You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Paperlibrary__Random__Pr...

133 lines
787 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[198,7,8,16],{"+NIl":function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){"use strict";Z.defineMode("stex",function(K,A){"use strict";function W(T,x){T.cmdState.push(x)}function M(T){return T.cmdState.length>0?T.cmdState[T.cmdState.length-1]:null}function P(T){var x=T.cmdState.pop();x&&x.closeBracket()}function U(T){for(var x=T.cmdState,S=x.length-1;S>=0;S--){var c=x[S];if(c.name=="DEFAULT")continue;return c}return{styleIdentifier:function(){return null}}}function k(T,x,S){return function(){this.name=T,this.bracketNo=0,this.style=x,this.styles=S,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=k("importmodule","tag",["string","builtin"]),R.documentclass=k("documentclass","tag",["","atom"]),R.usepackage=k("usepackage","tag",["atom"]),R.begin=k("begin","tag",["atom"]),R.end=k("end","tag",["atom"]),R.label=k("label","tag",["atom"]),R.ref=k("ref","tag",["atom"]),R.eqref=k("eqref","tag",["atom"]),R.cite=k("cite","tag",["atom"]),R.bibitem=k("bibitem","tag",["atom"]),R.Bibitem=k("Bibitem","tag",["atom"]),R.RBibitem=k("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(T,x){T.f=x}function g(T,x){var S;if(T.match(/^\\[a-zA-Z@]+/)){var c=T.current().slice(1);return S=R.hasOwnProperty(c)?R[c]:R.DEFAULT,S=new S,W(x,S),D(x,O),S.style}if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/\\]/))return"tag";if(T.match("\\["))return D(x,function(d,u){return b(d,u,"\\]")}),"keyword";if(T.match("\\("))return D(x,function(d,u){return b(d,u,"\\)")}),"keyword";if(T.match("$$"))return D(x,function(d,u){return b(d,u,"$$")}),"keyword";if(T.match("$"))return D(x,function(d,u){return b(d,u,"$")}),"keyword";var o=T.next();if(o=="%")return T.skipToEnd(),"comment";if(o=="}"||o=="]"){if(S=M(x),S)S.closeBracket(o),D(x,O);else return"error";return"bracket"}else return o=="{"||o=="["?(S=R.DEFAULT,S=new S,W(x,S),"bracket"):/\d/.test(o)?(T.eatWhile(/[\w.%]/),"atom"):(T.eatWhile(/[\w\-_]/),S=U(x),S.name=="begin"&&(S.argument=T.current()),S.styleIdentifier())}function b(T,x,S){if(T.eatSpace())return null;if(S&&T.match(S))return D(x,g),"keyword";if(T.match(/^\\[a-zA-Z@]+/))return"tag";if(T.match(/^[a-zA-Z]+/))return"variable-2";if(T.match(/^\\[$&%#{}_]/))return"tag";if(T.match(/^\\[,;!\/]/))return"tag";if(T.match(/^[\^_&]/))return"tag";if(T.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(T.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var c=T.next();return c=="{"||c=="}"||c=="["||c=="]"||c=="("||c==")"?"bracket":c=="%"?(T.skipToEnd(),"comment"):"error"}function O(T,x){var S=T.peek(),c;return S=="{"||S=="["?(c=M(x),c.openBracket(S),T.eat(S),D(x,g),"bracket"):/[ \t\r]/.test(S)?(T.eat(S),null):(D(x,g),P(x),g(T,x))}return{startState:function(){var T=A.inMathMode?function(x,S){return b(x,S)}:g;return{cmdState:[],f:T}},copyState:function(T){return{cmdState:T.cmdState.slice(),f:T.f}},token:function(T,x){return x.f(T,x)},blankLine:function(T){T.f=g,T.cmdState.length=0},lineComment:"%"}}),Z.defineMIME("text/x-stex","stex"),Z.defineMIME("text/x-latex","stex")})},"+yhJ":function(qe,Xe,$){qe.exports=$.p+"static/xixi.d492fb65.svg"},"0eGx":function(qe,Xe,$){qe.exports=$.p+"static/zhong.c1924b73.svg"},"19Vz":function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){Z.defineOption("placeholder","",function(k,R,D){var g=D&&D!=Z.Init;if(R&&!g)k.on("blur",M),k.on("change",P),k.on("swapDoc",P),Z.on(k.getInputField(),"compositionupdate",k.state.placeholderCompose=function(){W(k)}),P(k);else if(!R&&g){k.off("blur",M),k.off("change",P),k.off("swapDoc",P),Z.off(k.getInputField(),"compositionupdate",k.state.placeholderCompose),K(k);var b=k.getWrapperElement();b.className=b.className.replace(" CodeMirror-empty","")}R&&!k.hasFocus()&&M(k)});function K(k){k.state.placeholder&&(k.state.placeholder.parentNode.removeChild(k.state.placeholder),k.state.placeholder=null)}function A(k){K(k);var R=k.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=k.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var D=k.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),R.appendChild(D),k.display.lineSpace.insertBefore(R,k.display.lineSpace.firstChild)}function W(k){setTimeout(function(){var R=!1,D=k.getInputField();D.nodeName=="TEXTAREA"?R=!D.value:k.lineCount()==1&&(R=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),R?A(k):K(k)},20)}function M(k){U(k)&&A(k)}function P(k){var R=k.getWrapperElement(),D=U(k);R.className=R.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?A(k):K(k)}function U(k){return k.lineCount()===1&&k.getLine(0)===""}})},"1eCo":function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},A={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Z.defineMode("xml",function(W,M){var P=W.indentUnit,U={},k=M.htmlMode?K:A;for(var R in k)U[R]=k[R];for(var R in M)U[R]=M[R];var D,g;function b(a,E){function v(I){return E.tokenize=I,I(a,E)}var p=a.next();if(p=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?v(x("atom","]]>")):null:a.match("--")?v(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),v(S(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),E.tokenize=x("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",E.tokenize=O,"tag bracket");if(p=="&"){var L;return a.eat("#")?a.eat("x")?L=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):L=a.eatWhile(/[\d]/)&&a.eat(";"):L=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),L?"atom":"error"}else return a.eatWhile(/[^&<]/),null}b.isInText=!0;function O(a,E){var v=a.next();if(v==">"||v=="/"&&a.eat(">"))return E.tokenize=b,D=v==">"?"endTag":"selfcloseTag","tag bracket";if(v=="=")return D="equals",null;if(v=="<"){E.tokenize=b,E.state=u,E.tagName=E.tagStart=null;var p=E.tokenize(a,E);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(v)?(E.tokenize=T(v),E.stringStartCol=a.column(),E.tokenize(a,E)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function T(a){var E=function(v,p){for(;!v.eol();)if(v.next()==a){p.tokenize=O;break}return"string"};return E.isInAttribute=!0,E}function x(a,E){return function(v,p){for(;!v.eol();){if(v.match(E)){p.tokenize=b;break}v.next()}return a}}function S(a){return function(E,v){for(var p;(p=E.next())!=null;){if(p=="<")return v.tokenize=S(a+1),v.tokenize(E,v);if(p==">")if(a==1){v.tokenize=b;break}else return v.tokenize=S(a-1),v.tokenize(E,v)}return"meta"}}function c(a,E,v){this.prev=a.context,this.tagName=E,this.indent=a.indented,this.startOfLine=v,(U.doNotIndent.hasOwnProperty(E)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function d(a,E){for(var v;;){if(!a.context)return;if(v=a.context.tagName,!U.contextGrabbers.hasOwnProperty(v)||!U.contextGrabbers[v].hasOwnProperty(E))return;o(a)}}function u(a,E,v){return a=="openTag"?(v.tagStart=E.column(),w):a=="closeTag"?y:u}function w(a,E,v){return a=="word"?(v.tagName=E.current(),g="tag",_):U.allowMissingTagName&&a=="endTag"?(g="tag bracket",_(a,E,v)):(g="error",w)}function y(a,E,v){if(a=="word"){var p=E.current();return v.context&&v.context.tagName!=p&&U.implicitlyClosed.hasOwnProperty(v.context.tagName)&&o(v),v.context&&v.context.tagName==p||U.matchClosing===!1?(g="tag",m):(g="tag error",l)}else return U.allowMissingTagName&&a=="endTag"?(g="tag bracket",m(a,E,v)):(g="error",l)}function m(a,E,v){return a!="endTag"?(g="error",m):(o(v),u)}function l(a,E,v){return g="error",m(a,E,v)}function _(a,E,v){if(a=="word")return g="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var p=v.tagName,L=v.tagStart;return v.tagName=v.tagStart=null,a=="selfcloseTag"||U.autoSelfClosers.hasOwnProperty(p)?d(v,p):(d(v,p),v.context=new c(v,p,L==v.indented)),u}return g="error",_}function f(a,E,v){return a=="equals"?h:(U.allowMissing||(g="error"),_(a,E,v))}function h(a,E,v){return a=="string"?s:a=="word"&&U.allowUnquoted?(g="string",_):(g="error",_(a,E,v))}function s(a,E,v){return a=="string"?s:_(a,E,v)}return{startState:function(a){var E={tokenize:b,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(E.baseIndent=a),E},token:function(a,E){if(!E.tagName&&a.sol()&&(E.indented=a.indentation()),a.eatSpace())return null;D=null;var v=E.tokenize(a,E);return(v||D)&&v!="comment"&&(g=null,E.state=E.state(D||v,a,E),g&&(v=g=="error"?v+" error":g)),v},indent:function(a,E,v){var p=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+P;if(p&&p.noIndent)return Z.Pass;if(a.tokenize!=O&&a.tokenize!=b)return v?v.match(/^(\s*)/)[0].length:0;if(a.tagName)return U.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+P*(U.multilineTagIndentFactor||1);if(U.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var L=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(L&&L[1])for(;p;)if(p.tagName==L[2]){p=p.prev;break}else if(U.implicitlyClosed.hasOwnProperty(p.tagName))p=p.prev;else break;else if(L)for(;p;){var I=U.contextGrabbers[p.tagName];if(I&&I.hasOwnProperty(L[2]))p=p.prev;else break}for(;p&&p.prev&&!p.startOfLine;)p=p.prev;return p?p.indent+P:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:U.htmlMode?"html":"xml",helperType:U.htmlMode?"html":"xml",skipAttribute:function(a){a.state==h&&(a.state=_)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var E=[],v=a.context;v;v=v.prev)v.tagName&&E.push(v.tagName);return E.reverse()}}}),Z.defineMIME("text/xml","xml"),Z.defineMIME("application/xml","xml"),Z.mimeModes.hasOwnProperty("text/html")||Z.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"6+eU":function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return m});var Z=$("wx14"),K=$("rePB"),A=$("VTBJ"),W=$("1OyB"),M=$("vuIU"),P=$("Ji7U"),U=$("LK+K"),k=$("cDcd"),R=$.n(k),D=$("TSYQ"),g=$.n(D),b=function(_){var f,h="".concat(_.rootPrefixCls,"-item"),s=g()(h,"".concat(h,"-").concat(_.page),(f={},Object(K.a)(f,"".concat(h,"-active"),_.active),Object(K.a)(f,_.className,!!_.className),Object(K.a)(f,"".concat(h,"-disabled"),!_.page),f)),a=function(){_.onClick(_.page)},E=function(p){_.onKeyPress(p,_.onClick,_.page)};return R.a.createElement("li",{title:_.showTitle?_.page:null,className:s,onClick:a,onKeyPress:E,tabIndex:"0"},_.itemRender(_.page,"page",R.a.createElement("a",{rel:"nofollow"},_.page)))},O=b,T={ZERO:48,NINE:57,NUMPAD_ZERO:96,NUMPAD_NINE:105,BACKSPACE:8,DELETE:46,ENTER:13,ARROW_UP:38,ARROW_DOWN:40},x=function(l){Object(P.a)(f,l);var _=Object(U.a)(f);function f(){var h;Object(W.a)(this,f);for(var s=arguments.length,a=new Array(s),E=0;E<s;E++)a[E]=arguments[E];return h=_.call.apply(_,[this].concat(a)),h.state={goInputText:""},h.buildOptionText=function(v){return"".concat(v," ").concat(h.props.locale.items_per_page)},h.changeSize=function(v){h.props.changeSize(Number(v))},h.handleChange=function(v){h.setState({goInputText:v.target.value})},h.handleBlur=function(v){var p=h.props,L=p.goButton,I=p.quickGo,B=p.rootPrefixCls,z=h.state.goInputText;if(L||z==="")return;if(v.relatedTarget&&(v.relatedTarget.className.indexOf("".concat(B,"-prev"))>=0||v.relatedTarget.className.indexOf("".concat(B,"-next"))>=0))return;h.setState({goInputText:""}),I(h.getValidValue())},h.go=function(v){var p=h.state.goInputText;if(p==="")return;(v.keyCode===T.ENTER||v.type==="click")&&(h.setState({goInputText:""}),h.props.quickGo(h.getValidValue()))},h}return Object(M.a)(f,[{key:"getValidValue",value:function(){var s=this.state,a=s.goInputText,E=s.current;return!a||isNaN(a)?E:Number(a)}},{key:"getPageSizeOptions",value:function(){var s=this.props,a=s.pageSize,E=s.pageSizeOptions;return E.some(function(v){return v.toString()===a.toString()})?E:E.concat([a.toString()]).sort(function(v,p){var L=isNaN(Number(v))?0:Number(v),I=isNaN(Number(p))?0:Number(p);return L-I})}},{key:"render",value:function(){var s=this,a=this.props,E=a.pageSize,v=a.locale,p=a.rootPrefixCls,L=a.changeSize,I=a.quickGo,B=a.goButton,z=a.selectComponentClass,j=a.buildOptionText,F=a.selectPrefixCls,X=a.disabled,te=this.state.goInputText,ie="".concat(p,"-options"),le=z,_e=null,me=null,he=null;if(!L&&!I)return null;var fe=this.getPageSizeOptions();if(L&&le){var ce=fe.map(function(ne,q){return R.a.createElement(le.Option,{key:q,value:ne.toString()},(j||s.buildOptionText)(ne))});_e=R.a.createElement(le,{disabled:X,prefixCls:F,showSearch:!1,className:"".concat(ie,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(E||fe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(q){return q.parentNode}},ce)}return I&&(B&&(he=typeof B=="boolean"?R.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:X,className:"".concat(ie,"-quick-jumper-button")},v.jump_to_confirm):R.a.createElement("span",{onClick:this.go,onKeyUp:this.go},B)),me=R.a.createElement("div",{className:"".concat(ie,"-quick-jumper")},v.jump_to,R.a.createElement("input",{disabled:X,type:"text",value:te,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),v.page,he)),R.a.createElement("li",{className:"".concat(ie)},_e,me)}}]),f}(R.a.Component);x.defaultProps={pageSizeOptions:["10","20","50","100"]};var S=x,c=$("N2Kk");function o(){}function d(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}function u(l,_,f){return f}function w(l,_,f){var h=typeof l=="undefined"?_.pageSize:l;return Math.floor((f.total-1)/h)+1}var y=function(l){Object(P.a)(f,l);var _=Object(U.a)(f);function f(h){var s;Object(W.a)(this,f),s=_.call(this,h),s.getJumpPrevPage=function(){return Math.max(1,s.state.current-(s.props.showLessItems?3:5))},s.getJumpNextPage=function(){return Math.min(w(void 0,s.state,s.props),s.state.current+(s.props.showLessItems?3:5))},s.getItemIcon=function(L,I){var B=s.props.prefixCls,z=L||R.a.createElement("button",{type:"button","aria-label":I,className:"".concat(B,"-item-link")});return typeof L=="function"&&(z=R.a.createElement(L,Object(A.a)({},s.props))),z},s.savePaginationNode=function(L){s.paginationNode=L},s.isValid=function(L){return d(L)&&L!==s.state.current},s.shouldDisplayQuickJumper=function(){var L=s.props,I=L.showQuickJumper,B=L.pageSize,z=L.total;return z<=B?!1:I},s.handleKeyDown=function(L){(L.keyCode===T.ARROW_UP||L.keyCode===T.ARROW_DOWN)&&L.preventDefault()},s.handleKeyUp=function(L){var I=s.getValidValue(L),B=s.state.currentInputValue;I!==B&&s.setState({currentInputValue:I}),L.keyCode===T.ENTER?s.handleChange(I):L.keyCode===T.ARROW_UP?s.handleChange(I-1):L.keyCode===T.ARROW_DOWN&&s.handleChange(I+1)},s.changePageSize=function(L){var I=s.state.current,B=w(L,s.state,s.props);I=I>B?B:I,B===0&&(I=s.state.current),typeof L=="number"&&("pageSize"in s.props||s.setState({pageSize:L}),"current"in s.props||s.setState({current:I,currentInputValue:I})),s.props.onShowSizeChange(I,L),"onChange"in s.props&&s.props.onChange&&s.props.onChange(I,L)},s.handleChange=function(L){var I=s.props.disabled,B=L;if(s.isValid(B)&&!I){var z=w(void 0,s.state,s.props);B>z?B=z:B<1&&(B=1),"current"in s.props||s.setState({current:B,currentInputValue:B});var j=s.state.pageSize;return s.props.onChange(B,j),B}return s.state.current},s.prev=function(){s.hasPrev()&&s.handleChange(s.state.current-1)},s.next=function(){s.hasNext()&&s.handleChange(s.state.current+1)},s.jumpPrev=function(){s.handleChange(s.getJumpPrevPage())},s.jumpNext=function(){s.handleChange(s.getJumpNextPage())},s.hasPrev=function(){return s.state.current>1},s.hasNext=function(){return s.state.current<w(void 0,s.state,s.props)},s.runIfEnter=function(L,I){if(L.key==="Enter"||L.charCode===13){for(var B=arguments.length,z=new Array(B>2?B-2:0),j=2;j<B;j++)z[j-2]=arguments[j];I.apply(void 0,z)}},s.runIfEnterPrev=function(L){s.runIfEnter(L,s.prev)},s.runIfEnterNext=function(L){s.runIfEnter(L,s.next)},s.runIfEnterJumpPrev=function(L){s.runIfEnter(L,s.jumpPrev)},s.runIfEnterJumpNext=function(L){s.runIfEnter(L,s.jumpNext)},s.handleGoTO=function(L){(L.keyCode===T.ENTER||L.type==="click")&&s.handleChange(s.state.currentInputValue)};var a=h.onChange!==o,E="current"in h;E&&!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 v=h.defaultCurrent;"current"in h&&(v=h.current);var p=h.defaultPageSize;return"pageSize"in h&&(p=h.pageSize),v=Math.min(v,w(p,void 0,h)),s.state={current:v,currentInputValue:v,pageSize:p},s}return Object(M.a)(f,[{key:"componentDidUpdate",value:function(s,a){var E=this.props.prefixCls;if(a.current!==this.state.current&&this.paginationNode){var v=this.paginationNode.querySelector(".".concat(E,"-item-").concat(a.current));v&&document.activeElement===v&&v.blur()}}},{key:"getValidValue",value:function(s){var a=s.target.value,E=w(void 0,this.state,this.props),v=this.state.currentInputValue,p;return a===""?p=a:isNaN(Number(a))?p=v:a>=E?p=E:p=Number(a),p}},{key:"getShowSizeChanger",value:function(){var s=this.props,a=s.showSizeChanger,E=s.total,v=s.totalBoundaryShowSizeChanger;return typeof a!="undefined"?a:E>v}},{key:"renderPrev",value:function(s){var a=this.props,E=a.prevIcon,v=a.itemRender,p=v(s,"prev",this.getItemIcon(E,"prev page")),L=!this.hasPrev();return Object(k.isValidElement)(p)?Object(k.cloneElement)(p,{disabled:L}):p}},{key:"renderNext",value:function(s){var a=this.props,E=a.nextIcon,v=a.itemRender,p=v(s,"next",this.getItemIcon(E,"next page")),L=!this.hasNext();return Object(k.isValidElement)(p)?Object(k.cloneElement)(p,{disabled:L}):p}},{key:"render",value:function(){var s=this,a=this.props,E=a.prefixCls,v=a.className,p=a.style,L=a.disabled,I=a.hideOnSinglePage,B=a.total,z=a.locale,j=a.showQuickJumper,F=a.showLessItems,X=a.showTitle,te=a.showTotal,ie=a.simple,le=a.itemRender,_e=a.showPrevNextJumpers,me=a.jumpPrevIcon,he=a.jumpNextIcon,fe=a.selectComponentClass,ce=a.selectPrefixCls,ne=a.pageSizeOptions,q=this.state,ye=q.current,Fe=q.pageSize,Be=q.currentInputValue;if(I===!0&&B<=Fe)return null;var We=w(void 0,this.state,this.props),ze=[],we=null,Ae=null,Me=null,je=null,Ie=null,Oe=j&&j.goButton,Te=F?1:2,ct=ye-1>0?ye-1:0,rt=ye+1<We?ye+1:We,Ye=Object.keys(this.props).reduce(function(Y,Q){return(Q.substr(0,5)==="data-"||Q.substr(0,5)==="aria-"||Q==="role")&&(Y[Q]=s.props[Q]),Y},{});if(ie)return Oe&&(typeof Oe=="boolean"?Ie=R.a.createElement("button",{type:"button",onClick:this.handleGoTO,onKeyUp:this.handleGoTO},z.jump_to_confirm):Ie=R.a.createElement("span",{onClick:this.handleGoTO,onKeyUp:this.handleGoTO},Oe),Ie=R.a.createElement("li",{title:X?"".concat(z.jump_to).concat(ye,"/").concat(We):null,className:"".concat(E,"-simple-pager")},Ie)),R.a.createElement("ul",Object(Z.a)({className:g()(E,"".concat(E,"-simple"),Object(K.a)({},"".concat(E,"-disabled"),L),v),style:p,ref:this.savePaginationNode},Ye),R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterPrev,className:g()("".concat(E,"-prev"),Object(K.a)({},"".concat(E,"-disabled"),!this.hasPrev())),"aria-disabled":!this.hasPrev()},this.renderPrev(ct)),R.a.createElement("li",{title:X?"".concat(ye,"/").concat(We):null,className:"".concat(E,"-simple-pager")},R.a.createElement("input",{type:"text",value:Be,disabled:L,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleKeyUp,size:"3"}),R.a.createElement("span",{className:"".concat(E,"-slash")},"/"),We),R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:this.hasPrev()?0:null,onKeyPress:this.runIfEnterNext,className:g()("".concat(E,"-next"),Object(K.a)({},"".concat(E,"-disabled"),!this.hasNext())),"aria-disabled":!this.hasNext()},this.renderNext(rt)),Ie);if(We<=3+Te*2){var Ge={locale:z,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,showTitle:X,itemRender:le};We||ze.push(R.a.createElement(O,Object(Z.a)({},Ge,{key:"noPager",page:We,className:"".concat(E,"-disabled")})));for(var ot=1;ot<=We;ot+=1){var nt=ye===ot;ze.push(R.a.createElement(O,Object(Z.a)({},Ge,{key:ot,page:ot,active:nt})))}}else{var et=F?z.prev_3:z.prev_5,Ee=F?z.next_3:z.next_5;_e&&(we=R.a.createElement("li",{title:X?et:null,key:"prev",onClick:this.jumpPrev,tabIndex:"0",onKeyPress:this.runIfEnterJumpPrev,className:g()("".concat(E,"-jump-prev"),Object(K.a)({},"".concat(E,"-jump-prev-custom-icon"),!!me))},le(this.getJumpPrevPage(),"jump-prev",this.getItemIcon(me,"prev page"))),Ae=R.a.createElement("li",{title:X?Ee:null,key:"next",tabIndex:"0",onClick:this.jumpNext,onKeyPress:this.runIfEnterJumpNext,className:g()("".concat(E,"-jump-next"),Object(K.a)({},"".concat(E,"-jump-next-custom-icon"),!!he))},le(this.getJumpNextPage(),"jump-next",this.getItemIcon(he,"next page")))),je=R.a.createElement(O,{locale:z,last:!0,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:We,page:We,active:!1,showTitle:X,itemRender:le}),Me=R.a.createElement(O,{locale:z,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:1,page:1,active:!1,showTitle:X,itemRender:le});var it=Math.max(1,ye-Te),Ze=Math.min(ye+Te,We);ye-1<=Te&&(Ze=1+Te*2),We-ye<=Te&&(it=We-Te*2);for(var be=it;be<=Ze;be+=1){var De=ye===be;ze.push(R.a.createElement(O,{locale:z,rootPrefixCls:E,onClick:this.handleChange,onKeyPress:this.runIfEnter,key:be,page:be,active:De,showTitle:X,itemRender:le}))}ye-1>=Te*2&&ye!==1+2&&(ze[0]=Object(k.cloneElement)(ze[0],{className:"".concat(E,"-item-after-jump-prev")}),ze.unshift(we)),We-ye>=Te*2&&ye!==We-2&&(ze[ze.length-1]=Object(k.cloneElement)(ze[ze.length-1],{className:"".concat(E,"-item-before-jump-next")}),ze.push(Ae)),it!==1&&ze.unshift(Me),Ze!==We&&ze.push(je)}var ue=null;te&&(ue=R.a.createElement("li",{className:"".concat(E,"-total-text")},te(B,[B===0?0:(ye-1)*Fe+1,ye*Fe>B?B:ye*Fe])));var ae=!this.hasPrev()||!We,se=!this.hasNext()||!We;return R.a.createElement("ul",Object(Z.a)({className:g()(E,v,Object(K.a)({},"".concat(E,"-disabled"),L)),style:p,unselectable:"unselectable",ref:this.savePaginationNode},Ye),ue,R.a.createElement("li",{title:X?z.prev_page:null,onClick:this.prev,tabIndex:ae?null:0,onKeyPress:this.runIfEnterPrev,className:g()("".concat(E,"-prev"),Object(K.a)({},"".concat(E,"-disabled"),ae)),"aria-disabled":ae},this.renderPrev(ct)),ze,R.a.createElement("li",{title:X?z.next_page:null,onClick:this.next,tabIndex:se?null:0,onKeyPress:this.runIfEnterNext,className:g()("".concat(E,"-next"),Object(K.a)({},"".concat(E,"-disabled"),se)),"aria-disabled":se},this.renderNext(rt)),R.a.createElement(S,{disabled:L,locale:z,rootPrefixCls:E,selectComponentClass:fe,selectPrefixCls:ce,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:ye,pageSize:Fe,pageSizeOptions:ne,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Oe}))}}],[{key:"getDerivedStateFromProps",value:function(s,a){var E={};if("current"in s&&(E.current=s.current,s.current!==a.current&&(E.currentInputValue=E.current)),"pageSize"in s&&s.pageSize!==a.pageSize){var v=a.current,p=w(s.pageSize,a,s);v=v>p?p:v,"current"in s||(E.current=v,E.currentInputValue=v),E.pageSize=s.pageSize}return E}}]),f}(R.a.Component);y.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:o,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:o,locale:c.a,style:{},itemRender:u,totalBoundaryShowSizeChanger:50};var m=y},"6K3P":function(qe,Xe,$){qe.exports=$.p+"static/jinshi.9b74f304.svg"},"7Cbv":function(qe,Xe,$){"use strict";var Z=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function A(){if(!Z)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Z(K)}var W=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function M(O){return typeof O=="string"&&W.test(O)}for(var P=M,U=[],k=0;k<256;++k)U.push((k+256).toString(16).substr(1));function R(O){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(U[O[T+0]]+U[O[T+1]]+U[O[T+2]]+U[O[T+3]]+"-"+U[O[T+4]]+U[O[T+5]]+"-"+U[O[T+6]]+U[O[T+7]]+"-"+U[O[T+8]]+U[O[T+9]]+"-"+U[O[T+10]]+U[O[T+11]]+U[O[T+12]]+U[O[T+13]]+U[O[T+14]]+U[O[T+15]]).toLowerCase();if(!P(x))throw TypeError("Stringified UUID is invalid");return x}var D=R;function g(O,T,x){O=O||{};var S=O.random||(O.rng||A)();if(S[6]=S[6]&15|64,S[8]=S[8]&63|128,T){x=x||0;for(var c=0;c<16;++c)T[x+c]=S[c];return T}return D(S)}var b=Xe.a=g},"7ahc":function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return w});var Z=$("k1fw"),K=$("0Owb"),A=$("+L6B"),W=$("2/Rp"),M=$("y8nQ"),P=$("Vl3Y"),U=$("tJVT"),k=$("OaEy"),R=$("2fM7"),D=$("cDcd"),g=$.n(D),b=$("VrN/"),O=$.n(b),T=$("p77/"),x=$.n(T),S=$("c5Ni"),c=$.n(S),o=R.a.Option,d={labelCol:{span:4},wrapperCol:{span:20}},u={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"]};Xe.b=function(y){var m=y.callback,l=y.onCancel,_=Object(D.useState)("python"),f=Object(U.a)(_,2),h=f[0],s=f[1];function a(v){s(u[v][1])}function E(v){m(v)}return g.a.createElement(P.a,Object(K.a)({},d,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),g.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},g.a.createElement(R.a,{onChange:a},Object.keys(u).map(function(v){return g.a.createElement(o,{key:v,value:v},u[v][0])}))),g.a.createElement(P.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},g.a.createElement(w,{mode:h})),g.a.createElement("div",{className:"flex-container flex-end"},g.a.createElement(W.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),g.a.createElement(W.a,{type:"ghost",onClick:l},"\u53D6\u6D88")))};function w(y){var m=y.value,l=y.onChange,_=y.mode,f=y.options,h=f===void 0?{}:f,s=Object(D.useRef)(),a=Object(D.useState)(),E=Object(U.a)(a,2),v=E[0],p=E[1];return Object(D.useEffect)(function(){if(v){function L(I){var B=I.getValue();l&&l(B)}return v.on("change",L),function(){v.off("change",L)}}},[v,l]),Object(D.useEffect)(function(){v&&v.setOption("mode",_)},[v,_]),Object(D.useEffect)(function(){v&&((m!==v.getValue()||m==="")&&setTimeout(function(){v.setValue(m||" ")},300))},[v,m]),Object(D.useEffect)(function(){if(s.current&&!v){var L=O.a.fromTextArea(s.current,Object(Z.a)({mode:_,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));p(L)}},[s.current,v]),g.a.createElement("div",{className:"my-codemirror-container"},g.a.createElement("textarea",{ref:s}))}},"7ixt":function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return A});var Z={adjustX:1,adjustY:1},K=[0,0],A={left:{points:["cr","cl"],overflow:Z,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:Z,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:Z,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:Z,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:Z,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:Z,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:Z,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:Z,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:Z,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:Z,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:Z,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:Z,offset:[-4,0],targetOffset:K}},W=A},"7qnI":function(qe,Xe,$){"use strict";var Z=$("5Dmo"),K=$("3S7+"),A=$("fWQN"),W=$("mtLc"),M=$("yKVA"),P=$("879j"),U=$("5NDa"),k=$("5rEg"),R=$("cDcd"),D=$.n(R),g=$("O2Wb"),b=$.n(g),O=k.a.TextArea,T=function(x){Object(M.a)(c,x);var S=Object(P.a)(c);function c(){return Object(A.a)(this,c),S.apply(this,arguments)}return Object(W.a)(c,[{key:"render",value:function(){var d=this,u=this.props,w=u.index,y=u.onAnswerChange,m=u.addChildAnswer,l=u.exerciseIsPublish,_=u.answers,f=u.activeOptionErrorIndex,h=u.flex,s=h===void 0?"0 0 1000px":h;return D.a.createElement("div",{className:b.a.flex},D.a.createElement("div",{className:"".concat(b.a.color666," mb5 mt6"),style:{flex:"0 0 90px"}},"\u7B54\u6848(\u586B\u7A7A",w+1,"):"),D.a.createElement("div",{className:"".concat(b.a.flex," ").concat(b.a.flex1),style:{flexDirection:"column"}},_.map(function(a,E){var v="".concat(w,"-").concat(E);return D.a.createElement("div",{className:"".concat(b.a.flex," ").concat(b.a.flex1),key:E},D.a.createElement("div",{className:b.a.flex1,style:{flex:s}},D.a.createElement("div",null,D.a.createElement(O,{className:v===f?b.a.error:"",spellCheck:!1,rows:4,value:a||"",defaultValue:"\u8BF7\u8F93\u5165\u53C2\u8003\u7B54\u6848".concat(E==0?"":"(\u53EF\u9009)"),onChange:function(L){return y(w,E,L.target.value)},style:{minHeight:95}}))),!l&&D.a.createElement(D.a.Fragment,null,E!=0&&D.a.createElement(K.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(b.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswer(w,E)},style:{float:"right"}})),E===0&&D.a.createElement(K.a,{title:"\u5220\u9664"},D.a.createElement("i",{className:"".concat(b.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return d.props.deleteChildAnswermain(w,E)},style:{float:"right"}})),D.a.createElement(K.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},D.a.createElement("i",{className:"".concat(b.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return m(w)},style:{float:"right",visibility:E==_.length-1?"":"hidden"}}))))})))}}]),c}(R.Component);Xe.a=T},"8EBN":function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){"use strict";Z.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 K=0;K<Z.modeInfo.length;K++){var A=Z.modeInfo[K];A.mimes&&(A.mime=A.mimes[0])}Z.findModeByMIME=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.mime==W)return P;if(P.mimes){for(var U=0;U<P.mimes.length;U++)if(P.mimes[U]==W)return P}}if(/\+xml$/.test(W))return Z.findModeByMIME("application/xml");if(/\+json$/.test(W))return Z.findModeByMIME("application/json")},Z.findModeByExtension=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.ext){for(var U=0;U<P.ext.length;U++)if(P.ext[U]==W)return P}}},Z.findModeByFileName=function(W){for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.file&&P.file.test(W))return P}var U=W.lastIndexOf("."),k=U>-1&&W.substring(U+1,W.length);if(k)return Z.findModeByExtension(k)},Z.findModeByName=function(W){W=W.toLowerCase();for(var M=0;M<Z.modeInfo.length;M++){var P=Z.modeInfo[M];if(P.name.toLowerCase()==W)return P;if(P.alias){for(var U=0;U<P.alias.length;U++)if(P.alias[U].toLowerCase()==W)return P}}}})},"8hTe":function(qe,Xe,$){qe.exports={button:"button___1wy9m"}},"9Bee":function(qe,Xe,$){"use strict";var Z=$("DYRE"),K=$("zeV3"),A=$("+L6B"),W=$("2/Rp"),M=$("k1fw"),P=$("tJVT"),U=$("cDcd"),k=$.n(U),R=$("vg9a"),D=$("DlQD"),g=$.n(D),b=$("rUJ1");function O(he,fe){var ce=he.match(/^(\s+)(?:```)/);if(ce===null)return fe;var ne=ce[1];return fe.split(`
`).map(function(q){var ye=q.match(/^\s+/);if(ye===null)return q;var Fe=Object(P.a)(ye,1),Be=Fe[0];return Be.length>=ne.length?q.slice(ne.length):q}).join(`
`)}var T=[],x=["<ul>"],S=new g.a.Renderer,c=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){T.length=0,x=["<ul>"]}var d={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(he,fe,ce,ne){if(fe>=he.length||he[fe].level<=ce)return fe;var q=he[fe];ne.push("<li><a href='#"+q.anchor+"'>"+q.text+"</a>"),fe++;var ye=[];return fe=u(he,fe,q.level,ye),ye.length>0&&(ne.push("<ul>"),ye.forEach(function(Fe){ne.push(Fe)}),ne.push("</ul>")),ne.push("</li>"),fe=u(he,fe,ce,ne),fe}function w(){return u(T,0,0,x),x.push("</ul>"),x.join("")}var y={heading:function(fe){var ce=c.exec(fe);if(ce)return{type:"heading",raw:ce[0],depth:ce[1].length,text:ce[2]}},fences:function(fe){var ce=this.rules.block.fences.exec(fe);if(ce){var ne=ce[0],q=O(ne,ce[3]||""),ye=ce[2]?ce[2].trim():ce[2];if(["latex","katex","math"].indexOf(ye)>=0){var Fe=_(),Be=q;q=Fe,f[Fe]={type:"block",expression:Be}}return{type:"code",raw:ne,lang:ye,text:q}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,l=0,_=function(){return"__special_katext_id_".concat(l++,"__")},f={};function h(){return f}function s(){l=0,f={}}function a(he){return he=he.replace(m,function(fe,ce){var ne=_();return f[ne]={type:"inline",expression:ce},ne}),he}var E=S.listitem;S.listitem=function(he){return E(a(he))};var v=S.paragraph;S.paragraph=function(he){return v(a(he))};var p=S.tablecell;S.tablecell=function(he,fe){return p(a(he),fe)},S.code=function(he,fe,ce){var ne=(fe||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(fe,'">').concat(ce?he:Object(b.escape)(he,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(ce?he:Object(b.escape)(he,!0))+"</code></pre>"},S.heading=function(he,fe,ce){var ne=this.options.headerPrefix+ce.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return T.push({anchor:ne,level:fe,text:he}),"<h"+fe+' id="'+ne+'">'+he+"</h"+fe+">"},g.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),g.a.use({tokenizer:y,renderer:S});var L=g.a,I=$("SJMd"),B=$("ulZh"),z=$.n(B),j=$("m3rI"),F=$("Oy/b"),X=$("p5ED"),te=$("8hTe"),ie=$.n(te),le=/<pre[^>]*>/g;function _e(he){var fe=document.createElement("div");return fe.innerHTML=he,fe.childNodes.length===0?"":fe.childNodes[0].nodeValue}var me=Xe.a=function(he){var fe=he.value,ce=fe===void 0?"":fe,ne=he.edit,q=ne===void 0?!1:ne,ye=he.className,Fe=he.showTextOnly,Be=he.showLines,We=he.replaces,ze=he.zoomImg,we=he.hasMask,Ae=he.style,Me=Ae===void 0?{}:Ae,je=he.stylesPrev,Ie=je===void 0?{}:je,Oe=String(ce),Te=Object(U.useRef)(),ct=Object(U.useRef)(),rt=Object(U.useState)(""),Ye=Object(P.a)(rt,2),Ge=Ye[0],ot=Ye[1],nt=Object(U.useState)("office"),et=Object(P.a)(nt,2),Ee=et[0],it=et[1],Ze=Object(U.useMemo)(function(){try{var se=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Q=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Oe=Oe.replace(se,"("+j.a.API_SERVER+"/api/attachments/").replace(Y,'"'+j.a.API_SERVER+"/api/attachments/").replace(Q,'"'+j.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`)}catch(xe){}var J=L(Oe),ee=h();if(Oe.match(/\[TOC\]/)&&(J=J.replace("<p>[TOC]</p>",w()),o()),J=J.replace(/(__special_katext_id_\d+__)/g,function(xe,Re){var lt=ee[Re],st=lt.type,Le=lt.expression;return Object(F.renderToString)(_e(Le)||"",{displayMode:st==="block",throwOnError:!1,output:"html"})}),J=J.replace(/▁/g,"\u2581\u2581\u2581"),s(),Fe){var de=document.createElement("div");return de.innerHTML=J,de.innerText}return setTimeout(function(){return ue()},500),J},[Oe]),be=Object(U.useRef)();d.WebkitLineClamp=Be,Be&&(Me=Object(M.a)(Object(M.a)({},Me),d));function De(se){var Y=se.target;if(Y.tagName.toUpperCase()==="IMG"){if(ze){var Q=Y.getAttribute("src");ot(Q),it("image")}}else if(Y.tagName.toUpperCase()==="A"){var J=Y.getAttribute("href");if(J.indexOf("office")>-1)se.preventDefault(),ot(J),it("office");else if(J.indexOf("application/pdf")>-1)se.preventDefault(),ot(J),it("pdf");else if(J.indexOf("text/html")>-1)se.preventDefault(),ot(J),it("html");else if(J.startsWith("#")){se.preventDefault();var ee=document.getElementById(J.replace("#",""));ee&&ee.scrollIntoView(!0)}}}var ue=function(){var Y,Q=(Y=be.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");Q==null||Q.forEach(function(J){if(J.oncontextmenu=function(){return!1},J.src.indexOf(".m3u8")>-1&&!J.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var ee=new z.a;ee.loadSource(J.src),ee.attachMedia(J)}}})};Object(U.useEffect)(function(){if(be.current&&Ze&&(Ze.match(le)&&window.PR.prettyPrint()),be.current)return be.current.addEventListener("click",De),function(){be.current.removeEventListener("click",De),s(),o()}},[Ze,be.current,De]);var ae=function(Y){if(!q)return;Y.target.nodeName==="IMG"?(Te.current.style.display="flex",Te.current.style.width=Y.target.clientWidth+"px",Te.current.style.height=Y.target.clientHeight+"px",Te.current.style.top=Y.target.offsetTop+"px",Te.current.style.left=Y.target.offsetLeft+"px",ct.current.src=Y.target.getAttribute("src")):Te.current.style.display="none"};return k.a.createElement("div",{style:{position:"relative"}},k.a.createElement("div",{ref:be,style:Object(M.a)({},Me),className:"".concat(ye||""," markdown-body ").concat(ie.a.mdBody),onMouseOver:ae,dangerouslySetInnerHTML:{__html:Ze}}),k.a.createElement("div",{ref:Te,className:ie.a.button},k.a.createElement(K.a,null,k.a.createElement(W.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),k.a.createElement(W.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),k.a.createElement("img",{ref:ct,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),k.a.createElement(X.a,{close:!0,data:Ge,type:Ge!=null&&Ge.length?Ee:"",style:Object(M.a)({},Ie),onClose:function(){return ot("")}}))}},"9VGf":function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return A});var Z=$("cDcd"),K=$.n(Z);function A(W,M){var P=Object(Z.useRef)();Object(Z.useEffect)(function(){P.current=W}),Object(Z.useEffect)(function(){function U(){P.current()}if(M!==null){var k=setInterval(U,M);return function(){return clearInterval(k)}}},[M])}},Bd2K:function(qe,Xe,$){(function(Z){Z($("VrN/"),$("osHv"))})(function(Z){Z.defineOption("autoCloseTags",!1,function(R,D,g){if(g!=Z.Init&&g&&R.removeKeyMap("autoCloseTags"),!D)return;var b={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(b["'/'"]=function(O){return P(O)}),(typeof D!="object"||D.whenOpening!==!1)&&(b["'>'"]=function(O){return W(O)}),R.addKeyMap(b)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],A=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function W(R){if(R.getOption("disableInput"))return Z.Pass;for(var D=R.listSelections(),g=[],b=R.getOption("autoCloseTags"),O=0;O<D.length;O++){if(!D[O].empty())return Z.Pass;var T=D[O].head,x=R.getTokenAt(T),S=Z.innerMode(R.getMode(),x.state),c=S.state,o=S.mode.xmlCurrentTag&&S.mode.xmlCurrentTag(c),d=o&&o.name;if(!d)return Z.Pass;var u=S.mode.configuration=="html",w=typeof b=="object"&&b.dontCloseTags||u&&K,y=typeof b=="object"&&b.indentTags||u&&A;x.end>T.ch&&(d=d.slice(0,d.length-x.end+T.ch));var m=d.toLowerCase();if(!d||x.type=="string"&&(x.end!=T.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==T.ch-x.start-1||w&&U(w,m)>-1||k(R,S.mode.xmlCurrentContext&&S.mode.xmlCurrentContext(c)||[],d,T,!0))return Z.Pass;var l=typeof b=="object"&&b.emptyTags;if(l&&U(l,d)>-1){g[O]={text:"/>",newPos:Z.Pos(T.line,T.ch+2)};continue}var _=y&&U(y,m)>-1;g[O]={indent:_,text:">"+(_?`
`:"")+"</"+d+">",newPos:_?Z.Pos(T.line+1,0):Z.Pos(T.line,T.ch+1)}}for(var f=typeof b=="object"&&b.dontIndentOnAutoClose,O=D.length-1;O>=0;O--){var h=g[O];R.replaceRange(h.text,D[O].head,D[O].anchor,"+insert");var s=R.listSelections().slice(0);s[O]={head:h.newPos,anchor:h.newPos},R.setSelections(s),!f&&h.indent&&(R.indentLine(h.newPos.line,null,!0),R.indentLine(h.newPos.line+1,null,!0))}}function M(R,D){for(var g=R.listSelections(),b=[],O=D?"/":"</",T=R.getOption("autoCloseTags"),x=typeof T=="object"&&T.dontIndentOnSlash,S=0;S<g.length;S++){if(!g[S].empty())return Z.Pass;var c=g[S].head,o=R.getTokenAt(c),d=Z.innerMode(R.getMode(),o.state),u=d.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=c.ch-1))return Z.Pass;var w,y=d.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(y&&d.mode.name=="javascript")w=O+"script";else if(y&&d.mode.name=="css")w=O+"style";else{var m=d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(u);if(!m||m.length&&k(R,m,m[m.length-1],c))return Z.Pass;w=O+m[m.length-1]}R.getLine(c.line).charAt(o.end)!=">"&&(w+=">"),b[S]=w}if(R.replaceSelections(b),g=R.listSelections(),!x)for(var S=0;S<g.length;S++)(S==g.length-1||g[S].head.line<g[S+1].head.line)&&R.indentLine(g[S].head.line)}function P(R){return R.getOption("disableInput")?Z.Pass:M(R,!0)}Z.commands.closeTag=function(R){return M(R)};function U(R,D){if(R.indexOf)return R.indexOf(D);for(var g=0,b=R.length;g<b;++g)if(R[g]==D)return g;return-1}function k(R,D,g,b,O){if(!Z.scanForClosingTag)return!1;var T=Math.min(R.lastLine()+1,b.line+500),x=Z.scanForClosingTag(R,b,null,T);if(!x||x.tag!=g)return!1;for(var S=O?1:0,c=D.length-1;c>=0&&D[c]==g;c--)++S;b=x.to;for(var c=1;c<S;c++){var o=Z.scanForClosingTag(R,b,null,T);if(!o||o.tag!=g)return!1;b=o.to}return!0}})},BjJ7:function(qe,Xe,$){"use strict";$.d(Xe,"d",function(){return K}),$.d(Xe,"c",function(){return A}),$.d(Xe,"e",function(){return W}),$.d(Xe,"b",function(){return M}),$.d(Xe,"a",function(){return U});var Z=$("m3rI");function K(k){var R=!0;if(k.length>0){for(var D=0;D<k.length;D++)if(k[D].compile_success==0||!k[D].compile_success){R=!1;break}}else R=!1;return R}function A(k){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],g=0;g<k.length;g++){var b=k[g],O=R?"".concat(R,"/").concat(b.name):"".concat(b.name);D.push({title:b.name,isLeaf:!(b.type==="tree"),key:O})}return D}function W(k,R,D){for(var g=0;g<k.length;g++){var b=k[g];if(b.key===R){b.children=D;break}b.children&&W(b.children,R,D)}return k}function M(k,R,D){var g;return function(){var b=this,O=arguments,T=function(){g=null,D||k.apply(b,O)},x=D&&!g;clearTimeout(g),g=setTimeout(T,R),x&&k.apply(b,O)}}var P=!0,U=Z.a.API_SERVER},"C+DQ":function(qe,Xe,$){},D1Df:function(qe,Xe,$){"use strict";function Z(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Z=function(I){return typeof I}:Z=function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},Z(p)}function K(){return K=Object.assign||function(p){for(var L=1;L<arguments.length;L++){var I=arguments[L];for(var B in I)Object.prototype.hasOwnProperty.call(I,B)&&(p[B]=I[B])}return p},K.apply(this,arguments)}function A(p,L){var I=Object.keys(p);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(p);L&&(B=B.filter(function(z){return Object.getOwnPropertyDescriptor(p,z).enumerable})),I.push.apply(I,B)}return I}function W(p){for(var L=1;L<arguments.length;L++){var I=arguments[L]!=null?arguments[L]:{};L%2?A(I,!0).forEach(function(B){x(p,B,I[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(I)):A(I).forEach(function(B){Object.defineProperty(p,B,Object.getOwnPropertyDescriptor(I,B))})}return p}function M(p,L){if(p==null)return{};var I=P(p,L),B,z;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(p);for(z=0;z<j.length;z++){if(B=j[z],L.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,B))continue;I[B]=p[B]}}return I}function P(p,L){if(p==null)return{};var I={},B=Object.keys(p),z,j;for(j=0;j<B.length;j++){if(z=B[j],L.indexOf(z)>=0)continue;I[z]=p[z]}return I}function U(p,L){if(!(p instanceof L))throw new TypeError("Cannot call a class as a function")}function k(p,L){for(var I=0;I<L.length;I++){var B=L[I];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(p,B.key,B)}}function R(p,L,I){return L&&k(p.prototype,L),I&&k(p,I),p}function D(p,L){return L&&(Z(L)==="object"||typeof L=="function")?L:b(p)}function g(p){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(I){return I.__proto__||Object.getPrototypeOf(I)},g(p)}function b(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function O(p,L){if(typeof L!="function"&&L!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(L&&L.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),L&&T(p,L)}function T(p,L){return T=Object.setPrototypeOf||function(B,z){return B.__proto__=z,B},T(p,L)}function x(p,L,I){return L in p?Object.defineProperty(p,L,{value:I,enumerable:!0,configurable:!0,writable:!0}):p[L]=I,p}var S=$("cDcd"),c=$("17x9"),o=$("H38U"),d=$("aRTE");function u(p){for(var L="",I=0;I<p.length;I++){var B=p.charCodeAt(I);B<128?L+=String.fromCharCode(B):B<2048?(L+=String.fromCharCode(192|B>>6),L+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(L+=String.fromCharCode(224|B>>12),L+=String.fromCharCode(128|B>>6&63),L+=String.fromCharCode(128|B&63)):(I++,B=65536+((B&1023)<<10|p.charCodeAt(I)&1023),L+=String.fromCharCode(240|B>>18),L+=String.fromCharCode(128|B>>12&63),L+=String.fromCharCode(128|B>>6&63),L+=String.fromCharCode(128|B&63))}return L}var w={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},y={},m=4,l=.1;function _(p){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,I=[];return p.forEach(function(B,z){var j=null;B.forEach(function(F,X){if(!F&&j!==null){I.push("M".concat(j+L," ").concat(z+L,"h").concat(X-j,"v1H").concat(j+L,"z")),j=null;return}if(X===B.length-1){if(!F)return;j===null?I.push("M".concat(X+L,",").concat(z+L," h1v1H").concat(X+L,"z")):I.push("M".concat(j+L,",").concat(z+L," h").concat(X+1-j,"v1H").concat(j+L,"z"));return}F&&j===null&&(j=X)})}),I.join("")}function f(p,L){return p.slice().map(function(I,B){return B<L.y||B>=L.y+L.h?I:I.map(function(z,j){return j<L.x||j>=L.x+L.w?z:!1})})}function h(p,L){var I=p.imageSettings,B=p.size,z=p.includeMargin;if(I==null)return null;var j=z?m:0,F=L.length+j*2,X=Math.floor(B*l),te=F/B,ie=(I.width||X)*te,le=(I.height||X)*te,_e=I.x==null?L.length/2-ie/2:I.x*te,me=I.y==null?L.length/2-le/2:I.y*te,he=null;if(I.excavate){var fe=Math.floor(_e),ce=Math.floor(me),ne=Math.ceil(ie+_e-fe),q=Math.ceil(le+me-ce);he={x:fe,y:ce,w:ne,h:q}}return{x:_e,y:me,h:le,w:ie,excavation:he}}var s=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),a=function(p){O(L,p);function L(){var I,B;U(this,L);for(var z=arguments.length,j=new Array(z),F=0;F<z;F++)j[F]=arguments[F];return B=D(this,(I=g(L)).call.apply(I,[this].concat(j))),x(b(B),"_canvas",void 0),x(b(B),"_image",void 0),x(b(B),"state",{imgLoaded:!1}),x(b(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return R(L,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,te=B.fgColor,ie=B.includeMargin,le=B.imageSettings,_e=new o(-1,d[F]);if(_e.addData(u(z)),_e.make(),this._canvas!=null){var me=this._canvas,he=me.getContext("2d");if(!he)return;var fe=_e.modules;if(fe===null)return;var ce=ie?m:0,ne=fe.length+ce*2,q=h(this.props,fe);le!=null&&q!=null&&(q.excavation!=null&&(fe=f(fe,q.excavation)));var ye=window.devicePixelRatio||1;me.height=me.width=j*ye;var Fe=j/ne*ye;he.scale(Fe,Fe),he.fillStyle=X,he.fillRect(0,0,ne,ne),he.fillStyle=te,s?he.fill(new Path2D(_(fe,ce))):fe.forEach(function(Be,We){Be.forEach(function(ze,we){ze&&he.fillRect(we+ce,We+ce,1,1)})}),this.state.imgLoaded&&this._image&&q!=null&&he.drawImage(this._image,q.x+ce,q.y+ce,q.w,q.h)}}},{key:"render",value:function(){var B=this,z=this.props,j=z.value,F=z.size,X=z.level,te=z.bgColor,ie=z.fgColor,le=z.style,_e=z.includeMargin,me=z.imageSettings,he=M(z,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),fe=W({height:F,width:F},le),ce=null,ne=me&&me.src;return me!=null&&ne!=null&&(ce=S.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(ye){return B._image=ye}})),S.createElement(S.Fragment,null,S.createElement("canvas",K({style:fe,height:F,width:F,ref:function(ye){return B._canvas=ye}},he)),ce)}}]),L}(S.PureComponent);x(a,"defaultProps",w);var E=function(p){O(L,p);function L(){return U(this,L),D(this,g(L).apply(this,arguments))}return R(L,[{key:"render",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,te=B.fgColor,ie=B.includeMargin,le=B.imageSettings,_e=M(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),me=new o(-1,d[F]);me.addData(u(z)),me.make();var he=me.modules;if(he===null)return null;var fe=ie?m:0,ce=he.length+fe*2,ne=h(this.props,he),q=null;le!=null&&ne!=null&&(ne.excavation!=null&&(he=f(he,ne.excavation)),q=S.createElement("image",{xlinkHref:le.src,height:ne.h,width:ne.w,x:ne.x+fe,y:ne.y+fe,preserveAspectRatio:"none"}));var ye=_(he,fe);return S.createElement("svg",K({shapeRendering:"crispEdges",height:j,width:j,viewBox:"0 0 ".concat(ce," ").concat(ce)},_e),S.createElement("path",{fill:X,d:"M0,0 h".concat(ce,"v").concat(ce,"H0z")}),S.createElement("path",{fill:te,d:ye}),q)}}]),L}(S.PureComponent);x(E,"defaultProps",w);var v=function(L){var I=L.renderAs,B=M(L,["renderAs"]),z=I==="svg"?E:a;return S.createElement(z,B)};v.defaultProps=W({renderAs:"canvas"},w),qe.exports=v},DlQD:function(qe,Xe,$){(function(Z,K){qe.exports=K()})(this,function(){"use strict";function Z(ue,ae){for(var se=0;se<ae.length;se++){var Y=ae[se];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(ue,Y.key,Y)}}function K(ue,ae,se){return ae&&Z(ue.prototype,ae),se&&Z(ue,se),ue}function A(ue,ae){if(!ue)return;if(typeof ue=="string")return W(ue,ae);var se=Object.prototype.toString.call(ue).slice(8,-1);if(se==="Object"&&ue.constructor&&(se=ue.constructor.name),se==="Map"||se==="Set")return Array.from(ue);if(se==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(se))return W(ue,ae)}function W(ue,ae){(ae==null||ae>ue.length)&&(ae=ue.length);for(var se=0,Y=new Array(ae);se<ae;se++)Y[se]=ue[se];return Y}function M(ue,ae){var se;if(typeof Symbol=="undefined"||ue[Symbol.iterator]==null){if(Array.isArray(ue)||(se=A(ue))||ae&&ue&&typeof ue.length=="number"){se&&(ue=se);var Y=0;return function(){return Y>=ue.length?{done:!0}:{done:!1,value:ue[Y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return se=ue[Symbol.iterator](),se.next.bind(se)}function P(ue,ae){return ae={exports:{}},ue(ae,ae.exports),ae.exports}var U=P(function(ue){function ae(){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 se(Y){ue.exports.defaults=Y}ue.exports={defaults:ae(),getDefaults:ae,changeDefaults:se}}),k=U.defaults,R=U.getDefaults,D=U.changeDefaults,g=/[&<>"']/,b=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,T=/[<>"']|&(?!#?\w+;)/g,x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},S=function(ae){return x[ae]};function c(ue,ae){if(ae){if(g.test(ue))return ue.replace(b,S)}else if(O.test(ue))return ue.replace(T,S);return ue}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function d(ue){return ue.replace(o,function(ae,se){return se=se.toLowerCase(),se==="colon"?":":se.charAt(0)==="#"?se.charAt(1)==="x"?String.fromCharCode(parseInt(se.substring(2),16)):String.fromCharCode(+se.substring(1)):""})}var u=/(^|[^\[])\^/g;function w(ue,ae){ue=ue.source||ue,ae=ae||"";var se={replace:function(Q,J){return J=J.source||J,J=J.replace(u,"$1"),ue=ue.replace(Q,J),se},getRegex:function(){return new RegExp(ue,ae)}};return se}var y=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function l(ue,ae,se){if(ue){var Y;try{Y=decodeURIComponent(d(se)).replace(y,"").toLowerCase()}catch(Q){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ae&&!m.test(se)&&(se=a(ae,se));try{se=encodeURI(se).replace(/%25/g,"%")}catch(Q){return null}return se}var _={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ue,ae){_[" "+ue]||(f.test(ue)?_[" "+ue]=ue+"/":_[" "+ue]=L(ue,"/",!0)),ue=_[" "+ue];var se=ue.indexOf(":")===-1;return ae.substring(0,2)==="//"?se?ae:ue.replace(h,"$1")+ae:ae.charAt(0)==="/"?se?ae:ue.replace(s,"$1")+ae:ue+ae}var E={exec:function(){}};function v(ue){for(var ae=1,se,Y;ae<arguments.length;ae++){se=arguments[ae];for(Y in se)Object.prototype.hasOwnProperty.call(se,Y)&&(ue[Y]=se[Y])}return ue}function p(ue,ae){var se=ue.replace(/\|/g,function(J,ee,de){for(var xe=!1,Re=ee;--Re>=0&&de[Re]==="\\";)xe=!xe;return xe?"|":" |"}),Y=se.split(/ \|/),Q=0;if(Y.length>ae)Y.splice(ae);else for(;Y.length<ae;)Y.push("");for(;Q<Y.length;Q++)Y[Q]=Y[Q].trim().replace(/\\\|/g,"|");return Y}function L(ue,ae,se){var Y=ue.length;if(Y===0)return"";for(var Q=0;Q<Y;){var J=ue.charAt(Y-Q-1);if(J===ae&&!se)Q++;else if(J!==ae&&se)Q++;else break}return ue.substr(0,Y-Q)}function I(ue,ae){if(ue.indexOf(ae[1])===-1)return-1;for(var se=ue.length,Y=0,Q=0;Q<se;Q++)if(ue[Q]==="\\")Q++;else if(ue[Q]===ae[0])Y++;else if(ue[Q]===ae[1]&&(Y--,Y<0))return Q;return-1}function B(ue){ue&&ue.sanitize&&!ue.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:c,unescape:d,edit:w,cleanUrl:l,resolveUrl:a,noopTest:E,merge:v,splitCells:p,rtrim:L,findClosingBracket:I,checkSanitizeDeprecation:B},j=U.defaults,F=z.rtrim,X=z.splitCells,te=z.escape,ie=z.findClosingBracket;function le(ue,ae,se){var Y=ae.href,Q=ae.title?te(ae.title):null,J=ue[1].replace(/\\([\[\]])/g,"$1");return ue[0].charAt(0)!=="!"?{type:"link",raw:se,href:Y,title:Q,text:J}:{type:"image",raw:se,href:Y,title:Q,text:te(J)}}function _e(ue,ae){var se=ue.match(/^(\s+)(?:```)/);if(se===null)return ae;var Y=se[1];return ae.split(`
`).map(function(Q){var J=Q.match(/^\s+/);if(J===null)return Q;var ee=J[0];return ee.length>=Y.length?Q.slice(Y.length):Q}).join(`
`)}var me=function(){function ue(se){this.options=se||j}var ae=ue.prototype;return ae.space=function(Y){var Q=this.rules.block.newline.exec(Y);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
`}},ae.code=function(Y,Q){var J=this.rules.block.code.exec(Y);if(J){var ee=Q[Q.length-1];if(ee&&ee.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var de=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?de:F(de,`
`)}}},ae.fences=function(Y){var Q=this.rules.block.fences.exec(Y);if(Q){var J=Q[0],ee=_e(J,Q[3]||"");return{type:"code",raw:J,lang:Q[2]?Q[2].trim():Q[2],text:ee}}},ae.heading=function(Y){var Q=this.rules.block.heading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},ae.nptable=function(Y){var Q=this.rules.block.nptable.exec(Y);if(Q){var J={type:"table",header:X(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[],raw:Q[0]};if(J.header.length===J.align.length){var ee=J.align.length,de;for(de=0;de<ee;de++)/^ *-+: *$/.test(J.align[de])?J.align[de]="right":/^ *:-+: *$/.test(J.align[de])?J.align[de]="center":/^ *:-+ *$/.test(J.align[de])?J.align[de]="left":J.align[de]=null;for(ee=J.cells.length,de=0;de<ee;de++)J.cells[de]=X(J.cells[de],J.header.length);return J}}},ae.hr=function(Y){var Q=this.rules.block.hr.exec(Y);if(Q)return{type:"hr",raw:Q[0]}},ae.blockquote=function(Y){var Q=this.rules.block.blockquote.exec(Y);if(Q){var J=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:J}}},ae.list=function(Y){var Q=this.rules.block.list.exec(Y);if(Q){for(var J=Q[0],ee=Q[2],de=ee.length>1,xe=ee[ee.length-1]===")",Re={type:"list",raw:J,ordered:de,start:de?+ee.slice(0,-1):"",loose:!1,items:[]},lt=Q[0].match(this.rules.block.item),st=!1,Le,_t,Ue,Ve,Tt,ht,St,kt=lt.length,pt=0;pt<kt;pt++)Le=lt[pt],J=Le,_t=Le.length,Le=Le.replace(/^ *([*+-]|\d+[.)]) */,""),~Le.indexOf(`
`)&&(_t-=Le.length,Le=this.options.pedantic?Le.replace(/^ {1,4}/gm,""):Le.replace(new RegExp("^ {1,"+_t+"}","gm"),"")),pt!==kt-1&&(Ue=this.rules.block.bullet.exec(lt[pt+1])[0],(de?Ue.length===1||!xe&&Ue[Ue.length-1]===")":Ue.length>1||this.options.smartLists&&Ue!==ee)&&(Ve=lt.slice(pt+1).join(`
`),Re.raw=Re.raw.substring(0,Re.raw.length-Ve.length),pt=kt-1)),Tt=st||/\n\n(?!\s*$)/.test(Le),pt!==kt-1&&(st=Le.charAt(Le.length-1)===`
`,Tt||(Tt=st)),Tt&&(Re.loose=!0),ht=/^\[[ xX]\] /.test(Le),St=void 0,ht&&(St=Le[1]!==" ",Le=Le.replace(/^\[[ xX]\] +/,"")),Re.items.push({type:"list_item",raw:J,task:ht,checked:St,loose:Tt,text:Le});return Re}},ae.html=function(Y){var Q=this.rules.block.html.exec(Y);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):te(Q[0]):Q[0]}},ae.def=function(Y){var Q=this.rules.block.def.exec(Y);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var J=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:Q[0],href:Q[2],title:Q[3]}}},ae.table=function(Y){var Q=this.rules.block.table.exec(Y);if(Q){var J={type:"table",header:X(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
`):[]};if(J.header.length===J.align.length){J.raw=Q[0];var ee=J.align.length,de;for(de=0;de<ee;de++)/^ *-+: *$/.test(J.align[de])?J.align[de]="right":/^ *:-+: *$/.test(J.align[de])?J.align[de]="center":/^ *:-+ *$/.test(J.align[de])?J.align[de]="left":J.align[de]=null;for(ee=J.cells.length,de=0;de<ee;de++)J.cells[de]=X(J.cells[de].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ae.lheading=function(Y){var Q=this.rules.block.lheading.exec(Y);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},ae.paragraph=function(Y){var Q=this.rules.block.paragraph.exec(Y);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
`?Q[1].slice(0,-1):Q[1]}},ae.text=function(Y,Q){var J=this.rules.block.text.exec(Y);if(J){var ee=Q[Q.length-1];return ee&&ee.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ae.escape=function(Y){var Q=this.rules.inline.escape.exec(Y);if(Q)return{type:"escape",raw:Q[0],text:te(Q[1])}},ae.tag=function(Y,Q,J){var ee=this.rules.inline.tag.exec(Y);if(ee)return!Q&&/^<a /i.test(ee[0])?Q=!0:Q&&/^<\/a>/i.test(ee[0])&&(Q=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(ee[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ee[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:ee[0],inLink:Q,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):te(ee[0]):ee[0]}},ae.link=function(Y){var Q=this.rules.inline.link.exec(Y);if(Q){var J=ie(Q[2],"()");if(J>-1){var ee=Q[0].indexOf("!")===0?5:4,de=ee+Q[1].length+J;Q[2]=Q[2].substring(0,J),Q[0]=Q[0].substring(0,de).trim(),Q[3]=""}var xe=Q[2],Re="";if(this.options.pedantic){var lt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(xe);lt?(xe=lt[1],Re=lt[3]):Re=""}else Re=Q[3]?Q[3].slice(1,-1):"";xe=xe.trim().replace(/^<([\s\S]*)>$/,"$1");var st=le(Q,{href:xe&&xe.replace(this.rules.inline._escapes,"$1"),title:Re&&Re.replace(this.rules.inline._escapes,"$1")},Q[0]);return st}},ae.reflink=function(Y,Q){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var ee=(J[2]||J[1]).replace(/\s+/g," ");if(ee=Q[ee.toLowerCase()],!ee||!ee.href){var de=J[0].charAt(0);return{type:"text",raw:de,text:de}}var xe=le(J,ee,J[0]);return xe}},ae.strong=function(Y,Q,J){J===void 0&&(J="");var ee=this.rules.inline.strong.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){Q=Q.slice(-1*Y.length);var de=ee[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;de.lastIndex=0;for(var xe;(ee=de.exec(Q))!=null;)if(xe=this.rules.inline.strong.middle.exec(Q.slice(0,ee.index+3)),xe)return{type:"strong",raw:Y.slice(0,xe[0].length),text:Y.slice(2,xe[0].length-2)}}},ae.em=function(Y,Q,J){J===void 0&&(J="");var ee=this.rules.inline.em.start.exec(Y);if(ee&&(!ee[1]||ee[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){Q=Q.slice(-1*Y.length);var de=ee[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;de.lastIndex=0;for(var xe;(ee=de.exec(Q))!=null;)if(xe=this.rules.inline.em.middle.exec(Q.slice(0,ee.index+2)),xe)return{type:"em",raw:Y.slice(0,xe[0].length),text:Y.slice(1,xe[0].length-1)}}},ae.codespan=function(Y){var Q=this.rules.inline.code.exec(Y);if(Q){var J=Q[2].replace(/\n/g," "),ee=/[^ ]/.test(J),de=J.startsWith(" ")&&J.endsWith(" ");return ee&&de&&(J=J.substring(1,J.length-1)),J=te(J,!0),{type:"codespan",raw:Q[0],text:J}}},ae.br=function(Y){var Q=this.rules.inline.br.exec(Y);if(Q)return{type:"br",raw:Q[0]}},ae.del=function(Y){var Q=this.rules.inline.del.exec(Y);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},ae.autolink=function(Y,Q){var J=this.rules.inline.autolink.exec(Y);if(J){var ee,de;return J[2]==="@"?(ee=te(this.options.mangle?Q(J[1]):J[1]),de="mailto:"+ee):(ee=te(J[1]),de=ee),{type:"link",raw:J[0],text:ee,href:de,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.url=function(Y,Q){var J;if(J=this.rules.inline.url.exec(Y)){var ee,de;if(J[2]==="@")ee=te(this.options.mangle?Q(J[0]):J[0]),de="mailto:"+ee;else{var xe;do xe=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(xe!==J[0]);ee=te(J[0]),J[1]==="www."?de="http://"+ee:de=ee}return{type:"link",raw:J[0],text:ee,href:de,tokens:[{type:"text",raw:ee,text:ee}]}}},ae.inlineText=function(Y,Q,J){var ee=this.rules.inline.text.exec(Y);if(ee){var de;return Q?de=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ee[0]):te(ee[0]):ee[0]:de=te(this.options.smartypants?J(ee[0]):ee[0]),{type:"text",raw:ee[0],text:de}}},ue}(),he=z.noopTest,fe=z.edit,ce=z.merge,ne={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=fe(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=fe(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=fe(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=fe(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=fe(ne._paragraph).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.blockquote=fe(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=ce({},ne),ne.gfm=ce({},ne.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ne.gfm.nptable=fe(ne.gfm.nptable).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.gfm.table=fe(ne.gfm.table).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.pedantic=ce({},ne.normal,{html:fe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:he,paragraph:fe(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};q._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",q.punctuation=fe(q.punctuation).replace(/punctuation/g,q._punctuation).getRegex(),q._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",q._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",q.em.start=fe(q.em.start).replace(/punctuation/g,q._punctuation).getRegex(),q.em.middle=fe(q.em.middle).replace(/punctuation/g,q._punctuation).replace(/overlapSkip/g,q._overlapSkip).getRegex(),q.em.endAst=fe(q.em.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.em.endUnd=fe(q.em.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.start=fe(q.strong.start).replace(/punctuation/g,q._punctuation).getRegex(),q.strong.middle=fe(q.strong.middle).replace(/punctuation/g,q._punctuation).replace(/blockSkip/g,q._blockSkip).getRegex(),q.strong.endAst=fe(q.strong.endAst,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.strong.endUnd=fe(q.strong.endUnd,"g").replace(/punctuation/g,q._punctuation).getRegex(),q.blockSkip=fe(q._blockSkip,"g").getRegex(),q.overlapSkip=fe(q._overlapSkip,"g").getRegex(),q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,q._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])?)+(?![-_])/,q.autolink=fe(q.autolink).replace("scheme",q._scheme).replace("email",q._email).getRegex(),q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,q.tag=fe(q.tag).replace("comment",ne._comment).replace("attribute",q._attribute).getRegex(),q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,q.link=fe(q.link).replace("label",q._label).replace("href",q._href).replace("title",q._title).getRegex(),q.reflink=fe(q.reflink).replace("label",q._label).getRegex(),q.reflinkSearch=fe(q.reflinkSearch,"g").replace("reflink",q.reflink).replace("nolink",q.nolink).getRegex(),q.normal=ce({},q),q.pedantic=ce({},q.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:fe(/^!?\[(label)\]\((.*?)\)/).replace("label",q._label).getRegex(),reflink:fe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q._label).getRegex()}),q.gfm=ce({},q.normal,{escape:fe(q.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),q.gfm.url=fe(q.gfm.url,"i").replace("email",q.gfm._extended_email).getRegex(),q.breaks=ce({},q.gfm,{br:fe(q.br).replace("{2,}","*").getRegex(),text:fe(q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:ne,inline:q},Fe=U.defaults,Be=ye.block,We=ye.inline;function ze(ue){return ue.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function we(ue){var ae="",se,Y,Q=ue.length;for(se=0;se<Q;se++)Y=ue.charCodeAt(se),Math.random()>.5&&(Y="x"+Y.toString(16)),ae+="&#"+Y+";";return ae}var Ae=function(){function ue(se){this.tokens=[],this.tokens.links=Object.create(null),this.options=se||Fe,this.options.tokenizer=this.options.tokenizer||new me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:Be.normal,inline:We.normal};this.options.pedantic?(Y.block=Be.pedantic,Y.inline=We.pedantic):this.options.gfm&&(Y.block=Be.gfm,this.options.breaks?Y.inline=We.breaks:Y.inline=We.gfm),this.tokenizer.rules=Y}ue.lex=function(Y,Q){var J=new ue(Q);return J.lex(Y)};var ae=ue.prototype;return ae.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(Y,Q,J){Q===void 0&&(Q=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var ee,de,xe,Re;Y;){if(ee=this.tokenizer.space(Y)){Y=Y.substring(ee.raw.length),ee.type&&Q.push(ee);continue}if(ee=this.tokenizer.code(Y,Q)){Y=Y.substring(ee.raw.length),ee.type?Q.push(ee):(Re=Q[Q.length-1],Re.raw+=`
`+ee.raw,Re.text+=`
`+ee.text);continue}if(ee=this.tokenizer.fences(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.heading(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.nptable(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.hr(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.blockquote(Y)){Y=Y.substring(ee.raw.length),ee.tokens=this.blockTokens(ee.text,[],J),Q.push(ee);continue}if(ee=this.tokenizer.list(Y)){for(Y=Y.substring(ee.raw.length),xe=ee.items.length,de=0;de<xe;de++)ee.items[de].tokens=this.blockTokens(ee.items[de].text,[],!1);Q.push(ee);continue}if(ee=this.tokenizer.html(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(J&&(ee=this.tokenizer.def(Y))){Y=Y.substring(ee.raw.length),this.tokens.links[ee.tag]||(this.tokens.links[ee.tag]={href:ee.href,title:ee.title});continue}if(ee=this.tokenizer.table(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.lheading(Y)){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(J&&(ee=this.tokenizer.paragraph(Y))){Y=Y.substring(ee.raw.length),Q.push(ee);continue}if(ee=this.tokenizer.text(Y,Q)){Y=Y.substring(ee.raw.length),ee.type?Q.push(ee):(Re=Q[Q.length-1],Re.raw+=`
`+ee.raw,Re.text+=`
`+ee.text);continue}if(Y){var lt="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return Q},ae.inline=function(Y){var Q,J,ee,de,xe,Re,lt=Y.length;for(Q=0;Q<lt;Q++){Re=Y[Q];switch(Re.type){case"paragraph":case"text":case"heading":{Re.tokens=[],this.inlineTokens(Re.text,Re.tokens);break}case"table":{for(Re.tokens={header:[],cells:[]},de=Re.header.length,J=0;J<de;J++)Re.tokens.header[J]=[],this.inlineTokens(Re.header[J],Re.tokens.header[J]);for(de=Re.cells.length,J=0;J<de;J++)for(xe=Re.cells[J],Re.tokens.cells[J]=[],ee=0;ee<xe.length;ee++)Re.tokens.cells[J][ee]=[],this.inlineTokens(xe[ee],Re.tokens.cells[J][ee]);break}case"blockquote":{this.inline(Re.tokens);break}case"list":{for(de=Re.items.length,J=0;J<de;J++)this.inline(Re.items[J].tokens);break}}}return Y},ae.inlineTokens=function(Y,Q,J,ee,de){Q===void 0&&(Q=[]),J===void 0&&(J=!1),ee===void 0&&(ee=!1),de===void 0&&(de="");var xe,Re=Y,lt;if(this.tokens.links){var st=Object.keys(this.tokens.links);if(st.length>0)for(;(lt=this.tokenizer.rules.inline.reflinkSearch.exec(Re))!=null;)st.includes(lt[0].slice(lt[0].lastIndexOf("[")+1,-1))&&(Re=Re.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+Re.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(lt=this.tokenizer.rules.inline.blockSkip.exec(Re))!=null;)Re=Re.slice(0,lt.index)+"["+"a".repeat(lt[0].length-2)+"]"+Re.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(xe=this.tokenizer.escape(Y)){Y=Y.substring(xe.raw.length),Q.push(xe);continue}if(xe=this.tokenizer.tag(Y,J,ee)){Y=Y.substring(xe.raw.length),J=xe.inLink,ee=xe.inRawBlock,Q.push(xe);continue}if(xe=this.tokenizer.link(Y)){Y=Y.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,ee)),Q.push(xe);continue}if(xe=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(xe.raw.length),xe.type==="link"&&(xe.tokens=this.inlineTokens(xe.text,[],!0,ee)),Q.push(xe);continue}if(xe=this.tokenizer.strong(Y,Re,de)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],J,ee),Q.push(xe);continue}if(xe=this.tokenizer.em(Y,Re,de)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],J,ee),Q.push(xe);continue}if(xe=this.tokenizer.codespan(Y)){Y=Y.substring(xe.raw.length),Q.push(xe);continue}if(xe=this.tokenizer.br(Y)){Y=Y.substring(xe.raw.length),Q.push(xe);continue}if(xe=this.tokenizer.del(Y)){Y=Y.substring(xe.raw.length),xe.tokens=this.inlineTokens(xe.text,[],J,ee),Q.push(xe);continue}if(xe=this.tokenizer.autolink(Y,we)){Y=Y.substring(xe.raw.length),Q.push(xe);continue}if(!J&&(xe=this.tokenizer.url(Y,we))){Y=Y.substring(xe.raw.length),Q.push(xe);continue}if(xe=this.tokenizer.inlineText(Y,ee,ze)){Y=Y.substring(xe.raw.length),de=xe.raw.slice(-1),Q.push(xe);continue}if(Y){var Le="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Le);break}else throw new Error(Le)}}return Q},K(ue,null,[{key:"rules",get:function(){return{block:Be,inline:We}}}]),ue}(),Me=U.defaults,je=z.cleanUrl,Ie=z.escape,Oe=function(){function ue(se){this.options=se||Me}var ae=ue.prototype;return ae.code=function(Y,Q,J){var ee=(Q||"").match(/\S*/)[0];if(this.options.highlight){var de=this.options.highlight(Y,ee);de!=null&&de!==Y&&(J=!0,Y=de)}return ee?'<pre><code class="'+this.options.langPrefix+Ie(ee,!0)+'">'+(J?Y:Ie(Y,!0))+`</code></pre>
`:"<pre><code>"+(J?Y:Ie(Y,!0))+`</code></pre>
`},ae.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},ae.html=function(Y){return Y},ae.heading=function(Y,Q,J,ee){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+ee.slug(J)+'">'+Y+"</h"+Q+`>
`:"<h"+Q+">"+Y+"</h"+Q+`>
`},ae.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ae.list=function(Y,Q,J){var ee=Q?"ol":"ul",de=Q&&J!==1?' start="'+J+'"':"";return"<"+ee+de+`>
`+Y+"</"+ee+`>
`},ae.listitem=function(Y){return"<li>"+Y+`</li>
`},ae.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(Y){return"<p>"+Y+`</p>
`},ae.table=function(Y,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+Q+`</table>
`},ae.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},ae.tablecell=function(Y,Q){var J=Q.header?"th":"td",ee=Q.align?"<"+J+' align="'+Q.align+'">':"<"+J+">";return ee+Y+"</"+J+`>
`},ae.strong=function(Y){return"<strong>"+Y+"</strong>"},ae.em=function(Y){return"<em>"+Y+"</em>"},ae.codespan=function(Y){return"<code>"+Y+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(Y){return"<del>"+Y+"</del>"},ae.link=function(Y,Q,J){if(Y=je(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<a href="'+Ie(Y)+'"';return Q&&(ee+=' title="'+Q+'"'),ee+=">"+J+"</a>",ee},ae.image=function(Y,Q,J){if(Y=je(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var ee='<img src="'+Y+'" alt="'+J+'"';return Q&&(ee+=' title="'+Q+'"'),ee+=this.options.xhtml?"/>":">",ee},ae.text=function(Y){return Y},ue}(),Te=function(){function ue(){}var ae=ue.prototype;return ae.strong=function(Y){return Y},ae.em=function(Y){return Y},ae.codespan=function(Y){return Y},ae.del=function(Y){return Y},ae.html=function(Y){return Y},ae.text=function(Y){return Y},ae.link=function(Y,Q,J){return""+J},ae.image=function(Y,Q,J){return""+J},ae.br=function(){return""},ue}(),ct=function(){function ue(){this.seen={}}var ae=ue.prototype;return ae.slug=function(Y){var Q=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var J=Q;do this.seen[J]++,Q=J+"-"+this.seen[J];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},ue}(),rt=U.defaults,Ye=z.unescape,Ge=function(){function ue(se){this.options=se||rt,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Te,this.slugger=new ct}ue.parse=function(Y,Q){var J=new ue(Q);return J.parse(Y)};var ae=ue.prototype;return ae.parse=function(Y,Q){Q===void 0&&(Q=!0);var J="",ee,de,xe,Re,lt,st,Le,_t,Ue,Ve,Tt,ht,St,kt,pt,Bt,Ot,Pt,Ft=Y.length;for(ee=0;ee<Ft;ee++){Ve=Y[ee];switch(Ve.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(Ve.tokens),Ve.depth,Ye(this.parseInline(Ve.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(Ve.text,Ve.lang,Ve.escaped);continue}case"table":{for(_t="",Le="",Re=Ve.header.length,de=0;de<Re;de++)Le+=this.renderer.tablecell(this.parseInline(Ve.tokens.header[de]),{header:!0,align:Ve.align[de]});for(_t+=this.renderer.tablerow(Le),Ue="",Re=Ve.cells.length,de=0;de<Re;de++){for(st=Ve.tokens.cells[de],Le="",lt=st.length,xe=0;xe<lt;xe++)Le+=this.renderer.tablecell(this.parseInline(st[xe]),{header:!1,align:Ve.align[xe]});Ue+=this.renderer.tablerow(Le)}J+=this.renderer.table(_t,Ue);continue}case"blockquote":{Ue=this.parse(Ve.tokens),J+=this.renderer.blockquote(Ue);continue}case"list":{for(Tt=Ve.ordered,ht=Ve.start,St=Ve.loose,Re=Ve.items.length,Ue="",de=0;de<Re;de++)pt=Ve.items[de],Bt=pt.checked,Ot=pt.task,kt="",pt.task&&(Pt=this.renderer.checkbox(Bt),St?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Pt+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=Pt+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Pt}):kt+=Pt),kt+=this.parse(pt.tokens,St),Ue+=this.renderer.listitem(kt,Ot,Bt);J+=this.renderer.list(Ue,Tt,ht);continue}case"html":{J+=this.renderer.html(Ve.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(Ve.tokens));continue}case"text":{for(Ue=Ve.tokens?this.parseInline(Ve.tokens):Ve.text;ee+1<Ft&&Y[ee+1].type==="text";)Ve=Y[++ee],Ue+=`
`+(Ve.tokens?this.parseInline(Ve.tokens):Ve.text);J+=Q?this.renderer.paragraph(Ue):Ue;continue}default:{var It='Token with "'+Ve.type+'" type was not found.';if(this.options.silent){console.error(It);return}else throw new Error(It)}}}return J},ae.parseInline=function(Y,Q){Q=Q||this.renderer;var J="",ee,de,xe=Y.length;for(ee=0;ee<xe;ee++){de=Y[ee];switch(de.type){case"escape":{J+=Q.text(de.text);break}case"html":{J+=Q.html(de.text);break}case"link":{J+=Q.link(de.href,de.title,this.parseInline(de.tokens,Q));break}case"image":{J+=Q.image(de.href,de.title,de.text);break}case"strong":{J+=Q.strong(this.parseInline(de.tokens,Q));break}case"em":{J+=Q.em(this.parseInline(de.tokens,Q));break}case"codespan":{J+=Q.codespan(de.text);break}case"br":{J+=Q.br();break}case"del":{J+=Q.del(this.parseInline(de.tokens,Q));break}case"text":{J+=Q.text(de.text);break}default:{var Re='Token with "'+de.type+'" type was not found.';if(this.options.silent){console.error(Re);return}else throw new Error(Re)}}}return J},ue}(),ot=z.merge,nt=z.checkSanitizeDeprecation,et=z.escape,Ee=U.getDefaults,it=U.changeDefaults,Ze=U.defaults;function be(ue,ae,se){if(typeof ue=="undefined"||ue===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ue!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ue)+", string expected");if(typeof ae=="function"&&(se=ae,ae=null),ae=ot({},be.defaults,ae||{}),nt(ae),se){var Y=ae.highlight,Q;try{Q=Ae.lex(ue,ae)}catch(xe){return se(xe)}var J=function(Re){var lt;if(!Re)try{lt=Ge.parse(Q,ae)}catch(st){Re=st}return ae.highlight=Y,Re?se(Re):se(null,lt)};if(!Y||Y.length<3)return J();if(delete ae.highlight,!Q.length)return J();var ee=0;be.walkTokens(Q,function(xe){xe.type==="code"&&(ee++,setTimeout(function(){Y(xe.text,xe.lang,function(Re,lt){if(Re)return J(Re);lt!=null&&lt!==xe.text&&(xe.text=lt,xe.escaped=!0),ee--,ee===0&&J()})},0))}),ee===0&&J();return}try{var de=Ae.lex(ue,ae);return ae.walkTokens&&be.walkTokens(de,ae.walkTokens),Ge.parse(de,ae)}catch(xe){if(xe.message+=`
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+et(xe.message+"",!0)+"</pre>";throw xe}}be.options=be.setOptions=function(ue){return ot(be.defaults,ue),it(be.defaults),be},be.getDefaults=Ee,be.defaults=Ze,be.use=function(ue){var ae=ot({},ue);if(ue.renderer&&function(){var Y=be.defaults.renderer||new Oe,Q=function(de){var xe=Y[de];Y[de]=function(){for(var Re=arguments.length,lt=new Array(Re),st=0;st<Re;st++)lt[st]=arguments[st];var Le=ue.renderer[de].apply(Y,lt);return Le===!1&&(Le=xe.apply(Y,lt)),Le}};for(var J in ue.renderer)Q(J);ae.renderer=Y}(),ue.tokenizer&&function(){var Y=be.defaults.tokenizer||new me,Q=function(de){var xe=Y[de];Y[de]=function(){for(var Re=arguments.length,lt=new Array(Re),st=0;st<Re;st++)lt[st]=arguments[st];var Le=ue.tokenizer[de].apply(Y,lt);return Le===!1&&(Le=xe.apply(Y,lt)),Le}};for(var J in ue.tokenizer)Q(J);ae.tokenizer=Y}(),ue.walkTokens){var se=be.defaults.walkTokens;ae.walkTokens=function(Y){ue.walkTokens(Y),se&&se(Y)}}be.setOptions(ae)},be.walkTokens=function(ue,ae){for(var se=M(ue),Y;!(Y=se()).done;){var Q=Y.value;ae(Q);switch(Q.type){case"table":{for(var J=M(Q.tokens.header),ee;!(ee=J()).done;){var de=ee.value;be.walkTokens(de,ae)}for(var xe=M(Q.tokens.cells),Re;!(Re=xe()).done;)for(var lt=Re.value,st=M(lt),Le;!(Le=st()).done;){var _t=Le.value;be.walkTokens(_t,ae)}break}case"list":{be.walkTokens(Q.items,ae);break}default:Q.tokens&&be.walkTokens(Q.tokens,ae)}}},be.Parser=Ge,be.parser=Ge.parse,be.Renderer=Oe,be.TextRenderer=Te,be.Lexer=Ae,be.lexer=Ae.lex,be.Tokenizer=me,be.Slugger=ct,be.parse=be;var De=be;return De})},ELLl:function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},A=Z.Pos;Z.defineOption("autoCloseBrackets",!1,function(x,S,c){c&&c!=Z.Init&&(x.removeKeyMap(M),x.state.closeBrackets=null),S&&(P(W(S,"pairs")),x.state.closeBrackets=S,x.addKeyMap(M))});function W(x,S){return S=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[S]!=null?x[S]:K[S]}var M={Backspace:R,Enter:D};function P(x){for(var S=0;S<x.length;S++){var c=x.charAt(S),o="'"+c+"'";M[o]||(M[o]=U(c))}}P(K.pairs+"`");function U(x){return function(S){return b(S,x)}}function k(x){var S=x.state.closeBrackets;if(!S||S.override)return S;var c=x.getModeAt(x.getCursor());return c.closeBrackets||S}function R(x){var S=k(x);if(!S||x.getOption("disableInput"))return Z.Pass;for(var c=W(S,"pairs"),o=x.listSelections(),d=0;d<o.length;d++){if(!o[d].empty())return Z.Pass;var u=O(x,o[d].head);if(!u||c.indexOf(u)%2!=0)return Z.Pass}for(var d=o.length-1;d>=0;d--){var w=o[d].head;x.replaceRange("",A(w.line,w.ch-1),A(w.line,w.ch+1),"+delete")}}function D(x){var S=k(x),c=S&&W(S,"explode");if(!c||x.getOption("disableInput"))return Z.Pass;for(var o=x.listSelections(),d=0;d<o.length;d++){if(!o[d].empty())return Z.Pass;var u=O(x,o[d].head);if(!u||c.indexOf(u)%2!=0)return Z.Pass}x.operation(function(){var w=x.lineSeparator()||`
`;x.replaceSelection(w+w,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var y=0;y<o.length;y++){var m=o[y].head.line;x.indentLine(m,null,!0),x.indentLine(m+1,null,!0)}})}function g(x){var S=Z.cmpPos(x.anchor,x.head)>0;return{anchor:new A(x.anchor.line,x.anchor.ch+(S?-1:1)),head:new A(x.head.line,x.head.ch+(S?1:-1))}}function b(x,S){var c=k(x);if(!c||x.getOption("disableInput"))return Z.Pass;var o=W(c,"pairs"),d=o.indexOf(S);if(d==-1)return Z.Pass;for(var u=W(c,"closeBefore"),w=W(c,"triples"),y=o.charAt(d+1)==S,m=x.listSelections(),l=d%2==0,_,f=0;f<m.length;f++){var h=m[f],s=h.head,a,E=x.getRange(s,A(s.line,s.ch+1));if(l&&!h.empty())a="surround";else if((y||!l)&&E==S)y&&T(x,s)?a="both":w.indexOf(S)>=0&&x.getRange(s,A(s.line,s.ch+3))==S+S+S?a="skipThree":a="skip";else if(y&&s.ch>1&&w.indexOf(S)>=0&&x.getRange(A(s.line,s.ch-2),s)==S+S){if(s.ch>2&&/\bstring/.test(x.getTokenTypeAt(A(s.line,s.ch-2))))return Z.Pass;a="addFour"}else if(y){var v=s.ch==0?" ":x.getRange(A(s.line,s.ch-1),s);if(!Z.isWordChar(E)&&v!=S&&!Z.isWordChar(v))a="both";else return Z.Pass}else if(l&&(E.length===0||/\s/.test(E)||u.indexOf(E)>-1))a="both";else return Z.Pass;if(!_)_=a;else if(_!=a)return Z.Pass}var p=d%2?o.charAt(d-1):S,L=d%2?S:o.charAt(d+1);x.operation(function(){if(_=="skip")x.execCommand("goCharRight");else if(_=="skipThree")for(var I=0;I<3;I++)x.execCommand("goCharRight");else if(_=="surround"){for(var B=x.getSelections(),I=0;I<B.length;I++)B[I]=p+B[I]+L;x.replaceSelections(B,"around"),B=x.listSelections().slice();for(var I=0;I<B.length;I++)B[I]=g(B[I]);x.setSelections(B)}else _=="both"?(x.replaceSelection(p+L,null),x.triggerElectric(p+L),x.execCommand("goCharLeft")):_=="addFour"&&(x.replaceSelection(p+p+p+p,"before"),x.execCommand("goCharRight"))})}function O(x,S){var c=x.getRange(A(S.line,S.ch-1),A(S.line,S.ch+1));return c.length==2?c:null}function T(x,S){var c=x.getTokenAt(A(S.line,S.ch+1));return/\bstring/.test(c.type)&&c.start==S.ch&&(S.ch==0||!/\bstring/.test(x.getTokenTypeAt(S)))}})},FIWC:function(qe,Xe,$){qe.exports={flex_box_center:"flex_box_center___gdHkq",flex_space_between:"flex_space_between___lk_Gv",flex_box_vertical_center:"flex_box_vertical_center___2WNVo",flex_box_center_end:"flex_box_center_end___13O11",flex_box_column:"flex_box_column___kMb8L",wrap:"wrap___1y6rg",crumbs:"crumbs___1vKDo"}},Gytx:function(qe,Xe){qe.exports=function(Z,K,A,W){var M=A?A.call(W,Z,K):void 0;if(M!==void 0)return!!M;if(Z===K)return!0;if(typeof Z!="object"||!Z||typeof K!="object"||!K)return!1;var P=Object.keys(Z),U=Object.keys(K);if(P.length!==U.length)return!1;for(var k=Object.prototype.hasOwnProperty.bind(K),R=0;R<P.length;R++){var D=P[R];if(!k(D))return!1;var g=Z[D],b=K[D];if(M=A?A.call(W,g,b,D):void 0,M===!1||M===void 0&&g!==b)return!1}return!0}},H38U:function(qe,Xe,$){var Z=$("f4xo"),K=$("rcnY"),A=$("wU8J"),W=$("Iq15"),M=$("dWSS");function P(k,R){this.typeNumber=k,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var U=P.prototype;U.addData=function(k){var R=new Z(k);this.dataList.push(R),this.dataCache=null},U.isDark=function(k,R){if(k<0||this.moduleCount<=k||R<0||this.moduleCount<=R)throw new Error(k+","+R);return this.modules[k][R]},U.getModuleCount=function(){return this.moduleCount},U.make=function(){if(this.typeNumber<1){var k=1;for(k=1;k<40;k++){for(var R=K.getRSBlocks(k,this.errorCorrectLevel),D=new A,g=0,b=0;b<R.length;b++)g+=R[b].dataCount;for(var b=0;b<this.dataList.length;b++){var O=this.dataList[b];D.put(O.mode,4),D.put(O.getLength(),W.getLengthInBits(O.mode,k)),O.write(D)}if(D.getLengthInBits()<=g*8)break}this.typeNumber=k}this.makeImpl(!1,this.getBestMaskPattern())},U.makeImpl=function(k,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var D=0;D<this.moduleCount;D++){this.modules[D]=new Array(this.moduleCount);for(var g=0;g<this.moduleCount;g++)this.modules[D][g]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(k,R),this.typeNumber>=7&&this.setupTypeNumber(k),this.dataCache==null&&(this.dataCache=P.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},U.setupPositionProbePattern=function(k,R){for(var D=-1;D<=7;D++){if(k+D<=-1||this.moduleCount<=k+D)continue;for(var g=-1;g<=7;g++){if(R+g<=-1||this.moduleCount<=R+g)continue;0<=D&&D<=6&&(g==0||g==6)||0<=g&&g<=6&&(D==0||D==6)||2<=D&&D<=4&&2<=g&&g<=4?this.modules[k+D][R+g]=!0:this.modules[k+D][R+g]=!1}}},U.getBestMaskPattern=function(){for(var k=0,R=0,D=0;D<8;D++){this.makeImpl(!0,D);var g=W.getLostPoint(this);(D==0||k>g)&&(k=g,R=D)}return R},U.createMovieClip=function(k,R,D){var g=k.createEmptyMovieClip(R,D),b=1;this.make();for(var O=0;O<this.modules.length;O++)for(var T=O*b,x=0;x<this.modules[O].length;x++){var S=x*b,c=this.modules[O][x];c&&(g.beginFill(0,100),g.moveTo(S,T),g.lineTo(S+b,T),g.lineTo(S+b,T+b),g.lineTo(S,T+b),g.endFill())}return g},U.setupTimingPattern=function(){for(var k=8;k<this.moduleCount-8;k++){if(this.modules[k][6]!=null)continue;this.modules[k][6]=k%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},U.setupPositionAdjustPattern=function(){for(var k=W.getPatternPosition(this.typeNumber),R=0;R<k.length;R++)for(var D=0;D<k.length;D++){var g=k[R],b=k[D];if(this.modules[g][b]!=null)continue;for(var O=-2;O<=2;O++)for(var T=-2;T<=2;T++)O==-2||O==2||T==-2||T==2||O==0&&T==0?this.modules[g+O][b+T]=!0:this.modules[g+O][b+T]=!1}},U.setupTypeNumber=function(k){for(var R=W.getBCHTypeNumber(this.typeNumber),D=0;D<18;D++){var g=!k&&(R>>D&1)==1;this.modules[Math.floor(D/3)][D%3+this.moduleCount-8-3]=g}for(var D=0;D<18;D++){var g=!k&&(R>>D&1)==1;this.modules[D%3+this.moduleCount-8-3][Math.floor(D/3)]=g}},U.setupTypeInfo=function(k,R){for(var D=this.errorCorrectLevel<<3|R,g=W.getBCHTypeInfo(D),b=0;b<15;b++){var O=!k&&(g>>b&1)==1;b<6?this.modules[b][8]=O:b<8?this.modules[b+1][8]=O:this.modules[this.moduleCount-15+b][8]=O}for(var b=0;b<15;b++){var O=!k&&(g>>b&1)==1;b<8?this.modules[8][this.moduleCount-b-1]=O:b<9?this.modules[8][15-b-1+1]=O:this.modules[8][15-b-1]=O}this.modules[this.moduleCount-8][8]=!k},U.mapData=function(k,R){for(var D=-1,g=this.moduleCount-1,b=7,O=0,T=this.moduleCount-1;T>0;T-=2)for(T==6&&T--;;){for(var x=0;x<2;x++)if(this.modules[g][T-x]==null){var S=!1;O<k.length&&(S=(k[O]>>>b&1)==1);var c=W.getMask(R,g,T-x);c&&(S=!S),this.modules[g][T-x]=S,b--,b==-1&&(O++,b=7)}if(g+=D,g<0||this.moduleCount<=g){g-=D,D=-D;break}}},P.PAD0=236,P.PAD1=17,P.createData=function(k,R,D){for(var g=K.getRSBlocks(k,R),b=new A,O=0;O<D.length;O++){var T=D[O];b.put(T.mode,4),b.put(T.getLength(),W.getLengthInBits(T.mode,k)),T.write(b)}for(var x=0,O=0;O<g.length;O++)x+=g[O].dataCount;if(b.getLengthInBits()>x*8)throw new Error("code length overflow. ("+b.getLengthInBits()+">"+x*8+")");for(b.getLengthInBits()+4<=x*8&&b.put(0,4);b.getLengthInBits()%8!=0;)b.putBit(!1);for(;!(b.getLengthInBits()>=x*8);){if(b.put(P.PAD0,8),b.getLengthInBits()>=x*8)break;b.put(P.PAD1,8)}return P.createBytes(b,g)},P.createBytes=function(k,R){for(var D=0,g=0,b=0,O=new Array(R.length),T=new Array(R.length),x=0;x<R.length;x++){var S=R[x].dataCount,c=R[x].totalCount-S;g=Math.max(g,S),b=Math.max(b,c),O[x]=new Array(S);for(var o=0;o<O[x].length;o++)O[x][o]=255&k.buffer[o+D];D+=S;var d=W.getErrorCorrectPolynomial(c),u=new M(O[x],d.getLength()-1),w=u.mod(d);T[x]=new Array(d.getLength()-1);for(var o=0;o<T[x].length;o++){var y=o+w.getLength()-T[x].length;T[x][o]=y>=0?w.get(y):0}}for(var m=0,o=0;o<R.length;o++)m+=R[o].totalCount;for(var l=new Array(m),_=0,o=0;o<g;o++)for(var x=0;x<R.length;x++)o<O[x].length&&(l[_++]=O[x][o]);for(var o=0;o<b;o++)for(var x=0;x<R.length;x++)o<T[x].length&&(l[_++]=T[x][o]);return l},qe.exports=P},HmJG:function(qe,Xe,$){},Iq15:function(qe,Xe,$){var Z=$("nVVt"),K=$("dWSS"),A=$("dQei"),W={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},M={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(P){for(var U=P<<10;M.getBCHDigit(U)-M.getBCHDigit(M.G15)>=0;)U^=M.G15<<M.getBCHDigit(U)-M.getBCHDigit(M.G15);return(P<<10|U)^M.G15_MASK},getBCHTypeNumber:function(P){for(var U=P<<12;M.getBCHDigit(U)-M.getBCHDigit(M.G18)>=0;)U^=M.G18<<M.getBCHDigit(U)-M.getBCHDigit(M.G18);return P<<12|U},getBCHDigit:function(P){for(var U=0;P!=0;)U++,P>>>=1;return U},getPatternPosition:function(P){return M.PATTERN_POSITION_TABLE[P-1]},getMask:function(P,U,k){switch(P){case W.PATTERN000:return(U+k)%2==0;case W.PATTERN001:return U%2==0;case W.PATTERN010:return k%3==0;case W.PATTERN011:return(U+k)%3==0;case W.PATTERN100:return(Math.floor(U/2)+Math.floor(k/3))%2==0;case W.PATTERN101:return U*k%2+U*k%3==0;case W.PATTERN110:return(U*k%2+U*k%3)%2==0;case W.PATTERN111:return(U*k%3+(U+k)%2)%2==0;default:throw new Error("bad maskPattern:"+P)}},getErrorCorrectPolynomial:function(P){for(var U=new K([1],0),k=0;k<P;k++)U=U.multiply(new K([1,A.gexp(k)],0));return U},getLengthInBits:function(P,U){if(1<=U&&U<10)switch(P){case Z.MODE_NUMBER:return 10;case Z.MODE_ALPHA_NUM:return 9;case Z.MODE_8BIT_BYTE:return 8;case Z.MODE_KANJI:return 8;default:throw new Error("mode:"+P)}else if(U<27)switch(P){case Z.MODE_NUMBER:return 12;case Z.MODE_ALPHA_NUM:return 11;case Z.MODE_8BIT_BYTE:return 16;case Z.MODE_KANJI:return 10;default:throw new Error("mode:"+P)}else if(U<41)switch(P){case Z.MODE_NUMBER:return 14;case Z.MODE_ALPHA_NUM:return 13;case Z.MODE_8BIT_BYTE:return 16;case Z.MODE_KANJI:return 12;default:throw new Error("mode:"+P)}else throw new Error("type:"+U)},getLostPoint:function(P){for(var U=P.getModuleCount(),k=0,R=0;R<U;R++)for(var D=0;D<U;D++){for(var g=0,b=P.isDark(R,D),O=-1;O<=1;O++){if(R+O<0||U<=R+O)continue;for(var T=-1;T<=1;T++){if(D+T<0||U<=D+T)continue;if(O==0&&T==0)continue;b==P.isDark(R+O,D+T)&&g++}}g>5&&(k+=3+g-5)}for(var R=0;R<U-1;R++)for(var D=0;D<U-1;D++){var x=0;P.isDark(R,D)&&x++,P.isDark(R+1,D)&&x++,P.isDark(R,D+1)&&x++,P.isDark(R+1,D+1)&&x++,(x==0||x==4)&&(k+=3)}for(var R=0;R<U;R++)for(var D=0;D<U-6;D++)P.isDark(R,D)&&!P.isDark(R,D+1)&&P.isDark(R,D+2)&&P.isDark(R,D+3)&&P.isDark(R,D+4)&&!P.isDark(R,D+5)&&P.isDark(R,D+6)&&(k+=40);for(var D=0;D<U;D++)for(var R=0;R<U-6;R++)P.isDark(R,D)&&!P.isDark(R+1,D)&&P.isDark(R+2,D)&&P.isDark(R+3,D)&&P.isDark(R+4,D)&&!P.isDark(R+5,D)&&P.isDark(R+6,D)&&(k+=40);for(var S=0,D=0;D<U;D++)for(var R=0;R<U;R++)P.isDark(R,D)&&S++;var c=Math.abs(100*S/U/U-50)/5;return k+=c*10,k}};qe.exports=M},LdHM:function(qe,Xe,$){"use strict";$.d(Xe,"b",function(){return u}),$.d(Xe,"a",function(){return y});var Z=$("1OyB"),K=$("vuIU"),A=$("Ji7U"),W=$("LK+K"),M=$("cDcd"),P=$("rePB"),U=$("Ff2n"),k=$("ODXe"),R=$("4IlW"),D=$("bX4T"),g=$("YrtM"),b=$("TSYQ"),O=$.n(b),T=$("+nKL"),x=$("8OUc"),S=function(X,te){var ie=X.prefixCls,le=X.id,_e=X.flattenOptions,me=X.childrenAsData,he=X.values,fe=X.searchValue,ce=X.multiple,ne=X.defaultActiveFirstOption,q=X.height,ye=X.itemHeight,Fe=X.notFoundContent,Be=X.open,We=X.menuItemSelectedIcon,ze=X.virtual,we=X.onSelect,Ae=X.onToggleOpen,Me=X.onActiveValue,je=X.onScroll,Ie=X.onMouseEnter,Oe="".concat(ie,"-item"),Te=Object(g.a)(function(){return _e},[Be,_e],function(De,ue){return ue[0]&&De[1]!==ue[1]}),ct=M.useRef(null),rt=function(ue){ue.preventDefault()},Ye=function(ue){ct.current&&ct.current.scrollTo({index:ue})},Ge=function(ue){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,se=Te.length,Y=0;Y<se;Y+=1){var Q=(ue+Y*ae+se)%se,J=Te[Q],ee=J.group,de=J.data;if(!ee&&!de.disabled)return Q}return-1},ot=M.useState(function(){return Ge(0)}),nt=Object(k.a)(ot,2),et=nt[0],Ee=nt[1],it=function(ue){Ee(ue);var ae=Te[ue];if(!ae){Me(null,-1);return}Me(ae.data.value,ue)};M.useEffect(function(){it(ne!==!1?Ge(0):-1)},[Te.length,fe]),M.useEffect(function(){var De=setTimeout(function(){if(!ce&&Be&&he.size===1){var ue=Array.from(he)[0],ae=Te.findIndex(function(se){var Y=se.data;return Y.value===ue});it(ae),Ye(ae)}});return function(){return clearTimeout(De)}},[Be]);var Ze=function(ue){ue!==void 0&&we(ue,{selected:!he.has(ue)}),ce||Ae(!1)};if(M.useImperativeHandle(te,function(){return{onKeyDown:function(ue){var ae=ue.which;switch(ae){case R.a.UP:case R.a.DOWN:{var se=0;if(ae===R.a.UP?se=-1:ae===R.a.DOWN&&(se=1),se!==0){var Y=Ge(et+se,se);Ye(Y),it(Y)}break}case R.a.ENTER:{var Q=Te[et];Q&&!Q.data.disabled?Ze(Q.data.value):Ze(void 0),Be&&ue.preventDefault();break}case R.a.ESC:Ae(!1)}},onKeyUp:function(){},scrollTo:function(ue){Ye(ue)}}}),Te.length===0)return M.createElement("div",{role:"listbox",id:"".concat(le,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:rt},Fe);function be(De){var ue=Te[De];if(!ue)return null;var ae=ue.data||{},se=ae.value,Y=ae.label,Q=ae.children,J=Object(D.a)(ae,!0),ee=me?Q:Y;return ue?M.createElement("div",Object.assign({"aria-label":typeof ee=="string"?ee:null},J,{key:De,role:"option",id:"".concat(le,"_list_").concat(De),"aria-selected":he.has(se)}),se):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(le,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(et-1),be(et),be(et+1)),M.createElement(T.a,{itemKey:"key",ref:ct,data:Te,height:q,itemHeight:ye,fullHeight:!1,onMouseDown:rt,onScroll:je,virtual:ze,onMouseEnter:Ie},function(De,ue){var ae,se=De.group,Y=De.groupOption,Q=De.data,J=Q.label,ee=Q.key;if(se)return M.createElement("div",{className:O()(Oe,"".concat(Oe,"-group"))},J!==void 0?J:ee);var de=Q.disabled,xe=Q.value,Re=Q.title,lt=Q.children,st=Q.style,Le=Q.className,_t=Object(U.a)(Q,["disabled","value","title","children","style","className"]),Ue=he.has(xe),Ve="".concat(Oe,"-option"),Tt=O()(Oe,Ve,Le,(ae={},Object(P.a)(ae,"".concat(Ve,"-grouped"),Y),Object(P.a)(ae,"".concat(Ve,"-active"),et===ue&&!de),Object(P.a)(ae,"".concat(Ve,"-disabled"),de),Object(P.a)(ae,"".concat(Ve,"-selected"),Ue),ae)),ht=me?lt:J,St=!We||typeof We=="function"||Ue;return M.createElement("div",Object.assign({},_t,{"aria-selected":Ue,className:Tt,title:Re,onMouseMove:function(){if(et===ue||de)return;it(ue)},onClick:function(){de||Ze(xe)},style:st}),M.createElement("div",{className:"".concat(Ve,"-content")},ht||xe),M.isValidElement(We)||Ue,St&&M.createElement(x.a,{className:"".concat(Oe,"-option-state"),customizeIcon:We,customizeIconProps:{isSelected:Ue}},Ue?"\u2713":null))}))},c=M.forwardRef(S);c.displayName="OptionList";var o=c,d=function(){return null};d.isSelectOption=!0;var u=d,w=function(){return null};w.isSelectOptGroup=!0;var y=w,m=$("VTBJ"),l=$("Zm9Q");function _(F){var X=F.key,te=F.props,ie=te.children,le=te.value,_e=Object(U.a)(te,["children","value"]);return Object(m.a)({key:X,value:le!==void 0?le:X,children:ie},_e)}function f(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(l.a)(F).map(function(te,ie){if(!M.isValidElement(te)||!te.type)return null;var le=te.type.isSelectOptGroup,_e=te.key,me=te.props,he=me.children,fe=Object(U.a)(me,["children"]);return X||!le?_(te):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(_e===null?ie:_e,"__"),label:_e},fe),{},{options:f(he)})}).filter(function(te){return te})}var h=$("2Qr1"),s=$("qNPg"),a=$("U8pU"),E=$("Kwbf"),v=$("WKfj");function p(F){var X=F.mode,te=F.options,ie=F.children,le=F.backfill,_e=F.allowClear,me=F.placeholder,he=F.getInputElement,fe=F.showSearch,ce=F.onSearch,ne=F.defaultOpen,q=F.autoFocus,ye=F.labelInValue,Fe=F.value,Be=F.inputValue,We=F.optionLabelProp,ze=X==="multiple"||X==="tags",we=fe!==void 0?fe:ze||X==="combobox",Ae=te||f(ie);if(Object(E.a)(X!=="tags"||Ae.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Me=Ae.some(function(Oe){return Oe.options?Oe.options.some(function(Te){return typeof("value"in Te?Te.value:Te.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(E.a)(!Me,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(X!=="combobox"||!We,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(X==="combobox"||!le,"`backfill` only works with `combobox` mode."),Object(E.a)(X==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(E.b)(X!=="combobox"||!he||!_e||!me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ce&&!we&&X!=="combobox"&&X!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!ne||q,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Fe!=null){var je=Object(v.d)(Fe);Object(E.a)(!ye||je.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!ze||Array.isArray(Fe),"`value` should be array when `mode` is `multiple` or `tags`")}if(ie){var Ie=null;Object(l.a)(ie).some(function(Oe){if(!M.isValidElement(Oe)||!Oe.type)return!1;var Te=Oe.type;if(Te.isSelectOption)return!1;if(Te.isSelectOptGroup){var ct=Object(l.a)(Oe.props.children).every(function(rt){return!M.isValidElement(rt)||!Oe.type||rt.type.isSelectOption?!0:(Ie=rt.type,!1)});return!ct}return Ie=Te,!0}),Ie&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(E.a)(Be===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var L=p,I=Object(s.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:L,fillOptionsWithMissingValue:h.a}),B=function(F){Object(A.a)(te,F);var X=Object(W.a)(te);function te(){var ie;return Object(Z.a)(this,te),ie=X.apply(this,arguments),ie.selectRef=M.createRef(),ie.focus=function(){ie.selectRef.current.focus()},ie.blur=function(){ie.selectRef.current.blur()},ie}return Object(K.a)(te,[{key:"render",value:function(){return M.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),te}(M.Component);B.Option=u,B.OptGroup=y;var z=B,j=Xe.c=z},M8RZ:function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return R});var Z=$("fWQN"),K=$("mtLc"),A=$("yKVA"),W=$("879j"),M=$("cDcd"),P=$.n(M),U=$("faye"),k=$.n(U),R=function(D){Object(A.a)(b,D);var g=Object(W.a)(b);function b(O){var T;Object(Z.a)(this,b),T=g.call(this,O);var x=window.document;return T.node=x.createElement("div"),x.body.appendChild(T.node),T}return Object(K.a)(b,[{key:"render",value:function(){var T=this.props.children;return Object(U.createPortal)(T,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),b}(P.a.Component)},O2Wb:function(qe,Xe,$){qe.exports={flex:"flex___2gmSR",flex1:"flex1___3Tu1g",color666:"color666___2uyGL",error:"error___yJ86W",deleteIcon:"deleteIcon___1D2tg",addIcon:"addIcon___2VIYB"}},OLES:function(qe,Xe,$){"use strict";var Z=$("U8pU"),K=$("VTBJ"),A=$("Ff2n"),W=$("cDcd"),M=$("uciX"),P=$("7ixt"),U=function(O){var T=O.overlay,x=O.prefixCls,S=O.id,c=O.overlayInnerStyle;return W.createElement("div",{className:"".concat(x,"-inner"),id:S,role:"tooltip",style:c},typeof T=="function"?T():T)},k=U,R=function(O,T){var x=O.overlayClassName,S=O.trigger,c=S===void 0?["hover"]:S,o=O.mouseEnterDelay,d=o===void 0?0:o,u=O.mouseLeaveDelay,w=u===void 0?.1:u,y=O.overlayStyle,m=O.prefixCls,l=m===void 0?"rc-tooltip":m,_=O.children,f=O.onVisibleChange,h=O.afterVisibleChange,s=O.transitionName,a=O.animation,E=O.placement,v=E===void 0?"right":E,p=O.align,L=p===void 0?{}:p,I=O.destroyTooltipOnHide,B=I===void 0?!1:I,z=O.defaultVisible,j=O.getTooltipContainer,F=O.overlayInnerStyle,X=Object(A.a)(O,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),te=Object(W.useRef)(null);Object(W.useImperativeHandle)(T,function(){return te.current});var ie=Object(K.a)({},X);"visible"in O&&(ie.popupVisible=O.visible);var le=function(){var ce=O.arrowContent,ne=ce===void 0?null:ce,q=O.overlay,ye=O.id;return[W.createElement("div",{className:"".concat(l,"-arrow"),key:"arrow"},ne),W.createElement(k,{key:"content",prefixCls:l,id:ye,overlay:q,overlayInnerStyle:F})]},_e=!1,me=!1;if(typeof B=="boolean")_e=B;else if(B&&Object(Z.a)(B)==="object"){var he=B.keepParent;_e=he===!0,me=he===!1}return W.createElement(M.a,Object.assign({popupClassName:x,prefixCls:l,popup:le,action:c,builtinPlacements:P.a,popupPlacement:v,ref:te,popupAlign:L,getPopupContainer:j,onPopupVisibleChange:f,afterPopupVisibleChange:h,popupTransitionName:s,popupAnimation:a,defaultPopupVisible:z,destroyPopupOnHide:_e,autoDestroy:me,mouseLeaveDelay:w,popupStyle:y,mouseEnterDelay:d},ie),_)},D=Object(W.forwardRef)(R),g=Xe.a=D},Ot1p:function(qe,Xe,$){"use strict";var Z=$("2qtc"),K=$("kLXV"),A=$("rAM+"),W=$("miYZ"),M=$("tsqr"),P=$("9og8"),U=$("tJVT"),k=$("jrin"),R=$("WmNS"),D=$.n(R),g=$("cDcd"),b=$.n(g),O=$("VrN/"),T=$.n(O),x=$("bdgK"),S=$("p77/"),c=$("Bd2K"),o=$("ELLl"),d=$("19Vz"),u=$("lZu9"),w=$("+NIl"),y=$("kSUc"),m=$("9Bee"),l=function(Le){var _t=Le.value,Ue=_t===void 0?"":_t,Ve=Le.className,Tt=Le.showTextOnly,ht=Le.showLines,St=Le.style,kt=St===void 0?{}:St,pt=Object(g.useMemo)(function(){return""},[Ue]);return b.a.createElement(b.a.Fragment,null,b.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},_=$("Q9mQ"),f=$("diRs"),h=$("0Owb"),s=$("dejd"),a=$("C+DQ"),E=$("D1Df"),v=$.n(E),p=$("1vsH"),L=$("m3rI"),I=[{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 B(Le){var _t=Le.onActionCallback,Ue=Le.title,Ve=Le.icon,Tt=Le.actionName,ht=Le.className,St=ht===void 0?"":ht,kt=Le.children;function pt(){_t(Tt)}return b.a.createElement("a",{title:Ue,className:St,onClick:pt},b.a.createElement("i",{className:"md-iconfont ".concat(Ve)}),kt)}var z=function(Le){var _t=Le.watch,Ue=Le.showNullButton,Ve=Le.onActionCallback,Tt=Le.fullScreen,ht=Le.insertTemp,St=Le.hidetoolBar,kt=Le.uuid,pt=Le.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(kt,"&api=").concat(encodeURIComponent(L.a.PROXY_SERVER)));var Bt=[].concat(I,[{title:"".concat(_t?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(_t?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return b.a.createElement("ul",{className:"markdown-toolbar-container"},!St&&Bt.map(function(Ot,Pt){return b.a.createElement("li",{key:Pt},Ot.actionName?b.a.createElement(B,Object(h.a)({},Ot,{onActionCallback:Ve})):b.a.createElement("span",{className:"v-line"}))}),Ue?b.a.createElement("li",null,b.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ve},b.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,ht&&b.a.createElement("li",null,b.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(ht),onActionCallback:Ve},b.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),b.a.createElement("li",null,b.a.createElement(f.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:b.a.createElement("div",null,b.a.createElement(v.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(kt,"&api=").concat(encodeURIComponent(L.a.PROXY_SERVER))}))},b.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),b.a.createElement("li",{className:"btn-full-screen"},b.a.createElement(B,{icon:"".concat(Tt?"icon-shrink":"icon-enlarge"),title:Tt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ve})))},j=$("M8RZ"),F=$("+L6B"),X=$("2/Rp"),te=$("y8nQ"),ie=$("Vl3Y"),le=$("5NDa"),_e=$("5rEg"),me={labelCol:{span:4},wrapperCol:{span:20}},he=function(Le){var _t=Le.callback,Ue=Le.onCancel;function Ve(Tt){_t(Tt)}return b.a.createElement(ie.a,Object(h.a)({},me,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ve}),b.a.createElement(ie.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},b.a.createElement(_e.a,null)),b.a.createElement(ie.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},b.a.createElement(_e.a,null)),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:Ue},"\u53D6\u6D88")))},fe=$("7ahc"),ce=$("k1fw"),ne=$("HmJG"),q=$("BjJ7"),ye=ie.a.useForm,Fe={width:280,marginRight:10},Be={labelCol:{span:5},wrapperCol:{span:19}},We=function(Le){var _t=Le.callback,Ue=Le.onCancel,Ve=ye(),Tt=Object(U.a)(Ve,1),ht=Tt[0],St=useRef();function kt(Ot){_t(Object(ce.a)(Object(ce.a)({},Ot),{},{name:St.current}))}function pt(Ot,Pt){if(Ot.status===-1){M.b.error(Ot.message);return}ht.setFieldsValue({src:"/api/attachments/".concat(Ot.id),type:Pt.type})}function Bt(Ot){var Pt=Ot.target.files[0];St.current=Pt.name,we(Pt,pt)}return b.a.createElement(ie.a,Object(h.a)({form:ht},Be,{className:"upload-image-panel",onFinish:kt}),b.a.createElement(ie.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},b.a.createElement("div",{className:"flex-container"},b.a.createElement(ie.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},b.a.createElement(_e.a,{style:Fe})),b.a.createElement(ze,{onFileChange:Bt}))),b.a.createElement(ie.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},b.a.createElement(_e.a,{style:{width:264}})),b.a.createElement(ie.a.Item,{style:{textAlign:"right"}},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:Ue},"\u53D6\u6D88")))};function ze(Le){var _t=Le.onFileChange;return b.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",b.a.createElement("input",{type:"file",onChange:_t}))}function we(Le,_t){if(!Le)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ue=new FormData;Ue.append("editormd-image-file",Le),Ue.append("file_param_name","editormd-image-file"),Ue.append("byxhr","true");var Ve=new window.XMLHttpRequest;Ve.withCredentials=!0,Ve.addEventListener("load",function(Tt){_t(JSON.parse(Tt.target.responseText),Le)},!1),Ve.addEventListener("error",function(Tt){console.error(Tt)},!1),Ve.open("POST","".concat(q.a,"/api/attachments.json")),Ve.send(Ue)}var Ae=$("giR+"),Me=$("fyUT"),je=$("7Kak"),Ie=$("9yH6"),Oe=Ie.a.Group,Te={margin:"0 8px"},ct=function(Le){var _t=Le.callback,Ue=Le.onCancel;function Ve(Tt){_t(Tt)}return b.a.createElement(ie.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ve},b.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},b.a.createElement("span",{style:Te},"\u5355\u5143\u683C\u6570\uFF1A"),b.a.createElement("span",{style:Te},"\u884C\u6570"),b.a.createElement(ie.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},b.a.createElement(Me.a,null)),b.a.createElement("span",{style:Te},"\u5217\u6570"),b.a.createElement(ie.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},b.a.createElement(Me.a,null))),b.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},b.a.createElement("span",{style:Te},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),b.a.createElement(ie.a.Item,{name:"align"},b.a.createElement(Oe,null,b.a.createElement(Ie.a,{value:"default"},b.a.createElement("i",{className:"fa fa-align-justify"})),b.a.createElement(Ie.a,{value:"left"},b.a.createElement("i",{className:"fa fa-align-left"})),b.a.createElement(Ie.a,{value:"center"},b.a.createElement("i",{className:"fa fa-align-center"})),b.a.createElement(Ie.a,{value:"right"},b.a.createElement("i",{className:"fa fa-align-right"}))))),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(X.a,{type:"ghost",onClick:Ue},"\u53D6\u6D88")))},rt=$("ErOA"),Ye=$("7Cbv"),Ge="link",ot="upload-image",nt="code-block",et="add-table",Ee="------------",it={default:Ee,left:":".concat(Ee),center:":".concat(Ee,":"),right:"".concat(Ee,":")},Ze=$("9VGf"),be,De;function ue(){}var ae=0,se=1e4,Y="\u2581",Q=`
**\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 J(Le){return/^\d+$/.test(Le)?"".concat(Le,"px"):Le}var ee=navigator.platform.toUpperCase().indexOf("MAC")>=0,de=ee?"Cmd":"Ctrl",xe=["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"],Re=(be={},Object(k.a)(be,de+"-B","bold"),Object(k.a)(be,de+"-I","italic"),be),lt=(De={},Object(k.a)(De,Ge,"\u6DFB\u52A0\u94FE\u63A5"),Object(k.a)(De,nt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(k.a)(De,ot,"\u6DFB\u52A0\u6587\u4EF6"),Object(k.a)(De,et,"\u6DFB\u52A0\u8868\u683C"),De),st=Xe.a=function(Le){var _t=Le.defaultValue,Ue=_t===void 0?"":_t,Ve=Le.onChange,Tt=Le.width,ht=Tt===void 0?"100%":Tt,St=Le.height,kt=St===void 0?400:St,pt=Le.miniToolbar,Bt=pt===void 0?!1:pt,Ot=Le.isFocus,Pt=Ot===void 0?!1:Ot,Ft=Le.watch,It=Le.insertTemp,Wt=Le.mode,Lt=Wt===void 0?"markdown":Wt,Ct=Le.id,gt=Ct===void 0?"markdown-editor-id":Ct,tt=Le.showResizeBar,ke=tt===void 0?!1:tt,zt=Le.noStorage,jt=zt===void 0?!1:zt,Vt=Le.showNullButton,Mt=Vt===void 0?!1:Vt,br=Le.hidetoolBar,Yt=br===void 0?!1:br,Et=Le.fullScreen,Ce=Et===void 0?!1:Et,ft=Le.onBlur,xr=Le.onCMBeforeChange,Qr=Le.onFullScreen,Jr=Le.className,cr=Jr===void 0?"":Jr,Ut=Le.disablePaste,vt=Ut===void 0?!1:Ut,ar=Le.placeholder,gr=ar===void 0?"":ar,lr=Le.values,vr=lr===void 0?"":lr,cn=Object(g.useState)(null),Dn=Object(U.a)(cn,2),Ne=Dn[0],Rn=Dn[1],Kn=Object(g.useState)(Ue),vn=Object(U.a)(Kn,2),Yr=vn[0],Zr=vn[1],On=Object(g.useState)(Ft),Pn=Object(U.a)(On,2),qr=Pn[0],ci=Pn[1],Gn=Object(g.useState)(Ce),Ur=Object(U.a)(Gn,2),$e=Ur[0],ge=Ur[1],He=Object(g.useState)(""),bt=Object(U.a)(He,2),at=bt[0],ut=bt[1],Dt=Object(g.useState)(0),rr=Object(U.a)(Dt,2),Zt=rr[0],nr=rr[1],Pr=Object(g.useState)(kt),or=Object(U.a)(Pr,2),Nr=or[0],hr=or[1],en=Object(g.useState)(!1),Cr=Object(U.a)(en,2),Lr=Cr[0],sn=Cr[1],tn=Object(g.useRef)(Object(Ye.a)()),Ni=Object(g.useRef)(!1),fi=Object(g.useRef)(),Dr=Object(g.useRef)(),yn=Object(g.useRef)(),zn=Object(g.useRef)(),En=Object(g.useRef)(),Fi=function(){var yt=Object(P.a)(D.a.mark(function Rt(){var wt,Ht;return D.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return er.next=2,Object(rt.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:Ht=er.sent,Ht!=null&&(wt=Ht.attachments)!==null&&wt!==void 0&&wt.length&&(console.log("cm:",Ne,Dr),Ht.attachments.map(function(Kt){Kt.content_type.indexOf("image")>-1?Ne.replaceSelection("![,](/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type,")")):Kt.content_type.indexOf("video")>-1?Ne.replaceSelection('<video width="100%" controls src="'.concat(L.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Kt.content_type.indexOf("pdf")>-1?Ne.replaceSelection('<a href="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,'&disposition=inline" target="_blank">').concat(Kt.name,"</a>")):Ne.replaceSelection("[".concat(Kt.name,"](").concat(L.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}));case 4:case"end":return er.stop()}},Rt)}));return function(){return yt.apply(this,arguments)}}();Object(g.useEffect)(function(){Zr(vr),Ne==null||Ne.setValue(vr)},[vr]),Object(g.useEffect)(function(){Qr==null||Qr($e)},[$e]),Object(g.useEffect)(function(){if(Dr.current){var yt=T.a.fromTextArea(Dr.current,{mode:Lt,lineNumbers:!Bt,lineWrapping:!0,value:Ue,autoCloseTags:!0,autoCloseBrackets:!0});Pt&&yt.focus();function Rt(wt,Ht){if(vt){Ht.preventDefault();return}var Xt=Ht.clipboardData;if(Xt){var er=Xt.types.toString(),Kt=Xt.items;if(er==="Files"||Xt.types.indexOf("Files")>-1){if(Ht.preventDefault(),Lt=="stex")return;try{var ur,yr=Kt[1];((ur=Kt[0])===null||ur===void 0?void 0:ur.kind)==="file"&&(yr=Kt[0]);var Gt=yr.getAsFile(),hn=Gt.name.split(".").pop();we(Gt,function(Qt){if(Qt.id){var Mr,qt,$r;(Gt==null||((Mr=Gt.type)===null||Mr===void 0)?void 0:Mr.indexOf("image"))>-1?yt.replaceSelection("![,](/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type,")")):(Gt==null||((qt=Gt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,'"></video>')):(Gt==null||(($r=Gt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):xe.includes(hn)?yt.replaceSelection('<a href="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):yt.replaceSelection("[".concat(Gt.name,"](").concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,")"))}else(Qt==null?void 0:Qt.status)===401&&(document.location.href="/user/login")})}catch(Qt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return yt.on("paste",Rt),yt.on("dragleave",function(wt,Ht){yn.current.classList.remove("mouse-hover-md")}),yt.on("dragover",function(wt,Ht){yn.current.classList.add("mouse-hover-md")}),yt.on("drop",function(wt,Ht){yn.current.classList.add("mouse-hover-md");var Xt;if(Xt=Ht.dataTransfer.files,Xt.length>0){Ht.preventDefault(),Ht.stopPropagation();for(var er=function(yr){var Gt=Xt[yr],hn=Gt.name.split(".").pop();we(Gt,function(Qt){if(Qt.id){var Mr,qt,$r;(Gt==null||((Mr=Gt.type)===null||Mr===void 0)?void 0:Mr.indexOf("image"))>-1?yt.replaceSelection("![,](/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type,")")):(Gt==null||((qt=Gt.type)===null||qt===void 0)?void 0:qt.indexOf("video"))>-1?yt.replaceSelection('<video width="100%" controls src="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,'"></video>')):(Gt==null||(($r=Gt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?yt.replaceSelection('<a href="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Gt.type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):xe.includes(hn)?yt.replaceSelection('<a href="'.concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,'?type=office&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):yt.replaceSelection("[".concat(Gt.name,"](").concat(L.a.API_SERVER,"/api/attachments/").concat(Qt.id,"?type=").concat(Qt.content_type,")"))}else(Qt==null?void 0:Qt.status)===401&&(document.location.href="/user/login")})},Kt=0;Kt<Xt.length;Kt++)er(Kt)}}),Rn(yt),function(){yt.off("paste",Rt)}}},[]);var rn=Object(g.useCallback)(function(){if(yn.current)try{}catch(yt){console.log(yt,"---- to set md editor body height")}},[Nr,yn,$e]);Object(g.useEffect)(function(){function yt(){var wt=new x.default(function(Ht){var Xt=Object(A.a)(Ht),er;try{for(Xt.s();!(er=Xt.n()).done;){var Kt=er.value;(Kt.target.offsetHeight>0||Kt.target.offsetWidth>0)&&(rn(),Ne.setSize("100%","100%"),Ne.refresh())}}catch(ur){Xt.e(ur)}finally{Xt.f()}});return wt.observe(Dr.current.parentElement),wt}if(Ne){var Rt=yt();return function(){Rt.unobserve(Dr.current.parentElement)}}},[Ne,rn]),Object(g.useEffect)(function(){if(Ne){for(var yt=[],Rt=function(){var Kt=Ht[wt];Xt=Object(U.a)(Kt,2);var ur=Xt[0],yr=Xt[1],Gt=Object(k.a)({},ur,function(){Vn(yr)});yt.push(Gt),Ne.addKeyMap(Gt)},wt=0,Ht=Object.entries(Re);wt<Ht.length;wt++){var Xt;Rt()}return fi.current=setInterval(function(){Ni.current&&Fi()},4e3),function(){clearInterval(fi.current);var er=Object(A.a)(yt),Kt;try{for(er.s();!(Kt=er.n()).done;){var ur=Kt.value;Ne.removeKeyMap(ur)}}catch(yr){er.e(yr)}finally{er.f()}}}},[Ne]),Object(g.useEffect)(function(){Ce!==$e&&ge(Ce)},[Ce]),Object(Ze.a)(function(){if(!jt&&Zt>0){var yt=new Date().getTime(),Rt=window.sessionStorage.getItem(gt);yt>=Zt+se&&(!Rt||Rt!==Yr)&&(window.sessionStorage.setItem(gt,Yr),sn(!0))}},se),Object(g.useEffect)(function(){ci(Ft)},[Ne,Ft]),Object(g.useEffect)(function(){Ne&&(Pt&&Ne.focus())},[Ne,Pt]),Object(g.useEffect)(function(){if(qr&&Ne){var yt=Ne.getScrollerElement();function Rt(wt){var Ht=wt.target;if(En.current){var Xt=Ht.scrollTop/Ht.scrollHeight;En.current.scrollTop=En.current.scrollHeight*Xt}}return yt.addEventListener("scroll",Rt),function(){yt.removeEventListener("scroll",Rt)}}},[Ne,qr]),Object(g.useEffect)(function(){if(Ne&&xr){function yt(Rt,wt){xr(Rt,wt)}return Ne.on("beforeChange",yt),function(){Ne.off("beforeChange",yt)}}},[Ne,xr]),Object(g.useEffect)(function(){if(Ne&&ft){function yt(){ft(Ne.getValue())}return Ne.on("blur",yt),function(){Ne.off("blur",yt)}}},[Ne,ft]),Object(g.useEffect)(function(){if(Ne){function yt(Rt){var wt=Rt.getValue();Zr(wt),nr(new Date().getTime()),Rt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ve&&Ve(wt)}return Ne.on("change",yt),function(){Ne.off("change",yt)}}},[Ne,Ve]),Object(g.useEffect)(function(){Ne&&(Ue==null?(Ne.setValue(""),Zr("")):Ue!==Ne.getValue()&&(Ne.setValue(Ue),Zr(Ue),Ne.setCursor(Ne.lineCount(),0)))},[Ne,Ue]);var Vn=Object(g.useCallback)(function(yt){var Rt=Ne.getCursor(),wt=Ne.getSelection(),Ht=wt.split(`
`);switch(yt){case"bold":return Ne.replaceSelection("**"+wt+"**"),wt===""&&Ne.setCursor(Rt.line,Rt.ch+2),Ne.focus();case"italic":return Ne.replaceSelection("*"+wt+"*"),wt===""&&Ne.setCursor(Rt.line,Rt.ch+1),Ne.focus();case"code":return Ne.replaceSelection("`"+wt+"`"),wt===""&&Ne.setCursor(Rt.line,Rt.ch+1),Ne.focus();case"inline-latex":return Ne.replaceSelection("`$$"+wt+"$$`"),wt===""&&Ne.setCursor(Rt.line,Rt.ch+3),Ne.focus();case"latex":return Ne.replaceSelection("```latex\n"+wt+"\n```"),Ne.setCursor(Rt.line+1,wt.length+1),Ne.focus();case"line-break":return Ne.replaceSelection(`<br/>
`),Ne.focus();case"list-ul":return wt===""?Ne.replaceSelection("- "+wt):Ne.replaceSelection(Ht.map(function(Xt){return Xt===""?"":"- ".concat(Xt)}).join(`
`)),Ne.focus();case"list-ol":return wt===""?Ne.replaceSelection("1. "+wt):Ne.replaceSelection(Ht.map(function(Xt,er){return Xt===""?"":"".concat(er+1,". ").concat(Xt)}).join(`
`)),Ne.focus();case"add-null-ch":return wt===""&&Ne.setCursor(Rt.line,Rt.ch+1),Ne.replaceSelection(Y),Ne.focus();case"inster-template-1":return wt===""&&Ne.setCursor(Rt.line,Rt.ch),Ne.replaceSelection(Q),Ne.focus();case"eraser":return Ne.setValue(""),Ne.focus();case"trigger-watch":return ci(!qr),Ne.focus();case"trigger-full-screen":return ge(!$e),Ne.focus();case Ge:ut(Ge);return;case nt:ut(nt);return;case ot:ut(ot);return;case et:ut(et);return;default:throw new Error}},[Ne,qr,$e]),Kr=Object(g.useCallback)(function(yt){ut("");switch(at){case Ge:var Rt=yt.title,wt=yt.link;return Ne.replaceSelection("[".concat(Rt,"](").concat(wt,")")),Ne.focus();case nt:var Ht=yt.language,Xt=yt.content;return Ne.replaceSelection(["```"+Ht,Xt,"```"].join(`
`)),Ne.focus();case ot:var er=yt.src,Kt=yt.alt;return Kt?Ne.replaceSelection("![ ".concat(Kt," ]( ").concat(er,' "').concat(Kt,'" )')):Ne.replaceSelection("![,](".concat(er,")")),Ne.focus();case et:for(var ur=yt.row,yr=yt.col,Gt=yt.align,hn=`
`,Qt=0;Qt<ur;Qt++){for(var Mr=[],qt=[],$r=0;$r<yr;$r++)Qt===1&&qt.push(it[Gt]),Mr.push(" ");Qt===1&&(hn+="| ".concat(qt.join(" | "),` |
`)),hn+="| ".concat(Mr.join(yr===1?"":" | "),` |
`)}return Ne.replaceSelection(hn+`
`),Ne.focus();default:throw new Error}},[Ne,at]),Xn=Object(g.useMemo)(function(){switch(at){case Ge:return b.a.createElement(he,{callback:Kr,onCancel:fn});case nt:return b.a.createElement(fe.b,{callback:Kr,onCancel:fn});case ot:return b.a.createElement(We,{callback:Kr,onCancel:fn});case et:return b.a.createElement(ct,{callback:Kr,onCancel:fn});default:return null}},[at]);function fn(){ut("")}Object(g.useEffect)(function(){if(zn.current){var yt=zn.current,Rt=!1,wt=0;function Ht(Kt){Rt=!0,wt=Kt.pageY}function Xt(){Rt=!1}function er(Kt){if(Rt){var ur=Kt.pageY-wt;ur<0&&(ur=0),ur>300&&(ur=300);var yr=kt+ur+"px";hr(yr)}}return yt.addEventListener("mousedown",Ht),document.addEventListener("mousemove",er),document.addEventListener("mouseup",Xt),function(){yt.removeEventListener("mousedown",Ht),document.removeEventListener("mousemove",er),document.removeEventListener("mouseup",Xt)}}},[Ne,zn]),Object(g.useEffect)(function(){hr(kt)},[kt]);var bn=J(ht),la=J(Nr),ua={width:bn,height:la},$a=Object(g.useMemo)(function(){if(Zt){var yt=new Date(Zt),Rt=yt.getHours(),wt=yt.getMinutes(),Ht=yt.getSeconds();return Rt=Rt<10?"0"+Rt:Rt,wt=wt<10?"0"+wt:wt,Ht=Ht<10?"0"+Ht:Ht,"".concat(Rt,":").concat(wt,":").concat(Ht)}return 0},[Zt]);function Qa(){window.sessionStorage.removeItem(gt),sn(!1),nr(0)}function da(){sn(!1),nr(0),Ne.setValue(window.sessionStorage.getItem(gt))}function Bi(yt,Rt){var wt=Ne.getValue();wt=wt.replace(yt,Rt),Zr(wt),Ne==null||Ne.setValue(wt)}return b.a.createElement(g.Fragment,null,b.a.createElement("div",{className:"markdown-editor-wrapper",ref:yn},b.a.createElement("div",{className:"markdown-editor-container ".concat(cr," ").concat(qr?"on-preview":""," ").concat(Bt?"mini":""," ").concat($e?"full-screen":""),style:ua},b.a.createElement(z,{insertTemp:It,watch:qr,fullScreen:$e,showNullButton:Mt,onActionCallback:Vn,hidetoolBar:Yt,uuid:tn.current,setOpenPhones:function(){Ni.current=!0}}),b.a.createElement("div",{className:"markdown-editor-body"},b.a.createElement("div",{className:"codemirror-container"},b.a.createElement("textarea",{ref:Dr,placeholder:gr})),qr?b.a.createElement("div",{ref:En,className:"preview-container"},Lt==="stex"&&b.a.createElement(l,{value:Yr}),Lt!=="stex"&&b.a.createElement(m.a,{edit:!0,value:Yr,replaces:Bi})):null))),ke?b.a.createElement("a",{ref:zn,className:"editor-resize"}):null,b.a.createElement(j.a,null,lt[at]?b.a.createElement(K.a,{centered:!0,title:lt[at],visible:!0,onCancel:fn,footer:null,className:"markdown-popup-form"},Xn):null))}},PGNT:function(qe,Xe,$){qe.exports={wrap:"wrap___orWmH",modal:"modal___142IN",titleWrap:"titleWrap___2UWGN",required:"required___lXOtq",title:"title___2wqMf",colorGray:"colorGray___3FkLm",choiceWrap:"choiceWrap___3pbic",answer:"answer___30LSv",activeAnswer:"activeAnswer___3ayAN",deleteIcon:"deleteIcon___2HHly",addIcon:"addIcon___29vcx",editorWrap:"editorWrap___ANVP6",htmlWrap:"htmlWrap___38sLf",radio:"radio___15wok",color333:"color333___sNPjh",color999:"color999___1ofkl",fold:"fold___6rnoE",head:"head___2muph"}},PsQE:function(qe,Xe,$){qe.exports={flex_box_center:"flex_box_center___2PkN_",flex_space_between:"flex_space_between___36cDA",flex_box_vertical_center:"flex_box_vertical_center___2c88u",flex_box_center_end:"flex_box_center_end___14cXO",flex_box_column:"flex_box_column___3nalt",wrap:"wrap___3xZrs",left:"left___19hOK",title:"title___3Ti2k",total:"total___3MRC5",list:"list___3pdfL",name:"name___2IcTs",b:"b___2W0Sn",r:"r___2Tpj8",l:"l___1rMKQ",tag:"tag___jj2X5",right:"right___16831",examName:"examName___2TmgX",t:"t___1CJZd",num:"num___1qX6C",topWarp:"topWarp___3WuSr",head:"head___3z9Hq",so:"so___m2B6Z",btn:"btn___20VL7",content:"content___2tTuo",titleWrap:"titleWrap___1cYdQ",single:"single___1BKtz",analysis:"analysis___1qm4Y",text:"text___1JQUf",btnsElse:"btnsElse___2IzAs",btnsWrap:"btnsWrap___3ib37",btns:"btns___2DbBT",modalColumn:"modalColumn___1zs36",modalRow:"modalRow___14b2N",sup:"sup___1CIjI",popover:"popover___Mmcvb"}},"RZ/O":function(qe,Xe,$){qe.exports=$.p+"static/bi.9c9b0364.svg"},SJMd:function(qe,Xe){/**
* @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,K,A=!1,W,M;window.PR_SHOULD_USE_CONTINUATION=!0;var P,U;(function(){var k=window,R=["break,continue,do,else,for,if,return,while"],D=[R,"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"],g=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],b=[g,"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=[g,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],T=[g,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",S=[g,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],c="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[R,"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"],d=[R,"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"],u=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[b,T,O,S,c,o,d,u],y=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",l="kwd",_="com",f="typ",h="lit",s="pun",a="pln",E="tag",v="dec",p="src",L="atn",I="atv",B="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(we){for(var Ae=0,Me=!1,je=!1,Ie=0,Oe=we.length;Ie<Oe;++Ie){var Te=we[Ie];if(Te.ignoreCase)je=!0;else if(/[a-z]/i.test(Te.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Me=!0,je=!1;break}}var ct={b:8,t:9,n:10,v:11,f:12,r:13};function rt(et){var Ee=et.charCodeAt(0);if(Ee!==92)return Ee;var it=et.charAt(1);return Ee=ct[it],Ee||("0"<=it&&it<="7"?parseInt(et.substring(1),8):it==="u"||it==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function Ye(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var Ee=String.fromCharCode(et);return Ee==="\\"||Ee==="-"||Ee==="]"||Ee==="^"?"\\"+Ee:Ee}function Ge(et){var Ee=et.substring(1,et.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")),it=[],Ze=Ee[0]==="^",be=["["];Ze&&be.push("^");for(var De=Ze?1:0,ue=Ee.length;De<ue;++De){var ae=Ee[De];if(/\\[bdsw]/i.test(ae))be.push(ae);else{var se=rt(ae),Y;De+2<ue&&Ee[De+1]==="-"?(Y=rt(Ee[De+2]),De+=2):Y=se,it.push([se,Y]),Y<65||se>122||(Y<65||se>90||it.push([Math.max(65,se)|32,Math.min(Y,90)|32]),Y<97||se>122||it.push([Math.max(97,se)&~32,Math.min(Y,122)&~32]))}}it.sort(function(de,xe){return de[0]-xe[0]||xe[1]-de[1]});for(var Q=[],J=[],De=0;De<it.length;++De){var ee=it[De];ee[0]<=J[1]+1?J[1]=Math.max(J[1],ee[1]):Q.push(J=ee)}for(var De=0;De<Q.length;++De){var ee=Q[De];be.push(Ye(ee[0])),ee[1]>ee[0]&&(ee[1]+1>ee[0]&&be.push("-"),be.push(Ye(ee[1])))}return be.push("]"),be.join("")}function ot(et){for(var Ee=et.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")),it=Ee.length,Ze=[],be=0,De=0;be<it;++be){var ue=Ee[be];if(ue==="(")++De;else if(ue.charAt(0)==="\\"){var ae=+ue.substring(1);ae&&(ae<=De?Ze[ae]=-1:Ee[be]=Ye(ae))}}for(var be=1;be<Ze.length;++be)Ze[be]===-1&&(Ze[be]=++Ae);for(var be=0,De=0;be<it;++be){var ue=Ee[be];if(ue==="(")++De,Ze[De]||(Ee[be]="(?:");else if(ue.charAt(0)==="\\"){var ae=+ue.substring(1);ae&&ae<=De&&(Ee[be]="\\"+Ze[ae])}}for(var be=0;be<it;++be)Ee[be]==="^"&&Ee[be+1]!=="^"&&(Ee[be]="");if(et.ignoreCase&&Me)for(var be=0;be<it;++be){var ue=Ee[be],se=ue.charAt(0);ue.length>=2&&se==="["?Ee[be]=Ge(ue):se!=="\\"&&(Ee[be]=ue.replace(/[a-zA-Z]/g,function(J){var ee=J.charCodeAt(0);return"["+String.fromCharCode(ee&~32,ee|32)+"]"}))}return Ee.join("")}for(var nt=[],Ie=0,Oe=we.length;Ie<Oe;++Ie){var Te=we[Ie];if(Te.global||Te.multiline)throw new Error(""+Te);nt.push("(?:"+ot(Te)+")")}return new RegExp(nt.join("|"),je?"gi":"g")}function F(we,Ae){var Me=/(?:^|\s)nocode(?:\s|$)/,je=[],Ie=0,Oe=[],Te=0;function ct(rt){var Ye=rt.nodeType;if(Ye==1){if(Me.test(rt.className))return;for(var Ge=rt.firstChild;Ge;Ge=Ge.nextSibling)ct(Ge);var ot=rt.nodeName.toLowerCase();(ot==="br"||ot==="li")&&(je[Te]=`
`,Oe[Te<<1]=Ie++,Oe[Te++<<1|1]=rt)}else if(Ye==3||Ye==4){var nt=rt.nodeValue;nt.length&&(Ae?nt=nt.replace(/\r\n?/g,`
`):nt=nt.replace(/[ \t\r\n]+/g," "),je[Te]=nt,Oe[Te<<1]=Ie,Ie+=nt.length,Oe[Te++<<1|1]=rt)}}return ct(we),{sourceCode:je.join("").replace(/\n$/,""),spans:Oe}}function X(we,Ae,Me,je,Ie){if(!Me)return;var Oe={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:Me,spans:null,basePos:Ae,decorations:null};je(Oe),Ie.push.apply(Ie,Oe.decorations)}var te=/\S/;function ie(we){for(var Ae=void 0,Me=we.firstChild;Me;Me=Me.nextSibling){var je=Me.nodeType;Ae=je===1?Ae?we:Me:je===3&&te.test(Me.nodeValue)?we:Ae}return Ae===we?void 0:Ae}function le(we,Ae){var Me={},je;(function(){for(var Te=we.concat(Ae),ct=[],rt={},Ye=0,Ge=Te.length;Ye<Ge;++Ye){var ot=Te[Ye],nt=ot[3];if(nt)for(var et=nt.length;--et>=0;)Me[nt.charAt(et)]=ot;var Ee=ot[1],it=""+Ee;rt.hasOwnProperty(it)||(ct.push(Ee),rt[it]=null)}ct.push(/[\0-\uffff]/),je=j(ct)})();var Ie=Ae.length,Oe=function(Te){for(var ct=Te.sourceCode,rt=Te.basePos,Ye=Te.sourceNode,Ge=[rt,a],ot=0,nt=ct.match(je)||[],et={},Ee=0,it=nt.length;Ee<it;++Ee){var Ze=nt[Ee],be=et[Ze],De=void 0,ue;if(typeof be=="string")ue=!1;else{var ae=Me[Ze.charAt(0)];if(ae)De=Ze.match(ae[1]),be=ae[0];else{for(var se=0;se<Ie;++se)if(ae=Ae[se],De=Ze.match(ae[1]),De){be=ae[0];break}De||(be=a)}ue=be.length>=5&&be.substring(0,5)==="lang-",ue&&!(De&&typeof De[1]=="string")&&(ue=!1,be=p),ue||(et[Ze]=be)}var Y=ot;if(ot+=Ze.length,!ue)Ge.push(rt+Y,be);else{var Q=De[1],J=Ze.indexOf(Q),ee=J+Q.length;De[2]&&(ee=Ze.length-De[2].length,J=ee-Q.length);var de=be.substring(5);X(Ye,rt+Y,Ze.substring(0,J),Oe,Ge),X(Ye,rt+Y+J,Q,q(de,Q),Ge),X(Ye,rt+Y+ee,Ze.substring(ee),Oe,Ge)}}Te.decorations=Ge};return Oe}function _e(we){var Ae=[],Me=[];we.tripleQuotedStrings?Ae.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?Ae.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ae.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&Me.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=we.hashComments;je&&(we.cStyleComments?(je>1?Ae.push([_,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ae.push([_,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Me.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ae.push([_,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&(Me.push([_,/^\/\/[^\r\n]*/,null]),Me.push([_,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=we.regexLiterals;if(Ie){var Oe=Ie>1?"":`
\r`,Te=Oe?".":"[\\S\\s]",ct="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Te+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Te+")*(?:\\x5D|$))+/";Me.push(["lang-regex",RegExp("^"+z+"("+ct+")")])}var rt=we.types;rt&&Me.push([f,rt]);var Ye=(""+we.keywords).replace(/^ | $/g,"");Ye.length&&Me.push([l,new RegExp("^(?:"+Ye.replace(/[\s,]+/g,"|")+")\\b"),null]),Ae.push([a,/^\s+/,null,` \r
\xA0`]);var Ge="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(Ge+="(?!s*/)"),Me.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[s,new RegExp(Ge),null]),le(Ae,Me)}var me=_e({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(we,Ae,Me){for(var je=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Oe=we.ownerDocument,Te=Oe.createElement("li");we.firstChild;)Te.appendChild(we.firstChild);var ct=[Te];function rt(Ee){var it=Ee.nodeType;if(it==1&&!je.test(Ee.className))if(Ee.nodeName==="br")Ye(Ee),Ee.parentNode&&Ee.parentNode.removeChild(Ee);else for(var Ze=Ee.firstChild;Ze;Ze=Ze.nextSibling)rt(Ze);else if((it==3||it==4)&&Me){var be=Ee.nodeValue,De=be.match(Ie);if(De){var ue=be.substring(0,De.index);Ee.nodeValue=ue;var ae=be.substring(De.index+De[0].length);if(ae){var se=Ee.parentNode;se.insertBefore(Oe.createTextNode(ae),Ee.nextSibling)}Ye(Ee),ue||Ee.parentNode.removeChild(Ee)}}}function Ye(Ee){for(;!Ee.nextSibling;)if(Ee=Ee.parentNode,!Ee)return;function it(De,ue){var ae=ue?De.cloneNode(!1):De,se=De.parentNode;if(se){var Y=it(se,1),Q=De.nextSibling;Y.appendChild(ae);for(var J=Q;J;J=Q)Q=J.nextSibling,Y.appendChild(J)}return ae}for(var Ze=it(Ee.nextSibling,0),be;(be=Ze.parentNode)&&be.nodeType===1;)Ze=be;ct.push(Ze)}for(var Ge=0;Ge<ct.length;++Ge)rt(ct[Ge]);Ae===(Ae|0)&&ct[0].setAttribute("value",Ae);var ot=Oe.createElement("ol");ot.className="linenums";for(var nt=Math.max(0,Ae-1|0)||0,Ge=0,et=ct.length;Ge<et;++Ge)Te=ct[Ge],Te.className="L"+(Ge+nt)%10,Te.firstChild||Te.appendChild(Oe.createTextNode("\xA0")),ot.appendChild(Te);we.appendChild(ot)}function fe(we){var Ae=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Ae=Ae&&+Ae[1]<=8;var Me=/\n/g,je=we.sourceCode,Ie=je.length,Oe=0,Te=we.spans,ct=Te.length,rt=0,Ye=we.decorations,Ge=Ye.length,ot=0;Ye[Ge]=Ie;var nt,et;for(et=nt=0;et<Ge;)Ye[et]!==Ye[et+2]?(Ye[nt++]=Ye[et++],Ye[nt++]=Ye[et++]):et+=2;for(Ge=nt,et=nt=0;et<Ge;){for(var Ee=Ye[et],it=Ye[et+1],Ze=et+2;Ze+2<=Ge&&Ye[Ze+1]===it;)Ze+=2;Ye[nt++]=Ee,Ye[nt++]=it,et=Ze}Ge=Ye.length=nt;var be=we.sourceNode,De="";be&&(De=be.style.display,be.style.display="none");try{for(var ue=null;rt<ct;){var ae=Te[rt],se=Te[rt+2]||Ie,Y=Ye[ot+2]||Ie,Ze=Math.min(se,Y),Q=Te[rt+1],J;if(Q.nodeType!==1&&(J=je.substring(Oe,Ze))){Ae&&(J=J.replace(Me,"\r")),Q.nodeValue=J;var ee=Q.ownerDocument,de=ee.createElement("span");de.className=Ye[ot+1];var xe=Q.parentNode;xe.replaceChild(de,Q),de.appendChild(Q),Oe<se&&(Te[rt+1]=Q=ee.createTextNode(je.substring(Ze,se)),xe.insertBefore(Q,de.nextSibling))}Oe=Ze,Oe>=se&&(rt+=2),Oe>=Y&&(ot+=2)}}finally{be&&(be.style.display=De)}}var ce={};function ne(we,Ae){for(var Me=Ae.length;--Me>=0;){var je=Ae[Me];ce.hasOwnProperty(je)?k.console&&console.warn("cannot override language handler %s",je):ce[je]=we}}function q(we,Ae){return we&&ce.hasOwnProperty(we)||(we=/^\s*</.test(Ae)?"default-markup":"default-code"),ce[we]}ne(me,["default-code"]),ne(le([],[[a,/^[^<?]+/],[v,/^<!\w[^>]*(?:>|$)/],[_,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[s,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ne(le([[a,/^[\s]+/,null,` \r
`],[I,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[L,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[s,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ne(le([],[[I,/^[\s\S]+/]]),["uq.val"]),ne(_e({keywords:b,hashComments:!0,cStyleComments:!0,types:y}),["c","cc","cpp","cxx","cyc","m"]),ne(_e({keywords:"null,true,false"}),["json"]),ne(_e({keywords:T,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:y}),["cs"]),ne(_e({keywords:O,cStyleComments:!0}),["java"]),ne(_e({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(_e({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(_e({keywords:c,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(_e({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(_e({keywords:S,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(_e({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(le([],[[m,/^[\s\S]+/]]),["regex"]);function ye(we){var Ae=we.langExtension;try{var Me=F(we.sourceNode,we.pre),je=Me.sourceCode;we.sourceCode=je,we.spans=Me.spans,we.basePos=0,q(Ae,je)(we),fe(we)}catch(Ie){k.console&&console.log(Ie&&Ie.stack||Ie)}}function Fe(we,Ae,Me){var je=Me||!1,Ie=Ae||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+we+"</pre>",Oe=Oe.firstChild,je&&he(Oe,je,!0);var Te={langExtension:Ie,numberLines:je,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(Te),Oe.innerHTML}function Be(we,Ae){var Me=Ae||document.body,je=Me.ownerDocument||document;function Ie(ae){return Me.getElementsByTagName(ae)}for(var Oe=[Ie("pre"),Ie("code"),Ie("xmp")],Te=[],ct=0;ct<Oe.length;++ct)for(var rt=0,Ye=Oe[ct].length;rt<Ye;++rt)Te.push(Oe[ct][rt]);Oe=null;var Ge=Date;Ge.now||(Ge={now:function(){return+new Date}});var ot=0,nt=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,Ee=/\bprettyprinted\b/,it=/pre|xmp/i,Ze=/^code$/i,be=/^(?:pre|code|xmp)$/i,De={};function ue(){for(var ae=k.PR_SHOULD_USE_CONTINUATION?Ge.now()+250:Infinity;ot<Te.length&&Ge.now()<ae;ot++){for(var se=Te[ot],Y=De,Q=se;Q=Q.previousSibling;){var J=Q.nodeType,ee=(J===7||J===8)&&Q.nodeValue;if(ee?!/^\??prettify\b/.test(ee):J!==3||/\S/.test(Q.nodeValue))break;if(ee){Y={},ee.replace(/\b(\w+)=([\w:.%+-]+)/g,function(kt,pt,Bt){Y[pt]=Bt});break}}var de=se.className;if((Y!==De||et.test(de))&&!Ee.test(de)){for(var xe=!1,Re=se.parentNode;Re;Re=Re.parentNode){var lt=Re.tagName;if(be.test(lt)&&Re.className&&et.test(Re.className)){xe=!0;break}}if(!xe){se.className+=" prettyprinted";var st=Y.lang;if(!st){st=de.match(nt);var Le;!st&&(Le=ie(se))&&Ze.test(Le.tagName)&&(st=Le.className.match(nt)),st&&(st=st[1])}var _t;if(it.test(se.tagName))_t=1;else{var Ue=se.currentStyle,Ve=je.defaultView,Tt=Ue?Ue.whiteSpace:Ve&&Ve.getComputedStyle?Ve.getComputedStyle(se,null).getPropertyValue("white-space"):0;_t=Tt&&Tt.substring(0,3)==="pre"}var ht=Y.linenums;(ht=ht==="true"||+ht)||(ht=de.match(/\blinenums\b(?::(\d+))?/),ht=ht?ht[1]&&ht[1].length?+ht[1]:!0:!1),ht&&he(se,ht,_t);var St={langExtension:st,sourceNode:se,numberLines:ht,pre:_t,sourceCode:null,basePos:null,spans:null,decorations:null};ye(St)}}}ot<Te.length?k.setTimeout(ue,250):typeof we=="function"&&we()}ue()}var We=k.PR={createSimpleLexer:le,registerLangHandler:ne,sourceDecorator:_e,PR_ATTRIB_NAME:L,PR_ATTRIB_VALUE:I,PR_COMMENT:_,PR_DECLARATION:v,PR_KEYWORD:l,PR_LITERAL:h,PR_NOCODE:B,PR_PLAIN:a,PR_PUNCTUATION:s,PR_SOURCE:p,PR_STRING:m,PR_TAG:E,PR_TYPE:f,prettyPrintOne:A?k.prettyPrintOne=Fe:P=Fe,prettyPrint:U=A?k.prettyPrint=Be:U=Be},ze=k.define;typeof ze=="function"&&ze.amd&&ze("google-code-prettify",[],function(){return We})})()},"VrN/":function(qe,Xe,$){(function(Z,K){qe.exports=K()})(this,function(){"use strict";var Z=navigator.userAgent,K=navigator.platform,A=/gecko\/\d/i.test(Z),W=/MSIE \d/.test(Z),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Z),P=/Edge\/(\d+)/.exec(Z),U=W||M||P,k=U&&(W?document.documentMode||6:+(P||M)[1]),R=!P&&/WebKit\//.test(Z),D=R&&/Qt\/\d+\.\d+/.test(Z),g=!P&&/Chrome\//.test(Z),b=/Opera\//.test(Z),O=/Apple Computer/.test(navigator.vendor),T=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Z),x=/PhantomJS/.test(Z),S=!P&&/AppleWebKit/.test(Z)&&/Mobile\/\w+/.test(Z),c=/Android/.test(Z),o=S||c||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Z),d=S||/Mac/.test(K),u=/\bCrOS\b/.test(Z),w=/win/i.test(K),y=b&&Z.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1])),y&&y>=15&&(b=!1,R=!0);var m=d&&(D||b&&(y==null||y<12.11)),l=A||U&&k>=9;function _(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=_(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 h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function s(e,t){return h(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 C=0;C<t.length;++C)i.appendChild(t[C]);return i}function E(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var v;document.createRange?v=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:v=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 p(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 L(){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 I(e,t){var n=e.className;_(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!_(n[r]).test(t)&&(t+=" "+n[r]);return t}var z=function(e){e.select()};S?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:U&&(z=function(e){try{e.select()}catch(t){}});function j(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(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 X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,N=i||0;;){var H=e.indexOf(" ",C);if(H<0||H>=t)return N+(t-C);N+=H-C,N+=n-N%n,C=H+1}}var te=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},te.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ie(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var le=50,_e={toString:function(){return"CodeMirror.Pass"}},me={scroll:!1},he={origin:"*mouse"},fe={origin:"+move"};function ce(e,t,n){for(var r=0,i=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var N=C-r;if(C==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=C-r,i+=n-i%n,r=C+1,i>=t)return r}}var ne=[""];function q(e){for(;ne.length<=e;)ne.push(ye(ne)+" ");return ne[e]}function ye(e){return e[e.length-1]}function Fe(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Be(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function We(){}function ze(e,t){var n;return Object.create?n=Object.create(e):(We.prototype=e,n=new We),t&&F(t,n),n}var we=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Ae(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||we.test(e))}function Me(e,t){return t?t.source.indexOf("\\w")>-1&&Ae(e)?!0:t.test(e):Ae(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ie=/[\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 Oe(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function Te(e,t,n){for(;(n<0?t>0:t<e.length)&&Oe(e.charAt(t));)t+=n;return t}function ct(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,C=r<0?Math.ceil(i):Math.floor(i);if(C==t)return e(C)?t:n;e(C)?n=C:t=C+r}}function rt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,C=0;C<e.length;++C){var N=e[C];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",C),i=!0)}i||r(t,n,"ltr")}var Ye=null;function Ge(e,t,n){var r;Ye=null;for(var i=0;i<e.length;++i){var C=e[i];if(C.from<t&&C.to>t)return i;C.to==t&&(C.from!=C.to&&n=="before"?r=i:Ye=i),C.from==t&&(C.from!=C.to&&n!="before"?r=i:Ye=i)}return r!=null?r:Ye}var ot=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,C=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function G(V,re,oe){this.level=V,this.from=re,this.to=oe}return function(V,re){var oe=re=="ltr"?"L":"R";if(V.length==0||re=="ltr"&&!r.test(V))return!1;for(var ve=V.length,pe=[],Se=0;Se<ve;++Se)pe.push(n(V.charCodeAt(Se)));for(var Pe=0,Ke=oe;Pe<ve;++Pe){var Qe=pe[Pe];Qe=="m"?pe[Pe]=Ke:Ke=Qe}for(var dt=0,Je=oe;dt<ve;++dt){var mt=pe[dt];mt=="1"&&Je=="r"?pe[dt]="n":C.test(mt)&&(Je=mt,mt=="r"&&(pe[dt]="R"))}for(var At=1,xt=pe[0];At<ve-1;++At){var Nt=pe[At];Nt=="+"&&xt=="1"&&pe[At+1]=="1"?pe[At]="1":Nt==","&&xt==pe[At+1]&&(xt=="1"||xt=="n")&&(pe[At]=xt),xt=Nt}for(var tr=0;tr<ve;++tr){var Sr=pe[tr];if(Sr==",")pe[tr]="N";else if(Sr=="%"){var sr=void 0;for(sr=tr+1;sr<ve&&pe[sr]=="%";++sr);for(var zr=tr&&pe[tr-1]=="!"||sr<ve&&pe[sr]=="1"?"1":"N",jr=tr;jr<sr;++jr)pe[jr]=zr;tr=sr-1}}for(var mr=0,Wr=oe;mr<ve;++mr){var Ar=pe[mr];Wr=="L"&&Ar=="1"?pe[mr]="L":C.test(Ar)&&(Wr=Ar)}for(var Er=0;Er<ve;++Er)if(i.test(pe[Er])){var pr=void 0;for(pr=Er+1;pr<ve&&i.test(pe[pr]);++pr);for(var dr=(Er?pe[Er-1]:oe)=="L",Hr=(pr<ve?pe[pr]:oe)=="L",ui=dr==Hr?dr?"L":"R":oe,Ln=Er;Ln<pr;++Ln)pe[Ln]=ui;Er=pr-1}for(var Or=[],dn,wr=0;wr<ve;)if(N.test(pe[wr])){var Xa=wr;for(++wr;wr<ve&&N.test(pe[wr]);++wr);Or.push(new G(0,Xa,wr))}else{var gn=wr,Wn=Or.length,Hn=re=="rtl"?1:0;for(++wr;wr<ve&&pe[wr]!="L";++wr);for(var Ir=gn;Ir<wr;)if(H.test(pe[Ir])){gn<Ir&&(Or.splice(Wn,0,new G(1,gn,Ir)),Wn+=Hn);var di=Ir;for(++Ir;Ir<wr&&H.test(pe[Ir]);++Ir);Or.splice(Wn,0,new G(2,di,Ir)),Wn+=Hn,gn=Ir}else++Ir;gn<wr&&Or.splice(Wn,0,new G(1,gn,wr))}return re=="ltr"&&(Or[0].level==1&&(dn=V.match(/^\s+/))&&(Or[0].from=dn[0].length,Or.unshift(new G(0,0,dn[0].length))),ye(Or).level==1&&(dn=V.match(/\s+$/))&&(ye(Or).to-=dn[0].length,Or.push(new G(0,ve-dn[0].length,ve)))),re=="rtl"?Or.reverse():Or}}();function nt(e,t){var n=e.order;return n==null&&(n=e.order=ot(e.text,t)),n}var et=[],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]||et).concat(n)}};function it(e,t){return e._handlers&&e._handlers[t]||et}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 C=ie(i,n);C>-1&&(r[t]=i.slice(0,C).concat(i.slice(C+1)))}}}function be(e,t){var n=it(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 De(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function ue(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ie(n,t[r])==-1&&n.push(t[r])}function ae(e,t){return it(e,t).length>0}function se(e){e.prototype.on=function(t,n){Ee(this,t,n)},e.prototype.off=function(t,n){Ze(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ee(e){Y(e),Q(e)}function de(e){return e.target||e.srcElement}function xe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),d&&e.ctrlKey&&t==1&&(t=3),t}var Re=function(){if(U&&k<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),lt;function st(e){if(lt==null){var t=a("span","\u200B");s(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(lt=t.offsetWidth<=1&&t.offsetHeight>2&&!(U&&k<8))}var n=lt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Le;function _t(e){if(Le!=null)return Le;var t=s(e,document.createTextNode("A\u062EA")),n=v(t,0,1).getBoundingClientRect(),r=v(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:Le=r.right-n.right<3}var Ue=`
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 C=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=C.indexOf("\r");N!=-1?(n.push(C.slice(0,N)),t+=N+1):(n.push(C),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ve=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},Tt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ht=null;function St(e){if(ht!=null)return ht;var t=s(e,a("span","x")),n=t.getBoundingClientRect(),r=v(t,0,1).getBoundingClientRect();return ht=Math.abs(n.left-r.left)>1}var kt={},pt={};function Bt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kt[e]=t}function Ot(e,t){pt[e]=t}function Pt(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=ze(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Pt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Pt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ft(e,t){t=Pt(t);var n=kt[t.name];if(!n)return Ft(e,"text/plain");var r=n(e,t);if(It.hasOwnProperty(t.name)){var i=It[t.name];for(var C in i){if(!i.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=i[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var It={};function Wt(e,t){var n=It.hasOwnProperty(e)?It[e]:It[e]={};F(t,n)}function Lt(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 Ct(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 gt(e,t,n){return e.startState?e.startState(t,n):!0}var tt=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};tt.prototype.eol=function(){return this.pos>=this.string.length},tt.prototype.sol=function(){return this.pos==this.lineStart},tt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},tt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},tt.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},tt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},tt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},tt.prototype.skipToEnd=function(){this.pos=this.string.length},tt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},tt.prototype.backUp=function(e){this.pos-=e},tt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},tt.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},tt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},tt.prototype.current=function(){return this.string.slice(this.start,this.pos)},tt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},tt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},tt.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],C=i.chunkSize();if(t<C){n=i;break}t-=C}return n.lines[t]}function zt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(C){var N=C.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function jt(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Vt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Mt(e){if(e.parent==null)return null;for(var t=e.parent,n=ie(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function br(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],C=i.height;if(t<C){e=i;continue e}t-=C,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],G=H.height;if(t<G)break;t-=G}return n+N}function Yt(e,t){return t>=e.first&&t<e.first+e.size}function Et(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ce(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ce))return new Ce(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function xr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function Qr(e){return Ce(e.line,e.ch)}function Jr(e,t){return ft(e,t)<0?t:e}function cr(e,t){return ft(e,t)<0?e:t}function Ut(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function vt(e,t){if(t.line<e.first)return Ce(e.first,0);var n=e.first+e.size-1;return t.line>n?Ce(n,ke(e,n).text.length):ar(t,ke(e,t.line).text.length)}function ar(e,t){var n=e.ch;return n==null||n>t?Ce(e.line,t):n<0?Ce(e.line,0):e}function gr(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=vt(e,t[r]);return n}var lr=function(e,t){this.state=e,this.lookAhead=t},vr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};vr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},vr.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}},vr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},vr.fromSaved=function(e,t,n){return t instanceof lr?new vr(e,Lt(e.mode,t.state),n,t.lookAhead):new vr(e,Lt(e.mode,t),n)},vr.prototype.save=function(e){var t=e!==!1?Lt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new lr(t,this.maxLookAhead):t};function cn(e,t,n,r){var i=[e.state.modeGen],C={};Pn(e,t.text,e.doc.mode,n,function(V,re){return i.push(V,re)},C,r);for(var N=n.state,H=function(V){n.baseTokens=i;var re=e.state.overlays[V],oe=1,ve=0;n.state=!0,Pn(e,t.text,re.mode,n,function(pe,Se){for(var Pe=oe;ve<pe;){var Ke=i[oe];Ke>pe&&i.splice(oe,1,pe,i[oe+1],Ke),oe+=2,ve=Math.min(pe,Ke)}if(!Se)return;if(re.opaque)i.splice(Pe,oe-Pe,pe,"overlay "+Se),oe=Pe+2;else for(;Pe<oe;Pe+=2){var Qe=i[Pe+1];i[Pe+1]=(Qe?Qe+" ":"")+"overlay "+Se}},C),n.state=N,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)H(G);return{styles:i,classes:C.bgClass||C.textClass?C:null}}function Dn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ne(e,Mt(t)),i=t.text.length>e.options.maxHighlightLength&&Lt(e.doc.mode,r.state),C=cn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=C.styles,C.classes?t.styleClasses=C.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 Ne(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new vr(r,!0,t);var C=qr(e,t,n),N=C>r.first&&ke(r,C-1).stateAfter,H=N?vr.fromSaved(r,N,C):new vr(r,gt(r.mode),C);return r.iter(C,t,function(G){Rn(e,G.text,H);var V=H.line;G.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Rn(e,t,n,r){var i=e.doc.mode,C=new tt(t,e.options.tabSize,n);for(C.start=C.pos=r||0,t==""&&Kn(i,n.state);!C.eol();)vn(i,C,n.state),C.start=C.pos}function Kn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Ct(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function vn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ct(e,n).mode);var C=e.token(t,n);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yr=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Zr(e,t,n,r){var i=e.doc,C=i.mode,N;t=vt(i,t);var H=ke(i,t.line),G=Ne(e,t.line,n),V=new tt(H.text,e.options.tabSize,G),re;for(r&&(re=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,N=vn(C,V,G.state),r&&re.push(new Yr(V,N,Lt(i.mode,G.state)));return r?re:new Yr(V,N,G.state)}function On(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 Pn(e,t,n,r,i,C,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var G=0,V=null,re=new tt(t,e.options.tabSize,r),oe,ve=e.options.addModeClass&&[null];for(t==""&&On(Kn(n,r.state),C);!re.eol();){if(re.pos>e.options.maxHighlightLength?(H=!1,N&&Rn(e,t,r,re.pos),re.pos=t.length,oe=null):oe=On(vn(n,re,r.state,ve),C),ve){var pe=ve[0].name;pe&&(oe="m-"+(oe?pe+" "+oe:pe))}if(!H||V!=oe){for(;G<re.start;)G=Math.min(re.start,G+5e3),i(G,V);V=oe}re.start=re.pos}for(;G<re.pos;){var Se=Math.min(re.pos,G+5e3);i(Se,V),G=Se}}function qr(e,t,n){for(var r,i,C=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=C.first)return C.first;var G=ke(C,H-1),V=G.stateAfter;if(V&&(!n||H+(V instanceof lr?V.lookAhead:0)<=C.modeFrontier))return H;var re=X(G.text,null,e.options.tabSize);(i==null||r>re)&&(i=H-1,r=re)}return i}function ci(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 lr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Gn=!1,Ur=!1;function $e(){Gn=!0}function ge(){Ur=!0}function He(e,t,n){this.marker=e,this.from=t,this.to=n}function bt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function at(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ut(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Dt(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],N=C.marker,H=C.from==null||(N.inclusiveLeft?C.from<=t:C.from<t);if(H||C.from==t&&N.type=="bookmark"&&(!n||!C.marker.insertLeft)){var G=C.to==null||(N.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new He(N,C.from,G?null:C.to))}}return r}function rr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var C=e[i],N=C.marker,H=C.to==null||(N.inclusiveRight?C.to>=t:C.to>t);if(H||C.from==t&&N.type=="bookmark"&&(!n||C.marker.insertLeft)){var G=C.from==null||(N.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new He(N,G?null:C.from-t,C.to==null?null:C.to-t))}}return r}function Zt(e,t){if(t.full)return null;var n=Yt(e,t.from.line)&&ke(e,t.from.line).markedSpans,r=Yt(e,t.to.line)&&ke(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,C=t.to.ch,N=ft(t.from,t.to)==0,H=Dt(n,i,N),G=rr(r,C,N),V=t.text.length==1,re=ye(t.text).length+(V?i:0);if(H)for(var oe=0;oe<H.length;++oe){var ve=H[oe];if(ve.to==null){var pe=bt(G,ve.marker);pe?V&&(ve.to=pe.to==null?null:pe.to+re):ve.to=i}}if(G)for(var Se=0;Se<G.length;++Se){var Pe=G[Se];if(Pe.to!=null&&(Pe.to+=re),Pe.from==null){var Ke=bt(H,Pe.marker);Ke||(Pe.from=re,V&&(H||(H=[])).push(Pe))}else Pe.from+=re,V&&(H||(H=[])).push(Pe)}H&&(H=nr(H)),G&&G!=H&&(G=nr(G));var Qe=[H];if(!V){var dt=t.text.length-2,Je;if(dt>0&&H)for(var mt=0;mt<H.length;++mt)H[mt].to==null&&(Je||(Je=[])).push(new He(H[mt].marker,null,null));for(var At=0;At<dt;++At)Qe.push(Je);Qe.push(G)}return Qe}function nr(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 Pr(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(pe){if(pe.markedSpans)for(var Se=0;Se<pe.markedSpans.length;++Se){var Pe=pe.markedSpans[Se].marker;Pe.readOnly&&(!r||ie(r,Pe)==-1)&&(r||(r=[])).push(Pe)}}),!r)return null;for(var i=[{from:t,to:n}],C=0;C<r.length;++C)for(var N=r[C],H=N.find(0),G=0;G<i.length;++G){var V=i[G];if(ft(V.to,H.from)<0||ft(V.from,H.to)>0)continue;var re=[G,1],oe=ft(V.from,H.from),ve=ft(V.to,H.to);(oe<0||!N.inclusiveLeft&&!oe)&&re.push({from:V.from,to:H.from}),(ve>0||!N.inclusiveRight&&!ve)&&re.push({from:H.to,to:V.to}),i.splice.apply(i,re),G+=re.length-3}return i}function or(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 Nr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function hr(e){return e.inclusiveLeft?-1:0}function en(e){return e.inclusiveRight?1:0}function Cr(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),C=ft(r.from,i.from)||hr(e)-hr(t);if(C)return-C;var N=ft(r.to,i.to)||en(e)-en(t);return N||t.id-e.id}function Lr(e,t){var n=Ur&&e.markedSpans,r;if(n)for(var i=void 0,C=0;C<n.length;++C)i=n[C],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Cr(r,i.marker)<0)&&(r=i.marker);return r}function sn(e){return Lr(e,!0)}function tn(e){return Lr(e,!1)}function Ni(e,t){var n=Ur&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var C=n[i];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||Cr(r,C.marker)<0)&&(r=C.marker)}return r}function fi(e,t,n,r,i){var C=ke(e,t),N=Ur&&C.markedSpans;if(N)for(var H=0;H<N.length;++H){var G=N[H];if(!G.marker.collapsed)continue;var V=G.marker.find(0),re=ft(V.from,n)||hr(G.marker)-hr(i),oe=ft(V.to,r)||en(G.marker)-en(i);if(re>=0&&oe<=0||re<=0&&oe>=0)continue;if(re<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ft(V.to,n)>=0:ft(V.to,n)>0)||re>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ft(V.from,r)<=0:ft(V.from,r)<0))return!0}}function Dr(e){for(var t;t=sn(e);)e=t.find(-1,!0).line;return e}function yn(e){for(var t;t=tn(e);)e=t.find(1,!0).line;return e}function zn(e){for(var t,n;t=tn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function En(e,t){var n=ke(e,t),r=Dr(n);return n==r?t:Mt(r)}function Fi(e,t){if(t>e.lastLine())return t;var n=ke(e,t),r;if(!rn(e,n))return t;for(;r=tn(n);)n=r.find(1,!0).line;return Mt(n)+1}function rn(e,t){var n=Ur&&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&&Vn(e,t,r))return!0}}function Vn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Vn(e,r.line,bt(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,C=0;C<t.markedSpans.length;++C)if(i=t.markedSpans[C],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Vn(e,t,i))return!0}function Kr(e){e=Dr(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 C=n.parent;C;n=C,C=n.parent)for(var N=0;N<C.children.length;++N){var H=C.children[N];if(H==n)break;t+=H.height}return t}function Xn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=sn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=tn(r);){var C=n.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function fn(e){var t=e.display,n=e.doc;t.maxLine=ke(n,n.first),t.maxLineLength=Xn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Xn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var bn=function(e,t,n){this.text=e,Nr(this,t),this.height=n?n(this):1};bn.prototype.lineNo=function(){return Mt(this)},se(bn);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),or(e),Nr(e,n);var i=r?r(e):1;i!=e.height&&Vt(e,i)}function ua(e){e.parent=null,or(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Bi(e,t){var n=E("span",null,null,R?"padding-right: .1px":null),r={pre:E("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 C=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Rt,_t(e.display.measure)&&(N=nt(C,e.doc.direction))&&(r.addToken=Ht(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&Mt(C);er(C,r,Dn(e,C,H)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=B(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=B(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(st(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(R){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 be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function yt(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 Rt(e,t,n,r,i,C,N){if(!t)return;var H=e.splitSpaces?wt(t,e.trailingSpace):t,G=e.cm.state.specialChars,V=!1,re;if(!G.test(t))e.col+=t.length,re=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,re),U&&k<9&&(V=!0),e.pos+=t.length;else{re=document.createDocumentFragment();for(var oe=0;;){G.lastIndex=oe;var ve=G.exec(t),pe=ve?ve.index-oe:t.length-oe;if(pe){var Se=document.createTextNode(H.slice(oe,oe+pe));U&&k<9?re.appendChild(a("span",[Se])):re.appendChild(Se),e.map.push(e.pos,e.pos+pe,Se),e.col+=pe,e.pos+=pe}if(!ve)break;oe+=pe+1;var Pe=void 0;if(ve[0]==" "){var Ke=e.cm.options.tabSize,Qe=Ke-e.col%Ke;Pe=re.appendChild(a("span",q(Qe),"cm-tab")),Pe.setAttribute("role","presentation"),Pe.setAttribute("cm-text"," "),e.col+=Qe}else ve[0]=="\r"||ve[0]==`
`?(Pe=re.appendChild(a("span",ve[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Pe.setAttribute("cm-text",ve[0]),e.col+=1):(Pe=e.cm.options.specialCharPlaceholder(ve[0]),Pe.setAttribute("cm-text",ve[0]),U&&k<9?re.appendChild(a("span",[Pe])):re.appendChild(Pe),e.col+=1);e.map.push(e.pos,e.pos+1,Pe),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||V||C||N){var dt=n||"";r&&(dt+=r),i&&(dt+=i);var Je=a("span",[re],dt,C);if(N)for(var mt in N)N.hasOwnProperty(mt)&&mt!="style"&&mt!="class"&&Je.setAttribute(mt,N[mt]);return e.content.appendChild(Je)}e.content.appendChild(re)}function wt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var C=e.charAt(i);C==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(C="\xA0"),r+=C,n=C==" "}return r}function Ht(e,t){return function(n,r,i,C,N,H,G){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,re=V+r.length;;){for(var oe=void 0,ve=0;ve<t.length&&!(oe=t[ve],oe.to>V&&oe.from<=V);ve++);if(oe.to>=re)return e(n,r,i,C,N,H,G);e(n,r.slice(0,oe.to-V),i,C,null,H,G),C=null,r=r.slice(oe.to-V),V=oe.to}}}function Xt(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 er(e,t,n){var r=e.markedSpans,i=e.text,C=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(C,C=n[N]),da(n[N+1],t.cm.options));return}for(var H=i.length,G=0,V=1,re="",oe,ve,pe=0,Se,Pe,Ke,Qe,dt;;){if(pe==G){Se=Pe=Ke=ve="",dt=null,Qe=null,pe=Infinity;for(var Je=[],mt=void 0,At=0;At<r.length;++At){var xt=r[At],Nt=xt.marker;if(Nt.type=="bookmark"&&xt.from==G&&Nt.widgetNode)Je.push(Nt);else if(xt.from<=G&&(xt.to==null||xt.to>G||Nt.collapsed&&xt.to==G&&xt.from==G)){if(xt.to!=null&&xt.to!=G&&pe>xt.to&&(pe=xt.to,Pe=""),Nt.className&&(Se+=" "+Nt.className),Nt.css&&(ve=(ve?ve+";":"")+Nt.css),Nt.startStyle&&xt.from==G&&(Ke+=" "+Nt.startStyle),Nt.endStyle&&xt.to==pe&&(mt||(mt=[])).push(Nt.endStyle,xt.to),Nt.title&&((dt||(dt={})).title=Nt.title),Nt.attributes)for(var tr in Nt.attributes)(dt||(dt={}))[tr]=Nt.attributes[tr];Nt.collapsed&&(!Qe||Cr(Qe.marker,Nt)<0)&&(Qe=xt)}else xt.from>G&&pe>xt.from&&(pe=xt.from)}if(mt)for(var Sr=0;Sr<mt.length;Sr+=2)mt[Sr+1]==pe&&(Pe+=" "+mt[Sr]);if(!Qe||Qe.from==G)for(var sr=0;sr<Je.length;++sr)Xt(t,0,Je[sr]);if(Qe&&(Qe.from||0)==G){if(Xt(t,(Qe.to==null?H+1:Qe.to)-G,Qe.marker,Qe.from==null),Qe.to==null)return;Qe.to==G&&(Qe=!1)}}if(G>=H)break;for(var zr=Math.min(H,pe);;){if(re){var jr=G+re.length;if(!Qe){var mr=jr>zr?re.slice(0,zr-G):re;t.addToken(t,mr,oe?oe+Se:Se,Ke,G+mr.length==pe?Pe:"",ve,dt)}if(jr>=zr){re=re.slice(zr-G),G=zr;break}G=jr,Ke=""}re=i.slice(C,C=n[V++]),oe=da(n[V++],t.cm.options)}}}function Kt(e,t,n){this.line=t,this.rest=zn(t),this.size=this.rest?Mt(ye(this.rest))-n+1:1,this.node=this.text=null,this.hidden=rn(e,t)}function ur(e,t,n){for(var r=[],i,C=t;C<n;C=i){var N=new Kt(e.doc,ke(e.doc,C),C);i=C+N.size,r.push(N)}return r}var yr=null;function Gt(e){yr?yr.ops.push(e):e.ownsGroup=yr={ops:[e],delayedCallbacks:[]}}function hn(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 Qt(e,t){var n=e.ownsGroup;if(!n)return;try{hn(n)}finally{yr=null,t(n)}}var Mr=null;function qt(e,t){var n=it(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;yr?i=yr.delayedCallbacks:Mr?i=Mr:(i=Mr=[],setTimeout($r,0));for(var C=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)C(N)}function $r(){var e=Mr;Mr=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var C=t.changes[i];C=="text"?ks(e,t):C=="gutter"?qa(e,t,n,r):C=="class"?ca(e,t):C=="widget"&&Is(e,t,r)}t.changes=null}function hi(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),U&&k<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=hi(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):Bi(e,t)}function ks(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ms(e,t),t.line.wrapClass?hi(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 qa(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=hi(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 C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var N=hi(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),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",Et(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var G=0;G<e.display.gutterSpecs.length;++G){var V=e.display.gutterSpecs[G].className,re=C.hasOwnProperty(V)&&C[V];re&&H.appendChild(a("div",[re],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=_("CodeMirror-linewidget"),i=t.node.firstChild,C=void 0;i;i=C)C=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(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),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var C=hi(n),N=0,H=t.widgets;N<H.length;++N){var G=H[N],V=a("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(G,V,n,r),e.display.input.setUneditable(V),i&&G.above?C.insertBefore(V,n.gutter||n.text):C.appendChild(V),qt(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 mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!p(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),s(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function mn(e,t){for(var n=de(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function ji(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=s(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ln(e){return le-e.display.nativeBarWidth}function Mn(e){return e.display.scroller.clientWidth-ln(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-ln(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&Mn(e);if(!t.measure.heights||r&&t.measure.width!=i){var C=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var G=N[H],V=N[H+1];Math.abs(G.bottom-V.bottom)>2&&C.push((G.bottom+V.top)/2-n.top)}}C.push(n.bottom-n.top)}}function no(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(Mt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Dr(t);var n=Mt(t),r=e.display.externalMeasured=new Kt(e.doc,t,n);r.lineN=n;var i=r.built=Bi(e,r);return r.text=i.pre,s(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return un(e,Yn(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Un(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Yn(e,t){var n=Mt(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function un(e,t,n,r,i){t.before&&(n=-1);var C=n+(r||""),N;return t.cache.hasOwnProperty(C)?N=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[C]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,C,N,H,G,V=0;V<e.length;V+=3)if(H=e[V],G=e[V+1],t<H?(i=0,C=1,N="left"):t<G?(i=t-H,C=i+1):(V==e.length-3||t==G&&e[V+3]>t)&&(C=G-H,i=C-1,t>=G&&(N="right")),i!=null){if(r=e[V+2],H==G&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],N="left";if(n=="right"&&i==G-H)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],N="right";break}return{node:r,start:i,end:C,collapse:N,coverStart:H,coverEnd:G}}function js(e,t){var n=ao;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=oo(t.map,n,r),C=i.node,N=i.start,H=i.end,G=i.collapse,V;if(C.nodeType==3){for(var re=0;re<4;re++){for(;N&&Oe(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&Oe(t.line.text.charAt(i.coverStart+H));)++H;if(U&&k<9&&N==0&&H==i.coverEnd-i.coverStart?V=C.parentNode.getBoundingClientRect():V=js(v(C,N,H).getClientRects(),r),V.left||V.right||N==0)break;H=N,N=N-1,G="right"}U&&k<11&&(V=Hs(e.display.measure,V))}else{N>0&&(G=r="right");var oe;e.options.lineWrapping&&(oe=C.getClientRects()).length>1?V=oe[r=="right"?oe.length-1:0]:V=C.getBoundingClientRect()}if(U&&k<9&&!N&&(!V||!V.left&&!V.right)){var ve=C.parentNode.getClientRects()[0];ve?V={left:ve.left,right:ve.left+Qn(e.display),top:ve.top,bottom:ve.bottom}:V=ao}for(var pe=V.top-t.rect.top,Se=V.bottom-t.rect.top,Pe=(pe+Se)/2,Ke=t.view.measure.heights,Qe=0;Qe<Ke.length-1&&!(Pe<Ke[Qe]);Qe++);var dt=Qe?Ke[Qe-1]:0,Je=Ke[Qe],mt={left:(G=="right"?V.right:V.left)-t.rect.left,right:(G=="left"?V.left:V.right)-t.rect.left,top:dt,bottom:Je};return!V.left&&!V.right&&(mt.bogus=!0),e.options.singleCursorHeightPerLine||(mt.rtop=pe,mt.rbottom=Se),mt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!St(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 so(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 lo(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function pi(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return g&&c?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return g&&c?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=mi(e.widgets[n]));return t}function Wi(e,t,n,r,i){if(!i){var C=pa(t);n.top+=C,n.bottom+=C}if(r=="line")return n;r||(r="local");var N=Kr(t);if(r=="local"?N+=ji(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:co());var G=H.left+(r=="window"?0:uo());n.left+=G,n.right+=G}return n.top+=N,n.bottom+=N,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var C=e.display.sizer.getBoundingClientRect();r+=C.left,i+=C.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ga(e,t,n,r,i){return r||(r=ke(e.doc,t.line)),Wi(e,r,io(e,r,t.ch,i),n)}function nn(e,t,n,r,i,C){r=r||ke(e.doc,t.line),i||(i=Yn(e,r));function N(Se,Pe){var Ke=un(e,i,Se,Pe?"right":"left",C);return Pe?Ke.left=Ke.right:Ke.right=Ke.left,Wi(e,r,Ke,n)}var H=nt(r,e.doc.direction),G=t.ch,V=t.sticky;if(G>=r.text.length?(G=r.text.length,V="before"):G<=0&&(G=0,V="after"),!H)return N(V=="before"?G-1:G,V=="before");function re(Se,Pe,Ke){var Qe=H[Pe],dt=Qe.level==1;return N(Ke?Se-1:Se,dt!=Ke)}var oe=Ge(H,G,V),ve=Ye,pe=re(G,oe,V=="before");return ve!=null&&(pe.other=re(G,ve,V!="before")),pe}function ho(e,t){var n=0;t=vt(e.doc,t),e.options.lineWrapping||(n=Qn(e.display)*t.ch);var r=ke(e.doc,t.line),i=Kr(r)+ji(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var C=Ce(e,t,n);return C.xRel=i,r&&(C.outside=r),C}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=br(r,n),C=r.first+r.size-1;if(i>C)return va(r.first+r.size-1,ke(r,C).text.length,null,1,1);t<0&&(t=0);for(var N=ke(r,i);;){var H=Ks(e,N,i,t,n),G=Ni(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!G)return H;var V=G.find(1);if(V.line==i)return V;N=ke(r,i=V.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,C=ct(function(N){return un(e,n,N-1).bottom<=r},i,0);return i=ct(function(N){return un(e,n,N).top>r},C,i),{begin:C,end:i}}function po(e,t,n,r){n||(n=Yn(e,t));var i=Wi(e,t,un(e,n,r),"line").top;return mo(e,t,n,i)}function Ea(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-=Kr(t);var C=Yn(e,t),N=pa(t),H=0,G=t.text.length,V=!0,re=nt(t,e.doc.direction);if(re){var oe=(e.options.lineWrapping?zs:Gs)(e,t,n,C,re,r,i);V=oe.level!=1,H=V?oe.from:oe.to-1,G=V?oe.to:oe.from-1}var ve=null,pe=null,Se=ct(function(At){var xt=un(e,C,At);return xt.top+=N,xt.bottom+=N,Ea(xt,r,i,!1)?(xt.top<=i&&xt.left<=r&&(ve=At,pe=xt),!0):!1},H,G),Pe,Ke,Qe=!1;if(pe){var dt=r-pe.left<pe.right-r,Je=dt==V;Se=ve+(Je?0:1),Ke=Je?"after":"before",Pe=dt?pe.left:pe.right}else{!V&&(Se==G||Se==H)&&Se++,Ke=Se==0?"after":Se==t.text.length?"before":un(e,C,Se-(V?1:0)).bottom+N<=i==V?"after":"before";var mt=nn(e,Ce(n,Se,Ke),"line",t,C);Pe=mt.left,Qe=i<mt.top?-1:i>=mt.bottom?1:0}return Se=Te(t.text,Se,1),va(n,Se,Ke,Qe,r-Pe)}function Gs(e,t,n,r,i,C,N){var H=ct(function(oe){var ve=i[oe],pe=ve.level!=1;return Ea(nn(e,Ce(n,pe?ve.to:ve.from,pe?"before":"after"),"line",t,r),C,N,!0)},0,i.length-1),G=i[H];if(H>0){var V=G.level!=1,re=nn(e,Ce(n,V?G.from:G.to,V?"after":"before"),"line",t,r);Ea(re,C,N,!0)&&re.top>N&&(G=i[H-1])}return G}function zs(e,t,n,r,i,C,N){var H=mo(e,t,r,N),G=H.begin,V=H.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var re=null,oe=null,ve=0;ve<i.length;ve++){var pe=i[ve];if(pe.from>=V||pe.to<=G)continue;var Se=pe.level!=1,Pe=un(e,r,Se?Math.min(V,pe.to)-1:Math.max(G,pe.from)).right,Ke=Pe<C?C-Pe+1e9:Pe-C;(!re||oe>Ke)&&(re=pe,oe=Ke)}return re||(re=i[i.length-1]),re.from<G&&(re={from:G,to:re.to,level:re.level}),re.to>V&&(re={from:re.from,to:V,level:re.level}),re}var kn;function $n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(kn==null){kn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)kn.appendChild(document.createTextNode("x")),kn.appendChild(a("br"));kn.appendChild(document.createTextNode("x"))}s(e.measure,kn);var n=kn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function Qn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");s(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,C=t.gutters.firstChild,N=0;C;C=C.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=C.offsetLeft+C.clientLeft+i,r[H]=C.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=$n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Qn(e.display)-3);return function(i){if(rn(e.doc,i))return 0;var C=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(C+=i.widgets[N].height);return n?C+(Math.ceil(i.text.length/r)||1)*t:C+t}}function _a(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&Vt(r,i)})}function In(e,t,n,r){var i=e.display;if(!n&&de(t).getAttribute("cm-not-content")=="true")return null;var C,N,H=i.lineSpace.getBoundingClientRect();try{C=t.clientX-H.left,N=t.clientY-H.top}catch(oe){return null}var G=ya(e,C,N),V;if(r&&G.xRel>0&&(V=ke(e.doc,G.line).text).length==G.ch){var re=X(V,V.length,e.options.tabSize)-V.length;G=Ce(G.line,Math.max(0,Math.round((C-ro(e.display).left)/Qn(e.display))-re))}return G}function Un(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Fr(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ur&&En(e.doc,t)<i.viewTo&&_n(e);else if(n<=i.viewFrom)Ur&&Fi(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 C=Hi(e,n,n+r,1);C?(i.view=i.view.slice(C.index),i.viewFrom=C.lineN,i.viewTo+=r):_n(e)}else if(n>=i.viewTo){var N=Hi(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):_n(e)}else{var H=Hi(e,t,t,-1),G=Hi(e,n,n+r,1);H&&G?(i.view=i.view.slice(0,H.index).concat(ur(e,H.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):_n(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function xn(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 C=r.view[Un(e,t)];if(C.node==null)return;var N=C.changes||(C.changes=[]);ie(N,n)==-1&&N.push(n)}function _n(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Hi(e,t,n,r){var i=Un(e,t),C,N=e.display.view;if(!Ur||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,G=0;G<i;G++)H+=N[G].size;if(H!=t){if(r>0){if(i==N.length-1)return null;C=H+N[i].size-t,i++}else C=H-t;t+=C,n+=C}for(;En(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=ur(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=ur(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Un(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(ur(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Un(e,n)))),r.viewTo=n}function vo(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 gi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var G=H.empty();(G||e.options.showCursorWhenSelecting)&&Eo(e,H.head,i),G||Xs(e,H,C)}return r}function Eo(e,t,n){var r=nn(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 C=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Ki(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,C=document.createDocumentFragment(),N=ro(e.display),H=N.left,G=Math.max(r.sizerWidth,Mn(e)-r.sizer.offsetLeft)-N.right,V=i.direction=="ltr";function re(Je,mt,At,xt){mt<0&&(mt=0),mt=Math.round(mt),xt=Math.round(xt),C.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Je+`px;
top: `+mt+"px; width: "+(At==null?G-Je:At)+`px;
height: `+(xt-mt)+"px"))}function oe(Je,mt,At){var xt=ke(i,Je),Nt=xt.text.length,tr,Sr;function sr(mr,Wr){return ga(e,Ce(Je,mr),"div",xt,Wr)}function zr(mr,Wr,Ar){var Er=po(e,xt,null,mr),pr=Wr=="ltr"==(Ar=="after")?"left":"right",dr=Ar=="after"?Er.begin:Er.end-(/\s/.test(xt.text.charAt(Er.end-1))?2:1);return sr(dr,pr)[pr]}var jr=nt(xt,i.direction);return rt(jr,mt||0,At==null?Nt:At,function(mr,Wr,Ar,Er){var pr=Ar=="ltr",dr=sr(mr,pr?"left":"right"),Hr=sr(Wr-1,pr?"right":"left"),ui=mt==null&&mr==0,Ln=At==null&&Wr==Nt,Or=Er==0,dn=!jr||Er==jr.length-1;if(Hr.top-dr.top<=3){var wr=(V?ui:Ln)&&Or,Xa=(V?Ln:ui)&&dn,gn=wr?H:(pr?dr:Hr).left,Wn=Xa?G:(pr?Hr:dr).right;re(gn,dr.top,Wn-gn,dr.bottom)}else{var Hn,Ir,di,Ya;pr?(Hn=V&&ui&&Or?H:dr.left,Ir=V?G:zr(mr,Ar,"before"),di=V?H:zr(Wr,Ar,"after"),Ya=V&&Ln&&dn?G:Hr.right):(Hn=V?zr(mr,Ar,"before"):H,Ir=!V&&ui&&Or?G:dr.right,di=!V&&Ln&&dn?H:Hr.left,Ya=V?zr(Wr,Ar,"after"):G),re(Hn,dr.top,Ir-Hn,dr.bottom),dr.bottom<Hr.top&&re(H,dr.bottom,null,Hr.top),re(di,Hr.top,Ya-di,Hr.bottom)}(!tr||Ki(dr,tr)<0)&&(tr=dr),Ki(Hr,tr)<0&&(tr=Hr),(!Sr||Ki(dr,Sr)<0)&&(Sr=dr),Ki(Hr,Sr)<0&&(Sr=Hr)}),{start:tr,end:Sr}}var ve=t.from(),pe=t.to();if(ve.line==pe.line)oe(ve.line,ve.ch,pe.ch);else{var Se=ke(i,ve.line),Pe=ke(i,pe.line),Ke=Dr(Se)==Dr(Pe),Qe=oe(ve.line,ve.ch,Ke?Se.text.length+1:null).end,dt=oe(pe.line,Ke?0:null,pe.ch).start;Ke&&(Qe.top<dt.top-2?(re(Qe.right,Qe.top,null,Qe.bottom),re(H,dt.top,dt.left,dt.bottom)):re(Qe.right,Qe.top,dt.left-Qe.right,Qe.bottom)),Qe.bottom<dt.top&&re(H,Qe.bottom,null,dt.top)}n.appendChild(C)}function Ta(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Jn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Jn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,I(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Jn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Gi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],C=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(U&&k<8){var G=i.node.offsetTop+i.node.offsetHeight;N=G-n,n=G}else{var V=i.node.getBoundingClientRect();N=V.bottom-V.top,!C&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var re=i.line.height-N;if((re>.005||re<-.005)&&(Vt(i.line,N),_o(i.line),i.rest))for(var oe=0;oe<i.rest.length;oe++)_o(i.rest[oe]);if(H>e.display.sizerWidth){var ve=Math.ceil(H/Qn(e.display));ve>e.display.maxLineLength&&(e.display.maxLineLength=ve,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function _o(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 zi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ji(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,C=br(t,r),N=br(t,i);if(n&&n.ensure){var H=n.ensure.from.line,G=n.ensure.to.line;H<C?(C=H,N=br(t,Kr(ke(t,H))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=N&&(C=br(t,Kr(ke(t,G))-e.wrapper.clientHeight),N=G)}return{from:C,to:Math.max(N,C+1)}}function Ys(e,t){if(De(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var C=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-ji(e.display))+`px;
height: `+(t.bottom-t.top+ln(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(i),e.display.lineSpace.removeChild(C)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ce(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ce(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var N=!1,H=nn(e,t),G=!n||n==t?H:nn(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 V=wa(e,i),re=e.doc.scrollTop,oe=e.doc.scrollLeft;if(V.scrollTop!=null&&(yi(e,V.scrollTop),Math.abs(e.doc.scrollTop-re)>1&&(N=!0)),V.scrollLeft!=null&&(Nn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-oe)>1&&(N=!0)),!N)break}return i}function Qs(e,t){var n=wa(e,t);n.scrollTop!=null&&yi(e,n.scrollTop),n.scrollLeft!=null&&Nn(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=$n(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,C=ha(e),N={};t.bottom-t.top>C&&(t.bottom=t.top+C);var H=e.doc.height+fa(n),G=t.top<r,V=t.bottom>H-r;if(t.top<i)N.scrollTop=G?0:t.top;else if(t.bottom>i+C){var re=Math.min(t.top,(V?H:t.bottom)-C);re!=i&&(N.scrollTop=re)}var oe=e.options.fixedGutter?0:n.gutters.offsetWidth,ve=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-oe,pe=Mn(e)-n.gutters.offsetWidth,Se=t.right-t.left>pe;return Se&&(t.right=t.left+pe),t.left<10?N.scrollLeft=0:t.left<ve?N.scrollLeft=Math.max(0,t.left+oe-(Se?0:10)):t.right>pe+ve-3&&(N.scrollLeft=t.right+(Se?0:10)-pe),N}function Ca(e,t){if(t==null)return;Vi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Zn(e){Vi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function vi(e,t,n){(t!=null||n!=null)&&Vi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Vi(e),e.curOp.scrollToPos=t}function Vi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);To(e,n,r,t.margin)}}function To(e,t,n,r){var i=wa(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});vi(e,i.scrollLeft,i.scrollTop)}function yi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;A||La(e,{top:t}),So(e,t,!0),A&&La(e),xi(e,100)}function So(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 Nn(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,Do(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(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+ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Fn=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,U&&k<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Fn.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 C=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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}},Fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Fn.prototype.zeroWidthHack=function(){var e=d&&!T?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new te,this.disableVert=new te},Fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),C=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var bi=function(){};bi.prototype.update=function(){return{bottom:0,right:0}},bi.prototype.setScrollLeft=function(){},bi.prototype.setScrollTop=function(){},bi.prototype.clear=function(){};function qn(e,t){t||(t=Ei(e));var n=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Gi(e),wo(e,Ei(e)),n=e.display.barWidth,r=e.display.barHeight}function wo(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 Co={native:Fn,null:bi};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Co[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"?Nn(e,t):yi(e,t)},e),e.display.scrollbars.addClass&&I(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function Bn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Gt(e.curOp)}function jn(e){var t=e.curOp;t&&Qt(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 C=0;C<t.length;C++)nl(t[C]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&fn(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 Xi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Gi(t),e.barMeasure=Ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Mn(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&&Nn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==L();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&qn(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&bo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&So(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Nn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,vt(r,e.scrollToPos.from),vt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var C=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(C)for(var H=0;H<C.length;++H)C[H].lines.length||be(C[H],"hide");if(N)for(var G=0;G<N.length;++G)N[G].lines.length&&be(N[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Gr(e,t){if(e.curOp)return t();Bn(e);try{return t()}finally{jn(e)}}function _r(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Bn(e);try{return t.apply(e,arguments)}finally{jn(e)}}}function kr(e){return function(){if(this.curOp)return e.apply(this,arguments);Bn(this);try{return e.apply(this,arguments)}finally{jn(this)}}}function Tr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Bn(t);try{return e.apply(this,arguments)}finally{jn(t)}}}function xi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,j(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Ne(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var N=C.styles,H=C.text.length>e.options.maxHighlightLength?Lt(t.mode,r.state):null,G=cn(e,C,r,!0);H&&(r.state=H),C.styles=G.styles;var V=C.styleClasses,re=G.classes;re?C.styleClasses=re:V&&(C.styleClasses=null);for(var oe=!N||N.length!=C.styles.length||V!=re&&(!V||!re||V.bgClass!=re.bgClass||V.textClass!=re.textClass),ve=0;!oe&&ve<N.length;++ve)oe=N[ve]!=C.styles[ve];oe&&i.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&Rn(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Gr(e,function(){for(var C=0;C<i.length;C++)xn(e,i[C],"text")})}var Xi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=zi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mn(e),this.force=n,this.dims=ba(e),this.events=[]};Xi.prototype.signal=function(e,t){ae(e,t)&&this.events.push(arguments)},Xi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.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=ln(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ln(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=L();if(!t||!p(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&p(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==L())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&p(document.body,e.anchorNode)&&p(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 Aa(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&&vo(e)==0)return!1;Ro(e)&&(_n(e),t.dims=ba(e));var i=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<C&&C-n.viewFrom<20&&(C=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),Ur&&(C=En(e.doc,C),N=Fi(e.doc,N));var H=C!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,C,N),n.viewOffset=Kr(ke(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=vo(e);if(!H&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=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(V),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,xi(e,400)),n.updateLineNumbers=null,!0}function Lo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Mn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=zi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=zi(e.display,e.doc,n));if(!Aa(e,t))break;Gi(e);var i=Ei(e);gi(e),qn(e,i),Ra(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 La(e,t){var n=new Xi(e,t);if(Aa(e,n)){Gi(e),Lo(e,n);var r=Ei(e);gi(e),qn(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,C=r.lineDiv,N=C.firstChild;function H(Se){var Pe=Se.nextSibling;return R&&d&&e.display.currentWheelTarget==Se?Se.style.display="none":Se.parentNode.removeChild(Se),Pe}for(var G=r.view,V=r.viewFrom,re=0;re<G.length;re++){var oe=G[re];if(!oe.hidden)if(!oe.node||oe.node.parentNode!=C){var ve=Us(e,oe,V,n);C.insertBefore(ve,N)}else{for(;N!=oe.node;)N=H(N);var pe=i&&t!=null&&t<=V&&oe.lineNumber;oe.changes&&(ie(oe.changes,"gutter")>-1&&(pe=!1),Ja(e,oe,V,n)),pe&&(h(oe.lineNumber),oe.lineNumber.appendChild(document.createTextNode(Et(e.options,V)))),N=oe.node.nextSibling}V+=oe.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+ln(e)+"px"}function Do(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,C=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=C),n[N].gutterBackground&&(n[N].gutterBackground.style.left=C));var H=n[N].alignable;if(H)for(var G=0;G<H.length;G++)H[G].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Et(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")),C=i.firstChild.offsetWidth,N=i.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var C=e[i],N=null;if(typeof C!="string"&&(N=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:C,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Oo(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],C=i.className,N=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+C));N&&(H.style.cssText=N),C=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function _i(e){Oo(e.display),Fr(e),Do(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=E("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=E("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var C=E("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[C],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+le+"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"),U&&k<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(A&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Oa(r.gutters,r.lineNumbers),Oo(i),n.init(i)}var Yi=0,Vr=null;U?Vr=-.53:A?Vr=15:g?Vr=-.7:O&&(Vr=-1/3);function Po(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=Po(e);return t.x*=Vr,t.y*=Vr,t}function Mo(e,t){var n=Po(t),r=n.x,i=n.y,C=e.display,N=C.scroller,H=N.scrollWidth>N.clientWidth,G=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&G))return;if(i&&d&&R){e:for(var V=t.target,re=C.view;V!=N;V=V.parentNode)for(var oe=0;oe<re.length;oe++)if(re[oe].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!A&&!b&&Vr!=null){i&&G&&yi(e,Math.max(0,N.scrollTop+i*Vr)),Nn(e,Math.max(0,N.scrollLeft+r*Vr)),(!i||i&&G)&&Y(t),C.wheelStartX=null;return}if(i&&Vr!=null){var ve=i*Vr,pe=e.doc.scrollTop,Se=pe+C.wrapper.clientHeight;ve<0?pe=Math.max(0,pe+ve-50):Se=Math.min(e.doc.height,Se+ve+50),La(e,{top:pe,bottom:Se})}Yi<20&&(C.wheelStartX==null?(C.wheelStartX=N.scrollLeft,C.wheelStartY=N.scrollTop,C.wheelDX=r,C.wheelDY=i,setTimeout(function(){if(C.wheelStartX==null)return;var Pe=N.scrollLeft-C.wheelStartX,Ke=N.scrollTop-C.wheelStartY,Qe=Ke&&C.wheelDY&&Ke/C.wheelDY||Pe&&C.wheelDX&&Pe/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!Qe)return;Vr=(Vr*Yi+Qe)/(Yi+1),++Yi},200)):(C.wheelDX+=r,C.wheelDY+=i))}var Xr=function(e,t){this.ranges=e,this.primIndex=t};Xr.prototype.primary=function(){return this.ranges[this.primIndex]},Xr.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(!xr(n.anchor,r.anchor)||!xr(n.head,r.head))return!1}return!0},Xr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new $t(Qr(this.ranges[t].anchor),Qr(this.ranges[t].head));return new Xr(e,this.primIndex)},Xr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Xr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var $t=function(e,t){this.anchor=e,this.head=t};$t.prototype.from=function(){return cr(this.anchor,this.head)},$t.prototype.to=function(){return Jr(this.anchor,this.head)},$t.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function an(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(ve,pe){return ft(ve.from(),pe.from())}),n=ie(t,i);for(var C=1;C<t.length;C++){var N=t[C],H=t[C-1],G=ft(H.to(),N.from());if(r&&!N.empty()?G>0:G>=0){var V=cr(H.from(),N.from()),re=Jr(H.to(),N.to()),oe=H.empty()?N.from()==N.head:H.from()==H.head;C<=n&&--n,t.splice(--C,2,new $t(oe?re:V,oe?V:re))}}return new Xr(t,n)}function Tn(e,t){return new Xr([new $t(e,t||e)],0)}function Sn(e){return e.text?Ce(e.from.line+e.text.length-1,ye(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function ko(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Sn(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+=Sn(t).ch-t.to.ch),Ce(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new $t(ko(i.anchor,t),ko(i.head,t)))}return an(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Ce(n.line,e.ch-t.ch+n.ch):Ce(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ce(e.first,0),C=i,N=0;N<t.length;N++){var H=t[N],G=Io(H.from,i,C),V=Io(Sn(H),i,C);if(i=H.to,C=V,n=="around"){var re=e.sel.ranges[N],oe=ft(re.head,re.anchor)<0;r[N]=new $t(oe?V:G,oe?G:V)}else r[N]=new $t(G,G)}return new Xr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Ft(e.options,e.doc.modeOption),Ti(e)}function Ti(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,xi(e,100),e.state.modeGen++,e.curOp&&Fr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&ye(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ka(e,t,n,r){function i(dt){return n?n[dt]:null}function C(dt,Je,mt){la(dt,Je,mt,r),qt(dt,"change",dt,t)}function N(dt,Je){for(var mt=[],At=dt;At<Je;++At)mt.push(new bn(V[At],i(At),r));return mt}var H=t.from,G=t.to,V=t.text,re=ke(e,H.line),oe=ke(e,G.line),ve=ye(V),pe=i(V.length-1),Se=G.line-H.line;if(t.full)e.insert(0,N(0,V.length)),e.remove(V.length,e.size-V.length);else if(Uo(e,t)){var Pe=N(0,V.length-1);C(oe,oe.text,pe),Se&&e.remove(H.line,Se),Pe.length&&e.insert(H.line,Pe)}else if(re==oe)if(V.length==1)C(re,re.text.slice(0,H.ch)+ve+re.text.slice(G.ch),pe);else{var Ke=N(1,V.length-1);Ke.push(new bn(ve+re.text.slice(G.ch),pe,r)),C(re,re.text.slice(0,H.ch)+V[0],i(0)),e.insert(H.line+1,Ke)}else if(V.length==1)C(re,re.text.slice(0,H.ch)+V[0]+oe.text.slice(G.ch),i(0)),e.remove(H.line+1,Se);else{C(re,re.text.slice(0,H.ch)+V[0],i(0)),C(oe,ve+oe.text.slice(G.ch),pe);var Qe=N(1,V.length-1);Se>1&&e.remove(H.line+1,Se-1),e.insert(H.line+1,Qe)}qt(e,"change",e,t)}function wn(e,t,n){function r(i,C,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var G=i.linked[H];if(G.doc==C)continue;var V=N&&G.sharedHist;if(n&&!V)continue;t(G.doc,V),r(G.doc,i,V)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,_a(e),Ma(e),Fo(e),e.options.lineWrapping||fn(e),e.options.mode=t.modeOption,Fr(e)}function Fo(e){(e.doc.direction=="rtl"?I:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){Gr(e,function(){Fo(e),Fr(e)})}function $i(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 Ia(e,t){var n={from:Qr(t.from),to:Sn(t),text:zt(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),wn(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=ye(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(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 jo(e,t,n,r){var i=e.history;i.undone.length=0;var C=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))H=ye(N.changes),ft(t.from,t.to)==0&&ft(t.from,H.to)==0?H.to=Sn(t):N.changes.push(Ia(e,t));else{var G=ye(i.done);for((!G||!G.ranges)&&Qi(e.sel,i.done),N={changes:[Ia(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=C,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||be(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,C=r&&r.origin;n==i.lastSelOp||C&&i.lastSelOrigin==C&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==C||pl(e,C,ye(i.done),t))?i.done[i.done.length-1]=t:Qi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=C,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Qi(e,t){var n=ye(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[C]=N.markedSpans),++C})}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 Ho(e,t){var n=yl(e,t),r=Zt(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var C=n[i],N=r[i];if(C&&N){e:for(var H=0;H<N.length;++H){for(var G=N[H],V=0;V<C.length;++V)if(C[V].marker==G.marker)continue e;C.push(G)}}else N&&(n[i]=N)}return n}function ei(e,t,n){for(var r=[],i=0;i<e.length;++i){var C=e[i];if(C.ranges){r.push(n?Xr.prototype.deepCopy.call(C):C);continue}var N=C.changes,H=[];r.push({changes:H});for(var G=0;G<N.length;++G){var V=N[G],re=void 0;if(H.push({from:V.from,to:V.to,text:V.text}),t)for(var oe in V)(re=oe.match(/^spans_(\d+)$/))&&(ie(t,Number(re[1]))>-1&&(ye(H)[oe]=V[oe],delete V[oe]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var C=ft(t,i)<0;C!=ft(n,i)<0?(i=t,t=n):C!=ft(t,n)<0&&(t=n)}return new $t(i,t)}else return new $t(n||t,t)}function Ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Rr(e,new Xr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=Ua(e.sel.ranges[C],t[C],null,i);var N=an(e.cm,r,e.sel.primIndex);Rr(e,N,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Rr(e,an(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Rr(e,Tn(t,n),r)}function El(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var C=0;C<i.length;C++)this.ranges[C]=new $t(vt(e,i[C].anchor),vt(e,i[C].head))},origin:n&&n.origin};return be(e,"beforeSelectionChange",e,r),e.cm&&be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?an(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=ye(r);i&&i.ranges?(r[r.length-1]=t,Zi(e,t,n)):Rr(e,t,n)}function Rr(e,t,n){Zi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Zi(e,t,n){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=El(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Zn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ue(e.cm)),qt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,C=0;C<t.ranges.length;C++){var N=t.ranges[C],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],G=qi(e,N.anchor,H&&H.anchor,n,r),V=qi(e,N.head,H&&H.head,n,r);(i||G!=N.anchor||V!=N.head)&&(i||(i=t.ranges.slice(0,C)),i[C]=new $t(G,V))}return i?an(e.cm,i,t.primIndex):t}function ti(e,t,n,r,i){var C=ke(e,t.line);if(C.markedSpans)for(var N=0;N<C.markedSpans.length;++N){var H=C.markedSpans[N],G=H.marker,V="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,re="selectRight"in G?!G.selectRight:G.inclusiveRight;if((H.from==null||(V?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(re?H.to>=t.ch:H.to>t.ch))){if(i&&(be(G,"beforeCursorEnter"),G.explicitlyCleared))if(C.markedSpans){--N;continue}else break;if(!G.atomic)continue;if(n){var oe=G.find(r<0?1:-1),ve=void 0;if((r<0?re:V)&&(oe=$o(e,oe,-r,oe&&oe.line==t.line?C:null)),oe&&oe.line==t.line&&(ve=ft(oe,n))&&(r<0?ve<0:ve>0))return ti(e,oe,t,r,i)}var pe=G.find(r<0?-1:1);return(r<0?V:re)&&(pe=$o(e,pe,r,pe.line==t.line?C:null)),pe?ti(e,pe,t,r,i):null}}return t}function qi(e,t,n,r,i){var C=r||1,N=ti(e,t,n,C,i)||!i&&ti(e,t,n,C,!0)||ti(e,t,n,-C,i)||!i&&ti(e,t,n,-C,!0);return N||(e.cantEdit=!0,Ce(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?vt(e,Ce(t.line-1)):null:n>0&&t.ch==(r||ke(e,t.line)).text.length?t.line<e.first+e.size-1?Ce(t.line+1,0):null:new Ce(t.line,t.ch+n)}function Qo(e){e.setSelection(Ce(e.firstLine(),0),Ce(e.lastLine()),me)}function Jo(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,C,N,H){i&&(r.from=vt(e,i)),C&&(r.to=vt(e,C)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),be(e,"beforeChange",e,r),e.cm&&be(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 ri(e,t,n){if(e.cm){if(!e.cm.curOp)return _r(e.cm,ri)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Gn&&!n&&Pr(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]==""&&ft(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),Si(e,t,n,Zt(e,t));var r=[];wn(e,function(i,C){!C&&ie(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),Si(i,t,null,Zt(i,t))})}function ea(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,C,N=e.sel,H=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,V=0;V<H.length&&!(C=H[V],n?C.ranges&&!C.equals(e.sel):!C.ranges);V++);if(V==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(C=H.pop(),C.ranges){if(Qi(C,G),n&&!C.equals(e.sel)){Rr(e,C,{clearRedo:!1});return}N=C}else if(r){H.push(C);return}else break;var re=[];Qi(N,G),G.push({changes:re,generation:i.generation}),i.generation=C.generation||++i.maxGeneration;for(var oe=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),ve=function(Pe){var Ke=C.changes[Pe];if(Ke.origin=t,oe&&!Jo(e,Ke,!1))return H.length=0,{};re.push(Ia(e,Ke));var Qe=Pe?Pa(e,Ke):ye(H);Si(e,Ke,Qe,Ho(e,Ke)),!Pe&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Sn(Ke)});var dt=[];wn(e,function(Je,mt){!mt&&ie(dt,Je.history)==-1&&(rs(Je.history,Ke),dt.push(Je.history)),Si(Je,Ke,null,Ho(Je,Ke))})},pe=C.changes.length-1;pe>=0;--pe){var Se=ve(pe);if(Se)return Se.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Xr(Fe(e.sel.ranges,function(i){return new $t(Ce(i.anchor.line+t,i.anchor.ch),Ce(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Fr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)xn(e.cm,r,"gutter")}}function Si(e,t,n,r){if(e.cm&&!e.cm.curOp)return _r(e.cm,Si)(e,t,n,r);if(t.to.line<e.first){qo(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);qo(e,i),t={from:Ce(e.first,0),to:Ce(t.to.line+i,t.to.ch),text:[ye(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Ce(C,ke(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zt(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?bl(e.cm,t,r):ka(e,t,r),Zi(e,n,me),e.cantEdit&&qi(e,Ce(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,n){var r=e.doc,i=e.display,C=t.from,N=t.to,H=!1,G=C.line;e.options.lineWrapping||(G=Mt(Dr(ke(r,C.line))),r.iter(G,N.line+1,function(pe){if(pe==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ue(e),ka(r,t,n,go(e)),e.options.lineWrapping||(r.iter(G,C.line+t.text.length,function(pe){var Se=Xn(pe);Se>i.maxLineLength&&(i.maxLine=pe,i.maxLineLength=Se,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),ci(r,C.line),xi(e,400);var V=t.text.length-(N.line-C.line)-1;t.full?Fr(e):C.line==N.line&&t.text.length==1&&!Uo(e.doc,t)?xn(e,C.line,"text"):Fr(e,C.line,N.line+1,V);var re=ae(e,"changes"),oe=ae(e,"change");if(oe||re){var ve={from:C,to:N,text:t.text,removed:t.removed,origin:t.origin};oe&&qt(e,"change",e,ve),re&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(ve)}e.display.selForContextMenu=null}function ni(e,t,n,r,i){var C;r||(r=n),ft(r,n)<0&&(C=[r,n],n=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),ri(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var C=e[i],N=!0;if(C.ranges){C.copied||(C=e[i]=C.deepCopy(),C.copied=!0);for(var H=0;H<C.ranges.length;H++)es(C.ranges[H].anchor,t,n,r),es(C.ranges[H].head,t,n,r);continue}for(var G=0;G<C.changes.length;++G){var V=C.changes[G];if(n<V.from.line)V.from=Ce(V.from.line+r,V.from.ch),V.to=Ce(V.to.line+r,V.to.ch);else if(t<=V.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function wi(e,t,n,r){var i=t,C=t;return typeof t=="number"?C=ke(e,Ut(e,t)):i=Mt(t),i==null?null:(r(C,i)&&e.cm&&xn(e.cm,i,n),C)}function Ci(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Ci.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),qt(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 Ai(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}Ai.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 C=Math.min(t,i-e),N=r.height;if(r.removeInner(e,C),this.height-=N-r.height,i==C&&(this.children.splice(n--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ci))){var H=[];this.collapse(H),this.children=[new Ci(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],C=i.chunkSize();if(e<=C){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var G=new Ci(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,N),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ai(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ie(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Ai(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],C=i.chunkSize();if(e<C){var N=Math.min(t,C-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=C}}};var Li=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Li.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Mt(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 C=mi(this);Vt(n,Math.max(0,n.height-C)),e&&(Gr(e,function(){ns(e,n,-C),xn(e,r,"widget")}),qt(e,"lineWidgetCleared",e,this,r))},Li.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=mi(this)-t;if(!i)return;rn(this.doc,r)||Vt(r,r.height+i),n&&Gr(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),qt(n,"lineWidgetChanged",n,e,Mt(r))})},se(Li);function ns(e,t,n){Kr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new Li(e,n,r),C=e.cm;return C&&i.noHScroll&&(C.display.alignWidgets=!0),wi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,C&&!rn(e,N)){var G=Kr(N)<e.scrollTop;Vt(N,N.height+mi(i)),G&&Ca(C,i.height),C.curOp.forceUpdate=!0}return!0}),C&&qt(C,"lineWidgetAdded",C,i,typeof t=="number"?t:Mt(t)),i}var is=0,Cn=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Cn.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Bn(e),ae(this,"clear")){var n=this.find();n&&qt(this,"clear",n.from,n.to)}for(var r=null,i=null,C=0;C<this.lines.length;++C){var N=this.lines[C],H=bt(N.markedSpans,this);e&&!this.collapsed?xn(e,Mt(N),"text"):e&&(H.to!=null&&(i=Mt(N)),H.from!=null&&(r=Mt(N))),N.markedSpans=at(N.markedSpans,H),H.from==null&&this.collapsed&&!rn(this.doc,N)&&e&&Vt(N,$n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var V=Dr(this.lines[G]),re=Xn(V);re>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=re,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Fr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&qt(e,"markerCleared",e,this,r,i),t&&jn(e),this.parent&&this.parent.clear()},Cn.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var C=this.lines[i],N=bt(C.markedSpans,this);if(N.from!=null&&(n=Ce(t?C:Mt(C),N.from),e==-1))return n;if(N.to!=null&&(r=Ce(t?C:Mt(C),N.to),e==1))return r}return n&&{from:n,to:r}},Cn.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;Gr(r,function(){var i=t.line,C=Mt(t.line),N=ma(r,C);if(N&&(so(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!rn(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var G=mi(n)-H;G&&Vt(i,i.height+G)}qt(r,"markerChanged",r,e)})},Cn.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ie(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Cn.prototype.detachLine=function(e){if(this.lines.splice(ie(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},se(Cn);function ii(e,t,n,r,i){if(r&&r.shared)return _l(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return _r(e.cm,ii)(e,t,n,r,i);var C=new Cn(e,i),N=ft(t,n);if(r&&F(r,C,!1),N>0||N==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=E("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(fi(e,t.line,t,n,C)||t.line!=n.line&&fi(e,n.line,t,n,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");ge()}C.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,G=e.cm,V;if(e.iter(H,n.line+1,function(oe){G&&C.collapsed&&!G.options.lineWrapping&&Dr(oe)==G.display.maxLine&&(V=!0),C.collapsed&&H!=t.line&&Vt(oe,0),ut(oe,new He(C,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),C.collapsed&&e.iter(t.line,n.line+1,function(oe){rn(e,oe)&&Vt(oe,0)}),C.clearOnEnter&&Ee(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&($e(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++is,C.atomic=!0),G){if(V&&(G.curOp.updateMaxLine=!0),C.collapsed)Fr(G,t.line,n.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var re=t.line;re<=n.line;re++)xn(G,re,"text");C.atomic&&Xo(G.doc),qt(G,"markerAdded",G,C)}return C}var Di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();qt(this,"clear")},Di.prototype.find=function(e,t){return this.primary.find(e,t)},se(Di);function _l(e,t,n,r,i){r=F(r),r.shared=!1;var C=[ii(e,t,n,r,i)],N=C[0],H=r.widgetNode;return wn(e,function(G){H&&(r.widgetNode=H.cloneNode(!0)),C.push(ii(G,vt(G,t),vt(G,n),r,i));for(var V=0;V<G.linked.length;++V)if(G.linked[V].isParent)return;N=ye(C)}),new Di(C,N)}function as(e){return e.findMarks(Ce(e.first,0),e.clipPos(Ce(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),C=e.clipPos(i.from),N=e.clipPos(i.to);if(ft(C,N)){var H=ii(e,C,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function Sl(e){for(var t=function(r){var i=e[r],C=[i.primary.doc];wn(i.primary.doc,function(G){return C.push(G)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];ie(C,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var wl=0,Br=function(e,t,n,r,i){if(!(this instanceof Br))return new Br(e,t,n,r,i);n==null&&(n=0),Ai.call(this,[new Ci([new bn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var C=Ce(n,0);this.sel=Tn(C),this.history=new $i(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)),ka(this,{from:C,to:C,text:e}),Rr(this,Tn(C),me)};Br.prototype=ze(Ai.prototype,{constructor:Br,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=jt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Tr(function(e){var t=Ce(this.first,0),n=this.first+this.size-1;ri(this,{from:t,to:Ce(n,ke(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&vi(this.cm,0,0),Rr(this,Tn(t),me)}),replaceRange:function(e,t,n,r){t=vt(this,t),n=n?vt(this,n):t,ni(this,e,t,n,r)},getRange:function(e,t,n){var r=zt(this,vt(this,e),vt(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(Yt(this,e))return ke(this,e)},getLineNumber:function(e){return Mt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ke(this,e)),Dr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return vt(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:Tr(function(e,t,n){Go(this,vt(this,typeof e=="number"?Ce(e,t||0):e),null,n)}),setSelection:Tr(function(e,t,n){Go(this,vt(this,e),vt(this,t||e),n)}),extendSelection:Tr(function(e,t,n){Ji(this,vt(this,e),t&&vt(this,t),n)}),extendSelections:Tr(function(e,t){Ko(this,gr(this,e),t)}),extendSelectionsBy:Tr(function(e,t){var n=Fe(this.sel.ranges,e);Ko(this,gr(this,n),t)}),setSelections:Tr(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new $t(vt(this,e[i].anchor),vt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Rr(this,an(this.cm,r,t),n)}),addSelection:Tr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new $t(vt(this,e),vt(this,t||e))),Rr(this,an(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=zt(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=zt(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:Tr(function(e,t,n){for(var r=[],i=this.sel,C=0;C<i.ranges.length;C++){var N=i.ranges[C];r[C]={from:N.from(),to:N.to(),text:this.splitLines(e[C]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)ri(this,r[G]);H?zo(this,H):this.cm&&Zn(this.cm)}),undo:Tr(function(){ea(this,"undo")}),redo:Tr(function(){ea(this,"redo")}),undoSelection:Tr(function(){ea(this,"undo",!0)}),redoSelection:Tr(function(){ea(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 $i(this.history.maxGeneration),wn(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:ei(this.history.done),undone:ei(this.history.undone)}},setHistory:function(e){var t=this.history=new $i(this.history.maxGeneration);t.done=ei(e.done.slice(0),null,!0),t.undone=ei(e.undone.slice(0),null,!0)},setGutterMarker:Tr(function(e,t,n){return wi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&je(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Tr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&wi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,je(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Yt(this,e))return null;if(t=e,e=ke(this,e),!e)return null}else if(t=Mt(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:Tr(function(e,t,n){return wi(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(_(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Tr(function(e,t,n){return wi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[i];if(C)if(n==null)r[i]=null;else{var N=C.match(_(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=C.slice(0,N.index)+(!N.index||H==C.length?"":" ")+C.slice(H)||null}else return!1;return!0})}),addLineWidget:Tr(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return ii(this,vt(this,e),vt(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=vt(this,e),ii(this,e,e,n,"bookmark")},findMarksAt:function(e){e=vt(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=vt(this,e),t=vt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(C){var N=C.markedSpans;if(N)for(var H=0;H<N.length;H++){var G=N[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 C=i.text.length+r;if(C>e)return t=e,!0;e-=C,++n}),vt(this,Ce(n,t))},indexFromPos:function(e){e=vt(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 Br(jt(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 Br(jt(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}],Tl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof ir&&(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(as(this));break}if(e.history==this.history){var r=[e.id];wn(e,function(i){return r.push(i.id)},!0),e.history=new $i(null),e.history.done=ei(this.history.done,r),e.history.undone=ei(this.history.undone,r)}},iterLinkedDocs:function(e){wn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Ue(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Tr(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)})}),Br.prototype.eachLine=Br.prototype.iter;var os=0;function Cl(e){var t=this;if(ss(t),De(t,e)||mn(t.display,e))return;Y(e),U&&(os=+new Date);var n=In(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,C=Array(i),N=0,H=function(){++N==i&&_r(t,function(){n=vt(t.doc,n);var pe={from:n,to:n,text:t.doc.splitLines(C.filter(function(Se){return Se!=null}).join(t.doc.lineSeparator())),origin:"paste"};ri(t.doc,pe),zo(t.doc,Tn(vt(t.doc,n),vt(t.doc,Sn(pe))))})()},G=function(pe,Se){if(t.options.allowDropFileTypes&&ie(t.options.allowDropFileTypes,pe.type)==-1){H();return}var Pe=new FileReader;Pe.onerror=function(){return H()},Pe.onload=function(){var Ke=Pe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){H();return}C[Se]=Ke,H()},Pe.readAsText(pe)},V=0;V<r.length;V++)G(r[V],V);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 re=e.dataTransfer.getData("Text");if(re){var oe;if(t.state.draggingText&&!t.state.draggingText.copy&&(oe=t.listSelections()),Zi(t.doc,Tn(n,n)),oe)for(var ve=0;ve<oe.length;++ve)ni(t.doc,"",oe[ve].anchor,oe[ve].head,"drag");t.replaceSelection(re,"around","paste"),t.display.input.focus()}}catch(pe){}}}function Al(e,t){if(U&&(!e.state.draggingText||+new Date-os<100)){ee(t);return}if(De(e,t)||mn(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==",b&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),b&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=In(e,t);if(!n)return;var r=document.createDocumentFragment();Eo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),s(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(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 C=0;C<n.length;C++)e(n[C])})}var us=!1;function Dl(){if(us)return;Rl(),us=!0}function Rl(){var e;Ee(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Ol)},100))}),Ee(window,"blur",function(){return ls(Jn)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var An={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ri=0;Ri<10;Ri++)An[Ri+48]=An[Ri+96]=String(Ri);for(var ta=65;ta<=90;ta++)An[ta]=String.fromCharCode(ta);for(var Oi=1;Oi<=12;Oi++)An[Oi+111]=An[Oi+63235]="F"+Oi;var pn={};pn.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"},pn.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"},pn.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"},pn.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"]},pn.default=d?pn.macDefault:pn.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,C,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))C=!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),C&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Ml(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Fe(n.split(" "),Pl),C=0;C<i.length;C++){var N=void 0,H=void 0;C==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,C+1).join(" "),N="...");var G=t[H];if(!G)t[H]=N;else if(G!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var V in t)e[V]=t[V];return e}function ai(e,t,n,r){t=ra(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 ai(e,t.fallthrough,n,r);for(var C=0;C<t.fallthrough.length;C++){var N=ai(e,t.fallthrough[C],n,r);if(N)return N}}}function ds(e){var t=typeof e=="string"?e:An[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(b&&e.keyCode==34&&e.char)return!1;var n=An[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function ra(e){return typeof e=="string"?pn[e]:e}function oi(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var C=t(n[i]);r.length&&ft(C.from,ye(r).to)<=0;){var N=r.pop();if(ft(N.from,C.from)<0){C.from=N.from;break}}r.push(C)}Gr(e,function(){for(var H=r.length-1;H>=0;H--)ni(e.doc,"",r[H].from,r[H].to,"+delete");Zn(e)})}function Fa(e,t,n){var r=Te(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Ce(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var C=nt(n,t.doc.direction);if(C){var N=i<0?ye(C):C[0],H=i<0==(N.level==1),G=H?"after":"before",V;if(N.level>0||t.doc.direction=="rtl"){var re=Yn(t,n);V=i<0?n.text.length-1:0;var oe=un(t,re,V).top;V=ct(function(ve){return un(t,re,ve).top==oe},i<0==(N.level==1)?N.from:N.to-1,V),G=="before"&&(V=Fa(n,V,1))}else V=i<0?N.to:N.from;return new Ce(r,V,G)}}return new Ce(r,i<0?n.text.length:0,i<0?"before":"after")}function kl(e,t,n,r){var i=nt(t,e.doc.direction);if(!i)return Ba(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 C=Ge(i,n.ch,n.sticky),N=i[C];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Ba(t,n,r);var H=function(Qe,dt){return Fa(t,Qe instanceof Ce?Qe.ch:Qe,dt)},G,V=function(Qe){return e.options.lineWrapping?(G=G||Yn(e,t),po(e,t,G,Qe)):{begin:0,end:t.text.length}},re=V(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var oe=N.level==1==r<0,ve=H(n,oe?1:-1);if(ve!=null&&(oe?ve<=N.to&&ve<=re.end:ve>=N.from&&ve>=re.begin)){var pe=oe?"before":"after";return new Ce(n.line,ve,pe)}}var Se=function(Qe,dt,Je){for(var mt=function(tr,Sr){return Sr?new Ce(n.line,H(tr,1),"before"):new Ce(n.line,tr,"after")};Qe>=0&&Qe<i.length;Qe+=dt){var At=i[Qe],xt=dt>0==(At.level!=1),Nt=xt?Je.begin:H(Je.end,-1);if(At.from<=Nt&&Nt<At.to)return mt(Nt,xt);if(Nt=xt?At.from:H(At.to,-1),Je.begin<=Nt&&Nt<Je.end)return mt(Nt,xt)}},Pe=Se(C+r,r,re);if(Pe)return Pe;var Ke=r>0?re.end:H(re.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Pe=Se(r>0?0:i.length-1,r,V(Ke)),Pe)?Pe:null}var Pi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),me)},killLine:function(e){return oi(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:Ce(t.head.line+1,0)}:{from:t.head,to:Ce(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return oi(e,function(t){return{from:Ce(t.from().line,0),to:vt(e.doc,Ce(t.to().line+1,0))}})},delLineLeft:function(e){return oi(e,function(t){return{from:Ce(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return oi(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 oi(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(Ce(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ce(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},fe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},fe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ms(e,t.head):r},fe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var C=n[i].from(),N=X(e.getLine(C.line),C.ch,r);t.push(q(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Gr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,C=ke(e.doc,i.line).text;if(C){if(i.ch==C.length&&(i=new Ce(i.line,i.ch-1)),i.ch>0)i=new Ce(i.line,i.ch+1),e.replaceRange(C.charAt(i.ch-1)+C.charAt(i.ch-2),Ce(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=ke(e.doc,i.line-1).text;N&&(i=new Ce(i.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ce(i.line-1,N.length-1),i,"+transpose"))}}n.push(new $t(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Gr(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);Zn(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=ke(e.doc,t),r=Dr(n);return r!=n&&(t=Mt(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=ke(e.doc,t),r=yn(n);return r!=n&&(t=Mt(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=ke(e.doc,n.line),i=nt(r,e.doc.direction);if(!i||i[0].level==0){var C=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=C&&t.ch;return Ce(n.line,N?0:C,n.sticky)}return n}function na(e,t,n){if(typeof t=="string"&&(t=Pi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=_e}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=ai(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&ai(t,e.options.extraKeys,n,e)||ai(t,e.options.keyMap,n,e)}var Nl=new te;function Mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(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())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&qt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Ta(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Mi(e,"Shift-"+n,t,function(r){return na(e,r,!0)})||Mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):Mi(e,n,t,function(r){return na(e,r)}):!1}function Fl(e,t,n){return Mi(e,"'"+n+"'",t,function(r){return na(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=L(),De(t,e))return;U&&k<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);b&&(Wa=r?n:null,!r&&n==88&&!Tt&&(d?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),A&&!d&&!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;I(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Ze(document,"keyup",n),Ze(document,"mouseover",n))}Ee(document,"keyup",n),Ee(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),De(this,e)}function Es(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(mn(t.display,e)||De(t,e)||e.ctrlKey&&!e.altKey||d&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(b&&n==Wa){Wa=null,Y(e);return}if(b&&(!e.which||e.which<10)&&gs(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,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var ki,Ii;function Wl(e,t){var n=+new Date;return Ii&&Ii.compare(n,e,t)?(ki=Ii=null,"triple"):ki&&ki.compare(n,e,t)?(Ii=new Ha(n,e,t),ki=null,"double"):(ki=new Ha(n,e,t),Ii=null,"single")}function bs(e){var t=this,n=t.display;if(De(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,mn(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=In(t,e),i=xe(e),C=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,C,e))return;i==1?r?Gl(t,r,C,e):de(e)==n.scroller&&Y(e):i==2?(r&&Ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(l?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,Mi(e,cs(C,i),i,function(N){if(typeof N=="string"&&(N=Pi[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=_e}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 C=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=C?"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=d?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(d?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){U?setTimeout(j(bo,e),0):e.curOp.focus=L();var i=Kl(e,n,r),C=e.doc.sel,N;e.options.dragDrop&&Re&&!e.isReadOnly()&&n=="single"&&(N=C.contains(t))>-1&&(ft((N=C.ranges[N]).from(),t)<0||t.xRel>0)&&(ft(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,C=!1,N=_r(e,function(V){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ze(i.wrapper.ownerDocument,"mouseup",N),Ze(i.wrapper.ownerDocument,"mousemove",H),Ze(i.scroller,"dragstart",G),Ze(i.scroller,"drop",N),C||(Y(V),r.addNew||Ji(e.doc,n,null,null,r.extend),R&&!O||U&&k==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(V){C=C||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},G=function(){return C=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ee(i.wrapper.ownerDocument,"mouseup",N),Ee(i.wrapper.ownerDocument,"mousemove",H),Ee(i.scroller,"dragstart",G),Ee(i.scroller,"drop",N),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new $t(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new $t(Ce(t.line,0),vt(e.doc,Ce(t.line+1,0)));var r=n(e,t);return new $t(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,C=e.doc;Y(t);var N,H,G=C.sel,V=G.ranges;if(r.addNew&&!r.extend?(H=C.sel.contains(n),H>-1?N=V[H]:N=new $t(n,n)):(N=C.sel.primary(),H=C.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new $t(n,n)),n=In(e,t,!0,!0),H=-1;else{var re=xs(e,n,r.unit);r.extend?N=Ua(N,re.anchor,re.head,r.extend):N=re}r.addNew?H==-1?(H=V.length,Rr(C,an(e,V.concat([N]),H),{scroll:!1,origin:"*mouse"})):V.length>1&&V[H].empty()&&r.unit=="char"&&!r.extend?(Rr(C,an(e,V.slice(0,H).concat(V.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),G=C.sel):Na(C,H,N,he):(H=0,Rr(C,new Xr([N],0),he),G=C.sel);var oe=n;function ve(Je){if(ft(oe,Je)==0)return;if(oe=Je,r.unit=="rectangle"){for(var mt=[],At=e.options.tabSize,xt=X(ke(C,n.line).text,n.ch,At),Nt=X(ke(C,Je.line).text,Je.ch,At),tr=Math.min(xt,Nt),Sr=Math.max(xt,Nt),sr=Math.min(n.line,Je.line),zr=Math.min(e.lastLine(),Math.max(n.line,Je.line));sr<=zr;sr++){var jr=ke(C,sr).text,mr=ce(jr,tr,At);tr==Sr?mt.push(new $t(Ce(sr,mr),Ce(sr,mr))):jr.length>mr&&mt.push(new $t(Ce(sr,mr),Ce(sr,ce(jr,Sr,At))))}mt.length||mt.push(new $t(n,n)),Rr(C,an(e,G.ranges.slice(0,H).concat(mt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Je)}else{var Wr=N,Ar=xs(e,Je,r.unit),Er=Wr.anchor,pr;ft(Ar.anchor,Er)>0?(pr=Ar.head,Er=cr(Wr.from(),Ar.anchor)):(pr=Ar.anchor,Er=Jr(Wr.to(),Ar.head));var dr=G.ranges.slice(0);dr[H]=Xl(e,new $t(vt(C,Er),pr)),Rr(C,an(e,dr,H),he)}}var pe=i.wrapper.getBoundingClientRect(),Se=0;function Pe(Je){var mt=++Se,At=In(e,Je,!0,r.unit=="rectangle");if(!At)return;if(ft(At,oe)!=0){e.curOp.focus=L(),ve(At);var xt=zi(i,C);(At.line>=xt.to||At.line<xt.from)&&setTimeout(_r(e,function(){Se==mt&&Pe(Je)}),150)}else{var Nt=Je.clientY<pe.top?-20:Je.clientY>pe.bottom?20:0;Nt&&setTimeout(_r(e,function(){if(Se!=mt)return;i.scroller.scrollTop+=Nt,Pe(Je)}),50)}}function Ke(Je){e.state.selectingText=!1,Se=Infinity,Je&&(Y(Je),i.input.focus()),Ze(i.wrapper.ownerDocument,"mousemove",Qe),Ze(i.wrapper.ownerDocument,"mouseup",dt),C.history.lastSelOrigin=null}var Qe=_r(e,function(Je){Je.buttons===0||!xe(Je)?Ke(Je):Pe(Je)}),dt=_r(e,Ke);e.state.selectingText=dt,Ee(i.wrapper.ownerDocument,"mousemove",Qe),Ee(i.wrapper.ownerDocument,"mouseup",dt)}function Xl(e,t){var n=t.anchor,r=t.head,i=ke(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var C=nt(i);if(!C)return t;var N=Ge(C,n.ch,n.sticky),H=C[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var G=N+(H.from==n.ch==(H.level!=1)?0:1);if(G==0||G==C.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var re=Ge(C,r.ch,r.sticky),oe=re-N||(r.ch-n.ch)*(H.level==1?-1:1);re==G-1||re==G?V=oe<0:V=oe>0}var ve=C[G+(V?-1:0)],pe=V==(ve.level==1),Se=pe?ve.from:ve.to,Pe=pe?"after":"before";return n.ch==Se&&n.sticky==Pe?t:new $t(new Ce(n.line,Se,Pe),r)}function _s(e,t,n,r){var i,C;if(t.touches)i=t.touches[0].clientX,C=t.touches[0].clientY;else try{i=t.clientX,C=t.clientY}catch(ve){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(C>H.bottom||!ae(e,n))return J(t);C-=H.top-N.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var V=N.gutters.childNodes[G];if(V&&V.getBoundingClientRect().right>=i){var re=br(e.doc,C),oe=e.display.gutterSpecs[G];return be(e,n,e,re,oe.className,t),J(t)}}}function Ka(e,t){return _s(e,t,"gutterClick",!0)}function Ts(e,t){if(mn(e.display,t)||Yl(e,t))return;if(De(e,t,"contextmenu"))return;l||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(e,"gutterContextMenu")?_s(e,t,"gutterContextMenu",!1):!1}function Ss(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pi(e)}var si={toString:function(){return"CodeMirror.Init"}},ws={},ia={};function $l(e){var t=e.optionHandlers;function n(r,i,C,N){e.defaults[r]=i,C&&(t[r]=N?function(H,G,V){V!=si&&C(H,G,V)}:C)}e.defineOption=n,e.Init=si,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ma(r)},!0),n("indentUnit",2,Ma,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Ti(r),pi(r),Fr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var C=[],N=r.doc.first;r.doc.iter(function(G){for(var V=0;;){var re=G.text.indexOf(i,V);if(re==-1)break;V=re+i.length,C.push(Ce(N,re))}N++});for(var H=C.length-1;H>=0;H--)ni(r.doc,i,C[H],Ce(C[H].line,C[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,C){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),C!=si&&r.refresh()}),n("specialCharPlaceholder",yt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Ss(r),_i(r)},!0),n("keyMap","default",function(r,i,C){var N=ra(i),H=C!=si&&ra(C);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Oa(i,r.options.lineNumbers),_i(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return qn(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),qn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Oa(r.options.gutters,i),_i(r)},!0),n("firstLineNumber",1,_i,!0),n("lineNumberFormatter",function(r){return r},_i,!0),n("showCursorWhenSelecting",!1,gi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Jn(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,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gi,!0),n("singleCursorHeightPerLine",!0,gi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ti,!0),n("addModeClass",!1,Ti,!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,Ti,!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 Ql(e,t,n){var r=n&&n!=si;if(!t!=!r){var i=e.display.dragFunctions,C=t?Ee:Ze;C(e.display.scroller,"dragstart",i.start),C(e.display.scroller,"dragenter",i.enter),C(e.display.scroller,"dragover",i.over),C(e.display.scroller,"dragleave",i.leave),C(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(I(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),fn(e)),_a(e),Fr(e),pi(e),setTimeout(function(){return qn(e)},100)}function ir(e,t){var n=this;if(!(this instanceof ir))return new ir(e,t);this.options=t=t?F(t):{},F(ws,t,!1);var r=t.value;typeof r=="string"?r=new Br(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new ir.inputStyles[t.inputStyle](this),C=this.display=new dl(e,r,i,t);C.wrapper.CodeMirror=this,Ss(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(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 te,keySeq:null,specialChars:null},t.autofocus&&!o&&C.input.focus(),U&&k<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),Bn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Jn(this);for(var N in ia)ia.hasOwnProperty(N)&&ia[N](this,t[N],si);Ro(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ga.length;++H)Ga[H](this);jn(this),R&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}ir.defaults=ws,ir.optionHandlers=ia;function Zl(e){var t=e.display;Ee(t.scroller,"mousedown",_r(e,bs)),U&&k<11?Ee(t.scroller,"dblclick",_r(e,function(G){if(De(e,G))return;var V=In(e,G);if(!V||Ka(e,G)||mn(e.display,G))return;Y(G);var re=e.findWordAt(V);Ji(e.doc,re.anchor,re.head)})):Ee(t.scroller,"dblclick",function(G){return De(e,G)||Y(G)}),Ee(t.scroller,"contextmenu",function(G){return Ts(e,G)}),Ee(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||Ts(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 C(G){if(G.touches.length!=1)return!1;var V=G.touches[0];return V.radiusX<=1&&V.radiusY<=1}function N(G,V){if(V.left==null)return!0;var re=V.left-G.left,oe=V.top-G.top;return re*re+oe*oe>20*20}Ee(t.scroller,"touchstart",function(G){if(!De(e,G)&&!C(G)&&!Ka(e,G)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-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 V=t.activeTouch;if(V&&!mn(t,G)&&V.left!=null&&!V.moved&&new Date-V.start<300){var re=e.coordsChar(t.activeTouch,"page"),oe;!V.prev||N(V,V.prev)?oe=new $t(re,re):!V.prev.prev||N(V,V.prev.prev)?oe=e.findWordAt(re):oe=new $t(Ce(re.line,0),vt(e.doc,Ce(re.line+1,0))),e.setSelection(oe.anchor,oe.head),e.focus(),Y(G)}i()}),Ee(t.scroller,"touchcancel",i),Ee(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yi(e,t.scroller.scrollTop),Nn(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),Ee(t.scroller,"mousewheel",function(G){return Mo(e,G)}),Ee(t.scroller,"DOMMouseScroll",function(G){return Mo(e,G)}),Ee(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){De(e,G)||ee(G)},over:function(G){De(e,G)||(Ll(e,G),ee(G))},start:function(G){return Al(e,G)},drop:_r(e,Cl),leave:function(G){De(e,G)||ss(e)}};var H=t.input.getField();Ee(H,"keyup",function(G){return ys.call(e,G)}),Ee(H,"keydown",_r(e,vs)),Ee(H,"keypress",_r(e,Es)),Ee(H,"focus",function(G){return Sa(e,G)}),Ee(H,"blur",function(G){return Jn(e,G)})}var Ga=[];ir.defineInitHook=function(e){return Ga.push(e)};function Ui(e,t,n,r){var i=e.doc,C;n==null&&(n="add"),n=="smart"&&(i.mode.indent?C=Ne(e,t).state:n="prev");var N=e.options.tabSize,H=ke(i,t),G=X(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var V=H.text.match(/^\s*/)[0],re;if(!r&&!/\S/.test(H.text))re=0,n="not";else if(n=="smart"&&(re=i.mode.indent(C,H.text.slice(V.length),H.text),re==_e||re>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?re=X(ke(i,t-1).text,null,N):re=0:n=="add"?re=G+e.options.indentUnit:n=="subtract"?re=G-e.options.indentUnit:typeof n=="number"&&(re=G+n),re=Math.max(0,re);var oe="",ve=0;if(e.options.indentWithTabs)for(var pe=Math.floor(re/N);pe;--pe)ve+=N,oe+=" ";if(ve<re&&(oe+=q(re-ve)),oe!=V)return ni(i,oe,Ce(t,0),Ce(t,V.length),"+input"),H.stateAfter=null,!0;for(var Se=0;Se<i.sel.ranges.length;Se++){var Pe=i.sel.ranges[Se];if(Pe.head.line==t&&Pe.head.ch<V.length){var Ke=Ce(t,V.length);Na(i,Se,new $t(Ke,Ke));break}}}var on=null;function aa(e){on=e}function za(e,t,n,r,i){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,G=Ue(t),V=null;if(H&&r.ranges.length>1)if(on&&on.text.join(`
`)==t){if(r.ranges.length%on.text.length==0){V=[];for(var re=0;re<on.text.length;re++)V.push(C.splitLines(on.text[re]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=Fe(G,function(Qe){return[Qe]}));for(var oe=e.curOp.updateInput,ve=r.ranges.length-1;ve>=0;ve--){var pe=r.ranges[ve],Se=pe.from(),Pe=pe.to();pe.empty()&&(n&&n>0?Se=Ce(Se.line,Se.ch-n):e.state.overwrite&&!H?Pe=Ce(Pe.line,Math.min(ke(C,Pe.line).text.length,Pe.ch+ye(G).length)):H&&on&&on.lineWise&&on.text.join(`
`)==G.join(`
`)&&(Se=Pe=Ce(Se.line,0)));var Ke={from:Se,to:Pe,text:V?V[ve%V.length]:G,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};ri(e.doc,Ke),qt(e,"inputRead",e,Ke)}t&&!H&&As(e,t),Zn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=oe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Cs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Gr(t,function(){return za(t,n,0,null,"paste")}),!0}function As(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 C=e.getModeAt(i.head),N=!1;if(C.electricChars){for(var H=0;H<C.electricChars.length;H++)if(t.indexOf(C.electricChars.charAt(H))>-1){N=Ui(e,i.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(ke(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ui(e,i.head.line,"smart")));N&&qt(e,"electricInput",e,i.head.line)}}function Ls(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,C={anchor:Ce(i,0),head:Ce(i+1,0)};n.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:n}}function Ds(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){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 R?e.style.width="1000px":e.setAttribute("wrap","off"),S&&(e.style.border="1px solid black"),Ds(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 C=this.options,N=C[r];if(C[r]==i&&r!="mode")return;C[r]=i,t.hasOwnProperty(r)&&_r(this,t[r])(this,i,N),be(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"](ra(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,C=0;C<i.length;++C)if(i[C]==r||i[C].name==r)return i.splice(C,1),!0},addOverlay:kr(function(r,i){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");Be(this.state.overlays,{mode:C,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,Fr(this)}),removeOverlay:kr(function(r){for(var i=this.state.overlays,C=0;C<i.length;++C){var N=i[C].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(C,1),this.state.modeGen++,Fr(this);return}}}),indentLine:kr(function(r,i,C){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Yt(this.doc,r)&&Ui(this,r,i,C)}),indentSelection:kr(function(r){for(var i=this.doc.sel.ranges,C=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>C&&(Ui(this,H.head.line,r,!0),C=H.head.line,N==this.doc.sel.primIndex&&Zn(this));else{var G=H.from(),V=H.to(),re=Math.max(C,G.line);C=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var oe=re;oe<C;++oe)Ui(this,oe,r);var ve=this.doc.sel.ranges;G.ch==0&&i.length==ve.length&&ve[N].from().ch>0&&Na(this.doc,N,new $t(G,ve[N].to()),me)}}}),getTokenAt:function(r,i){return Zr(this,r,i)},getLineTokens:function(r,i){return Zr(this,Ce(r),i,!0)},getTokenTypeAt:function(r){r=vt(this.doc,r);var i=Dn(this,ke(this.doc,r.line)),C=0,N=(i.length-1)/2,H=r.ch,G;if(H==0)G=i[2];else for(;;){var V=C+N>>1;if((V?i[V*2-1]:0)>=H)N=V;else if(i[V*2+1]<H)C=V+1;else{G=i[V*2+2];break}}var re=G?G.indexOf("overlay "):-1;return re<0?G:re==0?null:G.slice(0,re-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 C=[];if(!n.hasOwnProperty(i))return C;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&C.push(N[H[i]]);else if(H[i])for(var G=0;G<H[i].length;G++){var V=N[H[i][G]];V&&C.push(V)}else H.helperType&&N[H.helperType]?C.push(N[H.helperType]):N[H.name]&&C.push(N[H.name]);for(var re=0;re<N._global.length;re++){var oe=N._global[re];oe.pred(H,this)&&ie(C,oe.val)==-1&&C.push(oe.val)}return C},getStateAfter:function(r,i){var C=this.doc;return r=Ut(C,r==null?C.first+C.size-1:r),Ne(this,r+1,i).state},cursorCoords:function(r,i){var C,N=this.doc.sel.primary();return r==null?C=N.head:typeof r=="object"?C=vt(this.doc,r):C=r?N.from():N.to(),nn(this,C,i||"page")},charCoords:function(r,i){return ga(this,vt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,br(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,C){var N=!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,N=!0),H=ke(this.doc,r)}else H=r;return Wi(this,H,{top:0,left:0},i||"page",C||N).top+(N?this.doc.height-Kr(H):0)},defaultTextHeight:function(){return $n(this.display)},defaultCharWidth:function(){return Qn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,C,N,H){var G=this.display;r=nn(this,vt(this.doc,r));var V=r.bottom,re=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),N=="over")V=r.top;else if(N=="above"||N=="near"){var oe=Math.max(G.wrapper.clientHeight,this.doc.height),ve=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>oe)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=oe&&(V=r.bottom),re+i.offsetWidth>ve&&(re=ve-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",H=="right"?(re=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?re=0:H=="middle"&&(re=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=re+"px"),C&&Qs(this,{left:re,top:V,right:re+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:kr(vs),triggerOnKeyPress:kr(Es),triggerOnKeyUp:ys,triggerOnMouseDown:kr(bs),execCommand:function(r){if(Pi.hasOwnProperty(r))return Pi[r].call(null,this)},triggerElectric:kr(function(r){As(this,r)}),findPosH:function(r,i,C,N){var H=1;i<0&&(H=-1,i=-i);for(var G=vt(this.doc,r),V=0;V<i&&!(G=Va(this.doc,G,H,C,N),G.hitSide);++V);return G},moveH:kr(function(r,i){var C=this;this.extendSelectionsBy(function(N){return C.display.shift||C.doc.extend||N.empty()?Va(C.doc,N.head,r,i,C.options.rtlMoveVisually):r<0?N.from():N.to()},fe)}),deleteH:kr(function(r,i){var C=this.doc.sel,N=this.doc;C.somethingSelected()?N.replaceSelection("",null,"+delete"):oi(this,function(H){var G=Va(N,H.head,r,i,!1);return r<0?{from:G,to:H.head}:{from:H.head,to:G}})}),findPosV:function(r,i,C,N){var H=1,G=N;i<0&&(H=-1,i=-i);for(var V=vt(this.doc,r),re=0;re<i;++re){var oe=nn(this,V,"div");if(G==null?G=oe.left:oe.left=G,V=Os(this,oe,H,C),V.hitSide)break}return V},moveV:kr(function(r,i){var C=this,N=this.doc,H=[],G=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(re){if(G)return r<0?re.from():re.to();var oe=nn(C,re.head,"div");re.goalColumn!=null&&(oe.left=re.goalColumn),H.push(oe.left);var ve=Os(C,oe,r,i);return i=="page"&&re==N.sel.primary()&&Ca(C,ga(C,ve,"div").top-oe.top),ve},fe),H.length)for(var V=0;V<N.sel.ranges.length;V++)N.sel.ranges[V].goalColumn=H[V]}),findWordAt:function(r){var i=this.doc,C=ke(i,r.line).text,N=r.ch,H=r.ch;if(C){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||H==C.length)&&N?--N:++H;for(var V=C.charAt(N),re=Me(V,G)?function(oe){return Me(oe,G)}:/\s/.test(V)?function(oe){return/\s/.test(oe)}:function(oe){return!/\s/.test(oe)&&!Me(oe)};N>0&&re(C.charAt(N-1));)--N;for(;H<C.length&&re(C.charAt(H));)++H}return new $t(Ce(r.line,N),Ce(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==L()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:kr(function(r,i){vi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ln(this)-this.display.barHeight,width:r.scrollWidth-ln(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:Mn(this)}},scrollIntoView:kr(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:Ce(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Js(this,r):To(this,r.from,r.to,r.margin)}),setSize:kr(function(r,i){var C=this,N=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&lo(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(G){if(G.widgets){for(var V=0;V<G.widgets.length;V++)if(G.widgets[V].noHScroll){xn(C,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(r){return Gr(this,r)},startOperation:function(){return Bn(this)},endOperation:function(){return jn(this)},refresh:kr(function(){var r=this.display.cachedTextHeight;Fr(this),this.curOp.forceUpdate=!0,pi(this),vi(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-$n(this.display))>.5||this.options.lineWrapping)&&_a(this),be(this,"refresh",this)}),swapDoc:kr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),pi(this),this.display.input.reset(),vi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,qt(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}},se(e),e.registerHelper=function(r,i,C){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=C},e.registerGlobalHelper=function(r,i,C,N){e.registerHelper(r,i,N),n[r]._global.push({pred:C,val:N})}}function Va(e,t,n,r,i){var C=t,N=n,H=ke(e,t.line),G=i&&e.direction=="rtl"?-n:n;function V(){var dt=t.line+G;return dt<e.first||dt>=e.first+e.size?!1:(t=new Ce(dt,t.ch,t.sticky),H=ke(e,dt))}function re(dt){var Je;if(r=="codepoint"){var mt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(mt)?Je=null:Je=new Ce(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(mt>=55296&&mt<56320?2:1))),-n)}else i?Je=kl(e.cm,H,t,n):Je=Ba(H,t,n);if(Je==null)if(!dt&&V())t=ja(i,e.cm,H,t.line,G);else return!1;else t=Je;return!0}if(r=="char"||r=="codepoint")re();else if(r=="column")re(!0);else if(r=="word"||r=="group")for(var oe=null,ve=r=="group",pe=e.cm&&e.cm.getHelper(t,"wordChars"),Se=!0;!(n<0&&!re(!Se));Se=!1){var Pe=H.text.charAt(t.ch)||`
`,Ke=Me(Pe,pe)?"w":ve&&Pe==`
`?"n":!ve||/\s/.test(Pe)?null:"p";if(ve&&!Se&&!Ke&&(Ke="s"),oe&&oe!=Ke){n<0&&(n=1,re(),t.sticky="after");break}if(Ke&&(oe=Ke),n>0&&!re(!Se))break}var Qe=qi(e,t,C,N,!0);return xr(C,Qe)&&(Qe.hitSide=!0),Qe}function Os(e,t,n,r){var i=e.doc,C=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(H-.5*$n(e.display),3);N=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var V;!(V=ya(e,C,N),!V.outside);){if(n<0?N<=0:N>=i.height){V.hitSide=!0;break}N+=n*5}return V}var Jt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Jt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Ds(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(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(!C(H)||De(r,H)||Cs(H,r))return;k<=11&&setTimeout(_r(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 N(H){if(!C(H)||De(r,H))return;if(r.somethingSelected())aa({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Ls(r);aa({lineWise:!0,text:G.text}),H.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,me),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var V=on.text.join(`
`);if(H.clipboardData.setData("Text",V),H.clipboardData.getData("Text")==V){H.preventDefault();return}}var re=Rs(),oe=re.firstChild;r.display.lineSpace.insertBefore(re,r.display.lineSpace.firstChild),oe.value=on.text.join(`
`);var ve=document.activeElement;z(oe),setTimeout(function(){r.display.lineSpace.removeChild(re),ve.focus(),ve==i&&n.showPrimarySelection()},50)}Ee(i,"copy",N),Ee(i,"cut",N)},Jt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Jt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Jt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Jt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Jt.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 C=oa(t,e.anchorNode,e.anchorOffset),N=oa(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&N&&!N.bad&&ft(cr(C,N),r)==0&&ft(Jr(C,N),i)==0)return;var H=t.display.view,G=r.line>=t.display.viewFrom&&Ps(t,r)||{node:H[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ps(t,i);if(!V){var re=H[H.length-1].measure,oe=re.maps?re.maps[re.maps.length-1]:re.map;V={node:oe[oe.length-1],offset:oe[oe.length-2]-oe[oe.length-3]}}if(!G||!V){e.removeAllRanges();return}var ve=e.rangeCount&&e.getRangeAt(0),pe;try{pe=v(G.node,G.offset,V.offset,V.node)}catch(Se){}pe&&(!A&&t.state.focused?(e.collapse(G.node,G.offset),pe.collapsed||(e.removeAllRanges(),e.addRange(pe))):(e.removeAllRanges(),e.addRange(pe)),ve&&e.anchorNode==null?e.addRange(ve):A&&this.startGracePeriod()),this.rememberSelection()},Jt.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)},Jt.prototype.showMultipleSelections=function(e){s(this.cm.display.cursorDiv,e.cursors),s(this.cm.display.selectionDiv,e.selection)},Jt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Jt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return p(this.div,t)},Jt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Jt.prototype.blur=function(){this.div.blur()},Jt.prototype.getField=function(){return this.div},Jt.prototype.supportsTouch=function(){return!0},Jt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Gr(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)},Jt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Jt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(c&&g&&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=oa(t,e.anchorNode,e.anchorOffset),r=oa(t,e.focusNode,e.focusOffset);n&&r&&Gr(t,function(){Rr(t.doc,Tn(n,r),me),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Jt.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=Ce(r.line-1,ke(e.doc,r.line-1).length)),i.ch==ke(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ce(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var C,N,H;r.line==t.viewFrom||(C=Un(e,r.line))==0?(N=Mt(t.view[0].line),H=t.view[0].node):(N=Mt(t.view[C].line),H=t.view[C-1].node.nextSibling);var G=Un(e,i.line),V,re;if(G==t.view.length-1?(V=t.viewTo-1,re=t.lineDiv.lastChild):(V=Mt(t.view[G+1].line)-1,re=t.view[G+1].node.previousSibling),!H)return!1;for(var oe=e.doc.splitLines(tu(e,H,re,N,V)),ve=zt(e.doc,Ce(N,0),Ce(V,ke(e.doc,V).text.length));oe.length>1&&ve.length>1;)if(ye(oe)==ye(ve))oe.pop(),ve.pop(),V--;else if(oe[0]==ve[0])oe.shift(),ve.shift(),N++;else break;for(var pe=0,Se=0,Pe=oe[0],Ke=ve[0],Qe=Math.min(Pe.length,Ke.length);pe<Qe&&Pe.charCodeAt(pe)==Ke.charCodeAt(pe);)++pe;for(var dt=ye(oe),Je=ye(ve),mt=Math.min(dt.length-(oe.length==1?pe:0),Je.length-(ve.length==1?pe:0));Se<mt&&dt.charCodeAt(dt.length-Se-1)==Je.charCodeAt(Je.length-Se-1);)++Se;if(oe.length==1&&ve.length==1&&N==r.line)for(;pe&&pe>r.ch&&dt.charCodeAt(dt.length-Se-1)==Je.charCodeAt(Je.length-Se-1);)pe--,Se++;oe[oe.length-1]=dt.slice(0,dt.length-Se).replace(/^\u200b+/,""),oe[0]=oe[0].slice(pe).replace(/\u200b+$/,"");var At=Ce(N,pe),xt=Ce(V,ve.length?ye(ve).length-Se:0);if(oe.length>1||oe[0]||ft(At,xt))return ni(e.doc,oe,At,xt,"+input"),!0},Jt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Jt.prototype.reset=function(){this.forceCompositionEnd()},Jt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Jt.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)},Jt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Gr(this.cm,function(){return Fr(e.cm)})},Jt.prototype.setUneditable=function(e){e.contentEditable="false"},Jt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||_r(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Jt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Jt.prototype.onContextMenu=function(){},Jt.prototype.resetPosition=function(){},Jt.prototype.needsContentAttribute=!0;function Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=ke(e.doc,t.line),i=no(n,r,t.line),C=nt(r,e.doc.direction),N="left";if(C){var H=Ge(C,t.ch);N=H%2?"right":"left"}var G=oo(i.map,t.ch,N);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 li(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var C="",N=!1,H=e.doc.lineSeparator(),G=!1;function V(pe){return function(Se){return Se.id==pe}}function re(){N&&(C+=H,G&&(C+=H),N=G=!1)}function oe(pe){pe&&(re(),C+=pe)}function ve(pe){if(pe.nodeType==1){var Se=pe.getAttribute("cm-text");if(Se){oe(Se);return}var Pe=pe.getAttribute("cm-marker"),Ke;if(Pe){var Qe=e.findMarks(Ce(r,0),Ce(i+1,0),V(+Pe));Qe.length&&(Ke=Qe[0].find(0))&&oe(zt(e.doc,Ke.from,Ke.to).join(H));return}if(pe.getAttribute("contenteditable")=="false")return;var dt=/^(pre|div|p|li|table|br)$/i.test(pe.nodeName);if(!/^br$/i.test(pe.nodeName)&&pe.textContent.length==0)return;dt&&re();for(var Je=0;Je<pe.childNodes.length;Je++)ve(pe.childNodes[Je]);/^(pre|p)$/i.test(pe.nodeName)&&(G=!0),dt&&(N=!0)}else pe.nodeType==3&&oe(pe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(ve(t),t==n);)t=t.nextSibling,G=!1;return C}function oa(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return li(e.clipPos(Ce(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 C=e.display.view[i];if(C.node==r)return ru(C,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!p(r,t))return li(Ce(Mt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var C=e.rest?ye(e.rest):e.line;return li(Ce(Mt(C),C.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var G=e.measure,V=G.maps;function re(Ke,Qe,dt){for(var Je=-1;Je<(V?V.length:0);Je++)for(var mt=Je<0?G.map:V[Je],At=0;At<mt.length;At+=3){var xt=mt[At+2];if(xt==Ke||xt==Qe){var Nt=Mt(Je<0?e.line:e.rest[Je]),tr=mt[At]+dt;return(dt<0||xt!=Ke)&&(tr=mt[At+(dt?1:0)]),Ce(Nt,tr)}}}var oe=re(N,H,n);if(oe)return li(oe,i);for(var ve=H.nextSibling,pe=N?N.nodeValue.length-n:0;ve;ve=ve.nextSibling){if(oe=re(ve,ve.firstChild,0),oe)return li(Ce(oe.line,oe.ch-pe),i);pe+=ve.textContent.length}for(var Se=H.previousSibling,Pe=n;Se;Se=Se.previousSibling){if(oe=re(Se,Se.firstChild,-1),oe)return li(Ce(oe.line,oe.ch+Pe),i);Pe+=Se.textContent.length}}var fr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new te,this.hasSelection=!1,this.composing=null};fr.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),S&&(i.style.width="0px"),Ee(i,"input",function(){U&&k>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ee(i,"paste",function(N){if(De(r,N)||Cs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function C(N){if(De(r,N))return;if(r.somethingSelected())aa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Ls(r);aa({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,me):(n.prevInput="",i.value=H.text.join(`
`),z(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ee(i,"cut",C),Ee(i,"copy",C),Ee(e.scroller,"paste",function(N){if(mn(e,N)||De(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Ee(e.lineSpace,"selectstart",function(N){mn(e,N)||Y(N)}),Ee(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ee(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},fr.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},fr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},fr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=nn(e,n.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-C.left))}return r},fr.prototype.showSelection=function(e){var t=this.cm,n=t.display;s(n.cursorDiv,e.cursors),s(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},fr.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),U&&k>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",U&&k>=9&&(this.hasSelection=null))},fr.prototype.getField=function(){return this.textarea},fr.prototype.supportsTouch=function(){return!1},fr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||L()!=this.textarea))try{this.textarea.focus()}catch(e){}},fr.prototype.blur=function(){this.textarea.blur()},fr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},fr.prototype.receivedFocus=function(){this.slowPoll()},fr.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()})},fr.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)},fr.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ve(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(U&&k>=9&&this.hasSelection===i||d&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=i.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return Gr(t,function(){za(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},fr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},fr.prototype.onKeyPress=function(){U&&k>=9&&(this.hasSelection=null),this.fastPoll()},fr.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=In(n,e),N=r.scroller.scrollTop;if(!C||b)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(C)==-1&&_r(n,Rr)(n.doc,Tn(C),me);var G=i.style.cssText,V=t.wrapper.style.cssText,re=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-re.top-5)+"px; left: "+(e.clientX-re.left-5)+`px;
z-index: 1000; background: `+(U?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var oe;R&&(oe=window.scrollY),r.input.focus(),R&&window.scrollTo(null,oe),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=pe,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function ve(){if(i.selectionStart!=null){var Pe=n.somethingSelected(),Ke="\u200B"+(Pe?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Pe?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function pe(){if(t.contextMenuPending!=pe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=G,U&&k<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!U||U&&k<9)&&ve();var Pe=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?_r(n,Qo)(n):Pe++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(U&&k>=9&&ve(),l){ee(e);var Se=function(){Ze(window,"mouseup",Se),setTimeout(pe,20)};Ee(window,"mouseup",Se)}else setTimeout(pe,50)},fr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},fr.prototype.setUneditable=function(){},fr.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?F(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=L();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 C=e.form;i=C.submit;try{var N=C.submit=function(){r(),C.submit=i,C.submit(),C.submit=N}}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=ir(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=Br,e.splitLines=Ue,e.countColumn=X,e.findColumn=ce,e.isWordChar=Ae,e.Pass=_e,e.signal=be,e.Line=bn,e.changeEnd=Sn,e.scrollbarModel=Co,e.Pos=Ce,e.cmpPos=ft,e.modes=kt,e.mimeModes=pt,e.resolveMode=Pt,e.getMode=Ft,e.modeExtensions=It,e.extendMode=Wt,e.copyState=Lt,e.startState=gt,e.innerMode=Ct,e.commands=Pi,e.keyMap=pn,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=ai,e.normalizeKeyMap=Ml,e.StringStream=tt,e.SharedTextMarker=Di,e.TextMarker=Cn,e.LineWidget=Li,e.e_preventDefault=Y,e.e_stopPropagation=Q,e.e_stop=ee,e.addClass=I,e.contains=p,e.rmClass=f,e.keyNames=An}$l(ir),ql(ir);var au="iter insert remove copy getEditor constructor".split(" ");for(var sa in Br.prototype)Br.prototype.hasOwnProperty(sa)&&ie(au,sa)<0&&(ir.prototype[sa]=function(e){return function(){return e.apply(this.doc,arguments)}}(Br.prototype[sa]));return se(Br),ir.inputStyles={textarea:fr,contenteditable:Jt},ir.defineMode=function(e){!ir.defaults.mode&&e!="null"&&(ir.defaults.mode=e),Bt.apply(this,arguments)},ir.defineMIME=Ot,ir.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ir.defineMIME("text/plain","null"),ir.defineExtension=function(e,t){ir.prototype[e]=t},ir.defineDocExtension=function(e,t){Br.prototype[e]=t},ir.fromTextArea=nu,iu(ir),ir.version="5.58.2",ir})},Y1PL:function(qe,Xe,$){"use strict";$.r(Xe),$.d(Xe,"ResizableTextArea",function(){return ie});var Z=$("wx14"),K=$("1OyB"),A=$("vuIU"),W=$("Ji7U"),M=$("LK+K"),P=$("cDcd"),U=$("VTBJ"),k=$("rePB"),R=$("Zm9Q"),D=$("Kwbf"),g=$("c+Xe"),b=$("m+aA"),O=$("bdgK"),T=new Map;function x(me){me.forEach(function(he){var fe,ce=he.target;(fe=T.get(ce))===null||fe===void 0||fe.forEach(function(ne){return ne(ce)})})}var S=new O.default(x),c=null,o=null;function d(me,he){T.has(me)||(T.set(me,new Set),S.observe(me)),T.get(me).add(he)}function u(me,he){T.has(me)&&(T.get(me).delete(he),T.get(me).size||(S.unobserve(me),T.delete(me)))}var w=function(me){Object(W.a)(fe,me);var he=Object(M.a)(fe);function fe(){return Object(K.a)(this,fe),he.apply(this,arguments)}return Object(A.a)(fe,[{key:"render",value:function(){return this.props.children}}]),fe}(P.Component),y=P.createContext(null);function m(me){var he=me.children,fe=me.onBatchResize,ce=P.useRef(0),ne=P.useRef([]),q=P.useContext(y),ye=P.useCallback(function(Fe,Be,We){ce.current+=1;var ze=ce.current;ne.current.push({size:Fe,element:Be,data:We}),Promise.resolve().then(function(){ze===ce.current&&(fe==null||fe(ne.current),ne.current=[])}),q==null||q(Fe,Be,We)},[fe,q]);return P.createElement(y.Provider,{value:ye},he)}function l(me){var he=me.children,fe=me.disabled,ce=P.useRef(null),ne=P.useRef(null),q=P.useContext(y),ye=P.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Fe=P.isValidElement(he)&&Object(g.c)(he),Be=Fe?he.ref:null,We=P.useMemo(function(){return Object(g.a)(Be,ce)},[Be,ce]),ze=P.useRef(me);ze.current=me;var we=P.useCallback(function(Ae){var Me=ze.current,je=Me.onResize,Ie=Me.data,Oe=Ae.getBoundingClientRect(),Te=Oe.width,ct=Oe.height,rt=Ae.offsetWidth,Ye=Ae.offsetHeight,Ge=Math.floor(Te),ot=Math.floor(ct);if(ye.current.width!==Ge||ye.current.height!==ot||ye.current.offsetWidth!==rt||ye.current.offsetHeight!==Ye){var nt={width:Ge,height:ot,offsetWidth:rt,offsetHeight:Ye};ye.current=nt;var et=rt===Math.round(Te)?Te:rt,Ee=Ye===Math.round(ct)?ct:Ye,it=Object(U.a)(Object(U.a)({},nt),{},{offsetWidth:et,offsetHeight:Ee});q==null||q(it,Ae,Ie),je&&Promise.resolve().then(function(){je(it,Ae)})}},[]);return P.useEffect(function(){var Ae=Object(b.a)(ce.current)||Object(b.a)(ne.current);return Ae&&!fe&&d(Ae,we),function(){return u(Ae,we)}},[ce.current,fe]),P.createElement(w,{ref:ne},Fe?P.cloneElement(he,{ref:We}):he)}var _="rc-observer-key";function f(me){var he=me.children,fe=Object(R.a)(he);return fe.map(function(ce,ne){var q=(ce==null?void 0:ce.key)||"".concat(_,"-").concat(ne);return P.createElement(l,Object(Z.a)({},me,{key:q}),ce)})}f.Collection=m;var h=f,s=$("bT9E"),a=$("TSYQ"),E=$.n(a),v=`
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
`,p=["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"],L={},I;function B(me){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=me.getAttribute("id")||me.getAttribute("data-reactid")||me.getAttribute("name");if(he&&L[fe])return L[fe];var ce=window.getComputedStyle(me),ne=ce.getPropertyValue("box-sizing")||ce.getPropertyValue("-moz-box-sizing")||ce.getPropertyValue("-webkit-box-sizing"),q=parseFloat(ce.getPropertyValue("padding-bottom"))+parseFloat(ce.getPropertyValue("padding-top")),ye=parseFloat(ce.getPropertyValue("border-bottom-width"))+parseFloat(ce.getPropertyValue("border-top-width")),Fe=p.map(function(We){return"".concat(We,":").concat(ce.getPropertyValue(We))}).join(";"),Be={sizingStyle:Fe,paddingSize:q,borderSize:ye,boxSizing:ne};return he&&fe&&(L[fe]=Be),Be}function z(me){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,fe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;I||(I=document.createElement("textarea"),I.setAttribute("tab-index","-1"),I.setAttribute("aria-hidden","true"),document.body.appendChild(I)),me.getAttribute("wrap")?I.setAttribute("wrap",me.getAttribute("wrap")):I.removeAttribute("wrap");var ne=B(me,he),q=ne.paddingSize,ye=ne.borderSize,Fe=ne.boxSizing,Be=ne.sizingStyle;I.setAttribute("style","".concat(Be,";").concat(v)),I.value=me.value||me.placeholder||"";var We=Number.MIN_SAFE_INTEGER,ze=Number.MAX_SAFE_INTEGER,we=I.scrollHeight,Ae;if(Fe==="border-box"?we+=ye:Fe==="content-box"&&(we-=q),fe!==null||ce!==null){I.value=" ";var Me=I.scrollHeight-q;fe!==null&&(We=Me*fe,Fe==="border-box"&&(We=We+q+ye),we=Math.max(We,we)),ce!==null&&(ze=Me*ce,Fe==="border-box"&&(ze=ze+q+ye),Ae=we>ze?"":"hidden",we=Math.min(ze,we))}return{height:we,minHeight:We,maxHeight:ze,overflowY:Ae,resize:"none"}}var j=$("Gytx"),F=$.n(j),X;(function(me){me[me.NONE=0]="NONE",me[me.RESIZING=1]="RESIZING",me[me.RESIZED=2]="RESIZED"})(X||(X={}));var te=function(me){Object(W.a)(fe,me);var he=Object(M.a)(fe);function fe(ce){var ne;return Object(K.a)(this,fe),ne=he.call(this,ce),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(q){ne.textArea=q},ne.handleResize=function(q){var ye=ne.state.resizeStatus,Fe=ne.props,Be=Fe.autoSize,We=Fe.onResize;if(ye!==X.NONE)return;typeof We=="function"&&We(q),Be&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var q=ne.props.autoSize;if(!q||!ne.textArea)return;var ye=q.minRows,Fe=q.maxRows,Be=z(ne.textArea,!1,ye,Fe);ne.setState({textareaStyles:Be,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:X.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:X.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var q=ne.props,ye=q.prefixCls,Fe=ye===void 0?"rc-textarea":ye,Be=q.autoSize,We=q.onResize,ze=q.className,we=q.disabled,Ae=ne.state,Me=Ae.textareaStyles,je=Ae.resizeStatus,Ie=Object(s.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=E()(Fe,ze,Object(k.a)({},"".concat(Fe,"-disabled"),we));"value"in Ie&&(Ie.value=Ie.value||"");var Te=Object(U.a)(Object(U.a)(Object(U.a)({},ne.props.style),Me),je===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return P.createElement(h,{onResize:ne.handleResize,disabled:!(Be||We)},P.createElement("textarea",Object(Z.a)({},Ie,{className:Oe,style:Te,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:X.NONE},ne}return Object(A.a)(fe,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!F()(ne.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ne=this.textArea.selectionStart,q=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,q)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),fe}(P.Component),ie=te,le=function(me){Object(W.a)(fe,me);var he=Object(M.a)(fe);function fe(ce){var ne;Object(K.a)(this,fe),ne=he.call(this,ce),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function(ye){ne.resizableTextArea=ye},ne.handleChange=function(ye){var Fe=ne.props.onChange;ne.setValue(ye.target.value,function(){ne.resizableTextArea.resizeTextarea()}),Fe&&Fe(ye)},ne.handleKeyDown=function(ye){var Fe=ne.props,Be=Fe.onPressEnter,We=Fe.onKeyDown;ye.keyCode===13&&Be&&Be(ye),We&&We(ye)};var q=typeof ce.value=="undefined"||ce.value===null?ce.defaultValue:ce.value;return ne.state={value:q},ne}return Object(A.a)(fe,[{key:"setValue",value:function(ne,q){"value"in this.props||this.setState({value:ne},q)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return P.createElement(ie,Object(Z.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),fe}(P.Component),_e=Xe.default=le},ZWs3:function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return g});var Z=$("+L6B"),K=$("2/Rp"),A=$("0Owb"),W=$("9og8"),M=$("tJVT"),P=$("PpiC"),U=$("WmNS"),k=$.n(U),R=$("cDcd"),D=$.n(R),g=function(O){var T=O.children,x=Object(P.a)(O,["children"]),S=Object(R.useState)(!1),c=Object(M.a)(S,2),o=c[0],d=c[1];return D.a.createElement(K.a,Object(A.a)({},x,{loading:o,onClick:function(){var u=Object(W.a)(k.a.mark(function w(y){return k.a.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.prev=0,d(!0),l.next=4,x.onClick(y);case 4:d(!1),l.next=10;break;case 7:l.prev=7,l.t0=l.catch(0),d(!1);case 10:case"end":return l.stop()}},w,null,[[0,7]])}));return function(w){return u.apply(this,arguments)}}()}),T)}},ZpRC:function(qe,Xe,$){"use strict";function Z(g){return typeof g=="object"&&g!=null&&g.nodeType===1}function K(g,b){return(!b||g!=="hidden")&&g!=="visible"&&g!=="clip"}function A(g,b){if(g.clientHeight<g.scrollHeight||g.clientWidth<g.scrollWidth){var O=getComputedStyle(g,null);return K(O.overflowY,b)||K(O.overflowX,b)||function(T){var x=function(S){if(!S.ownerDocument||!S.ownerDocument.defaultView)return null;try{return S.ownerDocument.defaultView.frameElement}catch(c){return null}}(T);return!!x&&(x.clientHeight<T.scrollHeight||x.clientWidth<T.scrollWidth)}(g)}return!1}function W(g,b,O,T,x,S,c,o){return S<g&&c>b||S>g&&c<b?0:S<=g&&o<=O||c>=b&&o>=O?S-g-T:c>b&&o<O||S<g&&o>O?c-b+x:0}var M=function(g,b){var O=window,T=b.scrollMode,x=b.block,S=b.inline,c=b.boundary,o=b.skipOverflowHiddenElements,d=typeof c=="function"?c:function(Me){return Me!==c};if(!Z(g))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,w=[],y=g;Z(y)&&d(y);){if((y=y.parentElement)===u){w.push(y);break}y!=null&&y===document.body&&A(y)&&!A(document.documentElement)||y!=null&&A(y,o)&&w.push(y)}for(var m=O.visualViewport?O.visualViewport.width:innerWidth,l=O.visualViewport?O.visualViewport.height:innerHeight,_=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=g.getBoundingClientRect(),s=h.height,a=h.width,E=h.top,v=h.right,p=h.bottom,L=h.left,I=x==="start"||x==="nearest"?E:x==="end"?p:E+s/2,B=S==="center"?L+a/2:S==="end"?v:L,z=[],j=0;j<w.length;j++){var F=w[j],X=F.getBoundingClientRect(),te=X.height,ie=X.width,le=X.top,_e=X.right,me=X.bottom,he=X.left;if(T==="if-needed"&&E>=0&&L>=0&&p<=l&&v<=m&&E>=le&&p<=me&&L>=he&&v<=_e)return z;var fe=getComputedStyle(F),ce=parseInt(fe.borderLeftWidth,10),ne=parseInt(fe.borderTopWidth,10),q=parseInt(fe.borderRightWidth,10),ye=parseInt(fe.borderBottomWidth,10),Fe=0,Be=0,We="offsetWidth"in F?F.offsetWidth-F.clientWidth-ce-q:0,ze="offsetHeight"in F?F.offsetHeight-F.clientHeight-ne-ye:0;if(u===F)Fe=x==="start"?I:x==="end"?I-l:x==="nearest"?W(f,f+l,l,ne,ye,f+I,f+I+s,s):I-l/2,Be=S==="start"?B:S==="center"?B-m/2:S==="end"?B-m:W(_,_+m,m,ce,q,_+B,_+B+a,a),Fe=Math.max(0,Fe+f),Be=Math.max(0,Be+_);else{Fe=x==="start"?I-le-ne:x==="end"?I-me+ye+ze:x==="nearest"?W(le,me,te,ne,ye+ze,I,I+s,s):I-(le+te/2)+ze/2,Be=S==="start"?B-he-ce:S==="center"?B-(he+ie/2)+We/2:S==="end"?B-_e+q+We:W(he,_e,ie,ce,q+We,B,B+a,a);var we=F.scrollLeft,Ae=F.scrollTop;I+=Ae-(Fe=Math.max(0,Math.min(Ae+Fe,F.scrollHeight-te+ze))),B+=we-(Be=Math.max(0,Math.min(we+Be,F.scrollWidth-ie+We)))}z.push({el:F,top:Fe,left:Be})}return z};function P(g){return g===Object(g)&&Object.keys(g).length!==0}function U(g,b){b===void 0&&(b="auto");var O="scrollBehavior"in document.body.style;g.forEach(function(T){var x=T.el,S=T.top,c=T.left;x.scroll&&O?x.scroll({top:S,left:c,behavior:b}):(x.scrollTop=S,x.scrollLeft=c)})}function k(g){return g===!1?{block:"end",inline:"nearest"}:P(g)?g:{block:"start",inline:"nearest"}}function R(g,b){var O=!g.ownerDocument.documentElement.contains(g);if(P(b)&&typeof b.behavior=="function")return b.behavior(O?[]:M(g,b));if(O)return;var T=k(b);return U(M(g,T),T.behavior)}var D=Xe.a=R},aRTE:function(qe,Xe){qe.exports={L:1,M:0,Q:3,H:2}},bT9E:function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return K});var Z=$("VTBJ");function K(A,W){var M=Object(Z.a)({},A);return Array.isArray(W)&&W.forEach(function(P){delete M[P]}),M}},c5Ni:function(qe,Xe,$){},dQei:function(qe,Xe){for(var $={glog:function(K){if(K<1)throw new Error("glog("+K+")");return $.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return $.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},Z=0;Z<8;Z++)$.EXP_TABLE[Z]=1<<Z;for(var Z=8;Z<256;Z++)$.EXP_TABLE[Z]=$.EXP_TABLE[Z-4]^$.EXP_TABLE[Z-5]^$.EXP_TABLE[Z-6]^$.EXP_TABLE[Z-8];for(var Z=0;Z<255;Z++)$.LOG_TABLE[$.EXP_TABLE[Z]]=Z;qe.exports=$},dWSS:function(qe,Xe,$){var Z=$("dQei");function K(A,W){if(A.length==null)throw new Error(A.length+"/"+W);for(var M=0;M<A.length&&A[M]==0;)M++;this.num=new Array(A.length-M+W);for(var P=0;P<A.length-M;P++)this.num[P]=A[P+M]}K.prototype={get:function(A){return this.num[A]},getLength:function(){return this.num.length},multiply:function(A){for(var W=new Array(this.getLength()+A.getLength()-1),M=0;M<this.getLength();M++)for(var P=0;P<A.getLength();P++)W[M+P]^=Z.gexp(Z.glog(this.get(M))+Z.glog(A.get(P)));return new K(W,0)},mod:function(A){if(this.getLength()-A.getLength()<0)return this;for(var W=Z.glog(this.get(0))-Z.glog(A.get(0)),M=new Array(this.getLength()),P=0;P<this.getLength();P++)M[P]=this.get(P);for(var P=0;P<A.getLength();P++)M[P]^=Z.gexp(Z.glog(A.get(P))+W);return new K(M,0).mod(A)}},qe.exports=K},dejd:function(qe,Xe,$){},dmUQ:function(qe,Xe,$){"use strict";var Z=$("Ff2n"),K=$("rePB"),A=$("1OyB"),W=$("vuIU"),M=$("Ji7U"),P=$("md7G"),U=$("foSv"),k=$("cDcd"),R=$.n(k),D=$("TSYQ"),g=$.n(D),b=$("4IlW");function O(s,a){var E=Object.keys(s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);a&&(v=v.filter(function(p){return Object.getOwnPropertyDescriptor(s,p).enumerable})),E.push.apply(E,v)}return E}function T(s){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?O(Object(E),!0).forEach(function(v){Object(K.a)(s,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(E)):O(Object(E)).forEach(function(v){Object.defineProperty(s,v,Object.getOwnPropertyDescriptor(E,v))})}return s}function x(s){var a=S();return function(){var v=Object(U.a)(s),p;if(a){var L=Object(U.a)(this).constructor;p=Reflect.construct(v,arguments,L)}else p=v.apply(this,arguments);return Object(P.a)(this,p)}}function S(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(s){return!1}}function c(){}function o(s){s.preventDefault()}var d=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,w=600,y=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},l=function(a,E){return E===a||typeof E=="number"&&typeof a=="number"&&isNaN(E)&&isNaN(a)},_=function(s){Object(M.a)(E,s);var a=x(E);function E(v){var p;Object(A.a)(this,E),p=a.call(this,v),p.onKeyDown=function(B){var z=p.props,j=z.onKeyDown,F=z.onPressEnter;if(B.keyCode===b.a.UP){var X=p.getRatio(B);p.up(B,X,null),p.stop()}else if(B.keyCode===b.a.DOWN){var te=p.getRatio(B);p.down(B,te,null),p.stop()}else B.keyCode===b.a.ENTER&&F&&F(B);if(p.recordCursorPosition(),p.lastKeyCode=B.keyCode,j){for(var ie=arguments.length,le=new Array(ie>1?ie-1:0),_e=1;_e<ie;_e++)le[_e-1]=arguments[_e];j.apply(void 0,[B].concat(le))}},p.onKeyUp=function(B){var z=p.props.onKeyUp;if(p.stop(),p.recordCursorPosition(),z){for(var j=arguments.length,F=new Array(j>1?j-1:0),X=1;X<j;X++)F[X-1]=arguments[X];z.apply(void 0,[B].concat(F))}},p.onChange=function(B){var z=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(B)),p.setState({inputValue:p.rawInput}),z(p.toNumber(p.rawInput))},p.onMouseUp=function(){var B=p.props.onMouseUp;p.recordCursorPosition(),B&&B.apply(void 0,arguments)},p.onFocus=function(){var B;p.setState({focused:!0}),(B=p.props).onFocus.apply(B,arguments)},p.onBlur=function(){var B=p.props.onBlur;p.inputting=!1,p.setState({focused:!1});var z=p.getCurrentValidValue(p.state.inputValue),j=p.setValue(z,c);if(B){var F=p.input.value,X=p.getInputDisplayValue({focus:!1,value:j});p.input.value=X&&Number(X),B.apply(void 0,arguments),p.input.value=F}},p.getRatio=function(B){var z=1;return B.metaKey||B.ctrlKey?z=.1:B.shiftKey&&(z=10),z},p.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},p.getPrecision=function(B){if(m(p.props.precision))return p.props.precision;var z=String(B);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var j=0;return z.indexOf(".")>=0&&(j=z.length-z.indexOf(".")-1),j},p.getInputDisplayValue=function(B){var z=B||p.state,j=z.focused,F=z.inputValue,X=z.value,te;j?te=F:te=p.toPrecisionAsStep(X),te==null&&(te="");var ie=p.formatWrapper(te);return m(p.props.decimalSeparator)&&(ie=ie.toString().replace(".",p.props.decimalSeparator)),ie},p.recordCursorPosition=function(){try{p.cursorStart=p.input.selectionStart,p.cursorEnd=p.input.selectionEnd,p.currentValue=p.input.value,p.cursorBefore=p.input.value.substring(0,p.cursorStart),p.cursorAfter=p.input.value.substring(p.cursorEnd)}catch(B){}},p.restoreByAfter=function(B){if(B===void 0)return!1;var z=p.input.value,j=z.lastIndexOf(B);if(j===-1)return!1;var F=p.cursorBefore.length;return p.lastKeyCode===b.a.DELETE&&p.cursorBefore.charAt(F-1)===B[0]?(p.fixCaret(F,F),!0):j+B.length===z.length?(p.fixCaret(j,j),!0):!1},p.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(z,j){var F=B.substring(j);return p.restoreByAfter(F)})},p.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},p.stop=function(){p.autoStepTimer&&clearTimeout(p.autoStepTimer)},p.down=function(B,z,j){p.pressingUpOrDown=!0,p.step("down",B,z,j)},p.up=function(B,z,j){p.pressingUpOrDown=!0,p.step("up",B,z,j)},p.saveInput=function(B){p.input=B};var L=v.value;L===void 0&&(L=v.defaultValue),p.state={focused:v.autoFocus};var I=p.getValidValue(p.toNumber(L));return p.state=T(T({},p.state),{},{inputValue:p.toPrecisionAsStep(I),value:I}),p}return Object(W.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var L=this.props,I=L.value,B=L.onChange,z=L.max,j=L.min,F=this.state.focused;if(p){if(!l(p.value,I)||!l(p.max,z)||!l(p.min,j)){var X=F?I:this.getValidValue(I),te;this.pressingUpOrDown?te=X:this.inputting?te=this.rawInput:te=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:te})}var ie="value"in this.props?I:this.state.value;"max"in this.props&&p.max!==z&&typeof ie=="number"&&ie>z&&B&&B(z),"min"in this.props&&p.min!==j&&typeof ie=="number"&&ie<j&&B&&B(j)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var le=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===b.a.BACKSPACE?le=this.cursorStart-1:this.lastKeyCode===b.a.DELETE&&(le=this.cursorStart):le=this.input.value.length,this.fixCaret(le,le)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case b.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case b.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(_e){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(p){var L=p;return L===""?L="":this.isNotCompleteNumber(parseFloat(L))?L=this.state.value:L=this.getValidValue(L),this.toNumber(L)}},{key:"getValueFromEvent",value:function(p){var L=p.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(L=L.replace(this.props.decimalSeparator,".")),L}},{key:"getValidValue",value:function(p){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(p);return isNaN(B)?p:(B<L&&(B=L),B>I&&(B=I),B)}},{key:"setValue",value:function(p,L){var I=this.props.precision,B=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),z=this.state.value,j=z===void 0?null:z,F=this.state.inputValue,X=F===void 0?null:F,te=typeof B=="number"?B.toFixed(I):"".concat(B),ie=B!==j||te!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},L)):this.setState({value:B,inputValue:this.toPrecisionAsStep(p)},L),ie&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(p){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.props,B=I.precision,z=I.step;if(m(B))return B;var j=this.getPrecision(L),F=this.getPrecision(z),X=this.getPrecision(p);return p?Math.max(X,j+F):j+F}},{key:"getPrecisionFactor",value:function(p){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,I=this.getMaxPrecision(p,L);return Math.pow(10,I)}},{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(p){return this.props.formatter?this.props.formatter(p):p}},{key:"toPrecisionAsStep",value:function(p){if(this.isNotCompleteNumber(p)||p==="")return p;var L=Math.abs(this.getMaxPrecision(p));return isNaN(L)?p.toString():Number(p).toFixed(L)}},{key:"toNumber",value:function(p){var L=this.props.precision,I=this.state.focused,B=p&&p.length>16&&I;return this.isNotCompleteNumber(p)||B?p:m(L)?Math.round(p*Math.pow(10,L))/Math.pow(10,L):Number(p)}},{key:"upStep",value:function(p,L){var I=this.props.step,B=this.getPrecisionFactor(p,L),z=Math.abs(this.getMaxPrecision(p,L)),j=((B*p+B*I*L)/B).toFixed(z);return this.toNumber(j)}},{key:"downStep",value:function(p,L){var I=this.props.step,B=this.getPrecisionFactor(p,L),z=Math.abs(this.getMaxPrecision(p,L)),j=((B*p-B*I*L)/B).toFixed(z);return this.toNumber(j)}},{key:"step",value:function(p,L){var I=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),L&&(L.persist(),L.preventDefault());var j=this.props;if(j.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var X=this["".concat(p,"Step")](F,B),te=X>j.max||X<j.min;if(X>j.max?X=j.max:X<j.min&&(X=j.min),this.setValue(X,null),this.setState({focused:!0},function(){I.pressingUpOrDown=!1}),te)return;this.autoStepTimer=setTimeout(function(){I[p](L,B,!0)},z?u:w)}},{key:"fixCaret",value:function(p,L){if(p===void 0||L===void 0||!this.input||!this.input.value)return;try{var I=this.input.selectionStart,B=this.input.selectionEnd;(p!==I||L!==B)&&this.input.setSelectionRange(p,L)}catch(z){}}},{key:"render",value:function(){var p,L=this.props,I=L.prefixCls,B=L.disabled,z=L.readOnly,j=L.useTouch,F=L.autoComplete,X=L.upHandler,te=L.downHandler,ie=L.className,le=L.max,_e=L.min,me=L.style,he=L.title,fe=L.onMouseEnter,ce=L.onMouseLeave,ne=L.onMouseOver,q=L.onMouseOut,ye=L.required,Fe=L.onClick,Be=L.tabIndex,We=L.type,ze=L.placeholder,we=L.id,Ae=L.inputMode,Me=L.pattern,je=L.step,Ie=L.maxLength,Oe=L.autoFocus,Te=L.name,ct=L.onPaste,rt=L.onInput,Ye=Object(Z.a)(L,["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"]),Ge=this.state,ot=Ge.value,nt=Ge.focused,et=g()(I,(p={},Object(K.a)(p,ie,!!ie),Object(K.a)(p,"".concat(I,"-disabled"),B),Object(K.a)(p,"".concat(I,"-focused"),nt),p)),Ee={};Object.keys(Ye).forEach(function(ee){(ee.substr(0,5)==="data-"||ee.substr(0,5)==="aria-"||ee==="role")&&(Ee[ee]=Ye[ee])});var it=!z&&!B,Ze=this.getInputDisplayValue(null),be=(ot||ot===0)&&(isNaN(ot)||Number(ot)>=le),De=(ot||ot===0)&&(isNaN(ot)||Number(ot)<=_e),ue=be||B||z,ae=De||B||z,se=g()("".concat(I,"-handler"),"".concat(I,"-handler-up"),Object(K.a)({},"".concat(I,"-handler-up-disabled"),ue)),Y=g()("".concat(I,"-handler"),"".concat(I,"-handler-down"),Object(K.a)({},"".concat(I,"-handler-down-disabled"),ae)),Q=j?{onTouchStart:ue?c:this.up,onTouchEnd:this.stop}:{onMouseDown:ue?c:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=j?{onTouchStart:ae?c:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?c:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:et,style:me,title:he,onMouseEnter:fe,onMouseLeave:ce,onMouseOver:ne,onMouseOut:q,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(I,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":ue,className:se}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:Y}),te||R.a.createElement("span",{unselectable:"on",className:"".concat(I,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(I,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":_e,"aria-valuemax":le,"aria-valuenow":ot,required:ye,type:We,placeholder:ze,onPaste:ct,onClick:Fe,onMouseUp:this.onMouseUp,className:"".concat(I,"-input"),tabIndex:Be,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:it?this.onKeyDown:c,onKeyUp:it?this.onKeyUp:c,autoFocus:Oe,maxLength:Ie,readOnly:z,disabled:B,max:le,min:_e,step:je,name:Te,title:he,id:we,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ze),pattern:Me,inputMode:Ae,onInput:rt},Ee))))}}]),E}(R.a.Component);_.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:y,min:-y,step:1,style:{},onChange:c,onKeyDown:c,onPressEnter:c,onFocus:c,onBlur:c,parser:d,required:!1,autoComplete:"off"};var f=_,h=Xe.a=f},f4xo:function(qe,Xe,$){var Z=$("nVVt");function K(A){this.mode=Z.MODE_8BIT_BYTE,this.data=A}K.prototype={getLength:function(A){return this.data.length},write:function(A){for(var W=0;W<this.data.length;W++)A.put(this.data.charCodeAt(W),8)}},qe.exports=K},kSUc:function(qe,Xe,$){},kqOp:function(qe,Xe,$){"use strict";$.d(Xe,"a",function(){return D});var Z=$("0Owb"),K=$("fWQN"),A=$("mtLc"),W=$("yKVA"),M=$("879j"),P=$("cDcd"),U=$.n(P),k=$("Ot1p"),R="\u2581",D=function(g){Object(W.a)(O,g);var b=Object(M.a)(O);function O(){var T;Object(K.a)(this,O);for(var x=arguments.length,S=new Array(x),c=0;c<x;c++)S[c]=arguments[c];return T=b.call.apply(b,[this].concat(S)),T.getChCountBeforeCursor=function(o,d){for(var u=d.line,w=0,y=0;y<u;y++)w+=o.getLine(y).split(R).length-1;var m=o.getLine(u).substring(0,d.ch);return w+=m.split(R).length-1,w},T.onCMBeforeChange=function(o,d){var u=o.getRange(d.from,d.to),w=0;if(d.text.forEach(function(_){w+=_.split(R).length-1}),u&&u.indexOf(R)!=-1){var y=u.split(R).length-1,m=T.getChCountBeforeCursor(o,d.from);console.log("\u5220\u9664".concat(y,"\u4E2A\uFF0C \u4E4B\u524D\u6709").concat(m,"\u4E2A\uFF0C\u65B0\u589E").concat(w,"\u4E2A")),T.props.deleteEmptyDisabled?d.cancel():T.props.onPlaceholderChange&&T.props.onPlaceholderChange(m,y,w)}else if(w){var l=T.getChCountBeforeCursor(o,d.from);console.log("\u65B0\u589E".concat(w,"\u4E2A\uFF0C\u4E4B\u524D\u6709").concat(l,"\u4E2A")),T.props.onPlaceholderChange&&T.props.onPlaceholderChange(l,0,w)}},T}return Object(A.a)(O,[{key:"render",value:function(){return U.a.createElement(k.a,Object(Z.a)({},this.props,{onCMBeforeChange:this.onCMBeforeChange}))}}]),O}(P.Component)},lZu9:function(qe,Xe,$){(function(Z){Z($("VrN/"),$("1eCo"),$("8EBN"))})(function(Z){"use strict";Z.defineMode("markdown",function(K,A){var W=Z.getMode(K,"text/html"),M=W.name=="null";function P(j){if(Z.findModeByName){var F=Z.findModeByName(j);F&&(j=F.mime||F.mimes[0])}var X=Z.getMode(K,j);return X.name=="null"?null:X}A.highlightFormatting===void 0&&(A.highlightFormatting=!1),A.maxBlockquoteDepth===void 0&&(A.maxBlockquoteDepth=0),A.taskLists===void 0&&(A.taskLists=!1),A.strikethrough===void 0&&(A.strikethrough=!1),A.emoji===void 0&&(A.emoji=!1),A.fencedCodeBlockHighlighting===void 0&&(A.fencedCodeBlockHighlighting=!0),A.fencedCodeBlockDefaultMode===void 0&&(A.fencedCodeBlockDefaultMode="text/plain"),A.xml===void 0&&(A.xml=!0),A.tokenTypeOverrides===void 0&&(A.tokenTypeOverrides={});var U={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 U)U.hasOwnProperty(k)&&A.tokenTypeOverrides[k]&&(U[k]=A.tokenTypeOverrides[k]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,g=/^\[(x| )\](?=\s)/i,b=A.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,T=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,S=/^\s*\[[^\]]+?\]:.*$/,c=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function d(j,F,X){return F.f=F.inline=X,X(j,F)}function u(j,F,X){return F.f=F.block=X,X(j,F)}function w(j){return!j||!/\S/.test(j.string)}function y(j){if(j.linkTitle=!1,j.linkHref=!1,j.linkText=!1,j.em=!1,j.strong=!1,j.strikethrough=!1,j.quote=0,j.indentedCode=!1,j.f==l){var F=M;if(!F){var X=Z.innerMode(W,j.htmlState);F=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}F&&(j.f=s,j.block=m,j.htmlState=null)}return j.trailingSpace=0,j.trailingSpaceNewLine=!1,j.prevLine=j.thisLine,j.thisLine={stream:null},null}function m(j,F){var X=j.column()===F.indentation,te=w(F.prevLine.stream),ie=F.indentedCode,le=F.prevLine.hr,_e=F.list!==!1,me=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var he=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,_e)){for(F.list=null;he<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=he-F.listStack[F.listStack.length-1])}var fe=!te&&!le&&!F.prevLine.header&&(!_e||!ie)&&!F.prevLine.fencedCodeEnd,ce=(F.list===!1||le||te)&&F.indentation<=me&&j.match(R),ne=null;if(F.indentationDiff>=4&&(ie||F.prevLine.fencedCodeEnd||F.prevLine.header||te))return j.skipToEnd(),F.indentedCode=!0,U.code;if(j.eatSpace())return null;if(X&&F.indentation<=me&&(ne=j.match(b))&&ne[1].length<=6)return F.quote=0,F.header=ne[1].length,F.thisLine.header=!0,A.highlightFormatting&&(F.formatting="header"),F.f=F.inline,f(F);if(F.indentation<=me&&j.eat(">"))return F.quote=X?1:F.quote+1,A.highlightFormatting&&(F.formatting="quote"),j.eatSpace(),f(F);if(!ce&&!F.setext&&X&&F.indentation<=me&&(ne=j.match(D))){var q=ne[1]?"ol":"ul";return F.indentation=he+j.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,A.taskLists&&j.match(g,!1)&&(F.taskList=!0),F.f=F.inline,A.highlightFormatting&&(F.formatting=["list","list-"+q]),f(F)}else{if(X&&F.indentation<=me&&(ne=j.match(x,!0)))return F.quote=0,F.fencedEndRE=new RegExp(ne[1]+"+ *$"),F.localMode=A.fencedCodeBlockHighlighting&&P(ne[2]||A.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=Z.startState(F.localMode)),F.f=F.block=_,A.highlightFormatting&&(F.formatting="code-block"),F.code=-1,f(F);if(F.setext||(!fe||!_e)&&!F.quote&&F.list===!1&&!F.code&&!ce&&!S.test(j.string)&&(ne=j.lookAhead(1))&&(ne=ne.match(O)))return F.setext?(F.header=F.setext,F.setext=0,j.skipToEnd(),A.highlightFormatting&&(F.formatting="header")):(F.header=ne[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,f(F);if(ce)return j.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,U.hr;if(j.peek()==="[")return d(j,F,L)}return d(j,F,F.inline)}function l(j,F){var X=W.token(j,F.htmlState);if(!M){var te=Z.innerMode(W,F.htmlState);(te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText||F.md_inside&&j.current().indexOf(">")>-1)&&(F.f=s,F.block=m,F.htmlState=null)}return X}function _(j,F){var X=F.listStack[F.listStack.length-1]||0,te=F.indentation<X,ie=X+3;if(F.fencedEndRE&&F.indentation<=ie&&(te||j.match(F.fencedEndRE))){A.highlightFormatting&&(F.formatting="code-block");var le;return te||(le=f(F)),F.localMode=F.localState=null,F.block=m,F.f=s,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,te?u(j,F,F.block):le}else return F.localMode?F.localMode.token(j,F.localState):(j.skipToEnd(),U.code)}function f(j){var F=[];if(j.formatting){F.push(U.formatting),typeof j.formatting=="string"&&(j.formatting=[j.formatting]);for(var X=0;X<j.formatting.length;X++)F.push(U.formatting+"-"+j.formatting[X]),j.formatting[X]==="header"&&F.push(U.formatting+"-"+j.formatting[X]+"-"+j.header),j.formatting[X]==="quote"&&(!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(U.formatting+"-"+j.formatting[X]+"-"+j.quote):F.push("error"))}if(j.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(j.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(j.linkHref?F.push(U.linkHref,"url"):(j.strong&&F.push(U.strong),j.em&&F.push(U.em),j.strikethrough&&F.push(U.strikethrough),j.emoji&&F.push(U.emoji),j.linkText&&F.push(U.linkText),j.code&&F.push(U.code),j.image&&F.push(U.image),j.imageAltText&&F.push(U.imageAltText,"link"),j.imageMarker&&F.push(U.imageMarker)),j.header&&F.push(U.header,U.header+"-"+j.header),j.quote&&(F.push(U.quote),!A.maxBlockquoteDepth||A.maxBlockquoteDepth>=j.quote?F.push(U.quote+"-"+j.quote):F.push(U.quote+"-"+A.maxBlockquoteDepth)),j.list!==!1){var te=(j.listStack.length-1)%3;te?te===1?F.push(U.list2):F.push(U.list3):F.push(U.list1)}return j.trailingSpaceNewLine?F.push("trailing-space-new-line"):j.trailingSpace&&F.push("trailing-space-"+(j.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function h(j,F){return j.match(T,!0)?f(F):void 0}function s(j,F){var X=F.text(j,F);if(typeof X!="undefined")return X;if(F.list)return F.list=null,f(F);if(F.taskList){var te=j.match(g,!0)[1]===" ";return te?F.taskOpen=!0:F.taskClosed=!0,A.highlightFormatting&&(F.formatting="task"),F.taskList=!1,f(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&j.match(/^#+$/,!0))return A.highlightFormatting&&(F.formatting="header"),f(F);var ie=j.next();if(F.linkTitle){F.linkTitle=!1;var le=ie;ie==="("&&(le=")"),le=(le+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var _e="^\\s*(?:[^"+le+"\\\\]+|\\\\\\\\|\\\\.)"+le;if(j.match(new RegExp(_e),!0))return U.linkHref}if(ie==="`"){var me=F.formatting;A.highlightFormatting&&(F.formatting="code"),j.eatWhile("`");var he=j.current().length;if(F.code==0&&(!F.quote||he==1))return F.code=he,f(F);if(he==F.code){var fe=f(F);return F.code=0,fe}else return F.formatting=me,f(F)}else if(F.code)return f(F);if(ie==="\\"&&(j.next(),A.highlightFormatting)){var ce=f(F),ne=U.formatting+"-escape";return ce?ce+" "+ne:ne}if(ie==="!"&&j.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,A.highlightFormatting&&(F.formatting="image"),f(F);if(ie==="["&&F.imageMarker&&j.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,A.highlightFormatting&&(F.formatting="image"),f(F);if(ie==="]"&&F.imageAltText){A.highlightFormatting&&(F.formatting="image");var ce=f(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=E,ce}if(ie==="["&&!F.image)return F.linkText&&j.match(/^.*?\]/)||(F.linkText=!0,A.highlightFormatting&&(F.formatting="link")),f(F);if(ie==="]"&&F.linkText){A.highlightFormatting&&(F.formatting="link");var ce=f(F);return F.linkText=!1,F.inline=F.f=j.match(/\(.*?\)| ?\[.*?\]/,!1)?E:s,ce}if(ie==="<"&&j.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,A.highlightFormatting&&(F.formatting="link");var ce=f(F);return ce?ce+=" ":ce="",ce+U.linkInline}if(ie==="<"&&j.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=a,A.highlightFormatting&&(F.formatting="link");var ce=f(F);return ce?ce+=" ":ce="",ce+U.linkEmail}if(A.xml&&ie==="<"&&j.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var q=j.string.indexOf(">",j.pos);if(q!=-1){var ye=j.string.substring(j.start,q);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ye)&&(F.md_inside=!0)}return j.backUp(1),F.htmlState=Z.startState(W),u(j,F,l)}if(A.xml&&ie==="<"&&j.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ie==="*"||ie==="_"){for(var Fe=1,Be=j.pos==1?" ":j.string.charAt(j.pos-2);Fe<3&&j.eat(ie);)Fe++;var We=j.peek()||" ",ze=!/\s/.test(We)&&(!c.test(We)||/\s/.test(Be)||c.test(Be)),we=!/\s/.test(Be)&&(!c.test(Be)||/\s/.test(We)||c.test(We)),Ae=null,Me=null;if(Fe%2&&(!F.em&&ze&&(ie==="*"||!we||c.test(Be))?Ae=!0:F.em==ie&&we&&(ie==="*"||!ze||c.test(We))&&(Ae=!1)),Fe>1&&(!F.strong&&ze&&(ie==="*"||!we||c.test(Be))?Me=!0:F.strong==ie&&we&&(ie==="*"||!ze||c.test(We))&&(Me=!1)),Me!=null||Ae!=null){A.highlightFormatting&&(F.formatting=Ae==null?"strong":Me==null?"em":"strong em"),Ae===!0&&(F.em=ie),Me===!0&&(F.strong=ie);var fe=f(F);return Ae===!1&&(F.em=!1),Me===!1&&(F.strong=!1),fe}}else if(ie===" "&&(j.eat("*")||j.eat("_"))){if(j.peek()===" ")return f(F);j.backUp(1)}if(A.strikethrough){if(ie==="~"&&j.eatWhile(ie)){if(F.strikethrough){A.highlightFormatting&&(F.formatting="strikethrough");var fe=f(F);return F.strikethrough=!1,fe}else if(j.match(/^[^\s]/,!1))return F.strikethrough=!0,A.highlightFormatting&&(F.formatting="strikethrough"),f(F)}else if(ie===" "&&j.match(/^~~/,!0)){if(j.peek()===" ")return f(F);j.backUp(2)}}if(A.emoji&&ie===":"&&j.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,A.highlightFormatting&&(F.formatting="emoji");var je=f(F);return F.emoji=!1,je}return ie===" "&&(j.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),f(F)}function a(j,F){var X=j.next();if(X===">"){F.f=F.inline=s,A.highlightFormatting&&(F.formatting="link");var te=f(F);return te?te+=" ":te="",te+U.linkInline}return j.match(/^[^>]+/,!0),U.linkInline}function E(j,F){if(j.eatSpace())return null;var X=j.next();return X==="("||X==="["?(F.f=F.inline=p(X==="("?")":"]"),A.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,f(F)):"error"}var v={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(j){return function(F,X){var te=F.next();if(te===j){X.f=X.inline=s,A.highlightFormatting&&(X.formatting="link-string");var ie=f(X);return X.linkHref=!1,ie}return F.match(v[j]),X.linkHref=!0,f(X)}}function L(j,F){return j.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=I,j.next(),A.highlightFormatting&&(F.formatting="link"),F.linkText=!0,f(F)):d(j,F,s)}function I(j,F){if(j.match(/^\]:/,!0)){F.f=F.inline=B,A.highlightFormatting&&(F.formatting="link");var X=f(F);return F.linkText=!1,X}return j.match(/^([^\]\\]|\\.)+/,!0),U.linkText}function B(j,F){return j.eatSpace()?null:(j.match(/^[^\s]+/,!0),j.peek()===void 0?F.linkTitle=!0:j.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=s,U.linkHref+" url")}var z={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:s,text:h,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(j){return{f:j.f,prevLine:j.prevLine,thisLine:j.thisLine,block:j.block,htmlState:j.htmlState&&Z.copyState(W,j.htmlState),indentation:j.indentation,localMode:j.localMode,localState:j.localMode?Z.copyState(j.localMode,j.localState):null,inline:j.inline,text:j.text,formatting:!1,linkText:j.linkText,linkTitle:j.linkTitle,linkHref:j.linkHref,code:j.code,em:j.em,strong:j.strong,strikethrough:j.strikethrough,emoji:j.emoji,header:j.header,setext:j.setext,hr:j.hr,taskList:j.taskList,list:j.list,listStack:j.listStack.slice(0),quote:j.quote,indentedCode:j.indentedCode,trailingSpace:j.trailingSpace,trailingSpaceNewLine:j.trailingSpaceNewLine,md_inside:j.md_inside,fencedEndRE:j.fencedEndRE}},token:function(j,F){if(F.formatting=!1,j!=F.thisLine.stream){if(F.header=0,F.hr=!1,j.match(/^\s*$/,!0))return y(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:j},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=l)){var X=j.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(F.indentation=X,F.indentationDiff=null,X>0)return null}}return F.f(j,F)},innerMode:function(j){return j.block==l?{state:j.htmlState,mode:W}:j.localState?{state:j.localState,mode:j.localMode}:{state:j,mode:z}},indent:function(j,F,X){return j.block==l&&W.indent?W.indent(j.htmlState,F,X):j.localState&&j.localMode.indent?j.localMode.indent(j.localState,F,X):Z.Pass},blankLine:y,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),Z.defineMIME("text/markdown","markdown"),Z.defineMIME("text/x-markdown","markdown")})},nVVt:function(qe,Xe){qe.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(qe,Xe,$){(function(Z){Z($("VrN/"))})(function(Z){"use strict";var K=Z.Pos;function A(c,o){return c.line-o.line||c.ch-o.ch}var W="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=W+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",P=new RegExp("<(/?)(["+W+"]["+M+"]*)","g");function U(c,o,d,u){this.line=o,this.ch=d,this.cm=c,this.text=c.getLine(o),this.min=u?Math.max(u.from,c.firstLine()):c.firstLine(),this.max=u?Math.min(u.to-1,c.lastLine()):c.lastLine()}function k(c,o){var d=c.cm.getTokenTypeAt(K(c.line,o));return d&&/\btag\b/.test(d)}function R(c){return c.line>=c.max?void 0:(c.ch=0,c.text=c.cm.getLine(++c.line),!0)}function D(c){return c.line<=c.min?void 0:(c.text=c.cm.getLine(--c.line),c.ch=c.text.length,!0)}function g(c){for(;;){var o=c.text.indexOf(">",c.ch);if(o==-1){if(R(c))continue;return}if(!k(c,o+1)){c.ch=o+1;continue}var d=c.text.lastIndexOf("/",o),u=d>-1&&!/\S/.test(c.text.slice(d+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function b(c){for(;;){var o=c.ch?c.text.lastIndexOf("<",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!k(c,o+1)){c.ch=o;continue}P.lastIndex=o,c.ch=o;var d=P.exec(c.text);if(d&&d.index==o)return d}}function O(c){for(;;){P.lastIndex=c.ch;var o=P.exec(c.text);if(!o){if(R(c))continue;return}if(!k(c,o.index+1)){c.ch=o.index+1;continue}return c.ch=o.index+o[0].length,o}}function T(c){for(;;){var o=c.ch?c.text.lastIndexOf(">",c.ch-1):-1;if(o==-1){if(D(c))continue;return}if(!k(c,o+1)){c.ch=o;continue}var d=c.text.lastIndexOf("/",o),u=d>-1&&!/\S/.test(c.text.slice(d+1,o));return c.ch=o+1,u?"selfClose":"regular"}}function x(c,o){for(var d=[];;){var u=O(c),w,y=c.line,m=c.ch-(u?u[0].length:0);if(!u||!(w=g(c)))return;if(w=="selfClose")continue;if(u[1]){for(var l=d.length-1;l>=0;--l)if(d[l]==u[2]){d.length=l;break}if(l<0&&(!o||o==u[2]))return{tag:u[2],from:K(y,m),to:K(c.line,c.ch)}}else d.push(u[2])}}function S(c,o){for(var d=[];;){var u=T(c);if(!u)return;if(u=="selfClose"){b(c);continue}var w=c.line,y=c.ch,m=b(c);if(!m)return;if(m[1])d.push(m[2]);else{for(var l=d.length-1;l>=0;--l)if(d[l]==m[2]){d.length=l;break}if(l<0&&(!o||o==m[2]))return{tag:m[2],from:K(c.line,c.ch),to:K(w,y)}}}}Z.registerHelper("fold","xml",function(c,o){for(var d=new U(c,o.line,0);;){var u=O(d);if(!u||d.line!=o.line)return;var w=g(d);if(!w)return;if(!u[1]&&w!="selfClose"){var y=K(d.line,d.ch),m=x(d,u[2]);return m&&A(m.from,y)>0?{from:y,to:m.from}:null}}}),Z.findMatchingTag=function(c,o,d){var u=new U(c,o.line,o.ch,d);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var w=g(u),y=w&&K(u.line,u.ch),m=w&&b(u);if(!w||!m||A(u,o)>0)return;var l={from:K(u.line,u.ch),to:y,tag:m[2]};return w=="selfClose"?{open:l,close:null,at:"open"}:m[1]?{open:S(u,m[2]),close:l,at:"close"}:(u=new U(c,y.line,y.ch,d),{open:l,close:x(u,m[2]),at:"open"})},Z.findEnclosingTag=function(c,o,d,u){for(var w=new U(c,o.line,o.ch,d);;){var y=S(w,u);if(!y)break;var m=new U(c,o.line,o.ch,d),l=x(m,y.tag);if(l)return{open:y,close:l}}},Z.scanForClosingTag=function(c,o,d,u){var w=new U(c,o.line,o.ch,u?{from:0,to:u}:null);return x(w,d)}})},"p77/":function(qe,Xe,$){},rUJ1:function(qe,Xe){const $=/[&<>"']/,Z=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,A=/[<>"']|&(?!#?\w+;)/g,W={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},M=_=>W[_];function P(_,f){if(f){if($.test(_))return _.replace(Z,M)}else if(K.test(_))return _.replace(A,M);return _}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function k(_){return _.replace(U,(f,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const R=/(^|[^\[])\^/g;function D(_,f){_=_.source||_,f=f||"";const h={replace:(s,a)=>(a=a.source||a,a=a.replace(R,"$1"),_=_.replace(s,a),h),getRegex:()=>new RegExp(_,f)};return h}const g=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(_,f,h){if(_){let s;try{s=decodeURIComponent(k(h)).replace(g,"").toLowerCase()}catch(a){return null}if(s.indexOf("javascript:")===0||s.indexOf("vbscript:")===0||s.indexOf("data:")===0)return null}f&&!b.test(h)&&(h=o(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(s){return null}return h}const T={},x=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,c=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(_,f){T[" "+_]||(x.test(_)?T[" "+_]=_+"/":T[" "+_]=y(_,"/",!0)),_=T[" "+_];const h=_.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:_.replace(S,"$1")+f:f.charAt(0)==="/"?h?f:_.replace(c,"$1")+f:_+f}const d={exec:function(){}};function u(_){let f=1,h,s;for(;f<arguments.length;f++){h=arguments[f];for(s in h)Object.prototype.hasOwnProperty.call(h,s)&&(_[s]=h[s])}return _}function w(_,f){const h=_.replace(/\|/g,(E,v,p)=>{let L=!1,I=v;for(;--I>=0&&p[I]==="\\";)L=!L;return L?"|":" |"}),s=h.split(/ \|/);let a=0;if(s.length>f)s.splice(f);else for(;s.length<f;)s.push("");for(;a<s.length;a++)s[a]=s[a].trim().replace(/\\\|/g,"|");return s}function y(_,f,h){const s=_.length;if(s===0)return"";let a=0;for(;a<s;){const E=_.charAt(s-a-1);if(E===f&&!h)a++;else if(E!==f&&h)a++;else break}return _.substr(0,s-a)}function m(_,f){if(_.indexOf(f[1])===-1)return-1;const h=_.length;let s=0,a=0;for(;a<h;a++)if(_[a]==="\\")a++;else if(_[a]===f[0])s++;else if(_[a]===f[1]&&(s--,s<0))return a;return-1}function l(_){_&&_.sanitize&&!_.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")}qe.exports={escape:P,unescape:k,edit:D,cleanUrl:O,resolveUrl:o,noopTest:d,merge:u,splitCells:w,rtrim:y,findClosingBracket:m,checkSanitizeDeprecation:l}},rcnY:function(qe,Xe,$){var Z=$("aRTE");function K(A,W){this.totalCount=A,this.dataCount=W}K.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],K.getRSBlocks=function(A,W){var M=K.getRsBlockTable(A,W);if(M==null)throw new Error("bad rs block @ typeNumber:"+A+"/errorCorrectLevel:"+W);for(var P=M.length/3,U=new Array,k=0;k<P;k++)for(var R=M[k*3+0],D=M[k*3+1],g=M[k*3+2],b=0;b<R;b++)U.push(new K(D,g));return U},K.getRsBlockTable=function(A,W){switch(W){case Z.L:return K.RS_BLOCK_TABLE[(A-1)*4+0];case Z.M:return K.RS_BLOCK_TABLE[(A-1)*4+1];case Z.Q:return K.RS_BLOCK_TABLE[(A-1)*4+2];case Z.H:return K.RS_BLOCK_TABLE[(A-1)*4+3];default:return}},qe.exports=K},sDPU:function(qe,Xe,$){"use strict";$.r(Xe);var Z=$("cWXX"),K=$("/ezw"),A=$("k1fw"),W=$("9og8"),M=$("tJVT"),P=$("WmNS"),U=$.n(P),k=$("cDcd"),R=$.n(k),D=$("Ty5D"),g=$("9kvl"),b=$("FIWC"),O=$.n(b),T=$("sbIO"),x=$("ErOA"),S=$("LvDl"),c=$.n(S),o=function(u){var w,y,m,l,_=u.paperlibrary,f=u.user,h=u.globalSetting,s=u.dispatch,a=u.location,E=(a==null||((w=a.query)===null||w===void 0)?void 0:w.select)||0,v=Object(k.useState)(!1),p=Object(M.a)(v,2),L=p[0],I=p[1],B=Object(k.useState)(!0),z=Object(M.a)(B,2),j=z[0],F=z[1],X=Object(k.useState)(Number(E)),te=Object(M.a)(X,2),ie=te[0],le=te[1],_e=Object(k.useState)({}),me=Object(M.a)(_e,2),he=me[0],fe=me[1],ce=Object(D.i)(),ne=f.userInfo;Object(k.useEffect)(function(){return s({type:"globalSetting/footerToggle",payload:!1}),function(){s({type:"globalSetting/footerToggle",payload:!0})}},[]),Object(k.useEffect)(function(){return s({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!1}),function(){s({type:"globalSetting/onlyShowBackTopToggle",payload:!0}),s({type:"globalSetting/onlyShowBackTopIconToggle",payload:!0})}},[]),Object(k.useEffect)(function(){return document.body.setAttribute("data-custom","initial"),function(){document.body.removeAttribute("data-custom")}},[]),Object(k.useEffect)(function(){q(ie)},[]);var q=function(){var we=Object(W.a)(U.a.mark(function Ae(){var Me,je,Ie=arguments;return U.a.wrap(function(Te){for(;;)switch(Te.prev=Te.next){case 0:return Me=Ie.length>0&&Ie[0]!==void 0?Ie[0]:0,console.log(ce),Te.next=4,Object(x.a)("/api/exercises/".concat(ce.categoryId,"/preview_random_exercise.json"),{method:"get",params:{num:Me}});case 4:je=Te.sent,F(!1),fe(ye(je));case 7:case"end":return Te.stop()}},Ae)}));return function(){return we.apply(this,arguments)}}(),ye=function(Ae){var Me={1:"\u4E00",2:"\u4E8C",3:"\u4E09",4:"\u56DB",5:"\u4E94",6:"\u516D",7:"\u4E03"};if(!Ae)return;var je=Ae||{},Ie=je.exam,Oe=je.single_questions,Te=je.multiple_questions,ct=je.judgement_questions,rt=je.program_questions,Ye=je.completion_questions,Ge=je.subjective_questions,ot=je.practical_questions,nt=je.combination_questions,et=[Object(A.a)({type:"SINGLE",name:"\u5355\u9009\u9898"},Oe),Object(A.a)({type:"MULTIPLE",name:"\u591A\u9009\u9898"},Te),Object(A.a)({type:"COMPLETION",name:"\u586B\u7A7A\u9898"},Ye),Object(A.a)({type:"JUDGMENT",name:"\u5224\u65AD\u9898"},ct),Object(A.a)({type:"SUBJECTIVE",name:"\u7B80\u7B54\u9898"},Ge),Object(A.a)({type:"PROGRAM",name:"\u7F16\u7A0B\u9898"},rt),Object(A.a)({type:"PRACTICAL",name:"\u5B9E\u8BAD\u9898"},ot),Object(A.a)({type:"COMBINATION",name:"\u7EC4\u5408\u9898"},nt)],Ee=[],it=0,Ze=0,be=et.filter(function(De){return De.questions_count>0}).map(function(De,ue){var ae;return(ae=De.questions)===null||ae===void 0||ae.forEach(function(se){Ee.push(se.id),it=it+se.score,Ze=Ze+1}),Object(A.a)(Object(A.a)({},De),{number:Me[ue+1]})});return{all_questions_count:Ze,all_score:it,questionList:be,ids:Ee,exam:Ie}},Fe=function(){g.d.push("/classrooms/".concat(ce.coursesId,"/exercise"))},Be=function(){alert("\u4FDD\u5B58")},We=function(){var we=Object(W.a)(U.a.mark(function Ae(Me,je){var Ie,Oe,Te;return U.a.wrap(function(rt){for(;;)switch(rt.prev=rt.next){case 0:return rt.next=2,Object(x.a)("/api/exercises/".concat(ce.categoryId,"/toggle_random_question.json"),{method:"post",body:{question_id:Me==null?void 0:Me.single_question_id}});case 2:Ie=rt.sent,Ie!=null&&Ie.question&&(Te=Object(S.cloneDeep)(he),Te.questionList=Te==null||((Oe=Te.questionList)===null||Oe===void 0)?void 0:Oe.map(function(Ye){if(Ye.type===je.type){var Ge=Object(S.cloneDeep)(Ye==null?void 0:Ye.questions);return Ge.splice(je.index,1,Ie==null?void 0:Ie.question),Object(A.a)(Object(A.a)({},Ye),{},{questions:Ge})}return Ye}),fe(Te));case 4:case"end":return rt.stop()}},Ae)}));return function(Me,je){return we.apply(this,arguments)}}(),ze=function(){var we=Object(W.a)(U.a.mark(function Ae(Me){return U.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:document.body.scrollIntoView(),q(Me),le(Me);case 3:case"end":return Ie.stop()}},Ae)}));return function(Me){return we.apply(this,arguments)}}();return console.log(Object(D.h)(),"location333"),R.a.createElement("section",{className:O.a.wrap},R.a.createElement(K.a,{loading:j,active:!0,paragraph:{rows:5}},((y=Object(D.h)())===null||y===void 0||((m=y.pathname)===null||m===void 0)?void 0:m.includes("preview"))&&R.a.createElement("div",{className:O.a.crumbs},R.a.createElement("b",null),R.a.createElement("span",{className:"current",onClick:function(){return g.d.push("/classrooms/".concat(ce.coursesId,"/exercise"))}},"".concat(ne==null||((l=ne.course)===null||l===void 0)?void 0:l.course_name,">")),R.a.createElement("span",{className:"current",onClick:function(){return g.d.push("/classrooms/".concat(ce.coursesId,"/exercise"))}},"\u8BD5\u5377\u5217\u8868>"),R.a.createElement("span",{style:{color:"#bebebe"}},"\u9884\u89C8")),R.a.createElement(T.a,{loading:L,submit:Be,goBack:Fe,data:he,selectValue:ie,editPreview:!0,onExchange:We,onSkipExamination:ze})))};Xe.default=Object(g.a)(function(d){var u=d.paperlibrary,w=d.user,y=d.globalSetting;return{paperlibrary:u,user:w,globalSetting:y}})(o)},sbIO:function(qe,Xe,$){"use strict";var Z=$("DjyN"),K=$("NUBc"),A=$("5Dmo"),W=$("3S7+"),M=$("/zsF"),P=$("PArb"),U=$("Q9mQ"),k=$("diRs"),R=$("+L6B"),D=$("2/Rp"),g=$("5NDa"),b=$("5rEg"),O=$("miYZ"),T=$("tsqr"),x=$("9og8"),S=$("giR+"),c=$("fyUT"),o=$("2qtc"),d=$("kLXV"),u=$("tJVT"),w=$("WmNS"),y=$.n(w),m=$("cDcd"),l=$.n(m),_=$("PsQE"),f=$.n(_),h=$("0eGx"),s=$.n(h),a=$("9Bee"),E=$("Ty5D"),v=$("9kvl"),p=$("ErOA"),L=$("+yhJ"),I=$.n(L),B=$("RZ/O"),z=$.n(B),j=$("LvDl"),F=$("6K3P"),X=$.n(F),te=$("sRBo"),ie=$("kaz8"),le=$("oBTY"),_e=$("PpiC"),me=$("Ot1p"),he=$("kqOp"),fe=$("7qnI"),ce=$("1vsH"),ne=$("PGNT"),q=$.n(ne),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"],Fe=function(J,ee){var de=J.globalSetting,xe=J.loading,Re=J.dispatch,lt=J.isEdit,st=J.editData,Le=Object(_e.a)(J,["globalSetting","loading","dispatch","isEdit","editData"]),_t=Object(m.useState)(""),Ue=Object(u.a)(_t,2),Ve=Ue[0],Tt=Ue[1],ht=Object(m.useState)(""),St=Object(u.a)(ht,2),kt=St[0],pt=St[1],Bt=Object(m.useState)([]),Ot=Object(u.a)(Bt,2),Pt=Ot[0],Ft=Ot[1],It=Object(m.useState)(""),Wt=Object(u.a)(It,2),Lt=Wt[0],Ct=Wt[1],gt=Object(m.useState)(),tt=Object(u.a)(gt,2),ke=tt[0],zt=tt[1],jt=Object(m.useState)(!1),Vt=Object(u.a)(jt,2),Mt=Vt[0],br=Vt[1];Object(m.useEffect)(function(){if(!st||!lt)return;Tt(st==null?void 0:st.name),pt(st==null?void 0:st.analysis),zt(st==null?void 0:st.is_ordered),br(!0)},[st]),Object(m.useEffect)(function(){if(!Mt)return;var cr=st==null?void 0:st.standard_answer.map(function(Ut){return Ut.answer_text});Ft(cr),br(!1)},[Mt]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Yt,Clear:Et}});var Yt=function(){var Ut=[],vt=!1;return Ve?(Pt.forEach(function(ar,gr){Ut.push({position:gr+1,answer_text:[]}),ar.forEach(function(lr,vr){Ut[gr].answer_text.push(lr),(!lr||!Object(ce.fb)(lr,1e4))&&(Ct("".concat(gr,"-").concat(vr)),T.b.info(lr?"\u7B54\u6848\u4E0D\u80FD\u8D85\u8FC710000\u5B57\u7B26":"\u7B54\u6848\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"),vt=!0)})}),vt?!1:(Ut==null?void 0:Ut.length)>20?(T.b.warn("\u586B\u7A7A\u9898\u6807\u51C6\u7B54\u6848\u4E0D\u80FD\u4E3A\u7A7A/\u4E0D\u80FD\u8D85\u8FC720\u4E2A\uFF01"),!1):{name:Ve,analysis:kt,standard_answers:Ut,is_ordered:ke}):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Et=function(){Tt(""),pt(""),Ft([]),zt(!1)},Ce=function(Ut,vt,ar){var gr=Pt.slice();if(vt&&gr.splice(Ut,vt),ar)for(var lr=0;lr<ar;lr++)gr.splice(Ut+lr,0,[""]);Ft(gr)},ft=function(Ut,vt,ar){Ct("");var gr=Pt.slice();gr[Ut][vt]=ar,Ft(gr)},xr=function(Ut){var vt=Pt.slice();vt[Ut]=[].concat(Object(le.a)(vt[Ut]),[""]),Ft(vt)},Qr=function(Ut,vt){var ar=Pt.slice();if(!ar[Ut][vt]){ar[Ut]=ar[Ut].filter(function(gr,lr){return lr!==vt}),Ft(ar);return}d.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:q.a.modal,onOk:function(){ar[Ut]=ar[Ut].filter(function(lr,vr){return vr!==vt}),Ft(ar)}})},Jr=function(Ut){d.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:q.a.modal,onOk:function(){var ar=Pt.slice();ar=Pt.filter(function(gr,lr){return Ut!==lr}),Ft(ar)}})};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement("div",null,l.a.createElement(he.a,{id:"completion-question-tittle",placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE",height:155,defaultValue:Ve,onChange:function(Ut){return Tt(Ut)},showNullButton:!0,onPlaceholderChange:Ce})),l.a.createElement("div",{className:"mt20"},Pt.map(function(cr,Ut){return l.a.createElement(fe.a,{key:Ut,answers:cr,index:Ut,flex:1,is_md:!0,activeOptionErrorIndex:Lt,onAnswerChange:ft,addChildAnswer:xr,deleteChildAnswer:Qr,deleteChildAnswermain:Jr})})),l.a.createElement("div",{className:"mt20"},Pt.length>1&&l.a.createElement("span",null,l.a.createElement(ie.a,{checked:ke,onChange:function(Ut){return zt(Ut.target.checked)},className:"".concat(q.a.color333," font14")},"\u591A\u4E2A\u586B\u7A7A\u7684\u7B54\u6848\u6709\u987A\u5E8F\u8981\u6C42"),l.a.createElement("span",{className:"".concat(q.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"))),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:kt,onChange:function(Ut){return pt(Ut)}}))},Be=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Fe)),We=$("7Kak"),ze=$("9yH6"),we=["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"],Ae=function(J,ee){var de=J.globalSetting,xe=J.loading,Re=J.editData,lt=J.dispatch,st=J.onRef,Le=st===void 0?function(){}:st,_t=J.isEdit,Ue=Object(_e.a)(J,["globalSetting","loading","editData","dispatch","onRef","isEdit"]),Ve=Object(m.useState)(),Tt=Object(u.a)(Ve,2),ht=Tt[0],St=Tt[1],kt=Object(m.useState)(""),pt=Object(u.a)(kt,2),Bt=pt[0],Ot=pt[1],Pt=Object(m.useState)(""),Ft=Object(u.a)(Pt,2),It=Ft[0],Wt=Ft[1];Object(m.useEffect)(function(){if(!Re||!_t)return;Ot(Re==null?void 0:Re.name),Wt(Re==null?void 0:Re.analysis);var gt=Re==null?void 0:Re.choices.find(function(tt){return tt.is_answer});St(gt.choice_text==="\u6B63\u786E"?"0":"1")},[Re]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Lt,Clear:Ct}});var Lt=function(){if(!Bt)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(!ht)return T.b.info("\u8BF7\u5148\u70B9\u51FB\u9009\u62E9\u672C\u9009\u62E9\u9898\u7684\u6B63\u786E\u9009\u9879"),!1;var tt=[{choice_text:"\u6B63\u786E",is_answer:ht==="0"?1:0},{choice_text:"\u9519\u8BEF",is_answer:ht==="1"?1:0}];return{name:Bt,choices:tt,analysis:It}},Ct=function(){Ot(""),Wt(""),St("")};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(me.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Bt,onChange:function(tt){return Ot(tt)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),l.a.createElement(ze.a.Group,{buttonStyle:"solid",value:ht,onChange:function(tt){return St(tt.target.value)}},l.a.createElement(ze.a.Button,{value:"0",className:"".concat(q.a.radio," mr40")},"\u6B63\u786E"),l.a.createElement(ze.a.Button,{value:"1",className:q.a.radio},"\u9519\u8BEF")),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:It,onChange:function(tt){return Wt(tt)}}))},Me=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ae)),je=["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"],Ie=function(J,ee){var de=J.editData,xe=J.globalSetting,Re=J.loading,lt=J.dispatch,st=J.onRef,Le=st===void 0?function(){}:st,_t=J.isEdit,Ue=Object(_e.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(m.useState)([]),Tt=Object(u.a)(Ve,2),ht=Tt[0],St=Tt[1],kt=Object(m.useState)(),pt=Object(u.a)(kt,2),Bt=pt[0],Ot=pt[1],Pt=Object(m.useState)([]),Ft=Object(u.a)(Pt,2),It=Ft[0],Wt=Ft[1],Lt=Object(m.useState)(""),Ct=Object(u.a)(Lt,2),gt=Ct[0],tt=Ct[1],ke=Object(m.useState)(""),zt=Object(u.a)(ke,2),jt=zt[0],Vt=zt[1];Object(m.useEffect)(function(){St(["","","",""])},[]),Object(m.useEffect)(function(){if(!de||!_t)return;tt(de==null?void 0:de.name),Vt(de==null?void 0:de.analysis),St(de==null?void 0:de.choices.map(function(Et){return Et.choice_text}));var Yt=[];de==null||de.choices.map(function(Et,Ce){Et.is_answer&&Yt.push(Ce)}),Wt(Yt)},[de]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Mt,Clear:br}});var Mt=function(){if(!gt)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Et=ht.findIndex(function(ft){return!ft});if(Et>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(je[Et]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(!It.length)return T.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;if(It.length<2)return T.b.info("\u591A\u9009\u9898\u6700\u5C0F\u6B63\u786E\u9009\u9879\u4E3A2\u4E2A"),!1;var Ce=ht.map(function(ft,xr){return{choice_text:ft,is_answer:It.includes(xr)?1:0}});return{name:gt,choices:Ce,analysis:jt}},br=function(){St(["","","",""]),tt(""),Vt(""),Wt("")};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(me.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:gt,onChange:function(Et){return tt(Et)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ht.map(function(Yt,Et){return l.a.createElement("div",{className:q.a.choiceWrap,key:Et},l.a.createElement(W.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(q.a.answer," ").concat(It.includes(Et)?q.a.activeAnswer:""),onClick:function(){It.includes(Et)?Wt(It.filter(function(ft){return ft!==Et})):Wt([].concat(Object(le.a)(It),[Et]))}},je[Et])),l.a.createElement("div",{className:q.a.editorWrap},Bt===Et?l.a.createElement(me.a,{id:"single-question-option-".concat(Et),watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Yt,onChange:function(ft){ht[Et]=ft,St(ht)}}):l.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Ot(Et)}},l.a.createElement(a.a,{value:Yt}))),Et>1&&l.a.createElement(W.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){St(ht.filter(function(ft,xr){return xr!==Et})),It.includes(Et)?Wt(It.filter(function(ft){return ft!==Et})):Wt([].concat(Object(le.a)(It),[Et]))}})),Et<7&&Et===ht.length-1&&l.a.createElement(W.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return St([].concat(Object(le.a)(ht),[""]))}})))}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:jt,onChange:function(Et){return Vt(Et)}}))},Oe=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ie)),Te=["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"],ct=function(J,ee){var de=J.editData,xe=J.globalSetting,Re=J.loading,lt=J.dispatch,st=J.onRef,Le=st===void 0?function(){}:st,_t=J.isEdit,Ue=Object(_e.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(m.useState)([]),Tt=Object(u.a)(Ve,2),ht=Tt[0],St=Tt[1],kt=Object(m.useState)(),pt=Object(u.a)(kt,2),Bt=pt[0],Ot=pt[1],Pt=Object(m.useState)(),Ft=Object(u.a)(Pt,2),It=Ft[0],Wt=Ft[1],Lt=Object(m.useState)(""),Ct=Object(u.a)(Lt,2),gt=Ct[0],tt=Ct[1],ke=Object(m.useState)(""),zt=Object(u.a)(ke,2),jt=zt[0],Vt=zt[1];Object(m.useEffect)(function(){St(["","","",""])},[]),Object(m.useEffect)(function(){if(!de||!_t)return;tt(de==null?void 0:de.name),Vt(de==null?void 0:de.analysis),St(de==null?void 0:de.choices.map(function(Yt){return Yt.choice_text})),Wt(de==null?void 0:de.choices.findIndex(function(Yt){return Yt.is_answer}))},[de]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Mt,Clear:br}});var Mt=function(){if(!gt)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;var Et=ht.findIndex(function(ft){return!ft});if(Et>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165 ".concat(Te[Et]," \u9009\u9879\u7684\u5185\u5BB9")),!1;if(console.log("activeAnswer: ",It),!(typeof It=="number"))return T.b.info("\u8BF7\u8BBE\u7F6E\u672C\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E"),!1;var Ce=ht.map(function(ft,xr){return{choice_text:ft,is_answer:It===xr?1:0}});return{name:gt,choices:Ce,analysis:jt}},br=function(){St(["","","",""]),tt(""),Vt(""),Wt("")};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(me.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:gt,onChange:function(Et){return tt(Et)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),ht.map(function(Yt,Et){return l.a.createElement("div",{className:q.a.choiceWrap,key:Et},l.a.createElement(W.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(q.a.answer," ").concat(It===Et?q.a.activeAnswer:""),onClick:function(){return Wt(Et)}},Te[Et])),l.a.createElement("div",{className:q.a.editorWrap},Bt===Et?l.a.createElement(me.a,{id:"single-question-option-".concat(Et),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:Yt,onChange:function(ft){ht[Et]=ft,St(ht)}}):l.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Ot(Et)}},l.a.createElement(a.a,{value:Yt}))),Et>1&&l.a.createElement(W.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){St(ht.filter(function(ft,xr){return xr!==Et})),Et===It&&Wt(null)}})),Et<7&&Et===ht.length-1&&l.a.createElement(W.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return St([].concat(Object(le.a)(ht),[""]))}})))}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:jt,onChange:function(Et){return Vt(Et)}}))},rt=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(ct)),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"],Ge=function(J,ee){var de=J.editData,xe=J.globalSetting,Re=J.loading,lt=J.dispatch,st=J.onRef,Le=st===void 0?function(){}:st,_t=J.isEdit,Ue=Object(_e.a)(J,["editData","globalSetting","loading","dispatch","onRef","isEdit"]),Ve=Object(m.useState)(""),Tt=Object(u.a)(Ve,2),ht=Tt[0],St=Tt[1],kt=Object(m.useState)(""),pt=Object(u.a)(kt,2),Bt=pt[0],Ot=pt[1],Pt=Object(m.useState)(""),Ft=Object(u.a)(Pt,2),It=Ft[0],Wt=Ft[1];Object(m.useEffect)(function(){var gt;if(!de||!_t)return;St(de==null?void 0:de.name),Ot(de==null?void 0:de.analysis),Wt(de==null||((gt=de.answer_texts)===null||gt===void 0)?void 0:gt[0])},[de]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Lt,Clear:Ct}});var Lt=function(){return ht?It?{name:ht,answer_texts:[It],analysis:Bt}:(T.b.info("\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848"),!1):(T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1)},Ct=function(){St(""),Ot(""),Wt("")};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(me.a,{id:"single-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ht,onChange:function(tt){return St(tt)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u53C2\u8003\u7B54\u6848\uFF1A")),l.a.createElement(me.a,{id:"single-question-reference-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u53C2\u8003\u7B54\u6848",defaultValue:It,onChange:function(tt){return Wt(tt)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Bt,onChange:function(tt){return Ot(tt)}}))},ot=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ge)),nt=$("k1fw"),et=["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(J,ee){var de=J.globalSetting,xe=J.loading,Re=J.dispatch,lt=J.editData,st=J.onRef,Le=st===void 0?function(){}:st,_t=J.isEdit,Ue=Object(_e.a)(J,["globalSetting","loading","dispatch","editData","onRef","isEdit"]),Ve=Object(m.useState)(""),Tt=Object(u.a)(Ve,2),ht=Tt[0],St=Tt[1],kt=Object(m.useState)([]),pt=Object(u.a)(kt,2),Bt=pt[0],Ot=pt[1];console.log(Bt),Object(m.useEffect)(function(){var Lt;if(!lt||!_t)return;St(lt==null?void 0:lt.name);var Ct=lt==null||((Lt=lt.sub_item_banks)===null||Lt===void 0)?void 0:Lt.map(function(gt){var tt,ke,zt;return Object(nt.a)(Object(nt.a)({},gt),{},{id:gt.id,open:!1,qusList:gt==null||((tt=gt.choices)===null||tt===void 0)?void 0:tt.map(function(jt){return jt.choice_text}),activeQusEditor:null,qusAnswer:(ke=[gt==null||((zt=gt.choices)===null||zt===void 0)?void 0:zt.findIndex(function(jt){return jt.is_answer})])===null||ke===void 0?void 0:ke.filter(function(jt){return jt!==-1})})});Ot(Ct)},[lt]),Object(m.useImperativeHandle)(ee,function(){return{onSave:Pt,Clear:Ft}});var Pt=function(){if(!ht)return T.b.info("\u8BF7\u60A8\u8F93\u5165\u9898\u5E72"),!1;if(Bt.length===0)return T.b.info("\u8BF7\u60A8\u6DFB\u52A0\u5C0F\u9898"),!1;for(var Ct=0;Ct<Bt.length;Ct++){var gt,tt=Bt[Ct];if(!(tt!=null&&tt.name))return T.b.info("\u8BF7\u60A8\u8F93\u5165\u7B2C".concat(Ct+1,"\u5C0F\u9898\u9898\u5E72")),!1;var ke=tt==null||((gt=tt.qusList)===null||gt===void 0)?void 0:gt.findIndex(function(jt){return!jt});if(ke>-1)return T.b.info("\u8BF7\u5148\u8F93\u5165\u7B2C".concat(Ct+1,"\u5C0F\u9898").concat(et[ke],"\u9009\u9879\u7684\u5185\u5BB9")),!1;if(!(tt!=null&&tt.qusAnswer.length))return T.b.info("\u8BF7\u8BBE\u7F6E\u7B2C".concat(Ct+1,"\u5C0F\u9898\u7684\u6B63\u786E\u7B54\u6848\uFF0C\u70B9\u51FB\u9009\u9879A/B...\u5373\u53EF\u5B8C\u6210\u8BBE\u7F6E")),!1}var zt=Bt.map(function(jt){return{id:jt.id>1?jt.id:null,name:jt.name,item_type:jt.item_type,analysis:jt.analysis,choices:jt.qusList.map(function(Vt,Mt){return{choice_text:Vt,is_answer:jt.qusAnswer[0]===Mt?1:0}})}});return{name:ht,sub_item_banks:zt}},Ft=function(){St(""),Ot([])},It=function(){var Ct={id:Math.random(),item_type:"SINGLE",open:!1,name:"",qusList:["","","",""],activeQusEditor:null,qusAnswer:[],analysis:""};Ot(Bt.concat(Ct))},Wt=function(Ct,gt,tt){var ke=Object(j.cloneDeep)(Bt);if(Ct==="open"&&(ke[gt].open=!ke[gt].open),Ct==="delete"&&ke.splice(gt,1),Ct==="value"&&(ke[gt].name=tt),Ct==="answer"&&(ke[gt].qusAnswer=[tt]),Ct==="edit"&&(ke[gt].activeQusEditor=tt),Ct==="details"&&(ke[gt].qusList[ke[gt].activeQusEditor]=tt),Ct==="addQus"&&(ke[gt].qusList=ke[gt].qusList.concat("")),Ct==="deleteQus"){var zt;ke[gt].qusList=ke[gt].qusList.filter(function(jt,Vt){return Vt!==tt}),ke[gt].qusAnswer=(zt=ke[gt].qusAnswer)===null||zt===void 0?void 0:zt.filter(function(jt){return jt!==tt})}Ct==="analysis"&&(ke[gt].analysis=tt),Ot(ke)};return l.a.createElement("section",{className:q.a.wrap},l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u9898\u5E72\uFF1A")),l.a.createElement(me.a,{id:"combination-question-title",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:ht,onChange:function(Ct){return St(Ct)}}),Bt==null?void 0:Bt.map(function(Lt,Ct){var gt;return l.a.createElement("div",{className:q.a.fold,key:Lt.id},l.a.createElement("div",{onClick:function(){return Wt("open",Ct)},className:q.a.head},l.a.createElement("i",{className:"iconfont icon-sanjiaoxing",style:{transform:Lt.open?"initial":"rotate(270deg) translate(2px, 4px)"}}),l.a.createElement("span",null,"\u7B2C",Ct+1,"\u5C0F\u9898\uFF08\u5355\u9009\u9898\uFF09"),l.a.createElement("b",{style:{visibility:"hidden"},onClick:function(ke){ke.stopPropagation(),Wt("delete",Ct)},className:"iconfont icon-shanchu8"})),l.a.createElement("div",{className:"mb10",style:{display:Lt.open?"block":"none"}},l.a.createElement(me.a,{watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u5E72",defaultValue:Lt==null?void 0:Lt.name,onChange:function(ke){return Wt("value",Ct,ke)}}),l.a.createElement("p",{className:q.a.titleWrap},l.a.createElement("span",{className:q.a.required},"*"),l.a.createElement("span",{className:q.a.title},"\u7B54\u6848\u9009\u9879\uFF1A",l.a.createElement("span",{className:q.a.colorGray},"\u70B9\u51FB\u9009\u9879\u53EF\u8BBE\u7F6E\u6B63\u786E\u7B54\u6848"))),Lt==null||((gt=Lt.qusList)===null||gt===void 0)?void 0:gt.map(function(tt,ke){var zt,jt;return l.a.createElement("div",{className:q.a.choiceWrap,key:ke},l.a.createElement(W.a,{title:"\u70B9\u51FB\u8BBE\u7F6E\u4E3A\u6807\u51C6\u7B54\u6848",placement:"left"},l.a.createElement("div",{className:"".concat(q.a.answer," ").concat(Lt!=null&&(zt=Lt.qusAnswer)!==null&&zt!==void 0&&zt.includes(ke)?q.a.activeAnswer:""),onClick:function(){return Wt("answer",Ct,ke)}},et[ke])),l.a.createElement("div",{className:q.a.editorWrap},(Lt==null?void 0:Lt.activeQusEditor)===ke?l.a.createElement(me.a,{id:"single-question-option-".concat(ke),watch:!0,height:155,isFocus:!0,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9009\u9879",defaultValue:tt,onChange:function(Mt){return Wt("details",Ct,Mt)}}):l.a.createElement("div",{className:q.a.htmlWrap,onClick:function(){return Wt("edit",Ct,ke)}},l.a.createElement(a.a,{value:tt}))),ke>1&&l.a.createElement(W.a,{title:"\u5220\u9664"},l.a.createElement("i",{className:"".concat(q.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return Wt("deleteQus",Ct,ke)}})),ke<7&&ke===(Lt==null||((jt=Lt.qusList)===null||jt===void 0)?void 0:jt.length)-1&&l.a.createElement(W.a,{title:"\u65B0\u589E\u53C2\u8003\u7B54\u6848"},l.a.createElement("i",{className:"".concat(q.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return Wt("addQus",Ct)}})))}),l.a.createElement("p",{className:"mb10 mt10"},l.a.createElement("span",{className:q.a.title},"\u9898\u76EE\u89E3\u6790\uFF1A")),l.a.createElement(me.a,{id:"single-question-answer",watch:!0,height:155,placeholder:"\u8BF7\u60A8\u8F93\u5165\u9898\u76EE\u89E3\u6790",defaultValue:Lt.analysis,onChange:function(ke){return Wt("analysis",Ct,ke)}})))}))},it=Object(v.a)(function(Q){var J=Q.loading,ee=Q.globalSetting;return{globalSetting:ee,loading:J.effects}},null,null,{forwardRef:!0})(Object(m.forwardRef)(Ee)),Ze=$("14J3"),be=$("BMrR"),De=$("ZWs3"),ue=function(J){var ee=J.visible,de=J.onCancel,xe=J.onRandomExchange,Re=J.selectFromProblemSet;return l.a.createElement(d.a,{title:"\u8BF7\u9009\u62E9\u66FF\u6362\u65B9\u5F0F",visible:ee,onCancel:de,centered:!0,maskClosable:!0,footer:null},l.a.createElement(be.a,{justify:"center"},l.a.createElement(De.a,{onClick:xe},"\u968F\u673A\u66F4\u6362"),l.a.createElement(D.a,{style:{marginLeft:24},onClick:Re},"\u4ECE\u9898\u5E93\u4E2D\u9009\u62E9")))},ae=ue,se=function(J){var ee,de,xe,Re,lt,st,Le,_t,Ue=J.data,Ve=J.submit,Tt=J.goBack,ht=J.loading,St=J.onTypeScore,kt=J.editPreview,pt=kt===void 0?!1:kt,Bt=J.onSkipExamination,Ot=J.selectValue,Pt=J.onExchange,Ft=Object(m.useRef)(),It=Object(m.useRef)(Object(j.debounce)(function(){return cr()},100,{leading:!0,trailing:!0})),Wt=Object(m.useState)(null),Lt=Object(u.a)(Wt,2),Ct=Lt[0],gt=Lt[1],tt=Object(m.useState)(!1),ke=Object(u.a)(tt,2),zt=ke[0],jt=ke[1],Vt=Object(m.useState)(!1),Mt=Object(u.a)(Vt,2),br=Mt[0],Yt=Mt[1],Et=Object(m.useRef)(),Ce=Object(E.i)();Object(m.useEffect)(function(){return window.addEventListener("scroll",It==null?void 0:It.current),function(){window.removeEventListener("scroll",It==null?void 0:It.current)}},[]),Object(m.useEffect)(function(){jt(!0)},[]),Object(m.useEffect)(function(){var $e,ge,He,bt,at=($e=document.getElementById("examName"))===null||$e===void 0||((ge=$e.getElementsByClassName("ant-pagination-options-quick-jumper"))===null||ge===void 0||((He=ge[0])===null||He===void 0||((bt=He.childNodes)===null||bt===void 0)))?void 0:bt[2];at&&(at.nodeValue="\u4EFD")},[Ue]);var ft=function(ge){var He=parseInt(ge);return isNaN(He)?"":He};function xr(){var $e=0,ge=0,He=0;return document.body&&(ge=document.body.scrollTop),document.documentElement&&(He=document.documentElement.scrollTop),$e=ge-He>0?ge:He,$e}function Qr(){var $e=0,ge=0,He=0;return document.body&&(ge=document.body.scrollHeight),document.documentElement&&(He=document.documentElement.scrollHeight),$e=ge-He>0?ge:He,$e}function Jr(){var $e=0;return document.compatMode=="CSS1Compat"?$e=document.documentElement.clientHeight:$e=document.body.clientHeight,$e}var cr=function(){var ge=document.getElementById("preview_btns"),He=document.getElementById("preview_btns_else");xr()+Jr()>=Qr()-68?(ge.style.visibility="hidden",He.style.visibility="visible"):(ge.style.visibility="visible",He.style.visibility="hidden")},Ut=["\u5BB9\u6613","\u7B80\u5355","\u9002\u4E2D","\u56F0\u96BE"],vt=function(ge){var He,bt=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("aside",{className:f.a.single},ge==null||((He=ge.choices)===null||He===void 0)?void 0:He.map(function(at,ut){return at.is_answer&&bt.push(cn[ut]),l.a.createElement("ul",{key:ut},l.a.createElement("li",null,cn[ut],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:at.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",bt.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ut[ge.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:ge.analysis?ge.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ge==null?void 0:ge.discipline_name,"/").concat(ge==null?void 0:ge.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ge==null?void 0:ge.tag_discipline_name))))},ar=function(ge){var He,bt=ge==null||((He=ge.standard_answer)===null||He===void 0)?void 0:He.map(function(at){var ut;return"\u7B54\u6848\uFF08\u586B\u7A7A".concat(at.position,"\uFF09\uFF1A").concat(at==null||((ut=at.answer_text)===null||ut===void 0)?void 0:ut.join("\u3001"))});return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",bt),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:ge.analysis?ge.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ge==null?void 0:ge.discipline_name,"/").concat(ge==null?void 0:ge.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ge==null?void 0:ge.tag_discipline_name))))},gr=function(ge){var He;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",ge==null||((He=ge.answer_texts)===null||He===void 0)?void 0:He[0]),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:ge.analysis?ge.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ge==null?void 0:ge.discipline_name,"/").concat(ge==null?void 0:ge.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ge==null?void 0:ge.tag_discipline_name)))},lr=function(ge){var He;return l.a.createElement("div",{className:f.a.analysis},l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u9884\u671F\u8F93\u51FA:"),l.a.createElement(a.a,{value:ge==null||((He=ge.program_attr)===null||He===void 0)?void 0:He.description})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ge==null?void 0:ge.discipline_name,"/").concat(ge==null?void 0:ge.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ge==null?void 0:ge.tag_discipline_name)))},vr=function(ge,He){var bt;return l.a.createElement("div",null,ge==null||((bt=ge.sub_item_banks)===null||bt===void 0)?void 0:bt.map(function(at,ut){var Dt,rr=[];return l.a.createElement(l.a.Fragment,null,l.a.createElement("div",{style:{marginLeft:25,fontSize:"16px",color:"#333"}},He+1+"."+(ut+1),"\uFF08\u5355\u9009\u9898\uFF09",at.name),l.a.createElement("aside",{className:f.a.single},at==null||((Dt=at.choices)===null||Dt===void 0)?void 0:Dt.map(function(Zt,nr){return Zt.is_answer&&rr.push(cn[nr]),l.a.createElement("ul",{key:nr},l.a.createElement("li",null,cn[nr],"\u3001"),l.a.createElement("li",null,l.a.createElement(a.a,{value:Zt.choice_text})))})),l.a.createElement("div",{className:f.a.analysis},l.a.createElement("div",null,"\u6B63\u786E\u7B54\u6848\uFF1A",rr.join(""),l.a.createElement("span",{className:"ml30"},"\u96BE\u5EA6\uFF1A",Ut[at.difficulty])),l.a.createElement("aside",null,l.a.createElement("span",{className:f.a.text},"\u89E3\u6790:"),l.a.createElement(a.a,{value:at.analysis?at.analysis:"\u6682\u65E0\u89E3\u6790"})),l.a.createElement("ul",null,l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#007AFF",marginRight:10}},"\u65B9\u5411&\u8BFE\u7A0B:"),"".concat(ge==null?void 0:ge.discipline_name,"/").concat(ge==null?void 0:ge.sub_discipline_name)),l.a.createElement("li",null,l.a.createElement("span",{style:{color:"#5AB891",marginRight:10}},"\u77E5\u8BC6\u70B9:"),ge==null?void 0:ge.tag_discipline_name))))}))},cn=["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"],Dn=function(ge){var He,bt=[];ge==null||((He=ge.questions)===null||He===void 0)||He.map(function(ut){var Dt;return ut==null||((Dt=ut.sub_item_banks)===null||Dt===void 0)?void 0:Dt.map(function(rr){bt.push(rr)})});var at=0;ge.type==="COMBINATION"?at=ge.questions_score/bt.length:at=ge.questions_score/ge.questions_count,d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u5206\u6570\u8BBE\u7F6E",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{className:f.a.modalRow,style:{justifyContent:"flex-start"}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",null,ge==null?void 0:ge.name,(ge==null?void 0:ge.type)==="COMBINATION"&&"\u4E2D\u7684\u6BCF\u5C0F\u9898","\uFF1A"),l.a.createElement(c.a,{min:1,parser:ft,defaultValue:at,onChange:function(Dt){at=Dt}}),l.a.createElement("span",{className:"ml5"},"\u5206/\u9898"))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var ut=Object(x.a)(y.a.mark(function rr(){var Zt,nr;return y.a.wrap(function(or){for(;;)switch(or.prev=or.next){case 0:if(at){or.next=3;break}return T.b.warn("\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A\u6216\u4E3A0"),or.abrupt("return",Promise.reject());case 3:ge.type==="COMBINATION"?(Zt={type:ge==null?void 0:ge.type,score:at,scoreTotal:at*(bt==null?void 0:bt.length)},St(Zt)):(nr={type:ge==null?void 0:ge.type,score:at,scoreTotal:at*ge.questions_count},St(nr));case 4:case"end":return or.stop()}},rr)}));function Dt(){return ut.apply(this,arguments)}return Dt}()})},Ne=function(){var ge="";d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u4FDD\u5B58\u8BD5\u5377",content:l.a.createElement("div",{className:f.a.modalColumn},l.a.createElement("div",{style:{color:"#676A6C",display:"flex"},className:"font14 mt20"},l.a.createElement("img",{style:{marginRight:5},src:X.a}),"\u4FDD\u5B58\u540E\u5355\u72EC\u751F\u6210\u4E00\u4EFD\u4EBA\u5DE5\u7EC4\u5377\u7C7B\u578B\u7684\u56FA\u5B9A\u8BD5\u5377\u3002"),l.a.createElement("div",{className:f.a.modalRow,style:{marginTop:20}},l.a.createElement("sup",{className:f.a.sup},"*"),l.a.createElement("span",{style:{flexShrink:0}},"\u8BD5\u5377\u540D\u79F0\uFF1A"),l.a.createElement(b.a,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u540D\u79F0",min:0,maxLength:60,defaultValue:ge,onChange:function(bt){ge=bt.target.value}}))),okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var He=Object(x.a)(y.a.mark(function at(){var ut,Dt,rr,Zt,nr;return y.a.wrap(function(or){for(;;)switch(or.prev=or.next){case 0:if(ge){or.next=3;break}return T.b.warn("\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"),or.abrupt("return",Promise.reject());case 3:return Dt=[],rr=[],Zt=[],Ue==null||((ut=Ue.questionList)===null||ut===void 0)||ut.forEach(function(Nr){var hr;(hr=Nr.questions)===null||hr===void 0||hr.forEach(function(en){Dt.push(en.id),rr.push(Nr.questions_score/Nr.questions_count),Nr.type==="COMBINATION"&&Zt.push({id:en.id,sub_item_bank_ids:en.sub_item_banks.map(function(Cr){return Cr.id})})})}),console.log("-----",Zt),nr={item_bank_ids:Dt,item_bank_scores:rr,name:ge,combination_item_banks:Zt},or.next=11,Ve(nr);case 11:case"end":return or.stop()}},at)}));function bt(){return He.apply(this,arguments)}return bt}()})},Rn=function(ge,He,bt,at){var ut,Dt="".concat(location.pathname).concat(location.search),rr=(ut=at.questions)===null||ut===void 0?void 0:ut.map(function(nr){return nr.id});if(Dt.includes("exercise"))Et.current={id:ge,ids:rr,type:He,index:bt},Yt(!0);else var Zt=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u8981\u66F4\u6362\u8BE5\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!0,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var nr=Object(x.a)(y.a.mark(function or(){return y.a.wrap(function(hr){for(;;)switch(hr.prev=hr.next){case 0:return Zt.update({cancelButtonProps:{disabled:!0}}),hr.next=3,Pt({single_question_id:ge,seleted_item_bank_ids:rr},{type:He,index:bt});case 3:Zt.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u8BD5\u9898");case 5:case"end":return hr.stop()}},or)}));function Pr(){return nr.apply(this,arguments)}return Pr}()})},Kn=function(ge){var He,bt=(He=ge.questions)===null||He===void 0?void 0:He.map(function(Dt){return Dt.id}),at=ge.name,ut=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362".concat(at,"\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F"),cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var Dt=Object(x.a)(y.a.mark(function Zt(){return y.a.wrap(function(Pr){for(;;)switch(Pr.prev=Pr.next){case 0:return ut.update({cancelButtonProps:{disabled:!0}}),Pr.next=3,Pt({seleted_item_bank_ids:bt},{type:ge.type});case 3:ut.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210".concat(at,"\u8BD5\u9898"));case 5:case"end":return Pr.stop()}},Zt)}));function rr(){return Dt.apply(this,arguments)}return rr}()})},vn=function(){var ge=d.a.confirm({icon:null,className:"custom-modal-divider",centered:!0,title:"\u6E29\u99A8\u63D0\u793A",content:"\u786E\u8BA4\u66F4\u6362\u9884\u89C8\u4E2D\u7684\u6240\u6709\u8BD5\u9898\u5417\uFF1F",cancelButtonProps:{disabled:!1},maskClosable:!1,keyboard:!1,okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",onOk:function(){var He=Object(x.a)(y.a.mark(function at(){return y.a.wrap(function(Dt){for(;;)switch(Dt.prev=Dt.next){case 0:return ge.update({cancelButtonProps:{disabled:!0}}),Dt.next=3,Pt();case 3:ge.update({cancelButtonProps:{disabled:!1}}),T.b.success("\u5DF2\u91CD\u65B0\u968F\u673A\u751F\u6210\u6574\u5F20\u8BD5\u9898");case 5:case"end":return Dt.stop()}},at)}));function bt(){return He.apply(this,arguments)}return bt}()})},Yr=function(ge){console.log(ge,"key"),Bt(ge-1)},Zr=function(){return l.a.createElement(l.a.Fragment,null,l.a.createElement(k.a,{color:"#55575D",overlayClassName:f.a.popover,visible:zt,getPopupContainer:function(He){return He==null?void 0:He.parentNode},content:"\u5982\u60A8\u5BF9\u6B64\u4EFD\u8BD5\u9898\u6EE1\u610F\uFF0C\u53EF\u5C06\u6B64\u4EFD\u8BD5\u9898\u4FDD\u5B58\u4E3A\u56FA\u5B9A\u8BD5\u5377"},l.a.createElement(D.a,{onMouseEnter:function(){return jt(!0)},onMouseLeave:function(){return jt(!1)},onClick:function(){Ne()}},"\u4FDD\u5B58")),l.a.createElement(D.a,{onClick:function(){document.body.scrollIntoView(),Tt()}},"\u8FD4\u56DE"),l.a.createElement(D.a,{loading:ht,onClick:function(){return Ve()},type:"primary"},"\u63D0\u4EA4"))},On=function(){var ge;return l.a.createElement(l.a.Fragment,null,l.a.createElement(D.a,{onClick:Tt},"\u8FD4\u56DE"),Ot>0&&l.a.createElement(D.a,{onClick:function(){return Yr(Ot)},type:"primary"},"\u4E0A\u4E00\u4EFD"),Ot<(Ue==null||((ge=Ue.exam)===null||ge===void 0)?void 0:ge.total_num)-1&&l.a.createElement(D.a,{onClick:function(){return Yr(Ot+2)}},"\u4E0B\u4E00\u4EFD"))},Pn=function(ge,He){if(He==="SINGLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(rt,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="MULTIPLE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Oe,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="JUDGMENT")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Me,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="COMPLETION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(Be,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="SUBJECTIVE")return l.a.createElement(l.a.Fragment,null,l.a.createElement(ot,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="COMBINATION")return l.a.createElement(l.a.Fragment,null,l.a.createElement(it,{ref:Ft,editData:ge,isEdit:!0}),l.a.createElement(P.a,null));if(He==="PROGRAM"){var bt;v.d.push("/problems/".concat(ge==null||((bt=ge.program_attr)===null||bt===void 0)?void 0:bt.identifier,"/edit?type=exercises&express_id=").concat(Ce.categoryId,"&question_id=").concat(ge==null?void 0:ge.id,"&score=").concat(ge==null?void 0:ge.score,"&callback_url=").concat(location.pathname,"&select=").concat(Ot,"&exercise=true"))}},qr=function(){var $e=Object(x.a)(y.a.mark(function ge(He,bt){var at,ut,Dt,rr,Zt,nr,Pr,or,Nr,hr;return y.a.wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:return Cr.next=2,(at=Ft.current)===null||at===void 0?void 0:at.onSave();case 2:if(ut=Cr.sent,ut){Cr.next=5;break}return Cr.abrupt("return");case 5:return Dt={question_score:bt.score,analysis:ut.analysis},(He==="SINGLE"||He==="MULTIPLE"||He==="JUDGMENT")&&(Zt=[],nr=[],Dt.question_type=He==="JUDGMENT"?2:1,Dt.question_title=ut==null?void 0:ut.name,ut==null||((rr=ut.choices)===null||rr===void 0)||rr.forEach(function(Lr,sn){Zt.push(Lr.choice_text),Lr!=null&&Lr.is_answer&&nr.push(sn+1)}),Dt.question_choices=Zt,Dt.standard_answers=nr),He==="COMPLETION"&&(Dt.is_ordered=ut.is_ordered,Dt.question_title=ut==null?void 0:ut.name,Dt.question_type=3,or=[],ut==null||((Pr=ut.standard_answers)===null||Pr===void 0)||Pr.forEach(function(Lr,sn){or.push({choice_id:Lr.position,answer_text:Lr.answer_text})}),Dt.standard_answers=or),He==="SUBJECTIVE"&&(Dt.question_title=ut==null?void 0:ut.name,Dt.question_type=3,Dt.standard_answers=ut==null?void 0:ut.answer_texts),He==="COMBINATION"&&(Dt.question_title=ut==null?void 0:ut.name,Dt.question_type=7,Dt.sub_questions=ut==null||((Nr=ut.sub_item_banks)===null||Nr===void 0)?void 0:Nr.map(function(Lr,sn){return{id:Lr.id,question_title:Lr.name,question_type:1,question_choices:Lr.choices.map(function(tn){return tn.choice_text}),standard_answers:[Lr.choices.findIndex(function(tn){return tn.is_answer})+1],analysis:Lr.analysis}}),delete Dt.analysis),Cr.next=12,Object(p.a)("/api/exercise_questions/".concat(bt.id,".json"),{method:"put",body:Dt});case 12:hr=Cr.sent,(hr==null?void 0:hr.status)===0&&(T.b.success("\u7F16\u8F91\u6210\u529F"),Yr(Ot+1)),gt(null);case 15:case"end":return Cr.stop()}},ge)}));return function(He,bt){return $e.apply(this,arguments)}}(),ci=function(){for(var ge=[],He=0;He<(Ue==null||((bt=Ue.exam)===null||bt===void 0)?void 0:bt.total_num);He++){var bt;ge.push({})}return ge},Gn=Ue==null||((ee=Ue.questionList)===null||ee===void 0)?void 0:ee.reduce(function($e,ge){return $e+ge.questions_score},0),Ur=pt&&(Ue==null||((de=Ue.exam)===null||de===void 0)?void 0:de.exercise_status)!==1;return l.a.createElement("section",{className:f.a.wrap},l.a.createElement("div",{id:"id_left_preview",className:f.a.left,onMouseEnter:function(ge){var He=document.getElementById("id_left_preview");He.style.overflowY="auto"},onMouseLeave:function(ge){var He=document.getElementById("id_left_preview");He.style.overflowY="hidden"}},l.a.createElement("div",{className:f.a.title},l.a.createElement("div",null,l.a.createElement("b",null),l.a.createElement("span",null,"\u7B54\u9898\u5361"))),l.a.createElement("div",{className:f.a.total},l.a.createElement("div",null,l.a.createElement("img",{src:I.a}),l.a.createElement("span",null,"\u9898\u6570(\u9053)"),l.a.createElement("aside",null,Ue==null?void 0:Ue.all_questions_count)),l.a.createElement("div",{className:"mr30 ml30"},l.a.createElement("img",{src:z.a}),l.a.createElement("span",null,"\u603B\u5206(\u5206)"),l.a.createElement("aside",null,Gn)),l.a.createElement("div",null,l.a.createElement("img",{src:s.a}),l.a.createElement("span",null,"\u65F6\u957F(\u5206)"),l.a.createElement("aside",null,Ue==null||((xe=Ue.exam)===null||xe===void 0)?void 0:xe.time))),Ue==null||((Re=Ue.questionList)===null||Re===void 0)?void 0:Re.map(function($e,ge){var He;return l.a.createElement("div",{className:f.a.list,key:ge},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,$e.name)),l.a.createElement("aside",null,l.a.createElement("div",null,"\u5171",l.a.createElement("span",{className:f.a.b},$e.questions_count),"\u9898 ",l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},$e.questions_score),"\u5206"),l.a.createElement("div",{className:f.a.answerSheet},$e==null||((He=$e.questions)===null||He===void 0)?void 0:He.map(function(bt,at){return l.a.createElement("div",{onClick:function(){var Dt="Anchor_".concat(bt.id),rr=document.getElementById(Dt);rr&&setTimeout(function(){return rr.scrollIntoView({block:"center",behavior:"smooth"})})},key:bt.id,className:f.a.tag},at+1)}))))})),l.a.createElement("div",{className:f.a.right},l.a.createElement("div",{className:f.a.examName,id:"examName"},l.a.createElement("div",{className:f.a.name},l.a.createElement(W.a,{title:Ue==null||((lt=Ue.exam)===null||lt===void 0)?void 0:lt.name,getPopupContainer:function(ge){return ge.parentNode}},l.a.createElement("span",{className:f.a.t},Ue==null||((st=Ue.exam)===null||st===void 0)?void 0:st.name))),pt?l.a.createElement(K.a,{showTotal:function(ge){return l.a.createElement("span",{style:{color:"#656F87",fontSize:14}},"\u5171\u8BA1",l.a.createElement("span",{className:"c-light-primary"},ge),"\u4EFD\u8BD5\u5377")},total:Ue==null||((Le=Ue.exam)===null||Le===void 0)?void 0:Le.total_num,pageSize:1,current:Ot+1,showSizeChanger:!1,onChange:Yr,showQuickJumper:!0,hideOnSinglePage:!1}):l.a.createElement(D.a,{onClick:vn,type:"primary"},"\u968F\u673A\u66F4\u6362")),l.a.createElement("div",{className:f.a.topWarp},Ue==null||((_t=Ue.questionList)===null||_t===void 0)?void 0:_t.map(function($e,ge){var He,bt;return l.a.createElement(l.a.Fragment,{key:ge},l.a.createElement("div",{className:f.a.head,style:ge===0?{border:0,marginTop:-16}:{}},l.a.createElement("div",{className:f.a.name},l.a.createElement("b",null),l.a.createElement("span",null,$e.name)),l.a.createElement("div",{className:f.a.so},"\u5171",l.a.createElement("span",{className:f.a.b},$e.questions_count," "),"\u9898 ",$e.type==="COMBINATION"&&"\uFF08\u5305\u542B".concat($e==null||((He=$e.questions)===null||He===void 0)?void 0:He.map(function(at){var ut;return at==null||((ut=at.sub_item_banks)===null||ut===void 0)?void 0:ut.length}).reduce(function(at,ut){return at+ut}),"\u5C0F\u9898\uFF09"),l.a.createElement("span",{className:f.a.l},"|"),"\u5171",l.a.createElement("span",{className:f.a.r},$e.questions_score),"\u5206"),!pt&&l.a.createElement("div",{className:f.a.btn},l.a.createElement(D.a,{onClick:function(){Dn($e)},type:"primary",ghost:!0,className:"mr20"},"\u8BBE\u7F6E\u5F97\u5206"),l.a.createElement(D.a,{onClick:function(){return Kn($e)},type:"primary",ghost:!0},"\u968F\u673A\u66F4\u6362"))),$e==null||((bt=$e.questions)===null||bt===void 0)?void 0:bt.map(function(at,ut){return Ct===at.id?l.a.createElement("div",{id:"Anchor_".concat(at.id),className:f.a.content,style:{padding:0,marginTop:10},key:at.id},l.a.createElement("div",{style:{float:"right",marginTop:-6}},l.a.createElement(D.a,{onClick:function(){return gt(null)},className:"mr20",type:"primary",ghost:!0},"\u53D6\u6D88"),l.a.createElement(D.a,{onClick:function(){return qr($e==null?void 0:$e.type,at)},type:"primary"},"\u4FDD\u5B58")),Pn(at,$e.type)):l.a.createElement("div",{id:"Anchor_".concat(at.id),className:f.a.content,key:at.id},l.a.createElement("div",{className:f.a.titleWrap},l.a.createElement(a.a,{style:{paddingRight:10},className:f.a.titleHtml,value:ut+1+"\u3001"+"".concat((at==null?void 0:at.item_type)==="combination"?"\uFF08\u9898\u5E72\uFF09":"")+at.name}),pt&&l.a.createElement(D.a,{disabled:Ur,onClick:function(){if(Ct){T.b.warn("\u5148\u4FDD\u5B58\u6216\u53D6\u6D88\u5F53\u524D\u6B63\u5728\u7F16\u8F91\u7684\u8BD5\u9898");return}gt(at.id)},type:"primary",className:"mr20",style:{marginLeft:"auto"},ghost:!0},"\u7F16\u8F91"),l.a.createElement(D.a,{disabled:Ur,onClick:function(){return Rn(at.id,$e.type,ut,$e)},type:"primary",ghost:!0},"\u6362\u4E00\u9898")),($e.type==="SINGLE"||$e.type==="JUDGMENT"||$e.type==="MULTIPLE")&&vt(at),$e.type==="COMPLETION"&&ar(at),$e.type==="SUBJECTIVE"&&gr(at),$e.type==="PROGRAM"&&lr(at),$e.type==="COMBINATION"&&vr(at,ut),l.a.createElement("div",null))}))})),l.a.createElement("div",{className:f.a.btnsElse,id:"preview_btns_else"},pt?On():Zr()),l.a.createElement("div",{className:f.a.btnsWrap,id:"preview_btns"},l.a.createElement("div",{className:f.a.btns},pt?On():Zr()))),l.a.createElement(ae,{visible:br,onRandomExchange:Object(x.a)(y.a.mark(function $e(){var ge;return y.a.wrap(function(bt){for(;;)switch(bt.prev=bt.next){case 0:return ge=Et.current,bt.next=3,Pt({single_question_id:ge.id,seleted_item_bank_ids:ge.ids},{type:ge.type,index:ge.index});case 3:Yt(!1);case 4:case"end":return bt.stop()}},$e)})),selectFromProblemSet:function(){var ge=Et.current,He="".concat(location.pathname).concat(location.search);He.includes("exercise")&&v.d.push("/paperlibrary/exchangequestion?type=exercise&qid=".concat(ge.id,"&qtype=").concat(ge.type,"&exerciseid=").concat(Ce.categoryId,"&from=").concat(He))},onCancel:function(){Yt(!1)}}))},Y=Xe.a=se},ulZh:function(qe,Xe,$){typeof window!="undefined"&&function(K,A){qe.exports=A()}(this,function(){return function(Z){var K={};function A(W){if(K[W])return K[W].exports;var M=K[W]={i:W,l:!1,exports:{}};return Z[W].call(M.exports,M,M.exports,A),M.l=!0,M.exports}return A.m=Z,A.c=K,A.d=function(W,M,P){A.o(W,M)||Object.defineProperty(W,M,{enumerable:!0,get:P})},A.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},A.t=function(W,M){if(M&1&&(W=A(W)),M&8)return W;if(M&4&&typeof W=="object"&&W&&W.__esModule)return W;var P=Object.create(null);if(A.r(P),Object.defineProperty(P,"default",{enumerable:!0,value:W}),M&2&&typeof W!="string")for(var U in W)A.d(P,U,function(k){return W[k]}.bind(null,U));return P},A.n=function(W){var M=W&&W.__esModule?function(){return W.default}:function(){return W};return A.d(M,"a",M),M},A.o=function(W,M){return Object.prototype.hasOwnProperty.call(W,M)},A.p="/dist/",A(A.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Z,K,A){"use strict";var W=Object.prototype.hasOwnProperty,M="~";function P(){}Object.create&&(P.prototype=Object.create(null),new P().__proto__||(M=!1));function U(g,b,O){this.fn=g,this.context=b,this.once=O||!1}function k(g,b,O,T,x){if(typeof O!="function")throw new TypeError("The listener must be a function");var S=new U(O,T||g,x),c=M?M+b:b;return g._events[c]?g._events[c].fn?g._events[c]=[g._events[c],S]:g._events[c].push(S):(g._events[c]=S,g._eventsCount++),g}function R(g,b){--g._eventsCount===0?g._events=new P:delete g._events[b]}function D(){this._events=new P,this._eventsCount=0}D.prototype.eventNames=function(){var b=[],O,T;if(this._eventsCount===0)return b;for(T in O=this._events)W.call(O,T)&&b.push(M?T.slice(1):T);return Object.getOwnPropertySymbols?b.concat(Object.getOwnPropertySymbols(O)):b},D.prototype.listeners=function(b){var O=M?M+b:b,T=this._events[O];if(!T)return[];if(T.fn)return[T.fn];for(var x=0,S=T.length,c=new Array(S);x<S;x++)c[x]=T[x].fn;return c},D.prototype.listenerCount=function(b){var O=M?M+b:b,T=this._events[O];return T?T.fn?1:T.length:0},D.prototype.emit=function(b,O,T,x,S,c){var o=M?M+b:b;if(!this._events[o])return!1;var d=this._events[o],u=arguments.length,w,y;if(d.fn){d.once&&this.removeListener(b,d.fn,void 0,!0);switch(u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,O),!0;case 3:return d.fn.call(d.context,O,T),!0;case 4:return d.fn.call(d.context,O,T,x),!0;case 5:return d.fn.call(d.context,O,T,x,S),!0;case 6:return d.fn.call(d.context,O,T,x,S,c),!0}for(y=1,w=new Array(u-1);y<u;y++)w[y-1]=arguments[y];d.fn.apply(d.context,w)}else{var m=d.length,l;for(y=0;y<m;y++){d[y].once&&this.removeListener(b,d[y].fn,void 0,!0);switch(u){case 1:d[y].fn.call(d[y].context);break;case 2:d[y].fn.call(d[y].context,O);break;case 3:d[y].fn.call(d[y].context,O,T);break;case 4:d[y].fn.call(d[y].context,O,T,x);break;default:if(!w)for(l=1,w=new Array(u-1);l<u;l++)w[l-1]=arguments[l];d[y].fn.apply(d[y].context,w)}}}return!0},D.prototype.on=function(b,O,T){return k(this,b,O,T,!1)},D.prototype.once=function(b,O,T){return k(this,b,O,T,!0)},D.prototype.removeListener=function(b,O,T,x){var S=M?M+b:b;if(!this._events[S])return this;if(!O)return R(this,S),this;var c=this._events[S];if(c.fn)c.fn===O&&(!x||c.once)&&(!T||c.context===T)&&R(this,S);else{for(var o=0,d=[],u=c.length;o<u;o++)(c[o].fn!==O||x&&!c[o].once||T&&c[o].context!==T)&&d.push(c[o]);d.length?this._events[S]=d.length===1?d[0]:d:R(this,S)}return this},D.prototype.removeAllListeners=function(b){var O;return b?(O=M?M+b:b,this._events[O]&&R(this,O)):(this._events=new P,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=M,D.EventEmitter=D,Z.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(Z,K,A){(function(W){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,P=/^([^\/?#]*)([^]*)$/,U=/(?:\/|^)\.(?=\/)/g,k=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(D,g,b){if(b=b||{},D=D.trim(),g=g.trim(),!g){if(!b.alwaysNormalize)return D;var O=R.parseURL(D);if(!O)throw new Error("Error trying to parse base URL.");return O.path=R.normalizePath(O.path),R.buildURLFromParts(O)}var T=R.parseURL(g);if(!T)throw new Error("Error trying to parse relative URL.");if(T.scheme)return b.alwaysNormalize?(T.path=R.normalizePath(T.path),R.buildURLFromParts(T)):g;var x=R.parseURL(D);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var S=P.exec(x.path);x.netLoc=S[1],x.path=S[2]}x.netLoc&&!x.path&&(x.path="/");var c={scheme:x.scheme,netLoc:T.netLoc,path:null,params:T.params,query:T.query,fragment:T.fragment};if(!T.netLoc&&(c.netLoc=x.netLoc,T.path[0]!=="/"))if(!T.path)c.path=x.path,T.params||(c.params=x.params,T.query||(c.query=x.query));else{var o=x.path,d=o.substring(0,o.lastIndexOf("/")+1)+T.path;c.path=R.normalizePath(d)}return c.path===null&&(c.path=b.alwaysNormalize?R.normalizePath(T.path):T.path),R.buildURLFromParts(c)},parseURL:function(D){var g=M.exec(D);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(U,"");D.length!==(D=D.replace(k,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};Z.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(Z,K,A){function W(b){var O={};function T(S){if(O[S])return O[S].exports;var c=O[S]={i:S,l:!1,exports:{}};return b[S].call(c.exports,c,c.exports,T),c.l=!0,c.exports}T.m=b,T.c=O,T.i=function(S){return S},T.d=function(S,c,o){T.o(S,c)||Object.defineProperty(S,c,{configurable:!1,enumerable:!0,get:o})},T.r=function(S){Object.defineProperty(S,"__esModule",{value:!0})},T.n=function(S){var c=S&&S.__esModule?function(){return S.default}:function(){return S};return T.d(c,"a",c),c},T.o=function(S,c){return Object.prototype.hasOwnProperty.call(S,c)},T.p="/",T.oe=function(S){throw console.error(S),S};var x=T(T.s=ENTRY_MODULE);return x.default||x}var M="[\\.|\\-|\\+|\\w|/|@]+",P="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function U(b){return(b+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function k(b){return!isNaN(1*b)}function R(b,O,T){var x={};x[T]=[];var S=O.toString(),c=S.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return x;for(var o=c[1],d=new RegExp("(\\\\n|\\W)"+U(o)+P,"g"),u;u=d.exec(S);){if(u[3]==="dll-reference")continue;x[T].push(u[3])}for(d=new RegExp("\\("+U(o)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+P,"g");u=d.exec(S);)b[u[2]]||(x[T].push(u[1]),b[u[2]]=A(u[1]).m),x[u[2]]=x[u[2]]||[],x[u[2]].push(u[4]);for(var w=Object.keys(x),y=0;y<w.length;y++)for(var m=0;m<x[w[y]].length;m++)k(x[w[y]][m])&&(x[w[y]][m]=1*x[w[y]][m]);return x}function D(b){var O=Object.keys(b);return O.reduce(function(T,x){return T||b[x].length>0},!1)}function g(b,O){for(var T={main:[O]},x={main:[]},S={main:{}};D(T);)for(var c=Object.keys(T),o=0;o<c.length;o++){var d=c[o],u=T[d],w=u.pop();if(S[d]=S[d]||{},S[d][w]||!b[d][w])continue;S[d][w]=!0,x[d]=x[d]||[],x[d].push(w);for(var y=R(b,b[d][w],d),m=Object.keys(y),l=0;l<m.length;l++)T[m[l]]=T[m[l]]||[],T[m[l]]=T[m[l]].concat(y[m[l]])}return x}Z.exports=function(b,O){O=O||{};var T={main:A.m},x=O.all?{main:Object.keys(T.main)}:g(T,b),S="";Object.keys(x).filter(function(w){return w!=="main"}).forEach(function(w){for(var y=0;x[w][y];)y++;x[w].push(y),T[w][y]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",S=S+"var "+w+" = ("+W.toString().replace("ENTRY_MODULE",JSON.stringify(y))+")({"+x[w].map(function(m){return""+JSON.stringify(m)+": "+T[w][m].toString()}).join(",")+`});
`}),S=S+"new (("+W.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+x.main.map(function(w){return""+JSON.stringify(w)+": "+T.main[w].toString()}).join(",")+"}))(self);";var c=new window.Blob([S],{type:"text/javascript"});if(O.bare)return c;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,d=o.createObjectURL(c),u=new window.Worker(d);return u.objectURL=d,u}},"./src/config.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"hlsDefaultConfig",function(){return l}),A.d(K,"mergeConfig",function(){return f}),A.d(K,"enableStreamingMode",function(){return h});var W=A("./src/controller/abr-controller.ts"),M=A("./src/controller/audio-stream-controller.ts"),P=A("./src/controller/audio-track-controller.ts"),U=A("./src/controller/subtitle-stream-controller.ts"),k=A("./src/controller/subtitle-track-controller.ts"),R=A("./src/controller/buffer-controller.ts"),D=A("./src/controller/timeline-controller.ts"),g=A("./src/controller/cap-level-controller.ts"),b=A("./src/controller/fps-controller.ts"),O=A("./src/controller/eme-controller.ts"),T=A("./src/controller/cmcd-controller.ts"),x=A("./src/utils/xhr-loader.ts"),S=A("./src/utils/fetch-loader.ts"),c=A("./src/utils/cues.ts"),o=A("./src/utils/mediakeys-helper.ts"),d=A("./src/utils/logger.ts");function u(){return u=Object.assign||function(s){for(var a=1;a<arguments.length;a++){var E=arguments[a];for(var v in E)Object.prototype.hasOwnProperty.call(E,v)&&(s[v]=E[v])}return s},u.apply(this,arguments)}function w(s,a){var E=Object.keys(s);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(s);a&&(v=v.filter(function(p){return Object.getOwnPropertyDescriptor(s,p).enumerable})),E.push.apply(E,v)}return E}function y(s){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?w(Object(E),!0).forEach(function(v){m(s,v,E[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(E)):w(Object(E)).forEach(function(v){Object.defineProperty(s,v,Object.getOwnPropertyDescriptor(E,v))})}return s}function m(s,a,E){return a in s?Object.defineProperty(s,a,{value:E,enumerable:!0,configurable:!0,writable:!0}):s[a]=E,s}var l=y(y({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:W.default,bufferController:R.default,capLevelController:g.default,fpsController:b.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},_()),{},{subtitleStreamController:U.SubtitleStreamController,subtitleTrackController:k.default,timelineController:D.TimelineController,audioStreamController:M.default,audioTrackController:P.default,emeController:O.default,cmcdController:T.default});function _(){return{cueHandler:c.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(s,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},s,a)}function h(s){var a=s.loader;if(a!==S.default&&a!==x.default)d.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),s.progressive=!1;else{var E=Object(S.fetchSupported)();E&&(s.loader=S.default,s.progressive=!0,s.enableSoftwareAES=!0,d.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/ewma-bandwidth-estimator.ts"),P=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/errors.ts"),R=A("./src/types/loader.ts"),D=A("./src/utils/logger.ts");function g(T,x){for(var S=0;S<x.length;S++){var c=x[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(T,c.key,c)}}function b(T,x,S){return x&&g(T.prototype,x),S&&g(T,S),T}var O=function(){function T(S){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=S;var c=S.config;this.bwEstimator=new M.default(c.abrEwmaSlowVoD,c.abrEwmaFastVoD,c.abrEwmaDefaultEstimate),this.registerListeners()}var x=T.prototype;return x.registerListeners=function(){var c=this.hls;c.on(P.Events.FRAG_LOADING,this.onFragLoading,this),c.on(P.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(P.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var c=this.hls;c.off(P.Events.FRAG_LOADING,this.onFragLoading,this),c.off(P.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this),c.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(P.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(c,o){var d=o.frag;if(d.type===R.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=d,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(c,o){var d=this.hls.config;o.details.live?this.bwEstimator.update(d.abrEwmaSlowLive,d.abrEwmaFastLive):this.bwEstimator.update(d.abrEwmaSlowVoD,d.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var c=this.fragCurrent,o=this.partCurrent,d=this.hls,u=d.autoLevelEnabled,w=d.config,y=d.media;if(!c||!y)return;var m=o?o.stats:c.stats,l=o?o.duration:c.duration;if(m.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||y.paused||!y.playbackRate||!y.readyState)return;var _=performance.now()-m.loading.start,f=Math.abs(y.playbackRate);if(_<=500*l/f)return;var h=d.levels,s=d.minAutoLevel,a=h[c.level],E=m.total||Math.max(m.loaded,Math.round(l*a.maxBitrate/8)),v=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/_),p=(E-m.loaded)/v,L=y.currentTime,I=(U.BufferHelper.bufferInfo(y,L,w.maxBufferHole).end-L)/f;if(I>=2*l/f||p<=I)return;var B=Number.POSITIVE_INFINITY,z;for(z=c.level-1;z>s;z--){var j=h[z].maxBitrate;if(B=l*j/(8*.8*v),B<I)break}if(B>=p)return;var F=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+c.sn+(o?" part "+o.index:"")+" of level "+c.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
Current BW estimate: `+(Object(W.isFiniteNumber)(F)?(F/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+p.toFixed(3)+` s
Estimated load time for the next fragment: `+B.toFixed(3)+` s
Time to underbuffer: `+I.toFixed(3)+" s"),d.nextLoadLevel=z,this.bwEstimator.sample(_,m.loaded),this.clearTimer(),c.loader&&(this.fragCurrent=this.partCurrent=null,c.loader.abort()),d.trigger(P.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:c,part:o,stats:m})},x.onFragLoaded=function(c,o){var d=o.frag,u=o.part;if(d.type===R.PlaylistLevelType.MAIN&&Object(W.isFiniteNumber)(d.sn)){var w=u?u.stats:d.stats,y=u?u.duration:d.duration;if(this.clearTimer(),this.lastLoadedFragLevel=d.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[d.level],l=(m.loaded?m.loaded.bytes:0)+w.loaded,_=(m.loaded?m.loaded.duration:0)+y;m.loaded={bytes:l,duration:_},m.realBitrate=Math.round(8*l/_)}if(d.bitrateTest){var f={stats:w,frag:d,part:u,id:d.type};this.onFragBuffered(P.Events.FRAG_BUFFERED,f),d.bitrateTest=!1}}},x.onFragBuffered=function(c,o){var d=o.frag,u=o.part,w=u?u.stats:d.stats;if(w.aborted)return;if(d.type!==R.PlaylistLevelType.MAIN||d.sn==="initSegment")return;var y=w.parsing.end-w.loading.start;this.bwEstimator.sample(y,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),d.bitrateTest?this.bitrateTestDelay=y/1e3:this.bitrateTestDelay=0},x.onError=function(c,o){switch(o.details){case k.ErrorDetails.FRAG_LOAD_ERROR:case k.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var c=this.fragCurrent,o=this.partCurrent,d=this.hls,u=d.maxAutoLevel,w=d.config,y=d.minAutoLevel,m=d.media,l=o?o.duration:c?c.duration:0,_=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,s=(U.BufferHelper.bufferInfo(m,_,w.maxBufferHole).end-_)/f,a=this.findBestLevel(h,y,u,s,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((s?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=l?Math.min(l,w.maxStarvationDelay):w.maxStarvationDelay,v=w.abrBandWidthFactor,p=w.abrBandWidthUpFactor;if(!s){var L=this.bitrateTestDelay;if(L){var I=l?Math.min(l,w.maxLoadingDelay):w.maxLoadingDelay;E=I-L,D.logger.trace("bitrate test took "+Math.round(1e3*L)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),v=p=1}}return a=this.findBestLevel(h,y,u,s+E,v,p),Math.max(a,0)},x.findBestLevel=function(c,o,d,u,w,y){for(var m,l=this.fragCurrent,_=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,s=h[f],a=!!(s!=null&&(m=s.details)!==null&&m!==void 0&&m.live),E=s==null?void 0:s.codecSet,v=_?_.duration:l?l.duration:0,p=d;p>=o;p--){var L=h[p];if(!L||E&&L.codecSet!==E)continue;var I=L.details,B=(_?I==null?void 0:I.partTarget:I==null?void 0:I.averagetargetduration)||v,z=void 0;p<=f?z=w*c:z=y*c;var j=h[p].maxBitrate,F=j*B/z;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(z)+"/"+j+"/"+B+"/"+u+"/"+F),z>j&&(!F||a&&!this.bitrateTestDelay||F<u))return p}return-1},b(T,[{key:"nextAutoLevel",get:function(){var c=this._nextAutoLevel,o=this.bwEstimator;if(c!==-1&&(!o||!o.canEstimate()))return c;var d=this.getNextABRAutoLevel();return c!==-1&&(d=Math.min(c,d)),d},set:function(c){this._nextAutoLevel=c}}]),T}();K.default=O},"./src/controller/audio-stream-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/events.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/controller/fragment-tracker.ts"),R=A("./src/types/level.ts"),D=A("./src/types/loader.ts"),g=A("./src/loader/fragment.ts"),b=A("./src/demux/chunk-cache.ts"),O=A("./src/demux/transmuxer-interface.ts"),T=A("./src/types/transmuxer.ts"),x=A("./src/controller/fragment-finders.ts"),S=A("./src/utils/discontinuities.ts"),c=A("./src/errors.ts"),o=A("./src/utils/logger.ts");function d(){return d=Object.assign||function(l){for(var _=1;_<arguments.length;_++){var f=arguments[_];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(l[h]=f[h])}return l},d.apply(this,arguments)}function u(l,_){l.prototype=Object.create(_.prototype),l.prototype.constructor=l,w(l,_)}function w(l,_){return w=Object.setPrototypeOf||function(h,s){return h.__proto__=s,h},w(l,_)}var y=100,m=function(l){u(_,l);function _(h,s){var a;return a=l.call(this,h,s,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=_.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var s=this.hls;s.on(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.on(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.on(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.on(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(P.Events.ERROR,this.onError,this),s.on(P.Events.BUFFER_RESET,this.onBufferReset,this),s.on(P.Events.BUFFER_CREATED,this.onBufferCreated,this),s.on(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.on(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var s=this.hls;s.off(P.Events.MEDIA_ATTACHED,this.onMediaAttached,this),s.off(P.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(P.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(P.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(P.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),s.off(P.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),s.off(P.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(P.Events.ERROR,this.onError,this),s.off(P.Events.BUFFER_RESET,this.onBufferReset,this),s.off(P.Events.BUFFER_CREATED,this.onBufferCreated,this),s.off(P.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),s.off(P.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(P.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(s,a){var E=a.frag,v=a.id,p=a.initPTS;if(v==="main"){var L=E.cc;this.initPTS[E.cc]=p,this.log("InitPTS for cc: "+L+" found from main: "+p),this.videoTrackCC=L,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(s){if(!this.levels){this.startPosition=s,this.state=M.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(y),this.fragLoadError=0,a>0&&s===-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=s,this.tick()},f.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var s,a=this.levels,E=this.trackId,v=a==null||((s=a[E])===null||s===void 0)?void 0:s.details;if(v){if(this.waitForCdnTuneIn(v))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var p,L=performance.now(),I=this.retryDate;(!I||L>=I||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var z=B.frag,j=B.part,F=B.cache,X=B.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var te=F.flush(),ie={frag:z,part:j,payload:te,networkDetails:null};this._handleFragmentLoadProgress(ie),X&&l.prototype._handleFragmentLoadComplete.call(this,ie)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var le=this.getLoadPosition(),_e=U.BufferHelper.bufferInfo(this.mediaBuffer,le,this.config.maxBufferHole),me=Object(x.fragmentWithinToleranceTest)(_e.end,this.config.maxFragLookUpTolerance,z);me<0&&(o.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+_e.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var s=this.waitingData;s&&(this.fragmentTracker.removeFragment(s.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},f.onTickEnd=function(){var s=this.media;if(!s||!s.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:s,E=a.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=s.currentTime},f.doTickIdle=function(){var s,a,E=this.hls,v=this.levels,p=this.media,L=this.trackId,I=E.config;if(!v||!v[L])return;if(!p&&(this.startFragRequested||!I.startFragPrefetch))return;var B=v[L],z=B.details;if(!z||z.live&&this.levelLastLoaded!==L||this.waitForCdnTuneIn(z)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,g.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(),te=this.audioSwitch;if(F>=X&&!te)return;if(!te&&this._streamEnded(j,z)){E.trigger(P.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ie=z.fragments,le=ie[0].start,_e=j.end;if(te){var me=this.getLoadPosition();_e=me,z.PTSKnown&&me<le&&((j.end>le||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=le+.05))}var he=this.getNextFragment(_e,z);if(!he){this.bufferFlushed=!0;return}((s=he.decryptdata)===null||s===void 0?void 0:s.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,z):this.loadFragment(he,z,_e)},f.getMaxBufferLength=function(){var s=l.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?s:Math.max(s,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,l.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(s,a){var E=a.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(v){return new R.Level(v)})},f.onAudioTrackSwitching=function(s,a){var E=!!a.url;this.trackId=a.id;var v=this.fragCurrent;v!=null&&v.loader&&v.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(y):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(s,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(s,a){var E,v=this.levels,p=a.details,L=a.id;if(!v){this.warn("Audio tracks were reset while loading level "+L);return}this.log("Track "+L+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var I=v[L],B=0;if(p.live||(E=I.details)!==null&&E!==void 0&&E.live){var z=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!z)return;!I.details&&p.hasProgramDateTime&&z.hasProgramDateTime?(Object(S.alignMediaPlaylistByPDT)(p,z),B=p.fragments[0].start):B=this.alignPlaylists(p,I.details)}I.details=p,this.levelLastLoaded=L,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(I.details,B),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=M.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(s){var a,E=s.frag,v=s.part,p=s.payload,L=this.config,I=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var z=B[I];console.assert(z,"Audio track is defined on fragment load progress");var j=z.details;console.assert(j,"Audio track details are defined on fragment load progress");var F=L.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new O.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var te=this.initPTS[E.cc],ie=(a=E.initSegment)===null||a===void 0?void 0:a.data;if(te!==void 0){var le=!1,_e=v?v.index:-1,me=_e!==-1,he=new T.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,p.byteLength,_e,me);X.push(p,ie,F,"",E,v,j.totalduration,le,he,te)}else{o.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+I);var fe=this.waitingData=this.waitingData||{frag:E,part:v,cache:new b.default,complete:!1},ce=fe.cache;ce.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(s){if(this.waitingData){this.waitingData.complete=!0;return}l.prototype._handleFragmentLoadComplete.call(this,s)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(s,a){var E=a.tracks.audio;E&&(this.mediaBuffer=E.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(s,a){var E=a.frag,v=a.part;if(E.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(v?" p: "+v.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,v)},f.onError=function(s,a){switch(a.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.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 c.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var E=!0,v=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);v&&v.len>.5&&(E=!this.reduceMaxBufferLength(v.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(s,a){var E=a.type;E===g.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(s){var a,E="audio",v=this.hls,p=s.remuxResult,L=s.chunkMeta,I=this.getCurrentContext(L);if(!I){this.warn("The loading context changed while buffering fragment "+L.sn+" of level "+L.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(L.level);return}var B=I.frag,z=I.part,j=p.audio,F=p.text,X=p.id3,te=p.initSegment;if(this.fragContextChanged(B))return;if(this.state=M.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),te!=null&&te.tracks&&(this._bufferInitSegment(te.tracks,B,L),v.trigger(P.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:E,tracks:te.tracks})),j){var ie=j.startPTS,le=j.endPTS,_e=j.startDTS,me=j.endDTS;z&&(z.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:ie,endPTS:le,startDTS:_e,endDTS:me}),B.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,ie,le,_e,me),this.bufferFragmentData(j,B,z,L)}if(X!=null&&(a=X.samples)!==null&&a!==void 0&&a.length){var he=d({frag:B,id:E},X);v.trigger(P.Events.FRAG_PARSING_METADATA,he)}if(F){var fe=d({frag:B,id:E},F);v.trigger(P.Events.FRAG_PARSING_USERDATA,fe)}},f._bufferInitSegment=function(s,a,E){if(this.state!==M.State.PARSING)return;s.video&&delete s.video;var v=s.audio;if(!v)return;v.levelCodec=v.codec,v.id="audio",this.log("Init audio buffer, container:"+v.container+", codecs[parsed]=["+v.codec+"]"),this.hls.trigger(P.Events.BUFFER_CODECS,s);var p=v.initSegment;if(p!=null&&p.byteLength){var L={type:"audio",frag:a,part:null,chunkMeta:E,parent:a.type,data:p};this.hls.trigger(P.Events.BUFFER_APPENDING,L)}this.tick()},f.loadFragment=function(s,a,E){var v=this.fragmentTracker.getState(s);this.fragCurrent=s,(this.audioSwitch||v===k.FragmentState.NOT_LOADED||v===k.FragmentState.PARTIAL)&&(s.sn==="initSegment"?this._loadInitSegment(s):a.live&&!Object(W.isFiniteNumber)(this.initPTS[s.cc])?(this.log("Waiting for video PTS in continuity counter "+s.cc+" of live stream before loading audio fragment "+s.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,l.prototype.loadFragment.call(this,s,a,E)))},f.completeAudioSwitch=function(){var s=this.hls,a=this.media,E=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),l.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,s.trigger(P.Events.AUDIO_TRACK_SWITCHED,{id:E})},_}(M.default);K.default=m},"./src/controller/audio-track-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/controller/base-playlist-controller.ts"),U=A("./src/types/loader.ts");function k(O,T){for(var x=0;x<T.length;x++){var S=T[x];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(O,S.key,S)}}function R(O,T,x){return T&&k(O.prototype,T),x&&k(O,x),O}function D(O,T){O.prototype=Object.create(T.prototype),O.prototype.constructor=O,g(O,T)}function g(O,T){return g=Object.setPrototypeOf||function(S,c){return S.__proto__=c,S},g(O,T)}var b=function(O){D(T,O);function T(S){var c;return c=O.call(this,S,"[audio-track-controller]")||this,c.tracks=[],c.groupId=null,c.tracksInGroup=[],c.trackId=-1,c.trackName="",c.selectDefaultTrack=!0,c.registerListeners(),c}var x=T.prototype;return x.registerListeners=function(){var c=this.hls;c.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.on(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.on(W.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var c=this.hls;c.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),c.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),c.off(W.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),c.off(W.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(c,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(c,o){var d=o.id,u=o.details,w=this.tracksInGroup[d];if(!w){this.warn("Invalid audio track id "+d);return}var y=w.details;w.details=o.details,this.log("audioTrack "+d+" loaded ["+u.startSN+"-"+u.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,o,y))},x.onLevelLoading=function(c,o){this.switchLevel(o.level)},x.onLevelSwitching=function(c,o){this.switchLevel(o.level)},x.switchLevel=function(c){var o=this.hls.levels[c];if(!(o!=null&&o.audioGroupIds))return;var d=o.audioGroupIds[o.urlId];if(this.groupId!==d){this.groupId=d;var u=this.tracks.filter(function(y){return!d||y.groupId===d});this.selectDefaultTrack&&!u.some(function(y){return y.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var w={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(W.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},x.onError=function(c,o){if(O.prototype.onError.call(this,c,o),o.fatal||!o.context)return;o.context.type===U.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.setAudioTrack=function(c){var o=this.tracksInGroup;if(c<0||c>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var d=o[this.trackId];this.log("Now switching to audio-track index "+c);var u=o[c],w=u.id,y=u.groupId,m=y===void 0?"":y,l=u.name,_=u.type,f=u.url;if(this.trackId=c,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(W.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:m,name:l,type:_,url:f}),u.details&&!u.details.live)return;var h=this.switchParams(u.url,d==null?void 0:d.details);this.loadPlaylist(h)},x.selectInitialTrack=function(){var c=this.tracksInGroup;console.assert(c.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,d=this.findTrackId(o)||this.findTrackId();d!==-1?this.setAudioTrack(d):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(c){for(var o=this.tracksInGroup,d=0;d<o.length;d++){var u=o[d];if((!this.selectDefaultTrack||u.default)&&(!c||c===u.name))return u.id}return-1},x.loadPlaylist=function(c){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var d=o.id,u=o.groupId,w=o.url;if(c)try{w=c.addDirectives(w)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("loading audio-track playlist for id: "+d),this.clearTimer(),this.hls.trigger(W.Events.AUDIO_TRACK_LOADING,{url:w,id:d,groupId:u,deliveryDirectives:c||null})}},R(T,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(c){this.selectDefaultTrack=!1,this.setAudioTrack(c)}}]),T}(P.default);K.default=b},"./src/controller/base-playlist-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var W=A("./src/polyfills/number.ts"),M=A("./src/types/level.ts"),P=A("./src/controller/level-helper.ts"),U=A("./src/utils/logger.ts"),k=A("./src/errors.ts"),R=function(){function D(b,O){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=U.logger.log.bind(U.logger,O+":"),this.warn=U.logger.warn.bind(U.logger,O+":"),this.hls=b}var g=D.prototype;return g.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},g.onError=function(O,T){T.fatal&&T.type===k.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},g.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},g.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},g.stopLoad=function(){this.canLoad=!1,this.clearTimer()},g.switchParams=function(O,T){var x=T==null?void 0:T.renditionReports;if(x)for(var S=0;S<x.length;S++){var c=x[S],o=""+c.URI;if(o===O.substr(-o.length)){var d=parseInt(c["LAST-MSN"]),u=parseInt(c["LAST-PART"]);if(T&&this.hls.config.lowLatencyMode){var w=Math.min(T.age-T.partTarget,T.targetduration);u!==void 0&&w>T.partTarget&&(u+=1)}if(Object(W.isFiniteNumber)(d))return new M.HlsUrlParameters(d,Object(W.isFiniteNumber)(u)?u:void 0,M.HlsSkip.No)}}},g.loadPlaylist=function(O){},g.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},g.playlistLoaded=function(O,T,x){var S=this,c=T.details,o=T.stats,d=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(c.advancedDateTime=Date.now()-d,c.live||x!=null&&x.live){if(c.reloaded(x),x&&this.log("live playlist "+O+" "+(c.advanced?"REFRESHED "+c.lastPartSn+"-"+c.lastPartIndex:"MISSED")),x&&c.fragments.length>0&&Object(P.mergeDetails)(x,c),!this.canLoad||!c.live)return;var u,w=void 0,y=void 0;if(c.canBlockReload&&c.endSN&&c.advanced){var m=this.hls.config.lowLatencyMode,l=c.lastPartSn,_=c.endSN,f=c.lastPartIndex,h=f!==-1,s=l===_,a=m?0:f;h?(w=s?_+1:l,y=s?a:f+1):w=_+1;var E=c.age,v=E+c.ageHeader,p=Math.min(v-c.partTarget,c.targetduration*1.5);if(p>0){if(x&&p>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+p+" with playlist age: "+c.age),p=0;else{var L=Math.floor(p/c.targetduration);if(w+=L,y!==void 0){var I=Math.round(p%c.targetduration/c.partTarget);y+=I}this.log("CDN Tune-in age: "+c.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+p+" skip sn "+L+" to part "+y)}c.tuneInGoal=p}if(u=this.getDeliveryDirectives(c,T.deliveryDirectives,w,y),m||!s){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(c,T.deliveryDirectives,w,y);var B=Object(P.computeReloadInterval)(c,o);w!==void 0&&c.canBlockReload&&(B-=c.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return S.loadPlaylist(u)},B)}else this.clearTimer()},g.getDeliveryDirectives=function(O,T,x,S){var c=Object(M.getSkipValue)(O,x);return T!=null&&T.skip&&O.deltaUpdateFailed&&(x=T.msn,S=T.part,c=M.HlsSkip.No),new M.HlsUrlParameters(x,S,c)},g.retryLoadingOrFail=function(O){var T=this,x=this.hls.config,S=this.retryCount<x.levelLoadingMaxRetry;if(S){var c;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(c=O.context)!==null&&c!==void 0&&c.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return T.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return S},D}()},"./src/controller/base-stream-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"State",function(){return _}),A.d(K,"default",function(){return f});var W=A("./src/polyfills/number.ts"),M=A("./src/task-loop.ts"),P=A("./src/controller/fragment-tracker.ts"),U=A("./src/utils/buffer-helper.ts"),k=A("./src/utils/logger.ts"),R=A("./src/events.ts"),D=A("./src/errors.ts"),g=A("./src/types/transmuxer.ts"),b=A("./src/utils/mp4-tools.ts"),O=A("./src/utils/discontinuities.ts"),T=A("./src/controller/fragment-finders.ts"),x=A("./src/controller/level-helper.ts"),S=A("./src/loader/fragment-loader.ts"),c=A("./src/crypt/decrypter.ts"),o=A("./src/utils/time-ranges.ts"),d=A("./src/types/loader.ts");function u(h,s){for(var a=0;a<s.length;a++){var E=s[a];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(h,E.key,E)}}function w(h,s,a){return s&&u(h.prototype,s),a&&u(h,a),h}function y(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function m(h,s){h.prototype=Object.create(s.prototype),h.prototype.constructor=h,l(h,s)}function l(h,s){return l=Object.setPrototypeOf||function(E,v){return E.__proto__=v,E},l(h,s)}var _={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(h){m(s,h);function s(E,v,p){var L;return L=h.call(this)||this,L.hls=void 0,L.fragPrevious=null,L.fragCurrent=null,L.fragmentTracker=void 0,L.transmuxer=null,L._state=_.STOPPED,L.media=void 0,L.mediaBuffer=void 0,L.config=void 0,L.bitrateTest=!1,L.lastCurrentTime=0,L.nextLoadPosition=0,L.startPosition=0,L.loadedmetadata=!1,L.fragLoadError=0,L.retryDate=0,L.levels=null,L.fragmentLoader=void 0,L.levelLastLoaded=null,L.startFragRequested=!1,L.decrypter=void 0,L.initPTS=[],L.onvseeking=null,L.onvended=null,L.logPrefix="",L.log=void 0,L.warn=void 0,L.logPrefix=p,L.log=k.logger.log.bind(k.logger,p+":"),L.warn=k.logger.warn.bind(k.logger,p+":"),L.hls=E,L.fragmentLoader=new S.default(E.config),L.fragmentTracker=v,L.config=E.config,L.decrypter=new c.default(E,E.config),E.on(R.Events.KEY_LOADED,L.onKeyLoaded,y(L)),L}var a=s.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(v){},a.stopLoad=function(){this.fragmentLoader.abort();var v=this.fragCurrent;v&&this.fragmentTracker.removeFragment(v),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},a._streamEnded=function(v,p){var L=this.fragCurrent,I=this.fragmentTracker;if(!p.live&&L&&L.sn===p.endSN&&!v.nextStart){var B=I.getState(L);return B===P.FragmentState.PARTIAL||B===P.FragmentState.OK}return!1},a.onMediaAttached=function(v,p){var L=this.media=this.mediaBuffer=p.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),L.addEventListener("seeking",this.onvseeking),L.addEventListener("ended",this.onvended);var I=this.config;this.levels&&I.autoStartLoad&&this.state===_.STOPPED&&this.startLoad(I.startPosition)},a.onMediaDetaching=function(){var v=this.media;v!=null&&v.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),v&&(v.removeEventListener("seeking",this.onvseeking),v.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 v=this.config,p=this.fragCurrent,L=this.media,I=this.mediaBuffer,B=this.state,z=L?L.currentTime:0,j=U.BufferHelper.bufferInfo(I||L,z,v.maxBufferHole);if(this.log("media seeking to "+(Object(W.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+B),B===_.ENDED)this.resetLoadingState();else if(p&&!j.len){var F=v.maxFragLookUpTolerance,X=p.start-F,te=p.start+p.duration+F,ie=z>te;(z<X||ie)&&(ie&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.loader.abort()),this.resetLoadingState())}L&&(this.lastCurrentTime=z),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(v,p){if(this.state!==_.KEY_LOADING||p.frag!==this.fragCurrent||!this.levels)return;this.state=_.IDLE;var L=this.levels[p.frag.level].details;L&&this.loadFragment(p.frag,L,p.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=_.STOPPED,this.hls.off(R.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,h.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(v,p){this.log("Loading key for "+v.sn+" of ["+p.startSN+"-"+p.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level),this.state=_.KEY_LOADING,this.fragCurrent=v,this.hls.trigger(R.Events.KEY_LOADING,{frag:v})},a.loadFragment=function(v,p,L){this._loadFragForPlayback(v,p,L)},a._loadFragForPlayback=function(v,p,L){var I=this,B=function(j){if(I.fragContextChanged(v)){I.warn("Fragment "+v.sn+(j.part?" p: "+j.part.index:"")+" of level "+v.level+" was dropped during download."),I.fragmentTracker.removeFragment(v);return}v.stats.chunkCount++,I._handleFragmentLoadProgress(j)};this._doFragLoad(v,p,L,B).then(function(z){if(!z)return;I.fragLoadError=0;var j=I.state;if(I.fragContextChanged(v)){(j===_.FRAG_LOADING||j===_.BACKTRACKING||!I.fragCurrent&&j===_.PARSING)&&(I.fragmentTracker.removeFragment(v),I.state=_.IDLE);return}if("payload"in z&&(I.log("Loaded fragment "+v.sn+" of level "+v.level),I.hls.trigger(R.Events.FRAG_LOADED,z),I.state===_.BACKTRACKING)){I.fragmentTracker.backtrack(v,z),I.resetFragmentLoading(v);return}I._handleFragmentLoadComplete(z)}).catch(function(z){I.warn(z),I.resetFragmentLoading(v)})},a.flushMainBuffer=function(v,p,L){if(L===void 0&&(L=null),!(v-p))return;var I={startOffset:v,endOffset:p,type:L};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,I)},a._loadInitSegment=function(v){var p=this;this._doFragLoad(v).then(function(L){if(!L||p.fragContextChanged(v)||!p.levels)throw new Error("init load aborted");return L}).then(function(L){var I=p.hls,B=L.payload,z=v.decryptdata;if(B&&B.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var j=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(B),z.key.buffer,z.iv.buffer).then(function(F){var X=self.performance.now();return I.trigger(R.Events.FRAG_DECRYPTED,{frag:v,payload:F,stats:{tstart:j,tdecrypt:X}}),L.payload=F,L})}return L}).then(function(L){var I=p.fragCurrent,B=p.hls,z=p.levels;if(!z)throw new Error("init load aborted, missing levels");var j=z[v.level].details;console.assert(j,"Level details are defined when init segment is loaded");var F=v.stats;p.state=_.IDLE,p.fragLoadError=0,v.data=new Uint8Array(L.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),L.frag===I&&B.trigger(R.Events.FRAG_BUFFERED,{stats:F,frag:I,part:null,id:v.type}),p.tick()}).catch(function(L){p.warn(L),p.resetFragmentLoading(v)})},a.fragContextChanged=function(v){var p=this.fragCurrent;return!v||!p||v.level!==p.level||v.sn!==p.sn||v.urlId!==p.urlId},a.fragBufferedComplete=function(v,p){var L=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+v.type+" sn: "+v.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+v.level+" "+o.default.toString(U.BufferHelper.getBuffered(L))),this.state=_.IDLE,this.tick()},a._handleFragmentLoadComplete=function(v){var p=this.transmuxer;if(!p)return;var L=v.frag,I=v.part,B=v.partsLoaded,z=!B||B.length===0||B.some(function(F){return!F}),j=new g.ChunkMetadata(L.level,L.sn,L.stats.chunkCount+1,0,I?I.index:-1,!z);p.flush(j)},a._handleFragmentLoadProgress=function(v){},a._doFragLoad=function(v,p,L,I){var B=this;if(L===void 0&&(L=null),!this.levels)throw new Error("frag load aborted, missing levels");if(L=Math.max(v.start,L||0),this.config.lowLatencyMode&&p){var z=p.partList;if(z&&I){L>v.end&&p.fragmentHint&&(v=p.fragmentHint);var j=this.getNextPart(z,v,L);if(j>-1){var F=z[j];return this.log("Loading part sn: "+v.sn+" p: "+F.index+" cc: "+v.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+j+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(L.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=_.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:v,part:z[j],targetBufferTime:L}),this.doFragPartsLoad(v,z,j,I).catch(function(X){return B.handleFragLoadError(X)})}else if(!v.url||this.loadedEndOfParts(z,L))return Promise.resolve(null)}}return this.log("Loading fragment "+v.sn+" cc: "+v.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+v.level+", target: "+parseFloat(L.toFixed(3))),Object(W.isFiniteNumber)(v.sn)&&!this.bitrateTest&&(this.nextLoadPosition=v.start+v.duration),this.state=_.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:v,targetBufferTime:L}),this.fragmentLoader.load(v,I).catch(function(X){return B.handleFragLoadError(X)})},a.doFragPartsLoad=function(v,p,L,I){var B=this;return new Promise(function(z,j){var F=[],X=function te(ie){var le=p[ie];B.fragmentLoader.loadPart(v,le,I).then(function(_e){F[le.index]=_e;var me=_e.part;B.hls.trigger(R.Events.FRAG_LOADED,_e);var he=p[ie+1];if(he&&he.fragment===v)te(ie+1);else return z({frag:v,part:me,partsLoaded:F})}).catch(j)};X(L)})},a.handleFragLoadError=function(v){var p=v.data;return p&&p.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(R.Events.ERROR,p),null},a._handleTransmuxerFlush=function(v){var p=this.getCurrentContext(v);if(!p||this.state!==_.PARSING){this.fragCurrent||(this.state=_.IDLE);return}var L=p.frag,I=p.part,B=p.level,z=self.performance.now();L.stats.parsing.end=z,I&&(I.stats.parsing.end=z),this.updateLevelTiming(L,I,B,v.partial)},a.getCurrentContext=function(v){var p=this.levels,L=v.level,I=v.sn,B=v.part;if(!p||!p[L])return this.warn("Levels object was unset while buffering fragment "+I+" of level "+L+". The current chunk will not be buffered."),null;var z=p[L],j=B>-1?Object(x.getPartWith)(z,I,B):null,F=j?j.fragment:Object(x.getFragmentWithSN)(z,I,this.fragCurrent);return F?{frag:F,part:j,level:z}:null},a.bufferFragmentData=function(v,p,L,I){if(!v||this.state!==_.PARSING)return;var B=v.data1,z=v.data2,j=B;if(B&&z&&(j=Object(b.appendUint8Array)(B,z)),!j||!j.length)return;var F={type:v.type,frag:p,part:L,chunkMeta:I,parent:p.type,data:j};this.hls.trigger(R.Events.BUFFER_APPENDING,F),v.dropped&&v.independent&&!L&&this.flushBufferGap(p)},a.flushBufferGap=function(v){var p=this.media;if(!p)return;if(!U.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,v.start);return}var L=p.currentTime,I=U.BufferHelper.bufferInfo(p,L,0),B=v.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),j=Math.max(Math.min(v.start-z,I.end-z),L+z);v.start-j>z&&this.flushMainBuffer(j,v.start)},a.getFwdBufferInfo=function(v,p){var L=this.config,I=this.getLoadPosition();if(!Object(W.isFiniteNumber)(I))return null;var B=U.BufferHelper.bufferInfo(v,I,L.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(I,p);if(z&&B.nextStart<z.end)return U.BufferHelper.bufferInfo(v,I,Math.max(B.nextStart,L.maxBufferHole))}return B},a.getMaxBufferLength=function(v){var p=this.config,L;return v?L=Math.max(8*p.maxBufferSize/v,p.maxBufferLength):L=p.maxBufferLength,Math.min(L,p.maxMaxBufferLength)},a.reduceMaxBufferLength=function(v){var p=this.config,L=v||p.maxBufferLength;return p.maxMaxBufferLength>=L?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(v,p){var L,I,B=p.fragments,z=B.length;if(!z)return null;var j=this.config,F=B[0].start,X;if(p.live){var te=j.initialLiveManifestSize;if(z<te)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+te+")"),null;!p.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(p,B),this.startPosition=X?this.hls.liveSyncPosition||X.start:v)}else v<=F&&(X=B[0]);if(!X){var ie=j.lowLatencyMode?p.partEnd:p.fragmentEnd;X=this.getFragmentAtPosition(v,ie,p)}return(L=X)!==null&&L!==void 0&&L.initSegment&&!((I=X)!==null&&I!==void 0&&I.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},a.getNextPart=function(v,p,L){for(var I=-1,B=!1,z=!0,j=0,F=v.length;j<F;j++){var X=v[j];if(z=z&&!X.independent,I>-1&&L<X.start)break;var te=X.loaded;!te&&(B||X.independent||z)&&X.fragment===p&&(I=j),B=te}return I},a.loadedEndOfParts=function(v,p){var L=v[v.length-1];return L&&p>L.start&&L.loaded},a.getInitialLiveFragment=function(v,p){var L=this.fragPrevious,I=null;if(L){if(v.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+L.programDateTime),I=Object(T.findFragmentByPDT)(p,L.endProgramDateTime,this.config.maxFragLookUpTolerance)),!I){var B=L.sn+1;if(B>=v.startSN&&B<=v.endSN){var z=p[B-v.startSN];L.cc===z.cc&&(I=z,this.log("Live playlist, switching playlist, load frag with next SN: "+I.sn))}I||(I=Object(T.findFragWithCC)(p,L.cc),I&&this.log("Live playlist, switching playlist, load frag with same CC: "+I.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(I=this.getFragmentAtPosition(j,this.bitrateTest?v.fragmentEnd:v.edge,v))}return I},a.getFragmentAtPosition=function(v,p,L){var I=this.config,B=this.fragPrevious,z=L.fragments,j=L.endSN,F=L.fragmentHint,X=I.maxFragLookUpTolerance,te=!!(I.lowLatencyMode&&L.partList&&F);te&&F&&!this.bitrateTest&&(z=z.concat(F),j=F.sn);var ie;if(v<p){var le=v>p-X?0:X;ie=Object(T.findFragmentByPTS)(B,z,v,le)}else ie=z[z.length-1];if(ie){var _e=ie.sn-L.startSN,me=B&&ie.level===B.level,he=z[_e+1],fe=this.fragmentTracker.getState(ie);if(fe===P.FragmentState.BACKTRACKED){ie=null;for(var ce=_e;z[ce]&&this.fragmentTracker.getState(z[ce])===P.FragmentState.BACKTRACKED;)B?ie=z[ce--]:ie=z[--ce];ie||(ie=he)}else B&&ie.sn===B.sn&&!te&&(me&&(ie.sn<j&&this.fragmentTracker.getState(he)!==P.FragmentState.OK?(this.log("SN "+ie.sn+" just loaded, load next one: "+he.sn),ie=he):ie=null))}return ie},a.synchronizeToLiveEdge=function(v){var p=this.config,L=this.media;if(!L)return;var I=this.hls.liveSyncPosition,B=L.currentTime,z=v.fragments[0].start,j=v.edge,F=B>=z-p.maxFragLookUpTolerance&&B<=j;if(I!==null&&L.duration>I&&(B<I||!F)){var X=p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:p.liveMaxLatencyDurationCount*v.targetduration;(!F&&L.readyState<4||B<j-X)&&(this.loadedmetadata||(this.nextLoadPosition=I),L.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+I.toFixed(3)),L.currentTime=I))}},a.alignPlaylists=function(v,p){var L=this.levels,I=this.levelLastLoaded,B=this.fragPrevious,z=I!==null?L[I]:null,j=v.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var F=v.fragments[0].start,X=!p,te=v.alignedSliding&&Object(W.isFiniteNumber)(F);if(X||!te&&!F){Object(O.alignStream)(B,z,v);var ie=v.fragments[0].start;return this.log("Live playlist sliding: "+ie.toFixed(2)+" start-sn: "+(p?p.startSN:"na")+"->"+v.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+j),ie}return F},a.waitForCdnTuneIn=function(v){var p=3;return v.live&&v.canBlockReload&&v.tuneInGoal>Math.max(v.partHoldBack,v.partTarget*p)},a.setStartPosition=function(v,p){var L=this.startPosition;if(L<p&&(L=-1),L===-1||this.lastCurrentTime===-1){var I=v.startTimeOffset;Object(W.isFiniteNumber)(I)?(L=p+I,I<0&&(L+=v.totalduration),L=Math.min(Math.max(p,L),p+v.totalduration),this.log("Start time offset "+I+" found in playlist, adjust startPosition to "+L),this.startPosition=L):v.live?L=this.hls.liveSyncPosition||p:this.startPosition=L=0,this.lastCurrentTime=L}this.nextLoadPosition=L},a.getLoadPosition=function(){var v=this.media,p=0;return this.loadedmetadata&&v?p=v.currentTime:this.nextLoadPosition&&(p=this.nextLoadPosition),p},a.handleFragLoadAborted=function(v,p){this.transmuxer&&v.sn!=="initSegment"&&v.stats.aborted&&(this.warn("Fragment "+v.sn+(p?" part"+p.index:"")+" of level "+v.level+" was aborted"),this.resetFragmentLoading(v))},a.resetFragmentLoading=function(v){(!this.fragCurrent||!this.fragContextChanged(v))&&(this.state=_.IDLE)},a.onFragmentOrKeyLoadError=function(v,p){if(p.fatal)return;var L=p.frag;if(!L||L.type!==v)return;var I=this.fragCurrent;console.assert(I&&L.sn===I.sn&&L.level===I.level&&L.urlId===I.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(L.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+L.sn+" of "+v+" "+L.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else p.levelRetry?(v===d.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(k.logger.error(p.details+" reaches max retry, redispatch as fatal ..."),p.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)},a.afterBufferFlushed=function(v,p,L){if(!v)return;var I=U.BufferHelper.getBuffered(v);this.fragmentTracker.detectEvictedFragments(p,I,L),this.state===_.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},a.resetLiveStartWhenNotLoaded=function(v){if(!this.loadedmetadata){this.startFragRequested=!1;var p=this.levels?this.levels[v].details:null;if(p!=null&&p.live)return this.startPosition=-1,this.setStartPosition(p,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(v,p,L,I){var B=this,z=L.details;console.assert(!!z,"level.details must be defined");var j=Object.keys(v.elementaryStreams).reduce(function(F,X){var te=v.elementaryStreams[X];if(te){var ie=te.endPTS-te.startPTS;if(ie<=0)return B.warn("Could not parse fragment "+v.sn+" "+X+" duration reliably ("+ie+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),F||!1;var le=I?0:Object(x.updateFragPTSDTS)(z,v,te.startPTS,te.endPTS,te.startDTS,te.endDTS);return B.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:z,level:L,drift:le,type:X,frag:v,start:te.startPTS,end:te.endPTS}),!0}return F},!1);j?(this.state=_.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:v,part:p})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(s,[{key:"state",get:function(){return this._state},set:function(v){var p=this._state;p!==v&&(this._state=v,this.log(p+"->"+v))}}]),s}(M.default)},"./src/controller/buffer-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return T});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),U=A("./src/errors.ts"),k=A("./src/utils/buffer-helper.ts"),R=A("./src/utils/mediasource-helper.ts"),D=A("./src/loader/fragment.ts"),g=A("./src/controller/buffer-operation-queue.ts"),b=Object(R.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,T=function(){function x(c){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var d=o.hls,u=o.media,w=o.mediaSource;P.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),d.trigger(M.Events.MEDIA_ATTACHED,{media:u})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.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=c,this._initSourceBuffer(),this.registerListeners()}var S=x.prototype;return S.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},S.destroy=function(){this.unregisterListeners(),this.details=null},S.registerListeners=function(){var o=this.hls;o.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(M.Events.BUFFER_RESET,this.onBufferReset,this),o.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(M.Events.BUFFER_EOS,this.onBufferEos,this),o.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(M.Events.FRAG_PARSED,this.onFragParsed,this),o.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},S.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(M.Events.BUFFER_RESET,this.onBufferReset,this),o.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(M.Events.BUFFER_EOS,this.onBufferEos,this),o.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(M.Events.FRAG_PARSED,this.onFragParsed,this),o.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},S._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new g.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},S.onManifestParsed=function(o,d){var u=2;(d.audio&&!d.video||!d.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,P.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},S.onMediaAttaching=function(o,d){var u=this.media=d.media;if(u&&b){var w=this.mediaSource=new b;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(w),this._objectUrl=u.src}},S.onMediaDetaching=function(){var o=this.media,d=this.mediaSource,u=this._objectUrl;if(d){if(P.logger.log("[buffer-controller]: media source detaching"),d.readyState==="open")try{d.endOfStream()}catch(w){P.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),d.removeEventListener("sourceopen",this._onMediaSourceOpen),d.removeEventListener("sourceended",this._onMediaSourceEnded),d.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.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)},S.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(d){var u=o.sourceBuffer[d];try{u&&(o.removeBufferListeners(d),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[d]=void 0)}catch(w){P.logger.warn("[buffer-controller]: Failed to reset the "+d+" buffer",w)}}),this._initSourceBuffer()},S.onBufferCodecs=function(o,d){var u=this,w=this.getSourceBufferTypes().length;if(Object.keys(d).forEach(function(y){if(w){var m=u.tracks[y];if(m&&typeof m.buffer.changeType=="function"){var l=d[y],_=l.codec,f=l.levelCodec,h=l.container,s=(m.levelCodec||m.codec).replace(O,"$1"),a=(f||_).replace(O,"$1");if(s!==a){var E=h+";codecs="+(f||_);u.appendChangeType(y,E)}}}else u.pendingTracks[y]=d[y]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},S.appendChangeType=function(o,d){var u=this,w=this.operationQueue,y={execute:function(){var l=u.sourceBuffer[o];l&&(P.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+d),l.changeType(d)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(l){P.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",l)}};w.append(y,o)},S.onBufferAppending=function(o,d){var u=this,w=this.hls,y=this.operationQueue,m=this.tracks,l=d.data,_=d.type,f=d.frag,h=d.part,s=d.chunkMeta,a=s.buffering[_],E=self.performance.now();a.start=E;var v=f.stats.buffering,p=h?h.stats.buffering:null;v.start===0&&(v.start=E),p&&p.start===0&&(p.start=E);var L=m.audio,I=_==="audio"&&s.id===1&&(L==null?void 0:L.container)==="audio/mpeg",B={execute:function(){if(a.executeStart=self.performance.now(),I){var j=u.sourceBuffer[_];if(j){var F=f.start-j.timestampOffset;Math.abs(F)>=.1&&(P.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+F+") sn: "+f.sn+")"),j.timestampOffset=f.start)}}u.appendExecutor(l,_)},onStart:function(){},onComplete:function(){var j=self.performance.now();a.executeEnd=a.end=j,v.first===0&&(v.first=j),p&&p.first===0&&(p.first=j);var F=u.sourceBuffer,X={};for(var te in F)X[te]=k.BufferHelper.getBuffered(F[te]);u.appendError=0,u.hls.trigger(M.Events.BUFFER_APPENDED,{type:_,frag:f,part:h,chunkMeta:s,parent:f.type,timeRanges:X})},onError:function(j){P.logger.error("[buffer-controller]: Error encountered while trying to append to the "+_+" SourceBuffer",j);var F={type:U.ErrorTypes.MEDIA_ERROR,parent:f.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=U.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,F.details=U.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>w.config.appendErrorMaxRetry&&(P.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),w.trigger(M.Events.ERROR,F)}};y.append(B,_)},S.onBufferFlushing=function(o,d){var u=this,w=this.operationQueue,y=function(l){return{execute:u.removeExecutor.bind(u,l,d.startOffset,d.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(M.Events.BUFFER_FLUSHED,{type:l})},onError:function(f){P.logger.warn("[buffer-controller]: Failed to remove from "+l+" SourceBuffer",f)}}};d.type?w.append(y(d.type),d.type):this.getSourceBufferTypes().forEach(function(m){w.append(y(m),m)})},S.onFragParsed=function(o,d){var u=this,w=d.frag,y=d.part,m=[],l=y?y.elementaryStreams:w.elementaryStreams;l[D.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(l[D.ElementaryStreamTypes.AUDIO]&&m.push("audio"),l[D.ElementaryStreamTypes.VIDEO]&&m.push("video"));var _=function(){var h=self.performance.now();w.stats.buffering.end=h,y&&(y.stats.buffering.end=h);var s=y?y.stats:w.stats;u.hls.trigger(M.Events.FRAG_BUFFERED,{frag:w,part:y,stats:s,id:w.type})};m.length===0&&P.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(_,m)},S.onFragChanged=function(o,d){this.flushBackBuffer()},S.onBufferEos=function(o,d){var u=this,w=this.getSourceBufferTypes().reduce(function(y,m){var l=u.sourceBuffer[m];return(!d.type||d.type===m)&&(l&&!l.ended&&(l.ended=!0,P.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),y&&!!(!l||l.ended)},!0);w&&this.blockBuffers(function(){var y=u.mediaSource;if(!y||y.readyState!=="open")return;y.endOfStream()})},S.onLevelUpdated=function(o,d){var u=d.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},S.flushBackBuffer=function(){var o=this.hls,d=this.details,u=this.media,w=this.sourceBuffer;if(!u||d===null)return;var y=this.getSourceBufferTypes();if(!y.length)return;var m=d.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(W.isFiniteNumber)(m)||m<0)return;var l=u.currentTime,_=d.levelTargetDuration,f=Math.max(m,_),h=Math.floor(l/_)*_-f;y.forEach(function(s){var a=w[s];if(a){var E=k.BufferHelper.getBuffered(a);E.length>0&&h>E.start(0)&&(o.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),d.live&&o.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),o.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:s}))}})},S.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,d=this.hls,u=this.media,w=this.mediaSource,y=o.fragments[0].start+o.totalduration,m=u.duration,l=Object(W.isFiniteNumber)(w.duration)?w.duration:0;o.live&&d.config.liveDurationInfinity?(P.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(y>l&&y>m||!Object(W.isFiniteNumber)(m))&&(P.logger.log("[buffer-controller]: Updating Media Source duration to "+y.toFixed(3)),w.duration=y)},S.updateSeekableRange=function(o){var d=this.mediaSource,u=o.fragments,w=u.length;if(w&&o.live&&d!==null&&d!==void 0&&d.setLiveSeekableRange){var y=Math.max(0,u[0].start),m=Math.max(y,y+o.totalduration);d.setLiveSeekableRange(y,m)}},S.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,d=this.operationQueue,u=this.pendingTracks,w=Object.keys(u).length;if(w&&!o||w===2){this.createSourceBuffers(u),this.pendingTracks={};var y=this.getSourceBufferTypes();if(y.length===0){this.hls.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}y.forEach(function(m){d.executeNext(m)})}},S.createSourceBuffers=function(o){var d=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var y in o)if(!d[y]){var m=o[y];if(!m)throw Error("source buffer exists for track "+y+", however track does not");var l=m.levelCodec||m.codec,_=m.container+";codecs="+l;P.logger.log("[buffer-controller]: creating sourceBuffer("+_+")");try{var f=d[y]=u.addSourceBuffer(_),h=y;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[y]={buffer:f,codec:l,container:m.container,levelCodec:m.levelCodec,id:m.id},w++}catch(s){P.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+s.message),this.hls.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:s,mimeType:_})}}w&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},S._onSBUpdateStart=function(o){var d=this.operationQueue,u=d.current(o);u.onStart()},S._onSBUpdateEnd=function(o){var d=this.operationQueue,u=d.current(o);u.onComplete(),d.shiftAndExecuteNext(o)},S._onSBUpdateError=function(o,d){P.logger.error("[buffer-controller]: "+o+" SourceBuffer error",d),this.hls.trigger(M.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(d)},S.removeExecutor=function(o,d,u){var w=this.media,y=this.mediaSource,m=this.operationQueue,l=this.sourceBuffer,_=l[o];if(!w||!y||!_){P.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var f=Object(W.isFiniteNumber)(w.duration)?w.duration:Infinity,h=Object(W.isFiniteNumber)(y.duration)?y.duration:Infinity,s=Math.max(0,d),a=Math.min(u,f,h);a>s?(P.logger.log("[buffer-controller]: Removing ["+s+","+a+"] from the "+o+" SourceBuffer"),console.assert(!_.updating,o+" sourceBuffer must not be updating"),_.remove(s,a)):m.shiftAndExecuteNext(o)},S.appendExecutor=function(o,d){var u=this.operationQueue,w=this.sourceBuffer,y=w[d];if(!y){P.logger.warn("[buffer-controller]: Attempting to append to the "+d+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(d);return}y.ended=!1,console.assert(!y.updating,d+" sourceBuffer must not be updating"),y.appendBuffer(o)},S.blockBuffers=function(o,d){var u=this;if(d===void 0&&(d=this.getSourceBufferTypes()),!d.length){P.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,y=d.map(function(m){return w.appendBlocker(m)});Promise.all(y).then(function(){o(),d.forEach(function(m){var l=u.sourceBuffer[m];(!l||!l.updating)&&w.shiftAndExecuteNext(m)})})},S.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},S.addBufferListener=function(o,d,u){var w=this.sourceBuffer[o];if(!w)return;var y=u.bind(this,o);this.listeners[o].push({event:d,listener:y}),w.addEventListener(d,y)},S.removeBufferListeners=function(o){var d=this.sourceBuffer[o];if(!d)return;this.listeners[o].forEach(function(u){d.removeEventListener(u.event,u.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return M});var W=A("./src/utils/logger.ts"),M=function(){function P(k){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=k}var U=P.prototype;return U.append=function(R,D){var g=this.queues[D];g.push(R),g.length===1&&this.buffers[D]&&this.executeNext(D)},U.insertAbort=function(R,D){var g=this.queues[D];g.unshift(R),this.executeNext(D)},U.appendBlocker=function(R){var D,g=new Promise(function(O){D=O}),b={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(b,R),g},U.executeNext=function(R){var D=this.buffers,g=this.queues,b=D[R],O=g[R];if(O.length){var T=O[0];try{T.execute()}catch(x){W.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),T.onError(x),(!b||!b.updating)&&(O.shift(),this.executeNext(R))}}},U.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},U.current=function(R){return this.queues[R][0]},P}()},"./src/controller/cap-level-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts");function M(k,R){for(var D=0;D<R.length;D++){var g=R[D];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(k,g.key,g)}}function P(k,R,D){return R&&M(k.prototype,R),D&&M(k,D),k}var U=function(){function k(D){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=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=k.prototype;return R.setStreamController=function(g){this.streamController=g},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var g=this.hls;g.on(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var g=this.hls;g.off(W.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),g.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),g.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(W.Events.BUFFER_CODECS,this.onBufferCodecs,this),g.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(g,b){k.isLevelAllowed(b.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(b.droppedLevel)},R.onMediaAttaching=function(g,b){this.media=b.media instanceof HTMLVideoElement?b.media:null},R.onManifestParsed=function(g,b){var O=this.hls;this.restrictedLevels=[],this.firstLevel=b.firstLevel,O.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onBufferCodecs=function(g,b){var O=this.hls;O.config.capLevelToPlayerSize&&b.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var g=this.hls.levels;if(g.length){var b=this.hls;b.autoLevelCapping=this.getMaxLevel(g.length-1),b.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=b.autoLevelCapping}}},R.getMaxLevel=function(g){var b=this,O=this.hls.levels;if(!O.length)return-1;var T=O.filter(function(x,S){return k.isLevelAllowed(S,b.restrictedLevels)&&S<=g});return this.clientRect=null,k.getMaxLevelByMediaSize(T,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var g=this.media,b={width:0,height:0};if(g){var O=g.getBoundingClientRect();b.width=O.width,b.height=O.height,!b.width&&!b.height&&(b.width=O.right-O.left||g.width||0,b.height=O.bottom-O.top||g.height||0)}return this.clientRect=b,b},k.isLevelAllowed=function(g,b){return b===void 0&&(b=[]),b.indexOf(g)===-1},k.getMaxLevelByMediaSize=function(g,b,O){if(!g||!g.length)return-1;for(var T=function(d,u){return u?d.width!==u.width||d.height!==u.height:!0},x=g.length-1,S=0;S<g.length;S+=1){var c=g[S];if((c.width>=b||c.height>=O)&&T(c,g[S+1])){x=S;break}}return x},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 g=1;try{g=self.devicePixelRatio}catch(b){}return g}}]),k}();K.default=U},"./src/controller/cmcd-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return T});var W=A("./src/events.ts"),M=A("./src/types/cmcd.ts"),P=A("./src/utils/buffer-helper.ts"),U=A("./src/utils/logger.ts");function k(x,S){for(var c=0;c<S.length;c++){var o=S[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function R(x,S,c){return S&&k(x.prototype,S),c&&k(x,c),x}function D(x,S){var c=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(c)return(c=c.call(x)).next.bind(c);if(Array.isArray(x)||(c=g(x))||S&&x&&typeof x.length=="number"){c&&(x=c);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g(x,S){if(!x)return;if(typeof x=="string")return b(x,S);var c=Object.prototype.toString.call(x).slice(8,-1);if(c==="Object"&&x.constructor&&(c=x.constructor.name),c==="Map"||c==="Set")return Array.from(x);if(c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return b(x,S)}function b(x,S){(S==null||S>x.length)&&(S=x.length);for(var c=0,o=new Array(S);c<S;c++)o[c]=x[c];return o}function O(){return O=Object.assign||function(x){for(var S=1;S<arguments.length;S++){var c=arguments[S];for(var o in c)Object.prototype.hasOwnProperty.call(c,o)&&(x[o]=c[o])}return x},O.apply(this,arguments)}var T=function(){function x(c){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:M.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(y){U.logger.warn("Could not generate manifest CMCD data.",y)}},this.applyFragmentData=function(w){try{var y=w.frag,m=o.hls.levels[y.level],l=o.getObjectType(y),_={d:y.duration*1e3,ot:l};(l===M.CMCDObjectType.VIDEO||l===M.CMCDObjectType.AUDIO||l==M.CMCDObjectType.MUXED)&&(_.br=m.bitrate/1e3,_.tb=o.getTopBandwidth(l),_.bl=o.getBufferLength(l)),o.apply(w,_)}catch(f){U.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=c;var d=this.config=c.config,u=d.cmcd;u!=null&&(d.pLoader=this.createPlaylistLoader(),d.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||x.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var S=x.prototype;return S.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(W.Events.BUFFER_CREATED,this.onBufferCreated,this)},S.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(W.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},S.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},S.onMediaAttached=function(o,d){this.media=d.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},S.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},S.onBufferCreated=function(o,d){var u,w;this.audioBuffer=(u=d.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(w=d.tracks.video)===null||w===void 0?void 0:w.buffer},S.createData=function(){var o;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},S.apply=function(o,d){d===void 0&&(d={}),O(d,this.createData());var u=d.ot===M.CMCDObjectType.INIT||d.ot===M.CMCDObjectType.VIDEO||d.ot===M.CMCDObjectType.MUXED;if(this.starved&&u&&(d.bs=!0,d.su=!0,this.starved=!1),d.su==null&&(d.su=this.buffering),this.useHeaders){var w=x.toHeaders(d);if(!Object.keys(w).length)return;o.headers||(o.headers={}),O(o.headers,w)}else{var y=x.toQuery(d);if(!y)return;o.url=x.appendQueryToUri(o.url,y)}},S.getObjectType=function(o){var d=o.type;return d==="subtitle"?M.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?M.CMCDObjectType.INIT:d==="audio"?M.CMCDObjectType.AUDIO:d==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},S.getTopBandwidth=function(o){for(var d=0,u=o===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=D(u),y;!(y=w()).done;){var m=y.value;m.bitrate>d&&(d=m.bitrate)}return d>0?d:NaN},S.getBufferLength=function(o){var d=this.hls.media,u=o===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!d)return NaN;var w=P.BufferHelper.bufferInfo(u,d.currentTime,this.config.maxBufferHole);return w.len*1e3},S.createPlaylistLoader=function(){var o=this.config.pLoader,d=this.applyPlaylistData,u=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new u(m)}var y=w.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(l,_,f){d(l),this.loader.load(l,_,f)},R(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},S.createFragmentLoader=function(){var o=this.config.fLoader,d=this.applyFragmentData,u=o||this.config.loader;return function(){function w(m){this.loader=void 0,this.loader=new u(m)}var y=w.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(l,_,f){d(l),this.loader.load(l,_,f)},R(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),d=o.toString();return URL.revokeObjectURL(o),d.substr(d.lastIndexOf("/")+1)},x.serialize=function(o){for(var d=[],u=function(I){return!Number.isNaN(I)&&I!=null&&I!==""&&I!==!1},w=function(I){return Math.round(I)},y=function(I){return w(I/100)*100},m=function(I){return encodeURIComponent(I)},l={br:w,d:w,bl:y,dl:y,mtp:y,nor:m,rtp:y,tb:w},_=Object.keys(o||{}).sort(),f=D(_),h;!(h=f()).done;){var s=h.value,a=o[s];if(!u(a))continue;if(s==="v"&&a===1)continue;if(s=="pr"&&a===1)continue;var E=l[s];E&&(a=E(a));var v=typeof a,p=void 0;s==="ot"||s==="sf"||s==="st"?p=s+"="+a:v==="boolean"?p=s:v==="number"?p=s+"="+a:p=s+"="+JSON.stringify(a),d.push(p)}return d.join(",")},x.toHeaders=function(o){for(var d=Object.keys(o),u={},w=["Object","Request","Session","Status"],y=[{},{},{},{}],m={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},l=0,_=d;l<_.length;l++){var f=_[l],h=m[f]!=null?m[f]:1;y[h][f]=o[f]}for(var s=0;s<y.length;s++){var a=x.serialize(y[s]);a&&(u["CMCD-"+w[s]]=a)}return u},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,d){if(!d)return o;var u=o.includes("?")?"&":"?";return""+o+u+d},x}()},"./src/controller/eme-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),U=A("./src/utils/mediakeys-helper.ts");function k(T,x){for(var S=0;S<x.length;S++){var c=x[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(T,c.key,c)}}function R(T,x,S){return x&&k(T.prototype,x),S&&k(T,S),T}var D=3,g=function(x,S,c){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(d){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+d+'"',robustness:c.audioRobustness||""})}),S.forEach(function(d){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+d+'"',robustness:c.videoRobustness||""})}),[o]},b=function(x,S,c,o){switch(x){case U.KeySystems.WIDEVINE:return g(S,c,o);default:throw new Error("Unknown key-system: "+x)}},O=function(){function T(S){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=S,this._config=S.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var x=T.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(W.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(c){switch(c){case U.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+c+'"')},x._attemptKeySystemAccess=function(c,o,d){var u=this,w=b(c,o,d,this._drmSystemOptions);P.logger.log("Requesting encrypted media key-system access");var y=this.requestMediaKeySystemAccess(c,w);this.mediaKeysPromise=y.then(function(m){return u._onMediaKeySystemAccessObtained(c,m)}),y.catch(function(m){P.logger.error('Failed to obtain key-system "'+c+'" access:',m)})},x._onMediaKeySystemAccessObtained=function(c,o){var d=this;P.logger.log('Access for key-system "'+c+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:c};this._mediaKeysList.push(u);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(y){return u.mediaKeys=y,P.logger.log('Media-keys created for key-system "'+c+'"'),d._onMediaKeysCreated(),y});return w.catch(function(y){P.logger.error("Failed to create media-keys:",y)}),w},x._onMediaKeysCreated=function(){var c=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),c._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(c){var o=this;P.logger.log("New key-system session "+c.sessionId),c.addEventListener("message",function(d){o._onKeySessionMessage(c,d.message)},!1)},x._onKeySessionMessage=function(c,o){P.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(d){P.logger.log("Received license data (length: "+(d&&d.byteLength)+"), updating key-session"),c.update(d)})},x.onMediaEncrypted=function(c){var o=this;if(P.logger.log('Media is encrypted using "'+c.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(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var d=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(c.initDataType,c.initData)};this.mediaKeysPromise.then(d).catch(d)},x._attemptSetMediaKeys=function(c){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){P.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(W.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(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(c,o){var d=this,u=this._mediaKeysList[0];if(!u){P.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){P.logger.warn("Key-Session already initialized but requested again");return}var w=u.mediaKeysSession;if(!w){P.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){P.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(W.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 "'+c+'" init data type'),u.mediaKeysSessionInitialized=!0,w.generateRequest(c,o).then(function(){P.logger.debug("Key-session generation succeeded")}).catch(function(y){P.logger.error("Error generating key-session request:",y),d.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(c,o,d){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,c,o,d);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,u,c),w=void 0}catch(y){P.logger.error(y)}try{u.readyState||u.open("POST",c,!0),w&&w.call(this.hls,u,c)}catch(y){throw new Error("issue setting up KeySystem license XHR "+y)}return u},x._onLicenseRequestReadyStageChange=function(c,o,d,u){switch(c.readyState){case 4:if(c.status===200){this._requestLicenseFailureCount=0,P.logger.log("License request succeeded");var w=c.response,y=this._licenseResponseCallback;if(y)try{w=y.call(this.hls,c,o)}catch(l){P.logger.error(l)}u(w)}else{if(P.logger.error("License Request XHR failed ("+o+"). Status: "+c.status+" ("+c.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=D-this._requestLicenseFailureCount+1;P.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(d,u)}break}},x._generateLicenseRequestChallenge=function(c,o){switch(c.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+c.mediaKeySystemDomain)},x._requestLicense=function(c,o){P.logger.log("Requesting content license for key-system");var d=this._mediaKeysList[0];if(!d){P.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(d.mediaKeySystemDomain),w=this._createLicenseXhr(u,c,o);P.logger.log("Sending license request to URL: "+u);var y=this._generateLicenseRequestChallenge(d,c);w.send(y)}catch(m){P.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(c,o){if(!this._emeEnabled)return;var d=o.media;this._media=d,d.addEventListener("encrypted",this._onMediaEncrypted)},x.onMediaDetached=function(){var c=this._media,o=this._mediaKeysList;if(!c)return;c.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(d){if(d.mediaKeysSession)return d.mediaKeysSession.close().catch(function(){})})).then(function(){return c.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(c,o){if(!this._emeEnabled)return;var d=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),u=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,d,u)},R(T,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),T}();K.default=O},"./src/controller/fps-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=function(){function U(R){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=R,this.registerListeners()}var k=U.prototype;return k.setStreamController=function(D){this.streamController=D},k.registerListeners=function(){this.hls.on(W.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},k.unregisterListeners=function(){this.hls.off(W.Events.MEDIA_ATTACHING,this.onMediaAttaching)},k.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},k.onMediaAttaching=function(D,g){var b=this.hls.config;if(b.capLevelOnFPSDrop){var O=g.media instanceof self.HTMLVideoElement?g.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),b.fpsDroppedMonitoringPeriod)}},k.checkFPS=function(D,g,b){var O=performance.now();if(g){if(this.lastTime){var T=O-this.lastTime,x=b-this.lastDroppedFrames,S=g-this.lastDecodedFrames,c=1e3*x/T,o=this.hls;if(o.trigger(W.Events.FPS_DROP,{currentDropped:x,currentDecoded:S,totalDroppedFrames:b}),c>0&&x>o.config.fpsDroppedMonitoringThreshold*S){var d=o.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+d),d>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=d)&&(d=d-1,o.trigger(W.Events.FPS_DROP_LEVEL_CAPPING,{level:d,droppedLevel:o.currentLevel}),o.autoLevelCapping=d,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=b,this.lastDecodedFrames=g}},k.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var g=D.getVideoPlaybackQuality();this.checkFPS(D,g.totalVideoFrames,g.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},U}();K.default=P},"./src/controller/fragment-finders.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"findFragmentByPDT",function(){return P}),A.d(K,"findFragmentByPTS",function(){return U}),A.d(K,"fragmentWithinToleranceTest",function(){return k}),A.d(K,"pdtWithinToleranceTest",function(){return R}),A.d(K,"findFragWithCC",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/binary-search.ts");function P(g,b,O){if(b===null||!Array.isArray(g)||!g.length||!Object(W.isFiniteNumber)(b))return null;var T=g[0].programDateTime;if(b<(T||0))return null;var x=g[g.length-1].endProgramDateTime;if(b>=(x||0))return null;O=O||0;for(var S=0;S<g.length;++S){var c=g[S];if(R(b,O,c))return c}return null}function U(g,b,O,T){O===void 0&&(O=0),T===void 0&&(T=0);var x=null;if(g?x=b[g.sn-b[0].sn+1]||null:O===0&&b[0].start===0&&(x=b[0]),x&&k(O,T,x)===0)return x;var S=M.default.search(b,k.bind(null,O,T));return S||x}function k(g,b,O){g===void 0&&(g=0),b===void 0&&(b=0);var T=Math.min(b,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-T<=g?1:O.start-T>g&&O.start?-1:0}function R(g,b,O){var T=Math.min(b,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,x=O.endProgramDateTime||0;return x-T>g}function D(g,b){return M.default.search(g,function(O){return O.cc<b?1:O.cc>b?-1:0})}},"./src/controller/fragment-tracker.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"FragmentState",function(){return P}),A.d(K,"FragmentTracker",function(){return U});var W=A("./src/events.ts"),M=A("./src/types/loader.ts"),P;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(P||(P={}));var U=function(){function D(b){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=b,this._registerListeners()}var g=D.prototype;return g._registerListeners=function(){var O=this.hls;O.on(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g._unregisterListeners=function(){var O=this.hls;O.off(W.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(W.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(W.Events.FRAG_LOADED,this.onFragLoaded,this)},g.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},g.getAppendedFrag=function(O,T){if(T===M.PlaylistLevelType.MAIN){var x=this.activeFragment,S=this.activeParts;if(!x)return null;if(S)for(var c=S.length;c--;){var o=S[c],d=o?o.end:x.appendedPTS;if(o.start<=O&&d!==void 0&&O<=d)return c>9&&(this.activeParts=S.slice(c-9)),o}else if(x.start<=O&&x.appendedPTS!==void 0&&O<=x.appendedPTS)return x}return this.getBufferedFrag(O,T)},g.getBufferedFrag=function(O,T){for(var x=this.fragments,S=Object.keys(x),c=S.length;c--;){var o=x[S[c]];if((o==null?void 0:o.body.type)===T&&o.buffered){var d=o.body;if(d.start<=O&&O<=d.end)return d}}return null},g.detectEvictedFragments=function(O,T,x){var S=this;Object.keys(this.fragments).forEach(function(c){var o=S.fragments[c];if(!o)return;if(!o.buffered){o.body.type===x&&S.removeFragment(o.body);return}var d=o.range[O];if(!d)return;d.time.some(function(u){var w=!S.isTimeBuffered(u.startPTS,u.endPTS,T);return w&&S.removeFragment(o.body),w})})},g.detectPartialFragments=function(O){var T=this,x=this.timeRanges,S=O.frag,c=O.part;if(!x||S.sn==="initSegment")return;var o=R(S),d=this.fragments[o];if(!d)return;Object.keys(x).forEach(function(u){var w=S.elementaryStreams[u];if(!w)return;var y=x[u],m=c!==null||w.partial===!0;d.range[u]=T.getBufferedTimes(S,c,m,y)}),d.backtrack=d.loaded=null,Object.keys(d.range).length?d.buffered=!0:this.removeFragment(d.body)},g.fragBuffered=function(O){var T=R(O),x=this.fragments[T];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},g.getBufferedTimes=function(O,T,x,S){for(var c={time:[],partial:x},o=T?T.start:O.start,d=T?T.end:O.end,u=O.minEndPTS||d,w=O.maxStartPTS||o,y=0;y<S.length;y++){var m=S.start(y)-this.bufferPadding,l=S.end(y)+this.bufferPadding;if(w>=m&&u<=l){c.time.push({startPTS:Math.max(o,S.start(y)),endPTS:Math.min(d,S.end(y))});break}else if(o<l&&d>m)c.partial=!0,c.time.push({startPTS:Math.max(o,S.start(y)),endPTS:Math.min(d,S.end(y))});else if(d<=m)break}return c},g.getPartialFragment=function(O){var T=null,x,S,c,o=0,d=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(w){var y=u[w];if(!y)return;k(y)&&(S=y.body.start-d,c=y.body.end+d,O>=S&&O<=c&&(x=Math.min(O-S,c-O),o<=x&&(T=y.body,o=x)))}),T},g.getState=function(O){var T=R(O),x=this.fragments[T];return x?x.buffered?k(x)?P.PARTIAL:P.OK:x.backtrack?P.BACKTRACKED:P.APPENDING:P.NOT_LOADED},g.backtrack=function(O,T){var x=R(O),S=this.fragments[x];if(!S||S.backtrack)return null;var c=S.backtrack=T||S.loaded;return S.loaded=null,c},g.getBacktrackData=function(O){var T=R(O),x=this.fragments[T];if(x){var S,c=x.backtrack;if(c!=null&&(S=c.payload)!==null&&S!==void 0&&S.byteLength)return c;this.removeFragment(O)}return null},g.isTimeBuffered=function(O,T,x){for(var S,c,o=0;o<x.length;o++){if(S=x.start(o)-this.bufferPadding,c=x.end(o)+this.bufferPadding,O>=S&&T<=c)return!0;if(T<=S)return!1}return!1},g.onFragLoaded=function(O,T){var x=T.frag,S=T.part;if(x.sn==="initSegment"||x.bitrateTest||S)return;var c=R(x);this.fragments[c]={body:x,loaded:T,backtrack:null,buffered:!1,range:Object.create(null)}},g.onBufferAppended=function(O,T){var x=this,S=T.frag,c=T.part,o=T.timeRanges;if(S.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=S,c){var d=this.activeParts;d||(this.activeParts=d=[]),d.push(c)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var w=o[u];if(x.detectEvictedFragments(u,w),!c)for(var y=0;y<w.length;y++)S.appendedPTS=Math.max(w.end(y),S.appendedPTS||0)})},g.onFragBuffered=function(O,T){this.detectPartialFragments(T)},g.hasFragment=function(O){var T=R(O);return!!this.fragments[T]},g.removeFragmentsInRange=function(O,T,x){var S=this;Object.keys(this.fragments).forEach(function(c){var o=S.fragments[c];if(!o)return;if(o.buffered){var d=o.body;d.type===x&&d.start<T&&d.end>O&&S.removeFragment(d)}})},g.removeFragment=function(O){var T=R(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[T]},g.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function k(D){var g,b;return D.buffered&&(((g=D.range.video)===null||g===void 0?void 0:g.partial)||((b=D.range.audio)===null||b===void 0?void 0:b.partial))}function R(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"STALL_MINIMUM_DURATION_MS",function(){return k}),A.d(K,"MAX_START_GAP_JUMP",function(){return R}),A.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),A.d(K,"SKIP_BUFFER_RANGE_START",function(){return g}),A.d(K,"default",function(){return b});var W=A("./src/utils/buffer-helper.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts"),U=A("./src/utils/logger.ts"),k=250,R=2,D=.1,g=.05,b=function(){function O(x,S,c,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=x,this.media=S,this.fragmentTracker=c,this.hls=o}var T=O.prototype;return T.destroy=function(){this.hls=this.fragmentTracker=this.media=null},T.poll=function(S){var c=this.config,o=this.media,d=this.stalled,u=o.currentTime,w=o.seeking,y=this.seeking&&!w,m=!this.seeking&&w;if(this.seeking=w,u!==S){if(this.moved=!0,d!==null){if(this.stallReported){var l=self.performance.now()-d;U.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(l)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||y)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!W.BufferHelper.getBuffered(o).length)return;var _=W.BufferHelper.bufferInfo(o,u,0),f=_.len>0,h=_.nextStart||0;if(!f&&!h)return;if(w){var s=_.len>R,a=!h||h-u>R&&!this.fragmentTracker.getPartialFragment(u);if(s||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,v=Math.max(h,_.start||0)-u,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,L=p==null||((E=p.details)===null||E===void 0)?void 0:E.live,I=L?p.details.targetduration*2:R;if(v>0&&v<=I){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(d===null){this.stalled=B;return}var z=B-d;!w&&z>=k&&this._reportStall(_.len);var j=W.BufferHelper.bufferInfo(o,u,c.maxBufferHole);this._tryFixBufferStall(j,z)},T._tryFixBufferStall=function(S,c){var o=this.config,d=this.fragmentTracker,u=this.media,w=u.currentTime,y=d.getPartialFragment(w);if(y){var m=this._trySkipBufferHole(y);if(m)return}S.len>o.maxBufferHole&&c>o.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},T._reportStall=function(S){var c=this.hls,o=this.media,d=this.stallReported;d||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+S+")"),c.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:S}))},T._trySkipBufferHole=function(S){for(var c=this.config,o=this.hls,d=this.media,u=d.currentTime,w=0,y=W.BufferHelper.getBuffered(d),m=0;m<y.length;m++){var l=y.start(m);if(u+c.maxBufferHole>=w&&u<l){var _=Math.max(l+g,d.currentTime+D);return U.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+_),this.moved=!0,this.stalled=null,d.currentTime=_,S&&o.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 "+u+" to "+_,frag:S}),_}w=y.end(m)}return 0},T._tryNudgeBuffer=function(){var S=this.config,c=this.hls,o=this.media,d=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<S.nudgeMaxRetry){var w=d+u*S.nudgeOffset;U.logger.warn("Nudging 'currentTime' from "+d+" to "+w),o.currentTime=w,c.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else U.logger.error("Playhead still not moving while enough data buffered @"+d+" after "+S.nudgeMaxRetry+" nudges"),c.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(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/demux/id3.ts"),U=.25,k=function(){function R(g){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=g,this._registerListeners()}var D=R.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var b=this.hls;b.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.on(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var b=this.hls;b.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),b.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),b.off(W.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),b.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(b,O){this.media=O.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(b){if(!this.media)return;for(var O=0;O<b.length;O++){var T=b[O];if(T.kind==="metadata"&&T.label==="id3")return Object(M.sendAddTrackEvent)(T,this.media),T}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(b,O){if(!this.media)return;var T=O.frag,x=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var S=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,c=0;c<x.length;c++){var o=P.getID3Frames(x[c].data);if(o){var d=x[c].pts,u=c<x.length-1?x[c+1].pts:T.end,w=u-d;w<=0&&(u=d+U);for(var y=0;y<o.length;y++){var m=o[y];if(!P.isTimeStampFrame(m)){var l=new S(d,u,"");l.value=m,this.id3Track.addCue(l)}}}}},D.onBufferFlushing=function(b,O){var T=O.startOffset,x=O.endOffset,S=O.type;if(!S||S==="audio"){var c=this.id3Track;c&&Object(M.removeCuesInRange)(c,T,x)}},R}();K.default=k},"./src/controller/latency-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var W=A("./src/errors.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts");function U(D,g){for(var b=0;b<g.length;b++){var O=g[b];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function k(D,g,b){return g&&U(D.prototype,g),b&&U(D,b),D}var R=function(){function D(b){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=b,this.config=b.config,this.registerListeners()}var g=D.prototype;return g.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},g.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)},g.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)},g.onMediaAttached=function(O,T){this.media=T.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},g.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},g.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},g.onLevelUpdated=function(O,T){var x=T.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},g.onError=function(O,T){if(T.details!==W.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,P.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},g.timeupdate=function(){var O=this.media,T=this.levelDetails;if(!O||!T)return;this.currentTime=O.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var S=this.config,c=S.lowLatencyMode,o=S.maxLiveSyncPlaybackRate;if(!c||o===1)return;var d=this.targetLatency;if(d===null)return;var u=x-d,w=Math.min(this.maxLatency,d+T.targetduration),y=u<w;if(T.live&&y&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),l=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;O.playbackRate=Math.min(m,Math.max(1,l))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},g.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},g.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},k(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,T=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:T?O.liveMaxLatencyDurationCount*T.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var T=O.holdBack,x=O.partHoldBack,S=O.targetduration,c=this.config,o=c.liveSyncDuration,d=c.liveSyncDurationCount,u=c.lowLatencyMode,w=this.hls.userConfig,y=u&&x||T;(w.liveSyncDuration||w.liveSyncDurationCount||y===0)&&(y=o!==void 0?o:d*S);var m=S,l=1;return y+Math.min(this.stallCount*l,m)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),T=this.targetLatency,x=this.levelDetails;if(O===null||T===null||x===null)return null;var S=x.edge,c=O-T-this.edgeStalled,o=S-x.totalduration,d=S-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,c),d)}},{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 T=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-T,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,T=this.levelDetails;if(!O||!T)return 0;var x=O.buffered.length;return x?O.buffered.end(x-1):T.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return c});var W=A("./src/types/level.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),U=A("./src/utils/codecs.ts"),k=A("./src/controller/level-helper.ts"),R=A("./src/controller/base-playlist-controller.ts"),D=A("./src/types/loader.ts");function g(){return g=Object.assign||function(o){for(var d=1;d<arguments.length;d++){var u=arguments[d];for(var w in u)Object.prototype.hasOwnProperty.call(u,w)&&(o[w]=u[w])}return o},g.apply(this,arguments)}function b(o,d){for(var u=0;u<d.length;u++){var w=d[u];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,d,u){return d&&b(o.prototype,d),u&&b(o,u),o}function T(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,x(o,d)}function x(o,d){return x=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},x(o,d)}var S=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),c=function(o){T(d,o);function d(w){var y;return y=o.call(this,w,"[level-controller]")||this,y._levels=[],y._firstLevel=-1,y._startLevel=void 0,y.currentLevelIndex=-1,y.manualLevelIndex=-1,y.onParsedComplete=void 0,y._registerListeners(),y}var u=d.prototype;return u._registerListeners=function(){var y=this.hls;y.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),y.on(M.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var y=this.hls;y.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),y.off(M.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var y=this._levels;y.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(y,m){var l=[],_=[],f=[],h,s={},a,E=!1,v=!1,p=!1;if(m.levels.forEach(function(z){var j=z.attrs;E=E||!!(z.width&&z.height),v=v||!!z.videoCodec,p=p||!!z.audioCodec,S&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var F=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;a=s[F],a?a.url.push(z.url):(a=new W.Level(z),s[F]=a,l.push(a)),j&&(j.AUDIO&&Object(k.addGroupId)(a,"audio",j.AUDIO),j.SUBTITLES&&Object(k.addGroupId)(a,"text",j.SUBTITLES))}),(E||v)&&p&&(l=l.filter(function(z){var j=z.videoCodec,F=z.width,X=z.height;return!!j||!!(F&&X)})),l=l.filter(function(z){var j=z.audioCodec,F=z.videoCodec;return(!j||Object(U.isCodecSupportedInMp4)(j,"audio"))&&(!F||Object(U.isCodecSupportedInMp4)(F,"video"))}),m.audioTracks&&(_=m.audioTracks.filter(function(z){return!z.audioCodec||Object(U.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(k.assignTrackIdsByGroup)(_)),m.subtitles&&(f=m.subtitles,Object(k.assignTrackIdsByGroup)(f)),l.length>0){h=l[0].bitrate,l.sort(function(z,j){return z.bitrate-j.bitrate}),this._levels=l;for(var L=0;L<l.length;L++)if(l[L].bitrate===h){this._firstLevel=L,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+h);break}var I=p&&!v,B={levels:l,audioTracks:_,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:p,video:v,altAudio:!I&&_.some(function(z){return!!z.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,B),(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:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(y,m){if(o.prototype.onError.call(this,y,m),m.fatal)return;var l=m.context,_=this._levels[this.currentLevelIndex];if(l&&(l.type===D.PlaylistContextType.AUDIO_TRACK&&_.audioGroupIds&&l.groupId===_.audioGroupIds[_.urlId]||l.type===D.PlaylistContextType.SUBTITLE_TRACK&&_.textGroupIds&&l.groupId===_.textGroupIds[_.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,s;switch(m.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(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(s=m.frag.level)):s=m.frag.level}break;case P.ErrorDetails.LEVEL_LOAD_ERROR:case P.ErrorDetails.LEVEL_LOAD_TIMEOUT:l&&(l.deliveryDirectives&&(h=!1),s=l.level),f=!0;break;case P.ErrorDetails.REMUX_ALLOC_ERROR:s=m.level,f=!0;break}s!==void 0&&this.recoverLevel(m,s,f,h)},u.recoverLevel=function(y,m,l,_){var f=y.details,h=this._levels[m];if(h.loadError++,l){var s=this.retryLoadingOrFail(y);if(s)y.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(_){var a=h.url.length;if(a>1&&h.loadError<a)y.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var E=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(f+": switch to "+E),y.levelRetry=!0,this.hls.nextAutoLevel=E)}}},u.redundantFailover=function(y){var m=this._levels[y],l=m.url.length;if(l>1){var _=(m.urlId+1)%l;this.warn("Switching to redundant URL-id "+_),this._levels.forEach(function(f){f.urlId=_}),this.level=y}},u.onFragLoaded=function(y,m){var l=m.frag;if(l!==void 0&&l.type===D.PlaylistLevelType.MAIN){var _=this._levels[l.level];_!==void 0&&(_.fragmentError=0,_.loadError=0)}},u.onLevelLoaded=function(y,m){var l,_=m.level,f=m.details,h=this._levels[_];if(!h){var s;this.warn("Invalid level index "+_),(s=m.deliveryDirectives)!==null&&s!==void 0&&s.skip&&(f.deltaUpdateFailed=!0);return}_===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(_,m,h.details)):(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(y,m){var l=this.hls.levels[this.currentLevelIndex];if(!l)return;if(l.audioGroupIds){for(var _=-1,f=this.hls.audioTracks[m.id].groupId,h=0;h<l.audioGroupIds.length;h++)if(l.audioGroupIds[h]===f){_=h;break}_!==l.urlId&&(l.urlId=_,this.startLoad())}},u.loadPlaylist=function(y){var m=this.currentLevelIndex,l=this._levels[m];if(this.canLoad&&l&&l.url.length>0){var _=l.urlId,f=l.url[_];if(y)try{f=y.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+m+(y?" at sn "+y.msn+" part "+y.part:"")+" with URL-id "+_+" "+f),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:f,level:m,id:_,deliveryDirectives:y||null})}},u.removeLevel=function(y,m){var l=function(h,s){return s!==m},_=this._levels.filter(function(f,h){return h!==y?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(l),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(l)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(l)),f.urlId=0,!0):!1}).map(function(f,h){var s=f.details;return s!=null&&s.fragments&&s.fragments.forEach(function(a){a.level=h}),f});this._levels=_,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:_})},O(d,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(y){var m,l=this._levels;if(l.length===0)return;if(this.currentLevelIndex===y&&(m=l[y])!==null&&m!==void 0&&m.details)return;if(y<0||y>=l.length){var _=y<0;if(this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.LEVEL_SWITCH_ERROR,level:y,fatal:_,reason:"invalid level idx"}),_)return;y=Math.min(y,l.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=l[f],s=l[y];this.log("switching to level "+y+" from "+f),this.currentLevelIndex=y;var a=g({},s,{level:y,maxBitrate:s.maxBitrate,uri:s.uri,urlId:s.urlId});delete a._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,a);var E=s.details;if(!E||E.live){var v=this.switchParams(s.uri,h==null?void 0:h.details);this.loadPlaylist(v)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(y){this.manualLevelIndex=y,this._startLevel===void 0&&(this._startLevel=y),y!==-1&&(this.level=y)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(y){this._firstLevel=y}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var y=this.hls.config.startLevel;return y!==void 0?y:this._firstLevel}else return this._startLevel},set:function(y){this._startLevel=y}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(y){this.level=y,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=y)}}]),d}(R.default)},"./src/controller/level-helper.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"addGroupId",function(){return P}),A.d(K,"assignTrackIdsByGroup",function(){return U}),A.d(K,"updatePTS",function(){return k}),A.d(K,"updateFragPTSDTS",function(){return D}),A.d(K,"mergeDetails",function(){return g}),A.d(K,"mapPartIntersection",function(){return b}),A.d(K,"mapFragmentIntersection",function(){return O}),A.d(K,"adjustSliding",function(){return T}),A.d(K,"addSliding",function(){return x}),A.d(K,"computeReloadInterval",function(){return S}),A.d(K,"getFragmentWithSN",function(){return c}),A.d(K,"getPartWith",function(){return o});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts");function P(d,u,w){switch(u){case"audio":d.audioGroupIds||(d.audioGroupIds=[]),d.audioGroupIds.push(w);break;case"text":d.textGroupIds||(d.textGroupIds=[]),d.textGroupIds.push(w);break}}function U(d){var u={};d.forEach(function(w){var y=w.groupId||"";w.id=u[y]=u[y]||0,u[y]++})}function k(d,u,w){var y=d[u],m=d[w];R(y,m)}function R(d,u){var w=u.startPTS;if(Object(W.isFiniteNumber)(w)){var y=0,m;u.sn>d.sn?(y=w-d.start,m=d):(y=d.start-w,m=u),m.duration!==y&&(m.duration=y)}else if(u.sn>d.sn){var l=d.cc===u.cc;l&&d.minEndPTS?u.start=d.start+(d.minEndPTS-d.start):u.start=d.start+d.duration}else u.start=Math.max(d.start-u.duration,0)}function D(d,u,w,y,m,l){var _=y-w;_<=0&&(M.logger.warn("Fragment should have a positive duration",u),y=w+u.duration,l=m+u.duration);var f=w,h=y,s=u.startPTS,a=u.endPTS;if(Object(W.isFiniteNumber)(s)){var E=Math.abs(s-w);Object(W.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(E,u.deltaPTS):u.deltaPTS=E,f=Math.max(w,s),w=Math.min(w,s),m=Math.min(m,u.startDTS),h=Math.min(y,a),y=Math.max(y,a),l=Math.max(l,u.endDTS)}u.duration=y-w;var v=w-u.start;u.appendedPTS=y,u.start=u.startPTS=w,u.maxStartPTS=f,u.startDTS=m,u.endPTS=y,u.minEndPTS=h,u.endDTS=l;var p=u.sn;if(!d||p<d.startSN||p>d.endSN)return 0;var L,I=p-d.startSN,B=d.fragments;for(B[I]=u,L=I;L>0;L--)R(B[L],B[L-1]);for(L=I;L<B.length-1;L++)R(B[L],B[L+1]);return d.fragmentHint&&R(B[B.length-1],d.fragmentHint),d.PTSKnown=d.alignedSliding=!0,v}function g(d,u){for(var w=null,y=d.fragments,m=y.length-1;m>=0;m--){var l=y[m].initSegment;if(l){w=l;break}}d.fragmentHint&&delete d.fragmentHint.endPTS;var _=0,f;if(O(d,u,function(L,I){L.relurl&&(_=L.cc-I.cc),Object(W.isFiniteNumber)(L.startPTS)&&Object(W.isFiniteNumber)(L.endPTS)&&(I.start=I.startPTS=L.startPTS,I.startDTS=L.startDTS,I.appendedPTS=L.appendedPTS,I.maxStartPTS=L.maxStartPTS,I.endPTS=L.endPTS,I.endDTS=L.endDTS,I.minEndPTS=L.minEndPTS,I.duration=L.endPTS-L.startPTS,I.duration&&(f=I),u.PTSKnown=u.alignedSliding=!0),I.elementaryStreams=L.elementaryStreams,I.loader=L.loader,I.stats=L.stats,I.urlId=L.urlId,L.initSegment&&(I.initSegment=L.initSegment,w=L.initSegment)}),w){var h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;h.forEach(function(L){var I;(!L.initSegment||L.initSegment.relurl===((I=w)===null||I===void 0?void 0:I.relurl))&&(L.initSegment=w)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(L){return!L}),u.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var s=u.skippedSegments;s--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(_){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<a.length;E++)a[E].cc+=_}u.skippedSegments&&(u.startCC=u.fragments[0].cc),b(d.partList,u.partList,function(L,I){I.elementaryStreams=L.elementaryStreams,I.stats=L.stats}),f?D(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):T(d,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=d.driftStartTime,u.driftStart=d.driftStart;var v=u.advancedDateTime;if(u.advanced&&v){var p=u.edge;u.driftStart||(u.driftStartTime=v,u.driftStart=p),u.driftEndTime=v,u.driftEnd=p}else u.driftEndTime=d.driftEndTime,u.driftEnd=d.driftEnd,u.advancedDateTime=d.advancedDateTime}function b(d,u,w){if(d&&u)for(var y=0,m=0,l=d.length;m<=l;m++){var _=d[m],f=u[m+y];_&&f&&_.index===f.index&&_.fragment.sn===f.fragment.sn?w(_,f):y--}}function O(d,u,w){for(var y=u.skippedSegments,m=Math.max(d.startSN,u.startSN)-u.startSN,l=(d.fragmentHint?1:0)+(y?u.endSN:Math.min(d.endSN,u.endSN))-u.startSN,_=u.startSN-d.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,h=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,s=m;s<=l;s++){var a=h[_+s],E=f[s];y&&!E&&s<y&&(E=u.fragments[s]=a),a&&E&&w(a,E)}}function T(d,u){var w=u.startSN+u.skippedSegments-d.startSN,y=d.fragments;if(w<0||w>=y.length)return;x(u,y[w].start)}function x(d,u){if(u){for(var w=d.fragments,y=d.skippedSegments;y<w.length;y++)w[y].start+=u;d.fragmentHint&&(d.fragmentHint.start+=u)}}function S(d,u){var w=1e3*d.levelTargetDuration,y=w/2,m=d.age,l=m>0&&m<w*3,_=u.loading.end-u.loading.start,f,h=d.availabilityDelay;if(d.updated===!1)if(l){var s=333*d.misses;f=Math.max(Math.min(y,_*2),s),d.availabilityDelay=(d.availabilityDelay||0)+f}else f=y;else l?(h=Math.min(h||w/2,m),d.availabilityDelay=h,f=h+w-m):f=w-_;return Math.round(f)}function c(d,u,w){if(!d||!d.details)return null;var y=d.details,m=y.fragments[u-y.startSN];return m||(m=y.fragmentHint,m&&m.sn===u?m:u<y.startSN&&w&&w.sn===u?w:null)}function o(d,u,w){if(!d||!d.details)return null;var y=d.details.partList;if(y)for(var m=y.length;m--;){var l=y[m];if(l.index===w&&l.fragment.sn===u)return l}return null}},"./src/controller/stream-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return y});var W=A("./src/polyfills/number.ts"),M=A("./src/controller/base-stream-controller.ts"),P=A("./src/is-supported.ts"),U=A("./src/events.ts"),k=A("./src/utils/buffer-helper.ts"),R=A("./src/controller/fragment-tracker.ts"),D=A("./src/types/loader.ts"),g=A("./src/loader/fragment.ts"),b=A("./src/demux/transmuxer-interface.ts"),O=A("./src/types/transmuxer.ts"),T=A("./src/controller/gap-controller.ts"),x=A("./src/errors.ts"),S=A("./src/utils/logger.ts");function c(m,l){for(var _=0;_<l.length;_++){var f=l[_];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function o(m,l,_){return l&&c(m.prototype,l),_&&c(m,_),m}function d(m,l){m.prototype=Object.create(l.prototype),m.prototype.constructor=m,u(m,l)}function u(m,l){return u=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},u(m,l)}var w=100,y=function(m){d(l,m);function l(f,h){var s;return s=m.call(this,f,h,"[stream-controller]")||this,s.audioCodecSwap=!1,s.gapController=null,s.level=-1,s._forceStartLoad=!1,s.altAudio=!1,s.audioOnly=!1,s.fragPlaying=null,s.onvplaying=null,s.onvseeked=null,s.fragLastKbps=0,s.stalled=!1,s.couldBacktrack=!1,s.audioCodecSwitch=!1,s.videoBuffer=null,s._registerListeners(),s}var _=l.prototype;return _._registerListeners=function(){var h=this.hls;h.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(U.Events.ERROR,this.onError,this),h.on(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(U.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(U.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(U.Events.ERROR,this.onError,this),h.off(U.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(U.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(U.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(U.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(U.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},_.startLoad=function(h){if(this.levels){var s=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=a.startLevel;E===-1&&(a.config.testBandwidth?(E=0,this.bitrateTest=!0):E=a.nextAutoLevel),this.level=a.nextLoadLevel=E,this.loadedmetadata=!1}s>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),h=s),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},_.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},_.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var h,s=this.levels,a=this.level,E=s==null||((h=s[a])===null||h===void 0)?void 0:h.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var v,p=self.performance.now(),L=this.retryDate;(!L||p>=L||(v=this.media)!==null&&v!==void 0&&v.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},_.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},_.doTickIdle=function(){var h,s,a=this.hls,E=this.levelLastLoaded,v=this.levels,p=this.media,L=a.config,I=a.nextLoadLevel;if(E===null||!p&&(this.startFragRequested||!L.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!v||!v[I])return;var B=v[I];this.level=a.nextLoadLevel=I;var z=B.details;if(!z||this.state===M.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==I){this.state=M.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,D.PlaylistLevelType.MAIN);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(B.maxBitrate);if(F>=X)return;if(this._streamEnded(j,z)){var te={};this.altAudio&&(te.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,te),this.state=M.State.ENDED;return}var ie=j.end,le=this.getNextFragment(ie,z);if(this.couldBacktrack&&!this.fragPrevious&&le&&le.sn!=="initSegment"){var _e=le.sn-z.startSN;_e>1&&(le=z.fragments[_e-1],this.fragmentTracker.removeFragment(le))}if(le&&this.fragmentTracker.getState(le)===R.FragmentState.OK&&this.nextLoadPosition>ie){var me=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,me,D.PlaylistLevelType.MAIN),le=this.getNextFragment(this.nextLoadPosition,z)}if(!le)return;le.initSegment&&!le.initSegment.data&&!this.bitrateTest&&(le=le.initSegment),((h=le.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((s=le.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(le,z):this.loadFragment(le,z,ie)},_.loadFragment=function(h,s,a){var E,v=this.fragmentTracker.getState(h);if(this.fragCurrent=h,v===R.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(h);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else v=R.FragmentState.NOT_LOADED}v===R.FragmentState.NOT_LOADED||v===R.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,h,s,a)):v===R.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},_.getAppendedFrag=function(h){var s=this.fragmentTracker.getAppendedFrag(h,D.PlaylistLevelType.MAIN);return s&&"fragment"in s?s.fragment:s},_.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,D.PlaylistLevelType.MAIN)},_.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},_.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},_.nextLevelSwitch=function(){var h=this.levels,s=this.media;if(s!=null&&s.readyState){var a,E=this.getAppendedFrag(s.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!s.paused&&h){var v=this.hls.nextLoadLevel,p=h[v],L=this.fragLastKbps;L&&this.fragCurrent?a=this.fragCurrent.duration*p.maxBitrate/(1e3*L)+1:a=0}else a=0;var I=this.getBufferedFrag(s.currentTime+a);if(I){var B=this.followingBufferedFrag(I);if(B){this.abortCurrentFrag();var z=B.maxStartPTS?B.maxStartPTS:B.start,j=B.duration,F=Math.max(I.end,z+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},_.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},_.flushMainBuffer=function(h,s){m.prototype.flushMainBuffer.call(this,h,s,this.altAudio?"video":null)},_.onMediaAttached=function(h,s){m.prototype.onMediaAttached.call(this,h,s);var a=s.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new T.default(this.config,a,this.fragmentTracker,this.hls)},_.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},_.onMediaPlaying=function(){this.tick()},_.onMediaSeeked=function(){var h=this.media,s=h?h.currentTime:null;Object(W.isFiniteNumber)(s)&&this.log("Media seeked to "+s.toFixed(3)),this.tick()},_.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},_.onManifestParsed=function(h,s){var a=!1,E=!1,v;s.levels.forEach(function(p){v=p.audioCodec,v&&(v.indexOf("mp4a.40.2")!==-1&&(a=!0),v.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=a&&E&&!Object(P.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=s.levels,this.startFragRequested=!1},_.onLevelLoading=function(h,s){var a=this.levels;if(!a||this.state!==M.State.IDLE)return;var E=a[s.level];(!E.details||E.details.live&&this.levelLastLoaded!==s.level||this.waitForCdnTuneIn(E.details))&&(this.state=M.State.WAITING_LEVEL)},_.onLevelLoaded=function(h,s){var a,E=this.levels,v=s.level,p=s.details,L=p.totalduration;if(!E){this.warn("Levels were reset while loading level "+v);return}this.log("Level "+v+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+L);var I=this.fragCurrent;I&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(I.level!==s.level&&I.loader&&(this.state=M.State.IDLE,I.loader.abort()));var B=E[v],z=0;if(p.live||(a=B.details)!==null&&a!==void 0&&a.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;z=this.alignPlaylists(p,B.details)}if(B.details=p,this.levelLastLoaded=v,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:p,level:v}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=M.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,z),this.tick()},_._handleFragmentLoadProgress=function(h){var s,a=h.frag,E=h.part,v=h.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var L=p[a.level],I=L.details;if(!I){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var B=L.videoCodec,z=I.PTSKnown||!I.live,j=(s=a.initSegment)===null||s===void 0?void 0:s.data,F=this._getAudioCodec(L),X=this.transmuxer=this.transmuxer||new b.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),te=E?E.index:-1,ie=te!==-1,le=new O.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,v.byteLength,te,ie),_e=this.initPTS[a.cc];X.push(v,j,F,B,a,E,I.totalduration,z,le,_e)},_.onAudioTrackSwitching=function(h,s){var a=this.altAudio,E=!!s.url,v=s.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var p=this.fragCurrent;p!=null&&p.loader&&(this.log("Switching to main audio track, cancel main fragment load"),p.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var L=this.hls;a&&L.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),L.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:v})}},_.onAudioTrackSwitched=function(h,s){var a=s.id,E=!!this.hls.audioTracks[a].url;if(E){var v=this.videoBuffer;v&&this.mediaBuffer!==v&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=v)}this.altAudio=E,this.tick()},_.onBufferCreated=function(h,s){var a=s.tracks,E,v,p=!1;for(var L in a){var I=a[L];if(I.id==="main"){if(v=L,E=I,L==="video"){var B=a[L];B&&(this.videoBuffer=B.buffer)}}else p=!0}p&&E?(this.log("Alternate track found, use "+v+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},_.onFragBuffered=function(h,s){var a=s.frag,E=s.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(E?" p: "+E.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 v=E?E.stats:a.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,E)},_.onError=function(h,s){switch(s.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,s);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(s.fatal?(this.warn(""+s.details),this.state=M.State.ERROR):!s.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var a=!0,E=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);E&&E.len>.5&&(a=!this.reduceMaxBufferLength(E.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},_.checkBuffer=function(){var h=this.media,s=this.gapController;if(!h||!s||!h.readyState)return;var a=k.BufferHelper.getBuffered(h);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):s.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},_.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},_.onBufferFlushed=function(h,s){var a=s.type;if(a!==g.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(a===g.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,a,D.PlaylistLevelType.MAIN)}},_.onLevelsUpdated=function(h,s){this.levels=s.levels},_.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},_.seekToStartPos=function(){var h=this.media,s=h.currentTime,a=this.startPosition;if(a>=0&&s<a){if(h.seeking){S.logger.log("could not seek to "+a+", already seeking at "+s);return}var E=k.BufferHelper.getBuffered(h),v=E.length?E.start(0):0,p=v-a;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(S.logger.log("adjusting start position by "+p+" to match buffer start"),a+=p,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+s),h.currentTime=a}},_._getAudioCodec=function(h){var s=this.config.defaultAudioCodec||h.audioCodec;return this.audioCodecSwap&&s&&(this.log("Swapping audio codec"),s.indexOf("mp4a.40.5")!==-1?s="mp4a.40.2":s="mp4a.40.5"),s},_._loadBitrateTestFrag=function(h){var s=this;this._doFragLoad(h).then(function(a){var E=s.hls;if(!a||E.nextLoadLevel||s.fragContextChanged(h))return;s.fragLoadError=0,s.state=M.State.IDLE,s.startFragRequested=!1,s.bitrateTest=!1;var v=h.stats;v.parsing.start=v.parsing.end=v.buffering.start=v.buffering.end=self.performance.now(),E.trigger(U.Events.FRAG_LOADED,a)})},_._handleTransmuxComplete=function(h){var s,a="main",E=this.hls,v=h.remuxResult,p=h.chunkMeta,L=this.getCurrentContext(p);if(!L){this.warn("The loading context changed while buffering fragment "+p.sn+" of level "+p.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(p.level);return}var I=L.frag,B=L.part,z=L.level,j=v.video,F=v.text,X=v.id3,te=v.initSegment,ie=this.altAudio?void 0:v.audio;if(this.fragContextChanged(I))return;if(this.state=M.State.PARSING,te){te.tracks&&(this._bufferInitSegment(z,te.tracks,I,p),E.trigger(U.Events.FRAG_PARSING_INIT_SEGMENT,{frag:I,id:a,tracks:te.tracks}));var le=te.initPTS,_e=te.timescale;Object(W.isFiniteNumber)(le)&&(this.initPTS[I.cc]=le,E.trigger(U.Events.INIT_PTS_FOUND,{frag:I,id:a,initPTS:le,timescale:_e}))}if(j&&v.independent!==!1){if(z.details){var me=j.startPTS,he=j.endPTS,fe=j.startDTS,ce=j.endDTS;if(B)B.elementaryStreams[j.type]={startPTS:me,endPTS:he,startDTS:fe,endDTS:ce};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<me){this.backtrack(I);return}I.setElementaryStreamInfo(j.type,I.start,he,I.start,ce,!0)}I.setElementaryStreamInfo(j.type,me,he,fe,ce),this.bufferFragmentData(j,I,B,p)}}else if(v.independent===!1){this.backtrack(I);return}if(ie){var q=ie.startPTS,ye=ie.endPTS,Fe=ie.startDTS,Be=ie.endDTS;B&&(B.elementaryStreams[g.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:ye,startDTS:Fe,endDTS:Be}),I.setElementaryStreamInfo(g.ElementaryStreamTypes.AUDIO,q,ye,Fe,Be),this.bufferFragmentData(ie,I,B,p)}if(X!=null&&(s=X.samples)!==null&&s!==void 0&&s.length){var We={frag:I,id:a,samples:X.samples};E.trigger(U.Events.FRAG_PARSING_METADATA,We)}if(F){var ze={frag:I,id:a,samples:F.samples};E.trigger(U.Events.FRAG_PARSING_USERDATA,ze)}},_._bufferInitSegment=function(h,s,a,E){var v=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!s.audio&&!s.video,this.altAudio&&!this.audioOnly&&delete s.audio;var p=s.audio,L=s.video,I=s.audiovideo;if(p){var B=h.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),p.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(B="mp4a.40.5")),z.indexOf("android")!==-1&&p.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),h.audioCodec&&h.audioCodec!==B&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+B+'"'),p.levelCodec=B,p.id="main",this.log("Init audio buffer, container:"+p.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(h.audioCodec||"")+"/"+p.codec+"]")}L&&(L.levelCodec=h.videoCodec,L.id="main",this.log("Init video buffer, container:"+L.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+L.codec+"]")),I&&this.log("Init audiovideo buffer, container:"+I.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+I.codec+"]"),this.hls.trigger(U.Events.BUFFER_CODECS,s),Object.keys(s).forEach(function(j){var F=s[j],X=F.initSegment;X!=null&&X.byteLength&&v.hls.trigger(U.Events.BUFFER_APPENDING,{type:j,data:X,frag:a,part:null,chunkMeta:E,parent:a.type})}),this.tick()},_.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var s=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,s?this.resetFragmentLoading(h):this.state=M.State.BACKTRACKING},_.checkFragmentChanged=function(){var h=this.media,s=null;if(h&&h.readyState>1&&h.seeking===!1){var a=h.currentTime;if(k.BufferHelper.isBuffered(h,a)?s=this.getAppendedFrag(a):k.BufferHelper.isBuffered(h,a+.1)&&(s=this.getAppendedFrag(a+.1)),s){var E=this.fragPlaying,v=s.level;(!E||s.sn!==E.sn||E.level!==v||s.urlId!==E.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:s}),(!E||E.level!==v)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:v}),this.fragPlaying=s)}}},o(l,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);if(s)return s.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var s=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(s)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),l}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"SubtitleStreamController",function(){return d});var W=A("./src/events.ts"),M=A("./src/utils/logger.ts"),P=A("./src/utils/buffer-helper.ts"),U=A("./src/controller/fragment-finders.ts"),k=A("./src/utils/discontinuities.ts"),R=A("./src/controller/level-helper.ts"),D=A("./src/controller/fragment-tracker.ts"),g=A("./src/controller/base-stream-controller.ts"),b=A("./src/types/loader.ts"),O=A("./src/types/level.ts");function T(u,w){for(var y=0;y<w.length;y++){var m=w[y];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function x(u,w,y){return w&&T(u.prototype,w),y&&T(u,y),u}function S(u,w){u.prototype=Object.create(w.prototype),u.prototype.constructor=u,c(u,w)}function c(u,w){return c=Object.setPrototypeOf||function(m,l){return m.__proto__=l,m},c(u,w)}var o=500,d=function(u){S(w,u);function w(m,l){var _;return _=u.call(this,m,l,"[subtitle-stream-controller]")||this,_.levels=[],_.currentTrackId=-1,_.tracksBuffered=[],_.mainDetails=null,_._registerListeners(),_}var y=w.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var l=this.hls;l.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(W.Events.ERROR,this.onError,this),l.on(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.on(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.on(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y._unregisterListeners=function(){var l=this.hls;l.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(W.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(W.Events.ERROR,this.onError,this),l.off(W.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(W.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),l.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),l.off(W.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),l.off(W.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y.startLoad=function(){this.stopLoad(),this.state=g.State.IDLE,this.setInterval(o),this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},y.onLevelLoaded=function(l,_){this.mainDetails=_.details},y.onSubtitleFragProcessed=function(l,_){var f=_.frag,h=_.success;if(this.fragPrevious=f,this.state=g.State.IDLE,!h)return;var s=this.tracksBuffered[this.currentTrackId];if(!s)return;for(var a,E=f.start,v=0;v<s.length;v++)if(E>=s[v].start&&E<=s[v].end){a=s[v];break}var p=f.start+f.duration;a?a.end=p:(a={start:E,end:p},s.push(a)),this.fragmentTracker.fragBuffered(f)},y.onBufferFlushing=function(l,_){var f=_.startOffset,h=_.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var s=this.currentTrackId,a=this.levels;if(!a.length||!a[s]||!a[s].details)return;var E=a[s].details,v=E.targetduration,p=h-v;if(p<=0)return;_.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(L){for(var I=0;I<L.length;){if(L[I].end<=p){L.shift();continue}else if(L[I].start<p)L[I].start=p;else break;I++}}),this.fragmentTracker.removeFragmentsInRange(f,p,b.PlaylistLevelType.SUBTITLE)}},y.onError=function(l,_){var f,h=_.frag;if(!h||h.type!==b.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=g.State.IDLE},y.onSubtitleTracksUpdated=function(l,_){var f=this,h=_.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(s){return new O.Level(s)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(s){f.tracksBuffered[s.id]=[]}),this.mediaBuffer=null},y.onSubtitleTrackSwitch=function(l,_){if(this.currentTrackId=_.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},y.onSubtitleTrackLoaded=function(l,_){var f,h=_.details,s=_.id,a=this.currentTrackId,E=this.levels;if(!E.length)return;var v=E[a];if(s>=E.length||s!==a||!v)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=v.details)!==null&&f!==void 0&&f.live){var p=this.mainDetails;if(h.deltaUpdateFailed||!p)return;var L=p.fragments[0];if(!v.details)h.hasProgramDateTime&&p.hasProgramDateTime?Object(k.alignMediaPlaylistByPDT)(h,p):L&&Object(R.addSliding)(h,L.start);else{var I=this.alignPlaylists(h,v.details);I===0&&L&&Object(R.addSliding)(h,L.start)}}if(v.details=h,this.levelLastLoaded=s,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===g.State.IDLE){var B=Object(U.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0)}},y._handleFragmentLoadComplete=function(l){var _=l.frag,f=l.payload,h=_.decryptdata,s=this.hls;if(this.fragContextChanged(_))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(E){var v=performance.now();s.trigger(W.Events.FRAG_DECRYPTED,{frag:_,payload:E,stats:{tstart:a,tdecrypt:v}})})}},y.doTick=function(){if(!this.media){this.state=g.State.IDLE;return}if(this.state===g.State.IDLE){var l,_=this.currentTrackId,f=this.levels;if(!f.length||!f[_]||!f[_].details)return;var h=f[_].details,s=h.targetduration,a=this.config,E=this.media,v=P.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-s,a.maxBufferHole),p=v.end,L=v.len,I=this.getMaxBufferLength()+s;if(L>I)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var B=h.fragments,z=B.length,j=h.edge,F,X=this.fragPrevious;if(p<j){var te=a.maxFragLookUpTolerance;X&&h.hasProgramDateTime&&(F=Object(U.findFragmentByPDT)(B,X.endProgramDateTime,te)),F||(F=Object(U.findFragmentByPTS)(X,B,p,te),!F&&X&&X.start<B[0].start&&(F=B[0]))}else F=B[z-1];(l=F)!==null&&l!==void 0&&l.encrypted?(M.logger.log("Loading key for "+F.sn),this.state=g.State.KEY_LOADING,this.hls.trigger(W.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===D.FragmentState.NOT_LOADED&&this.loadFragment(F,h,p)}},y.loadFragment=function(l,_,f){this.fragCurrent=l,u.prototype.loadFragment.call(this,l,_,f)},x(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(g.default)},"./src/controller/subtitle-track-controller.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/events.ts"),M=A("./src/utils/texttrack-utils.ts"),P=A("./src/controller/base-playlist-controller.ts"),U=A("./src/types/loader.ts");function k(T,x){for(var S=0;S<x.length;S++){var c=x[S];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(T,c.key,c)}}function R(T,x,S){return x&&k(T.prototype,x),S&&k(T,S),T}function D(T,x){T.prototype=Object.create(x.prototype),T.prototype.constructor=T,g(T,x)}function g(T,x){return g=Object.setPrototypeOf||function(c,o){return c.__proto__=o,c},g(T,x)}var b=function(T){D(x,T);function x(c){var o;return o=T.call(this,c,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var S=x.prototype;return S.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,T.prototype.destroy.call(this)},S.registerListeners=function(){var o=this.hls;o.on(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(W.Events.ERROR,this.onError,this)},S.unregisterListeners=function(){var o=this.hls;o.off(W.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(W.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(W.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(W.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(W.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(W.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(W.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(W.Events.ERROR,this.onError,this)},S.onMediaAttached=function(o,d){if(this.media=d.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)},S.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},S.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=O(this.media.textTracks);o.forEach(function(d){Object(M.clearCurrentCues)(d)}),this.subtitleTrack=-1,this.media=null},S.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},S.onManifestParsed=function(o,d){this.tracks=d.subtitleTracks},S.onSubtitleTrackLoaded=function(o,d){var u=d.id,w=d.details,y=this.trackId,m=this.tracksInGroup[y];if(!m){this.warn("Invalid subtitle track id "+u);return}var l=m.details;m.details=d.details,this.log("subtitle track "+u+" loaded ["+w.startSN+"-"+w.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,d,l))},S.onLevelLoading=function(o,d){this.switchLevel(d.level)},S.onLevelSwitching=function(o,d){this.switchLevel(d.level)},S.switchLevel=function(o){var d=this.hls.levels[o];if(!(d!=null&&d.textGroupIds))return;var u=d.textGroupIds[d.urlId];if(this.groupId!==u){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,y=this.tracks.filter(function(_){return!u||_.groupId===u});this.tracksInGroup=y;var m=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=u;var l={subtitleTracks:y};this.log("Updating subtitle tracks, "+y.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(W.Events.SUBTITLE_TRACKS_UPDATED,l),m!==-1&&this.setSubtitleTrack(m,w)}},S.findTrackId=function(o){for(var d=this.tracksInGroup,u=0;u<d.length;u++){var w=d[u];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},S.onError=function(o,d){if(T.prototype.onError.call(this,o,d),d.fatal||!d.context)return;d.context.type===U.PlaylistContextType.SUBTITLE_TRACK&&d.context.id===this.trackId&&d.context.groupId===this.groupId&&this.retryLoadingOrFail(d)},S.loadPlaylist=function(o){var d=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(d)){var u=d.id,w=d.groupId,y=d.url;if(o)try{y=o.addDirectives(y)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(W.Events.SUBTITLE_TRACK_LOADING,{url:y,id:u,groupId:w,deliveryDirectives:o||null})}},S.toggleTrackModes=function(o){var d=this,u=this.media,w=this.subtitleDisplay,y=this.trackId;if(!u)return;var m=O(u.textTracks),l=m.filter(function(h){return h.groupId===d.groupId});if(o===-1)[].slice.call(m).forEach(function(h){h.mode="disabled"});else{var _=l[y];_&&(_.mode="disabled")}var f=l[o];f&&(f.mode=w?"showing":"hidden")},S.setSubtitleTrack=function(o,d){var u,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=w[o])!==null&&u!==void 0&&u.details)||o<-1||o>=w.length)return;this.clearTimer();var y=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,y){var m=y.id,l=y.groupId,_=l===void 0?"":l,f=y.name,h=y.type,s=y.url;this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:_,name:f,type:h,url:s});var a=this.switchParams(y.url,d==null?void 0:d.details);this.loadPlaylist(a)}else this.hls.trigger(W.Events.SUBTITLE_TRACK_SWITCH,{id:o})},S.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,d=O(this.media.textTracks),u=0;u<d.length;u++)if(d[u].mode==="hidden")o=u;else if(d[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var d=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,d)}}]),x}(P.default);function O(T){for(var x=[],S=0;S<T.length;S++){var c=T[S];c.kind==="subtitles"&&c.label&&x.push(T[S])}return x}K.default=b},"./src/controller/timeline-controller.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"TimelineController",function(){return O});var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/utils/cea-608-parser.ts"),U=A("./src/utils/output-filter.ts"),k=A("./src/utils/webvtt-parser.ts"),R=A("./src/utils/texttrack-utils.ts"),D=A("./src/utils/imsc1-ttml-parser.ts"),g=A("./src/types/loader.ts"),b=A("./src/utils/logger.ts"),O=function(){function c(d){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=S(),this.captionsProperties=void 0,this.hls=d,this.config=d.config,this.Cues=d.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 u=new U.default(this,"textTrack1"),w=new U.default(this,"textTrack2"),y=new U.default(this,"textTrack3"),m=new U.default(this,"textTrack4");this.cea608Parser1=new P.default(1,u,w),this.cea608Parser2=new P.default(3,y,m)}d.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.on(M.Events.FRAG_LOADING,this.onFragLoading,this),d.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=c.prototype;return o.destroy=function(){var u=this.hls;u.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(M.Events.FRAG_LOADING,this.onFragLoading,this),u.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,w,y,m,l){for(var _=!1,f=l.length;f--;){var h=l[f],s=x(h[0],h[1],w,y);if(s>=0&&(h[0]=Math.min(h[0],w),h[1]=Math.max(h[1],y),_=!0,s/(y-w)>.5))return}if(_||l.push([w,y]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,w,y,m)}else{var E=this.Cues.newCue(null,w,y,m);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:E,track:u})}},o.onInitPtsFound=function(u,w){var y=this,m=w.frag,l=w.id,_=w.initPTS,f=w.timescale,h=this.unparsedVttFrags;l==="main"&&(this.initPTS[m.cc]=_,this.timescale[m.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(s){y.onFragLoaded(M.Events.FRAG_LOADED,s)}))},o.getExistingTrack=function(u){var w=this.media;if(w)for(var y=0;y<w.textTracks.length;y++){var m=w.textTracks[y];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var w=this.captionsProperties,y=this.captionsTracks,m=this.media,l=w[u],_=l.label,f=l.languageCode,h=this.getExistingTrack(u);if(h)y[u]=h,Object(R.clearCurrentCues)(y[u]),Object(R.sendAddTrackEvent)(y[u],m);else{var s=this.createTextTrack("captions",_,f);s&&(s[u]=!0,y[u]=s)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var w=this.captionsProperties[u];if(!w)return;var y=w.label,m={_id:u,label:y,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,w,y){var m=this.media;return m?m.addTextTrack(u,w,y):void 0},o.onMediaAttaching=function(u,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(w){Object(R.clearCurrentCues)(u[w]),delete u[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=S(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var w=u.textTracks;if(w)for(var y=0;y<w.length;y++)Object(R.clearCurrentCues)(w[y])},o.onSubtitleTracksUpdated=function(u,w){var y=this;this.textTracks=[];var m=w.subtitleTracks||[],l=m.some(function(s){return s.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||l&&this.config.enableIMSC1){var _=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(s,a){var E;if(a<f.length){for(var v=null,p=0;p<f.length;p++)if(T(f[p],s)){v=f[p];break}v&&(E=v)}E?Object(R.clearCurrentCues)(E):(E=y.createTextTrack("subtitles",s.name,s.lang),E&&(E.mode="disabled")),E&&(E.groupId=s.groupId,y.textTracks.push(E))})}else if(!_&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(s){return{label:s.name,kind:s.type.toLowerCase(),default:s.default,subtitleTrack:s}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},o.onManifestLoaded=function(u,w){var y=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(m){var l=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!l)return;var _="textTrack"+l[1],f=y.captionsProperties[_];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},o.onFragLoading=function(u,w){var y=this.cea608Parser1,m=this.cea608Parser2,l=this.lastSn,_=this.lastPartIndex;if(!this.enabled||!(y&&m))return;if(w.frag.type===g.PlaylistLevelType.MAIN){var f,h,s=w.frag.sn,a=(f=w==null||((h=w.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;s===l+1||s===l&&a===_+1||(y.reset(),m.reset()),this.lastSn=s,this.lastPartIndex=a}},o.onFragLoaded=function(u,w){var y=w.frag,m=w.payload,l=this.initPTS,_=this.unparsedVttFrags;if(y.type===g.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(W.isFiniteNumber)(l[y.cc])){_.push(w),l.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Missing initial subtitle PTS")});return}var f=y.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[y.level],s=this.vttCCs;s[y.cc]||(s[y.cc]={start:y.start,prevCC:this.prevCC,new:!0},this.prevCC=y.cc),h&&h.textCodec===D.IMSC1_CODEC?this._parseIMSC1(y,m):this._parseVTTs(y,m,s)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,w){var y=this,m=this.hls;Object(D.parseIMSC1)(w,this.initPTS[u.cc],this.timescale[u.cc],function(l){y._appendCues(l,u.level),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(l){b.logger.log("Failed to parse IMSC1: "+l),m.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:l})})},o._parseVTTs=function(u,w,y){var m=this,l=this.hls;Object(k.parseWebVTT)(w,this.initPTS[u.cc],this.timescale[u.cc],y,u.cc,u.start,function(_){m._appendCues(_,u.level),l.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(_){m._fallbackToIMSC1(u,w),b.logger.log("Failed to parse VTT cue: "+_),l.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:_})})},o._fallbackToIMSC1=function(u,w){var y=this,m=this.tracks[u.level];m.textCodec||Object(D.parseIMSC1)(w,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=D.IMSC1_CODEC,y._parseIMSC1(u,w)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,w){var y=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[w];if(m.mode==="disabled")return;u.forEach(function(f){return Object(R.addCueToTrack)(m,f)})}else{var l=this.tracks[w],_=l.default?"default":"subtitles"+w;y.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:u,track:_})}},o.onFragDecrypted=function(u,w){var y=w.frag;if(y.type===g.PlaylistLevelType.SUBTITLE){if(!Object(W.isFiniteNumber)(this.initPTS[y.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(M.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,w){var y=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(y&&m))return;for(var l=0;l<w.samples.length;l++){var _=w.samples[l].bytes;if(_){var f=this.extractCea608Data(_);y.addData(w.samples[l].pts,f[0]),m.addData(w.samples[l].pts,f[1])}}},o.onBufferFlushing=function(u,w){var y=w.startOffset,m=w.endOffset,l=w.endOffsetSubtitles,_=w.type,f=this.media;if(!f||f.currentTime<m)return;if(!_||_==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(a){return Object(R.removeCuesInRange)(h[a],y,m)})}if(this.config.renderTextTracksNatively&&(y===0&&l!==void 0)){var s=this.textTracks;Object.keys(s).forEach(function(a){return Object(R.removeCuesInRange)(s[a],y,l)})}},o.extractCea608Data=function(u){for(var w=u[0]&31,y=2,m=[[],[]],l=0;l<w;l++){var _=u[y++],f=127&u[y++],h=127&u[y++],s=(4&_)!==0,a=3&_;if(f===0&&h===0)continue;s&&((a===0||a===1)&&(m[a].push(f),m[a].push(h)))}return m},c}();function T(c,o){return c&&c.label===o.name&&!(c.textTrack1||c.textTrack2)}function x(c,o,d,u){return Math.min(o,u)-Math.max(c,d)}function S(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(U,k){this.subtle=void 0,this.aesIV=void 0,this.subtle=U,this.aesIV=k}var P=M.prototype;return P.decrypt=function(k,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,k)},M}()},"./src/crypt/aes-decryptor.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"removePadding",function(){return M}),A.d(K,"default",function(){return P});var W=A("./src/utils/typed-array.ts");function M(U){var k=U.byteLength,R=k&&new DataView(U.buffer).getUint8(k-1);return R?Object(W.sliceUint8)(U,0,k-R):U}var P=function(){function U(){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=U.prototype;return k.uint8ArrayToUint32Array_=function(D){for(var g=new DataView(D),b=new Uint32Array(4),O=0;O<4;O++)b[O]=g.getUint32(O*4);return b},k.initTable=function(){var D=this.sBox,g=this.invSBox,b=this.subMix,O=b[0],T=b[1],x=b[2],S=b[3],c=this.invSubMix,o=c[0],d=c[1],u=c[2],w=c[3],y=new Uint32Array(256),m=0,l=0,_=0;for(_=0;_<256;_++)_<128?y[_]=_<<1:y[_]=_<<1^283;for(_=0;_<256;_++){var f=l^l<<1^l<<2^l<<3^l<<4;f=f>>>8^f&255^99,D[m]=f,g[f]=m;var h=y[m],s=y[h],a=y[s],E=y[f]*257^f*16843008;O[m]=E<<24|E>>>8,T[m]=E<<16|E>>>16,x[m]=E<<8|E>>>24,S[m]=E,E=a*16843009^s*65537^h*257^m*16843008,o[f]=E<<24|E>>>8,d[f]=E<<16|E>>>16,u[f]=E<<8|E>>>24,w[f]=E,m?(m=h^y[y[y[a^h]]],l^=y[y[l]]):m=l=1}},k.expandKey=function(D){for(var g=this.uint8ArrayToUint32Array_(D),b=!0,O=0;O<g.length&&b;)b=g[O]===this.key[O],O++;if(b)return;this.key=g;var T=this.keySize=g.length;if(T!==4&&T!==6&&T!==8)throw new Error("Invalid aes key size="+T);var x=this.ksRows=(T+6+1)*4,S,c,o=this.keySchedule=new Uint32Array(x),d=this.invKeySchedule=new Uint32Array(x),u=this.sBox,w=this.rcon,y=this.invSubMix,m=y[0],l=y[1],_=y[2],f=y[3],h,s;for(S=0;S<x;S++){if(S<T){h=o[S]=g[S];continue}s=h,S%T===0?(s=s<<8|s>>>24,s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255],s^=w[S/T|0]<<24):T>6&&S%T===4&&(s=u[s>>>24]<<24|u[s>>>16&255]<<16|u[s>>>8&255]<<8|u[s&255]),o[S]=h=(o[S-T]^s)>>>0}for(c=0;c<x;c++)S=x-c,c&3?s=o[S]:s=o[S-4],c<4||S<=4?d[c]=s:d[c]=m[u[s>>>24]]^l[u[s>>>16&255]]^_[u[s>>>8&255]]^f[u[s&255]],d[c]=d[c]>>>0},k.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},k.decrypt=function(D,g,b){for(var O=this.keySize+6,T=this.invKeySchedule,x=this.invSBox,S=this.invSubMix,c=S[0],o=S[1],d=S[2],u=S[3],w=this.uint8ArrayToUint32Array_(b),y=w[0],m=w[1],l=w[2],_=w[3],f=new Int32Array(D),h=new Int32Array(f.length),s,a,E,v,p,L,I,B,z,j,F,X,te,ie,le=this.networkToHostOrderSwap;g<f.length;){for(z=le(f[g]),j=le(f[g+1]),F=le(f[g+2]),X=le(f[g+3]),p=z^T[0],L=X^T[1],I=F^T[2],B=j^T[3],te=4,ie=1;ie<O;ie++)s=c[p>>>24]^o[L>>16&255]^d[I>>8&255]^u[B&255]^T[te],a=c[L>>>24]^o[I>>16&255]^d[B>>8&255]^u[p&255]^T[te+1],E=c[I>>>24]^o[B>>16&255]^d[p>>8&255]^u[L&255]^T[te+2],v=c[B>>>24]^o[p>>16&255]^d[L>>8&255]^u[I&255]^T[te+3],p=s,L=a,I=E,B=v,te=te+4;s=x[p>>>24]<<24^x[L>>16&255]<<16^x[I>>8&255]<<8^x[B&255]^T[te],a=x[L>>>24]<<24^x[I>>16&255]<<16^x[B>>8&255]<<8^x[p&255]^T[te+1],E=x[I>>>24]<<24^x[B>>16&255]<<16^x[p>>8&255]<<8^x[L&255]^T[te+2],v=x[B>>>24]<<24^x[p>>16&255]<<16^x[L>>8&255]<<8^x[I&255]^T[te+3],h[g]=le(s^y),h[g+1]=le(v^m),h[g+2]=le(E^l),h[g+3]=le(a^_),y=z,m=j,l=F,_=X,g=g+4}return h.buffer},U}()},"./src/crypt/decrypter.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return g});var W=A("./src/crypt/aes-crypto.ts"),M=A("./src/crypt/fast-aes-key.ts"),P=A("./src/crypt/aes-decryptor.ts"),U=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),R=A("./src/utils/typed-array.ts"),D=16,g=function(){function b(T,x,S){var c=S===void 0?{}:S,o=c.removePKCS7Padding,d=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=T,this.config=x,this.removePKCS7Padding=d,d)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=b.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var S=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(P.removePadding)(S):S},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(x,S,c,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),S,c);var d=this.flush();d&&o(d.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),S,c).then(o)},O.softwareDecrypt=function(x,S,c){var o=this.currentIV,d=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(x=Object(k.appendUint8Array)(u,x),this.remainderData=null);var w=this.getValidChunk(x);if(!w.length)return null;o&&(c=o);var y=this.softwareDecrypter;y||(y=this.softwareDecrypter=new P.default),y.expandKey(S);var m=d;return this.currentResult=y.decrypt(w.buffer,0,c),this.currentIV=Object(R.sliceUint8)(w,-16).buffer,m||null},O.webCryptoDecrypt=function(x,S,c){var o=this,d=this.subtle;return(this.key!==S||!this.fastAesKey)&&(this.key=S,this.fastAesKey=new M.default(d,S)),this.fastAesKey.expandKey().then(function(u){if(!d)return Promise.reject(new Error("web crypto not initialized"));var w=new W.default(d,c);return w.decrypt(x.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,x,S,c)})},O.onWebCryptoError=function(x,S,c,o){return U.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(S,c,o)},O.getValidChunk=function(x){var S=x,c=x.length-x.length%D;return c!==x.length&&(S=Object(R.sliceUint8)(x,0,c),this.remainderData=Object(R.sliceUint8)(x,c)),S},O.logOnce=function(x){if(!this.logEnabled)return;U.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},b}()},"./src/crypt/fast-aes-key.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(U,k){this.subtle=void 0,this.key=void 0,this.subtle=U,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(Z,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/adts.ts"),P=A("./src/utils/logger.ts"),U=A("./src/demux/id3.ts");function k(g,b){g.prototype=Object.create(b.prototype),g.prototype.constructor=g,R(g,b)}function R(g,b){return R=Object.setPrototypeOf||function(T,x){return T.__proto__=x,T},R(g,b)}var D=function(g){k(b,g);function b(T,x){var S;return S=g.call(this)||this,S.observer=void 0,S.config=void 0,S.observer=T,S.config=x,S}var O=b.prototype;return O.resetInitSegment=function(x,S,c){g.prototype.resetInitSegment.call(this,x,S,c),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:c,inputTimeScale:9e4,dropped:0}},b.probe=function(x){if(!x)return!1;for(var S=U.getID3Data(x,0)||[],c=S.length,o=x.length;c<o;c++)if(M.probe(x,c))return P.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(x,S){return M.canParse(x,S)},O.appendFrame=function(x,S,c){M.initTrackConfig(x,this.observer,S,c,x.manifestCodec);var o=M.appendFrame(x,S,c,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},b}(W.default);D.minProbeByteLength=9,K.default=D},"./src/demux/adts.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"getAudioConfig",function(){return U}),A.d(K,"isHeaderPattern",function(){return k}),A.d(K,"getHeaderLength",function(){return R}),A.d(K,"getFullFrameLength",function(){return D}),A.d(K,"canGetFrameLength",function(){return g}),A.d(K,"isHeader",function(){return b}),A.d(K,"canParse",function(){return O}),A.d(K,"probe",function(){return T}),A.d(K,"initTrackConfig",function(){return x}),A.d(K,"getFrameDuration",function(){return S}),A.d(K,"parseFrameHeader",function(){return c}),A.d(K,"appendFrame",function(){return o});var W=A("./src/utils/logger.ts"),M=A("./src/errors.ts"),P=A("./src/events.ts");function U(d,u,w,y){var m,l,_,f,h=navigator.userAgent.toLowerCase(),s=y,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[w+2]&192)>>>6)+1;var E=(u[w+2]&60)>>>2;if(E>a.length-1){d.trigger(P.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return _=(u[w+2]&1)<<2,_|=(u[w+3]&192)>>>6,W.logger.log("manifest codec:"+y+", ADTS type:"+m+", samplingIndex:"+E),/firefox/i.test(h)?E>=6?(m=5,f=new Array(4),l=E-3):(m=2,f=new Array(2),l=E):h.indexOf("android")!==-1?(m=2,f=new Array(2),l=E):(m=5,f=new Array(4),y&&(y.indexOf("mp4a.40.29")!==-1||y.indexOf("mp4a.40.5")!==-1)||!y&&E>=6?l=E-3:((y&&y.indexOf("mp4a.40.2")!==-1&&(E>=6&&_===1||/vivaldi/i.test(h))||!y&&_===1)&&(m=2,f=new Array(2)),l=E)),f[0]=m<<3,f[0]|=(E&14)>>1,f[1]|=(E&1)<<7,f[1]|=_<<3,m===5&&(f[1]|=(l&14)>>1,f[2]=(l&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[E],channelCount:_,codec:"mp4a.40."+m,manifestCodec:s}}function k(d,u){return d[u]===255&&(d[u+1]&246)===240}function R(d,u){return d[u+1]&1?7:9}function D(d,u){return(d[u+3]&3)<<11|d[u+4]<<3|(d[u+5]&224)>>>5}function g(d,u){return u+5<d.length}function b(d,u){return u+1<d.length&&k(d,u)}function O(d,u){return g(d,u)&&k(d,u)&&D(d,u)<=d.length-u}function T(d,u){if(b(d,u)){var w=R(d,u);if(u+w>=d.length)return!1;var y=D(d,u);if(y<=w)return!1;var m=u+y;return m===d.length||b(d,m)}return!1}function x(d,u,w,y,m){if(!d.samplerate){var l=U(u,w,y,m);if(!l)return;d.config=l.config,d.samplerate=l.samplerate,d.channelCount=l.channelCount,d.codec=l.codec,d.manifestCodec=l.manifestCodec,W.logger.log("parsed codec:"+d.codec+", rate:"+l.samplerate+", channels:"+l.channelCount)}}function S(d){return 1024*9e4/d}function c(d,u,w,y,m){var l=R(d,u),_=D(d,u);if(_-=l,_>0){var f=w+y*m;return{headerLength:l,frameLength:_,stamp:f}}}function o(d,u,w,y,m){var l=S(d.samplerate),_=c(u,w,y,m,l);if(_){var f=_.frameLength,h=_.headerLength,s=_.stamp,a=h+f,E=Math.max(0,w+a-u.length),v;E?(v=new Uint8Array(a-h),v.set(u.subarray(w+h,u.length),0)):v=u.subarray(w+h,w+a);var p={unit:v,pts:s};return E||d.samples.push(p),{sample:p,length:a,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"initPTSFn",function(){return D});var W=A("./src/polyfills/number.ts"),M=A("./src/demux/id3.ts"),P=A("./src/demux/dummy-demuxed-track.ts"),U=A("./src/utils/mp4-tools.ts"),k=A("./src/utils/typed-array.ts"),R=function(){function g(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var b=g.prototype;return b.resetInitSegment=function(T,x,S){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},b.resetTimeStamp=function(){},b.resetContiguity=function(){},b.canParse=function(T,x){return!1},b.appendFrame=function(T,x,S){},b.demux=function(T,x){this.cachedData&&(T=Object(U.appendUint8Array)(this.cachedData,T),this.cachedData=null);var S=M.getID3Data(T,0),c=S?S.length:0,o,d,u=this._audioTrack,w=this._id3Track,y=S?M.getTimeStamp(S):void 0,m=T.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(y,x)),S&&S.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:S}),d=this.initPTS;c<m;){if(this.canParse(T,c)){var l=this.appendFrame(u,T,c);l?(this.frameIndex++,d=l.sample.pts,c+=l.length,o=c):c=m}else M.canParse(T,c)?(S=M.getID3Data(T,c),w.samples.push({pts:d,dts:d,data:S}),c+=S.length,o=c):c++;if(c===m&&o!==m){var _=Object(k.sliceUint8)(T,o);this.cachedData?this.cachedData=Object(U.appendUint8Array)(this.cachedData,_):this.cachedData=_}}return{audioTrack:u,avcTrack:Object(P.dummyTrack)(),id3Track:w,textTrack:Object(P.dummyTrack)()}},b.demuxSampleAes=function(T,x,S){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},b.flush=function(T){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(P.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(P.dummyTrack)()}},b.destroy=function(){},g}(),D=function(b,O){return Object(W.isFiniteNumber)(b)?b*90:O*9e4};K.default=R},"./src/demux/chunk-cache.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function P(){this.chunks=[],this.dataLength=0}var U=P.prototype;return U.push=function(R){this.chunks.push(R),this.dataLength+=R.length},U.flush=function(){var R=this.chunks,D=this.dataLength,g;if(R.length)R.length===1?g=R[0]:g=M(R,D);else return new Uint8Array(0);return this.reset(),g},U.reset=function(){this.chunks.length=0,this.dataLength=0},P}();function M(P,U){for(var k=new Uint8Array(U),R=0,D=0;D<P.length;D++){var g=P[D];k.set(g,R),R+=g.length}return k}},"./src/demux/dummy-demuxed-track.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"dummyTrack",function(){return W});function W(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./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 U=P.prototype;return U.loadWord=function(){var R=this.data,D=this.bytesAvailable,g=R.byteLength-D,b=new Uint8Array(4),O=Math.min(4,D);if(O===0)throw new Error("no bytes available");b.set(R.subarray(g,g+O)),this.word=new DataView(b.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},U.skipBits=function(R){var D;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,D=R>>3,R-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},U.readBits=function(R){var D=Math.min(this.bitsAvailable,R),g=this.word>>>32-D;return R>32&&W.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=R-D,D>0&&this.bitsAvailable?g<<D|this.readBits(D):g},U.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},U.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(R){for(var D=8,g=8,b,O=0;O<R;O++)g!==0&&(b=this.readEG(),g=(D+b+256)%256),D=g===0?D:g},U.readSPS=function(){var R=0,D=0,g=0,b=0,O,T,x,S=this.readUByte.bind(this),c=this.readBits.bind(this),o=this.readUEG.bind(this),d=this.readBoolean.bind(this),u=this.skipBits.bind(this),w=this.skipEG.bind(this),y=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);S();var l=S();if(c(5),u(3),S(),y(),l===100||l===110||l===122||l===244||l===44||l===83||l===86||l===118||l===128){var _=o();if(_===3&&u(1),y(),y(),u(1),d())for(T=_!==3?8:12,x=0;x<T;x++)d()&&(x<6?m(16):m(64))}y();var f=o();if(f===0)o();else if(f===1)for(u(1),w(),w(),O=o(),x=0;x<O;x++)w();y(),u(1);var h=o(),s=o(),a=c(1);a===0&&u(1),u(1),d()&&(R=o(),D=o(),g=o(),b=o());var E=[1,1];if(d()&&d()){var v=S();switch(v){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[S()<<8|S(),S()<<8|S()];break}}}return{width:Math.ceil((h+1)*16-R*2-D*2),height:(2-a)*(s+1)*16-(a?2:4)*(g+b),pixelRatio:E}},U.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},P}();K.default=M},"./src/demux/id3.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"isHeader",function(){return W}),A.d(K,"isFooter",function(){return M}),A.d(K,"getID3Data",function(){return P}),A.d(K,"canParse",function(){return k}),A.d(K,"getTimeStamp",function(){return R}),A.d(K,"isTimeStampFrame",function(){return D}),A.d(K,"getID3Frames",function(){return b}),A.d(K,"decodeFrame",function(){return O}),A.d(K,"utf8ArrayToStr",function(){return o}),A.d(K,"testables",function(){return d});var W=function(m,l){return l+10<=m.length&&(m[l]===73&&m[l+1]===68&&m[l+2]===51&&(m[l+3]<255&&m[l+4]<255&&(m[l+6]<128&&m[l+7]<128&&m[l+8]<128&&m[l+9]<128)))},M=function(m,l){return l+10<=m.length&&(m[l]===51&&m[l+1]===68&&m[l+2]===73&&(m[l+3]<255&&m[l+4]<255&&(m[l+6]<128&&m[l+7]<128&&m[l+8]<128&&m[l+9]<128)))},P=function(m,l){for(var _=l,f=0;W(m,l);){f+=10;var h=U(m,l+6);f+=h,M(m,l+10)&&(f+=10),l+=f}return f>0?m.subarray(_,_+f):void 0},U=function(m,l){var _=0;return _=(m[l]&127)<<21,_|=(m[l+1]&127)<<14,_|=(m[l+2]&127)<<7,_|=m[l+3]&127,_},k=function(m,l){return W(m,l)&&U(m,l+6)+10<=m.length-l},R=function(m){for(var l=b(m),_=0;_<l.length;_++){var f=l[_];if(D(f))return c(f)}return},D=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},g=function(m){var l=String.fromCharCode(m[0],m[1],m[2],m[3]),_=U(m,4),f=10;return{type:l,size:_,data:m.subarray(f,f+_)}},b=function(m){for(var l=0,_=[];W(m,l);){var f=U(m,l+6);l+=10;for(var h=l+f;l+8<h;){var s=g(m.subarray(l)),a=O(s);a&&_.push(a),l+=s.size+10}M(m,l)&&(l+=10)}return _},O=function(m){return m.type==="PRIV"?T(m):m.type[0]==="W"?S(m):x(m)},T=function(m){if(m.size<2)return;var l=o(m.data,!0),_=new Uint8Array(m.data.subarray(l.length+1));return{key:m.type,info:l,data:_.buffer}},x=function(m){if(m.size<2)return;if(m.type==="TXXX"){var l=1,_=o(m.data.subarray(l),!0);l+=_.length+1;var f=o(m.data.subarray(l));return{key:m.type,info:_,data:f}}var h=o(m.data.subarray(1));return{key:m.type,data:h}},S=function(m){if(m.type==="WXXX"){if(m.size<2)return;var l=1,_=o(m.data.subarray(l),!0);l+=_.length+1;var f=o(m.data.subarray(l));return{key:m.type,info:_,data:f}}var h=o(m.data);return{key:m.type,data:h}},c=function(m){if(m.data.byteLength===8){var l=new Uint8Array(m.data),_=l[3]&1,f=(l[4]<<23)+(l[5]<<15)+(l[6]<<7)+l[7];return f/=45,_&&(f+=4772185884e-2),Math.round(f)}return},o=function(m,l){l===void 0&&(l=!1);var _=w();if(_){var f=_.decode(m);if(l){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var s=m.length,a,E,v,p="",L=0;L<s;){if(a=m[L++],a===0&&l)return p;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:p+=String.fromCharCode(a);break;case 12:case 13:E=m[L++],p+=String.fromCharCode((a&31)<<6|E&63);break;case 14:E=m[L++],v=m[L++],p+=String.fromCharCode((a&15)<<12|(E&63)<<6|(v&63)<<0);break;default:}}return p},d={decodeTextFrame:x},u;function w(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/demux/base-audio-demuxer.ts"),M=A("./src/demux/id3.ts"),P=A("./src/utils/logger.ts"),U=A("./src/demux/mpegaudio.ts");function k(g,b){g.prototype=Object.create(b.prototype),g.prototype.constructor=g,R(g,b)}function R(g,b){return R=Object.setPrototypeOf||function(T,x){return T.__proto__=x,T},R(g,b)}var D=function(g){k(b,g);function b(){return g.apply(this,arguments)||this}var O=b.prototype;return O.resetInitSegment=function(x,S,c){g.prototype.resetInitSegment.call(this,x,S,c),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:c,inputTimeScale:9e4,dropped:0}},b.probe=function(x){if(!x)return!1;for(var S=M.getID3Data(x,0)||[],c=S.length,o=x.length;c<o;c++)if(U.probe(x,c))return P.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(x,S){return U.canParse(x,S)},O.appendFrame=function(x,S,c){return this.initPTS===null?void 0:U.appendFrame(x,S,c,this.initPTS,this.frameIndex)},b}(W.default);D.minProbeByteLength=4,K.default=D},"./src/demux/mp4demuxer.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/utils/mp4-tools.ts"),M=A("./src/demux/dummy-demuxed-track.ts"),P=function(){function U(R,D){this.remainderData=null,this.config=void 0,this.config=D}var k=U.prototype;return k.resetTimeStamp=function(){},k.resetInitSegment=function(){},k.resetContiguity=function(){},U.probe=function(D){return Object(W.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},k.demux=function(D){var g=D,b=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(g=Object(W.appendUint8Array)(this.remainderData,D));var O=Object(W.segmentValidRange)(g);this.remainderData=O.remainder,b.samples=O.valid||new Uint8Array}else b.samples=g;return{audioTrack:Object(M.dummyTrack)(),avcTrack:b,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.flush=function(){var D=Object(M.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:D,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},k.demuxSampleAes=function(D,g,b){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},k.destroy=function(){},U}();P.minProbeByteLength=1024,K.default=P},"./src/demux/mpegaudio.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"appendFrame",function(){return R}),A.d(K,"parseHeader",function(){return D}),A.d(K,"isHeaderPattern",function(){return g}),A.d(K,"isHeader",function(){return b}),A.d(K,"canParse",function(){return O}),A.d(K,"probe",function(){return T});var W=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],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],k=[0,1,1,4];function R(x,S,c,o,d){if(c+24>S.length)return;var u=D(S,c);if(u&&c+u.frameLength<=S.length){var w=u.samplesPerFrame*9e4/u.sampleRate,y=o+d*w,m={unit:S.subarray(c,c+u.frameLength),pts:y,dts:y};return x.config=[],x.channelCount=u.channelCount,x.samplerate=u.sampleRate,x.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function D(x,S){var c=x[S+1]>>3&3,o=x[S+1]>>1&3,d=x[S+2]>>4&15,u=x[S+2]>>2&3;if(c!==1&&d!==0&&d!==15&&u!==3){var w=x[S+2]>>1&1,y=x[S+3]>>6,m=c===3?3-o:o===3?3:4,l=M[m*14+d-1]*1e3,_=c===3?0:c===2?1:2,f=P[_*3+u],h=y===3?1:2,s=U[c][o],a=k[o],E=s*8*a,v=Math.floor(s*l/f+w)*a;if(W===null){var p=navigator.userAgent||"",L=p.match(/Chrome\/(\d+)/i);W=L?parseInt(L[1]):0}var I=!!W&&W<=87;return I&&o===2&&l>=224e3&&y===0&&(x[S+3]=x[S+3]|128),{sampleRate:f,channelCount:h,frameLength:v,samplesPerFrame:E}}}function g(x,S){return x[S]===255&&(x[S+1]&224)===224&&(x[S+1]&6)!==0}function b(x,S){return S+1<x.length&&g(x,S)}function O(x,S){var c=4;return g(x,S)&&c<=x.length-S}function T(x,S){if(S+1<x.length&&g(x,S)){var c=4,o=D(x,S),d=c;o!=null&&o.frameLength&&(d=o.frameLength);var u=S+d;return u===x.length||b(x,u)}return!1}},"./src/demux/sample-aes.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/crypt/decrypter.ts"),M=A("./src/demux/tsdemuxer.ts"),P=function(){function U(R,D,g){this.keyData=void 0,this.decrypter=void 0,this.keyData=g,this.decrypter=new W.default(R,D,{removePKCS7Padding:!1})}var k=U.prototype;return k.decryptBuffer=function(D,g){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,g)},k.decryptAacSample=function(D,g,b,O){var T=D[g].unit,x=T.subarray(16,T.length-T.length%16),S=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),c=this;this.decryptBuffer(S,function(o){var d=new Uint8Array(o);T.set(d,16),O||c.decryptAacSamples(D,g+1,b)})},k.decryptAacSamples=function(D,g,b){for(;;g++){if(g>=D.length){b();return}if(D[g].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(D,g,b,O),!O)return}},k.getAvcEncryptedData=function(D){for(var g=Math.floor((D.length-48)/160)*16+16,b=new Int8Array(g),O=0,T=32;T<=D.length-16;T+=160,O+=16)b.set(D.subarray(T,T+16),O);return b},k.getAvcDecryptedUnit=function(D,g){for(var b=new Uint8Array(g),O=0,T=32;T<=D.length-16;T+=160,O+=16)D.set(b.subarray(O,O+16),T);return D},k.decryptAvcSample=function(D,g,b,O,T,x){var S=Object(M.discardEPB)(T.data),c=this.getAvcEncryptedData(S),o=this;this.decryptBuffer(c.buffer,function(d){T.data=o.getAvcDecryptedUnit(S,d),x||o.decryptAvcSamples(D,g,b+1,O)})},k.decryptAvcSamples=function(D,g,b,O){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;g++,b=0){if(g>=D.length){O();return}for(var T=D[g].units;!(b>=T.length);b++){var x=T[b];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var S=this.decrypter.isSync();if(this.decryptAvcSample(D,g,b,O,x,S),!S)return}}},U}();K.default=P},"./src/demux/transmuxer-interface.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return T});var W=A("./node_modules/webworkify-webpack/index.js"),M=A.n(W),P=A("./src/events.ts"),U=A("./src/demux/transmuxer.ts"),k=A("./src/utils/logger.ts"),R=A("./src/errors.ts"),D=A("./src/utils/mediasource-helper.ts"),g=A("./node_modules/eventemitter3/index.js"),b=A.n(g),O=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},T=function(){function x(c,o,d,u){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=c,this.id=o,this.onTransmuxComplete=d,this.onFlush=u;var y=c.config,m=function(s,a){a=a||{},a.frag=w.frag,a.id=w.id,c.trigger(s,a)};this.observer=new g.EventEmitter,this.observer.on(P.Events.FRAG_DECRYPTED,m),this.observer.on(P.Events.ERROR,m);var l={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},_=navigator.vendor;if(y.enableWorker&&typeof Worker!="undefined"){k.logger.log("demuxing in webworker");var f;try{f=this.worker=W("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){c.trigger(P.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},f.postMessage({cmd:"init",typeSupported:l,vendor:_,id:o,config:JSON.stringify(y)})}catch(h){k.logger.warn("Error in worker:",h),k.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new U.default(this.observer,l,y,_,o),this.worker=null}}else this.transmuxer=new U.default(this.observer,l,y,_,o)}var S=x.prototype;return S.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var d=this.transmuxer;d&&(d.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},S.push=function(o,d,u,w,y,m,l,_,f,h){var s=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,E=this.worker,v=m?m.start:y.start,p=y.decryptdata,L=this.frag,I=!(L&&y.cc===L.cc),B=!(L&&f.level===L.level),z=L?f.sn-L.sn:-1,j=this.part?f.part-this.part.index:1,F=!B&&(z===1||z===0&&j===1),X=self.performance.now();(B||z||y.stats.parsing.start===0)&&(y.stats.parsing.start=X),m&&(j||!F)&&(m.stats.parsing.start=X);var te=new U.TransmuxState(I,F,_,B,v);if(!F||I){k.logger.log("[transmuxer-interface, "+y.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+I+`
trackSwitch: `+B+`
contiguous: `+F+`
accurateTimeOffset: `+_+`
timeOffset: `+v);var ie=new U.TransmuxConfig(u,w,d,l,h);this.configureTransmuxer(ie)}if(this.frag=y,this.part=m,E)E.postMessage({cmd:"demux",data:o,decryptdata:p,chunkMeta:f,state:te},o instanceof ArrayBuffer?[o]:[]);else if(a){var le=a.push(o,p,f,te);Object(U.isPromise)(le)?le.then(function(_e){s.handleTransmuxComplete(_e)}):this.handleTransmuxComplete(le)}},S.flush=function(o){var d=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(u){var y=u.flush(o);Object(U.isPromise)(y)?y.then(function(m){d.handleFlushResult(m,o)}):this.handleFlushResult(y,o)}},S.handleFlushResult=function(o,d){var u=this;o.forEach(function(w){u.handleTransmuxComplete(w)}),this.onFlush(d)},S.onWorkerMessage=function(o){var d=o.data,u=this.hls;switch(d.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.id=this.id,u.trigger(d.event,d.data);break}}},S.configureTransmuxer=function(o){var d=this.worker,u=this.transmuxer;d?d.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},S.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return R});var W=A("./src/demux/transmuxer.ts"),M=A("./src/events.ts"),P=A("./src/utils/logger.ts"),U=A("./node_modules/eventemitter3/index.js"),k=A.n(U);function R(T){var x=new U.EventEmitter,S=function(o,d){T.postMessage({event:o,data:d})};x.on(M.Events.FRAG_DECRYPTED,S),x.on(M.Events.ERROR,S),T.addEventListener("message",function(c){var o=c.data;switch(o.cmd){case"init":{var d=JSON.parse(o.config);T.transmuxer=new W.default(x,o.typeSupported,d,o.vendor,o.id),Object(P.enableLogs)(d.debug),S("init",null);break}case"configure":{T.transmuxer.configure(o.config);break}case"demux":{var u=T.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(W.isPromise)(u)?u.then(function(m){D(T,m)}):D(T,u);break}case"flush":{var w=o.chunkMeta,y=T.transmuxer.flush(w);Object(W.isPromise)(y)?y.then(function(m){b(T,m,w)}):b(T,y,w);break}default:break}})}function D(T,x){if(O(x.remuxResult))return;var S=[],c=x.remuxResult,o=c.audio,d=c.video;o&&g(S,o),d&&g(S,d),T.postMessage({event:"transmuxComplete",data:x},S)}function g(T,x){x.data1&&T.push(x.data1.buffer),x.data2&&T.push(x.data2.buffer)}function b(T,x,S){x.forEach(function(c){D(T,c)}),T.postMessage({event:"flush",data:S})}function O(T){return!T.audio&&!T.video&&!T.text&&!T.id3&&!T.initSegment}},"./src/demux/transmuxer.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return d}),A.d(K,"isPromise",function(){return y}),A.d(K,"TransmuxConfig",function(){return m}),A.d(K,"TransmuxState",function(){return l});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/crypt/decrypter.ts"),U=A("./src/demux/aacdemuxer.ts"),k=A("./src/demux/mp4demuxer.ts"),R=A("./src/demux/tsdemuxer.ts"),D=A("./src/demux/mp3demuxer.ts"),g=A("./src/remux/mp4-remuxer.ts"),b=A("./src/remux/passthrough-remuxer.ts"),O=A("./src/demux/chunk-cache.ts"),T=A("./src/utils/mp4-tools.ts"),x=A("./src/utils/logger.ts"),S;try{S=self.performance.now.bind(self.performance)}catch(_){x.logger.debug("Unable to use Performance API on this environment"),S=self.Date.now}var c=[{demux:R.default,remux:g.default},{demux:k.default,remux:b.default},{demux:U.default,remux:g.default},{demux:D.default,remux:g.default}],o=1024;c.forEach(function(_){var f=_.demux;o=Math.max(o,f.minProbeByteLength)});var d=function(){function _(h,s,a,E,v){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=h,this.typeSupported=s,this.config=a,this.vendor=E,this.id=v}var f=_.prototype;return f.configure=function(s){this.transmuxConfig=s,this.decrypter&&this.decrypter.reset()},f.push=function(s,a,E,v){var p=this,L=E.transmuxing;L.executeStart=S();var I=new Uint8Array(s),B=this.cache,z=this.config,j=this.currentTransmuxState,F=this.transmuxConfig;v&&(this.currentTransmuxState=v);var X=u(I,a);if(X&&X.method==="AES-128"){var te=this.getDecrypter();if(z.enableSoftwareAES){var ie=te.softwareDecrypt(I,X.key.buffer,X.iv.buffer);if(!ie)return L.executeEnd=S(),w(E);I=new Uint8Array(ie)}else return this.decryptionPromise=te.webCryptoDecrypt(I,X.key.buffer,X.iv.buffer).then(function(Ae){var Me=p.push(Ae,null,E);return p.decryptionPromise=null,Me}),this.decryptionPromise}var le=v||j,_e=le.contiguous,me=le.discontinuity,he=le.trackSwitch,fe=le.accurateTimeOffset,ce=le.timeOffset,ne=F.audioCodec,q=F.videoCodec,ye=F.defaultInitPts,Fe=F.duration,Be=F.initSegmentData;if((me||he)&&this.resetInitSegment(Be,ne,q,Fe),me&&this.resetInitialTimestamp(ye),_e||this.resetContiguity(),this.needsProbing(I,me,he)){if(B.dataLength){var We=B.flush();I=Object(T.appendUint8Array)(We,I)}this.configureTransmuxer(I,F)}var ze=this.transmux(I,X,ce,fe,E),we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,L.executeEnd=S(),ze},f.flush=function(s){var a=this,E=s.transmuxing;E.executeStart=S();var v=this.decrypter,p=this.cache,L=this.currentTransmuxState,I=this.decryptionPromise;if(I)return I.then(function(){return a.flush(s)});var B=[],z=L.timeOffset;if(v){var j=v.flush();j&&B.push(this.push(j,null,s))}var F=p.dataLength;p.reset();var X=this.demuxer,te=this.remuxer;if(!X||!te)return F>=o&&this.observer.emit(W.Events.ERROR,W.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=S(),[w(s)];var ie=X.flush(z);return y(ie)?ie.then(function(le){return a.flushRemux(B,le,s),B}):(this.flushRemux(B,ie,s),B)},f.flushRemux=function(s,a,E){var v=a.audioTrack,p=a.avcTrack,L=a.id3Track,I=a.textTrack,B=this.currentTransmuxState,z=B.accurateTimeOffset,j=B.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var F=this.remuxer.remux(v,p,L,I,j,z,!0,this.id);s.push({remuxResult:F,chunkMeta:E}),E.transmuxing.executeEnd=S()},f.resetInitialTimestamp=function(s){var a=this.demuxer,E=this.remuxer;if(!a||!E)return;a.resetTimeStamp(s),E.resetTimeStamp(s)},f.resetContiguity=function(){var s=this.demuxer,a=this.remuxer;if(!s||!a)return;s.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(s,a,E,v){var p=this.demuxer,L=this.remuxer;if(!p||!L)return;p.resetInitSegment(a,E,v),L.resetInitSegment(s,a,E)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(s,a,E,v,p){var L;return a&&a.method==="SAMPLE-AES"?L=this.transmuxSampleAes(s,a,E,v,p):L=this.transmuxUnencrypted(s,E,v,p),L},f.transmuxUnencrypted=function(s,a,E,v){var p=this.demuxer.demux(s,a,!1,!this.config.progressive),L=p.audioTrack,I=p.avcTrack,B=p.id3Track,z=p.textTrack,j=this.remuxer.remux(L,I,B,z,a,E,!1,this.id);return{remuxResult:j,chunkMeta:v}},f.transmuxSampleAes=function(s,a,E,v,p){var L=this;return this.demuxer.demuxSampleAes(s,a,E).then(function(I){var B=L.remuxer.remux(I.audioTrack,I.avcTrack,I.id3Track,I.textTrack,E,v,!1,L.id);return{remuxResult:B,chunkMeta:p}})},f.configureTransmuxer=function(s,a){for(var E=this.config,v=this.observer,p=this.typeSupported,L=this.vendor,I=a.audioCodec,B=a.defaultInitPts,z=a.duration,j=a.initSegmentData,F=a.videoCodec,X,te=0,ie=c.length;te<ie;te++)if(c[te].demux.probe(s)){X=c[te];break}X||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:k.default,remux:b.default});var le=this.demuxer,_e=this.remuxer,me=X.remux,he=X.demux;(!_e||!(_e instanceof me))&&(this.remuxer=new me(v,E,p,L)),(!le||!(le instanceof he))&&(this.demuxer=new he(v,E,p),this.probe=he.probe),this.resetInitSegment(j,I,F,z),this.resetInitialTimestamp(B)},f.needsProbing=function(s,a,E){return!this.demuxer||!this.remuxer||a||E},f.getDecrypter=function(){var s=this.decrypter;return s||(s=this.decrypter=new P.default(this.observer,this.config)),s},_}();function u(_,f){var h=null;return _.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var w=function(f){return{remuxResult:{},chunkMeta:f}};function y(_){return"then"in _&&_.then instanceof Function}var m=function(f,h,s,a,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=h,this.initSegmentData=s,this.duration=a,this.defaultInitPts=E},l=function(f,h,s,a,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=h,this.accurateTimeOffset=s,this.trackSwitch=a,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"discardEPB",function(){return w});var W=A("./src/demux/adts.ts"),M=A("./src/demux/mpegaudio.ts"),P=A("./src/demux/exp-golomb.ts"),U=A("./src/demux/id3.ts"),k=A("./src/demux/sample-aes.ts"),R=A("./src/events.ts"),D=A("./src/utils/mp4-tools.ts"),g=A("./src/utils/logger.ts"),b=A("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},T=function(){function y(l,_,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=l,this.config=_,this.typeSupported=f}y.probe=function(_){var f=y.syncOffset(_);return f<0?!1:(f&&g.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},y.syncOffset=function(_){for(var f=Math.min(1e3,_.length-3*188),h=0;h<f;){if(_[h]===71&&_[h+188]===71&&_[h+2*188]===71)return h;h++}return-1},y.createTrack=function(_,f){return{container:_==="video"||_==="audio"?"video/mp2t":void 0,type:_,id:O[_],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:_==="audio"?f:void 0}};var m=y.prototype;return m.resetInitSegment=function(_,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=y.createTrack("video",h),this._audioTrack=y.createTrack("audio",h),this._id3Track=y.createTrack("id3",h),this._txtTrack=y.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=_,this.videoCodec=f,this._duration=h},m.resetTimeStamp=function(){},m.resetContiguity=function(){var _=this._audioTrack,f=this._avcTrack,h=this._id3Track;_&&(_.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(_,f,h,s){h===void 0&&(h=!1),s===void 0&&(s=!1),h||(this.sampleAes=null);var a,E=this._avcTrack,v=this._audioTrack,p=this._id3Track,L=E.pid,I=E.pesData,B=v.pid,z=p.pid,j=v.pesData,F=p.pesData,X=!1,te=this.pmtParsed,ie=this._pmtId,le=_.length;if(this.remainderData&&(_=Object(D.appendUint8Array)(this.remainderData,_),le=_.length,this.remainderData=null),le<188&&!s)return this.remainderData=_,{audioTrack:v,avcTrack:E,id3Track:p,textTrack:this._txtTrack};var _e=Math.max(0,y.syncOffset(_));le-=(le+_e)%188,le<_.byteLength&&!s&&(this.remainderData=new Uint8Array(_.buffer,le,_.buffer.byteLength-le));for(var me=_e;me<le;me+=188)if(_[me]===71){var he=!!(_[me+1]&64),fe=((_[me+1]&31)<<8)+_[me+2],ce=(_[me+3]&48)>>4,ne=void 0;if(ce>1){if(ne=me+5+_[me+4],ne===me+188)continue}else ne=me+4;switch(fe){case L:he&&(I&&(a=o(I))&&this.parseAVCPES(a,!1),I={data:[],size:0}),I&&(I.data.push(_.subarray(ne,me+188)),I.size+=me+188-ne);break;case B:he&&(j&&(a=o(j))&&(v.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),j={data:[],size:0}),j&&(j.data.push(_.subarray(ne,me+188)),j.size+=me+188-ne);break;case z:he&&(F&&(a=o(F))&&this.parseID3PES(a),F={data:[],size:0}),F&&(F.data.push(_.subarray(ne,me+188)),F.size+=me+188-ne);break;case 0:he&&(ne+=_[ne]+1),ie=this._pmtId=S(_,ne);break;case ie:{he&&(ne+=_[ne]+1);var q=c(_,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);L=q.avc,L>0&&(E.pid=L),B=q.audio,B>0&&(v.pid=B,v.isAAC=q.isAAC),z=q.id3,z>0&&(p.pid=z),X&&!te&&(g.logger.log("reparse from beginning"),X=!1,me=_e-188),te=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=I,v.pesData=j,p.pesData=F;var ye={audioTrack:v,avcTrack:E,id3Track:p,textTrack:this._txtTrack};return s&&this.extractRemainingSamples(ye),ye},m.flush=function(){var _=this.remainderData;this.remainderData=null;var f;return _?f=this.demux(_,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(_){var f=_.audioTrack,h=_.avcTrack,s=_.id3Track,a=h.pesData,E=f.pesData,v=s.pesData,p;a&&(p=o(a))?(this.parseAVCPES(p,!0),h.pesData=null):h.pesData=a,E&&(p=o(E))?(f.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),f.pesData=null):(E!=null&&E.size&&g.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),v&&(p=o(v))?(this.parseID3PES(p),s.pesData=null):s.pesData=v},m.demuxSampleAes=function(_,f,h){var s=this.demux(_,h,!0,!this.config.progressive),a=this.sampleAes=new k.default(this.observer,this.config,f);return this.decrypt(s,a)},m.decrypt=function(_,f){return new Promise(function(h){var s=_.audioTrack,a=_.avcTrack;s.samples&&s.isAAC?f.decryptAacSamples(s.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){h(_)}):h(_)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){h(_)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(_,f){var h=this,s=this._avcTrack,a=this.parseAVCNALu(_.data),E=!1,v=this.avcSample,p,L=!1;_.data=null,v&&a.length&&!s.audFound&&(d(v,s),v=this.avcSample=x(!1,_.pts,_.dts,"")),a.forEach(function(I){switch(I.type){case 1:{p=!0,v||(v=h.avcSample=x(!0,_.pts,_.dts,"")),E&&(v.debug+="NDR "),v.frame=!0;var B=I.data;if(L&&B.length>4){var z=new P.default(B).readSliceType();(z===2||z===4||z===7||z===9)&&(v.key=!0)}break}case 5:p=!0,v||(v=h.avcSample=x(!0,_.pts,_.dts,"")),E&&(v.debug+="IDR "),v.key=!0,v.frame=!0;break;case 6:{p=!0,E&&v&&(v.debug+="SEI ");var j=new P.default(w(I.data));j.readUByte();for(var F=0,X=0,te=!1,ie=0;!te&&j.bytesAvailable>1;){F=0;do ie=j.readUByte(),F+=ie;while(ie===255);X=0;do ie=j.readUByte(),X+=ie;while(ie===255);if(F===4&&j.bytesAvailable!==0){te=!0;var le=j.readUByte();if(le===181){var _e=j.readUShort();if(_e===49){var me=j.readUInt();if(me===1195456820){var he=j.readUByte();if(he===3){for(var fe=j.readUByte(),ce=j.readUByte(),ne=31&fe,q=[fe,ce],ye=0;ye<ne;ye++)q.push(j.readUByte()),q.push(j.readUByte()),q.push(j.readUByte());u(h._txtTrack.samples,{type:3,pts:_.pts,bytes:q})}}}}}else if(F===5&&j.bytesAvailable!==0){if(te=!0,X>16){for(var Fe=[],Be=0;Be<16;Be++)Fe.push(j.readUByte().toString(16)),(Be===3||Be===5||Be===7||Be===9)&&Fe.push("-");for(var We=X-16,ze=new Uint8Array(We),we=0;we<We;we++)ze[we]=j.readUByte();u(h._txtTrack.samples,{pts:_.pts,payloadType:F,uuid:Fe.join(""),userData:Object(U.utf8ArrayToStr)(ze),userDataBytes:ze})}}else if(X<j.bytesAvailable)for(var Ae=0;Ae<X;Ae++)j.readUByte()}break}case 7:if(p=!0,L=!0,E&&v&&(v.debug+="SPS "),!s.sps){var Me=new P.default(I.data),je=Me.readSPS();s.width=je.width,s.height=je.height,s.pixelRatio=je.pixelRatio,s.sps=[I.data],s.duration=h._duration;for(var Ie=I.data.subarray(1,4),Oe="avc1.",Te=0;Te<3;Te++){var ct=Ie[Te].toString(16);ct.length<2&&(ct="0"+ct),Oe+=ct}s.codec=Oe}break;case 8:p=!0,E&&v&&(v.debug+="PPS "),s.pps||(s.pps=[I.data]);break;case 9:p=!1,s.audFound=!0,v&&d(v,s),v=h.avcSample=x(!1,_.pts,_.dts,E?"AUD ":"");break;case 12:p=!1;break;default:p=!1,v&&(v.debug+="unknown NAL "+I.type+" ");break}if(v&&p){var rt=v.units;rt.push(I)}}),f&&v&&(d(v,s),this.avcSample=null)},m.getLastNalUnit=function(){var _,f=this.avcSample,h;if(!f||f.units.length===0){var s=this._avcTrack.samples;f=s[s.length-1]}if((_=f)!==null&&_!==void 0&&_.units){var a=f.units;h=a[a.length-1]}return h},m.parseAVCNALu=function(_){var f=_.byteLength,h=this._avcTrack,s=h.naluState||0,a=s,E=[],v=0,p,L,I,B=-1,z=0;for(s===-1&&(B=0,z=_[0]&31,s=0,v=1);v<f;){if(p=_[v++],!s){s=p?0:1;continue}if(s===1){s=p?0:2;continue}if(!p)s=3;else if(p===1){if(B>=0){var j={data:_.subarray(B,v-s-1),type:z};E.push(j)}else{var F=this.getLastNalUnit();if(F&&(a&&v<=4-a&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-a))),L=v-s-1,L>0)){var X=new Uint8Array(F.data.byteLength+L);X.set(F.data,0),X.set(_.subarray(0,L),F.data.byteLength),F.data=X,F.state=0}}v<f?(I=_[v]&31,B=v,z=I,s=0):s=-1}else s=0}if(B>=0&&s>=0){var te={data:_.subarray(B,f),type:z,state:s};E.push(te)}if(E.length===0){var ie=this.getLastNalUnit();if(ie){var le=new Uint8Array(ie.data.byteLength+_.byteLength);le.set(ie.data,0),le.set(_,ie.data.byteLength),ie.data=le}}return h.naluState=s,E},m.parseAACPES=function(_){var f=0,h=this._audioTrack,s=this.aacOverFlow,a=_.data;if(s){this.aacOverFlow=null;var E=s.sample.unit.byteLength,v=Math.min(s.missing,E),p=E-v;s.sample.unit.set(a.subarray(0,v),p),h.samples.push(s.sample),f=s.missing}var L,I;for(L=f,I=a.length;L<I-1&&!W.isHeader(a,L);L++);if(L!==f){var B,z;if(L<I-1?(B="AAC PES did not start with ADTS header,offset:"+L,z=!1):(B="no ADTS header found in AAC PES",z=!0),g.logger.warn("parsing error:"+B),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:b.ErrorTypes.MEDIA_ERROR,details:b.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:B}),z)return}W.initTrackConfig(h,this.observer,a,L,this.audioCodec);var j;if(_.pts!==void 0)j=_.pts;else if(s){var F=W.getFrameDuration(h.samplerate);j=s.sample.pts+F}else{g.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;L<I;)if(W.isHeader(a,L)){if(L+5<I){var te=W.appendFrame(h,a,L,j,X);if(te)if(te.missing)this.aacOverFlow=te;else{L+=te.length,X++;continue}}break}else L++},m.parseMPEGPES=function(_){var f=_.data,h=f.length,s=0,a=0,E=_.pts;if(E===void 0){g.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<h;)if(M.isHeader(f,a)){var v=M.appendFrame(this._audioTrack,f,a,E,s);if(v)a+=v.length,s++;else break}else a++},m.parseID3PES=function(_){if(_.pts===void 0){g.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(_)},y}();T.minProbeByteLength=188;function x(y,m,l,_){return{key:y,frame:!1,pts:m,dts:l,units:[],debug:_,length:0}}function S(y,m){return(y[m+10]&31)<<8|y[m+11]}function c(y,m,l,_){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(y[m+1]&15)<<8|y[m+2],s=m+3+h-4,a=(y[m+10]&15)<<8|y[m+11];for(m+=12+a;m<s;){var E=(y[m+1]&31)<<8|y[m+2];switch(y[m]){case 207:if(!_){g.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=E);break;case 21:f.id3===-1&&(f.id3=E);break;case 219:if(!_){g.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=E);break;case 3:case 4:l?f.audio===-1&&(f.audio=E,f.isAAC=!1):g.logger.log("MPEG audio found, not supported in this browser");break;case 36:g.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((y[m+3]&15)<<8|y[m+4])+5}return f}function o(y){var m=0,l,_,f,h,s,a=y.data;if(!y||y.size===0)return null;for(;a[0].length<19&&a.length>1;){var E=new Uint8Array(a[0].length+a[1].length);E.set(a[0]),E.set(a[1],a[0].length),a[0]=E,a.splice(1,1)}l=a[0];var v=(l[0]<<16)+(l[1]<<8)+l[2];if(v===1){if(_=(l[4]<<8)+l[5],_&&_>y.size-6)return null;var p=l[7];p&192&&(h=(l[9]&14)*536870912+(l[10]&255)*4194304+(l[11]&254)*16384+(l[12]&255)*128+(l[13]&254)/2,p&64?(s=(l[14]&14)*536870912+(l[15]&255)*4194304+(l[16]&254)*16384+(l[17]&255)*128+(l[18]&254)/2,h-s>60*9e4&&(g.logger.warn(Math.round((h-s)/9e4)+"s delta between PTS and DTS, align them"),h=s)):s=h),f=l[8];var L=f+9;if(y.size<=L)return null;y.size-=L;for(var I=new Uint8Array(y.size),B=0,z=a.length;B<z;B++){l=a[B];var j=l.byteLength;if(L)if(L>j){L-=j;continue}else l=l.subarray(L),j-=L,L=0;I.set(l,m),m+=j}return _&&(_-=f+3),{data:I,pts:h,dts:s,len:_}}return null}function d(y,m){if(y.units.length&&y.frame){if(y.pts===void 0){var l=m.samples,_=l.length;if(_){var f=l[_-1];y.pts=f.pts,y.dts=f.dts}else{m.dropped++;return}}m.samples.push(y)}y.debug.length&&g.logger.log(y.pts+"/"+y.dts+":"+y.debug)}function u(y,m){var l=y.length;if(l>0){if(m.pts>=y[l-1].pts)y.push(m);else for(var _=l-1;_>=0;_--)if(m.pts<y[_].pts){y.splice(_,0,m);break}}else y.push(m)}function w(y){for(var m=y.byteLength,l=[],_=1;_<m-2;)y[_]===0&&y[_+1]===0&&y[_+2]===3?(l.push(_+2),_+=2):_++;if(l.length===0)return y;var f=m-l.length,h=new Uint8Array(f),s=0;for(_=0;_<f;s++,_++)s===l[0]&&(s++,l.shift()),h[_]=y[s];return h}K.default=T},"./src/errors.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"ErrorTypes",function(){return W}),A.d(K,"ErrorDetails",function(){return M});var W;(function(P){P.NETWORK_ERROR="networkError",P.MEDIA_ERROR="mediaError",P.KEY_SYSTEM_ERROR="keySystemError",P.MUX_ERROR="muxError",P.OTHER_ERROR="otherError"})(W||(W={}));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(Z,K,A){"use strict";A.r(K),A.d(K,"Events",function(){return W});var W;(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"})(W||(W={}))},"./src/hls.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return y});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W),P=A("./src/loader/playlist-loader.ts"),U=A("./src/loader/key-loader.ts"),k=A("./src/controller/id3-track-controller.ts"),R=A("./src/controller/latency-controller.ts"),D=A("./src/controller/level-controller.ts"),g=A("./src/controller/fragment-tracker.ts"),b=A("./src/controller/stream-controller.ts"),O=A("./src/is-supported.ts"),T=A("./src/utils/logger.ts"),x=A("./src/config.ts"),S=A("./node_modules/eventemitter3/index.js"),c=A.n(S),o=A("./src/events.ts"),d=A("./src/errors.ts");function u(m,l){for(var _=0;_<l.length;_++){var f=l[_];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function w(m,l,_){return l&&u(m.prototype,l),_&&u(m,_),m}var y=function(){m.isSupported=function(){return Object(O.isSupported)()};function m(_){_===void 0&&(_={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new S.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var f=this.config=Object(x.mergeConfig)(m.DefaultConfig,_);this.userConfig=_,Object(T.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(x.enableStreamingMode)(f);var h=f.abrController,s=f.bufferController,a=f.capLevelController,E=f.fpsController,v=this.abrController=new h(this),p=this.bufferController=new s(this),L=this.capLevelController=new a(this),I=new E(this),B=new P.default(this),z=new U.default(this),j=new k.default(this),F=this.levelController=new D.default(this),X=new g.FragmentTracker(this),te=this.streamController=new b.default(this,X);L.setStreamController(te),I.setStreamController(te);var ie=[F,te];this.networkControllers=ie;var le=[B,z,v,p,L,I,j,X];this.audioTrackController=this.createController(f.audioTrackController,null,ie),this.createController(f.audioStreamController,X,ie),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ie),this.createController(f.subtitleStreamController,X,ie),this.createController(f.timelineController,null,le),this.emeController=this.createController(f.emeController,null,le),this.cmcdController=this.createController(f.cmcdController,null,le),this.latencyController=this.createController(R.default,null,le),this.coreComponents=le}var l=m.prototype;return l.createController=function(f,h,s){if(f){var a=h?new f(this,h):new f(this);return s&&s.push(a),a}return null},l.on=function(f,h,s){s===void 0&&(s=this),this._emitter.on(f,h,s)},l.once=function(f,h,s){s===void 0&&(s=this),this._emitter.once(f,h,s)},l.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},l.off=function(f,h,s,a){s===void 0&&(s=this),this._emitter.off(f,h,s,a)},l.listeners=function(f){return this._emitter.listeners(f)},l.emit=function(f,h,s){return this._emitter.emit(f,h,s)},l.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(s){T.logger.error("An internal error happened while handling event "+f+'. Error message: "'+s.message+'". Here is a stacktrace:',s),this.trigger(o.Events.ERROR,{type:d.ErrorTypes.OTHER_ERROR,details:d.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:s})}return!1},l.listenerCount=function(f){return this._emitter.listenerCount(f)},l.destroy=function(){T.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},l.attachMedia=function(f){T.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},l.detachMedia=function(){T.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},l.loadSource=function(f){this.stopLoad();var h=this.media,s=this.url,a=this.url=W.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});T.logger.log("loadSource:"+a),h&&s&&s!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},l.startLoad=function(f){f===void 0&&(f=-1),T.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},l.stopLoad=function(){T.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},l.swapAudioCodec=function(){T.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},l.recoverMediaError=function(){T.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},l.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},w(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){T.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){T.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){T.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){T.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){T.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var h=!!f;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(T.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,h=this.config.minAutoBitrate;if(!f)return 0;for(var s=f.length,a=0;a<s;a++)if(f[a].maxBitrate>h)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,h=this.autoLevelCapping,s;return h===-1&&f&&f.length?s=f.length-1:s=h,s}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var h=this.audioTrackController;h&&(h.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var h=this.subtitleTrackController;h&&(h.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return d.ErrorTypes}},{key:"ErrorDetails",get:function(){return d.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:x.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();y.defaultConfig=void 0},"./src/is-supported.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"isSupported",function(){return P}),A.d(K,"changeTypeSupported",function(){return U});var W=A("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function P(){var k=Object(W.getMediaSource)();if(!k)return!1;var R=M(),D=k&&typeof k.isTypeSupported=="function"&&k.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),g=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!D&&!!g}function U(){var k,R=M();return typeof(R==null||((k=R.prototype)===null||k===void 0)?void 0:k.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return T}),A.d(K,"LoadError",function(){return S});var W=A("./src/polyfills/number.ts"),M=A("./src/errors.ts");function P(c,o){c.prototype=Object.create(o.prototype),c.prototype.constructor=c,g(c,o)}function U(c){var o=typeof Map=="function"?new Map:void 0;return U=function(u){if(u===null||!D(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,w)}function w(){return k(u,arguments,b(this).constructor)}return w.prototype=Object.create(u.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),g(w,u)},U(c)}function k(c,o,d){return R()?k=Reflect.construct:k=function(w,y,m){var l=[null];l.push.apply(l,y);var _=Function.bind.apply(w,l),f=new _;return m&&g(f,m.prototype),f},k.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(c){return!1}}function D(c){return Function.toString.call(c).indexOf("[native code]")!==-1}function g(c,o){return g=Object.setPrototypeOf||function(u,w){return u.__proto__=w,u},g(c,o)}function b(c){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},b(c)}var O=Math.pow(2,17),T=function(){function c(d){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=d}var o=c.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,w){var y=this,m=u.url;if(!m)return Promise.reject(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var l=this.config,_=l.fLoader,f=l.loader;return new Promise(function(h,s){y.loader&&y.loader.destroy();var a=y.loader=u.loader=_?new _(l):new f(l),E=x(u),v={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:O};u.stats=a.stats,a.load(E,v,{onSuccess:function(L,I,B,z){y.resetLoader(u,a),h({frag:u,part:null,payload:L.data,networkDetails:z})},onError:function(L,I,B){y.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:L,networkDetails:B}))},onAbort:function(L,I,B){y.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:B}))},onTimeout:function(L,I,B){y.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:B}))},onProgress:function(L,I,B,z){w&&w({frag:u,part:null,payload:B,networkDetails:z})}})})},o.loadPart=function(u,w,y){var m=this;this.abort();var l=this.config,_=l.fLoader,f=l.loader;return new Promise(function(h,s){m.loader&&m.loader.destroy();var a=m.loader=u.loader=_?new _(l):new f(l),E=x(u,w),v={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:O};w.stats=a.stats,a.load(E,v,{onSuccess:function(L,I,B,z){m.resetLoader(u,a),m.updateStatsFromPart(u,w);var j={frag:u,part:w,payload:L.data,networkDetails:z};y(j),h(j)},onError:function(L,I,B){m.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:w,response:L,networkDetails:B}))},onAbort:function(L,I,B){u.stats.aborted=w.stats.aborted,m.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:w,networkDetails:B}))},onTimeout:function(L,I,B){m.resetLoader(u,a),s(new S({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:w,networkDetails:B}))}})})},o.updateStatsFromPart=function(u,w){var y=u.stats,m=w.stats,l=m.total;if(y.loaded+=m.loaded,l){var _=Math.round(u.duration/w.duration),f=Math.min(Math.round(y.loaded/l),_),h=_-f,s=h*Math.round(y.loaded/f);y.total=y.loaded+s}else y.total=Math.max(y.loaded,y.total);var a=y.loading,E=m.loading;a.start?a.first+=E.first-E.start:(a.start=E.start,a.first=E.first),a.end=E.end},o.resetLoader=function(u,w){u.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},c}();function x(c,o){o===void 0&&(o=null);var d=o||c,u={frag:c,part:o,responseType:"arraybuffer",url:d.url,headers:{},rangeStart:0,rangeEnd:0},w=d.byteRangeStartOffset,y=d.byteRangeEndOffset;return Object(W.isFiniteNumber)(w)&&Object(W.isFiniteNumber)(y)&&(u.rangeStart=w,u.rangeEnd=y),u}var S=function(c){P(o,c);function o(d){for(var u,w=arguments.length,y=new Array(w>1?w-1:0),m=1;m<w;m++)y[m-1]=arguments[m];return u=c.call.apply(c,[this].concat(y))||this,u.data=void 0,u.data=d,u}return o}(U(Error))},"./src/loader/fragment.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"ElementaryStreamTypes",function(){return T}),A.d(K,"BaseSegment",function(){return x}),A.d(K,"Fragment",function(){return S}),A.d(K,"Part",function(){return c});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),U=A("./src/utils/logger.ts"),k=A("./src/loader/level-key.ts"),R=A("./src/loader/load-stats.ts");function D(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,g(o,d)}function g(o,d){return g=Object.setPrototypeOf||function(w,y){return w.__proto__=y,w},g(o,d)}function b(o,d){for(var u=0;u<d.length;u++){var w=d[u];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function O(o,d,u){return d&&b(o.prototype,d),u&&b(o,u),o}var T;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(T||(T={}));var x=function(){function o(u){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[T.AUDIO]=null,w[T.VIDEO]=null,w[T.AUDIOVIDEO]=null,w),this.baseurl=u}var d=o.prototype;return d.setByteRange=function(w,y){var m=w.split("@",2),l=[];m.length===1?l[0]=y?y.byteRangeEndOffset:0:l[0]=parseInt(m[1]),l[1]=parseInt(m[0])+l[0],this._byteRange=l},O(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(M.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),S=function(o){D(d,o);function d(w,y){var m;return m=o.call(this,y)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new R.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=w,m}var u=d.prototype;return u.createInitializationVector=function(y){for(var m=new Uint8Array(16),l=12;l<16;l++)m[l]=y>>8*(15-l)&255;return m},u.setDecryptDataFromLevelKey=function(y,m){var l=y;return(y==null?void 0:y.method)==="AES-128"&&y.uri&&!y.iv&&(l=k.LevelKey.fromURI(y.uri),l.method=y.method,l.iv=this.createInitializationVector(m),l.keyFormat="identity"),l},u.setElementaryStreamInfo=function(y,m,l,_,f,h){h===void 0&&(h=!1);var s=this.elementaryStreams,a=s[y];if(!a){s[y]={startPTS:m,endPTS:l,startDTS:_,endDTS:f,partial:h};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,l),a.startDTS=Math.min(a.startDTS,_),a.endDTS=Math.max(a.endDTS,f)},u.clearElementaryStreamInfo=function(){var y=this.elementaryStreams;y[T.AUDIO]=null,y[T.VIDEO]=null,y[T.AUDIOVIDEO]=null},O(d,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var y=this.sn;typeof y!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&U.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),y=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,y)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(W.isFiniteNumber)(this.programDateTime))return null;var y=Object(W.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+y*1e3}},{key:"encrypted",get:function(){var y;return!!((y=this.decryptdata)!==null&&y!==void 0&&y.keyFormat&&this.decryptdata.uri)}}]),d}(x),c=function(o){D(d,o);function d(u,w,y,m,l){var _;_=o.call(this,y)||this,_.fragOffset=0,_.duration=0,_.gap=!1,_.independent=!1,_.relurl=void 0,_.fragment=void 0,_.index=void 0,_.stats=new R.LoadStats,_.duration=u.decimalFloatingPoint("DURATION"),_.gap=u.bool("GAP"),_.independent=u.bool("INDEPENDENT"),_.relurl=u.enumeratedString("URI"),_.fragment=w,_.index=m;var f=u.enumeratedString("BYTERANGE");return f&&_.setByteRange(f,l),l&&(_.fragOffset=l.fragOffset+l.duration),_}return O(d,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),d}(x)},"./src/loader/key-loader.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return U});var W=A("./src/events.ts"),M=A("./src/errors.ts"),P=A("./src/utils/logger.ts"),U=function(){function k(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var R=k.prototype;return R._registerListeners=function(){this.hls.on(W.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(W.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var g in this.loaders){var b=this.loaders[g];b&&b.destroy()}this.loaders={}},R.onKeyLoading=function(g,b){var O=b.frag,T=O.type,x=this.loaders[T];if(!O.decryptdata){P.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var S=O.decryptdata.uri;if(S!==this.decrypturl||this.decryptkey===null){var c=this.hls.config;if(x&&(P.logger.warn("abort previous key loader for type:"+T),x.abort()),!S){P.logger.warn("key uri is falsy");return}var o=c.loader,d=O.loader=this.loaders[T]=new o(c);this.decrypturl=S,this.decryptkey=null;var u={url:S,frag:O,responseType:"arraybuffer"},w={timeout:c.fragLoadingTimeOut,maxRetry:0,retryDelay:c.fragLoadingRetryDelay,maxRetryDelay:c.fragLoadingMaxRetryTimeout,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};d.load(u,w,y)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(W.Events.KEY_LOADED,{frag:O}))},R.loadsuccess=function(g,b,O){var T=O.frag;if(!T.decryptdata){P.logger.error("after key load, decryptdata unset");return}this.decryptkey=T.decryptdata.key=new Uint8Array(g.data),T.loader=null,delete this.loaders[T.type],this.hls.trigger(W.Events.KEY_LOADED,{frag:T})},R.loaderror=function(g,b){var O=b.frag,T=O.loader;T&&T.abort(),delete this.loaders[O.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:g})},R.loadtimeout=function(g,b){var O=b.frag,T=O.loader;T&&T.abort(),delete this.loaders[O.type],this.hls.trigger(W.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},k}()},"./src/loader/level-details.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"LevelDetails",function(){return k});var W=A("./src/polyfills/number.ts");function M(R,D){for(var g=0;g<D.length;g++){var b=D[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function P(R,D,g){return D&&M(R.prototype,D),g&&M(R,g),R}var U=10,k=function(){function R(g){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=g}var D=R.prototype;return D.reloaded=function(b){if(!b){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-b.lastPartSn,T=this.lastPartIndex-b.lastPartIndex;this.updated=this.endSN!==b.endSN||!!T||!!O,this.advanced=this.endSN>b.endSN||O>0||O===0&&T>0,this.updated||this.advanced?this.misses=Math.floor(b.misses*.6):this.misses=b.misses+1,this.availabilityDelay=b.availabilityDelay},P(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(W.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var b=this.driftEndTime-this.driftStartTime;if(b>0){var O=this.driftEnd-this.driftStart;return O*1e3/b}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var b;return(b=this.fragments)!==null&&b!==void 0&&b.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 b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var b;return(b=this.partList)!==null&&b!==void 0&&b.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"LevelKey",function(){return k});var W=A("./node_modules/url-toolkit/src/url-toolkit.js"),M=A.n(W);function P(R,D){for(var g=0;g<D.length;g++){var b=D[g];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(R,b.key,b)}}function U(R,D,g){return D&&P(R.prototype,D),g&&P(R,g),R}var k=function(){R.fromURL=function(g,b){return new R(g,b)},R.fromURI=function(g){return new R(g)};function R(D,g){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,g?this._uri=Object(W.buildAbsoluteURL)(D,g,{alwaysNormalize:!0}):this._uri=D}return U(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"LoadStats",function(){return W});var W=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(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return d});var W=A("./src/polyfills/number.ts"),M=A("./node_modules/url-toolkit/src/url-toolkit.js"),P=A.n(M),U=A("./src/loader/fragment.ts"),k=A("./src/loader/level-details.ts"),R=A("./src/loader/level-key.ts"),D=A("./src/utils/attr-list.ts"),g=A("./src/utils/logger.ts"),b=A("./src/utils/codecs.ts"),O=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,T=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),S=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("|")),c=/\.(mp4|m4s|m4v|m4a)$/i;function o(l){var _,f;return c.test((_=(f=M.parseURL(l))===null||f===void 0?void 0:f.path)!=null?_:"")}var d=function(){function l(){}return l.findGroup=function(f,h){for(var s=0;s<f.length;s++){var a=f[s];if(a.id===h)return a}},l.convertAVC1ToAVCOTI=function(f){var h=f.split(".");if(h.length>2){var s=h.shift()+".";return s+=parseInt(h.shift()).toString(16),s+=("000"+parseInt(h.shift()).toString(16)).substr(-4),s}return f},l.resolve=function(f,h){return M.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},l.parseMasterPlaylist=function(f,h){var s=[],a={},E=!1;O.lastIndex=0;for(var v;(v=O.exec(f))!=null;)if(v[1]){var p=new D.AttrList(v[1]),L={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:l.resolve(v[2],h)},I=p.decimalResolution("RESOLUTION");I&&(L.width=I.width,L.height=I.height),u((p.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),L),L.videoCodec&&L.videoCodec.indexOf("avc1")!==-1&&(L.videoCodec=l.convertAVC1ToAVCOTI(L.videoCodec)),s.push(L)}else if(v[3]){var B=new D.AttrList(v[3]);B["DATA-ID"]&&(E=!0,a[B["DATA-ID"]]=B)}return{levels:s,sessionData:E?a:null}},l.parseMasterPlaylistMedia=function(f,h,s,a){a===void 0&&(a=[]);var E,v=[],p=0;for(T.lastIndex=0;(E=T.exec(f))!==null;){var L=new D.AttrList(E[1]);if(L.TYPE===s){var I={attrs:L,bitrate:0,id:p++,groupId:L["GROUP-ID"],instreamId:L["INSTREAM-ID"],name:L.NAME||L.LANGUAGE||"",type:s,default:L.bool("DEFAULT"),autoselect:L.bool("AUTOSELECT"),forced:L.bool("FORCED"),lang:L.LANGUAGE,url:L.URI?l.resolve(L.URI,h):""};if(a.length){var B=l.findGroup(a,I.groupId)||a[0];w(I,B,"audioCodec"),w(I,B,"textCodec")}v.push(I)}}return v},l.parseLevelPlaylist=function(f,h,s,a,E){var v=new k.LevelDetails(h),p=v.fragments,L=null,I=0,B=0,z=0,j=0,F=null,X=new U.Fragment(a,h),te,ie,le,_e=-1,me=!1;for(x.lastIndex=0,v.m3u8=f;(te=x.exec(f))!==null;){me&&(me=!1,X=new U.Fragment(a,h),X.start=z,X.sn=I,X.cc=j,X.level=s,L&&(X.initSegment=L,X.rawProgramDateTime=L.rawProgramDateTime));var he=te[1];if(he){X.duration=parseFloat(he);var fe=(" "+te[2]).slice(1);X.title=fe||null,X.tagList.push(fe?["INF",he,fe]:["INF",he])}else if(te[3])Object(W.isFiniteNumber)(X.duration)&&(X.start=z,le&&(X.levelkey=le),X.sn=I,X.level=s,X.cc=j,X.urlId=E,p.push(X),X.relurl=(" "+te[3]).slice(1),m(X,F),F=X,z+=X.duration,I++,B=0,me=!0);else if(te[4]){var ce=(" "+te[4]).slice(1);F?X.setByteRange(ce,F):X.setByteRange(ce)}else if(te[5])X.rawProgramDateTime=(" "+te[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),_e===-1&&(_e=p.length);else{if(te=te[0].match(S),!te){g.logger.warn("No matches on slow regex match for level playlist!");continue}for(ie=1;ie<te.length&&!(typeof te[ie]!="undefined");ie++);var ne=(" "+te[ie]).slice(1),q=(" "+te[ie+1]).slice(1),ye=te[ie+2]?(" "+te[ie+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":v.type=q.toUpperCase();break;case"MEDIA-SEQUENCE":I=v.startSN=parseInt(q);break;case"SKIP":{var Fe=new D.AttrList(q),Be=Fe.decimalInteger("SKIPPED-SEGMENTS");if(Object(W.isFiniteNumber)(Be)){v.skippedSegments=Be;for(var We=Be;We--;)p.unshift(null);I+=Be}var ze=Fe.enumeratedString("RECENTLY-REMOVED-DATERANGES");ze&&(v.recentlyRemovedDateranges=ze.split(" "));break}case"TARGETDURATION":v.targetduration=parseFloat(q);break;case"VERSION":v.version=parseInt(q);break;case"EXTM3U":break;case"ENDLIST":v.live=!1;break;case"#":(q||ye)&&X.tagList.push(ye?[q,ye]:[q]);break;case"DIS":j++;case"GAP":X.tagList.push([ne]);break;case"BITRATE":X.tagList.push([ne,q]);break;case"DISCONTINUITY-SEQ":j=parseInt(q);break;case"KEY":{var we,Ae=new D.AttrList(q),Me=Ae.enumeratedString("METHOD"),je=Ae.URI,Ie=Ae.hexadecimalInteger("IV"),Oe=Ae.enumeratedString("KEYFORMATVERSIONS"),Te=Ae.enumeratedString("KEYID"),ct=(we=Ae.enumeratedString("KEYFORMAT"))!=null?we:"identity",rt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(rt.indexOf(ct)>-1){g.logger.warn("Keyformat "+ct+" is not supported from the manifest");continue}else if(ct!=="identity")continue;Me&&(le=R.LevelKey.fromURL(h,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Me)>=0&&(le.method=Me,le.keyFormat=ct,Te&&(le.keyID=Te),Oe&&(le.keyFormatVersions=Oe),le.iv=Ie));break}case"START":{var Ye=new D.AttrList(q),Ge=Ye.decimalFloatingPoint("TIME-OFFSET");Object(W.isFiniteNumber)(Ge)&&(v.startTimeOffset=Ge);break}case"MAP":{var ot=new D.AttrList(q);X.relurl=ot.URI,ot.BYTERANGE&&X.setByteRange(ot.BYTERANGE),X.level=s,X.sn="initSegment",le&&(X.levelkey=le),X.initSegment=null,L=X,me=!0;break}case"SERVER-CONTROL":{var nt=new D.AttrList(q);v.canBlockReload=nt.bool("CAN-BLOCK-RELOAD"),v.canSkipUntil=nt.optionalFloat("CAN-SKIP-UNTIL",0),v.canSkipDateRanges=v.canSkipUntil>0&&nt.bool("CAN-SKIP-DATERANGES"),v.partHoldBack=nt.optionalFloat("PART-HOLD-BACK",0),v.holdBack=nt.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var et=new D.AttrList(q);v.partTarget=et.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ee=v.partList;Ee||(Ee=v.partList=[]);var it=B>0?Ee[Ee.length-1]:void 0,Ze=B++,be=new U.Part(new D.AttrList(q),X,h,Ze,it);Ee.push(be),X.duration+=be.duration;break}case"PRELOAD-HINT":{var De=new D.AttrList(q);v.preloadHint=De;break}case"RENDITION-REPORT":{var ue=new D.AttrList(q);v.renditionReports=v.renditionReports||[],v.renditionReports.push(ue);break}default:g.logger.warn("line parsed but not handled: "+te);break}}}F&&!F.relurl?(p.pop(),z-=F.duration,v.partList&&(v.fragmentHint=F)):v.partList&&(m(X,F),X.cc=j,v.fragmentHint=X);var ae=p.length,se=p[0],Y=p[ae-1];if(z+=v.skippedSegments*v.targetduration,z>0&&ae&&Y){v.averagetargetduration=z/ae;var Q=Y.sn;v.endSN=Q!=="initSegment"?Q:0,se&&(v.startCC=se.cc,se.initSegment||v.fragments.every(function(J){return J.relurl&&o(J.relurl)})&&(g.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new U.Fragment(a,h),X.relurl=Y.relurl,X.level=s,X.sn="initSegment",se.initSegment=X,v.needSidxRanges=!0))}else v.endSN=0,v.startCC=0;return v.fragmentHint&&(z+=v.fragmentHint.duration),v.totalduration=z,v.endCC=j,_e>0&&y(p,_e),v},l}();function u(l,_){["video","audio","text"].forEach(function(f){var h=l.filter(function(a){return Object(b.isCodecType)(a,f)});if(h.length){var s=h.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});_[f+"Codec"]=s.length>0?s[0]:h[0],l=l.filter(function(a){return h.indexOf(a)===-1})}}),_.unknownCodecs=l}function w(l,_,f){var h=_[f];h&&(l[f]=h)}function y(l,_){for(var f=l[_],h=_;h--;){var s=l[h];if(!s)return;s.programDateTime=f.programDateTime-s.duration*1e3,f=s}}function m(l,_){l.rawProgramDateTime?l.programDateTime=Date.parse(l.rawProgramDateTime):_!=null&&_.programDateTime&&(l.programDateTime=_.endProgramDateTime),Object(W.isFiniteNumber)(l.programDateTime)||(l.programDateTime=null,l.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/events.ts"),P=A("./src/errors.ts"),U=A("./src/utils/logger.ts"),k=A("./src/utils/mp4-tools.ts"),R=A("./src/loader/m3u8-parser.ts"),D=A("./src/types/loader.ts"),g=A("./src/utils/attr-list.ts");function b(x){var S=x.type;switch(S){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function O(x,S){var c=x.url;return(c===void 0||c.indexOf("data:")===0)&&(c=S.url),c}var T=function(){function x(c){this.hls=void 0,this.loaders=Object.create(null),this.hls=c,this.registerListeners()}var S=x.prototype;return S.registerListeners=function(){var o=this.hls;o.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.unregisterListeners=function(){var o=this.hls;o.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},S.createInternalLoader=function(o){var d=this.hls.config,u=d.pLoader,w=d.loader,y=u||w,m=new y(d);return o.loader=m,this.loaders[o.type]=m,m},S.getInternalLoader=function(o){return this.loaders[o.type]},S.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},S.destroyInternalLoaders=function(){for(var o in this.loaders){var d=this.loaders[o];d&&d.destroy(),this.resetInternalLoader(o)}},S.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},S.onManifestLoading=function(o,d){var u=d.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},S.onLevelLoading=function(o,d){var u=d.id,w=d.level,y=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:null,level:w,responseType:"text",type:D.PlaylistContextType.LEVEL,url:y,deliveryDirectives:m})},S.onAudioTrackLoading=function(o,d){var u=d.id,w=d.groupId,y=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:w,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:y,deliveryDirectives:m})},S.onSubtitleTrackLoading=function(o,d){var u=d.id,w=d.groupId,y=d.url,m=d.deliveryDirectives;this.load({id:u,groupId:w,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:y,deliveryDirectives:m})},S.load=function(o){var d,u=this.hls.config,w=this.getInternalLoader(o);if(w){var y=w.context;if(y&&y.url===o.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var m,l,_,f;switch(o.type){case D.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,l=u.manifestLoadingTimeOut,_=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:m=0,l=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,l=u.levelLoadingTimeOut,_=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(d=o.deliveryDirectives)!==null&&d!==void 0&&d.part){var h;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?h=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?h=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(h=this.hls.subtitleTracks[o.id].details),h){var s=h.partTarget,a=h.targetduration;s&&a&&(l=Math.min(Math.max(s*3,a*.8)*1e3,l))}}var E={timeout:l,maxRetry:m,retryDelay:_,maxRetryDelay:f,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,E,v)},S.loadsuccess=function(o,d,u,w){if(w===void 0&&(w=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,d,u,w);return}this.resetInternalLoader(u.type);var y=o.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",w);return}d.parsing.start=performance.now(),y.indexOf("#EXTINF:")>0||y.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,d,u,w):this.handleMasterPlaylist(o,d,u,w)},S.loaderror=function(o,d,u){u===void 0&&(u=null),this.handleNetworkError(d,u,!1,o)},S.loadtimeout=function(o,d,u){u===void 0&&(u=null),this.handleNetworkError(d,u,!0)},S.handleMasterPlaylist=function(o,d,u,w){var y=this.hls,m=o.data,l=O(o,u),_=R.default.parseMasterPlaylist(m,l),f=_.levels,h=_.sessionData;if(!f.length){this.handleManifestParsingError(o,u,"no level found in manifest",w);return}var s=f.map(function(I){return{id:I.attrs.AUDIO,audioCodec:I.audioCodec}}),a=f.map(function(I){return{id:I.attrs.SUBTITLES,textCodec:I.textCodec}}),E=R.default.parseMasterPlaylistMedia(m,l,"AUDIO",s),v=R.default.parseMasterPlaylistMedia(m,l,"SUBTITLES",a),p=R.default.parseMasterPlaylistMedia(m,l,"CLOSED-CAPTIONS");if(E.length){var L=E.some(function(I){return!I.url});!L&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(U.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new g.AttrList({}),bitrate:0,url:""}))}y.trigger(M.Events.MANIFEST_LOADED,{levels:f,audioTracks:E,subtitles:v,captions:p,url:l,stats:d,networkDetails:w,sessionData:h})},S.handleTrackOrLevelPlaylist=function(o,d,u,w){var y=this.hls,m=u.id,l=u.level,_=u.type,f=O(o,u),h=Object(W.isFiniteNumber)(m)?m:0,s=Object(W.isFiniteNumber)(l)?l:h,a=b(u),E=R.default.parseLevelPlaylist(o.data,f,s,a,h);if(!E.fragments.length){y.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(_===D.PlaylistContextType.MANIFEST){var v={attrs:new g.AttrList({}),bitrate:0,details:E,name:"",url:f};y.trigger(M.Events.MANIFEST_LOADED,{levels:[v],audioTracks:[],url:f,stats:d,networkDetails:w,sessionData:null})}if(d.parsing.end=performance.now(),E.needSidxRanges){var p,L=(p=E.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:L,isSidxRequest:!0,type:_,level:l,levelDetails:E,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=E,this.handlePlaylistLoaded(o,d,u,w)},S.handleSidxRequest=function(o,d){var u=Object(k.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var w=u.references,y=d.levelDetails;w.forEach(function(m,l){var _=m.info,f=y.fragments[l];f.byteRange.length===0&&f.setByteRange(String(1+_.end-_.start)+"@"+String(_.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},S.handleManifestParsingError=function(o,d,u,w){this.hls.trigger(M.Events.ERROR,{type:P.ErrorTypes.NETWORK_ERROR,details:P.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:d.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:d,networkDetails:w})},S.handleNetworkError=function(o,d,u,w){u===void 0&&(u=!1),U.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var y=P.ErrorDetails.UNKNOWN,m=!1,l=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:y=u?P.ErrorDetails.MANIFEST_LOAD_TIMEOUT:P.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case D.PlaylistContextType.LEVEL:y=u?P.ErrorDetails.LEVEL_LOAD_TIMEOUT:P.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.AUDIO_TRACK:y=u?P.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:P.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:y=u?P.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:P.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}l&&this.resetInternalLoader(o.type);var _={type:P.ErrorTypes.NETWORK_ERROR,details:y,fatal:m,url:o.url,loader:l,context:o,networkDetails:d};w&&(_.response=w),this.hls.trigger(M.Events.ERROR,_)},S.handlePlaylistLoaded=function(o,d,u,w){var y=u.type,m=u.level,l=u.id,_=u.groupId,f=u.loader,h=u.levelDetails,s=u.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",w);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(y){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:h,level:m||0,id:l||0,stats:d,networkDetails:w,deliveryDirectives:s});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:h,id:l||0,groupId:_||"",stats:d,networkDetails:w,deliveryDirectives:s});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:h,id:l||0,groupId:_||"",stats:d,networkDetails:w,deliveryDirectives:s});break}},x}();K.default=T},"./src/polyfills/number.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"isFiniteNumber",function(){return W}),A.d(K,"MAX_SAFE_INTEGER",function(){return M});var W=Number.isFinite||function(P){return typeof P=="number"&&isFinite(P)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Z,K,A){"use strict";A.r(K);var W=function(){function M(){}return M.getSilentFrame=function(U,k){switch(U){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}();K.default=W},"./src/remux/mp4-generator.ts":function(Z,K,A){"use strict";A.r(K);var W=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 R=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]),D=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:R,audio:D};var g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),b=new Uint8Array([0,0,0,0,0,0,0,0]);P.STTS=P.STSC=P.STCO=b,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]),T=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);P.FTYP=P.box(P.types.ftyp,O,x,O,T),P.DINF=P.box(P.types.dinf,P.box(P.types.dref,g))},P.box=function(k){for(var R=8,D=arguments.length,g=new Array(D>1?D-1:0),b=1;b<D;b++)g[b-1]=arguments[b];for(var O=g.length,T=O;O--;)R+=g[O].byteLength;var x=new Uint8Array(R);for(x[0]=R>>24&255,x[1]=R>>16&255,x[2]=R>>8&255,x[3]=R&255,x.set(k,4),O=0,R=8;O<T;O++)x.set(g[O],R),R+=g[O].byteLength;return x},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,R){R*=k;var D=Math.floor(R/(W+1)),g=Math.floor(R%(W+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,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&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,R,D){return P.box(P.types.moof,P.mfhd(k),P.traf(D,R))},P.moov=function(k){for(var R=k.length,D=[];R--;)D[R]=P.trak(k[R]);return P.box.apply(null,[P.types.moov,P.mvhd(k[0].timescale,k[0].duration)].concat(D).concat(P.mvex(k)))},P.mvex=function(k){for(var R=k.length,D=[];R--;)D[R]=P.trex(k[R]);return P.box.apply(null,[P.types.mvex].concat(D))},P.mvhd=function(k,R){R*=k;var D=Math.floor(R/(W+1)),g=Math.floor(R%(W+1)),b=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,D>>24,D>>16&255,D>>8&255,D&255,g>>24,g>>16&255,g>>8&255,g&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,b)},P.sdtp=function(k){var R=k.samples||[],D=new Uint8Array(4+R.length),g,b;for(g=0;g<R.length;g++)b=R[g].flags,D[g+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return P.box(P.types.sdtp,D)},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 R=[],D=[],g,b,O;for(g=0;g<k.sps.length;g++)b=k.sps[g],O=b.byteLength,R.push(O>>>8&255),R.push(O&255),R=R.concat(Array.prototype.slice.call(b));for(g=0;g<k.pps.length;g++)b=k.pps[g],O=b.byteLength,D.push(O>>>8&255),D.push(O&255),D=D.concat(Array.prototype.slice.call(b));var T=P.box(P.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|k.sps.length].concat(R).concat([k.pps.length]).concat(D))),x=k.width,S=k.height,c=k.pixelRatio[0],o=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,x>>8&255,x&255,S>>8&255,S&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),T,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([c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&255])))},P.esds=function(k){var R=k.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(k.config).concat([6,1,2]))},P.mp4a=function(k){var R=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,R>>8&255,R&255,0,0]),P.box(P.types.esds,P.esds(k)))},P.mp3=function(k){var R=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,R>>8&255,R&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 R=k.id,D=k.duration*k.timescale,g=k.width,b=k.height,O=Math.floor(D/(W+1)),T=Math.floor(D%(W+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,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&255,T>>24,T>>16&255,T>>8&255,T&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,g>>8&255,g&255,0,0,b>>8&255,b&255,0,0]))},P.traf=function(k,R){var D=P.sdtp(k),g=k.id,b=Math.floor(R/(W+1)),O=Math.floor(R%(W+1));return P.box(P.types.traf,P.box(P.types.tfhd,new Uint8Array([0,0,0,0,g>>24,g>>16&255,g>>8&255,g&255])),P.box(P.types.tfdt,new Uint8Array([1,0,0,0,b>>24,b>>16&255,b>>8&255,b&255,O>>24,O>>16&255,O>>8&255,O&255])),P.trun(k,D.length+16+20+8+16+8+8),D)},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 R=k.id;return P.box(P.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},P.trun=function(k,R){var D=k.samples||[],g=D.length,b=12+16*g,O=new Uint8Array(b),T,x,S,c,o,d;for(R+=8+b,O.set([0,0,15,1,g>>>24&255,g>>>16&255,g>>>8&255,g&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),T=0;T<g;T++)x=D[T],S=x.duration,c=x.size,o=x.flags,d=x.cts,O.set([S>>>24&255,S>>>16&255,S>>>8&255,S&255,c>>>24&255,c>>>16&255,c>>>8&255,c&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,d>>>24&255,d>>>16&255,d>>>8&255,d&255],12+16*T);return P.box(P.types.trun,O)},P.initSegment=function(k){P.types||P.init();var R=P.moov(k),D=new Uint8Array(P.FTYP.byteLength+R.byteLength);return D.set(P.FTYP),D.set(R,P.FTYP.byteLength),D},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,K.default=M},"./src/remux/mp4-remuxer.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return d}),A.d(K,"normalizePts",function(){return u});var W=A("./src/polyfills/number.ts"),M=A("./src/remux/aac-helper.ts"),P=A("./src/remux/mp4-generator.ts"),U=A("./src/events.ts"),k=A("./src/errors.ts"),R=A("./src/utils/logger.ts"),D=A("./src/types/loader.ts"),g=A("./src/utils/timescale-conversion.ts");function b(){return b=Object.assign||function(l){for(var _=1;_<arguments.length;_++){var f=arguments[_];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(l[h]=f[h])}return l},b.apply(this,arguments)}var O=10*1e3,T=1024,x=1152,S=null,c=null,o=!1,d=function(){function l(f,h,s,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=h,this.typeSupported=s,this.ISGenerated=!1,S===null){var E=navigator.userAgent||"",v=E.match(/Chrome\/(\d+)/i);S=v?parseInt(v[1]):0}if(c===null){var p=navigator.userAgent.match(/Safari\/(\d+)/i);c=p?parseInt(p[1]):0}o=!!S&&S<75||!!c&&c<600}var _=l.prototype;return _.destroy=function(){},_.resetTimeStamp=function(h){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},_.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},_.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},_.getVideoStartPts=function(h){var s=!1,a=h.reduce(function(E,v){var p=v.pts-E;return p<-4294967296?(s=!0,u(E,v.pts)):p>0?E:v.pts},h[0].pts);return s&&R.logger.debug("PTS rollover detected"),a},_.remux=function(h,s,a,E,v,p,L,I){var B,z,j,F,X,te,ie=v,le=v,_e=h.pid>-1,me=s.pid>-1,he=s.samples.length,fe=h.samples.length>0,ce=he>1,ne=(!_e||fe)&&(!me||ce)||this.ISGenerated||L;if(ne){this.ISGenerated||(j=this.generateIS(h,s,v));var q=this.isVideoContiguous,ye=-1;if(ce&&(ye=w(s.samples),!q&&this.config.forceKeyFrameOnDiscontinuity))if(te=!0,ye>0){R.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+he+" video samples due to a missing keyframe");var Fe=this.getVideoStartPts(s.samples);s.samples=s.samples.slice(ye),s.dropped+=ye,le+=(s.samples[0].pts-Fe)/(s.timescale||9e4)}else ye===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),te=!1);if(this.ISGenerated){if(fe&&ce){var Be=this.getVideoStartPts(s.samples),We=u(h.samples[0].pts,Be)-Be,ze=We/s.inputTimeScale;ie+=Math.max(0,ze),le+=Math.max(0,-ze)}if(fe){if(h.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(h,s,v)),z=this.remuxAudio(h,ie,this.isAudioContiguous,p,me||ce||I===D.PlaylistLevelType.AUDIO?le:void 0),ce){var we=z?z.endPTS-z.startPTS:0;s.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(h,s,v)),B=this.remuxVideo(s,le,q,we)}}else ce&&(B=this.remuxVideo(s,le,q,0));B&&(B.firstKeyFrame=ye,B.independent=ye!==-1)}}return this.ISGenerated&&(a.samples.length&&(X=this.remuxID3(a,v)),E.samples.length&&(F=this.remuxText(E,v))),{audio:z,video:B,initSegment:j,independent:te,text:F,id3:X}},_.generateIS=function(h,s,a){var E=h.samples,v=s.samples,p=this.typeSupported,L={},I=!Object(W.isFiniteNumber)(this._initPTS),B="audio/mp4",z,j,F;if(I&&(z=j=Infinity),h.config&&E.length&&(h.timescale=h.samplerate,h.isAAC||(p.mpeg?(B="audio/mpeg",h.codec=""):p.mp3&&(h.codec="mp3")),L.audio={id:"audio",container:B,codec:h.codec,initSegment:!h.isAAC&&p.mpeg?new Uint8Array(0):P.default.initSegment([h]),metadata:{channelCount:h.channelCount}},I&&(F=h.inputTimeScale,z=j=E[0].pts-Math.round(F*a))),s.sps&&s.pps&&v.length&&(s.timescale=s.inputTimeScale,L.video={id:"main",container:"video/mp4",codec:s.codec,initSegment:P.default.initSegment([s]),metadata:{width:s.width,height:s.height}},I)){F=s.inputTimeScale;var X=this.getVideoStartPts(v),te=Math.round(F*a);j=Math.min(j,u(v[0].dts,X)-te),z=Math.min(z,X-te)}if(Object.keys(L).length)return this.ISGenerated=!0,I&&(this._initPTS=z,this._initDTS=j),{tracks:L,initPTS:z,timescale:F}},_.remuxVideo=function(h,s,a,E){var v=h.inputTimeScale,p=h.samples,L=[],I=p.length,B=this._initPTS,z=this.nextAvcDts,j=8,F,X,te,ie=Number.POSITIVE_INFINITY,le=Number.NEGATIVE_INFINITY,_e=0,me=!1;if(!a||z===null){var he=s*v,fe=p[0].pts-u(p[0].dts,p[0].pts);z=he-fe}for(var ce=0;ce<I;ce++){var ne=p[ce];if(ne.pts=u(ne.pts-B,z),ne.dts=u(ne.dts-B,z),ne.dts>ne.pts){var q=9e4*.2;_e=Math.max(Math.min(_e,ne.pts-ne.dts),-1*q)}ne.dts<p[ce>0?ce-1:ce].dts&&(me=!0)}me&&p.sort(function(_t,Ue){var Ve=_t.dts-Ue.dts,Tt=_t.pts-Ue.pts;return Ve||Tt}),X=p[0].dts,te=p[p.length-1].dts;var ye=Math.round((te-X)/(I-1));if(_e<0){if(_e<ye*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(g.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var Fe=_e,Be=0;Be<I;Be++)p[Be].dts=Fe=Math.max(Fe,p[Be].pts-ye),p[Be].pts=Math.max(Fe,p[Be].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(g.toMsFromMpegTsClock)(_e,!0)+" ms to overcome this issue");for(var We=0;We<I;We++)p[We].dts=p[We].dts+_e}X=p[0].dts}if(a){var ze=X-z,we=ze>ye,Ae=ze<-1;if(we||Ae){we?R.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(ze,!0)+" ms ("+ze+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(g.toMsFromMpegTsClock)(-ze,!0)+" ms ("+ze+"dts) overlapping between fragments detected"),X=z;var Me=p[0].pts-ze;p[0].dts=X,p[0].pts=Me,R.logger.log("Video: First PTS/DTS adjusted: "+Object(g.toMsFromMpegTsClock)(Me,!0)+"/"+Object(g.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(g.toMsFromMpegTsClock)(ze,!0)+" ms")}}o&&(X=Math.max(0,X));for(var je=0,Ie=0,Oe=0;Oe<I;Oe++){for(var Te=p[Oe],ct=Te.units,rt=ct.length,Ye=0,Ge=0;Ge<rt;Ge++)Ye+=ct[Ge].data.length;Ie+=Ye,je+=rt,Te.length=Ye,Te.dts=Math.max(Te.dts,X),Te.pts=Math.max(Te.pts,Te.dts,0),ie=Math.min(Te.pts,ie),le=Math.max(Te.pts,le)}te=p[I-1].dts;var ot=Ie+4*je+8,nt;try{nt=new Uint8Array(ot)}catch(_t){this.observer.emit(U.Events.ERROR,U.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 et=new DataView(nt.buffer);et.setUint32(0,ot),nt.set(P.default.types.mdat,4);for(var Ee=0;Ee<I;Ee++){for(var it=p[Ee],Ze=it.units,be=0,De=0,ue=Ze.length;De<ue;De++){var ae=Ze[De],se=ae.data,Y=ae.data.byteLength;et.setUint32(j,Y),j+=4,nt.set(se,j),j+=Y,be+=4+Y}if(Ee<I-1)F=p[Ee+1].dts-it.dts;else{var Q=this.config,J=it.dts-p[Ee>0?Ee-1:Ee].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var ee=Math.floor(Q.maxBufferHole*v),de=(E?ie+E*v:this.nextAudioPts)-it.pts;de>ee?(F=de-J,F<0&&(F=J),R.logger.log("[mp4-remuxer]: It is approximately "+de/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=J}else F=J}var xe=Math.round(it.pts-it.dts);L.push(new y(it.key,F,be,xe))}if(L.length&&S&&S<70){var Re=L[0].flags;Re.dependsOn=2,Re.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=te+F,this.isVideoContiguous=!0;var lt=P.default.moof(h.sequenceNumber++,X,b({},h,{samples:L})),st="video",Le={data1:lt,data2:nt,startPTS:ie/v,endPTS:(le+F)/v,startDTS:X/v,endDTS:z/v,type:st,hasAudio:!1,hasVideo:!0,nb:L.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(nt.length,"MDAT length must not be zero"),Le},_.remuxAudio=function(h,s,a,E,v){var p=h.inputTimeScale,L=h.samplerate?h.samplerate:p,I=p/L,B=h.isAAC?T:x,z=B*I,j=this._initPTS,F=!h.isAAC&&this.typeSupported.mpeg,X=[],te=h.samples,ie=F?0:8,le=this.nextAudioPts||-1,_e=s*p;if(this.isAudioContiguous=a=a||te.length&&le>0&&(E&&Math.abs(_e-le)<9e3||Math.abs(u(te[0].pts-j,_e)-le)<20*z),te.forEach(function(se){se.pts=u(se.pts-j,_e)}),!a||le<0){if(te=te.filter(function(se){return se.pts>=0}),!te.length)return;v===0?le=0:E?le=Math.max(0,_e):le=te[0].pts}if(h.isAAC)for(var me=v!==void 0,he=this.config.maxAudioFramesDrift,fe=0,ce=le;fe<te.length;fe++){var ne=te[fe],q=ne.pts,ye=q-ce,Fe=Math.abs(1e3*ye/p);if(ye<=-he*z&&me)fe===0&&(R.logger.warn("Audio frame @ "+(q/p).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/p)+" ms."),this.nextAudioPts=le=ce=q);else if(ye>=he*z&&Fe<O&&me){var Be=Math.round(ye/z);ce=q-Be*z,ce<0&&(Be--,ce+=z),fe===0&&(this.nextAudioPts=le=ce),R.logger.warn("[mp4-remuxer]: Injecting "+Be+" audio frame @ "+(ce/p).toFixed(3)+"s due to "+Math.round(1e3*ye/p)+" ms gap.");for(var We=0;We<Be;We++){var ze=Math.max(ce,0),we=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);we||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),we=ne.unit.subarray()),te.splice(fe,0,{unit:we,pts:ze}),ce+=z,fe++}}ne.pts=ce,ce+=z}for(var Ae=null,Me=null,je,Ie=0,Oe=te.length;Oe--;)Ie+=te[Oe].unit.byteLength;for(var Te=0,ct=te.length;Te<ct;Te++){var rt=te[Te],Ye=rt.unit,Ge=rt.pts;if(Me!==null){var ot=X[Te-1];ot.duration=Math.round((Ge-Me)/I)}else if(a&&h.isAAC&&(Ge=le),Ae=Ge,Ie>0){Ie+=ie;try{je=new Uint8Array(Ie)}catch(se){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:k.ErrorTypes.MUX_ERROR,details:k.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!F){var nt=new DataView(je.buffer);nt.setUint32(0,Ie),je.set(P.default.types.mdat,4)}}else return;je.set(Ye,ie);var et=Ye.byteLength;ie+=et,X.push(new y(!0,B,et,0)),Me=Ge}var Ee=X.length;if(!Ee)return;var it=X[X.length-1];this.nextAudioPts=le=Me+I*it.duration;var Ze=F?new Uint8Array(0):P.default.moof(h.sequenceNumber++,Ae/I,b({},h,{samples:X}));h.samples=[];var be=Ae/p,De=le/p,ue="audio",ae={data1:Ze,data2:je,startPTS:be,endPTS:De,startDTS:be,endDTS:De,type:ue,hasAudio:!0,hasVideo:!1,nb:Ee};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ae},_.remuxEmptyAudio=function(h,s,a,E){var v=h.inputTimeScale,p=h.samplerate?h.samplerate:v,L=v/p,I=this.nextAudioPts,B=(I!==null?I:E.startDTS*v)+this._initDTS,z=E.endDTS*v+this._initDTS,j=L*T,F=Math.ceil((z-B)/j),X=M.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var te=[],ie=0;ie<F;ie++){var le=B+ie*j;te.push({unit:X,pts:le,dts:le})}return h.samples=te,this.remuxAudio(h,s,a,!1)},_.remuxID3=function(h,s){var a=h.samples.length;if(!a)return;for(var E=h.inputTimeScale,v=this._initPTS,p=this._initDTS,L=0;L<a;L++){var I=h.samples[L];I.pts=u(I.pts-v,s*E)/E,I.dts=u(I.dts-p,s*E)/E}var B=h.samples;return h.samples=[],{samples:B}},_.remuxText=function(h,s){var a=h.samples.length;if(!a)return;for(var E=h.inputTimeScale,v=this._initPTS,p=0;p<a;p++){var L=h.samples[p];L.pts=u(L.pts-v,s*E)/E}h.samples.sort(function(B,z){return B.pts-z.pts});var I=h.samples;return h.samples=[],{samples:I}},l}();function u(l,_){var f;if(_===null)return l;for(_<l?f=-8589934592:f=8589934592;Math.abs(l-_)>4294967296;)l+=f;return l}function w(l){for(var _=0;_<l.length;_++)if(l[_].key)return _;return-1}var y=function(_,f,h,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=h,this.cts=s,this.flags=new m(_)},m=function(_){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=_?2:1,this.isNonSync=_?0:1}},"./src/remux/passthrough-remuxer.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/polyfills/number.ts"),M=A("./src/utils/mp4-tools.ts"),P=A("./src/loader/fragment.ts"),U=A("./src/utils/logger.ts"),k=function(){function g(){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 b=g.prototype;return b.destroy=function(){},b.resetTimeStamp=function(T){this.initPTS=T,this.lastEndDTS=null},b.resetNextTimestamp=function(){this.lastEndDTS=null},b.resetInitSegment=function(T,x,S){this.audioCodec=x,this.videoCodec=S,this.generateInitSegment(T),this.emitInitSegment=!0},b.generateInitSegment=function(T){var x=this.audioCodec,S=this.videoCodec;if(!T||!T.byteLength){this.initTracks=void 0,this.initData=void 0;return}var c=this.initData=Object(M.parseInitSegment)(T);x||(x=D(c.audio,P.ElementaryStreamTypes.AUDIO)),S||(S=D(c.video,P.ElementaryStreamTypes.VIDEO));var o={};c.audio&&c.video?o.audiovideo={container:"video/mp4",codec:x+","+S,initSegment:T,id:"main"}:c.audio?o.audio={container:"audio/mp4",codec:x,initSegment:T,id:"audio"}:c.video?o.video={container:"video/mp4",codec:S,initSegment:T,id:"main"}:U.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},b.remux=function(T,x,S,c,o){var d=this.initPTS,u=this.lastEndDTS,w={audio:void 0,video:void 0,text:c,id3:S,initSegment:void 0};Object(W.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var y=x.samples;if(!y||!y.length)return w;var m={initPTS:void 0,timescale:1},l=this.initData;if((!l||!l.length)&&(this.generateInitSegment(y),l=this.initData),!l||!l.length)return U.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(W.isFiniteNumber)(d)||(this.initPTS=m.initPTS=d=R(l,y,u));var _=Object(M.getDuration)(y,l),f=u,h=_+f;Object(M.offsetStartDTS)(l,y,d),_>0?this.lastEndDTS=h:(U.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var s=!!l.audio,a=!!l.video,E="";s&&(E+="audio"),a&&(E+="video");var v={data1:y,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:E,hasAudio:s,hasVideo:a,nb:1,dropped:0};return w.audio=v.type==="audio"?v:void 0,w.video=v.type!=="audio"?v:void 0,w.text=c,w.id3=S,w.initSegment=m,w},g}(),R=function(b,O,T){return Object(M.getStartDTS)(b,O)-T};function D(g,b){var O=g==null?void 0:g.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||b===P.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=k},"./src/task-loop.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=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(Z,K,A){"use strict";A.r(K),A.d(K,"CMCDVersion",function(){return W}),A.d(K,"CMCDObjectType",function(){return M}),A.d(K,"CMCDStreamingFormat",function(){return P}),A.d(K,"CMCDStreamType",function(){return U});var W=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 U;(function(k){k.VOD="v",k.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"HlsSkip",function(){return P}),A.d(K,"getSkipValue",function(){return U}),A.d(K,"HlsUrlParameters",function(){return k}),A.d(K,"Level",function(){return R});function W(D,g){for(var b=0;b<g.length;b++){var O=g[b];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function M(D,g,b){return g&&W(D.prototype,g),b&&W(D,b),D}var P;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(P||(P={}));function U(D,g){var b=D.canSkipUntil,O=D.canSkipDateRanges,T=D.endSN,x=g!==void 0?g-T:0;return b&&x<b?O?P.v2:P.Yes:P.No}var k=function(){function D(b,O,T){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=b,this.part=O,this.skip=T}var g=D.prototype;return g.addDirectives=function(O){var T=new self.URL(O);return this.msn!==void 0&&T.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&T.searchParams.set("_HLS_part",this.part.toString()),this.skip&&T.searchParams.set("_HLS_skip",this.skip),T.toString()},D}(),R=function(){function D(g){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=[g.url],this.attrs=g.attrs,this.bitrate=g.bitrate,g.details&&(this.details=g.details),this.id=g.id||0,this.name=g.name,this.width=g.width||0,this.height=g.height||0,this.audioCodec=g.audioCodec,this.videoCodec=g.videoCodec,this.unknownCodecs=g.unknownCodecs,this.codecSet=[g.videoCodec,g.audioCodec].filter(function(b){return b}).join(",").replace(/\.[^.,]+/g,"")}return M(D,[{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(b){var O=b%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),D}()},"./src/types/loader.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"PlaylistContextType",function(){return W}),A.d(K,"PlaylistLevelType",function(){return M});var W;(function(P){P.MANIFEST="manifest",P.LEVEL="level",P.AUDIO_TRACK="audioTrack",P.SUBTITLE_TRACK="subtitleTrack"})(W||(W={}));var M;(function(P){P.MAIN="main",P.AUDIO="audio",P.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"ChunkMetadata",function(){return W});var W=function(U,k,R,D,g,b){D===void 0&&(D=0),g===void 0&&(g=-1),b===void 0&&(b=!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=U,this.sn=k,this.id=R,this.size=D,this.part=g,this.partial=b};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"AttrList",function(){return P});var W=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,P=function(){function U(R){typeof R=="string"&&(R=U.parseAttrList(R));for(var D in R)R.hasOwnProperty(D)&&(this[D]=R[D])}var k=U.prototype;return k.decimalInteger=function(D){var g=parseInt(this[D],10);return g>Number.MAX_SAFE_INTEGER?Infinity:g},k.hexadecimalInteger=function(D){if(this[D]){var g=(this[D]||"0x").slice(2);g=(g.length&1?"0":"")+g;for(var b=new Uint8Array(g.length/2),O=0;O<g.length/2;O++)b[O]=parseInt(g.slice(O*2,O*2+2),16);return b}else return null},k.hexadecimalIntegerAsNumber=function(D){var g=parseInt(this[D],16);return g>Number.MAX_SAFE_INTEGER?Infinity:g},k.decimalFloatingPoint=function(D){return parseFloat(this[D])},k.optionalFloat=function(D,g){var b=this[D];return b?parseFloat(b):g},k.enumeratedString=function(D){return this[D]},k.bool=function(D){return this[D]==="YES"},k.decimalResolution=function(D){var g=W.exec(this[D]);return g===null?void 0:{width:parseInt(g[1],10),height:parseInt(g[2],10)}},U.parseAttrList=function(D){var g,b={},O='"';for(M.lastIndex=0;(g=M.exec(D))!==null;){var T=g[2];T.indexOf(O)===0&&T.lastIndexOf(O)===T.length-1&&(T=T.slice(1,-1)),b[g[1]]=T}return b},U}()},"./src/utils/binary-search.ts":function(Z,K,A){"use strict";A.r(K);var W={search:function(P,U){for(var k=0,R=P.length-1,D=null,g=null;k<=R;){D=(k+R)/2|0,g=P[D];var b=U(g);if(b>0)k=D+1;else if(b<0)R=D-1;else return g}return null}};K.default=W},"./src/utils/buffer-helper.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"BufferHelper",function(){return P});var W=A("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},P=function(){function U(){}return U.isBuffered=function(R,D){try{if(R){for(var g=U.getBuffered(R),b=0;b<g.length;b++)if(D>=g.start(b)&&D<=g.end(b))return!0}}catch(O){}return!1},U.bufferInfo=function(R,D,g){try{if(R){var b=U.getBuffered(R),O=[],T;for(T=0;T<b.length;T++)O.push({start:b.start(T),end:b.end(T)});return this.bufferedInfo(O,D,g)}}catch(x){}return{len:0,start:D,end:D,nextStart:void 0}},U.bufferedInfo=function(R,D,g){D=Math.max(0,D),R.sort(function(m,l){var _=m.start-l.start;return _||l.end-m.end});var b=[];if(g)for(var O=0;O<R.length;O++){var T=b.length;if(T){var x=b[T-1].end;R[O].start-x<g?R[O].end>x&&(b[T-1].end=R[O].end):b.push(R[O])}else b.push(R[O])}else b=R;for(var S=0,c,o=D,d=D,u=0;u<b.length;u++){var w=b[u].start,y=b[u].end;if(D+g>=w&&D<y)o=w,d=y,S=d-D;else if(D+g<w){c=w;break}}return{len:S,start:o||0,end:d||0,nextStart:c}},U.getBuffered=function(R){try{return R.buffered}catch(D){return W.logger.log("failed to get media.buffered",D),M}},U}()},"./src/utils/cea-608-parser.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"Row",function(){return d}),A.d(K,"CaptionScreen",function(){return u});var W=A("./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(h){var s=h;return M.hasOwnProperty(h)&&(s=M[h]),String.fromCharCode(s)},U=15,k=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},g={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},b={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],T;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(T||(T={}));var x=function(){function f(){this.time=null,this.verboseLevel=T.ERROR}var h=f.prototype;return h.log=function(a,E){this.verboseLevel>=a&&W.logger.log(this.time+" ["+a+"] "+E)},f}(),S=function(h){for(var s=[],a=0;a<h.length;a++)s.push(h[a].toString(16));return s},c=function(){function f(s,a,E,v,p){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=s||"white",this.underline=a||!1,this.italics=E||!1,this.background=v||"black",this.flash=p||!1}var h=f.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(a){for(var E=["foreground","underline","italics","background","flash"],v=0;v<E.length;v++){var p=E[v];a.hasOwnProperty(p)&&(this[p]=a[p])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},h.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(s,a,E,v,p,L){this.uchar=void 0,this.penState=void 0,this.uchar=s||" ",this.penState=new c(a,E,v,p,L)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(a,E){this.uchar=a,this.penState.copy(E)},h.setPenState=function(a){this.penState.copy(a)},h.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},h.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},h.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),d=function(){function f(s){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<k;a++)this.chars.push(new o);this.logger=s,this.pos=0,this.currPenState=new c}var h=f.prototype;return h.equals=function(a){for(var E=!0,v=0;v<k;v++)if(!this.chars[v].equals(a.chars[v])){E=!1;break}return E},h.copy=function(a){for(var E=0;E<k;E++)this.chars[E].copy(a.chars[E])},h.isEmpty=function(){for(var a=!0,E=0;E<k;E++)if(!this.chars[E].isEmpty()){a=!1;break}return a},h.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(T.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>k&&(this.logger.log(T.DEBUG,"Too large cursor position "+this.pos),this.pos=k)},h.moveCursor=function(a){var E=this.pos+a;if(a>1)for(var v=this.pos+1;v<E+1;v++)this.chars[v].setPenState(this.currPenState);this.setCursor(E)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(a){a>=144&&this.backSpace();var E=P(a);if(this.pos>=k){this.logger.log(T.ERROR,"Cannot insert "+a.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(a){var E;for(E=a;E<k;E++)this.chars[E].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var a=[],E=!0,v=0;v<k;v++){var p=this.chars[v].uchar;p!==" "&&(E=!1),a.push(p)}return E?"":a.join("")},h.setPenStyles=function(a){this.currPenState.setStyles(a);var E=this.chars[this.pos];E.setPenState(this.currPenState)},f}(),u=function(){function f(s){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<U;a++)this.rows.push(new d(s));this.logger=s,this.currRow=U-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=f.prototype;return h.reset=function(){for(var a=0;a<U;a++)this.rows[a].clear();this.currRow=U-1},h.equals=function(a){for(var E=!0,v=0;v<U;v++)if(!this.rows[v].equals(a.rows[v])){E=!1;break}return E},h.copy=function(a){for(var E=0;E<U;E++)this.rows[E].copy(a.rows[E])},h.isEmpty=function(){for(var a=!0,E=0;E<U;E++)if(!this.rows[E].isEmpty()){a=!1;break}return a},h.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},h.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},h.insertChar=function(a){var E=this.rows[this.currRow];E.insertChar(a)},h.setPen=function(a){var E=this.rows[this.currRow];E.setPenStyles(a)},h.moveCursor=function(a){var E=this.rows[this.currRow];E.moveCursor(a)},h.setCursor=function(a){this.logger.log(T.INFO,"setCursor: "+a);var E=this.rows[this.currRow];E.setCursor(a)},h.setPAC=function(a){this.logger.log(T.INFO,"pacData = "+JSON.stringify(a));var E=a.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var v=0;v<U;v++)this.rows[v].clear();var p=this.currRow+1-this.nrRollUpRows,L=this.lastOutputScreen;if(L){var I=L.rows[p].cueStartTime,B=this.logger.time;if(I&&B!==null&&I<B)for(var z=0;z<this.nrRollUpRows;z++)this.rows[E-this.nrRollUpRows+z+1].copy(L.rows[p+z])}}this.currRow=E;var j=this.rows[this.currRow];if(a.indent!==null){var F=a.indent,X=Math.max(F-1,0);j.setCursor(a.indent),a.color=j.chars[X].penState.foreground}var te={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(te)},h.setBkgData=function(a){this.logger.log(T.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},h.setRollUpRows=function(a){this.nrRollUpRows=a},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(T.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(T.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(a,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(T.INFO,"Rolling up")},h.getDisplayText=function(a){a=a||!1;for(var E=[],v="",p=-1,L=0;L<U;L++){var I=this.rows[L].getTextString();I&&(p=L+1,a?E.push("Row "+p+": '"+I+"'"):E.push(I.trim()))}return E.length>0&&(a?v="["+E.join(" | ")+"]":v=E.join(`
`)),v},h.getTextAndFormat=function(){return this.rows},f}(),w=function(){function f(s,a,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=s,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(E),this.nonDisplayedMemory=new u(E),this.lastOutputScreen=new u(E),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var h=f.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(a){this.outputFilter=a},h.setPAC=function(a){this.writeScreen.setPAC(a)},h.setBkgData=function(a){this.writeScreen.setBkgData(a)},h.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(T.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},h.insertChars=function(a){for(var E=0;E<a.length;E++)this.writeScreen.insertChar(a[E]);var v=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(T.INFO,v+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(T.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(T.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(T.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(T.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(a){this.logger.log(T.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},h.ccFON=function(){this.logger.log(T.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(T.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(T.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(T.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(T.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(T.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(T.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(T.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(T.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(a){this.logger.log(T.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},h.ccMIDROW=function(a){var E={flash:!1};if(E.underline=a%2===1,E.italics=a>=46,E.italics)E.foreground="white";else{var v=Math.floor(a/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=p[v]}this.logger.log(T.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},h.outputDataUpdate=function(a){a===void 0&&(a=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),y=function(){function f(s,a,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var v=new x;this.channels=[null,new w(s,a,v),new w(s+1,E,v)],this.cmdHistory=_(),this.logger=v}var h=f.prototype;return h.getHandler=function(a){return this.channels[a].getHandler()},h.setHandler=function(a,E){this.channels[a].setHandler(E)},h.addData=function(a,E){var v,p,L,I=!1;this.logger.time=a;for(var B=0;B<E.length;B+=2){if(p=E[B]&127,L=E[B+1]&127,p===0&&L===0)continue;if(this.logger.log(T.DATA,"["+S([E[B],E[B+1]])+"] -> ("+S([p,L])+")"),v=this.parseCmd(p,L),v||(v=this.parseMidrow(p,L)),v||(v=this.parsePAC(p,L)),v||(v=this.parseBackgroundAttributes(p,L)),!v&&(I=this.parseChars(p,L),I)){var z=this.currentChannel;if(z&&z>0){var j=this.channels[z];j.insertChars(I)}else this.logger.log(T.WARNING,"No channel found yet. TEXT-MODE?")}!v&&!I&&this.logger.log(T.WARNING,"Couldn't parse cleaned data "+S([p,L])+" orig: "+S([E[B],E[B+1]]))}},h.parseCmd=function(a,E){var v=this.cmdHistory,p=(a===20||a===28||a===21||a===29)&&E>=32&&E<=47,L=(a===23||a===31)&&E>=33&&E<=35;if(!(p||L))return!1;if(l(a,E,v))return m(null,null,v),this.logger.log(T.DEBUG,"Repeated command ("+S([a,E])+") is dropped"),!0;var I=a===20||a===21||a===23?1:2,B=this.channels[I];return a===20||a===21||a===28||a===29?E===32?B.ccRCL():E===33?B.ccBS():E===34?B.ccAOF():E===35?B.ccAON():E===36?B.ccDER():E===37?B.ccRU(2):E===38?B.ccRU(3):E===39?B.ccRU(4):E===40?B.ccFON():E===41?B.ccRDC():E===42?B.ccTR():E===43?B.ccRTD():E===44?B.ccEDM():E===45?B.ccCR():E===46?B.ccENM():E===47&&B.ccEOC():B.ccTO(E-32),m(a,E,v),this.currentChannel=I,!0},h.parseMidrow=function(a,E){var v=0;if((a===17||a===25)&&E>=32&&E<=47){if(a===17?v=1:v=2,v!==this.currentChannel)return this.logger.log(T.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[v];return p?(p.ccMIDROW(E),this.logger.log(T.DEBUG,"MIDROW ("+S([a,E])+")"),!0):!1}return!1},h.parsePAC=function(a,E){var v,p=this.cmdHistory,L=(a>=17&&a<=23||a>=25&&a<=31)&&E>=64&&E<=127,I=(a===16||a===24)&&E>=64&&E<=95;if(!(L||I))return!1;if(l(a,E,p))return m(null,null,p),!0;var B=a<=23?1:2;E>=64&&E<=95?v=B===1?R[a]:g[a]:v=B===1?D[a]:b[a];var z=this.channels[B];return z?(z.setPAC(this.interpretPAC(v,E)),m(a,E,p),this.currentChannel=B,!0):!1},h.interpretPAC=function(a,E){var v,p={color:null,italics:!1,indent:null,underline:!1,row:a};return E>95?v=E-96:v=E-64,p.underline=(v&1)===1,v<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(v/2)]:v<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((v-16)/2)*4,p},h.parseChars=function(a,E){var v,p=null,L=null;if(a>=25?(v=2,L=a-8):(v=1,L=a),L>=17&&L<=19){var I;L===17?I=E+80:L===18?I=E+112:I=E+144,this.logger.log(T.INFO,"Special char '"+P(I)+"' in channel "+v),p=[I]}else a>=32&&a<=127&&(p=E===0?[a]:[a,E]);if(p){var B=S(p);this.logger.log(T.DEBUG,"Char codes = "+B.join(",")),m(a,E,this.cmdHistory)}return p},h.parseBackgroundAttributes=function(a,E){var v=(a===16||a===24)&&E>=32&&E<=47,p=(a===23||a===31)&&E>=45&&E<=47;if(!(v||p))return!1;var L,I={};a===16||a===24?(L=Math.floor((E-32)/2),I.background=O[L],E%2===1&&(I.background=I.background+"_semi")):E===45?I.background="transparent":(I.foreground="black",E===47&&(I.underline=!0));var B=a<=23?1:2,z=this.channels[B];return z.setBkgData(I),m(a,E,this.cmdHistory),!0},h.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var E=this.channels[a];E&&E.reset()}this.cmdHistory=_()},h.cueSplitAtTime=function(a){for(var E=0;E<this.channels.length;E++){var v=this.channels[E];v&&v.cueSplitAtTime(a)}},f}();function m(f,h,s){s.a=f,s.b=h}function l(f,h,s){return s.a===f&&s.b===h}function _(){return{a:null,b:null}}K.default=y},"./src/utils/codecs.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"isCodecType",function(){return M}),A.d(K,"isCodecSupportedInMp4",function(){return P});var W={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(U,k){var R=W[k];return!!R&&R[U.slice(0,4)]===!0}function P(U,k){return MediaSource.isTypeSupported((k||"video")+'/mp4;codecs="'+U+'"')}},"./src/utils/cues.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/utils/vttparser.ts"),M=A("./src/utils/webvtt-parser.ts"),P=A("./src/utils/texttrack-utils.ts"),U=/\s/,k={newCue:function(D,g,b,O){for(var T=[],x,S,c,o,d,u=self.VTTCue||self.TextTrackCue,w=0;w<O.rows.length;w++)if(x=O.rows[w],c=!0,o=0,d="",!x.isEmpty()){for(var y=0;y<x.chars.length;y++)U.test(x.chars[y].uchar)&&c?o++:(d+=x.chars[y].uchar,c=!1);x.cueStartTime=g,g===b&&(b+=1e-4),o>=16?o--:o++;var m=Object(W.fixLineBreaks)(d.trim()),l=Object(M.generateCueId)(g,b,m);(!D||!D.cues||!D.cues.getCueById(l))&&(S=new u(g,b,m),S.id=l,S.line=w+1,S.align="left",S.position=10+Math.min(80,Math.floor(o*8/32)*10),T.push(S))}return D&&T.length&&(T.sort(function(_,f){return _.line==="auto"||f.line==="auto"?0:_.line>8&&f.line>8?f.line-_.line:_.line-f.line}),T.forEach(function(_){return Object(P.addCueToTrack)(D,_)})),T}};K.default=k},"./src/utils/discontinuities.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"findFirstFragWithCC",function(){return U}),A.d(K,"shouldAlignOnDiscontinuities",function(){return k}),A.d(K,"findDiscontinuousReferenceFrag",function(){return R}),A.d(K,"adjustSlidingStart",function(){return g}),A.d(K,"alignStream",function(){return b}),A.d(K,"alignPDT",function(){return T}),A.d(K,"alignFragmentByPDTDelta",function(){return x}),A.d(K,"alignMediaPlaylistByPDT",function(){return S});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/logger.ts"),P=A("./src/controller/level-helper.ts");function U(c,o){for(var d=null,u=0,w=c.length;u<w;u++){var y=c[u];if(y&&y.cc===o){d=y;break}}return d}function k(c,o,d){return!!(o.details&&(d.endCC>d.startCC||c&&c.cc<d.startCC))}function R(c,o){var d=c.fragments,u=o.fragments;if(!u.length||!d.length){M.logger.log("No fragments to align");return}var w=U(d,u[0].cc);if(!w||w&&!w.startPTS){M.logger.log("No frag in previous level to align on");return}return w}function D(c,o){if(c){var d=c.start+o;c.start=c.startPTS=d,c.endPTS=d+c.duration}}function g(c,o){for(var d=o.fragments,u=0,w=d.length;u<w;u++)D(d[u],c);o.fragmentHint&&D(o.fragmentHint,c),o.alignedSliding=!0}function b(c,o,d){if(!o)return;O(c,d,o),!d.alignedSliding&&o.details&&T(d,o.details),!d.alignedSliding&&o.details&&!d.skippedSegments&&Object(P.adjustSliding)(o.details,d)}function O(c,o,d){if(k(c,d,o)){var u=R(d.details,o);u&&Object(W.isFiniteNumber)(u.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),g(u.start,o))}}function T(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var d=o.fragments[0].programDateTime,u=c.fragments[0].programDateTime,w=(u-d)/1e3+o.fragments[0].start;w&&Object(W.isFiniteNumber)(w)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(u-d)+"ms, sliding:"+w.toFixed(3)+" "+c.url+" "),g(w,c))}function x(c,o){var d=c.programDateTime;if(!d)return;var u=(d-o)/1e3;c.start=c.startPTS=u,c.endPTS=u+c.duration}function S(c,o){if(!o.fragments.length||!c.hasProgramDateTime||!o.hasProgramDateTime)return;var d=o.fragments[0].programDateTime,u=o.fragments[0].start,w=d-u*1e3;c.fragments.forEach(function(y){x(y,w)}),c.fragmentHint&&x(c.fragmentHint,w),c.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/utils/ewma.ts"),M=function(){function P(k,R,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new W.default(k),this.fast_=new W.default(R)}var U=P.prototype;return U.update=function(R,D){var g=this.slow_,b=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new W.default(R,g.getEstimate(),g.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new W.default(D,b.getEstimate(),b.getTotalWeight()))},U.sample=function(R,D){R=Math.max(R,this.minDelayMs_);var g=8*D,b=R/1e3,O=g/b;this.fast_.sample(b,O),this.slow_.sample(b,O)},U.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},P}();K.default=M},"./src/utils/ewma.ts":function(Z,K,A){"use strict";A.r(K);var W=function(){function M(U,k,R){k===void 0&&(k=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=k,this.totalWeight_=R}var P=M.prototype;return P.sample=function(k,R){var D=Math.pow(this.alpha_,k);this.estimate_=R*(1-D)+D*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}();K.default=W},"./src/utils/fetch-loader.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"fetchSupported",function(){return x});var W=A("./src/polyfills/number.ts"),M=A("./src/loader/load-stats.ts"),P=A("./src/demux/chunk-cache.ts");function U(u,w){u.prototype=Object.create(w.prototype),u.prototype.constructor=u,b(u,w)}function k(u){var w=typeof Map=="function"?new Map:void 0;return k=function(m){if(m===null||!g(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(m))return w.get(m);w.set(m,l)}function l(){return R(m,arguments,O(this).constructor)}return l.prototype=Object.create(m.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),b(l,m)},k(u)}function R(u,w,y){return D()?R=Reflect.construct:R=function(l,_,f){var h=[null];h.push.apply(h,_);var s=Function.bind.apply(l,h),a=new s;return f&&b(a,f.prototype),a},R.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function g(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function b(u,w){return b=Object.setPrototypeOf||function(m,l){return m.__proto__=l,m},b(u,w)}function O(u){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},O(u)}function T(){return T=Object.assign||function(u){for(var w=1;w<arguments.length;w++){var y=arguments[w];for(var m in y)Object.prototype.hasOwnProperty.call(y,m)&&(u[m]=y[m])}return u},T.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var S=function(){function u(y){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=y.fetchSetup||o,this.controller=new self.AbortController,this.stats=new M.LoadStats}var w=u.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(m,l,_){var f=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var s=c(m,this.controller.signal),a=_.onProgress,E=m.responseType==="arraybuffer",v=E?"byteLength":"length";this.context=m,this.config=l,this.callbacks=_,this.request=this.fetchSetup(m,s),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),_.onTimeout(h,m,f.response)},l.timeout),self.fetch(this.request).then(function(p){if(f.response=f.loader=p,!p.ok){var L=p.status,I=p.statusText;throw new d(I||"fetch, bad network response",L,p)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(p.headers.get("Content-Length")||"0"),a&&Object(W.isFiniteNumber)(l.highWaterMark)?f.loadProgressively(p,h,m,l.highWaterMark,a):E?p.arrayBuffer():p.text()}).then(function(p){var L=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=p[v];var I={url:L.url,data:p};a&&!Object(W.isFiniteNumber)(l.highWaterMark)&&a(h,m,p,L),_.onSuccess(I,h,m,L)}).catch(function(p){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var L=p.code||0;_.onError({code:L,text:p.message},m,p.details)})},w.getCacheAge=function(){var m=null;if(this.response){var l=this.response.headers.get("age");m=l?parseFloat(l):null}return m},w.loadProgressively=function(m,l,_,f,h){f===void 0&&(f=0);var s=new P.default,a=m.body.getReader(),E=function v(){return a.read().then(function(p){if(p.done)return s.dataLength&&h(l,_,s.flush(),m),Promise.resolve(new ArrayBuffer(0));var L=p.value,I=L.length;return l.loaded+=I,I<f||s.dataLength?(s.push(L),s.dataLength>=f&&h(l,_,s.flush(),m)):h(l,_,L,m),v()}).catch(function(){return Promise.reject()})};return E()},u}();function c(u,w){var y={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(T({},u.headers))};return u.rangeEnd&&y.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),y}function o(u,w){return new self.Request(u.url,w)}var d=function(u){U(w,u);function w(y,m,l){var _;return _=u.call(this,y)||this,_.code=void 0,_.details=void 0,_.code=m,_.details=l,_}return w}(k(Error));K.default=S},"./src/utils/imsc1-ttml-parser.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"IMSC1_CODEC",function(){return g}),A.d(K,"parseIMSC1",function(){return x});var W=A("./src/utils/mp4-tools.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/utils/vttcue.ts"),U=A("./src/demux/id3.ts"),k=A("./src/utils/timescale-conversion.ts"),R=A("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var s=arguments[h];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(f[a]=s[a])}return f},D.apply(this,arguments)}var g="stpp.ttml.im1t",b=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,T={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(f,h,s,a,E){var v=Object(W.findBox)(new Uint8Array(f),["mdat"]);if(v.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var p=v[0],L=Object(U.utf8ArrayToStr)(new Uint8Array(f,p.start,p.end-p.start)),I=Object(k.toTimescaleFromScale)(h,1,s);try{a(S(L,I))}catch(B){E(B)}}function S(f,h){var s=new DOMParser,a=s.parseFromString(f,"text/xml"),E=a.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var v={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},p=Object.keys(v).reduce(function(j,F){return j[F]=E.getAttribute("ttp:"+F)||v[F],j},{}),L=E.getAttribute("xml:space")!=="preserve",I=o(c(E,"styling","style")),B=o(c(E,"layout","region")),z=c(E,"body","[begin]");return[].map.call(z,function(j){var F=d(j,L);if(!F||!j.hasAttribute("begin"))return null;var X=m(j.getAttribute("begin"),p),te=m(j.getAttribute("dur"),p),ie=m(j.getAttribute("end"),p);if(X===null)throw y(j);if(ie===null){if(te===null)throw y(j);ie=X+te}var le=new P.default(X-h,ie-h,F);le.id=Object(R.generateCueId)(le.startTime,le.endTime,le.text);var _e=B[j.getAttribute("region")],me=I[j.getAttribute("style")];le.position=10,le.size=80;var he=u(_e,me),fe=he.textAlign;if(fe){var ce=T[fe];ce&&(le.lineAlign=ce),le.align=fe}return D(le,he),le}).filter(function(j){return j!==null})}function c(f,h,s){var a=f.getElementsByTagName(h)[0];return a?[].slice.call(a.querySelectorAll(s)):[]}function o(f){return f.reduce(function(h,s){var a=s.getAttribute("xml:id");return a&&(h[a]=s),h},{})}function d(f,h){return[].slice.call(f.childNodes).reduce(function(s,a,E){var v;return a.nodeName==="br"&&E?s+`
`:(v=a.childNodes)!==null&&v!==void 0&&v.length?d(a,h):h?s+a.textContent.trim().replace(/\s+/g," "):s+a.textContent},"")}function u(f,h){var s="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(E,v){var p=w(h,s,v)||w(f,s,v);return p&&(E[v]=p),E},{})}function w(f,h,s){return f.hasAttributeNS(h,s)?f.getAttributeNS(h,s):null}function y(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,h){if(!f)return null;var s=Object(M.parseTimeStamp)(f);return s===null&&(b.test(f)?s=l(f,h):O.test(f)&&(s=_(f,h))),s}function l(f,h){var s=b.exec(f),a=(s[4]|0)+(s[5]|0)/h.subFrameRate;return(s[1]|0)*3600+(s[2]|0)*60+(s[3]|0)+a/h.frameRate}function _(f,h){var s=O.exec(f),a=Number(s[1]),E=s[2];switch(E){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/h.frameRate;case"t":return a/h.tickRate}return a}},"./src/utils/logger.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"enableLogs",function(){return R}),A.d(K,"logger",function(){return D});var W=function(){},M={trace:W,debug:W,log:W,warn:W,info:W,error:W},P=M;function U(g){var b=self.console[g];return b?b.bind(self.console,"["+g+"] >"):W}function k(g){for(var b=arguments.length,O=new Array(b>1?b-1:0),T=1;T<b;T++)O[T-1]=arguments[T];O.forEach(function(x){P[x]=g[x]?g[x].bind(g):U(x)})}function R(g){if(self.console&&g===!0||typeof g=="object"){k(g,"debug","log","info","warn","error");try{P.log()}catch(b){P=M}}else P=M}var D=P},"./src/utils/mediakeys-helper.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"KeySystems",function(){return W}),A.d(K,"requestMediaKeySystemAccess",function(){return M});var W;(function(P){P.WIDEVINE="com.widevine.alpha",P.PLAYREADY="com.microsoft.playready"})(W||(W={}));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(Z,K,A){"use strict";A.r(K),A.d(K,"getMediaSource",function(){return W});function W(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"bin2str",function(){return k}),A.d(K,"readUint16",function(){return R}),A.d(K,"readUint32",function(){return D}),A.d(K,"writeUint32",function(){return g}),A.d(K,"findBox",function(){return b}),A.d(K,"parseSegmentIndex",function(){return O}),A.d(K,"parseInitSegment",function(){return T}),A.d(K,"getStartDTS",function(){return x}),A.d(K,"getDuration",function(){return S}),A.d(K,"computeRawDurationFromSamples",function(){return c}),A.d(K,"offsetStartDTS",function(){return o}),A.d(K,"segmentValidRange",function(){return d}),A.d(K,"appendUint8Array",function(){return u});var W=A("./src/utils/typed-array.ts"),M=A("./src/loader/fragment.ts"),P=Math.pow(2,32)-1,U=[].push;function k(w){return String.fromCharCode.apply(null,w)}function R(w,y){"data"in w&&(y+=w.start,w=w.data);var m=w[y]<<8|w[y+1];return m<0?65536+m:m}function D(w,y){"data"in w&&(y+=w.start,w=w.data);var m=w[y]<<24|w[y+1]<<16|w[y+2]<<8|w[y+3];return m<0?4294967296+m:m}function g(w,y,m){"data"in w&&(y+=w.start,w=w.data),w[y]=m>>24,w[y+1]=m>>16&255,w[y+2]=m>>8&255,w[y+3]=m&255}function b(w,y){var m=[];if(!y.length)return m;var l,_,f;"data"in w?(l=w.data,_=w.start,f=w.end):(l=w,_=0,f=l.byteLength);for(var h=_;h<f;){var s=D(l,h),a=k(l.subarray(h+4,h+8)),E=s>1?h+s:f;if(a===y[0])if(y.length===1)m.push({data:l,start:h+8,end:E});else{var v=b({data:l,start:h+8,end:E},y.slice(1));v.length&&U.apply(m,v)}h=E}return m}function O(w){var y=b(w,["moov"]),m=y[0],l=m?m.end:null,_=b(w,["sidx"]);if(!_||!_[0])return null;var f=[],h=_[0],s=h.data[0],a=s===0?8:16,E=D(h,a);a+=4;var v=0,p=0;s===0?a+=8:a+=16,a+=2;var L=h.end+p,I=R(h,a);a+=2;for(var B=0;B<I;B++){var z=a,j=D(h,z);z+=4;var F=j&2147483647,X=(j&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var te=D(h,z);z+=4,f.push({referenceSize:F,subsegmentDuration:te,info:{duration:te/E,start:L,end:L+F-1}}),L+=F,z+=4,a=z}return{earliestPresentationTime:v,timescale:E,version:s,referencesCount:I,references:f,moovEndOffset:l}}function T(w){for(var y=[],m=b(w,["moov","trak"]),l=0;l<m.length;l++){var _=m[l],f=b(_,["tkhd"])[0];if(f){var h=f.data[f.start],s=h===0?12:20,a=D(f,s),E=b(_,["mdia","mdhd"])[0];if(E){h=E.data[E.start],s=h===0?12:20;var v=D(E,s),p=b(_,["mdia","hdlr"])[0];if(p){var L=k(p.data.subarray(p.start+8,p.start+12)),I={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[L];if(I){var B=b(_,["mdia","minf","stbl","stsd"])[0],z=void 0;B&&(z=k(B.data.subarray(B.start+12,B.start+16))),y[a]={timescale:v,type:I},y[I]={timescale:v,id:a,codec:z}}}}}}var j=b(w,["moov","mvex","trex"]);return j.forEach(function(F){var X=D(F,4),te=y[X];te&&(te.default={duration:D(F,12),flags:D(F,20)})}),y}function x(w,y){return b(y,["moof","traf"]).reduce(function(m,l){var _=b(l,["tfdt"])[0],f=_.data[_.start],h=b(l,["tfhd"]).reduce(function(s,a){var E=D(a,4),v=w[E];if(v){var p=D(_,4);f===1&&(p*=Math.pow(2,32),p+=D(_,8));var L=v.timescale||9e4,I=p/L;if(isFinite(I)&&(s===null||I<s))return I}return s},null);return h!==null&&isFinite(h)&&(m===null||h<m)?h:m},null)||0}function S(w,y){for(var m=0,l=0,_=0,f=b(w,["moof","traf"]),h=0;h<f.length;h++){var s=f[h],a=b(s,["tfhd"])[0],E=D(a,4),v=y[E];if(!v)continue;var p=v.default,L=D(a,0)|(p==null?void 0:p.flags),I=p==null?void 0:p.duration;L&8&&(L&2?I=D(a,12):I=D(a,8));for(var B=v.timescale||9e4,z=b(s,["trun"]),j=0;j<z.length;j++){if(I){var F=D(z[j],4);m=I*F}else m=c(z[j]);v.type===M.ElementaryStreamTypes.VIDEO?l+=m/B:v.type===M.ElementaryStreamTypes.AUDIO&&(_+=m/B)}}if(l===0&&_===0){var X=O(w);if(X!=null&&X.references)return X.references.reduce(function(te,ie){return te+ie.info.duration||0},0)}return l||_}function c(w){var y=D(w,0),m=8;y&1&&(m+=4),y&4&&(m+=4);for(var l=0,_=D(w,4),f=0;f<_;f++){if(y&256){var h=D(w,m);l+=h,m+=4}y&512&&(m+=4),y&1024&&(m+=4),y&2048&&(m+=4)}return l}function o(w,y,m){b(y,["moof","traf"]).forEach(function(l){b(l,["tfhd"]).forEach(function(_){var f=D(_,4),h=w[f];if(!h)return;var s=h.timescale||9e4;b(l,["tfdt"]).forEach(function(a){var E=a.data[a.start],v=D(a,4);if(E===0)g(a,4,v-m*s);else{v*=Math.pow(2,32),v+=D(a,8),v-=m*s,v=Math.max(v,0);var p=Math.floor(v/(P+1)),L=Math.floor(v%(P+1));g(a,4,p),g(a,8,L)}})})})}function d(w){var y={valid:null,remainder:null},m=b(w,["moof"]);if(m){if(m.length<2)return y.remainder=w,y}else return y;var l=m[m.length-1];return y.valid=Object(W.sliceUint8)(w,0,l.start-8),y.remainder=Object(W.sliceUint8)(w,l.start-8),y}function u(w,y){var m=new Uint8Array(w.length+y.length);return m.set(w),m.set(y,w.length),m}},"./src/utils/output-filter.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"default",function(){return W});var W=function(){function M(U,k){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=U,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,R,D){(this.startTime===null||this.startTime>k)&&(this.startTime=k),this.endTime=R,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},P.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"sendAddTrackEvent",function(){return M}),A.d(K,"addCueToTrack",function(){return P}),A.d(K,"clearCurrentCues",function(){return U}),A.d(K,"removeCuesInRange",function(){return k}),A.d(K,"getCuesInRange",function(){return D});var W=A("./src/utils/logger.ts");function M(g,b){var O;try{O=new Event("addtrack")}catch(T){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=g,b.dispatchEvent(O)}function P(g,b){var O=g.mode;if(O==="disabled"&&(g.mode="hidden"),g.cues&&!g.cues.getCueById(b.id))try{if(g.addCue(b),!g.cues.getCueById(b.id))throw new Error("addCue is failed for: "+b)}catch(x){W.logger.debug("[texttrack-utils]: "+x);var T=new self.TextTrackCue(b.startTime,b.endTime,b.text);T.id=b.id,g.addCue(T)}O==="disabled"&&(g.mode=O)}function U(g){var b=g.mode;if(b==="disabled"&&(g.mode="hidden"),g.cues)for(var O=g.cues.length;O--;)g.removeCue(g.cues[O]);b==="disabled"&&(g.mode=b)}function k(g,b,O){var T=g.mode;if(T==="disabled"&&(g.mode="hidden"),g.cues&&g.cues.length>0)for(var x=D(g.cues,b,O),S=0;S<x.length;S++)g.removeCue(x[S]);T==="disabled"&&(g.mode=T)}function R(g,b){if(b<g[0].startTime)return 0;var O=g.length-1;if(b>g[O].endTime)return-1;for(var T=0,x=O;T<=x;){var S=Math.floor((x+T)/2);if(b<g[S].startTime)x=S-1;else if(b>g[S].startTime&&T<O)T=S+1;else return S}return g[T].startTime-b<b-g[x].startTime?T:x}function D(g,b,O){var T=[],x=R(g,b);if(x>-1)for(var S=x,c=g.length;S<c;S++){var o=g[S];if(o.startTime>=b&&o.endTime<=O)T.push(o);else if(o.startTime>O)return T}return T}},"./src/utils/time-ranges.ts":function(Z,K,A){"use strict";A.r(K);var W={toString:function(P){for(var U="",k=P.length,R=0;R<k;R++)U+="["+P.start(R).toFixed(3)+","+P.end(R).toFixed(3)+"]";return U}};K.default=W},"./src/utils/timescale-conversion.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"toTimescaleFromBase",function(){return M}),A.d(K,"toTimescaleFromScale",function(){return P}),A.d(K,"toMsFromMpegTsClock",function(){return U}),A.d(K,"toMpegTsClockFromTimescale",function(){return k});var W=9e4;function M(R,D,g,b){g===void 0&&(g=1),b===void 0&&(b=!1);var O=R*D*g;return b?Math.round(O):O}function P(R,D,g,b){return g===void 0&&(g=1),b===void 0&&(b=!1),M(R,D,1/g,b)}function U(R,D){return D===void 0&&(D=!1),M(R,1e3,1/W,D)}function k(R,D){return D===void 0&&(D=1),M(R,W,1/D)}},"./src/utils/typed-array.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"sliceUint8",function(){return W});function W(M,P,U){return Uint8Array.prototype.slice?M.slice(P,U):new Uint8Array(Array.prototype.slice.call(M,P,U))}},"./src/utils/vttcue.ts":function(Z,K,A){"use strict";A.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var W=["","lr","rl"],M=["start","middle","end","left","right"];function P(g,b){if(typeof b!="string")return!1;if(!Array.isArray(g))return!1;var O=b.toLowerCase();return~g.indexOf(O)?O:!1}function U(g){return P(W,g)}function k(g){return P(M,g)}function R(g){for(var b=arguments.length,O=new Array(b>1?b-1:0),T=1;T<b;T++)O[T-1]=arguments[T];for(var x=1;x<arguments.length;x++){var S=arguments[x];for(var c in S)g[c]=S[c]}return g}function D(g,b,O){var T=this,x={enumerable:!0};T.hasBeenReset=!1;var S="",c=!1,o=g,d=b,u=O,w=null,y="",m=!0,l="auto",_="start",f=50,h="middle",s=50,a="middle";Object.defineProperty(T,"id",R({},x,{get:function(){return S},set:function(v){S=""+v}})),Object.defineProperty(T,"pauseOnExit",R({},x,{get:function(){return c},set:function(v){c=!!v}})),Object.defineProperty(T,"startTime",R({},x,{get:function(){return o},set:function(v){if(typeof v!="number")throw new TypeError("Start time must be set to a number.");o=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"endTime",R({},x,{get:function(){return d},set:function(v){if(typeof v!="number")throw new TypeError("End time must be set to a number.");d=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"text",R({},x,{get:function(){return u},set:function(v){u=""+v,this.hasBeenReset=!0}})),Object.defineProperty(T,"region",R({},x,{get:function(){return w},set:function(v){w=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"vertical",R({},x,{get:function(){return y},set:function(v){var p=U(v);if(p===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=p,this.hasBeenReset=!0}})),Object.defineProperty(T,"snapToLines",R({},x,{get:function(){return m},set:function(v){m=!!v,this.hasBeenReset=!0}})),Object.defineProperty(T,"line",R({},x,{get:function(){return l},set:function(v){if(typeof v!="number"&&v!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");l=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"lineAlign",R({},x,{get:function(){return _},set:function(v){var p=k(v);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");_=p,this.hasBeenReset=!0}})),Object.defineProperty(T,"position",R({},x,{get:function(){return f},set:function(v){if(v<0||v>100)throw new Error("Position must be between 0 and 100.");f=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"positionAlign",R({},x,{get:function(){return h},set:function(v){var p=k(v);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(T,"size",R({},x,{get:function(){return s},set:function(v){if(v<0||v>100)throw new Error("Size must be between 0 and 100.");s=v,this.hasBeenReset=!0}})),Object.defineProperty(T,"align",R({},x,{get:function(){return a},set:function(v){var p=k(v);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");a=p,this.hasBeenReset=!0}})),T.displayState=void 0}return D.prototype.getCueAsHTML=function(){var g=self.WebVTT;return g.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"parseTimeStamp",function(){return P}),A.d(K,"fixLineBreaks",function(){return b}),A.d(K,"VTTParser",function(){return O});var W=A("./src/utils/vttcue.ts"),M=function(){function T(){}var x=T.prototype;return x.decode=function(c,o){if(!c)return"";if(typeof c!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(c))},T}();function P(T){function x(c,o,d,u){return(c|0)*3600+(o|0)*60+(d|0)+parseFloat(u||0)}var S=T.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return S?parseFloat(S[2])>59?x(S[2],S[3],0,S[4]):x(S[1],S[2],S[3],S[4]):null}var U=function(){function T(){this.values=Object.create(null)}var x=T.prototype;return x.set=function(c,o){!this.get(c)&&o!==""&&(this.values[c]=o)},x.get=function(c,o,d){return d?this.has(c)?this.values[c]:o[d]:this.has(c)?this.values[c]:o},x.has=function(c){return c in this.values},x.alt=function(c,o,d){for(var u=0;u<d.length;++u)if(o===d[u]){this.set(c,o);break}},x.integer=function(c,o){/^-?\d+$/.test(o)&&this.set(c,parseInt(o,10))},x.percent=function(c,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var d=parseFloat(o);if(d>=0&&d<=100)return this.set(c,d),!0}return!1},T}();function k(T,x,S,c){var o=c?T.split(c):[T];for(var d in o){if(typeof o[d]!="string")continue;var u=o[d].split(S);if(u.length!==2)continue;var w=u[0],y=u[1];x(w,y)}}var R=new W.default(0,0,""),D=R.align==="middle"?"middle":"center";function g(T,x,S){var c=T;function o(){var w=P(T);if(w===null)throw new Error("Malformed timestamp: "+c);return T=T.replace(/^[^\sa-zA-Z-]+/,""),w}function d(w,y){var m=new U;k(w,function(f,h){var s;switch(f){case"region":for(var a=S.length-1;a>=0;a--)if(S[a].id===h){m.set(f,S[a].region);break}break;case"vertical":m.alt(f,h,["rl","lr"]);break;case"line":s=h.split(","),m.integer(f,s[0]),m.percent(f,s[0])&&m.set("snapToLines",!1),m.alt(f,s[0],["auto"]),s.length===2&&m.alt("lineAlign",s[1],["start",D,"end"]);break;case"position":s=h.split(","),m.percent(f,s[0]),s.length===2&&m.alt("positionAlign",s[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,h);break;case"align":m.alt(f,h,["start",D,"end","left","right"]);break}},/:/,/\s/),y.region=m.get("region",null),y.vertical=m.get("vertical","");var l=m.get("line","auto");l==="auto"&&R.line===-1&&(l=-1),y.line=l,y.lineAlign=m.get("lineAlign","start"),y.snapToLines=m.get("snapToLines",!0),y.size=m.get("size",100),y.align=m.get("align",D);var _=m.get("position","auto");_==="auto"&&R.position===50&&(_=y.align==="start"||y.align==="left"?0:y.align==="end"||y.align==="right"?100:50),y.position=_}function u(){T=T.replace(/^\s+/,"")}if(u(),x.startTime=o(),u(),T.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+c);T=T.substr(3),u(),x.endTime=o(),u(),d(T,x)}function b(T){return T.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function T(){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 x=T.prototype;return x.parse=function(c){var o=this;c&&(o.buffer+=o.decoder.decode(c,{stream:!0}));function d(){var _=o.buffer,f=0;for(_=b(_);f<_.length&&_[f]!=="\r"&&_[f]!==`
`;)++f;var h=_.substr(0,f);return _[f]==="\r"&&++f,_[f]===`
`&&++f,o.buffer=_.substr(f),h}function u(_){k(_,function(f,h){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=d();var y=w.match(/^()?WEBVTT([ \t].*)?$/);if(!y||!y[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:w=d();switch(o.state){case"HEADER":/:/.test(w)?u(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new W.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{g(w,o.cue,o.regionList)}catch(_){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var l=w.indexOf("-->")!==-1;if(!w||l&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(_){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.flush=function(){var c=this;try{if((c.cue||c.state==="HEADER")&&(c.buffer+=`
`,c.parse()),c.state==="INITIAL"||c.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){c.onparsingerror&&c.onparsingerror(o)}return c.onflush&&c.onflush(),this},T}()},"./src/utils/webvtt-parser.ts":function(Z,K,A){"use strict";A.r(K),A.d(K,"generateCueId",function(){return O}),A.d(K,"parseWebVTT",function(){return x});var W=A("./src/polyfills/number.ts"),M=A("./src/utils/vttparser.ts"),P=A("./src/demux/id3.ts"),U=A("./src/utils/timescale-conversion.ts"),k=A("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,D=function(c,o,d){return d===void 0&&(d=0),c.substr(d,o.length)===o},g=function(c){var o=parseInt(c.substr(-3)),d=parseInt(c.substr(-6,2)),u=parseInt(c.substr(-9,2)),w=c.length>9?parseInt(c.substr(0,c.indexOf(":"))):0;if(!Object(W.isFiniteNumber)(o)||!Object(W.isFiniteNumber)(d)||!Object(W.isFiniteNumber)(u)||!Object(W.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+c);return o+=1e3*d,o+=60*1e3*u,o+=60*60*1e3*w,o},b=function(c){for(var o=5381,d=c.length;d;)o=o*33^c.charCodeAt(--d);return(o>>>0).toString()};function O(S,c,o){return b(S.toString())+b(c.toString())+b(o)}var T=function(c,o,d){var u=c[o],w=c[u.prevCC];if(!w||!w.new&&u.new){c.ccOffset=c.presentationOffset=u.start,u.new=!1;return}for(;(y=w)!==null&&y!==void 0&&y.new;){var y;c.ccOffset+=u.start-w.start,u.new=!1,u=w,w=c[u.prevCC]}c.presentationOffset=d};function x(S,c,o,d,u,w,y,m){var l=new M.VTTParser,_=Object(P.utf8ArrayToStr)(new Uint8Array(S)).trim().replace(R,`
`).split(`
`),f=[],h=Object(U.toMpegTsClockFromTimescale)(c,o),s="00:00.000",a=0,E=0,v,p=!0,L=!1;l.oncue=function(I){var B=d[u],z=d.ccOffset,j=(a-h)/9e4;if(B!=null&&B.new&&(E!==void 0?z=d.ccOffset=B.start:T(d,u,j)),j&&(z=j-d.presentationOffset),L){var F=I.endTime-I.startTime,X=Object(k.normalizePts)((I.startTime+z-E)*9e4,w*9e4)/9e4;I.startTime=X,I.endTime=X+F}var te=I.text.trim();I.text=decodeURIComponent(encodeURIComponent(te)),I.id||(I.id=O(I.startTime,I.endTime,te)),I.endTime>0&&f.push(I)},l.onparsingerror=function(I){v=I},l.onflush=function(){if(v){m(v);return}y(f)},_.forEach(function(I){if(p)if(D(I,"X-TIMESTAMP-MAP=")){p=!1,L=!0,I.substr(16).split(",").forEach(function(B){D(B,"LOCAL:")?s=B.substr(6):D(B,"MPEGTS:")&&(a=parseInt(B.substr(7)))});try{E=g(s)/1e3}catch(B){L=!1,v=B}return}else I===""&&(p=!1);l.parse(I+`
`)}),l.flush()}},"./src/utils/xhr-loader.ts":function(Z,K,A){"use strict";A.r(K);var W=A("./src/utils/logger.ts"),M=A("./src/loader/load-stats.ts"),P=/^age:\s*[\d.]+\s*$/m,U=function(){function k(D){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=D?D.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var R=k.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var g=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),g&&(g.onreadystatechange=null,g.onprogress=null,g.readyState!==4&&(this.stats.aborted=!0,g.abort()))},R.abort=function(){var g;this.abortInternal(),(g=this.callbacks)!==null&&g!==void 0&&g.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(g,b,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=g,this.config=b,this.callbacks=O,this.retryDelay=b.retryDelay,this.loadInternal()},R.loadInternal=function(){var g=this.config,b=this.context;if(!g)return;var O=this.loader=new self.XMLHttpRequest,T=this.stats;T.loading.first=0,T.loaded=0;var x=this.xhrSetup;try{if(x)try{x(O,b.url)}catch(o){O.open("GET",b.url,!0),x(O,b.url)}O.readyState||O.open("GET",b.url,!0);var S=this.context.headers;if(S)for(var c in S)O.setRequestHeader(c,S[c])}catch(o){this.callbacks.onError({code:O.status,text:o.message},b,O);return}b.rangeEnd&&O.setRequestHeader("Range","bytes="+b.rangeStart+"-"+(b.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=b.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),g.timeout),O.send()},R.readystatechange=function(){var g=this.context,b=this.loader,O=this.stats;if(!g||!b)return;var T=b.readyState,x=this.config;if(O.aborted)return;if(T>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),T===4){b.onreadystatechange=null,b.onprogress=null;var S=b.status;if(S>=200&&S<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var c,o;if(g.responseType==="arraybuffer"?(c=b.response,o=c.byteLength):(c=b.responseText,o=c.length),O.loaded=O.total=o,!this.callbacks)return;var d=this.callbacks.onProgress;if(d&&d(O,g,c,b),!this.callbacks)return;var u={url:b.responseURL,data:c};this.callbacks.onSuccess(u,O,g,b)}else O.retry>=x.maxRetry||S>=400&&S<499?(W.logger.error(S+" while loading "+g.url),this.callbacks.onError({code:S,text:b.statusText},g,b)):(W.logger.warn(S+" while loading "+g.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,x.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},R.loadtimeout=function(){W.logger.warn("timeout while loading "+this.context.url);var g=this.callbacks;g&&(this.abortInternal(),g.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(g){var b=this.stats;b.loaded=g.loaded,g.lengthComputable&&(b.total=g.total)},R.getCacheAge=function(){var g=null;if(this.loader&&P.test(this.loader.getAllResponseHeaders())){var b=this.loader.getResponseHeader("age");g=b?parseFloat(b):null}return g},k}();K.default=U}}).default})},wU8J:function(qe,Xe){function $(){this.buffer=new Array,this.length=0}$.prototype={get:function(Z){var K=Math.floor(Z/8);return(this.buffer[K]>>>7-Z%8&1)==1},put:function(Z,K){for(var A=0;A<K;A++)this.putBit((Z>>>K-A-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(Z){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),Z&&(this.buffer[K]|=128>>>this.length%8),this.length++}},qe.exports=$}}]);