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__Shixuns__New__ImagePrevi...

387 lines
1.5 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

(window.webpackJsonp=window.webpackJsonp||[]).push([[231,5,6,7,19],{"+NIl":function(ot,se,ee){(function(z){z(ee("VrN/"))})(function(z){"use strict";z.defineMode("stex",function(L,D){"use strict";function k(l,t){l.cmdState.push(t)}function M(l){return l.cmdState.length>0?l.cmdState[l.cmdState.length-1]:null}function f(l){var t=l.cmdState.pop();t&&t.closeBracket()}function S(l){for(var t=l.cmdState,a=t.length-1;a>=0;a--){var i=t[a];if(i.name=="DEFAULT")continue;return i}return{styleIdentifier:function(){return null}}}function _(l,t,a){return function(){this.name=l,this.bracketNo=0,this.style=t,this.styles=a,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var p={};p.importmodule=_("importmodule","tag",["string","builtin"]),p.documentclass=_("documentclass","tag",["","atom"]),p.usepackage=_("usepackage","tag",["atom"]),p.begin=_("begin","tag",["atom"]),p.end=_("end","tag",["atom"]),p.label=_("label","tag",["atom"]),p.ref=_("ref","tag",["atom"]),p.eqref=_("eqref","tag",["atom"]),p.cite=_("cite","tag",["atom"]),p.bibitem=_("bibitem","tag",["atom"]),p.Bibitem=_("Bibitem","tag",["atom"]),p.RBibitem=_("RBibitem","tag",["atom"]),p.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function c(l,t){l.f=t}function o(l,t){var a;if(l.match(/^\\[a-zA-Z@]+/)){var i=l.current().slice(1);return a=p.hasOwnProperty(i)?p[i]:p.DEFAULT,a=new a,k(t,a),c(t,s),a.style}if(l.match(/^\\[$&%#{}_]/))return"tag";if(l.match(/^\\[,;!\/\\]/))return"tag";if(l.match("\\["))return c(t,function(h,d){return u(h,d,"\\]")}),"keyword";if(l.match("\\("))return c(t,function(h,d){return u(h,d,"\\)")}),"keyword";if(l.match("$$"))return c(t,function(h,d){return u(h,d,"$$")}),"keyword";if(l.match("$"))return c(t,function(h,d){return u(h,d,"$")}),"keyword";var r=l.next();if(r=="%")return l.skipToEnd(),"comment";if(r=="}"||r=="]"){if(a=M(t),a)a.closeBracket(r),c(t,s);else return"error";return"bracket"}else return r=="{"||r=="["?(a=p.DEFAULT,a=new a,k(t,a),"bracket"):/\d/.test(r)?(l.eatWhile(/[\w.%]/),"atom"):(l.eatWhile(/[\w\-_]/),a=S(t),a.name=="begin"&&(a.argument=l.current()),a.styleIdentifier())}function u(l,t,a){if(l.eatSpace())return null;if(a&&l.match(a))return c(t,o),"keyword";if(l.match(/^\\[a-zA-Z@]+/))return"tag";if(l.match(/^[a-zA-Z]+/))return"variable-2";if(l.match(/^\\[$&%#{}_]/))return"tag";if(l.match(/^\\[,;!\/]/))return"tag";if(l.match(/^[\^_&]/))return"tag";if(l.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(l.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var i=l.next();return i=="{"||i=="}"||i=="["||i=="]"||i=="("||i==")"?"bracket":i=="%"?(l.skipToEnd(),"comment"):"error"}function s(l,t){var a=l.peek(),i;return a=="{"||a=="["?(i=M(t),i.openBracket(a),l.eat(a),c(t,o),"bracket"):/[ \t\r]/.test(a)?(l.eat(a),null):(c(t,o),f(t),o(l,t))}return{startState:function(){var l=D.inMathMode?function(t,a){return u(t,a)}:o;return{cmdState:[],f:l}},copyState:function(l){return{cmdState:l.cmdState.slice(),f:l.f}},token:function(l,t){return t.f(l,t)},blankLine:function(l){l.f=o,l.cmdState.length=0},lineComment:"%"}}),z.defineMIME("text/x-stex","stex"),z.defineMIME("text/x-latex","stex")})},"+ua5":function(ot,se,ee){},"/POA":function(ot,se,ee){!function(z,L){if(!0)ot.exports=L();else var D,k}(window,function(){return function(z){var L={};function D(k){if(L[k])return L[k].exports;var M=L[k]={i:k,l:!1,exports:{}};return z[k].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=z,D.c=L,D.d=function(k,M,f){D.o(k,M)||Object.defineProperty(k,M,{enumerable:!0,get:f})},D.r=function(k){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(k,"__esModule",{value:!0})},D.t=function(k,M){if(1&M&&(k=D(k)),8&M)return k;if(4&M&&typeof k=="object"&&k&&k.__esModule)return k;var f=Object.create(null);if(D.r(f),Object.defineProperty(f,"default",{enumerable:!0,value:k}),2&M&&typeof k!="string")for(var S in k)D.d(f,S,function(_){return k[_]}.bind(null,S));return f},D.n=function(k){var M=k&&k.__esModule?function(){return k.default}:function(){return k};return D.d(M,"a",M),M},D.o=function(k,M){return Object.prototype.hasOwnProperty.call(k,M)},D.p="",D(D.s=34)}([function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.forwardEvent=L.EventEmitter=void 0;var k=function(){function M(){this._listeners=[],this._disposed=!1}return Object.defineProperty(M.prototype,"event",{get:function(){var f=this;return this._event||(this._event=function(S){return f._listeners.push(S),{dispose:function(){if(!f._disposed){for(var _=0;_<f._listeners.length;_++)if(f._listeners[_]===S)return void f._listeners.splice(_,1)}}}}),this._event},enumerable:!1,configurable:!0}),M.prototype.fire=function(f,S){for(var _=[],p=0;p<this._listeners.length;p++)_.push(this._listeners[p]);for(p=0;p<_.length;p++)_[p].call(void 0,f,S)},M.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},M}();L.EventEmitter=k,L.forwardEvent=function(M,f){return M(function(S){return f.fire(S)})}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.IUnicodeService=L.IOptionsService=L.ILogService=L.IInstantiationService=L.IDirtyRowService=L.ICharsetService=L.ICoreService=L.ICoreMouseService=L.IBufferService=void 0;var k=D(14);L.IBufferService=k.createDecorator("BufferService"),L.ICoreMouseService=k.createDecorator("CoreMouseService"),L.ICoreService=k.createDecorator("CoreService"),L.ICharsetService=k.createDecorator("CharsetService"),L.IDirtyRowService=k.createDecorator("DirtyRowService"),L.IInstantiationService=k.createDecorator("InstantiationService"),L.ILogService=k.createDecorator("LogService"),L.IOptionsService=k.createDecorator("OptionsService"),L.IUnicodeService=k.createDecorator("UnicodeService")},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.getDisposeArrayDisposable=L.disposeArray=L.Disposable=void 0;var k=function(){function f(){this._disposables=[],this._isDisposed=!1}return f.prototype.dispose=function(){this._isDisposed=!0;for(var S=0,_=this._disposables;S<_.length;S++)_[S].dispose();this._disposables.length=0},f.prototype.register=function(S){return this._disposables.push(S),S},f.prototype.unregister=function(S){var _=this._disposables.indexOf(S);_!==-1&&this._disposables.splice(_,1)},f}();function M(f){for(var S=0,_=f;S<_.length;S++)_[S].dispose();f.length=0}L.Disposable=k,L.disposeArray=M,L.getDisposeArrayDisposable=function(f){return{dispose:function(){return M(f)}}}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.WHITESPACE_CELL_CODE=L.WHITESPACE_CELL_WIDTH=L.WHITESPACE_CELL_CHAR=L.NULL_CELL_CODE=L.NULL_CELL_WIDTH=L.NULL_CELL_CHAR=L.CHAR_DATA_CODE_INDEX=L.CHAR_DATA_WIDTH_INDEX=L.CHAR_DATA_CHAR_INDEX=L.CHAR_DATA_ATTR_INDEX=L.DEFAULT_ATTR=L.DEFAULT_COLOR=void 0,L.DEFAULT_COLOR=256,L.DEFAULT_ATTR=256|L.DEFAULT_COLOR<<9,L.CHAR_DATA_ATTR_INDEX=0,L.CHAR_DATA_CHAR_INDEX=1,L.CHAR_DATA_WIDTH_INDEX=2,L.CHAR_DATA_CODE_INDEX=3,L.NULL_CELL_CHAR="",L.NULL_CELL_WIDTH=1,L.NULL_CELL_CODE=0,L.WHITESPACE_CELL_CHAR=" ",L.WHITESPACE_CELL_WIDTH=1,L.WHITESPACE_CELL_CODE=32},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(c,o){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,s){u.__proto__=s}||function(u,s){for(var l in s)s.hasOwnProperty(l)&&(u[l]=s[l])})(c,o)},function(c,o){function u(){this.constructor=c}k(c,o),c.prototype=o===null?Object.create(o):(u.prototype=o.prototype,new u)});Object.defineProperty(L,"__esModule",{value:!0}),L.CellData=void 0;var f=D(8),S=D(3),_=D(6),p=function(c){function o(){var u=c!==null&&c.apply(this,arguments)||this;return u.content=0,u.fg=0,u.bg=0,u.extended=new _.ExtendedAttrs,u.combinedData="",u}return M(o,c),o.fromCharData=function(u){var s=new o;return s.setFromCharData(u),s},o.prototype.isCombined=function(){return 2097152&this.content},o.prototype.getWidth=function(){return this.content>>22},o.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?f.stringFromCodePoint(2097151&this.content):""},o.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},o.prototype.setFromCharData=function(u){this.fg=u[S.CHAR_DATA_ATTR_INDEX],this.bg=0;var s=!1;if(u[S.CHAR_DATA_CHAR_INDEX].length>2)s=!0;else if(u[S.CHAR_DATA_CHAR_INDEX].length===2){var l=u[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=l&&l<=56319){var t=u[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(l-55296)+t-56320+65536|u[S.CHAR_DATA_WIDTH_INDEX]<<22:s=!0}else s=!0}else this.content=u[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|u[S.CHAR_DATA_WIDTH_INDEX]<<22;s&&(this.combinedData=u[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|u[S.CHAR_DATA_WIDTH_INDEX]<<22)},o.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},o}(_.AttributeData);L.CellData=p},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.ISoundService=L.ISelectionService=L.IRenderService=L.IMouseService=L.ICoreBrowserService=L.ICharSizeService=void 0;var k=D(14);L.ICharSizeService=k.createDecorator("CharSizeService"),L.ICoreBrowserService=k.createDecorator("CoreBrowserService"),L.IMouseService=k.createDecorator("MouseService"),L.IRenderService=k.createDecorator("RenderService"),L.ISelectionService=k.createDecorator("SelectionService"),L.ISoundService=k.createDecorator("SoundService")},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.ExtendedAttrs=L.AttributeData=void 0;var k=function(){function f(){this.fg=0,this.bg=0,this.extended=new M}return f.toColorRGB=function(S){return[S>>>16&255,S>>>8&255,255&S]},f.fromColorRGB=function(S){return(255&S[0])<<16|(255&S[1])<<8|255&S[2]},f.prototype.clone=function(){var S=new f;return S.fg=this.fg,S.bg=this.bg,S.extended=this.extended.clone(),S},f.prototype.isInverse=function(){return 67108864&this.fg},f.prototype.isBold=function(){return 134217728&this.fg},f.prototype.isUnderline=function(){return 268435456&this.fg},f.prototype.isBlink=function(){return 536870912&this.fg},f.prototype.isInvisible=function(){return 1073741824&this.fg},f.prototype.isItalic=function(){return 67108864&this.bg},f.prototype.isDim=function(){return 134217728&this.bg},f.prototype.getFgColorMode=function(){return 50331648&this.fg},f.prototype.getBgColorMode=function(){return 50331648&this.bg},f.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},f.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},f.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},f.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},f.prototype.isFgDefault=function(){return(50331648&this.fg)==0},f.prototype.isBgDefault=function(){return(50331648&this.bg)==0},f.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},f.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},f.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},f.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},f.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},f.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},f.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},f.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},f.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},f.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},f.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},f}();L.AttributeData=k;var M=function(){function f(S,_){S===void 0&&(S=0),_===void 0&&(_=-1),this.underlineStyle=S,this.underlineColor=_}return f.prototype.clone=function(){return new f(this.underlineStyle,this.underlineColor)},f.prototype.isEmpty=function(){return this.underlineStyle===0},f}();L.ExtendedAttrs=M},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.addDisposableDomListener=void 0,L.addDisposableDomListener=function(k,M,f,S){k.addEventListener(M,f,S);var _=!1;return{dispose:function(){_||(_=!0,k.removeEventListener(M,f,S))}}}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.Utf8ToUtf32=L.StringToUtf32=L.utf32ToString=L.stringFromCodePoint=void 0,L.stringFromCodePoint=function(f){return f>65535?(f-=65536,String.fromCharCode(55296+(f>>10))+String.fromCharCode(f%1024+56320)):String.fromCharCode(f)},L.utf32ToString=function(f,S,_){S===void 0&&(S=0),_===void 0&&(_=f.length);for(var p="",c=S;c<_;++c){var o=f[c];o>65535?(o-=65536,p+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):p+=String.fromCharCode(o)}return p};var k=function(){function f(){this._interim=0}return f.prototype.clear=function(){this._interim=0},f.prototype.decode=function(S,_){var p=S.length;if(!p)return 0;var c=0,o=0;this._interim&&(56320<=(l=S.charCodeAt(o++))&&l<=57343?_[c++]=1024*(this._interim-55296)+l-56320+65536:(_[c++]=this._interim,_[c++]=l),this._interim=0);for(var u=o;u<p;++u){var s=S.charCodeAt(u);if(55296<=s&&s<=56319){if(++u>=p)return this._interim=s,c;var l;56320<=(l=S.charCodeAt(u))&&l<=57343?_[c++]=1024*(s-55296)+l-56320+65536:(_[c++]=s,_[c++]=l)}else _[c++]=s}return c},f}();L.StringToUtf32=k;var M=function(){function f(){this.interim=new Uint8Array(3)}return f.prototype.clear=function(){this.interim.fill(0)},f.prototype.decode=function(S,_){var p=S.length;if(!p)return 0;var c,o,u,s,l=0,t=0,a=0;if(this.interim[0]){var i=!1,r=this.interim[0];r&=(224&r)==192?31:(240&r)==224?15:7;for(var h=0,d=void 0;(d=63&this.interim[++h])&&h<4;)r<<=6,r|=d;for(var y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=y-h;a<m;){if(a>=p)return 0;if((192&(d=S[a++]))!=128){a--,i=!0;break}this.interim[h++]=d,r<<=6,r|=63&d}i||(y===2?r<128?a--:_[l++]=r:y===3?r<2048||r>=55296&&r<=57343||(_[l++]=r):r<65536||r>1114111||(_[l++]=r)),this.interim.fill(0)}for(var C=p-4,T=a;T<p;){for(;!(!(T<C)||128&(c=S[T])||128&(o=S[T+1])||128&(u=S[T+2])||128&(s=S[T+3]));)_[l++]=c,_[l++]=o,_[l++]=u,_[l++]=s,T+=4;if((c=S[T++])<128)_[l++]=c;else if((224&c)==192){if(T>=p)return this.interim[0]=c,l;if((192&(o=S[T++]))!=128){T--;continue}if((t=(31&c)<<6|63&o)<128){T--;continue}_[l++]=t}else if((240&c)==224){if(T>=p)return this.interim[0]=c,l;if((192&(o=S[T++]))!=128){T--;continue}if(T>=p)return this.interim[0]=c,this.interim[1]=o,l;if((192&(u=S[T++]))!=128){T--;continue}if((t=(15&c)<<12|(63&o)<<6|63&u)<2048||t>=55296&&t<=57343)continue;_[l++]=t}else if((248&c)==240){if(T>=p)return this.interim[0]=c,l;if((192&(o=S[T++]))!=128){T--;continue}if(T>=p)return this.interim[0]=c,this.interim[1]=o,l;if((192&(u=S[T++]))!=128){T--;continue}if(T>=p)return this.interim[0]=c,this.interim[1]=o,this.interim[2]=u,l;if((192&(s=S[T++]))!=128){T--;continue}if((t=(7&c)<<18|(63&o)<<12|(63&u)<<6|63&s)<65536||t>1114111)continue;_[l++]=t}}return l},f}();L.Utf8ToUtf32=M},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.CHAR_ATLAS_CELL_SPACING=L.DIM_OPACITY=L.INVERTED_DEFAULT_COLOR=void 0,L.INVERTED_DEFAULT_COLOR=257,L.DIM_OPACITY=.5,L.CHAR_ATLAS_CELL_SPACING=1},function(z,L,D){"use strict";var k,M,f,S;function _(c){var o=c.toString(16);return o.length<2?"0"+o:o}function p(c,o){return c<o?(o+.05)/(c+.05):(c+.05)/(o+.05)}Object.defineProperty(L,"__esModule",{value:!0}),L.contrastRatio=L.toPaddedHex=L.rgba=L.rgb=L.css=L.color=L.channels=void 0,function(c){c.toCss=function(o,u,s,l){return l!==void 0?"#"+_(o)+_(u)+_(s)+_(l):"#"+_(o)+_(u)+_(s)},c.toRgba=function(o,u,s,l){return l===void 0&&(l=255),(o<<24|u<<16|s<<8|l)>>>0}}(k=L.channels||(L.channels={})),(M=L.color||(L.color={})).blend=function(c,o){var u=(255&o.rgba)/255;if(u===1)return{css:o.css,rgba:o.rgba};var s=o.rgba>>24&255,l=o.rgba>>16&255,t=o.rgba>>8&255,a=c.rgba>>24&255,i=c.rgba>>16&255,r=c.rgba>>8&255,h=a+Math.round((s-a)*u),d=i+Math.round((l-i)*u),y=r+Math.round((t-r)*u);return{css:k.toCss(h,d,y),rgba:k.toRgba(h,d,y)}},M.isOpaque=function(c){return(255&c.rgba)==255},M.ensureContrastRatio=function(c,o,u){var s=S.ensureContrastRatio(c.rgba,o.rgba,u);if(s)return S.toColor(s>>24&255,s>>16&255,s>>8&255)},M.opaque=function(c){var o=(255|c.rgba)>>>0,u=S.toChannels(o),s=u[0],l=u[1],t=u[2];return{css:k.toCss(s,l,t),rgba:o}},M.opacity=function(c,o){var u=Math.round(255*o),s=S.toChannels(c.rgba),l=s[0],t=s[1],a=s[2];return{css:k.toCss(l,t,a,u),rgba:k.toRgba(l,t,a,u)}},(L.css||(L.css={})).toColor=function(c){switch(c.length){case 7:return{css:c,rgba:(parseInt(c.slice(1),16)<<8|255)>>>0};case 9:return{css:c,rgba:parseInt(c.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(c){function o(u,s,l){var t=u/255,a=s/255,i=l/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))}c.relativeLuminance=function(u){return o(u>>16&255,u>>8&255,255&u)},c.relativeLuminance2=o}(f=L.rgb||(L.rgb={})),function(c){function o(s,l,t){for(var a=s>>24&255,i=s>>16&255,r=s>>8&255,h=l>>24&255,d=l>>16&255,y=l>>8&255,m=p(f.relativeLuminance2(h,y,d),f.relativeLuminance2(a,i,r));m<t&&(h>0||d>0||y>0);)h-=Math.max(0,Math.ceil(.1*h)),d-=Math.max(0,Math.ceil(.1*d)),y-=Math.max(0,Math.ceil(.1*y)),m=p(f.relativeLuminance2(h,y,d),f.relativeLuminance2(a,i,r));return(h<<24|d<<16|y<<8|255)>>>0}function u(s,l,t){for(var a=s>>24&255,i=s>>16&255,r=s>>8&255,h=l>>24&255,d=l>>16&255,y=l>>8&255,m=p(f.relativeLuminance2(h,y,d),f.relativeLuminance2(a,i,r));m<t&&(h<255||d<255||y<255);)h=Math.min(255,h+Math.ceil(.1*(255-h))),d=Math.min(255,d+Math.ceil(.1*(255-d))),y=Math.min(255,y+Math.ceil(.1*(255-y))),m=p(f.relativeLuminance2(h,y,d),f.relativeLuminance2(a,i,r));return(h<<24|d<<16|y<<8|255)>>>0}c.ensureContrastRatio=function(s,l,t){var a=f.relativeLuminance(s>>8),i=f.relativeLuminance(l>>8);if(p(a,i)<t)return i<a?o(s,l,t):u(s,l,t)},c.reduceLuminance=o,c.increaseLuminance=u,c.toChannels=function(s){return[s>>24&255,s>>16&255,s>>8&255,255&s]},c.toColor=function(s,l,t){return{css:k.toCss(s,l,t),rgba:k.toRgba(s,l,t)}}}(S=L.rgba||(L.rgba={})),L.toPaddedHex=_,L.contrastRatio=p},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.isLinux=L.isWindows=L.isIphone=L.isIpad=L.isMac=L.isSafari=L.isFirefox=void 0;var k=typeof navigator=="undefined",M=k?"node":navigator.userAgent,f=k?"node":navigator.platform;function S(_,p){return _.indexOf(p)>=0}L.isFirefox=!!~M.indexOf("Firefox"),L.isSafari=/^((?!chrome|android).)*safari/i.test(M),L.isMac=S(["Macintosh","MacIntel","MacPPC","Mac68K"],f),L.isIpad=f==="iPad",L.isIphone=f==="iPhone",L.isWindows=S(["Windows","Win16","Win32","WinCE"],f),L.isLinux=f.indexOf("Linux")>=0},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.C1=L.C0=void 0,function(k){k.NUL="\0",k.SOH="",k.STX="",k.ETX="",k.EOT="",k.ENQ="",k.ACK="",k.BEL="\x07",k.BS="\b",k.HT=" ",k.LF=`
`,k.VT="\v",k.FF="\f",k.CR="\r",k.SO="",k.SI="",k.DLE="",k.DC1="",k.DC2="",k.DC3="",k.DC4="",k.NAK="",k.SYN="",k.ETB="",k.CAN="",k.EM="",k.SUB="",k.ESC="",k.FS="",k.GS="",k.RS="",k.US="",k.SP=" ",k.DEL="\x7F"}(L.C0||(L.C0={})),function(k){k.PAD="\x80",k.HOP="\x81",k.BPH="\x82",k.NBH="\x83",k.IND="\x84",k.NEL="\x85",k.SSA="\x86",k.ESA="\x87",k.HTS="\x88",k.HTJ="\x89",k.VTS="\x8A",k.PLD="\x8B",k.PLU="\x8C",k.RI="\x8D",k.SS2="\x8E",k.SS3="\x8F",k.DCS="\x90",k.PU1="\x91",k.PU2="\x92",k.STS="\x93",k.CCH="\x94",k.MW="\x95",k.SPA="\x96",k.EPA="\x97",k.SOS="\x98",k.SGCI="\x99",k.SCI="\x9A",k.CSI="\x9B",k.ST="\x9C",k.OSC="\x9D",k.PM="\x9E",k.APC="\x9F"}(L.C1||(L.C1={}))},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.BaseRenderLayer=void 0;var k=D(3),M=D(9),f=D(25),S=D(6),_=D(28),p=D(10),c=D(17),o=function(){function u(s,l,t,a,i,r,h,d){this._container=s,this._alpha=a,this._colors=i,this._rendererId=r,this._bufferService=h,this._optionsService=d,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+l+"-layer"),this._canvas.style.zIndex=t.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return u.prototype.dispose=function(){var s;c.removeElementFromParent(this._canvas),(s=this._charAtlas)===null||s===void 0||s.dispose()},u.prototype._initCanvas=function(){this._ctx=_.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},u.prototype.onOptionsChanged=function(){},u.prototype.onBlur=function(){},u.prototype.onFocus=function(){},u.prototype.onCursorMove=function(){},u.prototype.onGridChanged=function(s,l){},u.prototype.onSelectionChanged=function(s,l,t){t===void 0&&(t=!1)},u.prototype.setColors=function(s){this._refreshCharAtlas(s)},u.prototype._setTransparency=function(s){if(s!==this._alpha){var l=this._canvas;this._alpha=s,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,l),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},u.prototype._refreshCharAtlas=function(s){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=f.acquireCharAtlas(this._optionsService.options,this._rendererId,s,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},u.prototype.resize=function(s){this._scaledCellWidth=s.scaledCellWidth,this._scaledCellHeight=s.scaledCellHeight,this._scaledCharWidth=s.scaledCharWidth,this._scaledCharHeight=s.scaledCharHeight,this._scaledCharLeft=s.scaledCharLeft,this._scaledCharTop=s.scaledCharTop,this._canvas.width=s.scaledCanvasWidth,this._canvas.height=s.scaledCanvasHeight,this._canvas.style.width=s.canvasWidth+"px",this._canvas.style.height=s.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},u.prototype._fillCells=function(s,l,t,a){this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,t*this._scaledCellWidth,a*this._scaledCellHeight)},u.prototype._fillBottomLineAtCells=function(s,l,t){t===void 0&&(t=1),this._ctx.fillRect(s*this._scaledCellWidth,(l+1)*this._scaledCellHeight-window.devicePixelRatio-1,t*this._scaledCellWidth,window.devicePixelRatio)},u.prototype._fillLeftLineAtCell=function(s,l,t){this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,window.devicePixelRatio*t,this._scaledCellHeight)},u.prototype._strokeRectAtCell=function(s,l,t,a){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(s*this._scaledCellWidth+window.devicePixelRatio/2,l*this._scaledCellHeight+window.devicePixelRatio/2,t*this._scaledCellWidth-window.devicePixelRatio,a*this._scaledCellHeight-window.devicePixelRatio)},u.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},u.prototype._clearCells=function(s,l,t,a){this._alpha?this._ctx.clearRect(s*this._scaledCellWidth,l*this._scaledCellHeight,t*this._scaledCellWidth,a*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,t*this._scaledCellWidth,a*this._scaledCellHeight))},u.prototype._fillCharTrueColor=function(s,l,t){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(t),this._ctx.fillText(s.getChars(),l*this._scaledCellWidth+this._scaledCharLeft,t*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},u.prototype._drawChars=function(s,l,t){var a,i,r=this._getContrastColor(s);r||s.isFgRGB()||s.isBgRGB()?this._drawUncachedChars(s,l,t,r):(s.isInverse()?(a=s.isBgDefault()?M.INVERTED_DEFAULT_COLOR:s.getBgColor(),i=s.isFgDefault()?M.INVERTED_DEFAULT_COLOR:s.getFgColor()):(i=s.isBgDefault()?k.DEFAULT_COLOR:s.getBgColor(),a=s.isFgDefault()?k.DEFAULT_COLOR:s.getFgColor()),a+=this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&a<8?8:0,this._currentGlyphIdentifier.chars=s.getChars()||k.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=s.getCode()||k.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=i,this._currentGlyphIdentifier.fg=a,this._currentGlyphIdentifier.bold=!!s.isBold(),this._currentGlyphIdentifier.dim=!!s.isDim(),this._currentGlyphIdentifier.italic=!!s.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,l*this._scaledCellWidth+this._scaledCharLeft,t*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(s,l,t))},u.prototype._drawUncachedChars=function(s,l,t,a){if(this._ctx.save(),this._ctx.font=this._getFont(!!s.isBold(),!!s.isItalic()),this._ctx.textBaseline="middle",s.isInverse())if(a)this._ctx.fillStyle=a.css;else if(s.isBgDefault())this._ctx.fillStyle=p.color.opaque(this._colors.background).css;else if(s.isBgRGB())this._ctx.fillStyle="rgb("+S.AttributeData.toColorRGB(s.getBgColor()).join(",")+")";else{var i=s.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&i<8&&(i+=8),this._ctx.fillStyle=this._colors.ansi[i].css}else if(a)this._ctx.fillStyle=a.css;else if(s.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(s.isFgRGB())this._ctx.fillStyle="rgb("+S.AttributeData.toColorRGB(s.getFgColor()).join(",")+")";else{var r=s.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&r<8&&(r+=8),this._ctx.fillStyle=this._colors.ansi[r].css}this._clipRow(t),s.isDim()&&(this._ctx.globalAlpha=M.DIM_OPACITY),this._ctx.fillText(s.getChars(),l*this._scaledCellWidth+this._scaledCharLeft,t*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},u.prototype._clipRow=function(s){this._ctx.beginPath(),this._ctx.rect(0,s*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},u.prototype._getFont=function(s,l){return(l?"italic":"")+" "+(s?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},u.prototype._getContrastColor=function(s){if(this._optionsService.options.minimumContrastRatio!==1){var l=this._colors.contrastCache.getColor(s.bg,s.fg);if(l!==void 0)return l||void 0;var t=s.getFgColor(),a=s.getFgColorMode(),i=s.getBgColor(),r=s.getBgColorMode(),h=!!s.isInverse(),d=!!s.isInverse();if(h){var y=t;t=i,i=y;var m=a;a=r,r=m}var C=this._resolveBackgroundRgba(r,i,h),T=this._resolveForegroundRgba(a,t,h,d),x=p.rgba.ensureContrastRatio(C,T,this._optionsService.options.minimumContrastRatio);if(x){var E={css:p.channels.toCss(x>>24&255,x>>16&255,x>>8&255),rgba:x};return this._colors.contrastCache.setColor(s.bg,s.fg,E),E}this._colors.contrastCache.setColor(s.bg,s.fg,null)}},u.prototype._resolveBackgroundRgba=function(s,l,t){switch(s){case 16777216:case 33554432:return this._colors.ansi[l].rgba;case 50331648:return l<<8;case 0:default:return t?this._colors.foreground.rgba:this._colors.background.rgba}},u.prototype._resolveForegroundRgba=function(s,l,t,a){switch(s){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&a&&l<8&&(l+=8),this._colors.ansi[l].rgba;case 50331648:return l<<8;case 0:default:return t?this._colors.background.rgba:this._colors.foreground.rgba}},u}();L.BaseRenderLayer=o},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.createDecorator=L.getServiceDependencies=L.serviceRegistry=void 0;function k(M,f,S){f.di$target===f?f.di$dependencies.push({id:M,index:S}):(f.di$dependencies=[{id:M,index:S}],f.di$target=f)}L.serviceRegistry=new Map,L.getServiceDependencies=function(M){return M.di$dependencies||[]},L.createDecorator=function(M){if(L.serviceRegistry.has(M))return L.serviceRegistry.get(M);var f=function(S,_,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");k(f,S,p)};return f.toString=function(){return M},L.serviceRegistry.set(M,f),f}},function(z,L,D){"use strict";function k(M,f,S,_){if(S===void 0&&(S=0),_===void 0&&(_=M.length),S>=M.length)return M;S=(M.length+S)%M.length,_=_>=M.length?M.length:(M.length+_)%M.length;for(var p=S;p<_;++p)M[p]=f;return M}Object.defineProperty(L,"__esModule",{value:!0}),L.concat=L.fillFallback=L.fill=void 0,L.fill=function(M,f,S,_){return M.fill?M.fill(f,S,_):k(M,f,S,_)},L.fillFallback=k,L.concat=function(M,f){var S=new M.constructor(M.length+f.length);return S.set(M),S.set(f,M.length),S}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.BufferLine=L.DEFAULT_ATTR_DATA=void 0;var k=D(8),M=D(3),f=D(4),S=D(6);L.DEFAULT_ATTR_DATA=Object.freeze(new S.AttributeData);var _=function(){function p(c,o,u){u===void 0&&(u=!1),this.isWrapped=u,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*c);for(var s=o||f.CellData.fromCharData([0,M.NULL_CELL_CHAR,M.NULL_CELL_WIDTH,M.NULL_CELL_CODE]),l=0;l<c;++l)this.setCell(l,s);this.length=c}return p.prototype.get=function(c){var o=this._data[3*c+0],u=2097151&o;return[this._data[3*c+1],2097152&o?this._combined[c]:u?k.stringFromCodePoint(u):"",o>>22,2097152&o?this._combined[c].charCodeAt(this._combined[c].length-1):u]},p.prototype.set=function(c,o){this._data[3*c+1]=o[M.CHAR_DATA_ATTR_INDEX],o[M.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[c]=o[1],this._data[3*c+0]=2097152|c|o[M.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*c+0]=o[M.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[M.CHAR_DATA_WIDTH_INDEX]<<22},p.prototype.getWidth=function(c){return this._data[3*c+0]>>22},p.prototype.hasWidth=function(c){return 12582912&this._data[3*c+0]},p.prototype.getFg=function(c){return this._data[3*c+1]},p.prototype.getBg=function(c){return this._data[3*c+2]},p.prototype.hasContent=function(c){return 4194303&this._data[3*c+0]},p.prototype.getCodePoint=function(c){var o=this._data[3*c+0];return 2097152&o?this._combined[c].charCodeAt(this._combined[c].length-1):2097151&o},p.prototype.isCombined=function(c){return 2097152&this._data[3*c+0]},p.prototype.getString=function(c){var o=this._data[3*c+0];return 2097152&o?this._combined[c]:2097151&o?k.stringFromCodePoint(2097151&o):""},p.prototype.loadCell=function(c,o){var u=3*c;return o.content=this._data[u+0],o.fg=this._data[u+1],o.bg=this._data[u+2],2097152&o.content&&(o.combinedData=this._combined[c]),268435456&o.bg&&(o.extended=this._extendedAttrs[c]),o},p.prototype.setCell=function(c,o){2097152&o.content&&(this._combined[c]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[c]=o.extended),this._data[3*c+0]=o.content,this._data[3*c+1]=o.fg,this._data[3*c+2]=o.bg},p.prototype.setCellFromCodePoint=function(c,o,u,s,l,t){268435456&l&&(this._extendedAttrs[c]=t),this._data[3*c+0]=o|u<<22,this._data[3*c+1]=s,this._data[3*c+2]=l},p.prototype.addCodepointToCell=function(c,o){var u=this._data[3*c+0];2097152&u?this._combined[c]+=k.stringFromCodePoint(o):(2097151&u?(this._combined[c]=k.stringFromCodePoint(2097151&u)+k.stringFromCodePoint(o),u&=-2097152,u|=2097152):u=o|1<<22,this._data[3*c+0]=u)},p.prototype.insertCells=function(c,o,u,s){if((c%=this.length)&&this.getWidth(c-1)===2&&this.setCellFromCodePoint(c-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs),o<this.length-c){for(var l=new f.CellData,t=this.length-c-o-1;t>=0;--t)this.setCell(c+o+t,this.loadCell(c+t,l));for(t=0;t<o;++t)this.setCell(c+t,u)}else for(t=c;t<this.length;++t)this.setCell(t,u);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs)},p.prototype.deleteCells=function(c,o,u,s){if(c%=this.length,o<this.length-c){for(var l=new f.CellData,t=0;t<this.length-c-o;++t)this.setCell(c+t,this.loadCell(c+o+t,l));for(t=this.length-o;t<this.length;++t)this.setCell(t,u)}else for(t=c;t<this.length;++t)this.setCell(t,u);c&&this.getWidth(c-1)===2&&this.setCellFromCodePoint(c-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs),this.getWidth(c)!==0||this.hasContent(c)||this.setCellFromCodePoint(c,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs)},p.prototype.replaceCells=function(c,o,u,s){for(c&&this.getWidth(c-1)===2&&this.setCellFromCodePoint(c-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new S.ExtendedAttrs);c<o&&c<this.length;)this.setCell(c++,u)},p.prototype.resize=function(c,o){if(c!==this.length){if(c>this.length){var u=new Uint32Array(3*c);this.length&&(3*c<this._data.length?u.set(this._data.subarray(0,3*c)):u.set(this._data)),this._data=u;for(var s=this.length;s<c;++s)this.setCell(s,o)}else if(c){(u=new Uint32Array(3*c)).set(this._data.subarray(0,3*c)),this._data=u;var l=Object.keys(this._combined);for(s=0;s<l.length;s++){var t=parseInt(l[s],10);t>=c&&delete this._combined[t]}}else this._data=new Uint32Array(0),this._combined={};this.length=c}},p.prototype.fill=function(c){this._combined={},this._extendedAttrs={};for(var o=0;o<this.length;++o)this.setCell(o,c)},p.prototype.copyFrom=function(c){for(var o in this.length!==c.length?this._data=new Uint32Array(c._data):this._data.set(c._data),this.length=c.length,this._combined={},c._combined)this._combined[o]=c._combined[o];for(var o in this._extendedAttrs={},c._extendedAttrs)this._extendedAttrs[o]=c._extendedAttrs[o];this.isWrapped=c.isWrapped},p.prototype.clone=function(){var c=new p(0);for(var o in c._data=new Uint32Array(this._data),c.length=this.length,this._combined)c._combined[o]=this._combined[o];for(var o in this._extendedAttrs)c._extendedAttrs[o]=this._extendedAttrs[o];return c.isWrapped=this.isWrapped,c},p.prototype.getTrimmedLength=function(){for(var c=this.length-1;c>=0;--c)if(4194303&this._data[3*c+0])return c+(this._data[3*c+0]>>22);return 0},p.prototype.copyCellsFrom=function(c,o,u,s,l){var t=c._data;if(l)for(var a=s-1;a>=0;a--)for(var i=0;i<3;i++)this._data[3*(u+a)+i]=t[3*(o+a)+i];else for(a=0;a<s;a++)for(i=0;i<3;i++)this._data[3*(u+a)+i]=t[3*(o+a)+i];var r=Object.keys(c._combined);for(i=0;i<r.length;i++){var h=parseInt(r[i],10);h>=o&&(this._combined[h-o+u]=c._combined[h])}},p.prototype.translateToString=function(c,o,u){c===void 0&&(c=!1),o===void 0&&(o=0),u===void 0&&(u=this.length),c&&(u=Math.min(u,this.getTrimmedLength()));for(var s="";o<u;){var l=this._data[3*o+0],t=2097151&l;s+=2097152&l?this._combined[o]:t?k.stringFromCodePoint(t):M.WHITESPACE_CELL_CHAR,o+=l>>22||1}return s},p}();L.BufferLine=_},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.removeElementFromParent=void 0,L.removeElementFromParent=function(){for(var k,M=[],f=0;f<arguments.length;f++)M[f]=arguments[f];for(var S=0,_=M;S<_.length;S++){var p=_[S];(k=p==null?void 0:p.parentElement)===null||k===void 0||k.removeChild(p)}}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.tooMuchOutput=L.promptLabel=void 0,L.promptLabel="Terminal input",L.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(T,x){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,w){E.__proto__=w}||function(E,w){for(var A in w)w.hasOwnProperty(A)&&(E[A]=w[A])})(T,x)},function(T,x){function E(){this.constructor=T}k(T,x),T.prototype=x===null?Object.create(x):(E.prototype=x.prototype,new E)});Object.defineProperty(L,"__esModule",{value:!0}),L.InputHandler=L.WindowsOptionsReportType=void 0;var f,S=D(12),_=D(20),p=D(39),c=D(2),o=D(15),u=D(8),s=D(16),l=D(0),t=D(3),a=D(4),i=D(6),r=D(22),h=D(24),d={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function y(T,x){if(T>24)return x.setWinLines||!1;switch(T){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}!function(T){T[T.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",T[T.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(f=L.WindowsOptionsReportType||(L.WindowsOptionsReportType={}));var m=function(){function T(x,E,w,A){this._bufferService=x,this._coreService=E,this._logService=w,this._optionsService=A,this._data=new Uint32Array(0)}return T.prototype.hook=function(x){this._data=new Uint32Array(0)},T.prototype.put=function(x,E,w){this._data=o.concat(this._data,x.subarray(E,w))},T.prototype.unhook=function(x){if(x){var E=u.utf32ToString(this._data);switch(this._data=new Uint32Array(0),E){case'"q':return this._coreService.triggerDataEvent(S.C0.ESC+'P1$r0"q'+S.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(S.C0.ESC+'P1$r61;1"p'+S.C0.ESC+"\\");case"r":var w=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(S.C0.ESC+"P1$r"+w+S.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(S.C0.ESC+"P1$r0m"+S.C0.ESC+"\\");case" q":var A={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return A-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(S.C0.ESC+"P1$r"+A+" q"+S.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",E),this._coreService.triggerDataEvent(S.C0.ESC+"P0$r"+S.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},T}(),C=function(T){function x(E,w,A,g,P,O,F,X,W){W===void 0&&(W=new p.EscapeSequenceParser);var N=T.call(this)||this;N._bufferService=E,N._charsetService=w,N._coreService=A,N._dirtyRowService=g,N._logService=P,N._optionsService=O,N._coreMouseService=F,N._unicodeService=X,N._parser=W,N._parseBuffer=new Uint32Array(4096),N._stringDecoder=new u.StringToUtf32,N._utf8Decoder=new u.Utf8ToUtf32,N._workCell=new a.CellData,N._windowTitle="",N._iconName="",N._windowTitleStack=[],N._iconNameStack=[],N._curAttrData=s.DEFAULT_ATTR_DATA.clone(),N._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone(),N._onRequestBell=new l.EventEmitter,N._onRequestRefreshRows=new l.EventEmitter,N._onRequestReset=new l.EventEmitter,N._onRequestScroll=new l.EventEmitter,N._onRequestSyncScrollBar=new l.EventEmitter,N._onRequestWindowsOptionsReport=new l.EventEmitter,N._onA11yChar=new l.EventEmitter,N._onA11yTab=new l.EventEmitter,N._onCursorMove=new l.EventEmitter,N._onLineFeed=new l.EventEmitter,N._onScroll=new l.EventEmitter,N._onTitleChange=new l.EventEmitter,N.register(N._parser),N._parser.setCsiHandlerFallback(function(V,ce){N._logService.debug("Unknown CSI code: ",{identifier:N._parser.identToString(V),params:ce.toArray()})}),N._parser.setEscHandlerFallback(function(V){N._logService.debug("Unknown ESC code: ",{identifier:N._parser.identToString(V)})}),N._parser.setExecuteHandlerFallback(function(V){N._logService.debug("Unknown EXECUTE code: ",{code:V})}),N._parser.setOscHandlerFallback(function(V,ce,ye){N._logService.debug("Unknown OSC code: ",{identifier:V,action:ce,data:ye})}),N._parser.setDcsHandlerFallback(function(V,ce,ye){ce==="HOOK"&&(ye=ye.toArray()),N._logService.debug("Unknown DCS code: ",{identifier:N._parser.identToString(V),action:ce,payload:ye})}),N._parser.setPrintHandler(function(V,ce,ye){return N.print(V,ce,ye)}),N._parser.setCsiHandler({final:"@"},function(V){return N.insertChars(V)}),N._parser.setCsiHandler({intermediates:" ",final:"@"},function(V){return N.scrollLeft(V)}),N._parser.setCsiHandler({final:"A"},function(V){return N.cursorUp(V)}),N._parser.setCsiHandler({intermediates:" ",final:"A"},function(V){return N.scrollRight(V)}),N._parser.setCsiHandler({final:"B"},function(V){return N.cursorDown(V)}),N._parser.setCsiHandler({final:"C"},function(V){return N.cursorForward(V)}),N._parser.setCsiHandler({final:"D"},function(V){return N.cursorBackward(V)}),N._parser.setCsiHandler({final:"E"},function(V){return N.cursorNextLine(V)}),N._parser.setCsiHandler({final:"F"},function(V){return N.cursorPrecedingLine(V)}),N._parser.setCsiHandler({final:"G"},function(V){return N.cursorCharAbsolute(V)}),N._parser.setCsiHandler({final:"H"},function(V){return N.cursorPosition(V)}),N._parser.setCsiHandler({final:"I"},function(V){return N.cursorForwardTab(V)}),N._parser.setCsiHandler({final:"J"},function(V){return N.eraseInDisplay(V)}),N._parser.setCsiHandler({prefix:"?",final:"J"},function(V){return N.eraseInDisplay(V)}),N._parser.setCsiHandler({final:"K"},function(V){return N.eraseInLine(V)}),N._parser.setCsiHandler({prefix:"?",final:"K"},function(V){return N.eraseInLine(V)}),N._parser.setCsiHandler({final:"L"},function(V){return N.insertLines(V)}),N._parser.setCsiHandler({final:"M"},function(V){return N.deleteLines(V)}),N._parser.setCsiHandler({final:"P"},function(V){return N.deleteChars(V)}),N._parser.setCsiHandler({final:"S"},function(V){return N.scrollUp(V)}),N._parser.setCsiHandler({final:"T"},function(V){return N.scrollDown(V)}),N._parser.setCsiHandler({final:"X"},function(V){return N.eraseChars(V)}),N._parser.setCsiHandler({final:"Z"},function(V){return N.cursorBackwardTab(V)}),N._parser.setCsiHandler({final:"`"},function(V){return N.charPosAbsolute(V)}),N._parser.setCsiHandler({final:"a"},function(V){return N.hPositionRelative(V)}),N._parser.setCsiHandler({final:"b"},function(V){return N.repeatPrecedingCharacter(V)}),N._parser.setCsiHandler({final:"c"},function(V){return N.sendDeviceAttributesPrimary(V)}),N._parser.setCsiHandler({prefix:">",final:"c"},function(V){return N.sendDeviceAttributesSecondary(V)}),N._parser.setCsiHandler({final:"d"},function(V){return N.linePosAbsolute(V)}),N._parser.setCsiHandler({final:"e"},function(V){return N.vPositionRelative(V)}),N._parser.setCsiHandler({final:"f"},function(V){return N.hVPosition(V)}),N._parser.setCsiHandler({final:"g"},function(V){return N.tabClear(V)}),N._parser.setCsiHandler({final:"h"},function(V){return N.setMode(V)}),N._parser.setCsiHandler({prefix:"?",final:"h"},function(V){return N.setModePrivate(V)}),N._parser.setCsiHandler({final:"l"},function(V){return N.resetMode(V)}),N._parser.setCsiHandler({prefix:"?",final:"l"},function(V){return N.resetModePrivate(V)}),N._parser.setCsiHandler({final:"m"},function(V){return N.charAttributes(V)}),N._parser.setCsiHandler({final:"n"},function(V){return N.deviceStatus(V)}),N._parser.setCsiHandler({prefix:"?",final:"n"},function(V){return N.deviceStatusPrivate(V)}),N._parser.setCsiHandler({intermediates:"!",final:"p"},function(V){return N.softReset(V)}),N._parser.setCsiHandler({intermediates:" ",final:"q"},function(V){return N.setCursorStyle(V)}),N._parser.setCsiHandler({final:"r"},function(V){return N.setScrollRegion(V)}),N._parser.setCsiHandler({final:"s"},function(V){return N.saveCursor(V)}),N._parser.setCsiHandler({final:"t"},function(V){return N.windowOptions(V)}),N._parser.setCsiHandler({final:"u"},function(V){return N.restoreCursor(V)}),N._parser.setCsiHandler({intermediates:"'",final:"}"},function(V){return N.insertColumns(V)}),N._parser.setCsiHandler({intermediates:"'",final:"~"},function(V){return N.deleteColumns(V)}),N._parser.setExecuteHandler(S.C0.BEL,function(){return N.bell()}),N._parser.setExecuteHandler(S.C0.LF,function(){return N.lineFeed()}),N._parser.setExecuteHandler(S.C0.VT,function(){return N.lineFeed()}),N._parser.setExecuteHandler(S.C0.FF,function(){return N.lineFeed()}),N._parser.setExecuteHandler(S.C0.CR,function(){return N.carriageReturn()}),N._parser.setExecuteHandler(S.C0.BS,function(){return N.backspace()}),N._parser.setExecuteHandler(S.C0.HT,function(){return N.tab()}),N._parser.setExecuteHandler(S.C0.SO,function(){return N.shiftOut()}),N._parser.setExecuteHandler(S.C0.SI,function(){return N.shiftIn()}),N._parser.setExecuteHandler(S.C1.IND,function(){return N.index()}),N._parser.setExecuteHandler(S.C1.NEL,function(){return N.nextLine()}),N._parser.setExecuteHandler(S.C1.HTS,function(){return N.tabSet()}),N._parser.setOscHandler(0,new r.OscHandler(function(V){N.setTitle(V),N.setIconName(V)})),N._parser.setOscHandler(1,new r.OscHandler(function(V){return N.setIconName(V)})),N._parser.setOscHandler(2,new r.OscHandler(function(V){return N.setTitle(V)})),N._parser.setEscHandler({final:"7"},function(){return N.saveCursor()}),N._parser.setEscHandler({final:"8"},function(){return N.restoreCursor()}),N._parser.setEscHandler({final:"D"},function(){return N.index()}),N._parser.setEscHandler({final:"E"},function(){return N.nextLine()}),N._parser.setEscHandler({final:"H"},function(){return N.tabSet()}),N._parser.setEscHandler({final:"M"},function(){return N.reverseIndex()}),N._parser.setEscHandler({final:"="},function(){return N.keypadApplicationMode()}),N._parser.setEscHandler({final:">"},function(){return N.keypadNumericMode()}),N._parser.setEscHandler({final:"c"},function(){return N.fullReset()}),N._parser.setEscHandler({final:"n"},function(){return N.setgLevel(2)}),N._parser.setEscHandler({final:"o"},function(){return N.setgLevel(3)}),N._parser.setEscHandler({final:"|"},function(){return N.setgLevel(3)}),N._parser.setEscHandler({final:"}"},function(){return N.setgLevel(2)}),N._parser.setEscHandler({final:"~"},function(){return N.setgLevel(1)}),N._parser.setEscHandler({intermediates:"%",final:"@"},function(){return N.selectDefaultCharset()}),N._parser.setEscHandler({intermediates:"%",final:"G"},function(){return N.selectDefaultCharset()});var G=function(V){U._parser.setEscHandler({intermediates:"(",final:V},function(){return N.selectCharset("("+V)}),U._parser.setEscHandler({intermediates:")",final:V},function(){return N.selectCharset(")"+V)}),U._parser.setEscHandler({intermediates:"*",final:V},function(){return N.selectCharset("*"+V)}),U._parser.setEscHandler({intermediates:"+",final:V},function(){return N.selectCharset("+"+V)}),U._parser.setEscHandler({intermediates:"-",final:V},function(){return N.selectCharset("-"+V)}),U._parser.setEscHandler({intermediates:".",final:V},function(){return N.selectCharset("."+V)}),U._parser.setEscHandler({intermediates:"/",final:V},function(){return N.selectCharset("/"+V)})},U=this;for(var H in _.CHARSETS)G(H);return N._parser.setEscHandler({intermediates:"#",final:"8"},function(){return N.screenAlignmentPattern()}),N._parser.setErrorHandler(function(V){return N._logService.error("Parsing error: ",V),V}),N._parser.setDcsHandler({intermediates:"$",final:"q"},new m(N._bufferService,N._coreService,N._logService,N._optionsService)),N}return M(x,T),Object.defineProperty(x.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),x.prototype.dispose=function(){T.prototype.dispose.call(this)},x.prototype.parse=function(E){var w=this._bufferService.buffer,A=w.x,g=w.y;if(this._logService.debug("parsing data",E),this._parseBuffer.length<E.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(E.length,131072))),this._dirtyRowService.clearRange(),E.length>131072)for(var P=0;P<E.length;P+=131072){var O=P+131072<E.length?P+131072:E.length,F=typeof E=="string"?this._stringDecoder.decode(E.substring(P,O),this._parseBuffer):this._utf8Decoder.decode(E.subarray(P,O),this._parseBuffer);this._parser.parse(this._parseBuffer,F)}else F=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer),this._parser.parse(this._parseBuffer,F);(w=this._bufferService.buffer).x===A&&w.y===g||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},x.prototype.print=function(E,w,A){var g,P,O=this._bufferService.buffer,F=this._charsetService.charset,X=this._optionsService.options.screenReaderMode,W=this._bufferService.cols,N=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,U=this._curAttrData,H=O.lines.get(O.ybase+O.y);this._dirtyRowService.markDirty(O.y),O.x&&A-w>0&&H.getWidth(O.x-1)===2&&H.setCellFromCodePoint(O.x-1,0,1,U.fg,U.bg,U.extended);for(var V=w;V<A;++V){if(g=E[V],P=this._unicodeService.wcwidth(g),g<127&&F){var ce=F[String.fromCharCode(g)];ce&&(g=ce.charCodeAt(0))}if(X&&this._onA11yChar.fire(u.stringFromCodePoint(g)),P||!O.x){if(O.x+P-1>=W){if(N){for(;O.x<W;)H.setCellFromCodePoint(O.x++,0,1,U.fg,U.bg,U.extended);O.x=0,O.y++,O.y===O.scrollBottom+1?(O.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(O.y>=this._bufferService.rows&&(O.y=this._bufferService.rows-1),O.lines.get(O.ybase+O.y).isWrapped=!0),H=O.lines.get(O.ybase+O.y)}else if(O.x=W-1,P===2)continue}if(G&&(H.insertCells(O.x,P,O.getNullCell(U),U),H.getWidth(W-1)===2&&H.setCellFromCodePoint(W-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,U.fg,U.bg,U.extended)),H.setCellFromCodePoint(O.x++,g,P,U.fg,U.bg,U.extended),P>0)for(;--P;)H.setCellFromCodePoint(O.x++,0,0,U.fg,U.bg,U.extended)}else H.getWidth(O.x-1)?H.addCodepointToCell(O.x-1,g):H.addCodepointToCell(O.x-2,g)}A-w>0&&(H.loadCell(O.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),O.x<W&&A-w>0&&H.getWidth(O.x)===0&&!H.hasContent(O.x)&&H.setCellFromCodePoint(O.x,0,1,U.fg,U.bg,U.extended),this._dirtyRowService.markDirty(O.y)},x.prototype.addCsiHandler=function(E,w){var A=this;return E.final!=="t"||E.prefix||E.intermediates?this._parser.addCsiHandler(E,w):this._parser.addCsiHandler(E,function(g){return!y(g.params[0],A._optionsService.options.windowOptions)||w(g)})},x.prototype.addDcsHandler=function(E,w){return this._parser.addDcsHandler(E,new h.DcsHandler(w))},x.prototype.addEscHandler=function(E,w){return this._parser.addEscHandler(E,w)},x.prototype.addOscHandler=function(E,w){return this._parser.addOscHandler(E,new r.OscHandler(w))},x.prototype.bell=function(){this._onRequestBell.fire()},x.prototype.lineFeed=function(){var E=this._bufferService.buffer;this._dirtyRowService.markDirty(E.y),this._optionsService.options.convertEol&&(E.x=0),E.y++,E.y===E.scrollBottom+1?(E.y--,this._onRequestScroll.fire(this._eraseAttrData())):E.y>=this._bufferService.rows&&(E.y=this._bufferService.rows-1),E.x>=this._bufferService.cols&&E.x--,this._dirtyRowService.markDirty(E.y),this._onLineFeed.fire()},x.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},x.prototype.backspace=function(){var E,w=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(w.x>0&&w.x--);if(this._restrictCursor(this._bufferService.cols),w.x>0)w.x--;else if(w.x===0&&w.y>w.scrollTop&&w.y<=w.scrollBottom&&((E=w.lines.get(w.ybase+w.y))===null||E===void 0?void 0:E.isWrapped)){w.lines.get(w.ybase+w.y).isWrapped=!1,w.y--,w.x=this._bufferService.cols-1;var A=w.lines.get(w.ybase+w.y);A.hasWidth(w.x)&&!A.hasContent(w.x)&&w.x--}this._restrictCursor()},x.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var E=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-E)}},x.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},x.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},x.prototype._restrictCursor=function(E){E===void 0&&(E=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(E,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},x.prototype._setCursor=function(E,w){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=E,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+w):(this._bufferService.buffer.x=E,this._bufferService.buffer.y=w),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},x.prototype._moveCursor=function(E,w){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+E,this._bufferService.buffer.y+w)},x.prototype.cursorUp=function(E){var w=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;w>=0?this._moveCursor(0,-Math.min(w,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1))},x.prototype.cursorDown=function(E){var w=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;w>=0?this._moveCursor(0,Math.min(w,E.params[0]||1)):this._moveCursor(0,E.params[0]||1)},x.prototype.cursorForward=function(E){this._moveCursor(E.params[0]||1,0)},x.prototype.cursorBackward=function(E){this._moveCursor(-(E.params[0]||1),0)},x.prototype.cursorNextLine=function(E){this.cursorDown(E),this._bufferService.buffer.x=0},x.prototype.cursorPrecedingLine=function(E){this.cursorUp(E),this._bufferService.buffer.x=0},x.prototype.cursorCharAbsolute=function(E){this._setCursor((E.params[0]||1)-1,this._bufferService.buffer.y)},x.prototype.cursorPosition=function(E){this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1)},x.prototype.charPosAbsolute=function(E){this._setCursor((E.params[0]||1)-1,this._bufferService.buffer.y)},x.prototype.hPositionRelative=function(E){this._moveCursor(E.params[0]||1,0)},x.prototype.linePosAbsolute=function(E){this._setCursor(this._bufferService.buffer.x,(E.params[0]||1)-1)},x.prototype.vPositionRelative=function(E){this._moveCursor(0,E.params[0]||1)},x.prototype.hVPosition=function(E){this.cursorPosition(E)},x.prototype.tabClear=function(E){var w=E.params[0];w===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:w===3&&(this._bufferService.buffer.tabs={})},x.prototype.cursorForwardTab=function(E){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var w=E.params[0]||1;w--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},x.prototype.cursorBackwardTab=function(E){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var w=E.params[0]||1,A=this._bufferService.buffer;w--;)A.x=A.prevStop()},x.prototype._eraseInBufferLine=function(E,w,A,g){g===void 0&&(g=!1);var P=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+E);P.replaceCells(w,A,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),g&&(P.isWrapped=!1)},x.prototype._resetBufferLine=function(E){var w=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+E);w.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),w.isWrapped=!1},x.prototype.eraseInDisplay=function(E){var w;switch(this._restrictCursor(),E.params[0]){case 0:for(w=this._bufferService.buffer.y,this._dirtyRowService.markDirty(w),this._eraseInBufferLine(w++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);w<this._bufferService.rows;w++)this._resetBufferLine(w);this._dirtyRowService.markDirty(w);break;case 1:for(w=this._bufferService.buffer.y,this._dirtyRowService.markDirty(w),this._eraseInBufferLine(w,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(w+1).isWrapped=!1);w--;)this._resetBufferLine(w);this._dirtyRowService.markDirty(0);break;case 2:for(w=this._bufferService.rows,this._dirtyRowService.markDirty(w-1);w--;)this._resetBufferLine(w);this._dirtyRowService.markDirty(0);break;case 3:var A=this._bufferService.buffer.lines.length-this._bufferService.rows;A>0&&(this._bufferService.buffer.lines.trimStart(A),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-A,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-A,0),this._onScroll.fire(0))}},x.prototype.eraseInLine=function(E){switch(this._restrictCursor(),E.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},x.prototype.insertLines=function(E){this._restrictCursor();var w=E.params[0]||1,A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var g=A.ybase+A.y,P=this._bufferService.rows-1-A.scrollBottom,O=this._bufferService.rows-1+A.ybase-P+1;w--;)A.lines.splice(O-1,1),A.lines.splice(g,0,A.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(A.y,A.scrollBottom),A.x=0}},x.prototype.deleteLines=function(E){this._restrictCursor();var w=E.params[0]||1,A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){var g,P=A.ybase+A.y;for(g=this._bufferService.rows-1-A.scrollBottom,g=this._bufferService.rows-1+A.ybase-g;w--;)A.lines.splice(P,1),A.lines.splice(g,0,A.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(A.y,A.scrollBottom),A.x=0}},x.prototype.insertChars=function(E){this._restrictCursor();var w=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);w&&(w.insertCells(this._bufferService.buffer.x,E.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.deleteChars=function(E){this._restrictCursor();var w=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);w&&(w.deleteCells(this._bufferService.buffer.x,E.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.scrollUp=function(E){for(var w=E.params[0]||1,A=this._bufferService.buffer;w--;)A.lines.splice(A.ybase+A.scrollTop,1),A.lines.splice(A.ybase+A.scrollBottom,0,A.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)},x.prototype.scrollDown=function(E){for(var w=E.params[0]||1,A=this._bufferService.buffer;w--;)A.lines.splice(A.ybase+A.scrollBottom,1),A.lines.splice(A.ybase+A.scrollTop,0,A.getBlankLine(s.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)},x.prototype.scrollLeft=function(E){var w=this._bufferService.buffer;if(!(w.y>w.scrollBottom||w.y<w.scrollTop)){for(var A=E.params[0]||1,g=w.scrollTop;g<=w.scrollBottom;++g){var P=w.lines.get(w.ybase+g);P.deleteCells(0,A,w.getNullCell(this._eraseAttrData()),this._eraseAttrData()),P.isWrapped=!1}this._dirtyRowService.markRangeDirty(w.scrollTop,w.scrollBottom)}},x.prototype.scrollRight=function(E){var w=this._bufferService.buffer;if(!(w.y>w.scrollBottom||w.y<w.scrollTop)){for(var A=E.params[0]||1,g=w.scrollTop;g<=w.scrollBottom;++g){var P=w.lines.get(w.ybase+g);P.insertCells(0,A,w.getNullCell(this._eraseAttrData()),this._eraseAttrData()),P.isWrapped=!1}this._dirtyRowService.markRangeDirty(w.scrollTop,w.scrollBottom)}},x.prototype.insertColumns=function(E){var w=this._bufferService.buffer;if(!(w.y>w.scrollBottom||w.y<w.scrollTop)){for(var A=E.params[0]||1,g=w.scrollTop;g<=w.scrollBottom;++g){var P=this._bufferService.buffer.lines.get(w.ybase+g);P.insertCells(w.x,A,w.getNullCell(this._eraseAttrData()),this._eraseAttrData()),P.isWrapped=!1}this._dirtyRowService.markRangeDirty(w.scrollTop,w.scrollBottom)}},x.prototype.deleteColumns=function(E){var w=this._bufferService.buffer;if(!(w.y>w.scrollBottom||w.y<w.scrollTop)){for(var A=E.params[0]||1,g=w.scrollTop;g<=w.scrollBottom;++g){var P=w.lines.get(w.ybase+g);P.deleteCells(w.x,A,w.getNullCell(this._eraseAttrData()),this._eraseAttrData()),P.isWrapped=!1}this._dirtyRowService.markRangeDirty(w.scrollTop,w.scrollBottom)}},x.prototype.eraseChars=function(E){this._restrictCursor();var w=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);w&&(w.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+(E.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.repeatPrecedingCharacter=function(E){if(this._parser.precedingCodepoint){for(var w=E.params[0]||1,A=new Uint32Array(w),g=0;g<w;++g)A[g]=this._parser.precedingCodepoint;this.print(A,0,A.length)}},x.prototype.sendDeviceAttributesPrimary=function(E){E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(S.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(S.C0.ESC+"[?6c"))},x.prototype.sendDeviceAttributesSecondary=function(E){E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(S.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(S.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(S.C0.ESC+"[>83;40003;0c"))},x.prototype._is=function(E){return(this._optionsService.options.termName+"").indexOf(E)===0},x.prototype.setMode=function(E){for(var w=0;w<E.length;w++)switch(E.params[w]){case 4:this._coreService.modes.insertMode=!0}},x.prototype.setModePrivate=function(E){for(var w=0;w<E.length;w++)switch(E.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_.DEFAULT_CHARSET),this._charsetService.setgCharset(1,_.DEFAULT_CHARSET),this._charsetService.setgCharset(2,_.DEFAULT_CHARSET),this._charsetService.setgCharset(3,_.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0;break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}},x.prototype.resetMode=function(E){for(var w=0;w<E.length;w++)switch(E.params[w]){case 4:this._coreService.modes.insertMode=!1}},x.prototype.resetModePrivate=function(E){for(var w=0;w<E.length;w++)switch(E.params[w]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[w]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}},x.prototype._updateAttrColor=function(E,w,A,g,P){return w===2?(E|=50331648,E&=-16777216,E|=i.AttributeData.fromColorRGB([A,g,P])):w===5&&(E&=-50331904,E|=33554432|255&A),E},x.prototype._extractColor=function(E,w,A){var g=[0,0,-1,0,0,0],P=0,O=0;do{if(g[O+P]=E.params[w+O],E.hasSubParams(w+O)){var F=E.getSubParams(w+O),X=0;do g[1]===5&&(P=1),g[O+X+1+P]=F[X];while(++X<F.length&&X+O+1+P<g.length);break}if(g[1]===5&&O+P>=2||g[1]===2&&O+P>=5)break;g[1]&&(P=1)}while(++O+w<E.length&&O+P<g.length);for(X=2;X<g.length;++X)g[X]===-1&&(g[X]=0);switch(g[0]){case 38:A.fg=this._updateAttrColor(A.fg,g[1],g[3],g[4],g[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,g[1],g[3],g[4],g[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,g[1],g[3],g[4],g[5])}return O},x.prototype._processUnderline=function(E,w){w.extended=w.extended.clone(),(!~E||E>5)&&(E=1),w.extended.underlineStyle=E,w.fg|=268435456,E===0&&(w.fg&=-268435457),w.updateExtended()},x.prototype.charAttributes=function(E){if(E.length===1&&E.params[0]===0)return this._curAttrData.fg=s.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=s.DEFAULT_ATTR_DATA.bg);for(var w,A=E.length,g=this._curAttrData,P=0;P<A;P++)(w=E.params[P])>=30&&w<=37?(g.fg&=-50331904,g.fg|=16777216|w-30):w>=40&&w<=47?(g.bg&=-50331904,g.bg|=16777216|w-40):w>=90&&w<=97?(g.fg&=-50331904,g.fg|=16777224|w-90):w>=100&&w<=107?(g.bg&=-50331904,g.bg|=16777224|w-100):w===0?(g.fg=s.DEFAULT_ATTR_DATA.fg,g.bg=s.DEFAULT_ATTR_DATA.bg):w===1?g.fg|=134217728:w===3?g.bg|=67108864:w===4?(g.fg|=268435456,this._processUnderline(E.hasSubParams(P)?E.getSubParams(P)[0]:1,g)):w===5?g.fg|=536870912:w===7?g.fg|=67108864:w===8?g.fg|=1073741824:w===2?g.bg|=134217728:w===21?this._processUnderline(2,g):w===22?(g.fg&=-134217729,g.bg&=-134217729):w===23?g.bg&=-67108865:w===24?g.fg&=-268435457:w===25?g.fg&=-536870913:w===27?g.fg&=-67108865:w===28?g.fg&=-1073741825:w===39?(g.fg&=-67108864,g.fg|=16777215&s.DEFAULT_ATTR_DATA.fg):w===49?(g.bg&=-67108864,g.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):w===38||w===48||w===58?P+=this._extractColor(E,P,g):w===59?(g.extended=g.extended.clone(),g.extended.underlineColor=-1,g.updateExtended()):w===100?(g.fg&=-67108864,g.fg|=16777215&s.DEFAULT_ATTR_DATA.fg,g.bg&=-67108864,g.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",w)},x.prototype.deviceStatus=function(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(S.C0.ESC+"[0n");break;case 6:var w=this._bufferService.buffer.y+1,A=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(S.C0.ESC+"["+w+";"+A+"R")}},x.prototype.deviceStatusPrivate=function(E){switch(E.params[0]){case 6:var w=this._bufferService.buffer.y+1,A=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(S.C0.ESC+"[?"+w+";"+A+"R")}},x.prototype.softReset=function(E){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1},x.prototype.setCursorStyle=function(E){var w=E.params[0]||1;switch(w){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var A=w%2==1;this._optionsService.options.cursorBlink=A},x.prototype.setScrollRegion=function(E){var w,A=E.params[0]||1;(E.length<2||(w=E.params[1])>this._bufferService.rows||w===0)&&(w=this._bufferService.rows),w>A&&(this._bufferService.buffer.scrollTop=A-1,this._bufferService.buffer.scrollBottom=w-1,this._setCursor(0,0))},x.prototype.windowOptions=function(E){if(y(E.params[0],this._optionsService.options.windowOptions)){var w=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:w!==2&&this._onRequestWindowsOptionsReport.fire(f.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(f.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(S.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:w!==0&&w!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),w!==0&&w!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:w!==0&&w!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),w!==0&&w!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},x.prototype.saveCursor=function(E){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},x.prototype.restoreCursor=function(E){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},x.prototype.setTitle=function(E){this._windowTitle=E,this._onTitleChange.fire(E)},x.prototype.setIconName=function(E){this._iconName=E},x.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},x.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},x.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},x.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,_.DEFAULT_CHARSET)},x.prototype.selectCharset=function(E){E.length===2?E[0]!=="/"&&this._charsetService.setgCharset(d[E[0]],_.CHARSETS[E[1]]||_.DEFAULT_CHARSET):this.selectDefaultCharset()},x.prototype.index=function(){this._restrictCursor();var E=this._bufferService.buffer;this._bufferService.buffer.y++,E.y===E.scrollBottom+1?(E.y--,this._onRequestScroll.fire(this._eraseAttrData())):E.y>=this._bufferService.rows&&(E.y=this._bufferService.rows-1),this._restrictCursor()},x.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},x.prototype.reverseIndex=function(){this._restrictCursor();var E=this._bufferService.buffer;if(E.y===E.scrollTop){var w=E.scrollBottom-E.scrollTop;E.lines.shiftElements(E.ybase+E.y,w,1),E.lines.set(E.ybase+E.y,E.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom)}else E.y--,this._restrictCursor()},x.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},x.prototype.reset=function(){this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone()},x.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},x.prototype.setgLevel=function(E){this._charsetService.setgLevel(E)},x.prototype.screenAlignmentPattern=function(){var E=new a.CellData;E.content=1<<22|"E".charCodeAt(0),E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg;var w=this._bufferService.buffer;this._setCursor(0,0);for(var A=0;A<this._bufferService.rows;++A){var g=w.ybase+w.y+A,P=w.lines.get(g);P&&(P.fill(E),P.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},x}(c.Disposable);L.InputHandler=C},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.DEFAULT_CHARSET=L.CHARSETS=void 0,L.CHARSETS={},L.DEFAULT_CHARSET=L.CHARSETS.B,L.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},L.CHARSETS.A={"#":"\xA3"},L.CHARSETS.B=void 0,L.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},L.CHARSETS.C=L.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},L.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},L.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},L.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},L.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},L.CHARSETS.E=L.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},L.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},L.CHARSETS.H=L.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},L.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.Params=void 0;var k=function(){function M(f,S){if(f===void 0&&(f=32),S===void 0&&(S=32),this.maxLength=f,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return M.fromArray=function(f){var S=new M;if(!f.length)return S;for(var _=f[0]instanceof Array?1:0;_<f.length;++_){var p=f[_];if(p instanceof Array)for(var c=0;c<p.length;++c)S.addSubParam(p[c]);else S.addParam(p)}return S},M.prototype.clone=function(){var f=new M(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f},M.prototype.toArray=function(){for(var f=[],S=0;S<this.length;++S){f.push(this.params[S]);var _=this._subParamsIdx[S]>>8,p=255&this._subParamsIdx[S];p-_>0&&f.push(Array.prototype.slice.call(this._subParams,_,p))}return f},M.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},M.prototype.addParam=function(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>2147483647?2147483647:f}},M.prototype.addSubParam=function(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>2147483647?2147483647:f,this._subParamsIdx[this.length-1]++}},M.prototype.hasSubParams=function(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0},M.prototype.getSubParams=function(f){var S=this._subParamsIdx[f]>>8,_=255&this._subParamsIdx[f];return _-S>0?this._subParams.subarray(S,_):null},M.prototype.getSubParamsAll=function(){for(var f={},S=0;S<this.length;++S){var _=this._subParamsIdx[S]>>8,p=255&this._subParamsIdx[S];p-_>0&&(f[S]=this._subParams.slice(_,p))}return f},M.prototype.addDigit=function(f){var S;if(!(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var _=this._digitIsSub?this._subParams:this.params,p=_[S-1];_[S-1]=~p?Math.min(10*p+f,2147483647):f}},M}();L.Params=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.OscHandler=L.OscParser=void 0;var k=D(23),M=D(8),f=function(){function _(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return _.prototype.addHandler=function(p,c){this._handlers[p]===void 0&&(this._handlers[p]=[]);var o=this._handlers[p];return o.push(c),{dispose:function(){var u=o.indexOf(c);u!==-1&&o.splice(u,1)}}},_.prototype.setHandler=function(p,c){this._handlers[p]=[c]},_.prototype.clearHandler=function(p){this._handlers[p]&&delete this._handlers[p]},_.prototype.setHandlerFallback=function(p){this._handlerFb=p},_.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},_.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},_.prototype._start=function(){var p=this._handlers[this._id];if(p)for(var c=p.length-1;c>=0;c--)p[c].start();else this._handlerFb(this._id,"START")},_.prototype._put=function(p,c,o){var u=this._handlers[this._id];if(u)for(var s=u.length-1;s>=0;s--)u[s].put(p,c,o);else this._handlerFb(this._id,"PUT",M.utf32ToString(p,c,o))},_.prototype._end=function(p){var c=this._handlers[this._id];if(c){for(var o=c.length-1;o>=0&&c[o].end(p)===!1;o--);for(o--;o>=0;o--)c[o].end(!1)}else this._handlerFb(this._id,"END",p)},_.prototype.start=function(){this.reset(),this._id=-1,this._state=1},_.prototype.put=function(p,c,o){if(this._state!==3){if(this._state===1)for(;c<o;){var u=p[c++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&o-c>0&&this._put(p,c,o)}},_.prototype.end=function(p){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(p)),this._id=-1,this._state=0)},_}();L.OscParser=f;var S=function(){function _(p){this._handler=p,this._data="",this._hitLimit=!1}return _.prototype.start=function(){this._data="",this._hitLimit=!1},_.prototype.put=function(p,c,o){this._hitLimit||(this._data+=M.utf32ToString(p,c,o),this._data.length>k.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},_.prototype.end=function(p){var c;return this._hitLimit?c=!1:p&&(c=this._handler(this._data)),this._data="",this._hitLimit=!1,c},_}();L.OscHandler=S},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.PAYLOAD_LIMIT=void 0,L.PAYLOAD_LIMIT=1e7},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.DcsHandler=L.DcsParser=void 0;var k=D(8),M=D(21),f=D(23),S=[],_=function(){function c(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=function(){}}return c.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},c.prototype.addHandler=function(o,u){this._handlers[o]===void 0&&(this._handlers[o]=[]);var s=this._handlers[o];return s.push(u),{dispose:function(){var l=s.indexOf(u);l!==-1&&s.splice(l,1)}}},c.prototype.setHandler=function(o,u){this._handlers[o]=[u]},c.prototype.clearHandler=function(o){this._handlers[o]&&delete this._handlers[o]},c.prototype.setHandlerFallback=function(o){this._handlerFb=o},c.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=S,this._ident=0},c.prototype.hook=function(o,u){if(this.reset(),this._ident=o,this._active=this._handlers[o]||S,this._active.length)for(var s=this._active.length-1;s>=0;s--)this._active[s].hook(u);else this._handlerFb(this._ident,"HOOK",u)},c.prototype.put=function(o,u,s){if(this._active.length)for(var l=this._active.length-1;l>=0;l--)this._active[l].put(o,u,s);else this._handlerFb(this._ident,"PUT",k.utf32ToString(o,u,s))},c.prototype.unhook=function(o){if(this._active.length){for(var u=this._active.length-1;u>=0&&this._active[u].unhook(o)===!1;u--);for(u--;u>=0;u--)this._active[u].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",o);this._active=S,this._ident=0},c}();L.DcsParser=_;var p=function(){function c(o){this._handler=o,this._data="",this._hitLimit=!1}return c.prototype.hook=function(o){this._params=o.clone(),this._data="",this._hitLimit=!1},c.prototype.put=function(o,u,s){this._hitLimit||(this._data+=k.utf32ToString(o,u,s),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},c.prototype.unhook=function(o){var u;return this._hitLimit?u=!1:o&&(u=this._handler(this._data,this._params||new M.Params)),this._params=void 0,this._data="",this._hitLimit=!1,u},c}();L.DcsHandler=p},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.removeTerminalFromCache=L.acquireCharAtlas=void 0;var k=D(26),M=D(43),f=[];L.acquireCharAtlas=function(S,_,p,c,o){for(var u=k.generateConfig(c,o,S,p),s=0;s<f.length;s++){var l=(t=f[s]).ownedBy.indexOf(_);if(l>=0){if(k.configEquals(t.config,u))return t.atlas;t.ownedBy.length===1?(t.atlas.dispose(),f.splice(s,1)):t.ownedBy.splice(l,1);break}}for(s=0;s<f.length;s++){var t=f[s];if(k.configEquals(t.config,u))return t.ownedBy.push(_),t.atlas}var a={atlas:new M.DynamicCharAtlas(document,u),config:u,ownedBy:[_]};return f.push(a),a.atlas},L.removeTerminalFromCache=function(S){for(var _=0;_<f.length;_++){var p=f[_].ownedBy.indexOf(S);if(p!==-1){f[_].ownedBy.length===1?(f[_].atlas.dispose(),f.splice(_,1)):f[_].ownedBy.splice(p,1);break}}}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.is256Color=L.configEquals=L.generateConfig=void 0;var k=D(3);L.generateConfig=function(M,f,S,_){var p={foreground:_.foreground,background:_.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:_.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:M,scaledCharHeight:f,fontFamily:S.fontFamily,fontSize:S.fontSize,fontWeight:S.fontWeight,fontWeightBold:S.fontWeightBold,allowTransparency:S.allowTransparency,colors:p}},L.configEquals=function(M,f){for(var S=0;S<M.colors.ansi.length;S++)if(M.colors.ansi[S].rgba!==f.colors.ansi[S].rgba)return!1;return M.devicePixelRatio===f.devicePixelRatio&&M.fontFamily===f.fontFamily&&M.fontSize===f.fontSize&&M.fontWeight===f.fontWeight&&M.fontWeightBold===f.fontWeightBold&&M.allowTransparency===f.allowTransparency&&M.scaledCharWidth===f.scaledCharWidth&&M.scaledCharHeight===f.scaledCharHeight&&M.colors.foreground===f.colors.foreground&&M.colors.background===f.colors.background},L.is256Color=function(M){return M<k.DEFAULT_COLOR}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.ColorManager=L.DEFAULT_ANSI_COLORS=void 0;var k=D(10),M=D(45),f=k.css.toColor("#ffffff"),S=k.css.toColor("#000000"),_=k.css.toColor("#ffffff"),p=k.css.toColor("#000000"),c={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};L.DEFAULT_ANSI_COLORS=function(){for(var u=[k.css.toColor("#2e3436"),k.css.toColor("#cc0000"),k.css.toColor("#4e9a06"),k.css.toColor("#c4a000"),k.css.toColor("#3465a4"),k.css.toColor("#75507b"),k.css.toColor("#06989a"),k.css.toColor("#d3d7cf"),k.css.toColor("#555753"),k.css.toColor("#ef2929"),k.css.toColor("#8ae234"),k.css.toColor("#fce94f"),k.css.toColor("#729fcf"),k.css.toColor("#ad7fa8"),k.css.toColor("#34e2e2"),k.css.toColor("#eeeeec")],s=[0,95,135,175,215,255],l=0;l<216;l++){var t=s[l/36%6|0],a=s[l/6%6|0],i=s[l%6];u.push({css:k.channels.toCss(t,a,i),rgba:k.channels.toRgba(t,a,i)})}for(l=0;l<24;l++){var r=8+10*l;u.push({css:k.channels.toCss(r,r,r),rgba:k.channels.toRgba(r,r,r)})}return u}();var o=function(){function u(s,l){this.allowTransparency=l;var t=s.createElement("canvas");t.width=1,t.height=1;var a=t.getContext("2d");if(!a)throw new Error("Could not get rendering context");this._ctx=a,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new M.ColorContrastCache,this.colors={foreground:f,background:S,cursor:_,cursorAccent:p,selectionTransparent:c,selectionOpaque:k.color.blend(S,c),ansi:L.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return u.prototype.onOptionsChange=function(s){s==="minimumContrastRatio"&&this._contrastCache.clear()},u.prototype.setTheme=function(s){(s===void 0&&(s={}),this.colors.foreground=this._parseColor(s.foreground,f),this.colors.background=this._parseColor(s.background,S),this.colors.cursor=this._parseColor(s.cursor,_,!0),this.colors.cursorAccent=this._parseColor(s.cursorAccent,p,!0),this.colors.selectionTransparent=this._parseColor(s.selection,c,!0),this.colors.selectionOpaque=k.color.blend(this.colors.background,this.colors.selectionTransparent),k.color.isOpaque(this.colors.selectionTransparent))&&(this.colors.selectionTransparent=k.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(s.black,L.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(s.red,L.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(s.green,L.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(s.yellow,L.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(s.blue,L.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(s.magenta,L.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(s.cyan,L.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(s.white,L.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(s.brightBlack,L.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(s.brightRed,L.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(s.brightGreen,L.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(s.brightYellow,L.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(s.brightBlue,L.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(s.brightMagenta,L.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(s.brightCyan,L.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(s.brightWhite,L.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},u.prototype._parseColor=function(s,l,t){if(t===void 0&&(t=this.allowTransparency),s===void 0)return l;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=s,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+s+" is invalid using fallback "+l.css),l;this._ctx.fillRect(0,0,1,1);var a=this._ctx.getImageData(0,0,1,1).data;if(a[3]!==255){if(!t)return console.warn("Color: "+s+" is using transparency, but allowTransparency is false. Using fallback "+l.css+"."),l;var i=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(C){return Number(C)}),r=i[0],h=i[1],d=i[2],y=i[3],m=Math.round(255*y);return{rgba:k.channels.toRgba(r,h,d,m),css:s}}return{css:this._ctx.fillStyle,rgba:k.channels.toRgba(a[0],a[1],a[2],a[3])}},u}();L.ColorManager=o},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.throwIfFalsy=void 0,L.throwIfFalsy=function(k){if(!k)throw new Error("value must not be falsy");return k}},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(o,u){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var t in l)l.hasOwnProperty(t)&&(s[t]=l[t])})(o,u)},function(o,u){function s(){this.constructor=o}k(o,u),o.prototype=u===null?Object.create(u):(s.prototype=u.prototype,new s)});Object.defineProperty(L,"__esModule",{value:!0}),L.CharacterJoinerRegistry=L.JoinedCellData=void 0;var f=D(6),S=D(3),_=D(4),p=function(o){function u(s,l,t){var a=o.call(this)||this;return a.content=0,a.combinedData="",a.fg=s.fg,a.bg=s.bg,a.combinedData=l,a._width=t,a}return M(u,o),u.prototype.isCombined=function(){return 2097152},u.prototype.getWidth=function(){return this._width},u.prototype.getChars=function(){return this.combinedData},u.prototype.getCode=function(){return 2097151},u.prototype.setFromCharData=function(s){throw new Error("not implemented")},u.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},u}(f.AttributeData);L.JoinedCellData=p;var c=function(){function o(u){this._bufferService=u,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _.CellData}return o.prototype.registerCharacterJoiner=function(u){var s={id:this._nextCharacterJoinerId++,handler:u};return this._characterJoiners.push(s),s.id},o.prototype.deregisterCharacterJoiner=function(u){for(var s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===u)return this._characterJoiners.splice(s,1),!0;return!1},o.prototype.getJoinedCharacters=function(u){if(this._characterJoiners.length===0)return[];var s=this._bufferService.buffer.lines.get(u);if(!s||s.length===0)return[];for(var l=[],t=s.translateToString(!0),a=0,i=0,r=0,h=s.getFg(0),d=s.getBg(0),y=0;y<s.getTrimmedLength();y++)if(s.loadCell(y,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==d){if(y-a>1)for(var m=this._getJoinedRanges(t,r,i,s,a),C=0;C<m.length;C++)l.push(m[C]);a=y,r=i,h=this._workCell.fg,d=this._workCell.bg}i+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-a>1)for(m=this._getJoinedRanges(t,r,i,s,a),C=0;C<m.length;C++)l.push(m[C]);return l},o.prototype._getJoinedRanges=function(u,s,l,t,a){for(var i=u.substring(s,l),r=this._characterJoiners[0].handler(i),h=1;h<this._characterJoiners.length;h++)for(var d=this._characterJoiners[h].handler(i),y=0;y<d.length;y++)o._mergeRanges(r,d[y]);return this._stringRangesToCellRanges(r,t,a),r},o.prototype._stringRangesToCellRanges=function(u,s,l){var t=0,a=!1,i=0,r=u[t];if(r){for(var h=l;h<this._bufferService.cols;h++){var d=s.getWidth(h),y=s.getString(h).length||S.WHITESPACE_CELL_CHAR.length;if(d!==0){if(!a&&r[0]<=i&&(r[0]=h,a=!0),r[1]<=i){if(r[1]=h,!(r=u[++t]))break;r[0]<=i?(r[0]=h,a=!0):a=!1}i+=y}}r&&(r[1]=this._bufferService.cols)}},o._mergeRanges=function(u,s){for(var l=!1,t=0;t<u.length;t++){var a=u[t];if(l){if(s[1]<=a[0])return u[t-1][1]=s[1],u;if(s[1]<=a[1])return u[t-1][1]=Math.max(s[1],a[1]),u.splice(t,1),u;u.splice(t,1),t--}else{if(s[1]<=a[0])return u.splice(t,0,s),u;if(s[1]<=a[1])return a[0]=Math.min(s[0],a[0]),u;s[0]<a[1]&&(a[0]=Math.min(s[0],a[0]),l=!0)}}return l?u[u.length-1][1]=s[1]:u.push(s),u},o}();L.CharacterJoinerRegistry=c},function(z,L,D){"use strict";function k(M,f){var S=f.getBoundingClientRect();return[M.clientX-S.left,M.clientY-S.top]}Object.defineProperty(L,"__esModule",{value:!0}),L.getRawByteCoords=L.getCoords=L.getCoordsRelativeToElement=void 0,L.getCoordsRelativeToElement=k,L.getCoords=function(M,f,S,_,p,c,o,u){if(p){var s=k(M,f);if(s)return s[0]=Math.ceil((s[0]+(u?c/2:0))/c),s[1]=Math.ceil(s[1]/o),s[0]=Math.min(Math.max(s[0],1),S+(u?1:0)),s[1]=Math.min(Math.max(s[1],1),_),s}},L.getRawByteCoords=function(M){if(M)return{x:M[0]+32,y:M[1]+32}}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.RenderDebouncer=void 0;var k=function(){function M(f){this._renderCallback=f}return M.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},M.prototype.refresh=function(f,S,_){var p=this;this._rowCount=_,f=f!==void 0?f:0,S=S!==void 0?S:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,f):f,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,S):S,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return p._innerRefresh()}))},M.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var f=Math.max(this._rowStart,0),S=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0,this._renderCallback(f,S)}},M}();L.RenderDebouncer=k},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(S,_){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,c){p.__proto__=c}||function(p,c){for(var o in c)c.hasOwnProperty(o)&&(p[o]=c[o])})(S,_)},function(S,_){function p(){this.constructor=S}k(S,_),S.prototype=_===null?Object.create(_):(p.prototype=_.prototype,new p)});Object.defineProperty(L,"__esModule",{value:!0}),L.ScreenDprMonitor=void 0;var f=function(S){function _(){var p=S!==null&&S.apply(this,arguments)||this;return p._currentDevicePixelRatio=window.devicePixelRatio,p}return M(_,S),_.prototype.setListener=function(p){var c=this;this._listener&&this.clearListener(),this._listener=p,this._outerListener=function(){c._listener&&(c._listener(window.devicePixelRatio,c._currentDevicePixelRatio),c._updateDpr())},this._updateDpr()},_.prototype.dispose=function(){S.prototype.dispose.call(this),this.clearListener()},_.prototype._updateDpr=function(){var p;this._outerListener&&((p=this._resolutionMediaMatchList)===null||p===void 0||p.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},_.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},_}(D(2).Disposable);L.ScreenDprMonitor=f},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.clone=void 0,L.clone=function k(M,f){if(f===void 0&&(f=5),typeof M!="object")return M;var S=Array.isArray(M)?[]:{};for(var _ in M)S[_]=f<=1?M[_]:M[_]?k(M[_],f-1):M[_];return S}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;var k=D(4),M=D(35),f=D(18),S=D(0),_=D(83),p=function(){function t(a){this._core=new M.Terminal(a),this._addonManager=new _.AddonManager}return t.prototype._checkProposedApi=function(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")},Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new s(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"unicode",{get:function(){return this._checkProposedApi(),new l(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"buffer",{get:function(){return this._checkProposedApi(),new o(this._core.buffers)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),t.prototype.blur=function(){this._core.blur()},t.prototype.focus=function(){this._core.focus()},t.prototype.resize=function(a,i){this._verifyIntegers(a,i),this._core.resize(a,i)},t.prototype.open=function(a){this._core.open(a)},t.prototype.attachCustomKeyEventHandler=function(a){this._core.attachCustomKeyEventHandler(a)},t.prototype.registerLinkMatcher=function(a,i,r){return this._checkProposedApi(),this._core.registerLinkMatcher(a,i,r)},t.prototype.deregisterLinkMatcher=function(a){this._checkProposedApi(),this._core.deregisterLinkMatcher(a)},t.prototype.registerLinkProvider=function(a){return this._checkProposedApi(),this._core.registerLinkProvider(a)},t.prototype.registerCharacterJoiner=function(a){return this._checkProposedApi(),this._core.registerCharacterJoiner(a)},t.prototype.deregisterCharacterJoiner=function(a){this._checkProposedApi(),this._core.deregisterCharacterJoiner(a)},t.prototype.registerMarker=function(a){return this._checkProposedApi(),this._verifyIntegers(a),this._core.addMarker(a)},t.prototype.addMarker=function(a){return this.registerMarker(a)},t.prototype.hasSelection=function(){return this._core.hasSelection()},t.prototype.select=function(a,i,r){this._verifyIntegers(a,i,r),this._core.select(a,i,r)},t.prototype.getSelection=function(){return this._core.getSelection()},t.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},t.prototype.clearSelection=function(){this._core.clearSelection()},t.prototype.selectAll=function(){this._core.selectAll()},t.prototype.selectLines=function(a,i){this._verifyIntegers(a,i),this._core.selectLines(a,i)},t.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},t.prototype.scrollLines=function(a){this._verifyIntegers(a),this._core.scrollLines(a)},t.prototype.scrollPages=function(a){this._verifyIntegers(a),this._core.scrollPages(a)},t.prototype.scrollToTop=function(){this._core.scrollToTop()},t.prototype.scrollToBottom=function(){this._core.scrollToBottom()},t.prototype.scrollToLine=function(a){this._verifyIntegers(a),this._core.scrollToLine(a)},t.prototype.clear=function(){this._core.clear()},t.prototype.write=function(a,i){this._core.write(a,i)},t.prototype.writeUtf8=function(a,i){this._core.write(a,i)},t.prototype.writeln=function(a,i){this._core.write(a),this._core.write(`\r
`,i)},t.prototype.paste=function(a){this._core.paste(a)},t.prototype.getOption=function(a){return this._core.optionsService.getOption(a)},t.prototype.setOption=function(a,i){this._core.optionsService.setOption(a,i)},t.prototype.refresh=function(a,i){this._verifyIntegers(a,i),this._core.refresh(a,i)},t.prototype.reset=function(){this._core.reset()},t.prototype.loadAddon=function(a){return this._addonManager.loadAddon(this,a)},Object.defineProperty(t,"strings",{get:function(){return f},enumerable:!1,configurable:!0}),t.prototype._verifyIntegers=function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];for(var r=0,h=a;r<h.length;r++){var d=h[r];if(d===1/0||isNaN(d)||d%1!=0)throw new Error("This API only accepts integers")}},t}();L.Terminal=p;var c=function(){function t(a,i){this._buffer=a,this.type=i}return t.prototype.init=function(a){return this._buffer=a,this},Object.defineProperty(t.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),t.prototype.getLine=function(a){var i=this._buffer.lines.get(a);if(i)return new u(i)},t.prototype.getNullCell=function(){return new k.CellData},t}(),o=function(){function t(a){var i=this;this._buffers=a,this._onBufferChange=new S.EventEmitter,this._normal=new c(this._buffers.normal,"normal"),this._alternate=new c(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return i._onBufferChange.fire(i.active)})}return Object.defineProperty(t.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){if(this._buffers.active===this._buffers.normal)return this.normal;if(this._buffers.active===this._buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!1,configurable:!0}),t}(),u=function(){function t(a){this._line=a}return Object.defineProperty(t.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),t.prototype.getCell=function(a,i){if(!(a<0||a>=this._line.length))return i?(this._line.loadCell(a,i),i):this._line.loadCell(a,new k.CellData)},t.prototype.translateToString=function(a,i,r){return this._line.translateToString(a,i,r)},t}(),s=function(){function t(a){this._core=a}return t.prototype.registerCsiHandler=function(a,i){return this._core.addCsiHandler(a,function(r){return i(r.toArray())})},t.prototype.addCsiHandler=function(a,i){return this.registerCsiHandler(a,i)},t.prototype.registerDcsHandler=function(a,i){return this._core.addDcsHandler(a,function(r,h){return i(r,h.toArray())})},t.prototype.addDcsHandler=function(a,i){return this.registerDcsHandler(a,i)},t.prototype.registerEscHandler=function(a,i){return this._core.addEscHandler(a,i)},t.prototype.addEscHandler=function(a,i){return this.registerEscHandler(a,i)},t.prototype.registerOscHandler=function(a,i){return this._core.addOscHandler(a,i)},t.prototype.addOscHandler=function(a,i){return this.registerOscHandler(a,i)},t}(),l=function(){function t(a){this._core=a}return t.prototype.register=function(a){this._core.unicodeService.register(a)},Object.defineProperty(t.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(a){this._core.unicodeService.activeVersion=a},enumerable:!1,configurable:!0}),t}()},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(W,N){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(G,U){G.__proto__=U}||function(G,U){for(var H in U)U.hasOwnProperty(H)&&(G[H]=U[H])})(W,N)},function(W,N){function G(){this.constructor=W}k(W,N),W.prototype=N===null?Object.create(N):(G.prototype=N.prototype,new G)});Object.defineProperty(L,"__esModule",{value:!0}),L.Terminal=void 0;var f=D(36),S=D(37),_=D(38),p=D(12),c=D(19),o=D(40),u=D(50),s=D(51),l=D(11),t=D(7),a=D(18),i=D(54),r=D(55),h=D(56),d=D(57),y=D(59),m=D(0),C=D(16),T=D(27),x=D(60),E=D(5),w=D(61),A=D(62),g=D(63),P=D(64),O=D(65),F=typeof window!="undefined"?window.document:null,X=function(W){function N(G){G===void 0&&(G={});var U=W.call(this,G)||this;return U.browser=l,U._keyDownHandled=!1,U._onCursorMove=new m.EventEmitter,U._onKey=new m.EventEmitter,U._onRender=new m.EventEmitter,U._onSelectionChange=new m.EventEmitter,U._onTitleChange=new m.EventEmitter,U._onFocus=new m.EventEmitter,U._onBlur=new m.EventEmitter,U._onA11yCharEmitter=new m.EventEmitter,U._onA11yTabEmitter=new m.EventEmitter,U._setup(),U.linkifier=U._instantiationService.createInstance(u.Linkifier),U.linkifier2=U.register(U._instantiationService.createInstance(g.Linkifier2)),U.register(U._inputHandler.onRequestBell(function(){return U.bell()})),U.register(U._inputHandler.onRequestRefreshRows(function(H,V){return U.refresh(H,V)})),U.register(U._inputHandler.onRequestReset(function(){return U.reset()})),U.register(U._inputHandler.onRequestScroll(function(H,V){return U.scroll(H,V||void 0)})),U.register(U._inputHandler.onRequestWindowsOptionsReport(function(H){return U._reportWindowsOptions(H)})),U.register(m.forwardEvent(U._inputHandler.onCursorMove,U._onCursorMove)),U.register(m.forwardEvent(U._inputHandler.onTitleChange,U._onTitleChange)),U.register(m.forwardEvent(U._inputHandler.onA11yChar,U._onA11yCharEmitter)),U.register(m.forwardEvent(U._inputHandler.onA11yTab,U._onA11yTabEmitter)),U.register(U._bufferService.onResize(function(H){return U._afterResize(H.cols,H.rows)})),U}return M(N,W),Object.defineProperty(N.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(N.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),N.prototype.dispose=function(){var G,U,H;this._isDisposed||(W.prototype.dispose.call(this),(G=this._renderService)===null||G===void 0||G.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(H=(U=this.element)===null||U===void 0?void 0:U.parentNode)===null||H===void 0||H.removeChild(this.element))},N.prototype._setup=function(){W.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(N.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),N.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},N.prototype._updateOptions=function(G){var U,H,V,ce;switch(W.prototype._updateOptions.call(this,G),G){case"fontFamily":case"fontSize":(U=this._renderService)===null||U===void 0||U.clear(),(H=this._charSizeService)===null||H===void 0||H.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(V=this.viewport)===null||V===void 0||V.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new h.AccessibilityManager(this,this._renderService)):((ce=this._accessibilityManager)===null||ce===void 0||ce.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},N.prototype._onTextAreaFocus=function(G){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(p.C0.ESC+"[I"),this.updateCursorStyle(G),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},N.prototype.blur=function(){var G;return(G=this.textarea)===null||G===void 0?void 0:G.blur()},N.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(p.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},N.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var G=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),U=this._bufferService.buffer.y*G,H=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=H+"px",this.textarea.style.top=U+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=G+"px",this.textarea.style.lineHeight=G+"px",this.textarea.style.zIndex="-5"}},N.prototype._initGlobal=function(){var G=this;this._bindKeys(),this.register(t.addDisposableDomListener(this.element,"copy",function(H){G.hasSelection()&&_.copyHandler(H,G._selectionService)}));var U=function(H){return _.handlePasteEvent(H,G.textarea,G._coreService)};this.register(t.addDisposableDomListener(this.textarea,"paste",U)),this.register(t.addDisposableDomListener(this.element,"paste",U)),l.isFirefox?this.register(t.addDisposableDomListener(this.element,"mousedown",function(H){H.button===2&&_.rightClickHandler(H,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})):this.register(t.addDisposableDomListener(this.element,"contextmenu",function(H){_.rightClickHandler(H,G.textarea,G.screenElement,G._selectionService,G.options.rightClickSelectsWord)})),l.isLinux&&this.register(t.addDisposableDomListener(this.element,"auxclick",function(H){H.button===1&&_.moveTextAreaUnderMouseCursor(H,G.textarea,G.screenElement)}))},N.prototype._bindKeys=function(){var G=this;this.register(t.addDisposableDomListener(this.textarea,"keyup",function(U){return G._keyUp(U)},!0)),this.register(t.addDisposableDomListener(this.textarea,"keydown",function(U){return G._keyDown(U)},!0)),this.register(t.addDisposableDomListener(this.textarea,"keypress",function(U){return G._keyPress(U)},!0)),this.register(t.addDisposableDomListener(this.textarea,"compositionstart",function(){return G._compositionHelper.compositionstart()})),this.register(t.addDisposableDomListener(this.textarea,"compositionupdate",function(U){return G._compositionHelper.compositionupdate(U)})),this.register(t.addDisposableDomListener(this.textarea,"compositionend",function(){return G._compositionHelper.compositionend()})),this.register(this.onRender(function(){return G._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(U){return G._queueLinkification(U.start,U.end)}))},N.prototype.open=function(G){var U=this;if(!G)throw new Error("Terminal requires a parent element.");F.body.contains(G)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=G.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),G.appendChild(this.element);var H=F.createDocumentFragment();this._viewportElement=F.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),H.appendChild(this._viewportElement),this._viewportScrollArea=F.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=F.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=F.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),H.appendChild(this.screenElement),this.textarea=F.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",a.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(t.addDisposableDomListener(this.textarea,"focus",function(ye){return U._onTextAreaFocus(ye)})),this.register(t.addDisposableDomListener(this.textarea,"blur",function(){return U._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var V=this._instantiationService.createInstance(P.CoreBrowserService,this.textarea);this._instantiationService.setService(E.ICoreBrowserService,V),this._charSizeService=this._instantiationService.createInstance(w.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._compositionView=F.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(f.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(H),this._theme=this.options.theme||this._theme,this._colorManager=new T.ColorManager(F,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(ye){return U._colorManager.onOptionsChange(ye)})),this._colorManager.setTheme(this._theme);var ce=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,ce,this.rows,this.screenElement)),this._instantiationService.setService(E.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(ye){return U._onRender.fire(ye)})),this.onResize(function(ye){return U._renderService.resize(ye.cols,ye.rows)}),this._soundService=this._instantiationService.createInstance(i.SoundService),this._instantiationService.setService(E.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(S.Viewport,function(ye,Le){return U.scrollLines(ye,Le)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return U.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){U._renderService.onCursorMove(),U._syncTextArea()})),this.register(this.onResize(function(){return U._renderService.onResize(U.cols,U.rows)})),this.register(this.onBlur(function(){return U._renderService.onBlur()})),this.register(this.onFocus(function(){return U._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return U.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(s.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(E.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(ye){return U.scrollLines(ye.amount,ye.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return U._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(ye){return U._renderService.onSelectionChanged(ye.start,ye.end,ye.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(ye){U.textarea.value=ye,U.textarea.focus(),U.textarea.select()})),this.register(this.onScroll(function(){U.viewport.syncScrollArea(),U._selectionService.refresh()})),this.register(t.addDisposableDomListener(this._viewportElement,"scroll",function(){return U._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(r.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return U._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(t.addDisposableDomListener(this.element,"mousedown",function(ye){return U._selectionService.onMouseDown(ye)})),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new h.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},N.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(o.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(d.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},N.prototype._setTheme=function(G){var U,H,V;this._theme=G,(U=this._colorManager)===null||U===void 0||U.setTheme(G),(H=this._renderService)===null||H===void 0||H.setColors(this._colorManager.colors),(V=this.viewport)===null||V===void 0||V.onThemeChange(this._colorManager.colors)},N.prototype.bindMouse=function(){var G=this,U=this,H=this.element;function V(Oe){var We,ze,Ae=U._mouseService.getRawByteCoords(Oe,U.screenElement,U.cols,U.rows);if(!Ae)return!1;switch(Oe.overrideType||Oe.type){case"mousemove":ze=32,Oe.buttons===void 0?(We=3,Oe.button!==void 0&&(We=Oe.button<3?Oe.button:3)):We=1&Oe.buttons?0:4&Oe.buttons?1:2&Oe.buttons?2:3;break;case"mouseup":ze=0,We=Oe.button<3?Oe.button:3;break;case"mousedown":ze=1,We=Oe.button<3?Oe.button:3;break;case"wheel":Oe.deltaY!==0&&(ze=Oe.deltaY<0?0:1),We=4;break;default:return!1}return!(ze===void 0||We===void 0||We>4)&&U._coreMouseService.triggerMouseEvent({col:Ae.x-33,row:Ae.y-33,button:We,action:ze,ctrl:Oe.ctrlKey,alt:Oe.altKey,shift:Oe.shiftKey})}var ce={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ye=function(Oe){return V(Oe),Oe.buttons||(G._document.removeEventListener("mouseup",ce.mouseup),ce.mousedrag&&G._document.removeEventListener("mousemove",ce.mousedrag)),G.cancel(Oe)},Le=function(Oe){return V(Oe),Oe.preventDefault(),G.cancel(Oe)},Ze=function(Oe){Oe.buttons&&V(Oe)},Ye=function(Oe){Oe.buttons||V(Oe)};this.register(this._coreMouseService.onProtocolChange(function(Oe){Oe?(G.optionsService.options.logLevel==="debug"&&G._logService.debug("Binding to mouse events:",G._coreMouseService.explainEvents(Oe)),G.element.classList.add("enable-mouse-events"),G._selectionService.disable()):(G._logService.debug("Unbinding from mouse events."),G.element.classList.remove("enable-mouse-events"),G._selectionService.enable()),8&Oe?ce.mousemove||(H.addEventListener("mousemove",Ye),ce.mousemove=Ye):(H.removeEventListener("mousemove",ce.mousemove),ce.mousemove=null),16&Oe?ce.wheel||(H.addEventListener("wheel",Le,{passive:!1}),ce.wheel=Le):(H.removeEventListener("wheel",ce.wheel),ce.wheel=null),2&Oe?ce.mouseup||(ce.mouseup=ye):(G._document.removeEventListener("mouseup",ce.mouseup),ce.mouseup=null),4&Oe?ce.mousedrag||(ce.mousedrag=Ze):(G._document.removeEventListener("mousemove",ce.mousedrag),ce.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(t.addDisposableDomListener(H,"mousedown",function(Oe){if(Oe.preventDefault(),G.focus(),G._coreMouseService.areMouseEventsActive&&!G._selectionService.shouldForceSelection(Oe))return V(Oe),ce.mouseup&&G._document.addEventListener("mouseup",ce.mouseup),ce.mousedrag&&G._document.addEventListener("mousemove",ce.mousedrag),G.cancel(Oe)})),this.register(t.addDisposableDomListener(H,"wheel",function(Oe){if(!ce.wheel){if(!G.buffer.hasScrollback){var We=G.viewport.getLinesScrolled(Oe);if(We===0)return;for(var ze=p.C0.ESC+(G._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Oe.deltaY<0?"A":"B"),Ae="",xe=0;xe<Math.abs(We);xe++)Ae+=ze;G._coreService.triggerDataEvent(Ae,!0)}}},{passive:!0})),this.register(t.addDisposableDomListener(H,"wheel",function(Oe){if(!ce.wheel)return G.viewport.onWheel(Oe)?void 0:G.cancel(Oe)},{passive:!1})),this.register(t.addDisposableDomListener(H,"touchstart",function(Oe){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchStart(Oe),G.cancel(Oe)},{passive:!0})),this.register(t.addDisposableDomListener(H,"touchmove",function(Oe){if(!G._coreMouseService.areMouseEventsActive)return G.viewport.onTouchMove(Oe)?void 0:G.cancel(Oe)},{passive:!1}))},N.prototype.refresh=function(G,U){var H;(H=this._renderService)===null||H===void 0||H.refreshRows(G,U)},N.prototype._queueLinkification=function(G,U){var H;(H=this.linkifier)===null||H===void 0||H.linkifyRows(G,U)},N.prototype.updateCursorStyle=function(G){this._selectionService&&this._selectionService.shouldColumnSelect(G)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},N.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},N.prototype.scrollLines=function(G,U){W.prototype.scrollLines.call(this,G,U),this.refresh(0,this.rows-1)},N.prototype.paste=function(G){_.paste(G,this.textarea,this._coreService)},N.prototype.attachCustomKeyEventHandler=function(G){this._customKeyEventHandler=G},N.prototype.registerLinkMatcher=function(G,U,H){var V=this.linkifier.registerLinkMatcher(G,U,H);return this.refresh(0,this.rows-1),V},N.prototype.deregisterLinkMatcher=function(G){this.linkifier.deregisterLinkMatcher(G)&&this.refresh(0,this.rows-1)},N.prototype.registerLinkProvider=function(G){return this.linkifier2.registerLinkProvider(G)},N.prototype.registerCharacterJoiner=function(G){var U=this._renderService.registerCharacterJoiner(G);return this.refresh(0,this.rows-1),U},N.prototype.deregisterCharacterJoiner=function(G){this._renderService.deregisterCharacterJoiner(G)&&this.refresh(0,this.rows-1)},Object.defineProperty(N.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),N.prototype.addMarker=function(G){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+G)},N.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},N.prototype.select=function(G,U,H){this._selectionService.setSelection(G,U,H)},N.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},N.prototype.getSelectionPosition=function(){if(this._selectionService&&this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},N.prototype.clearSelection=function(){var G;(G=this._selectionService)===null||G===void 0||G.clearSelection()},N.prototype.selectAll=function(){var G;(G=this._selectionService)===null||G===void 0||G.selectAll()},N.prototype.selectLines=function(G,U){var H;(H=this._selectionService)===null||H===void 0||H.selectLines(G,U)},N.prototype._keyDown=function(G){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;if(!this._compositionHelper.keydown(G))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var U=y.evaluateKeyboardEvent(G,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(G),U.type===3||U.type===2){var H=this.rows-1;return this.scrollLines(U.type===2?-H:H),this.cancel(G,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,G)||(U.cancel&&this.cancel(G,!0),!U.key||(U.key!==p.C0.ETX&&U.key!==p.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:G}),this._showCursor(),this._coreService.triggerDataEvent(U.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(G,!0)))},N.prototype._isThirdLevelShift=function(G,U){var H=G.isMac&&!this.options.macOptionIsMeta&&U.altKey&&!U.ctrlKey&&!U.metaKey||G.isWindows&&U.altKey&&U.ctrlKey&&!U.metaKey;return U.type==="keypress"?H:H&&(!U.keyCode||U.keyCode>47)},N.prototype._keyUp=function(G){this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1||(function(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18}(G)||this.focus(),this.updateCursorStyle(G))},N.prototype._keyPress=function(G){var U;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&this._customKeyEventHandler(G)===!1)return!1;if(this.cancel(G),G.charCode)U=G.charCode;else if(G.which===null||G.which===void 0)U=G.keyCode;else{if(G.which===0||G.charCode===0)return!1;U=G.which}return!(!U||(G.altKey||G.ctrlKey||G.metaKey)&&!this._isThirdLevelShift(this.browser,G))&&(U=String.fromCharCode(U),this._onKey.fire({key:U,domEvent:G}),this._showCursor(),this._coreService.triggerDataEvent(U,!0),!0)},N.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},N.prototype.resize=function(G,U){G!==this.cols||U!==this.rows?W.prototype.resize.call(this,G,U):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},N.prototype._afterResize=function(G,U){var H,V;(H=this._charSizeService)===null||H===void 0||H.measure(),(V=this.viewport)===null||V===void 0||V.syncScrollArea(!0)},N.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var G=1;G<this.rows;G++)this.buffer.lines.push(this.buffer.getBlankLine(C.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},N.prototype.reset=function(){var G,U;this.options.rows=this.rows,this.options.cols=this.cols;var H=this._customKeyEventHandler;this._setup(),W.prototype.reset.call(this),(G=this._selectionService)===null||G===void 0||G.reset(),this._customKeyEventHandler=H,this.refresh(0,this.rows-1),(U=this.viewport)===null||U===void 0||U.syncScrollArea()},N.prototype._reportWindowsOptions=function(G){if(this._renderService)switch(G){case c.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var U=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),H=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(p.C0.ESC+"[4;"+H+";"+U+"t");break;case c.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var V=this._renderService.dimensions.scaledCellWidth.toFixed(0),ce=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(p.C0.ESC+"[6;"+ce+";"+V+"t")}},N.prototype.cancel=function(G,U){if(this.options.cancelEvents||U)return G.preventDefault(),G.stopPropagation(),!1},N.prototype._visualBell=function(){return!1},N.prototype._soundBell=function(){return this.options.bellStyle==="sound"},N}(O.CoreTerminal);L.Terminal=X},function(z,L,D){"use strict";var k=this&&this.__decorate||function(p,c,o,u){var s,l=arguments.length,t=l<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(p,c,o,u);else for(var a=p.length-1;a>=0;a--)(s=p[a])&&(t=(l<3?s(t):l>3?s(c,o,t):s(c,o))||t);return l>3&&t&&Object.defineProperty(c,o,t),t},M=this&&this.__param||function(p,c){return function(o,u){c(o,u,p)}};Object.defineProperty(L,"__esModule",{value:!0}),L.CompositionHelper=void 0;var f=D(5),S=D(1),_=function(){function p(c,o,u,s,l,t){this._textarea=c,this._compositionView=o,this._bufferService=u,this._optionsService=s,this._charSizeService=l,this._coreService=t,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(p.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),p.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},p.prototype.compositionupdate=function(c){var o=this;this._compositionView.textContent=c.data,this.updateCompositionElements(),setTimeout(function(){o._compositionPosition.end=o._textarea.value.length},0)},p.prototype.compositionend=function(){this._finalizeComposition(!0)},p.prototype.keydown=function(c){if(this._isComposing||this._isSendingComposition){if(c.keyCode===229)return!1;if(c.keyCode===16||c.keyCode===17||c.keyCode===18)return!1;this._finalizeComposition(!1)}return c.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},p.prototype._finalizeComposition=function(c){var o=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,c){var u={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){if(o._isSendingComposition){o._isSendingComposition=!1;var l=void 0;l=o._isComposing?o._textarea.value.substring(u.start,u.end):o._textarea.value.substring(u.start),o._coreService.triggerDataEvent(l,!0)}},0)}else{this._isSendingComposition=!1;var s=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(s,!0)}},p.prototype._handleAnyTextareaChanges=function(){var c=this,o=this._textarea.value;setTimeout(function(){if(!c._isComposing){var u=c._textarea.value.replace(o,"");u.length>0&&c._coreService.triggerDataEvent(u,!0)}},0)},p.prototype.updateCompositionElements=function(c){var o=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var u=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),s=this._bufferService.buffer.y*u,l=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=u+"px",this._compositionView.style.lineHeight=u+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var t=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=s+"px",this._textarea.style.width=t.width+"px",this._textarea.style.height=t.height+"px",this._textarea.style.lineHeight=t.height+"px"}c||setTimeout(function(){return o.updateCompositionElements(!0)},0)}},p=k([M(2,S.IBufferService),M(3,S.IOptionsService),M(4,f.ICharSizeService),M(5,S.ICoreService)],p)}();L.CompositionHelper=_},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)}),f=this&&this.__decorate||function(s,l,t,a){var i,r=arguments.length,h=r<3?l:a===null?a=Object.getOwnPropertyDescriptor(l,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,t,a);else for(var d=s.length-1;d>=0;d--)(i=s[d])&&(h=(r<3?i(h):r>3?i(l,t,h):i(l,t))||h);return r>3&&h&&Object.defineProperty(l,t,h),h},S=this&&this.__param||function(s,l){return function(t,a){l(t,a,s)}};Object.defineProperty(L,"__esModule",{value:!0}),L.Viewport=void 0;var _=D(2),p=D(7),c=D(5),o=D(1),u=function(s){function l(t,a,i,r,h,d,y){var m=s.call(this)||this;return m._scrollLines=t,m._viewportElement=a,m._scrollArea=i,m._bufferService=r,m._optionsService=h,m._charSizeService=d,m._renderService=y,m.scrollBarWidth=0,m._currentRowHeight=0,m._lastRecordedBufferLength=0,m._lastRecordedViewportHeight=0,m._lastRecordedBufferHeight=0,m._lastTouchY=0,m._lastScrollTop=0,m._wheelPartialScroll=0,m._refreshAnimationFrame=null,m._ignoreNextScrollEvent=!1,m.scrollBarWidth=m._viewportElement.offsetWidth-m._scrollArea.offsetWidth||15,m.register(p.addDisposableDomListener(m._viewportElement,"scroll",m._onScroll.bind(m))),setTimeout(function(){return m.syncScrollArea()},0),m}return M(l,s),l.prototype.onThemeChange=function(t){this._viewportElement.style.backgroundColor=t.background.css},l.prototype._refresh=function(t){var a=this;if(t)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return a._innerRefresh()}))},l.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var a=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==a&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=a),this._refreshAnimationFrame=null},l.prototype.syncScrollArea=function(t){if(t===void 0&&(t=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(t);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var a=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===a&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(t)}else this._refresh(t)},l.prototype._onScroll=function(t){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var a=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(a,!0)}},l.prototype._bubbleScroll=function(t,a){var i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(a<0&&this._viewportElement.scrollTop!==0||a>0&&i<this._lastRecordedBufferHeight)||(t.cancelable&&t.preventDefault(),!1)},l.prototype.onWheel=function(t){var a=this._getPixelsScrolled(t);return a!==0&&(this._viewportElement.scrollTop+=a,this._bubbleScroll(t,a))},l.prototype._getPixelsScrolled=function(t){if(t.deltaY===0)return 0;var a=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_LINE?a*=this._currentRowHeight:t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._currentRowHeight*this._bufferService.rows),a},l.prototype.getLinesScrolled=function(t){if(t.deltaY===0)return 0;var a=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=this._currentRowHeight+0,this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a},l.prototype._applyScrollModifier=function(t,a){var i=this._optionsService.options.fastScrollModifier;return i==="alt"&&a.altKey||i==="ctrl"&&a.ctrlKey||i==="shift"&&a.shiftKey?t*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:t*this._optionsService.options.scrollSensitivity},l.prototype.onTouchStart=function(t){this._lastTouchY=t.touches[0].pageY},l.prototype.onTouchMove=function(t){var a=this._lastTouchY-t.touches[0].pageY;return this._lastTouchY=t.touches[0].pageY,a!==0&&(this._viewportElement.scrollTop+=a,this._bubbleScroll(t,a))},l=f([S(3,o.IBufferService),S(4,o.IOptionsService),S(5,c.ICharSizeService),S(6,c.IRenderService)],l)}(_.Disposable);L.Viewport=u},function(z,L,D){"use strict";function k(_){return _.replace(/\r?\n/g,"\r")}function M(_,p){return p?"[200~"+_+"[201~":_}function f(_,p,c){_=M(_=k(_),c.decPrivateModes.bracketedPasteMode),c.triggerDataEvent(_,!0),p.value=""}function S(_,p,c){var o=c.getBoundingClientRect(),u=_.clientX-o.left-10,s=_.clientY-o.top-10;p.style.width="20px",p.style.height="20px",p.style.left=u+"px",p.style.top=s+"px",p.style.zIndex="1000",p.focus()}Object.defineProperty(L,"__esModule",{value:!0}),L.rightClickHandler=L.moveTextAreaUnderMouseCursor=L.paste=L.handlePasteEvent=L.copyHandler=L.bracketTextForPaste=L.prepareTextForTerminal=void 0,L.prepareTextForTerminal=k,L.bracketTextForPaste=M,L.copyHandler=function(_,p){_.clipboardData&&_.clipboardData.setData("text/plain",p.selectionText),_.preventDefault()},L.handlePasteEvent=function(_,p,c){_.stopPropagation(),_.clipboardData&&f(_.clipboardData.getData("text/plain"),p,c)},L.paste=f,L.moveTextAreaUnderMouseCursor=S,L.rightClickHandler=function(_,p,c,o,u){S(_,p,c),u&&!o.isClickInSelection(_)&&o.selectWordAtCursor(_),p.value=o.selectionText,p.select()}},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)});Object.defineProperty(L,"__esModule",{value:!0}),L.EscapeSequenceParser=L.VT500_TRANSITION_TABLE=L.TransitionTable=void 0;var f=D(2),S=D(15),_=D(21),p=D(22),c=D(24),o=function(){function s(l){this.table=new Uint8Array(l)}return s.prototype.setDefault=function(l,t){S.fill(this.table,l<<4|t)},s.prototype.add=function(l,t,a,i){this.table[t<<8|l]=a<<4|i},s.prototype.addMany=function(l,t,a,i){for(var r=0;r<l.length;r++)this.table[t<<8|l[r]]=a<<4|i},s}();L.TransitionTable=o,L.VT500_TRANSITION_TABLE=function(){var s=new o(4095),l=Array.apply(null,Array(256)).map(function(d,y){return y}),t=function(d,y){return l.slice(d,y)},a=t(32,127),i=t(0,24);i.push(25),i.push.apply(i,t(28,32));var r,h=t(0,14);for(r in s.setDefault(1,0),s.addMany(a,0,2,0),h)s.addMany([24,26,153,154],r,3,0),s.addMany(t(128,144),r,3,0),s.addMany(t(144,152),r,3,0),s.add(156,r,0,0),s.add(27,r,11,1),s.add(157,r,4,8),s.addMany([152,158,159],r,0,7),s.add(155,r,11,3),s.add(144,r,11,9);return s.addMany(i,0,3,0),s.addMany(i,1,3,1),s.add(127,1,0,1),s.addMany(i,8,0,8),s.addMany(i,3,3,3),s.add(127,3,0,3),s.addMany(i,4,3,4),s.add(127,4,0,4),s.addMany(i,6,3,6),s.addMany(i,5,3,5),s.add(127,5,0,5),s.addMany(i,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(a,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(t(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(a,7,0,7),s.addMany(i,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(t(64,127),3,7,0),s.addMany(t(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(t(48,60),4,8,4),s.addMany(t(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(t(32,64),6,0,6),s.add(127,6,0,6),s.addMany(t(64,127),6,0,0),s.addMany(t(32,48),3,9,5),s.addMany(t(32,48),5,9,5),s.addMany(t(48,64),5,0,6),s.addMany(t(64,127),5,7,0),s.addMany(t(32,48),4,9,5),s.addMany(t(32,48),1,9,2),s.addMany(t(32,48),2,9,2),s.addMany(t(48,127),2,10,0),s.addMany(t(48,80),1,10,0),s.addMany(t(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(t(96,127),1,10,0),s.add(80,1,11,9),s.addMany(i,9,0,9),s.add(127,9,0,9),s.addMany(t(28,32),9,0,9),s.addMany(t(32,48),9,9,12),s.addMany(t(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(i,11,0,11),s.addMany(t(32,128),11,0,11),s.addMany(t(28,32),11,0,11),s.addMany(i,10,0,10),s.add(127,10,0,10),s.addMany(t(28,32),10,0,10),s.addMany(t(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(t(32,48),10,9,12),s.addMany(i,12,0,12),s.add(127,12,0,12),s.addMany(t(28,32),12,0,12),s.addMany(t(32,48),12,9,12),s.addMany(t(48,64),12,0,11),s.addMany(t(64,127),12,12,13),s.addMany(t(64,127),10,12,13),s.addMany(t(64,127),9,12,13),s.addMany(i,13,13,13),s.addMany(a,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(160,0,2,0),s.add(160,8,5,8),s.add(160,6,0,6),s.add(160,11,0,11),s.add(160,13,13,13),s}();var u=function(s){function l(t){t===void 0&&(t=L.VT500_TRANSITION_TABLE);var a=s.call(this)||this;return a._transitions=t,a.initialState=0,a.currentState=a.initialState,a._params=new _.Params,a._params.addParam(0),a._collect=0,a.precedingCodepoint=0,a._printHandlerFb=function(i,r,h){},a._executeHandlerFb=function(i){},a._csiHandlerFb=function(i,r){},a._escHandlerFb=function(i){},a._errorHandlerFb=function(i){return i},a._printHandler=a._printHandlerFb,a._executeHandlers=Object.create(null),a._csiHandlers=Object.create(null),a._escHandlers=Object.create(null),a._oscParser=new p.OscParser,a._dcsParser=new c.DcsParser,a._errorHandler=a._errorHandlerFb,a.setEscHandler({final:"\\"},function(){}),a}return M(l,s),l.prototype._identifier=function(t,a){a===void 0&&(a=[64,126]);var i=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if((i=t.prefix.charCodeAt(0))&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var r=0;r<t.intermediates.length;++r){var h=t.intermediates.charCodeAt(r);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=h}}if(t.final.length!==1)throw new Error("final must be a single byte");var d=t.final.charCodeAt(0);if(a[0]>d||d>a[1])throw new Error("final must be in range "+a[0]+" .. "+a[1]);return i<<=8,i|=d},l.prototype.identToString=function(t){for(var a=[];t;)a.push(String.fromCharCode(255&t)),t>>=8;return a.reverse().join("")},l.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},l.prototype.setPrintHandler=function(t){this._printHandler=t},l.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},l.prototype.addEscHandler=function(t,a){var i=this._identifier(t,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);var r=this._escHandlers[i];return r.push(a),{dispose:function(){var h=r.indexOf(a);h!==-1&&r.splice(h,1)}}},l.prototype.setEscHandler=function(t,a){this._escHandlers[this._identifier(t,[48,126])]=[a]},l.prototype.clearEscHandler=function(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]},l.prototype.setEscHandlerFallback=function(t){this._escHandlerFb=t},l.prototype.setExecuteHandler=function(t,a){this._executeHandlers[t.charCodeAt(0)]=a},l.prototype.clearExecuteHandler=function(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]},l.prototype.setExecuteHandlerFallback=function(t){this._executeHandlerFb=t},l.prototype.addCsiHandler=function(t,a){var i=this._identifier(t);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);var r=this._csiHandlers[i];return r.push(a),{dispose:function(){var h=r.indexOf(a);h!==-1&&r.splice(h,1)}}},l.prototype.setCsiHandler=function(t,a){this._csiHandlers[this._identifier(t)]=[a]},l.prototype.clearCsiHandler=function(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]},l.prototype.setCsiHandlerFallback=function(t){this._csiHandlerFb=t},l.prototype.addDcsHandler=function(t,a){return this._dcsParser.addHandler(this._identifier(t),a)},l.prototype.setDcsHandler=function(t,a){this._dcsParser.setHandler(this._identifier(t),a)},l.prototype.clearDcsHandler=function(t){this._dcsParser.clearHandler(this._identifier(t))},l.prototype.setDcsHandlerFallback=function(t){this._dcsParser.setHandlerFallback(t)},l.prototype.addOscHandler=function(t,a){return this._oscParser.addHandler(t,a)},l.prototype.setOscHandler=function(t,a){this._oscParser.setHandler(t,a)},l.prototype.clearOscHandler=function(t){this._oscParser.clearHandler(t)},l.prototype.setOscHandlerFallback=function(t){this._oscParser.setHandlerFallback(t)},l.prototype.setErrorHandler=function(t){this._errorHandler=t},l.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},l.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},l.prototype.parse=function(t,a){for(var i=0,r=0,h=this.currentState,d=this._oscParser,y=this._dcsParser,m=this._collect,C=this._params,T=this._transitions.table,x=0;x<a;++x){switch((r=T[h<<8|((i=t[x])<160?i:160)])>>4){case 2:for(var E=x+1;;++E){if(E>=a||(i=t[E])<32||i>126&&i<160){this._printHandler(t,x,E),x=E-1;break}if(++E>=a||(i=t[E])<32||i>126&&i<160){this._printHandler(t,x,E),x=E-1;break}if(++E>=a||(i=t[E])<32||i>126&&i<160){this._printHandler(t,x,E),x=E-1;break}if(++E>=a||(i=t[E])<32||i>126&&i<160){this._printHandler(t,x,E),x=E-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:x,code:i,currentState:h,collect:m,params:C,abort:!1}).abort)return;break;case 7:for(var w=this._csiHandlers[m<<8|i],A=w?w.length-1:-1;A>=0&&w[A](C)===!1;A--);A<0&&this._csiHandlerFb(m<<8|i,C),this.precedingCodepoint=0;break;case 8:do switch(i){case 59:C.addParam(0);break;case 58:C.addSubParam(-1);break;default:C.addDigit(i-48)}while(++x<a&&(i=t[x])>47&&i<60);x--;break;case 9:m<<=8,m|=i;break;case 10:for(var g=this._escHandlers[m<<8|i],P=g?g.length-1:-1;P>=0&&g[P]()===!1;P--);P<0&&this._escHandlerFb(m<<8|i),this.precedingCodepoint=0;break;case 11:C.reset(),C.addParam(0),m=0;break;case 12:y.hook(m<<8|i,C);break;case 13:for(var O=x+1;;++O)if(O>=a||(i=t[O])===24||i===26||i===27||i>127&&i<160){y.put(t,x,O),x=O-1;break}break;case 14:y.unhook(i!==24&&i!==26),i===27&&(r|=1),C.reset(),C.addParam(0),m=0,this.precedingCodepoint=0;break;case 4:d.start();break;case 5:for(var F=x+1;;F++)if(F>=a||(i=t[F])<32||i>127&&i<=159){d.put(t,x,F),x=F-1;break}break;case 6:d.end(i!==24&&i!==26),i===27&&(r|=1),C.reset(),C.addParam(0),m=0,this.precedingCodepoint=0}h=15&r}this._collect=m,this.currentState=h},l}(f.Disposable);L.EscapeSequenceParser=u},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(d,y){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,C){m.__proto__=C}||function(m,C){for(var T in C)C.hasOwnProperty(T)&&(m[T]=C[T])})(d,y)},function(d,y){function m(){this.constructor=d}k(d,y),d.prototype=y===null?Object.create(y):(m.prototype=y.prototype,new m)}),f=this&&this.__decorate||function(d,y,m,C){var T,x=arguments.length,E=x<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,m):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,y,m,C);else for(var w=d.length-1;w>=0;w--)(T=d[w])&&(E=(x<3?T(E):x>3?T(y,m,E):T(y,m))||E);return x>3&&E&&Object.defineProperty(y,m,E),E},S=this&&this.__param||function(d,y){return function(m,C){y(m,C,d)}};Object.defineProperty(L,"__esModule",{value:!0}),L.Renderer=void 0;var _=D(41),p=D(47),c=D(48),o=D(49),u=D(29),s=D(2),l=D(5),t=D(1),a=D(25),i=D(0),r=1,h=function(d){function y(m,C,T,x,E,w,A,g,P){var O=d.call(this)||this;O._colors=m,O._screenElement=C,O._bufferService=E,O._charSizeService=w,O._optionsService=A,O._id=r++,O._onRequestRedraw=new i.EventEmitter;var F=O._optionsService.options.allowTransparency;return O._characterJoinerRegistry=new u.CharacterJoinerRegistry(O._bufferService),O._renderLayers=[new _.TextRenderLayer(O._screenElement,0,O._colors,O._characterJoinerRegistry,F,O._id,O._bufferService,A),new p.SelectionRenderLayer(O._screenElement,1,O._colors,O._id,O._bufferService,A),new o.LinkRenderLayer(O._screenElement,2,O._colors,O._id,T,x,O._bufferService,A),new c.CursorRenderLayer(O._screenElement,3,O._colors,O._id,O._onRequestRedraw,O._bufferService,A,g,P)],O.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},O._devicePixelRatio=window.devicePixelRatio,O._updateDimensions(),O.onOptionsChanged(),O}return M(y,d),Object.defineProperty(y.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),y.prototype.dispose=function(){for(var m=0,C=this._renderLayers;m<C.length;m++)C[m].dispose();d.prototype.dispose.call(this),a.removeTerminalFromCache(this._id)},y.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},y.prototype.setColors=function(m){this._colors=m;for(var C=0,T=this._renderLayers;C<T.length;C++){var x=T[C];x.setColors(this._colors),x.reset()}},y.prototype.onResize=function(m,C){this._updateDimensions();for(var T=0,x=this._renderLayers;T<x.length;T++)x[T].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},y.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},y.prototype.onBlur=function(){this._runOperation(function(m){return m.onBlur()})},y.prototype.onFocus=function(){this._runOperation(function(m){return m.onFocus()})},y.prototype.onSelectionChanged=function(m,C,T){T===void 0&&(T=!1),this._runOperation(function(x){return x.onSelectionChanged(m,C,T)})},y.prototype.onCursorMove=function(){this._runOperation(function(m){return m.onCursorMove()})},y.prototype.onOptionsChanged=function(){this._runOperation(function(m){return m.onOptionsChanged()})},y.prototype.clear=function(){this._runOperation(function(m){return m.reset()})},y.prototype._runOperation=function(m){for(var C=0,T=this._renderLayers;C<T.length;C++)m(T[C])},y.prototype.renderRows=function(m,C){for(var T=0,x=this._renderLayers;T<x.length;T++)x[T].onGridChanged(m,C)},y.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},y.prototype.registerCharacterJoiner=function(m){return this._characterJoinerRegistry.registerCharacterJoiner(m)},y.prototype.deregisterCharacterJoiner=function(m){return this._characterJoinerRegistry.deregisterCharacterJoiner(m)},y=f([S(4,t.IBufferService),S(5,l.ICharSizeService),S(6,t.IOptionsService),S(7,t.ICoreService),S(8,l.ICoreBrowserService)],y)}(s.Disposable);L.Renderer=h},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)});Object.defineProperty(L,"__esModule",{value:!0}),L.TextRenderLayer=void 0;var f=D(42),S=D(13),_=D(6),p=D(3),c=D(29),o=D(4),u=function(s){function l(t,a,i,r,h,d,y,m){var C=s.call(this,t,"text",a,h,i,d,y,m)||this;return C._characterWidth=0,C._characterFont="",C._characterOverlapCache={},C._workCell=new o.CellData,C._state=new f.GridCache,C._characterJoinerRegistry=r,C}return M(l,s),l.prototype.resize=function(t){s.prototype.resize.call(this,t);var a=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===a||(this._characterWidth=t.scaledCharWidth,this._characterFont=a,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},l.prototype.reset=function(){this._state.clear(),this._clearAll()},l.prototype._forEachCell=function(t,a,i,r){for(var h=t;h<=a;h++)for(var d=h+this._bufferService.buffer.ydisp,y=this._bufferService.buffer.lines.get(d),m=i?i.getJoinedCharacters(d):[],C=0;C<this._bufferService.cols;C++){y.loadCell(C,this._workCell);var T=this._workCell,x=!1,E=C;if(T.getWidth()!==0){if(m.length>0&&C===m[0][0]){x=!0;var w=m.shift();T=new c.JoinedCellData(this._workCell,y.translateToString(!0,w[0],w[1]),w[1]-w[0]),E=w[1]-1}!x&&this._isOverlapping(T)&&E<y.length-1&&y.getCodePoint(E+1)===p.NULL_CELL_CODE&&(T.content&=-12582913,T.content|=2<<22),r(T,C,h),C=E}}},l.prototype._drawBackground=function(t,a){var i=this,r=this._ctx,h=this._bufferService.cols,d=0,y=0,m=null;r.save(),this._forEachCell(t,a,null,function(C,T,x){var E=null;C.isInverse()?E=C.isFgDefault()?i._colors.foreground.css:C.isFgRGB()?"rgb("+_.AttributeData.toColorRGB(C.getFgColor()).join(",")+")":i._colors.ansi[C.getFgColor()].css:C.isBgRGB()?E="rgb("+_.AttributeData.toColorRGB(C.getBgColor()).join(",")+")":C.isBgPalette()&&(E=i._colors.ansi[C.getBgColor()].css),m===null&&(d=T,y=x),x!==y?(r.fillStyle=m||"",i._fillCells(d,y,h-d,1),d=T,y=x):m!==E&&(r.fillStyle=m||"",i._fillCells(d,y,T-d,1),d=T,y=x),m=E}),m!==null&&(r.fillStyle=m,this._fillCells(d,y,h-d,1)),r.restore()},l.prototype._drawForeground=function(t,a){var i=this;this._forEachCell(t,a,this._characterJoinerRegistry,function(r,h,d){if(!r.isInvisible()&&(i._drawChars(r,h,d),r.isUnderline())){if(i._ctx.save(),r.isInverse())if(r.isBgDefault())i._ctx.fillStyle=i._colors.background.css;else if(r.isBgRGB())i._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(r.getBgColor()).join(",")+")";else{var y=r.getBgColor();i._optionsService.options.drawBoldTextInBrightColors&&r.isBold()&&y<8&&(y+=8),i._ctx.fillStyle=i._colors.ansi[y].css}else if(r.isFgDefault())i._ctx.fillStyle=i._colors.foreground.css;else if(r.isFgRGB())i._ctx.fillStyle="rgb("+_.AttributeData.toColorRGB(r.getFgColor()).join(",")+")";else{var m=r.getFgColor();i._optionsService.options.drawBoldTextInBrightColors&&r.isBold()&&m<8&&(m+=8),i._ctx.fillStyle=i._colors.ansi[m].css}i._fillBottomLineAtCells(h,d,r.getWidth()),i._ctx.restore()}})},l.prototype.onGridChanged=function(t,a){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,t,this._bufferService.cols,a-t+1),this._drawBackground(t,a),this._drawForeground(t,a))},l.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},l.prototype._isOverlapping=function(t){if(t.getWidth()!==1)return!1;if(t.getCode()<256)return!1;var a=t.getChars();if(this._characterOverlapCache.hasOwnProperty(a))return this._characterOverlapCache[a];this._ctx.save(),this._ctx.font=this._characterFont;var i=Math.floor(this._ctx.measureText(a).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[a]=i,i},l}(S.BaseRenderLayer);L.TextRenderLayer=u},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.GridCache=void 0;var k=function(){function M(){this.cache=[]}return M.prototype.resize=function(f,S){for(var _=0;_<f;_++){this.cache.length<=_&&this.cache.push([]);for(var p=this.cache[_].length;p<S;p++)this.cache[_].push(void 0);this.cache[_].length=S}this.cache.length=f},M.prototype.clear=function(){for(var f=0;f<this.cache.length;f++)for(var S=0;S<this.cache[f].length;S++)this.cache[f][S]=void 0},M}();L.GridCache=k},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(i,r){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,d){h.__proto__=d}||function(h,d){for(var y in d)d.hasOwnProperty(y)&&(h[y]=d[y])})(i,r)},function(i,r){function h(){this.constructor=i}k(i,r),i.prototype=r===null?Object.create(r):(h.prototype=r.prototype,new h)});Object.defineProperty(L,"__esModule",{value:!0}),L.NoneCharAtlas=L.DynamicCharAtlas=L.getGlyphCacheKey=void 0;var f=D(9),S=D(44),_=D(27),p=D(46),c=D(11),o=D(28),u=D(10),s={css:"rgba(0, 0, 0, 0)",rgba:0};function l(i){return i.code<<21|i.bg<<12|i.fg<<3|(i.bold?0:4)+(i.dim?0:2)+(i.italic?0:1)}L.getGlyphCacheKey=l;var t=function(i){function r(h,d){var y=i.call(this)||this;y._config=d,y._drawToCacheCount=0,y._glyphsWaitingOnBitmap=[],y._bitmapCommitTimeout=null,y._bitmap=null,y._cacheCanvas=h.createElement("canvas"),y._cacheCanvas.width=1024,y._cacheCanvas.height=1024,y._cacheCtx=o.throwIfFalsy(y._cacheCanvas.getContext("2d",{alpha:!0}));var m=h.createElement("canvas");m.width=y._config.scaledCharWidth,m.height=y._config.scaledCharHeight,y._tmpCtx=o.throwIfFalsy(m.getContext("2d",{alpha:y._config.allowTransparency})),y._width=Math.floor(1024/y._config.scaledCharWidth),y._height=Math.floor(1024/y._config.scaledCharHeight);var C=y._width*y._height;return y._cacheMap=new p.LRUMap(C),y._cacheMap.prealloc(C),y}return M(r,i),r.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},r.prototype.beginFrame=function(){this._drawToCacheCount=0},r.prototype.draw=function(h,d,y,m){if(d.code===32)return!0;if(!this._canCache(d))return!1;var C=l(d),T=this._cacheMap.get(C);if(T!=null)return this._drawFromCache(h,T,y,m),!0;if(this._drawToCacheCount<100){var x=void 0;x=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var E=this._drawToCache(d,x);return this._cacheMap.set(C,E),this._drawFromCache(h,E,y,m),!0}return!1},r.prototype._canCache=function(h){return h.code<256},r.prototype._toCoordinateX=function(h){return h%this._width*this._config.scaledCharWidth},r.prototype._toCoordinateY=function(h){return Math.floor(h/this._width)*this._config.scaledCharHeight},r.prototype._drawFromCache=function(h,d,y,m){if(!d.isEmpty){var C=this._toCoordinateX(d.index),T=this._toCoordinateY(d.index);h.drawImage(d.inBitmap?this._bitmap:this._cacheCanvas,C,T,this._config.scaledCharWidth,this._config.scaledCharHeight,y,m,this._config.scaledCharWidth,this._config.scaledCharHeight)}},r.prototype._getColorFromAnsiIndex=function(h){return h<this._config.colors.ansi.length?this._config.colors.ansi[h]:_.DEFAULT_ANSI_COLORS[h]},r.prototype._getBackgroundColor=function(h){return this._config.allowTransparency?s:h.bg===f.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:h.bg<256?this._getColorFromAnsiIndex(h.bg):this._config.colors.background},r.prototype._getForegroundColor=function(h){return h.fg===f.INVERTED_DEFAULT_COLOR?u.color.opaque(this._config.colors.background):h.fg<256?this._getColorFromAnsiIndex(h.fg):this._config.colors.foreground},r.prototype._drawToCache=function(h,d){this._drawToCacheCount++,this._tmpCtx.save();var y=this._getBackgroundColor(h);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=y.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var m=h.bold?this._config.fontWeightBold:this._config.fontWeight,C=h.italic?"italic":"";this._tmpCtx.font=C+" "+m+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline="middle",this._tmpCtx.fillStyle=this._getForegroundColor(h).css,h.dim&&(this._tmpCtx.globalAlpha=f.DIM_OPACITY),this._tmpCtx.fillText(h.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var T=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),x=!1;this._config.allowTransparency||(x=function(g,P){for(var O=!0,F=P.rgba>>>24,X=P.rgba>>>16&255,W=P.rgba>>>8&255,N=0;N<g.data.length;N+=4)g.data[N]===F&&g.data[N+1]===X&&g.data[N+2]===W?g.data[N+3]=0:O=!1;return O}(T,y));var E=this._toCoordinateX(d),w=this._toCoordinateY(d);this._cacheCtx.putImageData(T,E,w);var A={index:d,isEmpty:x,inBitmap:!1};return this._addGlyphToBitmap(A),A},r.prototype._addGlyphToBitmap=function(h){var d=this;!("createImageBitmap"in window)||c.isFirefox||c.isSafari||(this._glyphsWaitingOnBitmap.push(h),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return d._generateBitmap()},100)))},r.prototype._generateBitmap=function(){var h=this,d=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(y){h._bitmap=y;for(var m=0;m<d.length;m++)d[m].inBitmap=!0}),this._bitmapCommitTimeout=null},r}(S.BaseCharAtlas);L.DynamicCharAtlas=t;var a=function(i){function r(h,d){return i.call(this)||this}return M(r,i),r.prototype.draw=function(h,d,y,m){return!1},r}(S.BaseCharAtlas);L.NoneCharAtlas=a},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.BaseCharAtlas=void 0;var k=function(){function M(){this._didWarmUp=!1}return M.prototype.dispose=function(){},M.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},M.prototype._doWarmUp=function(){},M.prototype.beginFrame=function(){},M}();L.BaseCharAtlas=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.ColorContrastCache=void 0;var k=function(){function M(){this._color={},this._rgba={}}return M.prototype.clear=function(){this._color={},this._rgba={}},M.prototype.setCss=function(f,S,_){this._rgba[f]||(this._rgba[f]={}),this._rgba[f][S]=_},M.prototype.getCss=function(f,S){return this._rgba[f]?this._rgba[f][S]:void 0},M.prototype.setColor=function(f,S,_){this._color[f]||(this._color[f]={}),this._color[f][S]=_},M.prototype.getColor=function(f,S){return this._color[f]?this._color[f][S]:void 0},M}();L.ColorContrastCache=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.LRUMap=void 0;var k=function(){function M(f){this.capacity=f,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return M.prototype._unlinkNode=function(f){var S=f.prev,_=f.next;f===this._head&&(this._head=_),f===this._tail&&(this._tail=S),S!==null&&(S.next=_),_!==null&&(_.prev=S)},M.prototype._appendNode=function(f){var S=this._tail;S!==null&&(S.next=f),f.prev=S,f.next=null,this._tail=f,this._head===null&&(this._head=f)},M.prototype.prealloc=function(f){for(var S=this._nodePool,_=0;_<f;_++)S.push({prev:null,next:null,key:null,value:null})},M.prototype.get=function(f){var S=this._map[f];return S!==void 0?(this._unlinkNode(S),this._appendNode(S),S.value):null},M.prototype.peekValue=function(f){var S=this._map[f];return S!==void 0?S.value:null},M.prototype.peek=function(){var f=this._head;return f===null?null:f.value},M.prototype.set=function(f,S){var _=this._map[f];if(_!==void 0)_=this._map[f],this._unlinkNode(_),_.value=S;else if(this.size>=this.capacity)_=this._head,this._unlinkNode(_),delete this._map[_.key],_.key=f,_.value=S,this._map[f]=_;else{var p=this._nodePool;p.length>0?((_=p.pop()).key=f,_.value=S):_={prev:null,next:null,key:f,value:S},this._map[f]=_,this.size++}this._appendNode(_)},M}();L.LRUMap=k},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(S,_){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,c){p.__proto__=c}||function(p,c){for(var o in c)c.hasOwnProperty(o)&&(p[o]=c[o])})(S,_)},function(S,_){function p(){this.constructor=S}k(S,_),S.prototype=_===null?Object.create(_):(p.prototype=_.prototype,new p)});Object.defineProperty(L,"__esModule",{value:!0}),L.SelectionRenderLayer=void 0;var f=function(S){function _(p,c,o,u,s,l){var t=S.call(this,p,"selection",c,!0,o,u,s,l)||this;return t._clearState(),t}return M(_,S),_.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},_.prototype.resize=function(p){S.prototype.resize.call(this,p),this._clearState()},_.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},_.prototype.onSelectionChanged=function(p,c,o){if(this._didStateChange(p,c,o,this._bufferService.buffer.ydisp))if(this._clearAll(),p&&c){var u=p[1]-this._bufferService.buffer.ydisp,s=c[1]-this._bufferService.buffer.ydisp,l=Math.max(u,0),t=Math.min(s,this._bufferService.rows-1);if(!(l>=this._bufferService.rows||t<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,o){var a=p[0],i=c[0]-a,r=t-l+1;this._fillCells(a,l,i,r)}else{a=u===l?p[0]:0;var h=l===t?c[0]:this._bufferService.cols;this._fillCells(a,l,h-a,1);var d=Math.max(t-l-1,0);if(this._fillCells(0,l+1,this._bufferService.cols,d),l!==t){var y=s===t?c[0]:this._bufferService.cols;this._fillCells(0,t,y,1)}}this._state.start=[p[0],p[1]],this._state.end=[c[0],c[1]],this._state.columnSelectMode=o,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},_.prototype._didStateChange=function(p,c,o,u){return!this._areCoordinatesEqual(p,this._state.start)||!this._areCoordinatesEqual(c,this._state.end)||o!==this._state.columnSelectMode||u!==this._state.ydisp},_.prototype._areCoordinatesEqual=function(p,c){return!(!p||!c)&&p[0]===c[0]&&p[1]===c[1]},_}(D(13).BaseRenderLayer);L.SelectionRenderLayer=f},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(c,o){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,s){u.__proto__=s}||function(u,s){for(var l in s)s.hasOwnProperty(l)&&(u[l]=s[l])})(c,o)},function(c,o){function u(){this.constructor=c}k(c,o),c.prototype=o===null?Object.create(o):(u.prototype=o.prototype,new u)});Object.defineProperty(L,"__esModule",{value:!0}),L.CursorRenderLayer=void 0;var f=D(13),S=D(4),_=function(c){function o(u,s,l,t,a,i,r,h,d){var y=c.call(this,u,"cursor",s,!0,l,t,i,r)||this;return y._onRequestRedraw=a,y._coreService=h,y._coreBrowserService=d,y._cell=new S.CellData,y._state={x:0,y:0,isFocused:!1,style:"",width:0},y._cursorRenderers={bar:y._renderBarCursor.bind(y),block:y._renderBlockCursor.bind(y),underline:y._renderUnderlineCursor.bind(y)},y}return M(o,c),o.prototype.resize=function(u){c.prototype.resize.call(this,u),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},o.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},o.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},o.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},o.prototype.onOptionsChanged=function(){var u,s=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new p(this._coreBrowserService.isFocused,function(){s._render(!0)})):((u=this._cursorBlinkStateManager)===null||u===void 0||u.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},o.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},o.prototype.onGridChanged=function(u,s){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},o.prototype._render=function(u){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var s=this._bufferService.buffer.ybase+this._bufferService.buffer.y,l=s-this._bufferService.buffer.ydisp;if(l<0||l>=this._bufferService.rows)this._clearCursor();else{var t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(s).loadCell(t,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var a=this._optionsService.options.cursorStyle;return a&&a!=="block"?this._cursorRenderers[a](t,l,this._cell):this._renderBlurCursor(t,l,this._cell),this._ctx.restore(),this._state.x=t,this._state.y=l,this._state.isFocused=!1,this._state.style=a,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===t&&this._state.y===l&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](t,l,this._cell),this._ctx.restore(),this._state.x=t,this._state.y=l,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},o.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},o.prototype._renderBarCursor=function(u,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(u,s,this._optionsService.options.cursorWidth),this._ctx.restore()},o.prototype._renderBlockCursor=function(u,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(u,s,l.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(l,u,s),this._ctx.restore()},o.prototype._renderUnderlineCursor=function(u,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(u,s),this._ctx.restore()},o.prototype._renderBlurCursor=function(u,s,l){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(u,s,l.getWidth(),1),this._ctx.restore()},o}(f.BaseRenderLayer);L.CursorRenderLayer=_;var p=function(){function c(o,u){this._renderCallback=u,this.isCursorVisible=!0,o&&this._restartInterval()}return Object.defineProperty(c.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),c.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},c.prototype.restartBlinkAnimation=function(){var o=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){o._renderCallback(),o._animationFrame=void 0})))},c.prototype._restartInterval=function(o){var u=this;o===void 0&&(o=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(u._animationTimeRestarted){var s=600-(Date.now()-u._animationTimeRestarted);if(u._animationTimeRestarted=void 0,s>0)return void u._restartInterval(s)}u.isCursorVisible=!1,u._animationFrame=window.requestAnimationFrame(function(){u._renderCallback(),u._animationFrame=void 0}),u._blinkInterval=window.setInterval(function(){if(u._animationTimeRestarted){var l=600-(Date.now()-u._animationTimeRestarted);return u._animationTimeRestarted=void 0,void u._restartInterval(l)}u.isCursorVisible=!u.isCursorVisible,u._animationFrame=window.requestAnimationFrame(function(){u._renderCallback(),u._animationFrame=void 0})},600)},o)},c.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},c.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},c}()},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(c,o){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,s){u.__proto__=s}||function(u,s){for(var l in s)s.hasOwnProperty(l)&&(u[l]=s[l])})(c,o)},function(c,o){function u(){this.constructor=c}k(c,o),c.prototype=o===null?Object.create(o):(u.prototype=o.prototype,new u)});Object.defineProperty(L,"__esModule",{value:!0}),L.LinkRenderLayer=void 0;var f=D(13),S=D(9),_=D(26),p=function(c){function o(u,s,l,t,a,i,r,h){var d=c.call(this,u,"link",s,!0,l,t,r,h)||this;return a.onShowLinkUnderline(function(y){return d._onShowLinkUnderline(y)}),a.onHideLinkUnderline(function(y){return d._onHideLinkUnderline(y)}),i.onShowLinkUnderline(function(y){return d._onShowLinkUnderline(y)}),i.onHideLinkUnderline(function(y){return d._onHideLinkUnderline(y)}),d}return M(o,c),o.prototype.resize=function(u){c.prototype.resize.call(this,u),this._state=void 0},o.prototype.reset=function(){this._clearCurrentLink()},o.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var u=this._state.y2-this._state.y1-1;u>0&&this._clearCells(0,this._state.y1+1,this._state.cols,u),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},o.prototype._onShowLinkUnderline=function(u){if(u.fg===S.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:u.fg&&_.is256Color(u.fg)?this._ctx.fillStyle=this._colors.ansi[u.fg].css:this._ctx.fillStyle=this._colors.foreground.css,u.y1===u.y2)this._fillBottomLineAtCells(u.x1,u.y1,u.x2-u.x1);else{this._fillBottomLineAtCells(u.x1,u.y1,u.cols-u.x1);for(var s=u.y1+1;s<u.y2;s++)this._fillBottomLineAtCells(0,s,u.cols);this._fillBottomLineAtCells(0,u.y2,u.x2)}this._state=u},o.prototype._onHideLinkUnderline=function(u){this._clearCurrentLink()},o}(f.BaseRenderLayer);L.LinkRenderLayer=p},function(z,L,D){"use strict";var k=this&&this.__decorate||function(c,o,u,s){var l,t=arguments.length,a=t<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,u):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(c,o,u,s);else for(var i=c.length-1;i>=0;i--)(l=c[i])&&(a=(t<3?l(a):t>3?l(o,u,a):l(o,u))||a);return t>3&&a&&Object.defineProperty(o,u,a),a},M=this&&this.__param||function(c,o){return function(u,s){o(u,s,c)}};Object.defineProperty(L,"__esModule",{value:!0}),L.MouseZone=L.Linkifier=void 0;var f=D(0),S=D(1),_=function(){function c(o,u,s){this._bufferService=o,this._logService=u,this._unicodeService=s,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new f.EventEmitter,this._onHideLinkUnderline=new f.EventEmitter,this._onLinkTooltip=new f.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(c.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),c.prototype.attachToDom=function(o,u){this._element=o,this._mouseZoneManager=u},c.prototype.linkifyRows=function(o,u){var s=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=o,this._rowsToLinkify.end=u):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,o),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,u)),this._mouseZoneManager.clearAll(o,u),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return s._linkifyRows()},c._timeBeforeLatency))},c.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var o=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var u=o.ydisp+this._rowsToLinkify.start;if(!(u>=o.lines.length)){for(var s=o.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,l=Math.ceil(2e3/this._bufferService.cols),t=this._bufferService.buffer.iterator(!1,u,s,l,l);t.hasNext();)for(var a=t.next(),i=0;i<this._linkMatchers.length;i++)this._doLinkifyRow(a.range.first,a.content,this._linkMatchers[i]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},c.prototype.registerLinkMatcher=function(o,u,s){if(s===void 0&&(s={}),!u)throw new Error("handler must be defined");var l={id:this._nextLinkMatcherId++,regex:o,handler:u,matchIndex:s.matchIndex,validationCallback:s.validationCallback,hoverTooltipCallback:s.tooltipCallback,hoverLeaveCallback:s.leaveCallback,willLinkActivate:s.willLinkActivate,priority:s.priority||0};return this._addLinkMatcherToList(l),l.id},c.prototype._addLinkMatcherToList=function(o){if(this._linkMatchers.length!==0){for(var u=this._linkMatchers.length-1;u>=0;u--)if(o.priority<=this._linkMatchers[u].priority)return void this._linkMatchers.splice(u+1,0,o);this._linkMatchers.splice(0,0,o)}else this._linkMatchers.push(o)},c.prototype.deregisterLinkMatcher=function(o){for(var u=0;u<this._linkMatchers.length;u++)if(this._linkMatchers[u].id===o)return this._linkMatchers.splice(u,1),!0;return!1},c.prototype._doLinkifyRow=function(o,u,s){for(var l,t=this,a=new RegExp(s.regex.source,(s.regex.flags||"")+"g"),i=-1,r=function(){var d=l[typeof s.matchIndex!="number"?0:s.matchIndex];if(!d)return h._logService.debug("match found without corresponding matchIndex",l,s),"break";if(i=u.indexOf(d,i+1),a.lastIndex=i+d.length,i<0)return"break";var y=h._bufferService.buffer.stringIndexToBufferIndex(o,i);if(y[0]<0)return"break";var m=h._bufferService.buffer.lines.get(y[0]);if(!m)return"break";var C=m.getFg(y[1]),T=C?C>>9&511:void 0;s.validationCallback?s.validationCallback(d,function(x){t._rowsTimeoutId||x&&t._addLink(y[1],y[0]-t._bufferService.buffer.ydisp,d,s,T)}):h._addLink(y[1],y[0]-h._bufferService.buffer.ydisp,d,s,T)},h=this;(l=a.exec(u))!==null&&!(r()==="break"););},c.prototype._addLink=function(o,u,s,l,t){var a=this;if(this._mouseZoneManager&&this._element){var i=this._unicodeService.getStringCellWidth(s),r=o%this._bufferService.cols,h=u+Math.floor(o/this._bufferService.cols),d=(r+i)%this._bufferService.cols,y=h+Math.floor((r+i)/this._bufferService.cols);d===0&&(d=this._bufferService.cols,y--),this._mouseZoneManager.add(new p(r+1,h+1,d+1,y+1,function(m){if(l.handler)return l.handler(m,s);var C=window.open();C?(C.opener=null,C.location.href=s):console.warn("Opening link blocked as opener could not be cleared")},function(){a._onShowLinkUnderline.fire(a._createLinkHoverEvent(r,h,d,y,t)),a._element.classList.add("xterm-cursor-pointer")},function(m){a._onLinkTooltip.fire(a._createLinkHoverEvent(r,h,d,y,t)),l.hoverTooltipCallback&&l.hoverTooltipCallback(m,s,{start:{x:r,y:h},end:{x:d,y}})},function(){a._onHideLinkUnderline.fire(a._createLinkHoverEvent(r,h,d,y,t)),a._element.classList.remove("xterm-cursor-pointer"),l.hoverLeaveCallback&&l.hoverLeaveCallback()},function(m){return!l.willLinkActivate||l.willLinkActivate(m,s)}))}},c.prototype._createLinkHoverEvent=function(o,u,s,l,t){return{x1:o,y1:u,x2:s,y2:l,cols:this._bufferService.cols,fg:t}},c._timeBeforeLatency=200,c=k([M(0,S.IBufferService),M(1,S.ILogService),M(2,S.IUnicodeService)],c)}();L.Linkifier=_;var p=function(c,o,u,s,l,t,a,i,r){this.x1=c,this.y1=o,this.x2=u,this.y2=s,this.clickCallback=l,this.hoverCallback=t,this.tooltipCallback=a,this.leaveCallback=i,this.willLinkActivate=r};L.MouseZone=p},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(d,y){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,C){m.__proto__=C}||function(m,C){for(var T in C)C.hasOwnProperty(T)&&(m[T]=C[T])})(d,y)},function(d,y){function m(){this.constructor=d}k(d,y),d.prototype=y===null?Object.create(y):(m.prototype=y.prototype,new m)}),f=this&&this.__decorate||function(d,y,m,C){var T,x=arguments.length,E=x<3?y:C===null?C=Object.getOwnPropertyDescriptor(y,m):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,y,m,C);else for(var w=d.length-1;w>=0;w--)(T=d[w])&&(E=(x<3?T(E):x>3?T(y,m,E):T(y,m))||E);return x>3&&E&&Object.defineProperty(y,m,E),E},S=this&&this.__param||function(d,y){return function(m,C){y(m,C,d)}};Object.defineProperty(L,"__esModule",{value:!0}),L.SelectionService=void 0;var _=D(11),p=D(52),c=D(4),o=D(0),u=D(5),s=D(1),l=D(30),t=D(53),a=D(2),i=String.fromCharCode(160),r=new RegExp(i,"g"),h=function(d){function y(m,C,T,x,E,w,A){var g=d.call(this)||this;return g._element=m,g._screenElement=C,g._bufferService=T,g._coreService=x,g._mouseService=E,g._optionsService=w,g._renderService=A,g._dragScrollAmount=0,g._enabled=!0,g._workCell=new c.CellData,g._mouseDownTimeStamp=0,g._onLinuxMouseSelection=g.register(new o.EventEmitter),g._onRedrawRequest=g.register(new o.EventEmitter),g._onSelectionChange=g.register(new o.EventEmitter),g._onRequestScrollLines=g.register(new o.EventEmitter),g._mouseMoveListener=function(P){return g._onMouseMove(P)},g._mouseUpListener=function(P){return g._onMouseUp(P)},g._coreService.onUserInput(function(){g.hasSelection&&g.clearSelection()}),g._trimListener=g._bufferService.buffer.lines.onTrim(function(P){return g._onTrim(P)}),g.register(g._bufferService.buffers.onBufferActivate(function(P){return g._onBufferActivate(P)})),g.enable(),g._model=new p.SelectionModel(g._bufferService),g._activeSelectionMode=0,g}return M(y,d),Object.defineProperty(y.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),y.prototype.dispose=function(){this._removeMouseDownListeners()},y.prototype.reset=function(){this.clearSelection()},y.prototype.disable=function(){this.clearSelection(),this._enabled=!1},y.prototype.enable=function(){this._enabled=!0},Object.defineProperty(y.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasSelection",{get:function(){var m=this._model.finalSelectionStart,C=this._model.finalSelectionEnd;return!(!m||!C)&&(m[0]!==C[0]||m[1]!==C[1])},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectionText",{get:function(){var m=this._model.finalSelectionStart,C=this._model.finalSelectionEnd;if(!m||!C)return"";var T=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(m[0]===C[0])return"";for(var E=m[1];E<=C[1];E++){var w=T.translateBufferLineToString(E,!0,m[0],C[0]);x.push(w)}}else{var A=m[1]===C[1]?C[0]:void 0;for(x.push(T.translateBufferLineToString(m[1],!0,m[0],A)),E=m[1]+1;E<=C[1]-1;E++){var g=T.lines.get(E);w=T.translateBufferLineToString(E,!0),g&&g.isWrapped?x[x.length-1]+=w:x.push(w)}m[1]!==C[1]&&(g=T.lines.get(C[1]),w=T.translateBufferLineToString(C[1],!0,0,C[0]),g&&g.isWrapped?x[x.length-1]+=w:x.push(w))}return x.map(function(P){return P.replace(r," ")}).join(_.isWindows?`\r
`:`
`)},enumerable:!1,configurable:!0}),y.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},y.prototype.refresh=function(m){var C=this;(this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return C._refresh()})),_.isLinux&&m)&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},y.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},y.prototype.isClickInSelection=function(m){var C=this._getMouseBufferCoords(m),T=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(T&&x&&C)&&this._areCoordsInSelection(C,T,x)},y.prototype._areCoordsInSelection=function(m,C,T){return m[1]>C[1]&&m[1]<T[1]||C[1]===T[1]&&m[1]===C[1]&&m[0]>=C[0]&&m[0]<T[0]||C[1]<T[1]&&m[1]===T[1]&&m[0]<T[0]||C[1]<T[1]&&m[1]===C[1]&&m[0]>=C[0]},y.prototype.selectWordAtCursor=function(m){var C=this._getMouseBufferCoords(m);C&&(this._selectWordAt(C,!1),this._model.selectionEnd=void 0,this.refresh(!0))},y.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},y.prototype.selectLines=function(m,C){this._model.clearSelection(),m=Math.max(m,0),C=Math.min(C,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,C],this.refresh(),this._onSelectionChange.fire()},y.prototype._onTrim=function(m){this._model.onTrim(m)&&this.refresh()},y.prototype._getMouseBufferCoords=function(m){var C=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(C)return C[0]--,C[1]--,C[1]+=this._bufferService.buffer.ydisp,C},y.prototype._getMouseEventScrollAmount=function(m){var C=l.getCoordsRelativeToElement(m,this._screenElement)[1],T=this._renderService.dimensions.canvasHeight;return C>=0&&C<=T?0:(C>T&&(C-=T),C=Math.min(Math.max(C,-50),50),(C/=50)/Math.abs(C)+Math.round(14*C))},y.prototype.shouldForceSelection=function(m){return _.isMac?m.altKey&&this._optionsService.options.macOptionClickForcesSelection:m.shiftKey},y.prototype.onMouseDown=function(m){if(this._mouseDownTimeStamp=m.timeStamp,(m.button!==2||!this.hasSelection)&&m.button===0){if(!this._enabled){if(!this.shouldForceSelection(m))return;m.stopPropagation()}m.preventDefault(),this._dragScrollAmount=0,this._enabled&&m.shiftKey?this._onIncrementalClick(m):m.detail===1?this._onSingleClick(m):m.detail===2?this._onDoubleClick(m):m.detail===3&&this._onTripleClick(m),this._addMouseDownListeners(),this.refresh(!0)}},y.prototype._addMouseDownListeners=function(){var m=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return m._dragScroll()},50)},y.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},y.prototype._onIncrementalClick=function(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))},y.prototype._onSingleClick=function(m){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(m)?3:0,this._model.selectionStart=this._getMouseBufferCoords(m),this._model.selectionStart){this._model.selectionEnd=void 0;var C=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);C&&C.length!==this._model.selectionStart[0]&&C.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},y.prototype._onDoubleClick=function(m){var C=this._getMouseBufferCoords(m);C&&(this._activeSelectionMode=1,this._selectWordAt(C,!0))},y.prototype._onTripleClick=function(m){var C=this._getMouseBufferCoords(m);C&&(this._activeSelectionMode=2,this._selectLineAt(C[1]))},y.prototype.shouldColumnSelect=function(m){return m.altKey&&!(_.isMac&&this._optionsService.options.macOptionClickForcesSelection)},y.prototype._onMouseMove=function(m){if(m.stopImmediatePropagation(),this._model.selectionStart){var C=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(m),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(m),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){var x=T.lines.get(this._model.selectionEnd[1]);x&&x.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}C&&C[0]===this._model.selectionEnd[0]&&C[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},y.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});var m=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(m.ydisp+this._bufferService.rows,m.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=m.ydisp),this.refresh()}},y.prototype._onMouseUp=function(m){var C=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&C<500&&m.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var T=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){var x=t.moveToCellSequence(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},y.prototype._onBufferActivate=function(m){var C=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim(function(T){return C._onTrim(T)})},y.prototype._convertViewportColToCharacterIndex=function(m,C){for(var T=C[0],x=0;C[0]>=x;x++){var E=m.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:E>1&&C[0]!==x&&(T+=E-1)}return T},y.prototype.setSelection=function(m,C,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,C],this._model.selectionStartLength=T,this.refresh()},y.prototype._getWordAt=function(m,C,T,x){if(T===void 0&&(T=!0),x===void 0&&(x=!0),!(m[0]>=this._bufferService.cols)){var E=this._bufferService.buffer,w=E.lines.get(m[1]);if(w){var A=E.translateBufferLineToString(m[1],!1),g=this._convertViewportColToCharacterIndex(w,m),P=g,O=m[0]-g,F=0,X=0,W=0,N=0;if(A.charAt(g)===" "){for(;g>0&&A.charAt(g-1)===" ";)g--;for(;P<A.length&&A.charAt(P+1)===" ";)P++}else{var G=m[0],U=m[0];w.getWidth(G)===0&&(F++,G--),w.getWidth(U)===2&&(X++,U++);var H=w.getString(U).length;for(H>1&&(N+=H-1,P+=H-1);G>0&&g>0&&!this._isCharWordSeparator(w.loadCell(G-1,this._workCell));){w.loadCell(G-1,this._workCell);var V=this._workCell.getChars().length;this._workCell.getWidth()===0?(F++,G--):V>1&&(W+=V-1,g-=V-1),g--,G--}for(;U<w.length&&P+1<A.length&&!this._isCharWordSeparator(w.loadCell(U+1,this._workCell));){w.loadCell(U+1,this._workCell);var ce=this._workCell.getChars().length;this._workCell.getWidth()===2?(X++,U++):ce>1&&(N+=ce-1,P+=ce-1),P++,U++}}P++;var ye=g+O-F+W,Le=Math.min(this._bufferService.cols,P-g+F+X-W-N);if(C||A.slice(g,P).trim()!==""){if(T&&ye===0&&w.getCodePoint(0)!==32){var Ze=E.lines.get(m[1]-1);if(Ze&&w.isWrapped&&Ze.getCodePoint(this._bufferService.cols-1)!==32){var Ye=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Ye){var Oe=this._bufferService.cols-Ye.start;ye-=Oe,Le+=Oe}}}if(x&&ye+Le===this._bufferService.cols&&w.getCodePoint(this._bufferService.cols-1)!==32){var We=E.lines.get(m[1]+1);if(We&&We.isWrapped&&We.getCodePoint(0)!==32){var ze=this._getWordAt([0,m[1]+1],!1,!1,!0);ze&&(Le+=ze.length)}}return{start:ye,length:Le}}}}},y.prototype._selectWordAt=function(m,C){var T=this._getWordAt(m,C);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[T.start,m[1]],this._model.selectionStartLength=T.length}},y.prototype._selectToWordAt=function(m){var C=this._getWordAt(m,!0);if(C){for(var T=m[1];C.start<0;)C.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;C.start+C.length>this._bufferService.cols;)C.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?C.start:C.start+C.length,T]}},y.prototype._isCharWordSeparator=function(m){return m.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(m.getChars())>=0},y.prototype._selectLineAt=function(m){var C=this._bufferService.buffer.getWrappedRangeForLine(m);this._model.selectionStart=[0,C.first],this._model.selectionEnd=[this._bufferService.cols,C.last],this._model.selectionStartLength=0},y=f([S(2,s.IBufferService),S(3,s.ICoreService),S(4,u.IMouseService),S(5,s.IOptionsService),S(6,u.IRenderService)],y)}(a.Disposable);L.SelectionService=h},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.SelectionModel=void 0;var k=function(){function M(f){this._bufferService=f,this.isSelectAllActive=!1,this.selectionStartLength=0}return M.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(M.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(M.prototype,"finalSelectionEnd",{get:function(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){var f=this.selectionStart[0]+this.selectionStartLength;return f>this._bufferService.cols?[f%this._bufferService.cols,this.selectionStart[1]+Math.floor(f/this._bufferService.cols)]:[f,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),M.prototype.areSelectionValuesReversed=function(){var f=this.selectionStart,S=this.selectionEnd;return!(!f||!S)&&(f[1]>S[1]||f[1]===S[1]&&f[0]>S[0])},M.prototype.onTrim=function(f){return this.selectionStart&&(this.selectionStart[1]-=f),this.selectionEnd&&(this.selectionEnd[1]-=f),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},M}();L.SelectionModel=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.moveToCellSequence=void 0;var k=D(12);function M(o,u,s,l){var t=o-f(s,o),a=u-f(s,u);return c(Math.abs(t-a)-function(i,r,h){for(var d=0,y=i-f(h,i),m=r-f(h,r),C=0;C<Math.abs(y-m);C++){var T=S(i,r)==="A"?-1:1,x=h.buffer.lines.get(y+T*C);x&&x.isWrapped&&d++}return d}(o,u,s),p(S(o,u),l))}function f(o,u){for(var s=0,l=o.buffer.lines.get(u),t=l&&l.isWrapped;t&&u>=0&&u<o.rows;)s++,t=(l=o.buffer.lines.get(--u))&&l.isWrapped;return s}function S(o,u){return o>u?"A":"B"}function _(o,u,s,l,t,a){for(var i=o,r=u,h="";i!==s||r!==l;)i+=t?1:-1,t&&i>a.cols-1?(h+=a.buffer.translateBufferLineToString(r,!1,o,i),i=0,o=0,r++):!t&&i<0&&(h+=a.buffer.translateBufferLineToString(r,!1,0,o+1),o=i=a.cols-1,r--);return h+a.buffer.translateBufferLineToString(r,!1,o,i)}function p(o,u){var s=u?"O":"[";return k.C0.ESC+s+o}function c(o,u){o=Math.floor(o);for(var s="",l=0;l<o;l++)s+=u;return s}L.moveToCellSequence=function(o,u,s,l){var t,a=s.buffer.x,i=s.buffer.y;if(!s.buffer.hasScrollback)return function(h,d,y,m,C,T){return M(d,m,C,T).length===0?"":c(_(h,d,h,d-f(C,d),!1,C).length,p("D",T))}(a,i,0,u,s,l)+M(i,u,s,l)+function(h,d,y,m,C,T){var x;x=M(d,m,C,T).length>0?m-f(C,m):d;var E=m,w=function(A,g,P,O,F,X){var W;return W=M(P,O,F,X).length>0?O-f(F,O):g,A<P&&W<=O||A>=P&&W<O?"C":"D"}(h,d,y,m,C,T);return c(_(h,x,y,E,w==="C",C).length,p(w,T))}(a,i,o,u,s,l);if(i===u)return t=a>o?"D":"C",c(Math.abs(a-o),p(t,l));t=i>u?"D":"C";var r=Math.abs(i-u);return c(function(h,d){return d.cols-h}(i>u?o:a,s)+(r-1)*s.cols+1+((i>u?a:o)-1),p(t,l))}},function(z,L,D){"use strict";var k=this&&this.__decorate||function(_,p,c,o){var u,s=arguments.length,l=s<3?p:o===null?o=Object.getOwnPropertyDescriptor(p,c):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,p,c,o);else for(var t=_.length-1;t>=0;t--)(u=_[t])&&(l=(s<3?u(l):s>3?u(p,c,l):u(p,c))||l);return s>3&&l&&Object.defineProperty(p,c,l),l},M=this&&this.__param||function(_,p){return function(c,o){p(c,o,_)}};Object.defineProperty(L,"__esModule",{value:!0}),L.SoundService=void 0;var f=D(1),S=function(){function _(p){this._optionsService=p}return Object.defineProperty(_,"audioContext",{get:function(){if(!_._audioContext){var p=window.AudioContext||window.webkitAudioContext;if(!p)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;_._audioContext=new p}return _._audioContext},enumerable:!1,configurable:!0}),_.prototype.playBellSound=function(){var p=_.audioContext;if(p){var c=p.createBufferSource();p.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(o){c.buffer=o,c.connect(p.destination),c.start(0)})}},_.prototype._base64ToArrayBuffer=function(p){for(var c=window.atob(p),o=c.length,u=new Uint8Array(o),s=0;s<o;s++)u[s]=c.charCodeAt(s);return u.buffer},_.prototype._removeMimeType=function(p){return p.split(",")[1]},_=k([M(0,f.IOptionsService)],_)}();L.SoundService=S},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)}),f=this&&this.__decorate||function(s,l,t,a){var i,r=arguments.length,h=r<3?l:a===null?a=Object.getOwnPropertyDescriptor(l,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,t,a);else for(var d=s.length-1;d>=0;d--)(i=s[d])&&(h=(r<3?i(h):r>3?i(l,t,h):i(l,t))||h);return r>3&&h&&Object.defineProperty(l,t,h),h},S=this&&this.__param||function(s,l){return function(t,a){l(t,a,s)}};Object.defineProperty(L,"__esModule",{value:!0}),L.MouseZoneManager=void 0;var _=D(2),p=D(7),c=D(5),o=D(1),u=function(s){function l(t,a,i,r,h,d){var y=s.call(this)||this;return y._element=t,y._screenElement=a,y._bufferService=i,y._mouseService=r,y._selectionService=h,y._optionsService=d,y._zones=[],y._areZonesActive=!1,y._lastHoverCoords=[void 0,void 0],y._initialSelectionLength=0,y.register(p.addDisposableDomListener(y._element,"mousedown",function(m){return y._onMouseDown(m)})),y._mouseMoveListener=function(m){return y._onMouseMove(m)},y._mouseLeaveListener=function(m){return y._onMouseLeave(m)},y._clickListener=function(m){return y._onClick(m)},y}return M(l,s),l.prototype.dispose=function(){s.prototype.dispose.call(this),this._deactivate()},l.prototype.add=function(t){this._zones.push(t),this._zones.length===1&&this._activate()},l.prototype.clearAll=function(t,a){if(this._zones.length!==0){t&&a||(t=0,a=this._bufferService.rows-1);for(var i=0;i<this._zones.length;i++){var r=this._zones[i];(r.y1>t&&r.y1<=a+1||r.y2>t&&r.y2<=a+1||r.y1<t&&r.y2>a+1)&&(this._currentZone&&this._currentZone===r&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(i--,1))}this._zones.length===0&&this._deactivate()}},l.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},l.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},l.prototype._onMouseMove=function(t){this._lastHoverCoords[0]===t.pageX&&this._lastHoverCoords[1]===t.pageY||(this._onHover(t),this._lastHoverCoords=[t.pageX,t.pageY])},l.prototype._onHover=function(t){var a=this,i=this._findZoneEventAt(t);i!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),i&&(this._currentZone=i,i.hoverCallback&&i.hoverCallback(t),this._tooltipTimeout=window.setTimeout(function(){return a._onTooltip(t)},this._optionsService.options.linkTooltipHoverDuration)))},l.prototype._onTooltip=function(t){this._tooltipTimeout=void 0;var a=this._findZoneEventAt(t);a&&a.tooltipCallback&&a.tooltipCallback(t)},l.prototype._onMouseDown=function(t){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var a=this._findZoneEventAt(t);(a==null?void 0:a.willLinkActivate(t))&&(t.preventDefault(),t.stopImmediatePropagation())}},l.prototype._onMouseLeave=function(t){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},l.prototype._onClick=function(t){var a=this._findZoneEventAt(t),i=this._getSelectionLength();a&&i===this._initialSelectionLength&&(a.clickCallback(t),t.preventDefault(),t.stopImmediatePropagation())},l.prototype._getSelectionLength=function(){var t=this._selectionService.selectionText;return t?t.length:0},l.prototype._findZoneEventAt=function(t){var a=this._mouseService.getCoords(t,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(a)for(var i=a[0],r=a[1],h=0;h<this._zones.length;h++){var d=this._zones[h];if(d.y1===d.y2){if(r===d.y1&&i>=d.x1&&i<d.x2)return d}else if(r===d.y1&&i>=d.x1||r===d.y2&&i<d.x2||r>d.y1&&r<d.y2)return d}},l=f([S(2,o.IBufferService),S(3,c.IMouseService),S(4,c.ISelectionService),S(5,o.IOptionsService)],l)}(_.Disposable);L.MouseZoneManager=u},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(l,t){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var r in i)i.hasOwnProperty(r)&&(a[r]=i[r])})(l,t)},function(l,t){function a(){this.constructor=l}k(l,t),l.prototype=t===null?Object.create(t):(a.prototype=t.prototype,new a)});Object.defineProperty(L,"__esModule",{value:!0}),L.AccessibilityManager=void 0;var f=D(18),S=D(11),_=D(31),p=D(7),c=D(2),o=D(32),u=D(17),s=function(l){function t(a,i){var r=l.call(this)||this;r._terminal=a,r._renderService=i,r._liveRegionLineCount=0,r._charsToConsume=[],r._charsToAnnounce="",r._accessibilityTreeRoot=document.createElement("div"),r._accessibilityTreeRoot.classList.add("xterm-accessibility"),r._rowContainer=document.createElement("div"),r._rowContainer.classList.add("xterm-accessibility-tree"),r._rowContainer.setAttribute("role","list"),r._rowElements=[];for(var h=0;h<r._terminal.rows;h++)r._rowElements[h]=r._createAccessibilityTreeNode(),r._rowContainer.appendChild(r._rowElements[h]);if(r._topBoundaryFocusListener=function(d){return r._onBoundaryFocus(d,0)},r._bottomBoundaryFocusListener=function(d){return r._onBoundaryFocus(d,1)},r._rowElements[0].addEventListener("focus",r._topBoundaryFocusListener),r._rowElements[r._rowElements.length-1].addEventListener("focus",r._bottomBoundaryFocusListener),r._refreshRowsDimensions(),r._accessibilityTreeRoot.appendChild(r._rowContainer),r._renderRowsDebouncer=new _.RenderDebouncer(r._renderRows.bind(r)),r._refreshRows(),r._liveRegion=document.createElement("div"),r._liveRegion.classList.add("live-region"),r._liveRegion.setAttribute("aria-live","assertive"),r._accessibilityTreeRoot.appendChild(r._liveRegion),!r._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return r._terminal.element.insertAdjacentElement("afterbegin",r._accessibilityTreeRoot),r.register(r._renderRowsDebouncer),r.register(r._terminal.onResize(function(d){return r._onResize(d.rows)})),r.register(r._terminal.onRender(function(d){return r._refreshRows(d.start,d.end)})),r.register(r._terminal.onScroll(function(){return r._refreshRows()})),r.register(r._terminal.onA11yChar(function(d){return r._onChar(d)})),r.register(r._terminal.onLineFeed(function(){return r._onChar(`
`)})),r.register(r._terminal.onA11yTab(function(d){return r._onTab(d)})),r.register(r._terminal.onKey(function(d){return r._onKey(d.key)})),r.register(r._terminal.onBlur(function(){return r._clearLiveRegion()})),r.register(r._renderService.onDimensionsChange(function(){return r._refreshRowsDimensions()})),r._screenDprMonitor=new o.ScreenDprMonitor,r.register(r._screenDprMonitor),r._screenDprMonitor.setListener(function(){return r._refreshRowsDimensions()}),r.register(p.addDisposableDomListener(window,"resize",function(){return r._refreshRowsDimensions()})),r}return M(t,l),t.prototype.dispose=function(){l.prototype.dispose.call(this),u.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},t.prototype._onBoundaryFocus=function(a,i){var r=a.target,h=this._rowElements[i===0?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")!==(i===0?"1":""+this._terminal.buffer.lines.length)&&a.relatedTarget===h){var d,y;if(i===0?(d=r,y=this._rowElements.pop(),this._rowContainer.removeChild(y)):(d=this._rowElements.shift(),y=r,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),y.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){var m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else m=this._createAccessibilityTreeNode(),this._rowElements.push(m),this._rowContainer.appendChild(m);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),a.preventDefault(),a.stopImmediatePropagation()}},t.prototype._onResize=function(a){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>a;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var a=document.createElement("div");return a.setAttribute("role","listitem"),a.tabIndex=-1,this._refreshRowDimensions(a),a},t.prototype._onTab=function(a){for(var i=0;i<a;i++)this._onChar(" ")},t.prototype._onChar=function(a){var i=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==a&&(this._charsToAnnounce+=a):this._charsToAnnounce+=a,a===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)),S.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){i._accessibilityTreeRoot.appendChild(i._liveRegion)},0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,S.isMac&&u.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(a){this._clearLiveRegion(),this._charsToConsume.push(a)},t.prototype._refreshRows=function(a,i){this._renderRowsDebouncer.refresh(a,i,this._terminal.rows)},t.prototype._renderRows=function(a,i){for(var r=this._terminal.buffer,h=r.lines.length.toString(),d=a;d<=i;d++){var y=r.translateBufferLineToString(r.ydisp+d,!0),m=(r.ydisp+d+1).toString(),C=this._rowElements[d];C&&(y.length===0?C.innerHTML="&nbsp;":C.textContent=y,C.setAttribute("aria-posinset",m),C.setAttribute("aria-setsize",h))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var a=0;a<this._terminal.rows;a++)this._refreshRowDimensions(this._rowElements[a])}},t.prototype._refreshRowDimensions=function(a){a.style.height=this._renderService.dimensions.actualCellHeight+"px"},t.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},t}(c.Disposable);L.AccessibilityManager=s},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(r,h){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var m in y)y.hasOwnProperty(m)&&(d[m]=y[m])})(r,h)},function(r,h){function d(){this.constructor=r}k(r,h),r.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}),f=this&&this.__decorate||function(r,h,d,y){var m,C=arguments.length,T=C<3?h:y===null?y=Object.getOwnPropertyDescriptor(h,d):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(r,h,d,y);else for(var x=r.length-1;x>=0;x--)(m=r[x])&&(T=(C<3?m(T):C>3?m(h,d,T):m(h,d))||T);return C>3&&T&&Object.defineProperty(h,d,T),T},S=this&&this.__param||function(r,h){return function(d,y){h(d,y,r)}};Object.defineProperty(L,"__esModule",{value:!0}),L.DomRenderer=void 0;var _=D(58),p=D(9),c=D(2),o=D(5),u=D(1),s=D(0),l=D(10),t=D(17),a=1,i=function(r){function h(d,y,m,C,T,x,E,w,A){var g=r.call(this)||this;return g._colors=d,g._element=y,g._screenElement=m,g._viewportElement=C,g._linkifier=T,g._linkifier2=x,g._charSizeService=E,g._optionsService=w,g._bufferService=A,g._terminalClass=a++,g._rowElements=[],g._rowContainer=document.createElement("div"),g._rowContainer.classList.add("xterm-rows"),g._rowContainer.style.lineHeight="normal",g._rowContainer.setAttribute("aria-hidden","true"),g._refreshRowElements(g._bufferService.cols,g._bufferService.rows),g._selectionContainer=document.createElement("div"),g._selectionContainer.classList.add("xterm-selection"),g._selectionContainer.setAttribute("aria-hidden","true"),g.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},g._updateDimensions(),g._injectCss(),g._rowFactory=new _.DomRendererRowFactory(document,g._optionsService,g._colors),g._element.classList.add("xterm-dom-renderer-owner-"+g._terminalClass),g._screenElement.appendChild(g._rowContainer),g._screenElement.appendChild(g._selectionContainer),g._linkifier.onShowLinkUnderline(function(P){return g._onLinkHover(P)}),g._linkifier.onHideLinkUnderline(function(P){return g._onLinkLeave(P)}),g._linkifier2.onShowLinkUnderline(function(P){return g._onLinkHover(P)}),g._linkifier2.onHideLinkUnderline(function(P){return g._onLinkLeave(P)}),g}return M(h,r),Object.defineProperty(h.prototype,"onRequestRedraw",{get:function(){return new s.EventEmitter().event},enumerable:!1,configurable:!0}),h.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),t.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),r.prototype.dispose.call(this)},h.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var d=0,y=this._rowElements;d<y.length;d++){var m=y[d];m.style.width=this.dimensions.canvasWidth+"px",m.style.height=this.dimensions.actualCellHeight+"px",m.style.lineHeight=this.dimensions.actualCellHeight+"px",m.style.overflow="hidden"}this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var C=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=C,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},h.prototype.setColors=function(d){this._colors=d,this._injectCss()},h.prototype._injectCss=function(){var d=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var y=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";y+=this._terminalSelector+" span:not(."+_.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+_.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+_.ITALIC_CLASS+" { font-style: italic;}",y+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",y+="@keyframes blink_block_"+this._terminalClass+" { 0% { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+"; } 50% { background-color: "+this._colors.cursorAccent.css+"; color: "+this._colors.cursor.css+"; }}",y+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+":not(."+_.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_BLINK_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+_.CURSOR_CLASS+"."+_.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",y+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selectionTransparent.css+";}",this._colors.ansi.forEach(function(m,C){y+=d._terminalSelector+" .xterm-fg-"+C+" { color: "+m.css+"; }"+d._terminalSelector+" .xterm-bg-"+C+" { background-color: "+m.css+"; }"}),y+=this._terminalSelector+" .xterm-fg-"+p.INVERTED_DEFAULT_COLOR+" { color: "+l.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+p.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=y},h.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},h.prototype._refreshRowElements=function(d,y){for(var m=this._rowElements.length;m<=y;m++){var C=document.createElement("div");this._rowContainer.appendChild(C),this._rowElements.push(C)}for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop())},h.prototype.onResize=function(d,y){this._refreshRowElements(d,y),this._updateDimensions()},h.prototype.onCharSizeChanged=function(){this._updateDimensions()},h.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},h.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},h.prototype.onSelectionChanged=function(d,y,m){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(d&&y){var C=d[1]-this._bufferService.buffer.ydisp,T=y[1]-this._bufferService.buffer.ydisp,x=Math.max(C,0),E=Math.min(T,this._bufferService.rows-1);if(!(x>=this._bufferService.rows||E<0)){var w=document.createDocumentFragment();if(m)w.appendChild(this._createSelectionElement(x,d[0],y[0],E-x+1));else{var A=C===x?d[0]:0,g=x===E?y[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(x,A,g));var P=E-x-1;if(w.appendChild(this._createSelectionElement(x+1,0,this._bufferService.cols,P)),x!==E){var O=T===E?y[0]:this._bufferService.cols;w.appendChild(this._createSelectionElement(E,0,O))}}this._selectionContainer.appendChild(w)}}},h.prototype._createSelectionElement=function(d,y,m,C){C===void 0&&(C=1);var T=document.createElement("div");return T.style.height=C*this.dimensions.actualCellHeight+"px",T.style.top=d*this.dimensions.actualCellHeight+"px",T.style.left=y*this.dimensions.actualCellWidth+"px",T.style.width=this.dimensions.actualCellWidth*(m-y)+"px",T},h.prototype.onCursorMove=function(){},h.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},h.prototype.clear=function(){for(var d=0,y=this._rowElements;d<y.length;d++)y[d].innerHTML=""},h.prototype.renderRows=function(d,y){for(var m=this._bufferService.buffer.ybase+this._bufferService.buffer.y,C=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),T=this._optionsService.options.cursorBlink,x=d;x<=y;x++){var E=this._rowElements[x];E.innerHTML="";var w=x+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.lines.get(w),g=this._optionsService.options.cursorStyle;E.appendChild(this._rowFactory.createRow(A,w===m,g,C,T,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(h.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!1,configurable:!0}),h.prototype.registerCharacterJoiner=function(d){return-1},h.prototype.deregisterCharacterJoiner=function(d){return!1},h.prototype._onLinkHover=function(d){this._setCellUnderline(d.x1,d.x2,d.y1,d.y2,d.cols,!0)},h.prototype._onLinkLeave=function(d){this._setCellUnderline(d.x1,d.x2,d.y1,d.y2,d.cols,!1)},h.prototype._setCellUnderline=function(d,y,m,C,T,x){for(;d!==y||m!==C;){var E=this._rowElements[m];if(!E)return;var w=E.children[d];w&&(w.style.textDecoration=x?"underline":"none"),++d>=T&&(d=0,m++)}},h=f([S(6,o.ICharSizeService),S(7,u.IOptionsService),S(8,u.IBufferService)],h)}(c.Disposable);L.DomRenderer=i},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.DomRendererRowFactory=L.CURSOR_STYLE_UNDERLINE_CLASS=L.CURSOR_STYLE_BAR_CLASS=L.CURSOR_STYLE_BLOCK_CLASS=L.CURSOR_BLINK_CLASS=L.CURSOR_CLASS=L.UNDERLINE_CLASS=L.ITALIC_CLASS=L.DIM_CLASS=L.BOLD_CLASS=void 0;var k=D(9),M=D(3),f=D(4),S=D(10);L.BOLD_CLASS="xterm-bold",L.DIM_CLASS="xterm-dim",L.ITALIC_CLASS="xterm-italic",L.UNDERLINE_CLASS="xterm-underline",L.CURSOR_CLASS="xterm-cursor",L.CURSOR_BLINK_CLASS="xterm-cursor-blink",L.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",L.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",L.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var _=function(){function c(o,u,s){this._document=o,this._optionsService=u,this._colors=s,this._workCell=new f.CellData}return c.prototype.setColors=function(o){this._colors=o},c.prototype.createRow=function(o,u,s,l,t,a,i){for(var r=this._document.createDocumentFragment(),h=0,d=Math.min(o.length,i)-1;d>=0;d--)if(o.loadCell(d,this._workCell).getCode()!==M.NULL_CELL_CODE||u&&d===l){h=d+1;break}for(d=0;d<h;d++){o.loadCell(d,this._workCell);var y=this._workCell.getWidth();if(y!==0){var m=this._document.createElement("span");if(y>1&&(m.style.width=a*y+"px"),u&&d===l)switch(m.classList.add(L.CURSOR_CLASS),t&&m.classList.add(L.CURSOR_BLINK_CLASS),s){case"bar":m.classList.add(L.CURSOR_STYLE_BAR_CLASS);break;case"underline":m.classList.add(L.CURSOR_STYLE_UNDERLINE_CLASS);break;default:m.classList.add(L.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&m.classList.add(L.BOLD_CLASS),this._workCell.isItalic()&&m.classList.add(L.ITALIC_CLASS),this._workCell.isDim()&&m.classList.add(L.DIM_CLASS),this._workCell.isUnderline()&&m.classList.add(L.UNDERLINE_CLASS),this._workCell.isInvisible()?m.textContent=M.WHITESPACE_CELL_CHAR:m.textContent=this._workCell.getChars()||M.WHITESPACE_CELL_CHAR;var C=this._workCell.getFgColor(),T=this._workCell.getFgColorMode(),x=this._workCell.getBgColor(),E=this._workCell.getBgColorMode(),w=!!this._workCell.isInverse();if(w){var A=C;C=x,x=A;var g=T;T=E,E=g}switch(T){case 16777216:case 33554432:this._workCell.isBold()&&C<8&&this._optionsService.options.drawBoldTextInBrightColors&&(C+=8),this._applyMinimumContrast(m,this._colors.background,this._colors.ansi[C])||m.classList.add("xterm-fg-"+C);break;case 50331648:var P=S.rgba.toColor(C>>16&255,C>>8&255,255&C);this._applyMinimumContrast(m,this._colors.background,P)||this._addStyle(m,"color:#"+p(C.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(m,this._colors.background,this._colors.foreground)||w&&m.classList.add("xterm-fg-"+k.INVERTED_DEFAULT_COLOR)}switch(E){case 16777216:case 33554432:m.classList.add("xterm-bg-"+x);break;case 50331648:this._addStyle(m,"background-color:#"+p(x.toString(16),"0",6));break;case 0:default:w&&m.classList.add("xterm-bg-"+k.INVERTED_DEFAULT_COLOR)}r.appendChild(m)}}return r},c.prototype._applyMinimumContrast=function(o,u,s){if(this._optionsService.options.minimumContrastRatio===1)return!1;var l=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return l===void 0&&(l=S.color.ensureContrastRatio(u,s,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,l!=null?l:null)),!!l&&(this._addStyle(o,"color:"+l.css),!0)},c.prototype._addStyle=function(o,u){o.setAttribute("style",""+(o.getAttribute("style")||"")+u+";")},c}();function p(c,o,u){for(;c.length<u;)c=o+c;return c}L.DomRendererRowFactory=_},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.evaluateKeyboardEvent=void 0;var k=D(12),M={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};L.evaluateKeyboardEvent=function(f,S,_,p){var c={type:0,cancel:!1,key:void 0},o=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?c.key=S?k.C0.ESC+"OA":k.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?c.key=S?k.C0.ESC+"OD":k.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?c.key=S?k.C0.ESC+"OC":k.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(c.key=S?k.C0.ESC+"OB":k.C0.ESC+"[B");break;case 8:if(f.shiftKey){c.key=k.C0.BS;break}if(f.altKey){c.key=k.C0.ESC+k.C0.DEL;break}c.key=k.C0.DEL;break;case 9:if(f.shiftKey){c.key=k.C0.ESC+"[Z";break}c.key=k.C0.HT,c.cancel=!0;break;case 13:c.key=f.altKey?k.C0.ESC+k.C0.CR:k.C0.CR,c.cancel=!0;break;case 27:c.key=k.C0.ESC,f.altKey&&(c.key=k.C0.ESC+k.C0.ESC),c.cancel=!0;break;case 37:if(f.metaKey)break;o?(c.key=k.C0.ESC+"[1;"+(o+1)+"D",c.key===k.C0.ESC+"[1;3D"&&(c.key=k.C0.ESC+(_?"b":"[1;5D"))):c.key=S?k.C0.ESC+"OD":k.C0.ESC+"[D";break;case 39:if(f.metaKey)break;o?(c.key=k.C0.ESC+"[1;"+(o+1)+"C",c.key===k.C0.ESC+"[1;3C"&&(c.key=k.C0.ESC+(_?"f":"[1;5C"))):c.key=S?k.C0.ESC+"OC":k.C0.ESC+"[C";break;case 38:if(f.metaKey)break;o?(c.key=k.C0.ESC+"[1;"+(o+1)+"A",_||c.key!==k.C0.ESC+"[1;3A"||(c.key=k.C0.ESC+"[1;5A")):c.key=S?k.C0.ESC+"OA":k.C0.ESC+"[A";break;case 40:if(f.metaKey)break;o?(c.key=k.C0.ESC+"[1;"+(o+1)+"B",_||c.key!==k.C0.ESC+"[1;3B"||(c.key=k.C0.ESC+"[1;5B")):c.key=S?k.C0.ESC+"OB":k.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(c.key=k.C0.ESC+"[2~");break;case 46:c.key=o?k.C0.ESC+"[3;"+(o+1)+"~":k.C0.ESC+"[3~";break;case 36:c.key=o?k.C0.ESC+"[1;"+(o+1)+"H":S?k.C0.ESC+"OH":k.C0.ESC+"[H";break;case 35:c.key=o?k.C0.ESC+"[1;"+(o+1)+"F":S?k.C0.ESC+"OF":k.C0.ESC+"[F";break;case 33:f.shiftKey?c.type=2:c.key=k.C0.ESC+"[5~";break;case 34:f.shiftKey?c.type=3:c.key=k.C0.ESC+"[6~";break;case 112:c.key=o?k.C0.ESC+"[1;"+(o+1)+"P":k.C0.ESC+"OP";break;case 113:c.key=o?k.C0.ESC+"[1;"+(o+1)+"Q":k.C0.ESC+"OQ";break;case 114:c.key=o?k.C0.ESC+"[1;"+(o+1)+"R":k.C0.ESC+"OR";break;case 115:c.key=o?k.C0.ESC+"[1;"+(o+1)+"S":k.C0.ESC+"OS";break;case 116:c.key=o?k.C0.ESC+"[15;"+(o+1)+"~":k.C0.ESC+"[15~";break;case 117:c.key=o?k.C0.ESC+"[17;"+(o+1)+"~":k.C0.ESC+"[17~";break;case 118:c.key=o?k.C0.ESC+"[18;"+(o+1)+"~":k.C0.ESC+"[18~";break;case 119:c.key=o?k.C0.ESC+"[19;"+(o+1)+"~":k.C0.ESC+"[19~";break;case 120:c.key=o?k.C0.ESC+"[20;"+(o+1)+"~":k.C0.ESC+"[20~";break;case 121:c.key=o?k.C0.ESC+"[21;"+(o+1)+"~":k.C0.ESC+"[21~";break;case 122:c.key=o?k.C0.ESC+"[23;"+(o+1)+"~":k.C0.ESC+"[23~";break;case 123:c.key=o?k.C0.ESC+"[24;"+(o+1)+"~":k.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(_&&!p||!f.altKey||f.metaKey)_&&!f.altKey&&!f.ctrlKey&&f.metaKey?f.keyCode===65&&(c.type=1):f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?c.key=f.key:f.key&&f.ctrlKey&&f.key==="_"&&(c.key=k.C0.US);else{var u=M[f.keyCode],s=u&&u[f.shiftKey?1:0];if(s)c.key=k.C0.ESC+s;else if(f.keyCode>=65&&f.keyCode<=90){var l=f.ctrlKey?f.keyCode-64:f.keyCode+32;c.key=k.C0.ESC+String.fromCharCode(l)}}else f.keyCode>=65&&f.keyCode<=90?c.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?c.key=k.C0.NUL:f.keyCode>=51&&f.keyCode<=55?c.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?c.key=k.C0.DEL:f.keyCode===219?c.key=k.C0.ESC:f.keyCode===220?c.key=k.C0.FS:f.keyCode===221&&(c.key=k.C0.GS)}return c}},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(a,i){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,h){r.__proto__=h}||function(r,h){for(var d in h)h.hasOwnProperty(d)&&(r[d]=h[d])})(a,i)},function(a,i){function r(){this.constructor=a}k(a,i),a.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}),f=this&&this.__decorate||function(a,i,r,h){var d,y=arguments.length,m=y<3?i:h===null?h=Object.getOwnPropertyDescriptor(i,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,i,r,h);else for(var C=a.length-1;C>=0;C--)(d=a[C])&&(m=(y<3?d(m):y>3?d(i,r,m):d(i,r))||m);return y>3&&m&&Object.defineProperty(i,r,m),m},S=this&&this.__param||function(a,i){return function(r,h){i(r,h,a)}};Object.defineProperty(L,"__esModule",{value:!0}),L.RenderService=void 0;var _=D(31),p=D(0),c=D(2),o=D(32),u=D(7),s=D(1),l=D(5),t=function(a){function i(r,h,d,y,m,C){var T=a.call(this)||this;if(T._renderer=r,T._rowCount=h,T._isPaused=!1,T._needsFullRefresh=!1,T._isNextRenderRedrawOnly=!0,T._needsSelectionRefresh=!1,T._canvasWidth=0,T._canvasHeight=0,T._selectionState={start:void 0,end:void 0,columnSelectMode:!1},T._onDimensionsChange=new p.EventEmitter,T._onRender=new p.EventEmitter,T._onRefreshRequest=new p.EventEmitter,T.register({dispose:function(){return T._renderer.dispose()}}),T._renderDebouncer=new _.RenderDebouncer(function(E,w){return T._renderRows(E,w)}),T.register(T._renderDebouncer),T._screenDprMonitor=new o.ScreenDprMonitor,T._screenDprMonitor.setListener(function(){return T.onDevicePixelRatioChange()}),T.register(T._screenDprMonitor),T.register(C.onResize(function(E){return T._fullRefresh()})),T.register(y.onOptionChange(function(){return T._renderer.onOptionsChanged()})),T.register(m.onCharSizeChange(function(){return T.onCharSizeChanged()})),T._renderer.onRequestRedraw(function(E){return T.refreshRows(E.start,E.end,!0)}),T.register(u.addDisposableDomListener(window,"resize",function(){return T.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var x=new IntersectionObserver(function(E){return T._onIntersectionChange(E[E.length-1])},{threshold:0});x.observe(d),T.register({dispose:function(){return x.disconnect()}})}return T}return M(i,a),Object.defineProperty(i.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),i.prototype._onIntersectionChange=function(r){this._isPaused=r.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},i.prototype.refreshRows=function(r,h,d){d===void 0&&(d=!1),this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(r,h,this._rowCount))},i.prototype._renderRows=function(r,h){this._renderer.renderRows(r,h),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:r,end:h}),this._isNextRenderRedrawOnly=!0},i.prototype.resize=function(r,h){this._rowCount=h,this._fireOnCanvasResize()},i.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},i.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},i.prototype.dispose=function(){a.prototype.dispose.call(this)},i.prototype.setRenderer=function(r){var h=this;this._renderer.dispose(),this._renderer=r,this._renderer.onRequestRedraw(function(d){return h.refreshRows(d.start,d.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},i.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},i.prototype.setColors=function(r){this._renderer.setColors(r),this._fullRefresh()},i.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},i.prototype.onResize=function(r,h){this._renderer.onResize(r,h),this._fullRefresh()},i.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},i.prototype.onBlur=function(){this._renderer.onBlur()},i.prototype.onFocus=function(){this._renderer.onFocus()},i.prototype.onSelectionChanged=function(r,h,d){this._selectionState.start=r,this._selectionState.end=h,this._selectionState.columnSelectMode=d,this._renderer.onSelectionChanged(r,h,d)},i.prototype.onCursorMove=function(){this._renderer.onCursorMove()},i.prototype.clear=function(){this._renderer.clear()},i.prototype.registerCharacterJoiner=function(r){return this._renderer.registerCharacterJoiner(r)},i.prototype.deregisterCharacterJoiner=function(r){return this._renderer.deregisterCharacterJoiner(r)},i=f([S(3,s.IOptionsService),S(4,l.ICharSizeService),S(5,s.IBufferService)],i)}(c.Disposable);L.RenderService=t},function(z,L,D){"use strict";var k=this&&this.__decorate||function(c,o,u,s){var l,t=arguments.length,a=t<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,u):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(c,o,u,s);else for(var i=c.length-1;i>=0;i--)(l=c[i])&&(a=(t<3?l(a):t>3?l(o,u,a):l(o,u))||a);return t>3&&a&&Object.defineProperty(o,u,a),a},M=this&&this.__param||function(c,o){return function(u,s){o(u,s,c)}};Object.defineProperty(L,"__esModule",{value:!0}),L.CharSizeService=void 0;var f=D(1),S=D(0),_=function(){function c(o,u,s){this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=new S.EventEmitter,this._measureStrategy=new p(o,u,this._optionsService)}return Object.defineProperty(c.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),c.prototype.measure=function(){var o=this._measureStrategy.measure();o.width===this.width&&o.height===this.height||(this.width=o.width,this.height=o.height,this._onCharSizeChange.fire())},c=k([M(2,f.IOptionsService)],c)}();L.CharSizeService=_;var p=function(){function c(o,u,s){this._document=o,this._parentElement=u,this._optionsService=s,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return c.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._measureElement.getBoundingClientRect();return o.width!==0&&o.height!==0&&(this._result.width=o.width,this._result.height=Math.ceil(o.height)),this._result},c}()},function(z,L,D){"use strict";var k=this&&this.__decorate||function(p,c,o,u){var s,l=arguments.length,t=l<3?c:u===null?u=Object.getOwnPropertyDescriptor(c,o):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(p,c,o,u);else for(var a=p.length-1;a>=0;a--)(s=p[a])&&(t=(l<3?s(t):l>3?s(c,o,t):s(c,o))||t);return l>3&&t&&Object.defineProperty(c,o,t),t},M=this&&this.__param||function(p,c){return function(o,u){c(o,u,p)}};Object.defineProperty(L,"__esModule",{value:!0}),L.MouseService=void 0;var f=D(5),S=D(30),_=function(){function p(c,o){this._renderService=c,this._charSizeService=o}return p.prototype.getCoords=function(c,o,u,s,l){return S.getCoords(c,o,u,s,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,l)},p.prototype.getRawByteCoords=function(c,o,u,s){var l=this.getCoords(c,o,u,s);return S.getRawByteCoords(l)},p=k([M(0,f.IRenderService),M(1,f.ICharSizeService)],p)}();L.MouseService=_},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)}),f=this&&this.__decorate||function(s,l,t,a){var i,r=arguments.length,h=r<3?l:a===null?a=Object.getOwnPropertyDescriptor(l,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,t,a);else for(var d=s.length-1;d>=0;d--)(i=s[d])&&(h=(r<3?i(h):r>3?i(l,t,h):i(l,t))||h);return r>3&&h&&Object.defineProperty(l,t,h),h},S=this&&this.__param||function(s,l){return function(t,a){l(t,a,s)}};Object.defineProperty(L,"__esModule",{value:!0}),L.Linkifier2=void 0;var _=D(1),p=D(0),c=D(2),o=D(7),u=function(s){function l(t){var a=s.call(this)||this;return a._bufferService=t,a._linkProviders=[],a._linkCacheDisposables=[],a._isMouseOut=!0,a._activeLine=-1,a._onShowLinkUnderline=a.register(new p.EventEmitter),a._onHideLinkUnderline=a.register(new p.EventEmitter),a.register(c.getDisposeArrayDisposable(a._linkCacheDisposables)),a}return M(l,s),Object.defineProperty(l.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),l.prototype.registerLinkProvider=function(t){var a=this;return this._linkProviders.push(t),{dispose:function(){var i=a._linkProviders.indexOf(t);i!==-1&&a._linkProviders.splice(i,1)}}},l.prototype.attachToDom=function(t,a,i){var r=this;this._element=t,this._mouseService=a,this._renderService=i,this.register(o.addDisposableDomListener(this._element,"mouseleave",function(){r._isMouseOut=!0,r._clearCurrentLink()})),this.register(o.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(o.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},l.prototype._onMouseMove=function(t){if(this._lastMouseEvent=t,this._element&&this._mouseService){var a=this._positionFromMouseEvent(t,this._element,this._mouseService);if(a){this._isMouseOut=!1;for(var i=t.composedPath(),r=0;r<i.length;r++){var h=i[r];if(h.classList.contains("xterm"))break;if(h.classList.contains("xterm-hover"))return}this._lastBufferCell&&a.x===this._lastBufferCell.x&&a.y===this._lastBufferCell.y||(this._onHover(a),this._lastBufferCell=a)}}},l.prototype._onHover=function(t){if(this._activeLine!==t.y)return this._clearCurrentLink(),void this._askForLink(t,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))},l.prototype._askForLink=function(t,a){var i=this;this._activeProviderReplies&&a||(this._activeProviderReplies=new Map,this._activeLine=t.y);var r=!1;this._linkProviders.forEach(function(h,d){var y;a?((y=i._activeProviderReplies)===null||y===void 0?void 0:y.get(d))&&(r=i._checkLinkProviderResult(d,t,r)):h.provideLinks(t.y,function(m){var C,T;if(!i._isMouseOut){var x=m==null?void 0:m.map(function(E){return{link:E}});(C=i._activeProviderReplies)===null||C===void 0||C.set(d,x),r=i._checkLinkProviderResult(d,t,r),((T=i._activeProviderReplies)===null||T===void 0?void 0:T.size)===i._linkProviders.length&&i._removeIntersectingLinks(t.y,i._activeProviderReplies)}})})},l.prototype._removeIntersectingLinks=function(t,a){for(var i=new Set,r=0;r<a.size;r++){var h=a.get(r);if(h)for(var d=0;d<h.length;d++)for(var y=h[d],m=y.link.range.start.y<t?0:y.link.range.start.x,C=y.link.range.end.y>t?this._bufferService.cols:y.link.range.end.x,T=m;T<=C;T++){if(i.has(T)){h.splice(d--,1);break}i.add(T)}}},l.prototype._checkLinkProviderResult=function(t,a,i){var r,h=this;if(!this._activeProviderReplies)return i;for(var d=this._activeProviderReplies.get(t),y=!1,m=0;m<t;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(y=!0);if(!y&&d){var C=d.find(function(x){return h._linkAtPosition(x.link,a)});C&&(i=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviders.length&&!i)for(m=0;m<this._activeProviderReplies.size;m++){var T=(r=this._activeProviderReplies.get(m))===null||r===void 0?void 0:r.find(function(x){return h._linkAtPosition(x.link,a)});if(T){i=!0,this._handleNewLink(T);break}}return i},l.prototype._onClick=function(t){if(this._element&&this._mouseService&&this._currentLink){var a=this._positionFromMouseEvent(t,this._element,this._mouseService);a&&this._linkAtPosition(this._currentLink.link,a)&&this._currentLink.link.activate(t,this._currentLink.link.text)}},l.prototype._clearCurrentLink=function(t,a){this._element&&this._currentLink&&this._lastMouseEvent&&(!t||!a||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=a)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,c.disposeArray(this._linkCacheDisposables))},l.prototype._handleNewLink=function(t){var a=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(t.link,i)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0||t.link.decorations.underline,pointerCursor:t.link.decorations===void 0||t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:function(){var r,h;return(h=(r=a._currentLink)===null||r===void 0?void 0:r.state)===null||h===void 0?void 0:h.decorations.pointerCursor},set:function(r){var h,d;((h=a._currentLink)===null||h===void 0?void 0:h.state)&&a._currentLink.state.decorations.pointerCursor!==r&&(a._currentLink.state.decorations.pointerCursor=r,a._currentLink.state.isHovered&&((d=a._element)===null||d===void 0||d.classList.toggle("xterm-cursor-pointer",r)))}},underline:{get:function(){var r,h;return(h=(r=a._currentLink)===null||r===void 0?void 0:r.state)===null||h===void 0?void 0:h.decorations.underline},set:function(r){var h,d,y;((h=a._currentLink)===null||h===void 0?void 0:h.state)&&((y=(d=a._currentLink)===null||d===void 0?void 0:d.state)===null||y===void 0?void 0:y.decorations.underline)!==r&&(a._currentLink.state.decorations.underline=r,a._currentLink.state.isHovered&&a._fireUnderlineEvent(t.link,r))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(r){var h=r.start===0?0:r.start+1+a._bufferService.buffer.ydisp;a._clearCurrentLink(h,r.end+1+a._bufferService.buffer.ydisp)})))}},l.prototype._linkHover=function(t,a,i){var r;((r=this._currentLink)===null||r===void 0?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),a.hover&&a.hover(i,a.text)},l.prototype._fireUnderlineEvent=function(t,a){var i=t.range,r=this._bufferService.buffer.ydisp,h=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(a?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(h)},l.prototype._linkLeave=function(t,a,i){var r;((r=this._currentLink)===null||r===void 0?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(a,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),a.leave&&a.leave(i,a.text)},l.prototype._linkAtPosition=function(t,a){var i=t.range.start.y===t.range.end.y,r=t.range.start.y<a.y,h=t.range.end.y>a.y;return(i&&t.range.start.x<=a.x&&t.range.end.x>=a.x||r&&t.range.end.x>=a.x||h&&t.range.start.x<=a.x||r&&h)&&t.range.start.y<=a.y&&t.range.end.y>=a.y},l.prototype._positionFromMouseEvent=function(t,a,i){var r=i.getCoords(t,a,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}},l.prototype._createLinkUnderlineEvent=function(t,a,i,r,h){return{x1:t,y1:a,x2:i,y2:r,cols:this._bufferService.cols,fg:h}},l=f([S(0,_.IBufferService)],l)}(c.Disposable);L.Linkifier2=u},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.CoreBrowserService=void 0;var k=function(){function M(f){this._textarea=f}return Object.defineProperty(M.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),M}();L.CoreBrowserService=k},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(m,C){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,x){T.__proto__=x}||function(T,x){for(var E in x)x.hasOwnProperty(E)&&(T[E]=x[E])})(m,C)},function(m,C){function T(){this.constructor=m}k(m,C),m.prototype=C===null?Object.create(C):(T.prototype=C.prototype,new T)});Object.defineProperty(L,"__esModule",{value:!0}),L.CoreTerminal=void 0;var f=D(2),S=D(1),_=D(66),p=D(67),c=D(68),o=D(74),u=D(75),s=D(0),l=D(76),t=D(77),a=D(78),i=D(80),r=D(81),h=D(19),d=D(82),y=function(m){function C(T){var x=m.call(this)||this;return x._onBinary=new s.EventEmitter,x._onData=new s.EventEmitter,x._onLineFeed=new s.EventEmitter,x._onResize=new s.EventEmitter,x._onScroll=new s.EventEmitter,x._instantiationService=new _.InstantiationService,x.optionsService=new o.OptionsService(T),x._instantiationService.setService(S.IOptionsService,x.optionsService),x._bufferService=x.register(x._instantiationService.createInstance(c.BufferService)),x._instantiationService.setService(S.IBufferService,x._bufferService),x._logService=x._instantiationService.createInstance(p.LogService),x._instantiationService.setService(S.ILogService,x._logService),x._coreService=x.register(x._instantiationService.createInstance(u.CoreService,function(){return x.scrollToBottom()})),x._instantiationService.setService(S.ICoreService,x._coreService),x._coreMouseService=x._instantiationService.createInstance(l.CoreMouseService),x._instantiationService.setService(S.ICoreMouseService,x._coreMouseService),x._dirtyRowService=x._instantiationService.createInstance(t.DirtyRowService),x._instantiationService.setService(S.IDirtyRowService,x._dirtyRowService),x.unicodeService=x._instantiationService.createInstance(a.UnicodeService),x._instantiationService.setService(S.IUnicodeService,x.unicodeService),x._charsetService=x._instantiationService.createInstance(i.CharsetService),x._instantiationService.setService(S.ICharsetService,x._charsetService),x._inputHandler=new h.InputHandler(x._bufferService,x._charsetService,x._coreService,x._dirtyRowService,x._logService,x.optionsService,x._coreMouseService,x.unicodeService),x.register(s.forwardEvent(x._inputHandler.onLineFeed,x._onLineFeed)),x.register(x._inputHandler),x.register(s.forwardEvent(x._bufferService.onResize,x._onResize)),x.register(s.forwardEvent(x._coreService.onData,x._onData)),x.register(s.forwardEvent(x._coreService.onBinary,x._onBinary)),x.register(x.optionsService.onOptionChange(function(E){return x._updateOptions(E)})),x._writeBuffer=new d.WriteBuffer(function(E){return x._inputHandler.parse(E)}),x}return M(C,m),Object.defineProperty(C.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),C.prototype.dispose=function(){var T;this._isDisposed||(m.prototype.dispose.call(this),(T=this._windowsMode)===null||T===void 0||T.dispose(),this._windowsMode=void 0)},C.prototype.write=function(T,x){this._writeBuffer.write(T,x)},C.prototype.writeSync=function(T){this._writeBuffer.writeSync(T)},C.prototype.resize=function(T,x){isNaN(T)||isNaN(x)||(T=Math.max(T,c.MINIMUM_COLS),x=Math.max(x,c.MINIMUM_ROWS),this._bufferService.resize(T,x))},C.prototype.scroll=function(T,x){x===void 0&&(x=!1);var E,w=this._bufferService.buffer;(E=this._cachedBlankLine)&&E.length===this.cols&&E.getFg(0)===T.fg&&E.getBg(0)===T.bg||(E=w.getBlankLine(T,x),this._cachedBlankLine=E),E.isWrapped=x;var A=w.ybase+w.scrollTop,g=w.ybase+w.scrollBottom;if(w.scrollTop===0){var P=w.lines.isFull;g===w.lines.length-1?P?w.lines.recycle().copyFrom(E):w.lines.push(E.clone()):w.lines.splice(g+1,0,E.clone()),P?this._bufferService.isUserScrolling&&(w.ydisp=Math.max(w.ydisp-1,0)):(w.ybase++,this._bufferService.isUserScrolling||w.ydisp++)}else{var O=g-A+1;w.lines.shiftElements(A+1,O-1,-1),w.lines.set(g,E.clone())}this._bufferService.isUserScrolling||(w.ydisp=w.ybase),this._dirtyRowService.markRangeDirty(w.scrollTop,w.scrollBottom),this._onScroll.fire(w.ydisp)},C.prototype.scrollLines=function(T,x){var E=this._bufferService.buffer;if(T<0){if(E.ydisp===0)return;this._bufferService.isUserScrolling=!0}else T+E.ydisp>=E.ybase&&(this._bufferService.isUserScrolling=!1);var w=E.ydisp;E.ydisp=Math.max(Math.min(E.ydisp+T,E.ybase),0),w!==E.ydisp&&(x||this._onScroll.fire(E.ydisp))},C.prototype.scrollPages=function(T){this.scrollLines(T*(this.rows-1))},C.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},C.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},C.prototype.scrollToLine=function(T){var x=T-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)},C.prototype.addEscHandler=function(T,x){return this._inputHandler.addEscHandler(T,x)},C.prototype.addDcsHandler=function(T,x){return this._inputHandler.addDcsHandler(T,x)},C.prototype.addCsiHandler=function(T,x){return this._inputHandler.addCsiHandler(T,x)},C.prototype.addOscHandler=function(T,x){return this._inputHandler.addOscHandler(T,x)},C.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},C.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},C.prototype._updateOptions=function(T){var x;switch(T){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():((x=this._windowsMode)===null||x===void 0||x.dispose(),this._windowsMode=void 0)}},C.prototype._enableWindowsMode=function(){var T=this;if(!this._windowsMode){var x=[];x.push(this.onLineFeed(r.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.addCsiHandler({final:"H"},function(){return r.updateWindowsModeWrappedState(T._bufferService),!1})),this._windowsMode={dispose:function(){for(var E=0,w=x;E<w.length;E++)w[E].dispose()}}}},C}(f.Disposable);L.CoreTerminal=y},function(z,L,D){"use strict";var k=this&&this.__spreadArrays||function(){for(var p=0,c=0,o=arguments.length;c<o;c++)p+=arguments[c].length;var u=Array(p),s=0;for(c=0;c<o;c++)for(var l=arguments[c],t=0,a=l.length;t<a;t++,s++)u[s]=l[t];return u};Object.defineProperty(L,"__esModule",{value:!0}),L.InstantiationService=L.ServiceCollection=void 0;var M=D(1),f=D(14),S=function(){function p(){for(var c=[],o=0;o<arguments.length;o++)c[o]=arguments[o];this._entries=new Map;for(var u=0,s=c;u<s.length;u++){var l=s[u],t=l[0],a=l[1];this.set(t,a)}}return p.prototype.set=function(c,o){var u=this._entries.get(c);return this._entries.set(c,o),u},p.prototype.forEach=function(c){this._entries.forEach(function(o,u){return c(u,o)})},p.prototype.has=function(c){return this._entries.has(c)},p.prototype.get=function(c){return this._entries.get(c)},p}();L.ServiceCollection=S;var _=function(){function p(){this._services=new S,this._services.set(M.IInstantiationService,this)}return p.prototype.setService=function(c,o){this._services.set(c,o)},p.prototype.getService=function(c){return this._services.get(c)},p.prototype.createInstance=function(c){for(var o=[],u=1;u<arguments.length;u++)o[u-1]=arguments[u];for(var s=f.getServiceDependencies(c).sort(function(d,y){return d.index-y.index}),l=[],t=0,a=s;t<a.length;t++){var i=a[t],r=this._services.get(i.id);if(!r)throw new Error("[createInstance] "+c.name+" depends on UNKNOWN service "+i.id+".");l.push(r)}var h=s.length>0?s[0].index:o.length;if(o.length!==h)throw new Error("[createInstance] First service dependency of "+c.name+" at position "+(h+1)+" conflicts with "+o.length+" static arguments");return new(c.bind.apply(c,k([void 0],k(o,l))))},p}();L.InstantiationService=_},function(z,L,D){"use strict";var k=this&&this.__decorate||function(o,u,s,l){var t,a=arguments.length,i=a<3?u:l===null?l=Object.getOwnPropertyDescriptor(u,s):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,u,s,l);else for(var r=o.length-1;r>=0;r--)(t=o[r])&&(i=(a<3?t(i):a>3?t(u,s,i):t(u,s))||i);return a>3&&i&&Object.defineProperty(u,s,i),i},M=this&&this.__param||function(o,u){return function(s,l){u(s,l,o)}},f=this&&this.__spreadArrays||function(){for(var o=0,u=0,s=arguments.length;u<s;u++)o+=arguments[u].length;var l=Array(o),t=0;for(u=0;u<s;u++)for(var a=arguments[u],i=0,r=a.length;i<r;i++,t++)l[t]=a[i];return l};Object.defineProperty(L,"__esModule",{value:!0}),L.LogService=L.LogLevel=void 0;var S,_=D(1);!function(o){o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.OFF=4]="OFF"}(S=L.LogLevel||(L.LogLevel={}));var p={debug:S.DEBUG,info:S.INFO,warn:S.WARN,error:S.ERROR,off:S.OFF},c=function(){function o(u){var s=this;this._optionsService=u,this._updateLogLevel(),this._optionsService.onOptionChange(function(l){l==="logLevel"&&s._updateLogLevel()})}return o.prototype._updateLogLevel=function(){this._logLevel=p[this._optionsService.options.logLevel]},o.prototype._evalLazyOptionalParams=function(u){for(var s=0;s<u.length;s++)typeof u[s]=="function"&&(u[s]=u[s]())},o.prototype._log=function(u,s,l){this._evalLazyOptionalParams(l),u.call.apply(u,f([console,"xterm.js: "+s],l))},o.prototype.debug=function(u){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.DEBUG&&this._log(console.log,u,s)},o.prototype.info=function(u){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.INFO&&this._log(console.info,u,s)},o.prototype.warn=function(u){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.WARN&&this._log(console.warn,u,s)},o.prototype.error=function(u){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.ERROR&&this._log(console.error,u,s)},o=k([M(0,_.IOptionsService)],o)}();L.LogService=c},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(s,l){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,a){t.__proto__=a}||function(t,a){for(var i in a)a.hasOwnProperty(i)&&(t[i]=a[i])})(s,l)},function(s,l){function t(){this.constructor=s}k(s,l),s.prototype=l===null?Object.create(l):(t.prototype=l.prototype,new t)}),f=this&&this.__decorate||function(s,l,t,a){var i,r=arguments.length,h=r<3?l:a===null?a=Object.getOwnPropertyDescriptor(l,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,t,a);else for(var d=s.length-1;d>=0;d--)(i=s[d])&&(h=(r<3?i(h):r>3?i(l,t,h):i(l,t))||h);return r>3&&h&&Object.defineProperty(l,t,h),h},S=this&&this.__param||function(s,l){return function(t,a){l(t,a,s)}};Object.defineProperty(L,"__esModule",{value:!0}),L.BufferService=L.MINIMUM_ROWS=L.MINIMUM_COLS=void 0;var _=D(1),p=D(69),c=D(0),o=D(2);L.MINIMUM_COLS=2,L.MINIMUM_ROWS=1;var u=function(s){function l(t){var a=s.call(this)||this;return a._optionsService=t,a.isUserScrolling=!1,a._onResize=new c.EventEmitter,a.cols=Math.max(t.options.cols,L.MINIMUM_COLS),a.rows=Math.max(t.options.rows,L.MINIMUM_ROWS),a.buffers=new p.BufferSet(t,a),a}return M(l,s),Object.defineProperty(l.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),l.prototype.dispose=function(){s.prototype.dispose.call(this),this.buffers.dispose()},l.prototype.resize=function(t,a){this.cols=t,this.rows=a,this.buffers.resize(t,a),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:t,rows:a})},l.prototype.reset=function(){this.buffers.dispose(),this.buffers=new p.BufferSet(this._optionsService,this),this.isUserScrolling=!1},l=f([S(0,_.IOptionsService)],l)}(o.Disposable);L.BufferService=u},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(p,c){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var s in u)u.hasOwnProperty(s)&&(o[s]=u[s])})(p,c)},function(p,c){function o(){this.constructor=p}k(p,c),p.prototype=c===null?Object.create(c):(o.prototype=c.prototype,new o)});Object.defineProperty(L,"__esModule",{value:!0}),L.BufferSet=void 0;var f=D(70),S=D(0),_=function(p){function c(o,u){var s=p.call(this)||this;return s._onBufferActivate=s.register(new S.EventEmitter),s._normal=new f.Buffer(!0,o,u),s._normal.fillViewportRows(),s._alt=new f.Buffer(!1,o,u),s._activeBuffer=s._normal,s.setupTabStops(),s}return M(c,p),Object.defineProperty(c.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),c.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},c.prototype.activateAltBuffer=function(o){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(o),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},c.prototype.resize=function(o,u){this._normal.resize(o,u),this._alt.resize(o,u)},c.prototype.setupTabStops=function(o){this._normal.setupTabStops(o),this._alt.setupTabStops(o)},c}(D(2).Disposable);L.BufferSet=_},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.BufferStringIterator=L.Buffer=L.MAX_BUFFER_SIZE=void 0;var k=D(71),M=D(16),f=D(4),S=D(3),_=D(72),p=D(73),c=D(20),o=D(6);L.MAX_BUFFER_SIZE=4294967295;var u=function(){function l(t,a,i){this._hasScrollback=t,this._optionsService=a,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=M.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=f.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=f.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new k.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return l.prototype.getNullCell=function(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell},l.prototype.getWhitespaceCell=function(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell},l.prototype.getBlankLine=function(t,a){return new M.BufferLine(this._bufferService.cols,this.getNullCell(t),a)},Object.defineProperty(l.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"isCursorInViewport",{get:function(){var t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows},enumerable:!1,configurable:!0}),l.prototype._getCorrectBufferLength=function(t){if(!this._hasScrollback)return t;var a=t+this._optionsService.options.scrollback;return a>L.MAX_BUFFER_SIZE?L.MAX_BUFFER_SIZE:a},l.prototype.fillViewportRows=function(t){if(this.lines.length===0){t===void 0&&(t=M.DEFAULT_ATTR_DATA);for(var a=this._rows;a--;)this.lines.push(this.getBlankLine(t))}},l.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new k.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},l.prototype.resize=function(t,a){var i=this.getNullCell(M.DEFAULT_ATTR_DATA),r=this._getCorrectBufferLength(a);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<t)for(var h=0;h<this.lines.length;h++)this.lines.get(h).resize(t,i);var d=0;if(this._rows<a)for(var y=this._rows;y<a;y++)this.lines.length<a+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new M.BufferLine(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+d+1?(this.ybase--,d++,this.ydisp>0&&this.ydisp--):this.lines.push(new M.BufferLine(t,i)));else for(y=this._rows;y>a;y--)this.lines.length>a+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){var m=this.lines.length-r;m>0&&(this.lines.trimStart(m),this.ybase=Math.max(this.ybase-m,0),this.ydisp=Math.max(this.ydisp-m,0),this.savedY=Math.max(this.savedY-m,0)),this.lines.maxLength=r}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,a-1),d&&(this.y+=d),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=a-1,this._isReflowEnabled&&(this._reflow(t,a),this._cols>t))for(h=0;h<this.lines.length;h++)this.lines.get(h).resize(t,i);this._cols=t,this._rows=a},Object.defineProperty(l.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),l.prototype._reflow=function(t,a){this._cols!==t&&(t>this._cols?this._reflowLarger(t,a):this._reflowSmaller(t,a))},l.prototype._reflowLarger=function(t,a){var i=_.reflowLargerGetLinesToRemove(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(M.DEFAULT_ATTR_DATA));if(i.length>0){var r=_.reflowLargerCreateNewLayout(this.lines,i);_.reflowLargerApplyNewLayout(this.lines,r.layout),this._reflowLargerAdjustViewport(t,a,r.countRemoved)}},l.prototype._reflowLargerAdjustViewport=function(t,a,i){for(var r=this.getNullCell(M.DEFAULT_ATTR_DATA),h=i;h-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<a&&this.lines.push(new M.BufferLine(t,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)},l.prototype._reflowSmaller=function(t,a){for(var i=this.getNullCell(M.DEFAULT_ATTR_DATA),r=[],h=0,d=this.lines.length-1;d>=0;d--){var y=this.lines.get(d);if(!(!y||!y.isWrapped&&y.getTrimmedLength()<=t)){for(var m=[y];y.isWrapped&&d>0;)y=this.lines.get(--d),m.unshift(y);var C=this.ybase+this.y;if(!(C>=d&&C<d+m.length)){var T=m[m.length-1].getTrimmedLength(),x=_.reflowSmallerGetNewLineLengths(m,this._cols,t),E=x.length-m.length,w=void 0;w=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+E):Math.max(0,this.lines.length-this.lines.maxLength+E);for(var A=[],g=0;g<E;g++){var P=this.getBlankLine(M.DEFAULT_ATTR_DATA,!0);A.push(P)}A.length>0&&(r.push({start:d+m.length+h,newLines:A}),h+=A.length),m.push.apply(m,A);var O=x.length-1,F=x[O];F===0&&(F=x[--O]);for(var X=m.length-E-1,W=T;X>=0;){var N=Math.min(W,F);if(m[O].copyCellsFrom(m[X],W-N,F-N,N,!0),(F-=N)===0&&(F=x[--O]),(W-=N)===0){X--;var G=Math.max(X,0);W=_.getWrappedLineTrimmedLength(m,G,this._cols)}}for(g=0;g<m.length;g++)x[g]<t&&m[g].setCell(x[g],i);for(var U=E-w;U-- >0;)this.ybase===0?this.y<a-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-a&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+E,this.ybase+a-1)}}}if(r.length>0){var H=[],V=[];for(g=0;g<this.lines.length;g++)V.push(this.lines.get(g));var ce=this.lines.length,ye=ce-1,Le=0,Ze=r[Le];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);var Ye=0;for(g=Math.min(this.lines.maxLength-1,ce+h-1);g>=0;g--)if(Ze&&Ze.start>ye+Ye){for(var Oe=Ze.newLines.length-1;Oe>=0;Oe--)this.lines.set(g--,Ze.newLines[Oe]);g++,H.push({index:ye+1,amount:Ze.newLines.length}),Ye+=Ze.newLines.length,Ze=r[++Le]}else this.lines.set(g,V[ye--]);var We=0;for(g=H.length-1;g>=0;g--)H[g].index+=We,this.lines.onInsertEmitter.fire(H[g]),We+=H[g].amount;var ze=Math.max(0,ce+h-this.lines.maxLength);ze>0&&this.lines.onTrimEmitter.fire(ze)}},l.prototype.stringIndexToBufferIndex=function(t,a,i){for(i===void 0&&(i=!1);a;){var r=this.lines.get(t);if(!r)return[-1,-1];for(var h=i?r.getTrimmedLength():r.length,d=0;d<h;++d)if(r.get(d)[S.CHAR_DATA_WIDTH_INDEX]&&(a-=r.get(d)[S.CHAR_DATA_CHAR_INDEX].length||1),a<0)return[t,d];t++}return[t,0]},l.prototype.translateBufferLineToString=function(t,a,i,r){i===void 0&&(i=0);var h=this.lines.get(t);return h?h.translateToString(a,i,r):""},l.prototype.getWrappedRangeForLine=function(t){for(var a=t,i=t;a>0&&this.lines.get(a).isWrapped;)a--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:a,last:i}},l.prototype.setupTabStops=function(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.options.tabStopWidth)this.tabs[t]=!0},l.prototype.prevStop=function(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t},l.prototype.nextStop=function(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t},l.prototype.addMarker=function(t){var a=this,i=new p.Marker(t);return this.markers.push(i),i.register(this.lines.onTrim(function(r){i.line-=r,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(function(r){i.line>=r.index&&(i.line+=r.amount)})),i.register(this.lines.onDelete(function(r){i.line>=r.index&&i.line<r.index+r.amount&&i.dispose(),i.line>r.index&&(i.line-=r.amount)})),i.register(i.onDispose(function(){return a._removeMarker(i)})),i},l.prototype._removeMarker=function(t){this.markers.splice(this.markers.indexOf(t),1)},l.prototype.iterator=function(t,a,i,r,h){return new s(this,t,a,i,r,h)},l}();L.Buffer=u;var s=function(){function l(t,a,i,r,h,d){i===void 0&&(i=0),r===void 0&&(r=t.lines.length),h===void 0&&(h=0),d===void 0&&(d=0),this._buffer=t,this._trimRight=a,this._startIndex=i,this._endIndex=r,this._startOverscan=h,this._endOverscan=d,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return l.prototype.hasNext=function(){return this._current<this._endIndex},l.prototype.next=function(){var t=this._buffer.getWrappedRangeForLine(this._current);t.first<this._startIndex-this._startOverscan&&(t.first=this._startIndex-this._startOverscan),t.last>this._endIndex+this._endOverscan&&(t.last=this._endIndex+this._endOverscan),t.first=Math.max(t.first,0),t.last=Math.min(t.last,this._buffer.lines.length);for(var a="",i=t.first;i<=t.last;++i)a+=this._buffer.translateBufferLineToString(i,this._trimRight);return this._current=t.last+1,{range:t,content:a}},l}();L.BufferStringIterator=s},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.CircularList=void 0;var k=D(0),M=function(){function f(S){this._maxLength=S,this.onDeleteEmitter=new k.EventEmitter,this.onInsertEmitter=new k.EventEmitter,this.onTrimEmitter=new k.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(f.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"maxLength",{get:function(){return this._maxLength},set:function(S){if(this._maxLength!==S){for(var _=new Array(S),p=0;p<Math.min(S,this.length);p++)_[p]=this._array[this._getCyclicIndex(p)];this._array=_,this._maxLength=S,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"length",{get:function(){return this._length},set:function(S){if(S>this._length)for(var _=this._length;_<S;_++)this._array[_]=void 0;this._length=S},enumerable:!1,configurable:!0}),f.prototype.get=function(S){return this._array[this._getCyclicIndex(S)]},f.prototype.set=function(S,_){this._array[this._getCyclicIndex(S)]=_},f.prototype.push=function(S){this._array[this._getCyclicIndex(this._length)]=S,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},f.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(f.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),f.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},f.prototype.splice=function(S,_){for(var p=[],c=2;c<arguments.length;c++)p[c-2]=arguments[c];if(_){for(var o=S;o<this._length-_;o++)this._array[this._getCyclicIndex(o)]=this._array[this._getCyclicIndex(o+_)];this._length-=_}for(o=this._length-1;o>=S;o--)this._array[this._getCyclicIndex(o+p.length)]=this._array[this._getCyclicIndex(o)];for(o=0;o<p.length;o++)this._array[this._getCyclicIndex(S+o)]=p[o];if(this._length+p.length>this._maxLength){var u=this._length+p.length-this._maxLength;this._startIndex+=u,this._length=this._maxLength,this.onTrimEmitter.fire(u)}else this._length+=p.length},f.prototype.trimStart=function(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)},f.prototype.shiftElements=function(S,_,p){if(!(_<=0)){if(S<0||S>=this._length)throw new Error("start argument out of range");if(S+p<0)throw new Error("Cannot shift elements in list beyond index 0");if(p>0){for(var c=_-1;c>=0;c--)this.set(S+c+p,this.get(S+c));var o=S+_+p-this._length;if(o>0)for(this._length+=o;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(c=0;c<_;c++)this.set(S+c+p,this.get(S+c))}},f.prototype._getCyclicIndex=function(S){return(this._startIndex+S)%this._maxLength},f}();L.CircularList=M},function(z,L,D){"use strict";function k(M,f,S){if(f===M.length-1)return M[f].getTrimmedLength();var _=!M[f].hasContent(S-1)&&M[f].getWidth(S-1)===1,p=M[f+1].getWidth(0)===2;return _&&p?S-1:S}Object.defineProperty(L,"__esModule",{value:!0}),L.getWrappedLineTrimmedLength=L.reflowSmallerGetNewLineLengths=L.reflowLargerApplyNewLayout=L.reflowLargerCreateNewLayout=L.reflowLargerGetLinesToRemove=void 0,L.reflowLargerGetLinesToRemove=function(M,f,S,_,p){for(var c=[],o=0;o<M.length-1;o++){var u=o,s=M.get(++u);if(s.isWrapped){for(var l=[M.get(o)];u<M.length&&s.isWrapped;)l.push(s),s=M.get(++u);if(_>=o&&_<u)o+=l.length-1;else{for(var t=0,a=k(l,t,f),i=1,r=0;i<l.length;){var h=k(l,i,f),d=h-r,y=S-a,m=Math.min(d,y);l[t].copyCellsFrom(l[i],r,a,m,!1),(a+=m)===S&&(t++,a=0),(r+=m)===h&&(i++,r=0),a===0&&t!==0&&l[t-1].getWidth(S-1)===2&&(l[t].copyCellsFrom(l[t-1],S-1,a++,1,!1),l[t-1].setCell(S-1,p))}l[t].replaceCells(a,S,p);for(var C=0,T=l.length-1;T>0&&(T>t||l[T].getTrimmedLength()===0);T--)C++;C>0&&(c.push(o+l.length-C),c.push(C)),o+=l.length-1}}}return c},L.reflowLargerCreateNewLayout=function(M,f){for(var S=[],_=0,p=f[_],c=0,o=0;o<M.length;o++)if(p===o){var u=f[++_];M.onDeleteEmitter.fire({index:o-c,amount:u}),o+=u-1,c+=u,p=f[++_]}else S.push(o);return{layout:S,countRemoved:c}},L.reflowLargerApplyNewLayout=function(M,f){for(var S=[],_=0;_<f.length;_++)S.push(M.get(f[_]));for(_=0;_<S.length;_++)M.set(_,S[_]);M.length=f.length},L.reflowSmallerGetNewLineLengths=function(M,f,S){for(var _=[],p=M.map(function(a,i){return k(M,i,f)}).reduce(function(a,i){return a+i}),c=0,o=0,u=0;u<p;){if(p-u<S){_.push(p-u);break}c+=S;var s=k(M,o,f);c>s&&(c-=s,o++);var l=M[o].getWidth(c-1)===2;l&&c--;var t=l?S-1:S;_.push(t),u+=t}return _},L.getWrappedLineTrimmedLength=k},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(_,p){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,o){c.__proto__=o}||function(c,o){for(var u in o)o.hasOwnProperty(u)&&(c[u]=o[u])})(_,p)},function(_,p){function c(){this.constructor=_}k(_,p),_.prototype=p===null?Object.create(p):(c.prototype=p.prototype,new c)});Object.defineProperty(L,"__esModule",{value:!0}),L.Marker=void 0;var f=D(0),S=function(_){function p(c){var o=_.call(this)||this;return o.line=c,o._id=p._nextId++,o.isDisposed=!1,o._onDispose=new f.EventEmitter,o}return M(p,_),Object.defineProperty(p.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),p.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},p._nextId=1,p}(D(2).Disposable);L.Marker=S},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.OptionsService=L.DEFAULT_OPTIONS=L.DEFAULT_BELL_SOUND=void 0;var k=D(0),M=D(11),f=D(33);L.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",L.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:L.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,linkTooltipHoverDuration:500,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!0,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:M.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var S=["cols","rows"],_=function(){function p(c){this._onOptionChange=new k.EventEmitter,this.options=f.clone(L.DEFAULT_OPTIONS);for(var o=0,u=Object.keys(c);o<u.length;o++){var s=u[o];if(s in this.options){var l=c[s];this.options[s]=l}}}return Object.defineProperty(p.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!1,configurable:!0}),p.prototype.setOption=function(c,o){if(!(c in L.DEFAULT_OPTIONS))throw new Error('No option with key "'+c+'"');if(S.indexOf(c)!==-1)throw new Error('Option "'+c+'" can only be set in the constructor');this.options[c]!==o&&(o=this._sanitizeAndValidateOption(c,o),this.options[c]!==o&&(this.options[c]=o,this._onOptionChange.fire(c)))},p.prototype._sanitizeAndValidateOption=function(c,o){switch(c){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":o||(o=L.DEFAULT_OPTIONS[c]);break;case"cursorWidth":o=Math.floor(o);case"lineHeight":case"tabStopWidth":if(o<1)throw new Error(c+" cannot be less than 1, value: "+o);break;case"minimumContrastRatio":o=Math.max(1,Math.min(21,Math.round(10*o)/10));break;case"scrollback":if((o=Math.min(o,4294967295))<0)throw new Error(c+" cannot be less than 0, value: "+o);break;case"fastScrollSensitivity":case"scrollSensitivity":if(o<=0)throw new Error(c+" cannot be less than or equal to 0, value: "+o)}return o},p.prototype.getOption=function(c){if(!(c in L.DEFAULT_OPTIONS))throw new Error('No option with key "'+c+'"');return this.options[c]},p}();L.OptionsService=_},function(z,L,D){"use strict";var k,M=this&&this.__extends||(k=function(t,a){return(k=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var h in r)r.hasOwnProperty(h)&&(i[h]=r[h])})(t,a)},function(t,a){function i(){this.constructor=t}k(t,a),t.prototype=a===null?Object.create(a):(i.prototype=a.prototype,new i)}),f=this&&this.__decorate||function(t,a,i,r){var h,d=arguments.length,y=d<3?a:r===null?r=Object.getOwnPropertyDescriptor(a,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(t,a,i,r);else for(var m=t.length-1;m>=0;m--)(h=t[m])&&(y=(d<3?h(y):d>3?h(a,i,y):h(a,i))||y);return d>3&&y&&Object.defineProperty(a,i,y),y},S=this&&this.__param||function(t,a){return function(i,r){a(i,r,t)}};Object.defineProperty(L,"__esModule",{value:!0}),L.CoreService=void 0;var _=D(1),p=D(0),c=D(33),o=D(2),u=Object.freeze({insertMode:!1}),s=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),l=function(t){function a(i,r,h,d){var y=t.call(this)||this;return y._bufferService=r,y._logService=h,y._optionsService=d,y.isCursorInitialized=!1,y.isCursorHidden=!1,y._onData=y.register(new p.EventEmitter),y._onUserInput=y.register(new p.EventEmitter),y._onBinary=y.register(new p.EventEmitter),y._scrollToBottom=i,y.register({dispose:function(){return y._scrollToBottom=void 0}}),y.modes=c.clone(u),y.decPrivateModes=c.clone(s),y}return M(a,t),Object.defineProperty(a.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),a.prototype.reset=function(){this.modes=c.clone(u),this.decPrivateModes=c.clone(s)},a.prototype.triggerDataEvent=function(i,r){if(r===void 0&&(r=!1),!this._optionsService.options.disableStdin){var h=this._bufferService.buffer;h.ybase!==h.ydisp&&this._scrollToBottom(),r&&this._onUserInput.fire(),this._logService.debug('sending data "'+i+'"',function(){return i.split("").map(function(d){return d.charCodeAt(0)})}),this._onData.fire(i)}},a.prototype.triggerBinaryEvent=function(i){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+i+'"',function(){return i.split("").map(function(r){return r.charCodeAt(0)})}),this._onBinary.fire(i))},a=f([S(1,_.IBufferService),S(2,_.ILogService),S(3,_.IOptionsService)],a)}(o.Disposable);L.CoreService=l},function(z,L,D){"use strict";var k=this&&this.__decorate||function(s,l,t,a){var i,r=arguments.length,h=r<3?l:a===null?a=Object.getOwnPropertyDescriptor(l,t):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,t,a);else for(var d=s.length-1;d>=0;d--)(i=s[d])&&(h=(r<3?i(h):r>3?i(l,t,h):i(l,t))||h);return r>3&&h&&Object.defineProperty(l,t,h),h},M=this&&this.__param||function(s,l){return function(t,a){l(t,a,s)}};Object.defineProperty(L,"__esModule",{value:!0}),L.CoreMouseService=void 0;var f=D(1),S=D(0),_={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(s){return s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)}},VT200:{events:19,restrict:function(s){return s.action!==32}},DRAG:{events:23,restrict:function(s){return s.action!==32||s.button!==3}},ANY:{events:31,restrict:function(s){return!0}}};function p(s,l){var t=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(t|=64,t|=s.action):(t|=3&s.button,4&s.button&&(t|=64),8&s.button&&(t|=128),s.action===32?t|=32:s.action!==0||l||(t|=3)),t}var c=String.fromCharCode,o={DEFAULT:function(s){var l=[p(s,!1)+32,s.col+32,s.row+32];return l[0]>255||l[1]>255||l[2]>255?"":""+c(l[0])+c(l[1])+c(l[2])},SGR:function(s){var l=s.action===0&&s.button!==4?"m":"M";return"[<"+p(s,!0)+";"+s.col+";"+s.row+l}},u=function(){function s(l,t){this._bufferService=l,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new S.EventEmitter,this._lastEvent=null;for(var a=0,i=Object.keys(_);a<i.length;a++){var r=i[a];this.addProtocol(r,_[r])}for(var h=0,d=Object.keys(o);h<d.length;h++){var y=d[h];this.addEncoding(y,o[y])}this.reset()}return s.prototype.addProtocol=function(l,t){this._protocols[l]=t},s.prototype.addEncoding=function(l,t){this._encodings[l]=t},Object.defineProperty(s.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(l){if(!this._protocols[l])throw new Error('unknown protocol "'+l+'"');this._activeProtocol=l,this._onProtocolChange.fire(this._protocols[l].events)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"areMouseEventsActive",{get:function(){return this._protocols[this._activeProtocol].events!==0},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(l){if(!this._encodings[l])throw new Error('unknown encoding "'+l+'"');this._activeEncoding=l},enumerable:!1,configurable:!0}),s.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(s.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!1,configurable:!0}),s.prototype.triggerMouseEvent=function(l){if(l.col<0||l.col>=this._bufferService.cols||l.row<0||l.row>=this._bufferService.rows)return!1;if(l.button===4&&l.action===32)return!1;if(l.button===3&&l.action!==32)return!1;if(l.button!==4&&(l.action===2||l.action===3))return!1;if(l.col++,l.row++,l.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,l))return!1;if(!this._protocols[this._activeProtocol].restrict(l))return!1;var t=this._encodings[this._activeEncoding](l);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=l,!0},s.prototype.explainEvents=function(l){return{down:!!(1&l),up:!!(2&l),drag:!!(4&l),move:!!(8&l),wheel:!!(16&l)}},s.prototype._compareEvents=function(l,t){return l.col===t.col&&(l.row===t.row&&(l.button===t.button&&(l.action===t.action&&(l.ctrl===t.ctrl&&l.alt===t.alt))))&&l.shift===t.shift},s=k([M(0,f.IBufferService),M(1,f.ICoreService)],s)}();L.CoreMouseService=u},function(z,L,D){"use strict";var k=this&&this.__decorate||function(_,p,c,o){var u,s=arguments.length,l=s<3?p:o===null?o=Object.getOwnPropertyDescriptor(p,c):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(_,p,c,o);else for(var t=_.length-1;t>=0;t--)(u=_[t])&&(l=(s<3?u(l):s>3?u(p,c,l):u(p,c))||l);return s>3&&l&&Object.defineProperty(p,c,l),l},M=this&&this.__param||function(_,p){return function(c,o){p(c,o,_)}};Object.defineProperty(L,"__esModule",{value:!0}),L.DirtyRowService=void 0;var f=D(1),S=function(){function _(p){this._bufferService=p,this.clearRange()}return Object.defineProperty(_.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),_.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},_.prototype.markDirty=function(p){p<this._start?this._start=p:p>this._end&&(this._end=p)},_.prototype.markRangeDirty=function(p,c){if(p>c){var o=p;p=c,c=o}p<this._start&&(this._start=p),c>this._end&&(this._end=c)},_.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},_=k([M(0,f.IBufferService)],_)}();L.DirtyRowService=S},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.UnicodeService=void 0;var k=D(0),M=D(79),f=function(){function S(){this._providers=Object.create(null),this._active="",this._onChange=new k.EventEmitter;var _=new M.UnicodeV6;this.register(_),this._active=_.version,this._activeProvider=_}return Object.defineProperty(S.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"activeVersion",{get:function(){return this._active},set:function(_){if(!this._providers[_])throw new Error('unknown Unicode version "'+_+'"');this._active=_,this._activeProvider=this._providers[_],this._onChange.fire(_)},enumerable:!1,configurable:!0}),S.prototype.register=function(_){this._providers[_.version]=_},S.prototype.wcwidth=function(_){return this._activeProvider.wcwidth(_)},S.prototype.getStringCellWidth=function(_){for(var p=0,c=_.length,o=0;o<c;++o){var u=_.charCodeAt(o);if(55296<=u&&u<=56319){if(++o>=c)return p+this.wcwidth(u);var s=_.charCodeAt(o);56320<=s&&s<=57343?u=1024*(u-55296)+s-56320+65536:p+=this.wcwidth(s)}p+=this.wcwidth(u)}return p},S}();L.UnicodeService=f},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.UnicodeV6=void 0;var k,M=D(15),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],S=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],_=function(){function p(){if(this.version="6",!k){k=new Uint8Array(65536),M.fill(k,1),k[0]=0,M.fill(k,0,1,32),M.fill(k,0,127,160),M.fill(k,2,4352,4448),k[9001]=2,k[9002]=2,M.fill(k,2,11904,42192),k[12351]=1,M.fill(k,2,44032,55204),M.fill(k,2,63744,64256),M.fill(k,2,65040,65050),M.fill(k,2,65072,65136),M.fill(k,2,65280,65377),M.fill(k,2,65504,65511);for(var c=0;c<f.length;++c)M.fill(k,0,f[c][0],f[c][1]+1)}}return p.prototype.wcwidth=function(c){return c<32?0:c<127?1:c<65536?k[c]:function(o,u){var s,l=0,t=u.length-1;if(o<u[0][0]||o>u[t][1])return!1;for(;t>=l;)if(o>u[s=l+t>>1][1])l=s+1;else{if(!(o<u[s][0]))return!0;t=s-1}return!1}(c,S)?0:c>=131072&&c<=196605||c>=196608&&c<=262141?2:1},p}();L.UnicodeV6=_},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.CharsetService=void 0;var k=function(){function M(){this.glevel=0,this._charsets=[]}return M.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},M.prototype.setgLevel=function(f){this.glevel=f,this.charset=this._charsets[f]},M.prototype.setgCharset=function(f,S){this._charsets[f]=S,this.glevel===f&&(this.charset=S)},M}();L.CharsetService=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.updateWindowsModeWrappedState=void 0;var k=D(3);L.updateWindowsModeWrappedState=function(M){var f=M.buffer.lines.get(M.buffer.ybase+M.buffer.y-1),S=f==null?void 0:f.get(M.cols-1),_=M.buffer.lines.get(M.buffer.ybase+M.buffer.y);_&&S&&(_.isWrapped=S[k.CHAR_DATA_CODE_INDEX]!==k.NULL_CELL_CODE&&S[k.CHAR_DATA_CODE_INDEX]!==k.WHITESPACE_CELL_CODE)}},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.WriteBuffer=void 0;var k=function(){function M(f){this._action=f,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return M.prototype.writeSync=function(f){if(this._writeBuffer.length){for(var S=this._bufferOffset;S<this._writeBuffer.length;++S){var _=this._writeBuffer[S],p=this._callbacks[S];this._action(_),p&&p()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(f)},M.prototype.write=function(f,S){var _=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return _._innerWrite()})),this._pendingData+=f.length,this._writeBuffer.push(f),this._callbacks.push(S)},M.prototype._innerWrite=function(){for(var f=this,S=Date.now();this._writeBuffer.length>this._bufferOffset;){var _=this._writeBuffer[this._bufferOffset],p=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(_),this._pendingData-=_.length,p&&p(),Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return f._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},M}();L.WriteBuffer=k},function(z,L,D){"use strict";Object.defineProperty(L,"__esModule",{value:!0}),L.AddonManager=void 0;var k=function(){function M(){this._addons=[]}return M.prototype.dispose=function(){for(var f=this._addons.length-1;f>=0;f--)this._addons[f].instance.dispose()},M.prototype.loadAddon=function(f,S){var _=this,p={instance:S,dispose:S.dispose,isDisposed:!1};this._addons.push(p),S.dispose=function(){return _._wrappedAddonDispose(p)},S.activate(f)},M.prototype._wrappedAddonDispose=function(f){if(!f.isDisposed){for(var S=-1,_=0;_<this._addons.length;_++)if(this._addons[_]===f){S=_;break}if(S===-1)throw new Error("Could not dispose an addon that has not been loaded");f.isDisposed=!0,f.dispose.apply(f.instance),this._addons.splice(S,1)}},M}();L.AddonManager=k}])})},"/cxE":function(ot,se,ee){"use strict";ee.d(se,"e",function(){return D}),ee.d(se,"f",function(){return k}),ee.d(se,"g",function(){return M}),ee.d(se,"d",function(){return S}),ee.d(se,"a",function(){return _}),ee.d(se,"b",function(){return p}),ee.d(se,"c",function(){return c});var z=function(){function o(){this.listeners=[],this.unexpectedErrorHandler=function(u){setTimeout(function(){throw u.stack?new Error(u.message+`
`+u.stack):u},0)}}return o.prototype.emit=function(u){this.listeners.forEach(function(s){s(u)})},o.prototype.onUnexpectedError=function(u){this.unexpectedErrorHandler(u),this.emit(u)},o.prototype.onUnexpectedExternalError=function(u){this.unexpectedErrorHandler(u)},o}(),L=new z;function D(o){S(o)||L.onUnexpectedError(o);return}function k(o){S(o)||L.onUnexpectedExternalError(o);return}function M(o){if(o instanceof Error){var u=o.name,s=o.message,l=o.stacktrace||o.stack;return{$isError:!0,name:u,message:s,stack:l}}return o}var f="Canceled";function S(o){return o instanceof Error&&o.name===f&&o.message===f}function _(){var o=new Error(f);return o.name=o.message,o}function p(o){return o?new Error("Illegal argument: "+o):new Error("Illegal argument")}function c(o){return o?new Error("Illegal state: "+o):new Error("Illegal state")}},"07cG":function(ot,se,ee){ot.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(ot,se,ee){(function(z){z(ee("VrN/"))})(function(z){z.defineOption("placeholder","",function(_,p,c){var o=c&&c!=z.Init;if(p&&!o)_.on("blur",M),_.on("change",f),_.on("swapDoc",f),z.on(_.getInputField(),"compositionupdate",_.state.placeholderCompose=function(){k(_)}),f(_);else if(!p&&o){_.off("blur",M),_.off("change",f),_.off("swapDoc",f),z.off(_.getInputField(),"compositionupdate",_.state.placeholderCompose),L(_);var u=_.getWrapperElement();u.className=u.className.replace(" CodeMirror-empty","")}p&&!_.hasFocus()&&M(_)});function L(_){_.state.placeholder&&(_.state.placeholder.parentNode.removeChild(_.state.placeholder),_.state.placeholder=null)}function D(_){L(_);var p=_.state.placeholder=document.createElement("pre");p.style.cssText="height: 0; overflow: visible",p.style.direction=_.getOption("direction"),p.className="CodeMirror-placeholder CodeMirror-line-like";var c=_.getOption("placeholder");typeof c=="string"&&(c=document.createTextNode(c)),p.appendChild(c),_.display.lineSpace.insertBefore(p,_.display.lineSpace.firstChild)}function k(_){setTimeout(function(){var p=!1,c=_.getInputField();c.nodeName=="TEXTAREA"?p=!c.value:_.lineCount()==1&&(p=!/[^\u200b]/.test(c.querySelector(".CodeMirror-line").textContent)),p?D(_):L(_)},20)}function M(_){S(_)&&D(_)}function f(_){var p=_.getWrapperElement(),c=S(_);p.className=p.className.replace(" CodeMirror-empty","")+(c?" CodeMirror-empty":""),c?D(_):L(_)}function S(_){return _.lineCount()===1&&_.getLine(0)===""}})},"1dTM":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=ee("GQ8N"),L=w(ee("Lo0S")),D=ee("VSMT"),k=ee("GdRQ"),M=ee("SZEN"),f=ee("vewr"),S=x(ee("YJ9k")),_=x(ee("MZdM")),p=x(ee("ItS6")),c=x(ee("whVF")),o=x(ee("Fv0C")),u=x(ee("LCi9")),s=x(ee("rwxt")),l=x(ee("Mmt2")),t=x(ee("iUHT")),a=x(ee("mHUz")),i=x(ee("P2ho")),r=ee("NBmB");ee("mdZa");var h=x(ee("34/K")),d=x(ee("hXwI")),y=x(ee("SgaC")),m=x(ee("3690")),C=x(ee("8K/p")),T=x(ee("xO64"));function x(ke){return ke&&ke.__esModule?ke:{default:ke}}function E(){if(typeof WeakMap!="function")return null;var ke=new WeakMap;return E=function(){return ke},ke}function w(ke){if(ke&&ke.__esModule)return ke;if(ke===null||A(ke)!=="object"&&typeof ke!="function")return{default:ke};var Fe=E();if(Fe&&Fe.has(ke))return Fe.get(ke);var Ne={},Me=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var ne in ke)if(Object.prototype.hasOwnProperty.call(ke,ne)){var _e=Me?Object.getOwnPropertyDescriptor(ke,ne):null;_e&&(_e.get||_e.set)?Object.defineProperty(Ne,ne,_e):Ne[ne]=ke[ne]}return Ne.default=ke,Fe&&Fe.set(ke,Ne),Ne}function A(ke){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(Ne){return typeof Ne}:A=function(Ne){return Ne&&typeof Symbol=="function"&&Ne.constructor===Symbol&&Ne!==Symbol.prototype?"symbol":typeof Ne},A(ke)}function g(ke,Fe){if(!(ke instanceof Fe))throw new TypeError("Cannot call a class as a function")}function P(ke,Fe){for(var Ne=0;Ne<Fe.length;Ne++){var Me=Fe[Ne];Me.enumerable=Me.enumerable||!1,Me.configurable=!0,"value"in Me&&(Me.writable=!0),Object.defineProperty(ke,Me.key,Me)}}function O(ke,Fe,Ne){return Fe&&P(ke.prototype,Fe),Ne&&P(ke,Ne),ke}function F(ke,Fe){if(typeof Fe!="function"&&Fe!==null)throw new TypeError("Super expression must either be null or a function");ke.prototype=Object.create(Fe&&Fe.prototype,{constructor:{value:ke,writable:!0,configurable:!0}}),Fe&&X(ke,Fe)}function X(ke,Fe){return X=Object.setPrototypeOf||function(Me,ne){return Me.__proto__=ne,Me},X(ke,Fe)}function W(ke){var Fe=U();return function(){var Me=H(ke),ne;if(Fe){var _e=H(this).constructor;ne=Reflect.construct(Me,arguments,_e)}else ne=Me.apply(this,arguments);return N(this,ne)}}function N(ke,Fe){return Fe&&(A(Fe)==="object"||typeof Fe=="function")?Fe:G(ke)}function G(ke){if(ke===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return ke}function U(){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(ke){return!1}}function H(ke){return H=Object.setPrototypeOf?Object.getPrototypeOf:function(Ne){return Ne.__proto__||Object.getPrototypeOf(Ne)},H(ke)}var V=3,ce="rgb(40, 40, 40)",ye=17,Le=50,Ze=19,Ye=75,Oe=50,We=1e3,ze=50,Ae=1,xe=1<<1,le=1<<2,Se=1<<3,pe=1<<4,Ge=1<<24,fe=1<<25,ge=1<<26,De=1<<27,Ve=1<<28,Qe=function(ke){F(Ne,ke);var Fe=W(Ne);function Ne(Me,ne,_e){var ae;if(g(this,Ne),!Me)throw new Error("Must specify target");if(!ne)throw new Error("Must specify URL");ae=Fe.call(this),ae._target=Me,ae._url=ne,_e=_e||{},ae._rfbCredentials=_e.credentials||{},ae._shared="shared"in _e?!!_e.shared:!0,ae._repeaterID=_e.repeaterID||"",ae._wsProtocols=_e.wsProtocols||[],ae._rfbConnectionState="",ae._rfbInitState="",ae._rfbAuthScheme=-1,ae._rfbCleanDisconnect=!0,ae._rfbVersion=0,ae._rfbMaxVersion=3.8,ae._rfbTightVNC=!1,ae._rfbVeNCryptState=0,ae._rfbXvpVer=0,ae._fbWidth=0,ae._fbHeight=0,ae._fbName="",ae._capabilities={power:!1},ae._supportsFence=!1,ae._supportsContinuousUpdates=!1,ae._enabledContinuousUpdates=!1,ae._supportsSetDesktopSize=!1,ae._screenID=0,ae._screenFlags=0,ae._qemuExtKeyEventSupported=!1,ae._clipboardText=null,ae._clipboardServerCapabilitiesActions={},ae._clipboardServerCapabilitiesFormats={},ae._sock=null,ae._display=null,ae._flushing=!1,ae._keyboard=null,ae._gestures=null,ae._disconnTimer=null,ae._resizeTimeout=null,ae._mouseMoveTimer=null,ae._decoders={},ae._FBU={rects:0,x:0,y:0,width:0,height:0,encoding:null},ae._mousePos={},ae._mouseButtonMask=0,ae._mouseLastMoveTime=0,ae._viewportDragging=!1,ae._viewportDragPos={},ae._viewportHasMoved=!1,ae._accumulatedWheelDeltaX=0,ae._accumulatedWheelDeltaY=0,ae._gestureLastTapTime=null,ae._gestureFirstDoubleTapEv=null,ae._gestureLastMagnitudeX=0,ae._gestureLastMagnitudeY=0,ae._eventHandlers={focusCanvas:ae._focusCanvas.bind(G(ae)),windowResize:ae._windowResize.bind(G(ae)),handleMouse:ae._handleMouse.bind(G(ae)),handleWheel:ae._handleWheel.bind(G(ae)),handleGesture:ae._handleGesture.bind(G(ae))},L.Debug(">> RFB.constructor"),ae._screen=document.createElement("div"),ae._screen.style.display="flex",ae._screen.style.width="100%",ae._screen.style.height="100%",ae._screen.style.overflow="auto",ae._screen.style.background=ce,ae._canvas=document.createElement("canvas"),ae._canvas.style.margin="auto",ae._canvas.style.outline="none",ae._canvas.style.flexShrink="0",ae._canvas.width=0,ae._canvas.height=0,ae._canvas.tabIndex=-1,ae._screen.appendChild(ae._canvas),ae._cursor=new s.default,ae._cursorImage=Ne.cursors.none,ae._decoders[r.encodings.encodingRaw]=new h.default,ae._decoders[r.encodings.encodingCopyRect]=new d.default,ae._decoders[r.encodings.encodingRRE]=new y.default,ae._decoders[r.encodings.encodingHextile]=new m.default,ae._decoders[r.encodings.encodingTight]=new C.default,ae._decoders[r.encodings.encodingTightPNG]=new T.default;try{ae._display=new _.default(ae._canvas)}catch(Ie){throw L.Error("Display exception: "+Ie),Ie}return ae._display.onflush=ae._onFlush.bind(G(ae)),ae._keyboard=new o.default(ae._canvas),ae._keyboard.onkeyevent=ae._handleKeyEvent.bind(G(ae)),ae._gestures=new u.default,ae._sock=new l.default,ae._sock.on("message",function(){ae._handleMessage()}),ae._sock.on("open",function(){ae._rfbConnectionState==="connecting"&&ae._rfbInitState===""?(ae._rfbInitState="ProtocolVersion",L.Debug("Starting VNC handshake")):ae._fail("Unexpected server connection while "+ae._rfbConnectionState)}),ae._sock.on("close",function(Ie){L.Debug("WebSocket on-close event");var Je="";Ie.code&&(Je="(code: "+Ie.code,Ie.reason&&(Je+=", reason: "+Ie.reason),Je+=")");switch(ae._rfbConnectionState){case"connecting":ae._fail("Connection closed "+Je);break;case"connected":ae._updateConnectionState("disconnecting"),ae._updateConnectionState("disconnected");break;case"disconnecting":ae._updateConnectionState("disconnected");break;case"disconnected":ae._fail("Unexpected server disconnect when already disconnected "+Je);break;default:ae._fail("Unexpected server disconnect before connecting "+Je);break}ae._sock.off("close")}),ae._sock.on("error",function(Ie){return L.Warn("WebSocket on-error event")}),setTimeout(ae._updateConnectionState.bind(G(ae),"connecting")),L.Debug("<< RFB.constructor"),ae.dragViewport=!1,ae.focusOnClick=!0,ae._viewOnly=!1,ae._clipViewport=!1,ae._scaleViewport=!1,ae._resizeSession=!1,ae._showDotCursor=!1,_e.showDotCursor!==void 0&&(L.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated"),ae._showDotCursor=_e.showDotCursor),ae._qualityLevel=6,ae._compressionLevel=2,ae}return O(Ne,[{key:"disconnect",value:function(){this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open")}},{key:"sendCredentials",value:function(ne){this._rfbCredentials=ne,setTimeout(this._initMsg.bind(this),0)}},{key:"sendCtrlAltDel",value:function(){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;L.Info("Sending Ctrl-Alt-Del"),this.sendKey(a.default.XK_Control_L,"ControlLeft",!0),this.sendKey(a.default.XK_Alt_L,"AltLeft",!0),this.sendKey(a.default.XK_Delete,"Delete",!0),this.sendKey(a.default.XK_Delete,"Delete",!1),this.sendKey(a.default.XK_Alt_L,"AltLeft",!1),this.sendKey(a.default.XK_Control_L,"ControlLeft",!1)}},{key:"machineShutdown",value:function(){this._xvpOp(1,2)}},{key:"machineReboot",value:function(){this._xvpOp(1,3)}},{key:"machineReset",value:function(){this._xvpOp(1,4)}},{key:"sendKey",value:function(ne,_e,ae){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(ae===void 0){this.sendKey(ne,_e,!0),this.sendKey(ne,_e,!1);return}var Ie=i.default[_e];if(this._qemuExtKeyEventSupported&&Ie)ne=ne||0,L.Info("Sending key ("+(ae?"down":"up")+"): keysym "+ne+", scancode "+Ie),Ne.messages.QEMUExtendedKeyEvent(this._sock,ne,ae,Ie);else{if(!ne)return;L.Info("Sending keysym ("+(ae?"down":"up")+"): "+ne),Ne.messages.keyEvent(this._sock,ne,ae?1:0)}}},{key:"focus",value:function(){this._canvas.focus()}},{key:"blur",value:function(){this._canvas.blur()}},{key:"clipboardPasteFrom",value:function(ne){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(this._clipboardServerCapabilitiesFormats[Ae]&&this._clipboardServerCapabilitiesActions[De])this._clipboardText=ne,Ne.messages.extendedClipboardNotify(this._sock,[Ae]);else{for(var _e=new Uint8Array(ne.length),ae=0;ae<ne.length;ae++)_e[ae]=ne.charCodeAt(ae);Ne.messages.clientCutText(this._sock,_e)}}},{key:"_connect",value:function(){L.Debug(">> RFB.connect"),L.Info("connecting to "+this._url);try{this._sock.open(this._url,this._wsProtocols)}catch(ne){ne.name==="SyntaxError"?this._fail("Invalid host or port ("+ne+")"):this._fail("Error when opening socket ("+ne+")")}this._target.appendChild(this._screen),this._gestures.attach(this._canvas),this._cursor.attach(this._canvas),this._refreshCursor(),window.addEventListener("resize",this._eventHandlers.windowResize),this._canvas.addEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.addEventListener("touchstart",this._eventHandlers.focusCanvas),this._canvas.addEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.addEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.addEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.addEventListener("click",this._eventHandlers.handleMouse),this._canvas.addEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.addEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.addEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.addEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.addEventListener("gestureend",this._eventHandlers.handleGesture),L.Debug("<< RFB.connect")}},{key:"_disconnect",value:function(){L.Debug(">> RFB.disconnect"),this._cursor.detach(),this._canvas.removeEventListener("gesturestart",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gesturemove",this._eventHandlers.handleGesture),this._canvas.removeEventListener("gestureend",this._eventHandlers.handleGesture),this._canvas.removeEventListener("wheel",this._eventHandlers.handleWheel),this._canvas.removeEventListener("mousedown",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mouseup",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousemove",this._eventHandlers.handleMouse),this._canvas.removeEventListener("click",this._eventHandlers.handleMouse),this._canvas.removeEventListener("contextmenu",this._eventHandlers.handleMouse),this._canvas.removeEventListener("mousedown",this._eventHandlers.focusCanvas),this._canvas.removeEventListener("touchstart",this._eventHandlers.focusCanvas),window.removeEventListener("resize",this._eventHandlers.windowResize),this._keyboard.ungrab(),this._gestures.detach(),this._sock.close();try{this._target.removeChild(this._screen)}catch(ne){if(!(ne.name==="NotFoundError"))throw ne}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),L.Debug("<< RFB.disconnect")}},{key:"_focusCanvas",value:function(ne){if(!this.focusOnClick)return;this.focus()}},{key:"_setDesktopName",value:function(ne){this._fbName=ne,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}},{key:"_windowResize",value:function(ne){var _e=this;window.requestAnimationFrame(function(){_e._updateClip(),_e._updateScale()}),this._resizeSession&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),500))}},{key:"_updateClip",value:function(){var ne=this._display.clipViewport,_e=this._clipViewport;if(this._scaleViewport&&(_e=!1),ne!==_e&&(this._display.clipViewport=_e),_e){var ae=this._screenSize();this._display.viewportChangeSize(ae.w,ae.h),this._fixScrollbars()}}},{key:"_updateScale",value:function(){if(!this._scaleViewport)this._display.scale=1;else{var ne=this._screenSize();this._display.autoscale(ne.w,ne.h)}this._fixScrollbars()}},{key:"_requestRemoteResize",value:function(){if(clearTimeout(this._resizeTimeout),this._resizeTimeout=null,!this._resizeSession||this._viewOnly||!this._supportsSetDesktopSize)return;var ne=this._screenSize();Ne.messages.setDesktopSize(this._sock,Math.floor(ne.w),Math.floor(ne.h),this._screenID,this._screenFlags),L.Debug("Requested new desktop size: "+ne.w+"x"+ne.h)}},{key:"_screenSize",value:function(){var ne=this._screen.getBoundingClientRect();return{w:ne.width,h:ne.height}}},{key:"_fixScrollbars",value:function(){var ne=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=ne}},{key:"_updateConnectionState",value:function(ne){var _e=this,ae=this._rfbConnectionState;if(ne===ae){L.Debug("Already in state '"+ne+"', ignoring");return}if(ae==="disconnected"){L.Error("Tried changing state of a disconnected RFB object");return}switch(ne){case"connected":if(ae!=="connecting"){L.Error("Bad transition to connected state, previous connection state: "+ae);return}break;case"disconnected":if(ae!=="disconnecting"){L.Error("Bad transition to disconnected state, previous connection state: "+ae);return}break;case"connecting":if(ae!==""){L.Error("Bad transition to connecting state, previous connection state: "+ae);return}break;case"disconnecting":if(ae!=="connected"&&ae!=="connecting"){L.Error("Bad transition to disconnecting state, previous connection state: "+ae);return}break;default:L.Error("Unknown connection state: "+ne);return}this._rfbConnectionState=ne,L.Debug("New state '"+ne+"', was '"+ae+"'."),this._disconnTimer&&ne!=="disconnecting"&&(L.Debug("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close"));switch(ne){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout(function(){L.Error("Disconnection timed out."),_e._updateConnectionState("disconnected")},V*1e3);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}));break}}},{key:"_fail",value:function(ne){switch(this._rfbConnectionState){case"disconnecting":L.Error("Failed when disconnecting: "+ne);break;case"connected":L.Error("Failed while connected: "+ne);break;case"connecting":L.Error("Failed when connecting: "+ne);break;default:L.Error("RFB failure: "+ne);break}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}},{key:"_setCapability",value:function(ne,_e){this._capabilities[ne]=_e,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}},{key:"_handleMessage",value:function(){if(this._sock.rQlen===0){L.Warn("handleMessage called on an empty receive queue");return}switch(this._rfbConnectionState){case"disconnected":L.Error("Got data while disconnected");break;case"connected":for(;!this._flushing;){if(!this._normalMsg())break;if(this._sock.rQlen===0)break}break;default:this._initMsg();break}}},{key:"_handleKeyEvent",value:function(ne,_e,ae){this.sendKey(ne,_e,ae)}},{key:"_handleMouse",value:function(ne){if(ne.type==="click"&&ne.target!==this._canvas)return;if(ne.stopPropagation(),ne.preventDefault(),ne.type==="click"||ne.type==="contextmenu")return;var _e=(0,M.clientToElement)(ne.clientX,ne.clientY,this._canvas);switch(ne.type){case"mousedown":(0,f.setCapture)(this._canvas),this._handleMouseButton(_e.x,_e.y,!0,1<<ne.button);break;case"mouseup":this._handleMouseButton(_e.x,_e.y,!1,1<<ne.button);break;case"mousemove":this._handleMouseMove(_e.x,_e.y);break}}},{key:"_handleMouseButton",value:function(ne,_e,ae,Ie){if(this.dragViewport)if(ae&&!this._viewportDragging){this._viewportDragging=!0,this._viewportDragPos={x:ne,y:_e},this._viewportHasMoved=!1;return}else{if(this._viewportDragging=!1,this._viewportHasMoved)return;this._sendMouse(ne,_e,Ie)}this._mouseMoveTimer!==null&&(clearTimeout(this._mouseMoveTimer),this._mouseMoveTimer=null,this._sendMouse(ne,_e,this._mouseButtonMask)),ae?this._mouseButtonMask|=Ie:this._mouseButtonMask&=~Ie,this._sendMouse(ne,_e,this._mouseButtonMask)}},{key:"_handleMouseMove",value:function(ne,_e){var ae=this;if(this._viewportDragging){var Ie=this._viewportDragPos.x-ne,Je=this._viewportDragPos.y-_e;(this._viewportHasMoved||Math.abs(Ie)>k.dragThreshold||Math.abs(Je)>k.dragThreshold)&&(this._viewportHasMoved=!0,this._viewportDragPos={x:ne,y:_e},this._display.viewportChangePos(Ie,Je));return}if(this._mousePos={x:ne,y:_e},this._mouseMoveTimer==null){var et=Date.now()-this._mouseLastMoveTime;et>ye?(this._sendMouse(ne,_e,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()):this._mouseMoveTimer=setTimeout(function(){ae._handleDelayedMouseMove()},ye-et)}}},{key:"_handleDelayedMouseMove",value:function(){this._mouseMoveTimer=null,this._sendMouse(this._mousePos.x,this._mousePos.y,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()}},{key:"_sendMouse",value:function(ne,_e,ae){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;Ne.messages.pointerEvent(this._sock,this._display.absX(ne),this._display.absY(_e),ae)}},{key:"_handleWheel",value:function(ne){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;ne.stopPropagation(),ne.preventDefault();var _e=(0,M.clientToElement)(ne.clientX,ne.clientY,this._canvas),ae=ne.deltaX,Ie=ne.deltaY;ne.deltaMode!==0&&(ae*=Ze,Ie*=Ze),this._accumulatedWheelDeltaX+=ae,this._accumulatedWheelDeltaY+=Ie,Math.abs(this._accumulatedWheelDeltaX)>=Le&&(this._accumulatedWheelDeltaX<0?(this._handleMouseButton(_e.x,_e.y,!0,1<<5),this._handleMouseButton(_e.x,_e.y,!1,1<<5)):this._accumulatedWheelDeltaX>0&&(this._handleMouseButton(_e.x,_e.y,!0,1<<6),this._handleMouseButton(_e.x,_e.y,!1,1<<6)),this._accumulatedWheelDeltaX=0),Math.abs(this._accumulatedWheelDeltaY)>=Le&&(this._accumulatedWheelDeltaY<0?(this._handleMouseButton(_e.x,_e.y,!0,1<<3),this._handleMouseButton(_e.x,_e.y,!1,1<<3)):this._accumulatedWheelDeltaY>0&&(this._handleMouseButton(_e.x,_e.y,!0,1<<4),this._handleMouseButton(_e.x,_e.y,!1,1<<4)),this._accumulatedWheelDeltaY=0)}},{key:"_fakeMouseMove",value:function(ne,_e,ae){this._handleMouseMove(_e,ae),this._cursor.move(ne.detail.clientX,ne.detail.clientY)}},{key:"_handleTapEvent",value:function(ne,_e){var ae=(0,M.clientToElement)(ne.detail.clientX,ne.detail.clientY,this._canvas);if(this._gestureLastTapTime!==null&&Date.now()-this._gestureLastTapTime<We&&this._gestureFirstDoubleTapEv.detail.type===ne.detail.type){var Ie=this._gestureFirstDoubleTapEv.detail.clientX-ne.detail.clientX,Je=this._gestureFirstDoubleTapEv.detail.clientY-ne.detail.clientY,et=Math.hypot(Ie,Je);et<ze?ae=(0,M.clientToElement)(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas):this._gestureFirstDoubleTapEv=ne}else this._gestureFirstDoubleTapEv=ne;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,ae.x,ae.y),this._handleMouseButton(ae.x,ae.y,!0,_e),this._handleMouseButton(ae.x,ae.y,!1,_e)}},{key:"_handleGesture",value:function(ne){var _e,ae=(0,M.clientToElement)(ne.detail.clientX,ne.detail.clientY,this._canvas);switch(ne.type){case"gesturestart":switch(ne.detail.type){case"onetap":this._handleTapEvent(ne,1);break;case"twotap":this._handleTapEvent(ne,4);break;case"threetap":this._handleTapEvent(ne,2);break;case"drag":this._fakeMouseMove(ne,ae.x,ae.y),this._handleMouseButton(ae.x,ae.y,!0,1);break;case"longpress":this._fakeMouseMove(ne,ae.x,ae.y),this._handleMouseButton(ae.x,ae.y,!0,4);break;case"twodrag":this._gestureLastMagnitudeX=ne.detail.magnitudeX,this._gestureLastMagnitudeY=ne.detail.magnitudeY,this._fakeMouseMove(ne,ae.x,ae.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot(ne.detail.magnitudeX,ne.detail.magnitudeY),this._fakeMouseMove(ne,ae.x,ae.y);break}break;case"gesturemove":switch(ne.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":this._fakeMouseMove(ne,ae.x,ae.y);break;case"twodrag":for(this._fakeMouseMove(ne,ae.x,ae.y);ne.detail.magnitudeY-this._gestureLastMagnitudeY>Oe;)this._handleMouseButton(ae.x,ae.y,!0,8),this._handleMouseButton(ae.x,ae.y,!1,8),this._gestureLastMagnitudeY+=Oe;for(;ne.detail.magnitudeY-this._gestureLastMagnitudeY<-Oe;)this._handleMouseButton(ae.x,ae.y,!0,16),this._handleMouseButton(ae.x,ae.y,!1,16),this._gestureLastMagnitudeY-=Oe;for(;ne.detail.magnitudeX-this._gestureLastMagnitudeX>Oe;)this._handleMouseButton(ae.x,ae.y,!0,32),this._handleMouseButton(ae.x,ae.y,!1,32),this._gestureLastMagnitudeX+=Oe;for(;ne.detail.magnitudeX-this._gestureLastMagnitudeX<-Oe;)this._handleMouseButton(ae.x,ae.y,!0,64),this._handleMouseButton(ae.x,ae.y,!1,64),this._gestureLastMagnitudeX-=Oe;break;case"pinch":if(this._fakeMouseMove(ne,ae.x,ae.y),_e=Math.hypot(ne.detail.magnitudeX,ne.detail.magnitudeY),Math.abs(_e-this._gestureLastMagnitudeX)>Ye){for(this._handleKeyEvent(a.default.XK_Control_L,"ControlLeft",!0);_e-this._gestureLastMagnitudeX>Ye;)this._handleMouseButton(ae.x,ae.y,!0,8),this._handleMouseButton(ae.x,ae.y,!1,8),this._gestureLastMagnitudeX+=Ye;for(;_e-this._gestureLastMagnitudeX<-Ye;)this._handleMouseButton(ae.x,ae.y,!0,16),this._handleMouseButton(ae.x,ae.y,!1,16),this._gestureLastMagnitudeX-=Ye}this._handleKeyEvent(a.default.XK_Control_L,"ControlLeft",!1);break}break;case"gestureend":switch(ne.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":this._fakeMouseMove(ne,ae.x,ae.y),this._handleMouseButton(ae.x,ae.y,!1,1);break;case"longpress":this._fakeMouseMove(ne,ae.x,ae.y),this._handleMouseButton(ae.x,ae.y,!1,4);break}break}}},{key:"_negotiateProtocolVersion",value:function(){if(this._sock.rQwait("version",12))return!1;var ne=this._sock.rQshiftStr(12).substr(4,7);L.Info("Server ProtocolVersion: "+ne);var _e=0;switch(ne){case"000.000":_e=1;break;case"003.003":case"003.006":case"003.889":this._rfbVersion=3.3;break;case"003.007":this._rfbVersion=3.7;break;case"003.008":case"004.000":case"004.001":case"005.000":this._rfbVersion=3.8;break;default:return this._fail("Invalid server version "+ne)}if(_e){for(var ae="ID:"+this._repeaterID;ae.length<250;)ae+="\0";return this._sock.sendString(ae),!0}this._rfbVersion>this._rfbMaxVersion&&(this._rfbVersion=this._rfbMaxVersion);var Ie="00"+parseInt(this._rfbVersion,10)+".00"+this._rfbVersion*10%10;this._sock.sendString("RFB "+Ie+`
`),L.Debug("Sent ProtocolVersion: "+Ie),this._rfbInitState="Security"}},{key:"_negotiateSecurity",value:function(){function ne(Ie,Je){for(var et=0;et<Je.length;et++)if(Je[et]===Ie)return!0;return!1}if(this._rfbVersion>=3.7){var _e=this._sock.rQshift8();if(this._sock.rQwait("security type",_e,1))return!1;if(_e===0)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,this._initMsg();var ae=this._sock.rQshiftBytes(_e);if(L.Debug("Server security types: "+ae),ne(1,ae))this._rfbAuthScheme=1;else if(ne(22,ae))this._rfbAuthScheme=22;else if(ne(16,ae))this._rfbAuthScheme=16;else if(ne(2,ae))this._rfbAuthScheme=2;else if(ne(19,ae))this._rfbAuthScheme=19;else return this._fail("Unsupported security types (types: "+ae+")");this._sock.send([this._rfbAuthScheme])}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),this._rfbAuthScheme==0)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,this._initMsg()}return this._rfbInitState="Authentication",L.Debug("Authenticating using scheme: "+this._rfbAuthScheme),this._initMsg()}},{key:"_handleSecurityReason",value:function(){if(this._sock.rQwait("reason length",4))return!1;var ne=this._sock.rQshift32(),_e="";if(ne>0){if(this._sock.rQwait("reason",ne,4))return!1;_e=this._sock.rQshiftStr(ne)}return _e!==""?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:_e}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+_e+")")):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext))}},{key:"_negotiateXvpAuth",value:function(){if(this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0||this._rfbCredentials.target===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1;var ne=String.fromCharCode(this._rfbCredentials.username.length)+String.fromCharCode(this._rfbCredentials.target.length)+this._rfbCredentials.username+this._rfbCredentials.target;return this._sock.sendString(ne),this._rfbAuthScheme=2,this._negotiateAuthentication()}},{key:"_negotiateVeNCryptAuth",value:function(){if(this._rfbVeNCryptState==0){if(this._sock.rQwait("vencrypt version",2))return!1;var ne=this._sock.rQshift8(),_e=this._sock.rQshift8();if(!(ne==0&&_e==2))return this._fail("Unsupported VeNCrypt version "+ne+"."+_e);this._sock.send([0,2]),this._rfbVeNCryptState=1}if(this._rfbVeNCryptState==1){if(this._sock.rQwait("vencrypt ack",1))return!1;var ae=this._sock.rQshift8();if(ae!=0)return this._fail("VeNCrypt failure "+ae);this._rfbVeNCryptState=2}if(this._rfbVeNCryptState==2){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;var Ie=this._sock.rQshift8();if(Ie<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=Ie,this._rfbVeNCryptState=3}if(this._rfbVeNCryptState==3){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;for(var Je=[],et=0;et<this._rfbVeNCryptSubtypesLength;et++)Je.push(this._sock.rQshift32());if(Je.indexOf(256)!=-1)this._sock.send([0,0,1,0]),this._rfbVeNCryptState=4;else return this._fail("VeNCrypt Plain subtype not offered by server")}if(this._rfbVeNCryptState==4){if(!this._rfbCredentials.username||!this._rfbCredentials.password)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1;var Ke=(0,D.encodeUTF8)(this._rfbCredentials.username),it=(0,D.encodeUTF8)(this._rfbCredentials.password);return this._sock.send([0,0,0,Ke.length]),this._sock.send([0,0,0,it.length]),this._sock.sendString(Ke),this._sock.sendString(it),this._rfbInitState="SecurityResult",!0}}},{key:"_negotiateStdVNCAuth",value:function(){if(this._sock.rQwait("auth challenge",16))return!1;if(this._rfbCredentials.password===void 0)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["password"]}})),!1;var ne=Array.prototype.slice.call(this._sock.rQshiftBytes(16)),_e=Ne.genDES(this._rfbCredentials.password,ne);return this._sock.send(_e),this._rfbInitState="SecurityResult",!0}},{key:"_negotiateTightUnixAuth",value:function(){return this._rfbCredentials.username===void 0||this._rfbCredentials.password===void 0?(this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password"]}})),!1):(this._sock.send([0,0,0,this._rfbCredentials.username.length]),this._sock.send([0,0,0,this._rfbCredentials.password.length]),this._sock.sendString(this._rfbCredentials.username),this._sock.sendString(this._rfbCredentials.password),this._rfbInitState="SecurityResult",!0)}},{key:"_negotiateTightTunnels",value:function(ne){for(var _e={0:{vendor:"TGHT",signature:"NOTUNNEL"}},ae={},Ie=0;Ie<ne;Ie++){var Je=this._sock.rQshift32(),et=this._sock.rQshiftStr(4),Ke=this._sock.rQshiftStr(8);ae[Je]={vendor:et,signature:Ke}}return L.Debug("Server Tight tunnel types: "+ae),ae[1]&&ae[1].vendor==="SICR"&&ae[1].signature==="SCHANNEL"&&(L.Debug("Detected Siemens server. Assuming NOTUNNEL support."),ae[0]={vendor:"TGHT",signature:"NOTUNNEL"}),ae[0]?ae[0].vendor!=_e[0].vendor||ae[0].signature!=_e[0].signature?this._fail("Client's tunnel type had the incorrect vendor or signature"):(L.Debug("Selected tunnel type: "+_e[0]),this._sock.send([0,0,0,0]),!1):this._fail("Server wanted tunnels, but doesn't support the notunnel type")}},{key:"_negotiateTightAuth",value:function(){if(!this._rfbTightVNC){if(this._sock.rQwait("num tunnels",4))return!1;var ne=this._sock.rQshift32();if(ne>0&&this._sock.rQwait("tunnel capabilities",16*ne,4))return!1;if(this._rfbTightVNC=!0,ne>0)return this._negotiateTightTunnels(ne),!1}if(this._sock.rQwait("sub auth count",4))return!1;var _e=this._sock.rQshift32();if(_e===0)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*_e,4))return!1;for(var ae={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},Ie=[],Je=0;Je<_e;Je++){this._sock.rQshift32();var et=this._sock.rQshiftStr(12);Ie.push(et)}L.Debug("Server Tight authentication types: "+Ie);for(var Ke in ae)if(Ie.indexOf(Ke)!=-1){this._sock.send([0,0,0,ae[Ke]]),L.Debug("Selected authentication type: "+Ke);switch(Ke){case"STDVNOAUTH__":return this._rfbInitState="SecurityResult",!0;case"STDVVNCAUTH_":return this._rfbAuthScheme=2,this._initMsg();case"TGHTULGNAUTH":return this._rfbAuthScheme=129,this._initMsg();default:return this._fail("Unsupported tiny auth scheme (scheme: "+Ke+")")}}return this._fail("No supported sub-auth types!")}},{key:"_negotiateAuthentication",value:function(){switch(this._rfbAuthScheme){case 1:return this._rfbVersion>=3.8?(this._rfbInitState="SecurityResult",!0):(this._rfbInitState="ClientInitialisation",this._initMsg());case 22:return this._negotiateXvpAuth();case 2:return this._negotiateStdVNCAuth();case 16:return this._negotiateTightAuth();case 19:return this._negotiateVeNCryptAuth();case 129:return this._negotiateTightUnixAuth();default:return this._fail("Unsupported auth scheme (scheme: "+this._rfbAuthScheme+")")}}},{key:"_handleSecurityResult",value:function(){if(this._sock.rQwait("VNC auth response ",4))return!1;var ne=this._sock.rQshift32();return ne===0?(this._rfbInitState="ClientInitialisation",L.Debug("Authentication OK"),this._initMsg()):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=ne,this._initMsg()):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:ne}})),this._fail("Security handshake failed"))}},{key:"_negotiateServerInit",value:function(){if(this._sock.rQwait("server initialization",24))return!1;var ne=this._sock.rQshift16(),_e=this._sock.rQshift16(),ae=this._sock.rQshift8(),Ie=this._sock.rQshift8(),Je=this._sock.rQshift8(),et=this._sock.rQshift8(),Ke=this._sock.rQshift16(),it=this._sock.rQshift16(),he=this._sock.rQshift16(),Re=this._sock.rQshift8(),He=this._sock.rQshift8(),Ee=this._sock.rQshift8();this._sock.rQskipBytes(3);var ve=this._sock.rQshift32();if(this._sock.rQwait("server init name",ve,24))return!1;var be=this._sock.rQshiftStr(ve);if(be=(0,D.decodeUTF8)(be,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+ve))return!1;var J=this._sock.rQshift16(),oe=this._sock.rQshift16(),Z=this._sock.rQshift16();this._sock.rQskipBytes(2);var me=(J+oe+Z)*16;if(this._sock.rQwait("TightVNC extended server init header",me,32+ve))return!1;this._sock.rQskipBytes(16*J),this._sock.rQskipBytes(16*oe),this._sock.rQskipBytes(16*Z)}return L.Info("Screen: "+ne+"x"+_e+", bpp: "+ae+", depth: "+Ie+", bigEndian: "+Je+", trueColor: "+et+", redMax: "+Ke+", greenMax: "+it+", blueMax: "+he+", redShift: "+Re+", greenShift: "+He+", blueShift: "+Ee),this._setDesktopName(be),this._resize(ne,_e),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,this._fbName==="Intel(r) AMT KVM"&&(L.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),Ne.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),Ne.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}},{key:"_sendEncodings",value:function(){var ne=[];ne.push(r.encodings.encodingCopyRect),this._fbDepth==24&&(ne.push(r.encodings.encodingTight),ne.push(r.encodings.encodingTightPNG),ne.push(r.encodings.encodingHextile),ne.push(r.encodings.encodingRRE)),ne.push(r.encodings.encodingRaw),ne.push(r.encodings.pseudoEncodingQualityLevel0+this._qualityLevel),ne.push(r.encodings.pseudoEncodingCompressLevel0+this._compressionLevel),ne.push(r.encodings.pseudoEncodingDesktopSize),ne.push(r.encodings.pseudoEncodingLastRect),ne.push(r.encodings.pseudoEncodingQEMUExtendedKeyEvent),ne.push(r.encodings.pseudoEncodingExtendedDesktopSize),ne.push(r.encodings.pseudoEncodingXvp),ne.push(r.encodings.pseudoEncodingFence),ne.push(r.encodings.pseudoEncodingContinuousUpdates),ne.push(r.encodings.pseudoEncodingDesktopName),ne.push(r.encodings.pseudoEncodingExtendedClipboard),this._fbDepth==24&&(ne.push(r.encodings.pseudoEncodingVMwareCursor),ne.push(r.encodings.pseudoEncodingCursor)),Ne.messages.clientEncodings(this._sock,ne)}},{key:"_initMsg",value:function(){switch(this._rfbInitState){case"ProtocolVersion":return this._negotiateProtocolVersion();case"Security":return this._negotiateSecurity();case"Authentication":return this._negotiateAuthentication();case"SecurityResult":return this._handleSecurityResult();case"SecurityReason":return this._handleSecurityReason();case"ClientInitialisation":return this._sock.send([this._shared?1:0]),this._rfbInitState="ServerInitialisation",!0;case"ServerInitialisation":return this._negotiateServerInit();default:return this._fail("Unknown init state (state: "+this._rfbInitState+")")}}},{key:"_handleSetColourMapMsg",value:function(){return L.Debug("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}},{key:"_handleServerCutText",value:function(){if(L.Debug("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);var ne=this._sock.rQshift32();if(ne=(0,z.toSigned32bit)(ne),this._sock.rQwait("ServerCutText content",Math.abs(ne),8))return!1;if(ne>=0){var _e=this._sock.rQshiftStr(ne);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:_e}}))}else{ne=Math.abs(ne);var ae=this._sock.rQshift32(),Ie=ae&65535,Je=ae&4278190080,et=!!(Je&Ge);if(et){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(var Ke=0;Ke<=15;Ke++){var it=1<<Ke;Ie&it&&(this._clipboardServerCapabilitiesFormats[it]=!0,this._sock.rQshift32())}for(var he=24;he<=31;he++){var Re=1<<he;this._clipboardServerCapabilitiesActions[Re]=!!(Je&Re)}var He=[Ge,fe,ge,De,Ve];Ne.messages.extendedClipboardCaps(this._sock,He,{extendedClipboardFormatText:0})}else if(Je===fe){if(this._viewOnly)return!0;this._clipboardText!=null&&this._clipboardServerCapabilitiesActions[Ve]&&(Ie&Ae&&Ne.messages.extendedClipboardProvide(this._sock,[Ae],[this._clipboardText]))}else if(Je===ge){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[De]&&(this._clipboardText!=null?Ne.messages.extendedClipboardNotify(this._sock,[Ae]):Ne.messages.extendedClipboardNotify(this._sock,[]))}else if(Je===De){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[fe]&&(Ie&Ae&&Ne.messages.extendedClipboardRequest(this._sock,[Ae]))}else if(Je===Ve){if(this._viewOnly)return!0;if(!(Ie&Ae))return!0;this._clipboardText=null;var Ee=this._sock.rQshiftBytes(ne-4),ve=new p.default,be=null;ve.setInput(Ee);for(var J=0;J<=15;J++){var oe=1<<J;if(Ie&oe){var Z=0,me=ve.inflate(4);Z|=me[0]<<24,Z|=me[1]<<16,Z|=me[2]<<8,Z|=me[3];var Xe=ve.inflate(Z);oe===Ae&&(be=Xe)}}if(ve.setInput(null),be!==null){for(var j="",we=0;we<be.length;we++)j+=String.fromCharCode(be[we]);be=j,be=(0,D.decodeUTF8)(be),be.length>0&&be.charAt(be.length-1)==="\0"&&(be=be.slice(0,-1)),be=be.replace(`\r
`,`
`),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:be}}))}}else return this._fail("Unexpected action in extended clipboard message: "+Je)}return!0}},{key:"_handleServerFenceMsg",value:function(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);var ne=this._sock.rQshift32(),_e=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",_e,9))return!1;_e>64&&(L.Warn("Bad payload length ("+_e+") in fence response"),_e=64);var ae=this._sock.rQshiftStr(_e);return this._supportsFence=!0,ne&1<<31?(ne&=1<<0|1<<1,Ne.messages.clientFence(this._sock,ne,ae),!0):this._fail("Unexpected fence response")}},{key:"_handleXvpMsg",value:function(){if(this._sock.rQwait("XVP version and message",3,1))return!1;this._sock.rQskipBytes(1);var ne=this._sock.rQshift8(),_e=this._sock.rQshift8();switch(_e){case 0:L.Error("XVP Operation Failed");break;case 1:this._rfbXvpVer=ne,L.Info("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+_e+")");break}return!0}},{key:"_normalMsg",value:function(){var ne;this._FBU.rects>0?ne=0:ne=this._sock.rQshift8();var _e,ae;switch(ne){case 0:return ae=this._framebufferUpdate(),ae&&!this._enabledContinuousUpdates&&Ne.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),ae;case 1:return this._handleSetColourMapMsg();case 2:return L.Debug("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return _e=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,_e&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),L.Info("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+ne+")"),L.Debug("sock.rQslice(0, 30): "+this._sock.rQslice(0,30)),!0}}},{key:"_onFlush",value:function(){this._flushing=!1,this._sock.rQlen>0&&this._handleMessage()}},{key:"_framebufferUpdate",value:function(){if(this._FBU.rects===0){if(this._sock.rQwait("FBU header",3,1))return!1;if(this._sock.rQskipBytes(1),this._FBU.rects=this._sock.rQshift16(),this._display.pending())return this._flushing=!0,this._display.flush(),!1}for(;this._FBU.rects>0;){if(this._FBU.encoding===null){if(this._sock.rQwait("rect header",12))return!1;var ne=this._sock.rQshiftBytes(12);this._FBU.x=(ne[0]<<8)+ne[1],this._FBU.y=(ne[2]<<8)+ne[3],this._FBU.width=(ne[4]<<8)+ne[5],this._FBU.height=(ne[6]<<8)+ne[7],this._FBU.encoding=parseInt((ne[8]<<24)+(ne[9]<<16)+(ne[10]<<8)+ne[11],10)}if(!this._handleRect())return!1;this._FBU.rects--,this._FBU.encoding=null}return this._display.flip(),!0}},{key:"_handleRect",value:function(){switch(this._FBU.encoding){case r.encodings.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case r.encodings.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case r.encodings.pseudoEncodingCursor:return this._handleCursor();case r.encodings.pseudoEncodingQEMUExtendedKeyEvent:try{var ne=document.createEvent("keyboardEvent");ne.code!==void 0&&(this._qemuExtKeyEventSupported=!0)}catch(_e){}return!0;case r.encodings.pseudoEncodingDesktopName:return this._handleDesktopName();case r.encodings.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case r.encodings.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();default:return this._handleDataRect()}}},{key:"_handleVMwareCursor",value:function(){var ne=this._FBU.x,_e=this._FBU.y,ae=this._FBU.width,Ie=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;var Je=this._sock.rQshift8();this._sock.rQshift8();var et,Ke=4;if(Je==0){var it=4294967040|0;if(et=new Array(ae*Ie*Ke),this._sock.rQwait("VMware cursor classic encoding",ae*Ie*Ke*2,2))return!1;for(var he=new Array(ae*Ie),Re=0;Re<ae*Ie;Re++)he[Re]=this._sock.rQshift32();for(var He=new Array(ae*Ie),Ee=0;Ee<ae*Ie;Ee++)He[Ee]=this._sock.rQshift32();for(var ve=0;ve<ae*Ie;ve++)if(he[ve]==0){var be=He[ve],J=be>>8&255,oe=be>>16&255,Z=be>>24&255;et[ve*Ke]=J,et[ve*Ke+1]=oe,et[ve*Ke+2]=Z,et[ve*Ke+3]=255}else(he[ve]&it)==it?He[ve]==0?(et[ve*Ke]=0,et[ve*Ke+1]=0,et[ve*Ke+2]=0,et[ve*Ke+3]=0):((He[ve]&it)==it,et[ve*Ke]=0,et[ve*Ke+1]=0,et[ve*Ke+2]=0,et[ve*Ke+3]=255):(et[ve*Ke]=0,et[ve*Ke+1]=0,et[ve*Ke+2]=0,et[ve*Ke+3]=255)}else if(Je==1){if(this._sock.rQwait("VMware cursor alpha encoding",ae*Ie*4,2))return!1;et=new Array(ae*Ie*Ke);for(var me=0;me<ae*Ie;me++){var Xe=this._sock.rQshift32();et[me*4]=Xe>>24&255,et[me*4+1]=Xe>>16&255,et[me*4+2]=Xe>>8&255,et[me*4+3]=Xe&255}}else return L.Warn("The given cursor type is not supported: "+Je+" given."),!1;return this._updateCursor(et,ne,_e,ae,Ie),!0}},{key:"_handleCursor",value:function(){var ne=this._FBU.x,_e=this._FBU.y,ae=this._FBU.width,Ie=this._FBU.height,Je=ae*Ie*4,et=Math.ceil(ae/8)*Ie,Ke=Je+et;if(this._sock.rQwait("cursor encoding",Ke))return!1;for(var it=this._sock.rQshiftBytes(Je),he=this._sock.rQshiftBytes(et),Re=new Uint8Array(ae*Ie*4),He=0,Ee=0;Ee<Ie;Ee++)for(var ve=0;ve<ae;ve++){var be=Ee*Math.ceil(ae/8)+Math.floor(ve/8),J=he[be]<<ve%8&128?255:0;Re[He]=it[He+2],Re[He+1]=it[He+1],Re[He+2]=it[He],Re[He+3]=J,He+=4}return this._updateCursor(Re,ne,_e,ae,Ie),!0}},{key:"_handleDesktopName",value:function(){if(this._sock.rQwait("DesktopName",4))return!1;var ne=this._sock.rQshift32();if(this._sock.rQwait("DesktopName",ne,4))return!1;var _e=this._sock.rQshiftStr(ne);return _e=(0,D.decodeUTF8)(_e,!0),this._setDesktopName(_e),!0}},{key:"_handleExtendedDesktopSize",value:function(){if(this._sock.rQwait("ExtendedDesktopSize",4))return!1;var ne=this._sock.rQpeek8(),_e=4+ne*16;if(this._sock.rQwait("ExtendedDesktopSize",_e))return!1;var ae=!this._supportsSetDesktopSize;this._supportsSetDesktopSize=!0,ae&&this._requestRemoteResize(),this._sock.rQskipBytes(1),this._sock.rQskipBytes(3);for(var Ie=0;Ie<ne;Ie+=1)Ie===0?(this._screenID=this._sock.rQshiftBytes(4),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._sock.rQskipBytes(2),this._screenFlags=this._sock.rQshiftBytes(4)):this._sock.rQskipBytes(16);if(this._FBU.x===1&&this._FBU.y!==0){var Je="";switch(this._FBU.y){case 1:Je="Resize is administratively prohibited";break;case 2:Je="Out of resources";break;case 3:Je="Invalid screen layout";break;default:Je="Unknown reason";break}L.Warn("Server did not accept the resize request: "+Je)}else this._resize(this._FBU.width,this._FBU.height);return!0}},{key:"_handleDataRect",value:function(){var ne=this._decoders[this._FBU.encoding];if(!ne)return this._fail("Unsupported encoding (encoding: "+this._FBU.encoding+")"),!1;try{return ne.decodeRect(this._FBU.x,this._FBU.y,this._FBU.width,this._FBU.height,this._sock,this._display,this._fbDepth)}catch(_e){return this._fail("Error decoding rect: "+_e),!1}}},{key:"_updateContinuousUpdates",value:function(){if(!this._enabledContinuousUpdates)return;Ne.messages.enableContinuousUpdates(this._sock,!0,0,0,this._fbWidth,this._fbHeight)}},{key:"_resize",value:function(ne,_e){this._fbWidth=ne,this._fbHeight=_e,this._display.resize(this._fbWidth,this._fbHeight),this._updateClip(),this._updateScale(),this._updateContinuousUpdates()}},{key:"_xvpOp",value:function(ne,_e){if(this._rfbXvpVer<ne)return;L.Info("Sending XVP operation "+_e+" (version "+ne+")"),Ne.messages.xvpOp(this._sock,ne,_e)}},{key:"_updateCursor",value:function(ne,_e,ae,Ie,Je){this._cursorImage={rgbaPixels:ne,hotx:_e,hoty:ae,w:Ie,h:Je},this._refreshCursor()}},{key:"_shouldShowDotCursor",value:function(){if(!this._showDotCursor)return!1;for(var ne=3;ne<this._cursorImage.rgbaPixels.length;ne+=4)if(this._cursorImage.rgbaPixels[ne])return!1;return!0}},{key:"_refreshCursor",value:function(){if(this._rfbConnectionState!=="connecting"&&this._rfbConnectionState!=="connected")return;var ne=this._shouldShowDotCursor()?Ne.cursors.dot:this._cursorImage;this._cursor.change(ne.rgbaPixels,ne.hotx,ne.hoty,ne.w,ne.h)}},{key:"viewOnly",get:function(){return this._viewOnly},set:function(ne){this._viewOnly=ne,(this._rfbConnectionState==="connecting"||this._rfbConnectionState==="connected")&&(ne?this._keyboard.ungrab():this._keyboard.grab())}},{key:"capabilities",get:function(){return this._capabilities}},{key:"touchButton",get:function(){return 0},set:function(ne){L.Warn("Using old API!")}},{key:"clipViewport",get:function(){return this._clipViewport},set:function(ne){this._clipViewport=ne,this._updateClip()}},{key:"scaleViewport",get:function(){return this._scaleViewport},set:function(ne){this._scaleViewport=ne,ne&&this._clipViewport&&this._updateClip(),this._updateScale(),!ne&&this._clipViewport&&this._updateClip()}},{key:"resizeSession",get:function(){return this._resizeSession},set:function(ne){this._resizeSession=ne,ne&&this._requestRemoteResize()}},{key:"showDotCursor",get:function(){return this._showDotCursor},set:function(ne){this._showDotCursor=ne,this._refreshCursor()}},{key:"background",get:function(){return this._screen.style.background},set:function(ne){this._screen.style.background=ne}},{key:"qualityLevel",get:function(){return this._qualityLevel},set:function(ne){if(!Number.isInteger(ne)||ne<0||ne>9){L.Error("qualityLevel must be an integer between 0 and 9");return}if(this._qualityLevel===ne)return;this._qualityLevel=ne,this._rfbConnectionState==="connected"&&this._sendEncodings()}},{key:"compressionLevel",get:function(){return this._compressionLevel},set:function(ne){if(!Number.isInteger(ne)||ne<0||ne>9){L.Error("compressionLevel must be an integer between 0 and 9");return}if(this._compressionLevel===ne)return;this._compressionLevel=ne,this._rfbConnectionState==="connected"&&this._sendEncodings()}}],[{key:"genDES",value:function(ne,_e){var ae=ne.split("").map(function(Ie){return Ie.charCodeAt(0)});return new t.default(ae).encrypt(_e)}}]),Ne}(S.default);se.default=Qe,Qe.messages={keyEvent:function(Fe,Ne,Me){var ne=Fe._sQ,_e=Fe._sQlen;ne[_e]=4,ne[_e+1]=Me,ne[_e+2]=0,ne[_e+3]=0,ne[_e+4]=Ne>>24,ne[_e+5]=Ne>>16,ne[_e+6]=Ne>>8,ne[_e+7]=Ne,Fe._sQlen+=8,Fe.flush()},QEMUExtendedKeyEvent:function(Fe,Ne,Me,ne){function _e(et){var Ke=ne>>8,it=ne&255;return Ke===224&&it<127?it|128:et}var ae=Fe._sQ,Ie=Fe._sQlen;ae[Ie]=255,ae[Ie+1]=0,ae[Ie+2]=Me>>8,ae[Ie+3]=Me,ae[Ie+4]=Ne>>24,ae[Ie+5]=Ne>>16,ae[Ie+6]=Ne>>8,ae[Ie+7]=Ne;var Je=_e(ne);ae[Ie+8]=Je>>24,ae[Ie+9]=Je>>16,ae[Ie+10]=Je>>8,ae[Ie+11]=Je,Fe._sQlen+=12,Fe.flush()},pointerEvent:function(Fe,Ne,Me,ne){var _e=Fe._sQ,ae=Fe._sQlen;_e[ae]=5,_e[ae+1]=ne,_e[ae+2]=Ne>>8,_e[ae+3]=Ne,_e[ae+4]=Me>>8,_e[ae+5]=Me,Fe._sQlen+=6,Fe.flush()},_buildExtendedClipboardFlags:function(Fe,Ne){for(var Me=new Uint8Array(4),ne=0,_e=0,ae=0;ae<Fe.length;ae++)_e|=Fe[ae];for(var Ie=0;Ie<Ne.length;Ie++)ne|=Ne[Ie];return Me[0]=_e>>24,Me[1]=0,Me[2]=0,Me[3]=ne,Me},extendedClipboardProvide:function(Fe,Ne,Me){for(var ne=new c.default,_e=[],ae=0;ae<Ne.length;ae++){if(Ne[ae]!=Ae)throw new Error("Unsupported extended clipboard format for Provide message.");Me[ae]=Me[ae].replace(/\r\n|\r|\n/gm,`\r
`);var Ie=(0,D.encodeUTF8)(Me[ae]+"\0");_e.push(Ie.length>>24&255,Ie.length>>16&255,Ie.length>>8&255,Ie.length&255);for(var Je=0;Je<Ie.length;Je++)_e.push(Ie.charCodeAt(Je))}var et=ne.deflate(new Uint8Array(_e)),Ke=new Uint8Array(4+et.length);Ke.set(Qe.messages._buildExtendedClipboardFlags([Ve],Ne)),Ke.set(et,4),Qe.messages.clientCutText(Fe,Ke,!0)},extendedClipboardNotify:function(Fe,Ne){var Me=Qe.messages._buildExtendedClipboardFlags([De],Ne);Qe.messages.clientCutText(Fe,Me,!0)},extendedClipboardRequest:function(Fe,Ne){var Me=Qe.messages._buildExtendedClipboardFlags([fe],Ne);Qe.messages.clientCutText(Fe,Me,!0)},extendedClipboardCaps:function(Fe,Ne,Me){var ne=Object.keys(Me),_e=new Uint8Array(4+4*ne.length);ne.map(function(Je){return parseInt(Je)}),ne.sort(function(Je,et){return Je-et}),_e.set(Qe.messages._buildExtendedClipboardFlags(Ne,[]));for(var ae=4,Ie=0;Ie<ne.length;Ie++)_e[ae]=Me[ne[Ie]]>>24,_e[ae+1]=Me[ne[Ie]]>>16,_e[ae+2]=Me[ne[Ie]]>>8,_e[ae+3]=Me[ne[Ie]]>>0,ae+=4,_e[3]|=1<<ne[Ie];Qe.messages.clientCutText(Fe,_e,!0)},clientCutText:function(Fe,Ne){var Me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,ne=Fe._sQ,_e=Fe._sQlen;ne[_e]=6,ne[_e+1]=0,ne[_e+2]=0,ne[_e+3]=0;var ae;Me?ae=(0,z.toUnsigned32bit)(-Ne.length):ae=Ne.length,ne[_e+4]=ae>>24,ne[_e+5]=ae>>16,ne[_e+6]=ae>>8,ne[_e+7]=ae,Fe._sQlen+=8;for(var Ie=0,Je=Ne.length;Je>0;){for(var et=Math.min(Je,Fe._sQbufferSize-Fe._sQlen),Ke=0;Ke<et;Ke++)ne[Fe._sQlen+Ke]=Ne[Ie+Ke];Fe._sQlen+=et,Fe.flush(),Je-=et,Ie+=et}},setDesktopSize:function(Fe,Ne,Me,ne,_e){var ae=Fe._sQ,Ie=Fe._sQlen;ae[Ie]=251,ae[Ie+1]=0,ae[Ie+2]=Ne>>8,ae[Ie+3]=Ne,ae[Ie+4]=Me>>8,ae[Ie+5]=Me,ae[Ie+6]=1,ae[Ie+7]=0,ae[Ie+8]=ne>>24,ae[Ie+9]=ne>>16,ae[Ie+10]=ne>>8,ae[Ie+11]=ne,ae[Ie+12]=0,ae[Ie+13]=0,ae[Ie+14]=0,ae[Ie+15]=0,ae[Ie+16]=Ne>>8,ae[Ie+17]=Ne,ae[Ie+18]=Me>>8,ae[Ie+19]=Me,ae[Ie+20]=_e>>24,ae[Ie+21]=_e>>16,ae[Ie+22]=_e>>8,ae[Ie+23]=_e,Fe._sQlen+=24,Fe.flush()},clientFence:function(Fe,Ne,Me){var ne=Fe._sQ,_e=Fe._sQlen;ne[_e]=248,ne[_e+1]=0,ne[_e+2]=0,ne[_e+3]=0,ne[_e+4]=Ne>>24,ne[_e+5]=Ne>>16,ne[_e+6]=Ne>>8,ne[_e+7]=Ne;var ae=Me.length;ne[_e+8]=ae;for(var Ie=0;Ie<ae;Ie++)ne[_e+9+Ie]=Me.charCodeAt(Ie);Fe._sQlen+=9+ae,Fe.flush()},enableContinuousUpdates:function(Fe,Ne,Me,ne,_e,ae){var Ie=Fe._sQ,Je=Fe._sQlen;Ie[Je]=150,Ie[Je+1]=Ne,Ie[Je+2]=Me>>8,Ie[Je+3]=Me,Ie[Je+4]=ne>>8,Ie[Je+5]=ne,Ie[Je+6]=_e>>8,Ie[Je+7]=_e,Ie[Je+8]=ae>>8,Ie[Je+9]=ae,Fe._sQlen+=10,Fe.flush()},pixelFormat:function(Fe,Ne,Me){var ne=Fe._sQ,_e=Fe._sQlen,ae;Ne>16?ae=32:Ne>8?ae=16:ae=8;var Ie=Math.floor(Ne/3);ne[_e]=0,ne[_e+1]=0,ne[_e+2]=0,ne[_e+3]=0,ne[_e+4]=ae,ne[_e+5]=Ne,ne[_e+6]=0,ne[_e+7]=Me?1:0,ne[_e+8]=0,ne[_e+9]=(1<<Ie)-1,ne[_e+10]=0,ne[_e+11]=(1<<Ie)-1,ne[_e+12]=0,ne[_e+13]=(1<<Ie)-1,ne[_e+14]=Ie*2,ne[_e+15]=Ie*1,ne[_e+16]=Ie*0,ne[_e+17]=0,ne[_e+18]=0,ne[_e+19]=0,Fe._sQlen+=20,Fe.flush()},clientEncodings:function(Fe,Ne){var Me=Fe._sQ,ne=Fe._sQlen;Me[ne]=2,Me[ne+1]=0,Me[ne+2]=Ne.length>>8,Me[ne+3]=Ne.length;for(var _e=ne+4,ae=0;ae<Ne.length;ae++){var Ie=Ne[ae];Me[_e]=Ie>>24,Me[_e+1]=Ie>>16,Me[_e+2]=Ie>>8,Me[_e+3]=Ie,_e+=4}Fe._sQlen+=_e-ne,Fe.flush()},fbUpdateRequest:function(Fe,Ne,Me,ne,_e,ae){var Ie=Fe._sQ,Je=Fe._sQlen;typeof Me=="undefined"&&(Me=0),typeof ne=="undefined"&&(ne=0),Ie[Je]=3,Ie[Je+1]=Ne?1:0,Ie[Je+2]=Me>>8&255,Ie[Je+3]=Me&255,Ie[Je+4]=ne>>8&255,Ie[Je+5]=ne&255,Ie[Je+6]=_e>>8&255,Ie[Je+7]=_e&255,Ie[Je+8]=ae>>8&255,Ie[Je+9]=ae&255,Fe._sQlen+=10,Fe.flush()},xvpOp:function(Fe,Ne,Me){var ne=Fe._sQ,_e=Fe._sQlen;ne[_e]=250,ne[_e+1]=0,ne[_e+2]=Ne,ne[_e+3]=Me,Fe._sQlen+=4,Fe.flush()}},Qe.cursors={none:{rgbaPixels:new Uint8Array,w:0,h:0,hotx:0,hoty:0},dot:{rgbaPixels:new Uint8Array([255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255]),w:3,h:3,hotx:1,hoty:1}}},"1eCo":function(ot,se,ee){(function(z){z(ee("VrN/"))})(function(z){"use strict";var L={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};z.defineMode("xml",function(k,M){var f=k.indentUnit,S={},_=M.htmlMode?L:D;for(var p in _)S[p]=_[p];for(var p in M)S[p]=M[p];var c,o;function u(g,P){function O(W){return P.tokenize=W,W(g,P)}var F=g.next();if(F=="<")return g.eat("!")?g.eat("[")?g.match("CDATA[")?O(t("atom","]]>")):null:g.match("--")?O(t("comment","-->")):g.match("DOCTYPE",!0,!0)?(g.eatWhile(/[\w\._\-]/),O(a(1))):null:g.eat("?")?(g.eatWhile(/[\w\._\-]/),P.tokenize=t("meta","?>"),"meta"):(c=g.eat("/")?"closeTag":"openTag",P.tokenize=s,"tag bracket");if(F=="&"){var X;return g.eat("#")?g.eat("x")?X=g.eatWhile(/[a-fA-F\d]/)&&g.eat(";"):X=g.eatWhile(/[\d]/)&&g.eat(";"):X=g.eatWhile(/[\w\.\-:]/)&&g.eat(";"),X?"atom":"error"}else return g.eatWhile(/[^&<]/),null}u.isInText=!0;function s(g,P){var O=g.next();if(O==">"||O=="/"&&g.eat(">"))return P.tokenize=u,c=O==">"?"endTag":"selfcloseTag","tag bracket";if(O=="=")return c="equals",null;if(O=="<"){P.tokenize=u,P.state=d,P.tagName=P.tagStart=null;var F=P.tokenize(g,P);return F?F+" tag error":"tag error"}else return/[\'\"]/.test(O)?(P.tokenize=l(O),P.stringStartCol=g.column(),P.tokenize(g,P)):(g.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(g){var P=function(O,F){for(;!O.eol();)if(O.next()==g){F.tokenize=s;break}return"string"};return P.isInAttribute=!0,P}function t(g,P){return function(O,F){for(;!O.eol();){if(O.match(P)){F.tokenize=u;break}O.next()}return g}}function a(g){return function(P,O){for(var F;(F=P.next())!=null;){if(F=="<")return O.tokenize=a(g+1),O.tokenize(P,O);if(F==">")if(g==1){O.tokenize=u;break}else return O.tokenize=a(g-1),O.tokenize(P,O)}return"meta"}}function i(g,P,O){this.prev=g.context,this.tagName=P,this.indent=g.indented,this.startOfLine=O,(S.doNotIndent.hasOwnProperty(P)||g.context&&g.context.noIndent)&&(this.noIndent=!0)}function r(g){g.context&&(g.context=g.context.prev)}function h(g,P){for(var O;;){if(!g.context)return;if(O=g.context.tagName,!S.contextGrabbers.hasOwnProperty(O)||!S.contextGrabbers[O].hasOwnProperty(P))return;r(g)}}function d(g,P,O){return g=="openTag"?(O.tagStart=P.column(),y):g=="closeTag"?m:d}function y(g,P,O){return g=="word"?(O.tagName=P.current(),o="tag",x):S.allowMissingTagName&&g=="endTag"?(o="tag bracket",x(g,P,O)):(o="error",y)}function m(g,P,O){if(g=="word"){var F=P.current();return O.context&&O.context.tagName!=F&&S.implicitlyClosed.hasOwnProperty(O.context.tagName)&&r(O),O.context&&O.context.tagName==F||S.matchClosing===!1?(o="tag",C):(o="tag error",T)}else return S.allowMissingTagName&&g=="endTag"?(o="tag bracket",C(g,P,O)):(o="error",T)}function C(g,P,O){return g!="endTag"?(o="error",C):(r(O),d)}function T(g,P,O){return o="error",C(g,P,O)}function x(g,P,O){if(g=="word")return o="attribute",E;if(g=="endTag"||g=="selfcloseTag"){var F=O.tagName,X=O.tagStart;return O.tagName=O.tagStart=null,g=="selfcloseTag"||S.autoSelfClosers.hasOwnProperty(F)?h(O,F):(h(O,F),O.context=new i(O,F,X==O.indented)),d}return o="error",x}function E(g,P,O){return g=="equals"?w:(S.allowMissing||(o="error"),x(g,P,O))}function w(g,P,O){return g=="string"?A:g=="word"&&S.allowUnquoted?(o="string",x):(o="error",x(g,P,O))}function A(g,P,O){return g=="string"?A:x(g,P,O)}return{startState:function(g){var P={tokenize:u,state:d,indented:g||0,tagName:null,tagStart:null,context:null};return g!=null&&(P.baseIndent=g),P},token:function(g,P){if(!P.tagName&&g.sol()&&(P.indented=g.indentation()),g.eatSpace())return null;c=null;var O=P.tokenize(g,P);return(O||c)&&O!="comment"&&(o=null,P.state=P.state(c||O,g,P),o&&(O=o=="error"?O+" error":o)),O},indent:function(g,P,O){var F=g.context;if(g.tokenize.isInAttribute)return g.tagStart==g.indented?g.stringStartCol+1:g.indented+f;if(F&&F.noIndent)return z.Pass;if(g.tokenize!=s&&g.tokenize!=u)return O?O.match(/^(\s*)/)[0].length:0;if(g.tagName)return S.multilineTagIndentPastTag!==!1?g.tagStart+g.tagName.length+2:g.tagStart+f*(S.multilineTagIndentFactor||1);if(S.alignCDATA&&/<!\[CDATA\[/.test(P))return 0;var X=P&&/^<(\/)?([\w_:\.-]*)/.exec(P);if(X&&X[1])for(;F;)if(F.tagName==X[2]){F=F.prev;break}else if(S.implicitlyClosed.hasOwnProperty(F.tagName))F=F.prev;else break;else if(X)for(;F;){var W=S.contextGrabbers[F.tagName];if(W&&W.hasOwnProperty(X[2]))F=F.prev;else break}for(;F&&F.prev&&!F.startOfLine;)F=F.prev;return F?F.indent+f:g.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:S.htmlMode?"html":"xml",helperType:S.htmlMode?"html":"xml",skipAttribute:function(g){g.state==w&&(g.state=x)},xmlCurrentTag:function(g){return g.tagName?{name:g.tagName,close:g.type=="closeTag"}:null},xmlCurrentContext:function(g){for(var P=[],O=g.context;O;O=O.prev)O.tagName&&P.push(O.tagName);return P.reverse()}}}),z.defineMIME("text/xml","xml"),z.defineMIME("application/xml","xml"),z.mimeModes.hasOwnProperty("text/html")||z.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1q3G":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=z;function z(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},"24hK":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return D});var z=ee("JYp7"),L=function(){function k(M){this.element=M,this.next=k.Undefined,this.prev=k.Undefined}return k.Undefined=new k(void 0),k}(),D=function(){function k(){this._first=L.Undefined,this._last=L.Undefined,this._size=0}return Object.defineProperty(k.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),k.prototype.isEmpty=function(){return this._first===L.Undefined},k.prototype.clear=function(){this._first=L.Undefined,this._last=L.Undefined,this._size=0},k.prototype.unshift=function(M){return this._insert(M,!1)},k.prototype.push=function(M){return this._insert(M,!0)},k.prototype._insert=function(M,f){var S=this,_=new L(M);if(this._first===L.Undefined)this._first=_,this._last=_;else if(f){var p=this._last;this._last=_,_.prev=p,p.next=_}else{var c=this._first;this._first=_,_.next=c,c.prev=_}this._size+=1;var o=!1;return function(){o||(o=!0,S._remove(_))}},k.prototype.shift=function(){if(this._first===L.Undefined)return;var M=this._first.element;return this._remove(this._first),M},k.prototype.pop=function(){if(this._last===L.Undefined)return;var M=this._last.element;return this._remove(this._last),M},k.prototype._remove=function(M){if(M.prev!==L.Undefined&&M.next!==L.Undefined){var f=M.prev;f.next=M.next,M.next.prev=f}else M.prev===L.Undefined&&M.next===L.Undefined?(this._first=L.Undefined,this._last=L.Undefined):M.next===L.Undefined?(this._last=this._last.prev,this._last.next=L.Undefined):M.prev===L.Undefined&&(this._first=this._first.next,this._first.prev=L.Undefined);this._size-=1},k.prototype.iterator=function(){var M,f=this._first;return{next:function(){return f===L.Undefined?z.c:(M?M.value=f.element:M={done:!1,value:f.element},f=f.next,M)}}},k.prototype.toArray=function(){for(var M=[],f=this._first;f!==L.Undefined;f=f.next)M.push(f.element);return M},k}()},"34/K":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(M,f){if(!(M instanceof f))throw new TypeError("Cannot call a class as a function")}function L(M,f){for(var S=0;S<f.length;S++){var _=f[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function D(M,f,S){return f&&L(M.prototype,f),S&&L(M,S),M}var k=function(){function M(){z(this,M),this._lines=0}return D(M,[{key:"decodeRect",value:function(S,_,p,c,o,u,s){this._lines===0&&(this._lines=c);var l=s==8?1:4,t=p*l;if(o.rQwait("RAW",t))return!1;var a=_+(c-this._lines),i=Math.min(this._lines,Math.floor(o.rQlen/t)),r=o.rQ,h=o.rQi;if(s==8){for(var d=p*i,y=new Uint8Array(d*4),m=0;m<d;m++)y[m*4+0]=(r[h+m]>>0&3)*255/3,y[m*4+1]=(r[h+m]>>2&3)*255/3,y[m*4+2]=(r[h+m]>>4&3)*255/3,y[m*4+4]=0;r=y,h=0}return u.blitImage(S,a,p,i,r,h),o.rQskipBytes(i*t),this._lines-=i,!(this._lines>0)}}]),M}();se.default=k},"3690":function(ot,se,ee){"use strict";function z(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(o){return typeof o}:z=function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},z(p)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=k(ee("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var p=new WeakMap;return D=function(){return p},p}function k(p){if(p&&p.__esModule)return p;if(p===null||z(p)!=="object"&&typeof p!="function")return{default:p};var c=D();if(c&&c.has(p))return c.get(p);var o={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in p)if(Object.prototype.hasOwnProperty.call(p,s)){var l=u?Object.getOwnPropertyDescriptor(p,s):null;l&&(l.get||l.set)?Object.defineProperty(o,s,l):o[s]=p[s]}return o.default=p,c&&c.set(p,o),o}function M(p,c){if(!(p instanceof c))throw new TypeError("Cannot call a class as a function")}function f(p,c){for(var o=0;o<c.length;o++){var u=c[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function S(p,c,o){return c&&f(p.prototype,c),o&&f(p,o),p}var _=function(){function p(){M(this,p),this._tiles=0,this._lastsubencoding=0}return S(p,[{key:"decodeRect",value:function(o,u,s,l,t,a,i){for(this._tiles===0&&(this._tilesX=Math.ceil(s/16),this._tilesY=Math.ceil(l/16),this._totalTiles=this._tilesX*this._tilesY,this._tiles=this._totalTiles);this._tiles>0;){var r=1;if(t.rQwait("HEXTILE",r))return!1;var h=t.rQ,d=t.rQi,y=h[d];if(y>30)throw new Error("Illegal hextile subencoding (subencoding: "+y+")");var m=this._totalTiles-this._tiles,C=m%this._tilesX,T=Math.floor(m/this._tilesX),x=o+C*16,E=u+T*16,w=Math.min(16,o+s-x),A=Math.min(16,u+l-E);if(y&1)r+=w*A*4;else if(y&2&&(r+=4),y&4&&(r+=4),y&8){if(r++,t.rQwait("HEXTILE",r))return!1;var g=h[d+r-1];y&16?r+=g*(4+2):r+=g*2}if(t.rQwait("HEXTILE",r))return!1;if(d++,y===0)this._lastsubencoding&1?L.Debug(" Ignoring blank after RAW"):a.fillRect(x,E,w,A,this._background);else if(y&1)a.blitImage(x,E,w,A,h,d),d+=r-1;else{if(y&2&&(this._background=[h[d],h[d+1],h[d+2],h[d+3]],d+=4),y&4&&(this._foreground=[h[d],h[d+1],h[d+2],h[d+3]],d+=4),a.startTile(x,E,w,A,this._background),y&8){var P=h[d];d++;for(var O=0;O<P;O++){var F=void 0;y&16?(F=[h[d],h[d+1],h[d+2],h[d+3]],d+=4):F=this._foreground;var X=h[d];d++;var W=X>>4,N=X&15,G=h[d];d++;var U=(G>>4)+1,H=(G&15)+1;a.subTile(W,N,U,H,F)}}a.finishTile()}t.rQi=d,this._lastsubencoding=y,this._tiles--}return!0}}]),p}();se.default=_},"6BzB":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.shrinkBuf=z,se.arraySet=L,se.flattenChunks=D,se.Buf32=se.Buf16=se.Buf8=void 0;function z(S,_){return S.length===_?S:S.subarray?S.subarray(0,_):(S.length=_,S)}function L(S,_,p,c,o){if(_.subarray&&S.subarray){S.set(_.subarray(p,p+c),o);return}for(var u=0;u<c;u++)S[o+u]=_[p+u]}function D(S){var _,p,c,o,u,s;for(c=0,_=0,p=S.length;_<p;_++)c+=S[_].length;for(s=new Uint8Array(c),o=0,_=0,p=S.length;_<p;_++)u=S[_],s.set(u,o),o+=u.length;return s}var k=Uint8Array;se.Buf8=k;var M=Uint16Array;se.Buf16=M;var f=Int32Array;se.Buf32=f},"6Qwc":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={8:"Backspace",9:"Tab",10:"NumpadClear",12:"Numpad5",13:"Enter",16:"ShiftLeft",17:"ControlLeft",18:"AltLeft",19:"Pause",20:"CapsLock",21:"Lang1",25:"Lang2",27:"Escape",28:"Convert",29:"NonConvert",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",41:"Select",44:"PrintScreen",45:"Insert",46:"Delete",47:"Help",48:"Digit0",49:"Digit1",50:"Digit2",51:"Digit3",52:"Digit4",53:"Digit5",54:"Digit6",55:"Digit7",56:"Digit8",57:"Digit9",91:"MetaLeft",92:"MetaRight",93:"ContextMenu",95:"Sleep",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",108:"NumpadDecimal",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",124:"F13",125:"F14",126:"F15",127:"F16",128:"F17",129:"F18",130:"F19",131:"F20",132:"F21",133:"F22",134:"F23",135:"F24",144:"NumLock",145:"ScrollLock",166:"BrowserBack",167:"BrowserForward",168:"BrowserRefresh",169:"BrowserStop",170:"BrowserSearch",171:"BrowserFavorites",172:"BrowserHome",173:"AudioVolumeMute",174:"AudioVolumeDown",175:"AudioVolumeUp",176:"MediaTrackNext",177:"MediaTrackPrevious",178:"MediaStop",179:"MediaPlayPause",180:"LaunchMail",181:"MediaSelect",182:"LaunchApp1",183:"LaunchApp2",225:"AltRight"};se.default=z},"746U":function(ot,se,ee){"use strict";ee.d(se,"d",function(){return L}),ee.d(se,"j",function(){return D}),ee.d(se,"i",function(){return k}),ee.d(se,"h",function(){return M}),ee.d(se,"e",function(){return f}),ee.d(se,"k",function(){return S}),ee.d(se,"l",function(){return _}),ee.d(se,"a",function(){return p}),ee.d(se,"f",function(){return o}),ee.d(se,"g",function(){return u}),ee.d(se,"m",function(){return s}),ee.d(se,"c",function(){return a}),ee.d(se,"b",function(){return i}),ee.d(se,"n",function(){return r}),ee.d(se,"o",function(){return h});var z={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function L(d){return Array.isArray?Array.isArray(d):!!(d&&typeof d.length===z.number&&d.constructor===Array)}function D(d){return typeof d===z.string||d instanceof String}function k(d){return typeof d===z.object&&d!==null&&!Array.isArray(d)&&!(d instanceof RegExp)&&!(d instanceof Date)}function M(d){return(typeof d===z.number||d instanceof Number)&&!isNaN(d)}function f(d){return d===!0||d===!1}function S(d){return typeof d===z.undefined}function _(d){return S(d)||d===null}function p(d,y){if(!d)throw new Error(y?"Unexpected type, expected '"+y+"'":"Unexpected type")}var c=Object.prototype.hasOwnProperty;function o(d){if(!k(d))return!1;for(var y in d)if(c.call(d,y))return!1;return!0}function u(d){return typeof d===z.function}function s(d,y){for(var m=Math.min(d.length,y.length),C=0;C<m;C++)l(d[C],y[C])}function l(d,y){if(D(y)){if(typeof d!==y)throw new Error("argument does not match constraint: typeof "+y)}else if(u(y)){try{if(d instanceof y)return}catch(m){}if(!_(d)&&d.constructor===y)return;if(y.length===1&&y.call(void 0,d)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function t(d){for(var y=[],m=Object.getPrototypeOf(d);Object.prototype!==m;)y=y.concat(Object.getOwnPropertyNames(m)),m=Object.getPrototypeOf(m);return y}function a(d){for(var y=[],m=0,C=t(d);m<C.length;m++){var T=C[m];typeof d[T]=="function"&&y.push(T)}return y}function i(d,y){for(var m=function(w){return function(){var A=Array.prototype.slice.call(arguments,0);return y(w,A)}},C={},T=0,x=d;T<x.length;T++){var E=x[T];C[E]=m(E)}return C}function r(d){return d===null?void 0:d}function h(d){return typeof d=="undefined"?null:d}},"7Cbv":function(ot,se,ee){"use strict";var z=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),L=new Uint8Array(16);function D(){if(!z)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return z(L)}var k=/^(?:[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(s){return typeof s=="string"&&k.test(s)}for(var f=M,S=[],_=0;_<256;++_)S.push((_+256).toString(16).substr(1));function p(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,t=(S[s[l+0]]+S[s[l+1]]+S[s[l+2]]+S[s[l+3]]+"-"+S[s[l+4]]+S[s[l+5]]+"-"+S[s[l+6]]+S[s[l+7]]+"-"+S[s[l+8]]+S[s[l+9]]+"-"+S[s[l+10]]+S[s[l+11]]+S[s[l+12]]+S[s[l+13]]+S[s[l+14]]+S[s[l+15]]).toLowerCase();if(!f(t))throw TypeError("Stringified UUID is invalid");return t}var c=p;function o(s,l,t){s=s||{};var a=s.random||(s.rng||D)();if(a[6]=a[6]&15|64,a[8]=a[8]&63|128,l){t=t||0;for(var i=0;i<16;++i)l[t+i]=a[i];return l}return c(a)}var u=se.a=o},"7ahc":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return y});var z=ee("k1fw"),L=ee("0Owb"),D=ee("+L6B"),k=ee("2/Rp"),M=ee("y8nQ"),f=ee("Vl3Y"),S=ee("tJVT"),_=ee("OaEy"),p=ee("2fM7"),c=ee("q1tI"),o=ee.n(c),u=ee("VrN/"),s=ee.n(u),l=ee("p77/"),t=ee.n(l),a=ee("c5Ni"),i=ee.n(a),r=p.a.Option,h={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};se.b=function(m){var C=m.callback,T=m.onCancel,x=Object(c.useState)("python"),E=Object(S.a)(x,2),w=E[0],A=E[1];function g(O){A(d[O][1])}function P(O){C(O)}return o.a.createElement(f.a,Object(L.a)({},h,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:P}),o.a.createElement(f.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},o.a.createElement(p.a,{onChange:g},Object.keys(d).map(function(O){return o.a.createElement(r,{key:O,value:O},d[O][0])}))),o.a.createElement(f.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},o.a.createElement(y,{mode:w})),o.a.createElement("div",{className:"flex-container flex-end"},o.a.createElement(k.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),o.a.createElement(k.a,{type:"ghost",onClick:T},"\u53D6\u6D88")))};function y(m){var C=m.value,T=m.onChange,x=m.mode,E=m.options,w=E===void 0?{}:E,A=Object(c.useRef)(),g=Object(c.useState)(),P=Object(S.a)(g,2),O=P[0],F=P[1];return Object(c.useEffect)(function(){if(O){function X(W){var N=W.getValue();T&&T(N)}return O.on("change",X),function(){O.off("change",X)}}},[O,T]),Object(c.useEffect)(function(){O&&O.setOption("mode",x)},[O,x]),Object(c.useEffect)(function(){O&&((C!==O.getValue()||C==="")&&setTimeout(function(){O.setValue(C||" ")},300))},[O,C]),Object(c.useEffect)(function(){if(A.current&&!O){var X=s.a.fromTextArea(A.current,Object(z.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},w));F(X)}},[A.current,O]),o.a.createElement("div",{className:"my-codemirror-container"},o.a.createElement("textarea",{ref:A}))}},"7ixt":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return D});var z={adjustX:1,adjustY:1},L=[0,0],D={left:{points:["cr","cl"],overflow:z,offset:[-4,0],targetOffset:L},right:{points:["cl","cr"],overflow:z,offset:[4,0],targetOffset:L},top:{points:["bc","tc"],overflow:z,offset:[0,-4],targetOffset:L},bottom:{points:["tc","bc"],overflow:z,offset:[0,4],targetOffset:L},topLeft:{points:["bl","tl"],overflow:z,offset:[0,-4],targetOffset:L},leftTop:{points:["tr","tl"],overflow:z,offset:[-4,0],targetOffset:L},topRight:{points:["br","tr"],overflow:z,offset:[0,-4],targetOffset:L},rightTop:{points:["tl","tr"],overflow:z,offset:[4,0],targetOffset:L},bottomRight:{points:["tr","br"],overflow:z,offset:[0,4],targetOffset:L},rightBottom:{points:["bl","br"],overflow:z,offset:[4,0],targetOffset:L},bottomLeft:{points:["tl","bl"],overflow:z,offset:[0,4],targetOffset:L},leftBottom:{points:["br","bl"],overflow:z,offset:[-4,0],targetOffset:L}},k=D},"8+yF":function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={256:960,257:992,258:451,259:483,260:417,261:433,262:454,263:486,264:710,265:742,266:709,267:741,268:456,269:488,270:463,271:495,272:464,273:496,274:938,275:954,278:972,279:1004,280:458,281:490,282:460,283:492,284:728,285:760,286:683,287:699,288:725,289:757,290:939,291:955,292:678,293:694,294:673,295:689,296:933,297:949,298:975,299:1007,302:967,303:999,304:681,305:697,308:684,309:700,310:979,311:1011,312:930,313:453,314:485,315:934,316:950,317:421,318:437,321:419,322:435,323:465,324:497,325:977,326:1009,327:466,328:498,330:957,331:959,332:978,333:1010,336:469,337:501,338:5052,339:5053,340:448,341:480,342:931,343:947,344:472,345:504,346:422,347:438,348:734,349:766,350:426,351:442,352:425,353:441,354:478,355:510,356:427,357:443,358:940,359:956,360:989,361:1021,362:990,363:1022,364:733,365:765,366:473,367:505,368:475,369:507,370:985,371:1017,376:5054,377:428,378:444,379:431,380:447,381:430,382:446,402:2294,466:16777681,711:439,728:418,729:511,731:434,733:445,901:1966,902:1953,904:1954,905:1955,906:1956,908:1959,910:1960,911:1963,912:1974,913:1985,914:1986,915:1987,916:1988,917:1989,918:1990,919:1991,920:1992,921:1993,922:1994,923:1995,924:1996,925:1997,926:1998,927:1999,928:2e3,929:2001,931:2002,932:2004,933:2005,934:2006,935:2007,936:2008,937:2009,938:1957,939:1961,940:1969,941:1970,942:1971,943:1972,944:1978,945:2017,946:2018,947:2019,948:2020,949:2021,950:2022,951:2023,952:2024,953:2025,954:2026,955:2027,956:2028,957:2029,958:2030,959:2031,960:2032,961:2033,962:2035,963:2034,964:2036,965:2037,966:2038,967:2039,968:2040,969:2041,970:1973,971:1977,972:1975,973:1976,974:1979,1025:1715,1026:1713,1027:1714,1028:1716,1029:1717,1030:1718,1031:1719,1032:1720,1033:1721,1034:1722,1035:1723,1036:1724,1038:1726,1039:1727,1040:1761,1041:1762,1042:1783,1043:1767,1044:1764,1045:1765,1046:1782,1047:1786,1048:1769,1049:1770,1050:1771,1051:1772,1052:1773,1053:1774,1054:1775,1055:1776,1056:1778,1057:1779,1058:1780,1059:1781,1060:1766,1061:1768,1062:1763,1063:1790,1064:1787,1065:1789,1066:1791,1067:1785,1068:1784,1069:1788,1070:1760,1071:1777,1072:1729,1073:1730,1074:1751,1075:1735,1076:1732,1077:1733,1078:1750,1079:1754,1080:1737,1081:1738,1082:1739,1083:1740,1084:1741,1085:1742,1086:1743,1087:1744,1088:1746,1089:1747,1090:1748,1091:1749,1092:1734,1093:1736,1094:1731,1095:1758,1096:1755,1097:1757,1098:1759,1099:1753,1100:1752,1101:1756,1102:1728,1103:1745,1105:1699,1106:1697,1107:1698,1108:1700,1109:1701,1110:1702,1111:1703,1112:1704,1113:1705,1114:1706,1115:1707,1116:1708,1118:1710,1119:1711,1168:1725,1169:1709,1488:3296,1489:3297,1490:3298,1491:3299,1492:3300,1493:3301,1494:3302,1495:3303,1496:3304,1497:3305,1498:3306,1499:3307,1500:3308,1501:3309,1502:3310,1503:3311,1504:3312,1505:3313,1506:3314,1507:3315,1508:3316,1509:3317,1510:3318,1511:3319,1512:3320,1513:3321,1514:3322,1548:1452,1563:1467,1567:1471,1569:1473,1570:1474,1571:1475,1572:1476,1573:1477,1574:1478,1575:1479,1576:1480,1577:1481,1578:1482,1579:1483,1580:1484,1581:1485,1582:1486,1583:1487,1584:1488,1585:1489,1586:1490,1587:1491,1588:1492,1589:1493,1590:1494,1591:1495,1592:1496,1593:1497,1594:1498,1600:1504,1601:1505,1602:1506,1603:1507,1604:1508,1605:1509,1606:1510,1607:1511,1608:1512,1609:1513,1610:1514,1611:1515,1612:1516,1613:1517,1614:1518,1615:1519,1616:1520,1617:1521,1618:1522,3585:3489,3586:3490,3587:3491,3588:3492,3589:3493,3590:3494,3591:3495,3592:3496,3593:3497,3594:3498,3595:3499,3596:3500,3597:3501,3598:3502,3599:3503,3600:3504,3601:3505,3602:3506,3603:3507,3604:3508,3605:3509,3606:3510,3607:3511,3608:3512,3609:3513,3610:3514,3611:3515,3612:3516,3613:3517,3614:3518,3615:3519,3616:3520,3617:3521,3618:3522,3619:3523,3620:3524,3621:3525,3622:3526,3623:3527,3624:3528,3625:3529,3626:3530,3627:3531,3628:3532,3629:3533,3630:3534,3631:3535,3632:3536,3633:3537,3634:3538,3635:3539,3636:3540,3637:3541,3638:3542,3639:3543,3640:3544,3641:3545,3642:3546,3647:3551,3648:3552,3649:3553,3650:3554,3651:3555,3652:3556,3653:3557,3654:3558,3655:3559,3656:3560,3657:3561,3658:3562,3659:3563,3660:3564,3661:3565,3664:3568,3665:3569,3666:3570,3667:3571,3668:3572,3669:3573,3670:3574,3671:3575,3672:3576,3673:3577,8194:2722,8195:2721,8196:2723,8197:2724,8199:2725,8200:2726,8201:2727,8202:2728,8210:2747,8211:2730,8212:2729,8213:1967,8215:3295,8216:2768,8217:2769,8218:2813,8220:2770,8221:2771,8222:2814,8224:2801,8225:2802,8226:2790,8229:2735,8230:2734,8240:2773,8242:2774,8243:2775,8248:2812,8254:1150,8361:3839,8364:8364,8453:2744,8470:1712,8471:2811,8478:2772,8482:2761,8531:2736,8532:2737,8533:2738,8534:2739,8535:2740,8536:2741,8537:2742,8538:2743,8539:2755,8540:2756,8541:2757,8542:2758,8592:2299,8593:2300,8594:2301,8595:2302,8658:2254,8660:2253,8706:2287,8711:2245,8728:3018,8730:2262,8733:2241,8734:2242,8743:2270,8744:2271,8745:2268,8746:2269,8747:2239,8756:2240,8764:2248,8771:2249,8773:16785992,8800:2237,8801:2255,8804:2236,8805:2238,8834:2266,8835:2267,8866:3068,8867:3036,8868:3010,8869:3022,8968:3027,8970:3012,8981:2810,8992:2212,8993:2213,9109:3020,9115:2219,9117:2220,9118:2221,9120:2222,9121:2215,9123:2216,9124:2217,9126:2218,9128:2223,9132:2224,9143:2209,9146:2543,9147:2544,9148:2546,9149:2547,9225:2530,9226:2533,9227:2537,9228:2531,9229:2532,9251:2732,9252:2536,9472:2211,9474:2214,9484:2210,9488:2539,9492:2541,9496:2538,9500:2548,9508:2549,9516:2551,9524:2550,9532:2542,9618:2529,9642:2791,9643:2785,9644:2779,9645:2786,9646:2783,9647:2767,9650:2792,9651:2787,9654:2781,9655:2765,9660:2793,9661:2788,9664:2780,9665:2764,9670:2528,9675:2766,9679:2782,9702:2784,9734:2789,9742:2809,9747:2762,9756:2794,9758:2795,9792:2808,9794:2807,9827:2796,9829:2798,9830:2797,9837:2806,9839:2805,10003:2803,10007:2804,10013:2777,10016:2800,10216:2748,10217:2750,12289:1188,12290:1185,12300:1186,12301:1187,12443:1246,12444:1247,12449:1191,12450:1201,12451:1192,12452:1202,12453:1193,12454:1203,12455:1194,12456:1204,12457:1195,12458:1205,12459:1206,12461:1207,12463:1208,12465:1209,12467:1210,12469:1211,12471:1212,12473:1213,12475:1214,12477:1215,12479:1216,12481:1217,12483:1199,12484:1218,12486:1219,12488:1220,12490:1221,12491:1222,12492:1223,12493:1224,12494:1225,12495:1226,12498:1227,12501:1228,12504:1229,12507:1230,12510:1231,12511:1232,12512:1233,12513:1234,12514:1235,12515:1196,12516:1236,12517:1197,12518:1237,12519:1198,12520:1238,12521:1239,12522:1240,12523:1241,12524:1242,12525:1243,12527:1244,12530:1190,12531:1245,12539:1189,12540:1200},L={lookup:function(k){if(k>=32&&k<=255)return k;var M=z[k];return M!==void 0?M:16777216|k}};se.default=L},"8CQX":function(ot,se,ee){"use strict";function z(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(a){return typeof a}:z=function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},z(l)}Object.defineProperty(se,"__esModule",{value:!0}),se.getKeycode=o,se.getKey=u,se.getKeysym=s;var L=c(ee("mHUz")),D=c(ee("8+yF")),k=c(ee("6Qwc")),M=c(ee("gIYZ")),f=c(ee("mTgk")),S=p(ee("GdRQ"));function _(){if(typeof WeakMap!="function")return null;var l=new WeakMap;return _=function(){return l},l}function p(l){if(l&&l.__esModule)return l;if(l===null||z(l)!=="object"&&typeof l!="function")return{default:l};var t=_();if(t&&t.has(l))return t.get(l);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in l)if(Object.prototype.hasOwnProperty.call(l,r)){var h=i?Object.getOwnPropertyDescriptor(l,r):null;h&&(h.get||h.set)?Object.defineProperty(a,r,h):a[r]=l[r]}return a.default=l,t&&t.set(l,a),a}function c(l){return l&&l.__esModule?l:{default:l}}function o(l){if(l.code){switch(l.code){case"OSLeft":return"MetaLeft";case"OSRight":return"MetaRight"}return l.code}if(l.type!=="keypress"&&l.keyCode in k.default){var t=k.default[l.keyCode];if(S.isMac()&&t==="ContextMenu"&&(t="MetaRight"),l.location===2)switch(t){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(l.location===3)switch(t){case"Delete":return"NumpadDecimal";case"Insert":return"Numpad0";case"End":return"Numpad1";case"ArrowDown":return"Numpad2";case"PageDown":return"Numpad3";case"ArrowLeft":return"Numpad4";case"ArrowRight":return"Numpad6";case"Home":return"Numpad7";case"ArrowUp":return"Numpad8";case"PageUp":return"Numpad9";case"Enter":return"NumpadEnter"}return t}return"Unidentified"}function u(l){if(l.key!==void 0){switch(l.key){case"Spacebar":return" ";case"Esc":return"Escape";case"Scroll":return"ScrollLock";case"Win":return"Meta";case"Apps":return"ContextMenu";case"Up":return"ArrowUp";case"Left":return"ArrowLeft";case"Right":return"ArrowRight";case"Down":return"ArrowDown";case"Del":return"Delete";case"Divide":return"/";case"Multiply":return"*";case"Subtract":return"-";case"Add":return"+";case"Decimal":return l.char}switch(l.key){case"OS":return"Meta";case"LaunchMyComputer":return"LaunchApplication1";case"LaunchCalculator":return"LaunchApplication2"}switch(l.key){case"UIKeyInputUpArrow":return"ArrowUp";case"UIKeyInputDownArrow":return"ArrowDown";case"UIKeyInputLeftArrow":return"ArrowLeft";case"UIKeyInputRightArrow":return"ArrowRight";case"UIKeyInputEscape":return"Escape"}if(l.key==="\0"&&l.code==="NumpadDecimal")return"Delete";if(!S.isIE()&&!S.isEdge())return l.key;if(l.key.length!==1&&l.key!=="Unidentified")return l.key}var t=o(l);return t in M.default?M.default[t]:l.charCode?String.fromCharCode(l.charCode):"Unidentified"}function s(l){var t=u(l);if(t==="Unidentified")return null;if(t in f.default){var a=l.location;if(t==="Meta"&&a===0&&(a=2),t==="Clear"&&a===3){var i=o(l);i==="NumLock"&&(a=0)}if((a===void 0||a>3)&&(a=0),t==="Meta"){var r=o(l);if(r==="AltLeft")return L.default.XK_Meta_L;if(r==="AltRight")return L.default.XK_Meta_R}if(t==="Clear"){var h=o(l);if(h==="NumLock")return L.default.XK_Num_Lock}return f.default[t][a]}if(t.length!==1)return null;var d=t.charCodeAt();return d?D.default.lookup(d):null}},"8EBN":function(ot,se,ee){(function(z){z(ee("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 L=0;L<z.modeInfo.length;L++){var D=z.modeInfo[L];D.mimes&&(D.mime=D.mimes[0])}z.findModeByMIME=function(k){k=k.toLowerCase();for(var M=0;M<z.modeInfo.length;M++){var f=z.modeInfo[M];if(f.mime==k)return f;if(f.mimes){for(var S=0;S<f.mimes.length;S++)if(f.mimes[S]==k)return f}}if(/\+xml$/.test(k))return z.findModeByMIME("application/xml");if(/\+json$/.test(k))return z.findModeByMIME("application/json")},z.findModeByExtension=function(k){k=k.toLowerCase();for(var M=0;M<z.modeInfo.length;M++){var f=z.modeInfo[M];if(f.ext){for(var S=0;S<f.ext.length;S++)if(f.ext[S]==k)return f}}},z.findModeByFileName=function(k){for(var M=0;M<z.modeInfo.length;M++){var f=z.modeInfo[M];if(f.file&&f.file.test(k))return f}var S=k.lastIndexOf("."),_=S>-1&&k.substring(S+1,k.length);if(_)return z.findModeByExtension(_)},z.findModeByName=function(k){k=k.toLowerCase();for(var M=0;M<z.modeInfo.length;M++){var f=z.modeInfo[M];if(f.name.toLowerCase()==k)return f;if(f.alias){for(var S=0;S<f.alias.length;S++)if(f.alias[S].toLowerCase()==k)return f}}}})},"8HAY":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return f}),ee.d(se,"b",function(){return S});var z=ee("pmY6"),L=ee("MI8n"),D=function(){var _=function(p,c){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,u){o.__proto__=u}||function(o,u){for(var s in u)u.hasOwnProperty(s)&&(o[s]=u[s])},_(p,c)};return function(p,c){_(p,c);function o(){this.constructor=p}p.prototype=c===null?Object.create(c):(o.prototype=c.prototype,new o)}}(),k=function(_,p,c,o){function u(s){return s instanceof c?s:new c(function(l){l(s)})}return new(c||(c=Promise))(function(s,l){function t(r){try{i(o.next(r))}catch(h){l(h)}}function a(r){try{i(o.throw(r))}catch(h){l(h)}}function i(r){r.done?s(r.value):u(r.value).then(t,a)}i((o=o.apply(_,p||[])).next())})},M=function(_,p){var c={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,u,s,l;return l={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function t(i){return function(r){return a([i,r])}}function a(i){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,u&&(s=i[0]&2?u.return:i[0]?u.throw||((s=u.return)&&s.call(u),0):u.next)&&!(s=s.call(u,i[1])).done)return s;(u=0,s)&&(i=[i[0]&2,s.value]);switch(i[0]){case 0:case 1:s=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,u=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(s=c.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){c=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){c.label=i[1];break}if(i[0]===6&&c.label<s[1]){c.label=s[1],s=i;break}if(s&&c.label<s[2]){c.label=s[2],c.ops.push(i);break}s[2]&&c.ops.pop(),c.trys.pop();continue}i=p.call(_,c)}catch(r){i=[6,r],u=0}finally{o=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},f=function(_){D(p,_);function p(c,o,u,s,l){o===void 0&&(o=""),u===void 0&&(u=""),s===void 0&&(s=!0);var t=_.call(this)||this;return t._onDidChange=t._register(new L.a),t.onDidChange=t._onDidChange.event,t._enabled=!0,t._checked=!1,t._id=c,t._label=o,t._cssClass=u,t._enabled=s,t._actionCallback=l,t}return Object.defineProperty(p.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"label",{get:function(){return this._label},set:function(c){this._setLabel(c)},enumerable:!0,configurable:!0}),p.prototype._setLabel=function(c){this._label!==c&&(this._label=c,this._onDidChange.fire({label:c}))},Object.defineProperty(p.prototype,"tooltip",{get:function(){return this._tooltip||""},set:function(c){this._setTooltip(c)},enumerable:!0,configurable:!0}),p.prototype._setTooltip=function(c){this._tooltip!==c&&(this._tooltip=c,this._onDidChange.fire({tooltip:c}))},Object.defineProperty(p.prototype,"class",{get:function(){return this._cssClass},set:function(c){this._setClass(c)},enumerable:!0,configurable:!0}),p.prototype._setClass=function(c){this._cssClass!==c&&(this._cssClass=c,this._onDidChange.fire({class:c}))},Object.defineProperty(p.prototype,"enabled",{get:function(){return this._enabled},set:function(c){this._setEnabled(c)},enumerable:!0,configurable:!0}),p.prototype._setEnabled=function(c){this._enabled!==c&&(this._enabled=c,this._onDidChange.fire({enabled:c}))},Object.defineProperty(p.prototype,"checked",{get:function(){return this._checked},set:function(c){this._setChecked(c)},enumerable:!0,configurable:!0}),p.prototype._setChecked=function(c){this._checked!==c&&(this._checked=c,this._onDidChange.fire({checked:c}))},p.prototype.run=function(c,o){return this._actionCallback?this._actionCallback(c):Promise.resolve(!0)},p}(z.a),S=function(_){D(p,_);function p(){var c=_!==null&&_.apply(this,arguments)||this;return c._onDidBeforeRun=c._register(new L.a),c.onDidBeforeRun=c._onDidBeforeRun.event,c._onDidRun=c._register(new L.a),c.onDidRun=c._onDidRun.event,c}return p.prototype.run=function(c,o){return k(this,void 0,void 0,function(){var u,s;return M(this,function(l){switch(l.label){case 0:if(!c.enabled)return[2,Promise.resolve(null)];this._onDidBeforeRun.fire({action:c}),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.runAction(c,o)];case 2:return u=l.sent(),this._onDidRun.fire({action:c,result:u}),[3,4];case 3:return s=l.sent(),this._onDidRun.fire({action:c,error:s}),[3,4];case 4:return[2]}})})},p.prototype.runAction=function(c,o){var u=o?c.run(o):c.run();return Promise.resolve(u)},p}(z.a)},"8K/p":function(ot,se,ee){"use strict";function z(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(s){return typeof s}:z=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},z(o)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=f(ee("Lo0S")),D=k(ee("ItS6"));function k(o){return o&&o.__esModule?o:{default:o}}function M(){if(typeof WeakMap!="function")return null;var o=new WeakMap;return M=function(){return o},o}function f(o){if(o&&o.__esModule)return o;if(o===null||z(o)!=="object"&&typeof o!="function")return{default:o};var u=M();if(u&&u.has(o))return u.get(o);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in o)if(Object.prototype.hasOwnProperty.call(o,t)){var a=l?Object.getOwnPropertyDescriptor(o,t):null;a&&(a.get||a.set)?Object.defineProperty(s,t,a):s[t]=o[t]}return s.default=o,u&&u.set(o,s),s}function S(o,u){if(!(o instanceof u))throw new TypeError("Cannot call a class as a function")}function _(o,u){for(var s=0;s<u.length;s++){var l=u[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function p(o,u,s){return u&&_(o.prototype,u),s&&_(o,s),o}var c=function(){function o(){S(this,o),this._ctl=null,this._filter=null,this._numColors=0,this._palette=new Uint8Array(1024),this._len=0,this._zlibs=[];for(var u=0;u<4;u++)this._zlibs[u]=new D.default}return p(o,[{key:"decodeRect",value:function(s,l,t,a,i,r,h){if(this._ctl===null){if(i.rQwait("TIGHT compression-control",1))return!1;this._ctl=i.rQshift8();for(var d=0;d<4;d++)this._ctl>>d&1&&(this._zlibs[d].reset(),L.Info("Reset zlib stream "+d));this._ctl=this._ctl>>4}var y;if(this._ctl===8)y=this._fillRect(s,l,t,a,i,r,h);else if(this._ctl===9)y=this._jpegRect(s,l,t,a,i,r,h);else if(this._ctl===10)y=this._pngRect(s,l,t,a,i,r,h);else if((this._ctl&128)==0)y=this._basicRect(this._ctl,s,l,t,a,i,r,h);else throw new Error("Illegal tight compression received (ctl: "+this._ctl+")");return y&&(this._ctl=null),y}},{key:"_fillRect",value:function(s,l,t,a,i,r,h){if(i.rQwait("TIGHT",3))return!1;var d=i.rQi,y=i.rQ;return r.fillRect(s,l,t,a,[y[d+2],y[d+1],y[d]],!1),i.rQskipBytes(3),!0}},{key:"_jpegRect",value:function(s,l,t,a,i,r,h){var d=this._readData(i);return d===null?!1:(r.imageRect(s,l,t,a,"image/jpeg",d),!0)}},{key:"_pngRect",value:function(s,l,t,a,i,r,h){throw new Error("PNG received in standard Tight rect")}},{key:"_basicRect",value:function(s,l,t,a,i,r,h,d){if(this._filter===null)if(s&4){if(r.rQwait("TIGHT",1))return!1;this._filter=r.rQshift8()}else this._filter=0;var y=s&3,m;switch(this._filter){case 0:m=this._copyFilter(y,l,t,a,i,r,h,d);break;case 1:m=this._paletteFilter(y,l,t,a,i,r,h,d);break;case 2:m=this._gradientFilter(y,l,t,a,i,r,h,d);break;default:throw new Error("Illegal tight filter received (ctl: "+this._filter+")")}return m&&(this._filter=null),m}},{key:"_copyFilter",value:function(s,l,t,a,i,r,h,d){var y=a*i*3,m;if(y<12){if(r.rQwait("TIGHT",y))return!1;m=r.rQshiftBytes(y)}else{if(m=this._readData(r),m===null)return!1;this._zlibs[s].setInput(m),m=this._zlibs[s].inflate(y),this._zlibs[s].setInput(null)}return h.blitRgbImage(l,t,a,i,m,0,!1),!0}},{key:"_paletteFilter",value:function(s,l,t,a,i,r,h,d){if(this._numColors===0){if(r.rQwait("TIGHT palette",1))return!1;var y=r.rQpeek8()+1,m=y*3;if(r.rQwait("TIGHT palette",1+m))return!1;this._numColors=y,r.rQskipBytes(1),r.rQshiftTo(this._palette,m)}var C=this._numColors<=2?1:8,T=Math.floor((a*C+7)/8),x=T*i,E;if(x<12){if(r.rQwait("TIGHT",x))return!1;E=r.rQshiftBytes(x)}else{if(E=this._readData(r),E===null)return!1;this._zlibs[s].setInput(E),E=this._zlibs[s].inflate(x),this._zlibs[s].setInput(null)}return this._numColors==2?this._monoRect(l,t,a,i,E,this._palette,h):this._paletteRect(l,t,a,i,E,this._palette,h),this._numColors=0,!0}},{key:"_monoRect",value:function(s,l,t,a,i,r,h){for(var d=this._getScratchBuffer(t*a*4),y=Math.floor((t+7)/8),m=Math.floor(t/8),C=0;C<a;C++){var T=void 0,x=void 0,E=void 0;for(E=0;E<m;E++)for(var w=7;w>=0;w--)T=(C*t+E*8+7-w)*4,x=(i[C*y+E]>>w&1)*3,d[T]=r[x],d[T+1]=r[x+1],d[T+2]=r[x+2],d[T+3]=255;for(var A=7;A>=8-t%8;A--)T=(C*t+E*8+7-A)*4,x=(i[C*y+E]>>A&1)*3,d[T]=r[x],d[T+1]=r[x+1],d[T+2]=r[x+2],d[T+3]=255}h.blitRgbxImage(s,l,t,a,d,0,!1)}},{key:"_paletteRect",value:function(s,l,t,a,i,r,h){for(var d=this._getScratchBuffer(t*a*4),y=t*a*4,m=0,C=0;m<y;m+=4,C++){var T=i[C]*3;d[m]=r[T],d[m+1]=r[T+1],d[m+2]=r[T+2],d[m+3]=255}h.blitRgbxImage(s,l,t,a,d,0,!1)}},{key:"_gradientFilter",value:function(s,l,t,a,i,r,h,d){throw new Error("Gradient filter not implemented")}},{key:"_readData",value:function(s){if(this._len===0){if(s.rQwait("TIGHT",3))return null;var l;l=s.rQshift8(),this._len=l&127,l&128&&(l=s.rQshift8(),this._len|=(l&127)<<7,l&128&&(l=s.rQshift8(),this._len|=l<<14))}if(s.rQwait("TIGHT",this._len))return null;var t=s.rQshiftBytes(this._len);return this._len=0,t}},{key:"_getScratchBuffer",value:function(s){return(!this._scratchBuffer||this._scratchBuffer.length<s)&&(this._scratchBuffer=new Uint8Array(s)),this._scratchBuffer}}]),o}();se.default=c},"8hTe":function(ot,se,ee){ot.exports={button:"button___1wy9m"}},"9Bee":function(ot,se,ee){"use strict";var z=ee("DYRE"),L=ee("zeV3"),D=ee("+L6B"),k=ee("2/Rp"),M=ee("k1fw"),f=ee("9og8"),S=ee("tJVT"),_=ee("WmNS"),p=ee.n(_),c=ee("q1tI"),o=ee.n(c),u=ee("vg9a"),s=ee("DlQD"),l=ee.n(s),t=ee("rUJ1");function a(q,I){var B=q.match(/^(\s+)(?:```)/);if(B===null)return I;var Q=B[1];return I.split(`
`).map(function(te){var $=te.match(/^\s+/);if($===null)return te;var Ue=Object(S.a)($,1),at=Ue[0];return at.length>=Q.length?te.slice(Q.length):te}).join(`
`)}var i=[],r=["<ul>"],h=new l.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function y(){i.length=0,r=["<ul>"]}var m={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function C(q,I,B,Q){if(I>=q.length||q[I].level<=B)return I;var te=q[I];Q.push("<li><a href='#"+te.anchor+"'>"+te.text+"</a>"),I++;var $=[];return I=C(q,I,te.level,$),$.length>0&&(Q.push("<ul>"),$.forEach(function(Ue){Q.push(Ue)}),Q.push("</ul>")),Q.push("</li>"),I=C(q,I,B,Q),I}function T(){return C(i,0,0,r),r.push("</ul>"),r.join("")}var x={heading:function(I){var B=d.exec(I);if(B)return{type:"heading",raw:B[0],depth:B[1].length,text:B[2]}},fences:function(I){var B=this.rules.block.fences.exec(I);if(B){var Q=B[0],te=a(Q,B[3]||""),$=B[2]?B[2].trim():B[2];if(["latex","katex","math"].indexOf($)>=0){var Ue=A(),at=te;te=Ue,g[Ue]={type:"block",expression:at}}return{type:"code",raw:Q,lang:$,text:te}}}},E=/(?:\${2})([^\n`]+?)(?:\${2})/gi,w=0,A=function(){return"__special_katext_id_".concat(w++,"__")},g={};function P(){return g}function O(){w=0,g={}}function F(q){return q=q.replace(E,function(I,B){var Q=A();return g[Q]={type:"inline",expression:B},Q}),q}var X=h.listitem;h.listitem=function(q){return X(F(q))};var W=h.paragraph;h.paragraph=function(q){return W(F(q))};var N=h.tablecell;h.tablecell=function(q,I){return N(F(q),I)},h.code=function(q,I,B){var Q=(I||"").match(/\S*/)[0];return Q?["latex","katex","math"].indexOf(Q)>=0?"<p class='editormd-tex'>".concat(q,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(I,'">').concat(B?q:Object(t.escape)(q,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(B?q:Object(t.escape)(q,!0))+"</code></pre>"},h.heading=function(q,I,B){var Q=this.options.headerPrefix+B.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return i.push({anchor:Q,level:I,text:q}),"<h"+I+' id="'+Q+'">'+q+"</h"+I+">"},l.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),l.a.use({tokenizer:x,renderer:h});var G=l.a,U=ee("SJMd"),H=ee("ulZh"),V=ee.n(H),ce=ee("m3rI"),ye=ee("Oy/b"),Le=ee("p5ED"),Ze=ee("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ye=function(q,I){return(Ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,Q){B.__proto__=Q}||function(B,Q){for(var te in Q)Object.prototype.hasOwnProperty.call(Q,te)&&(B[te]=Q[te])})(q,I)};function Oe(q,I){function B(){this.constructor=q}Ye(q,I),q.prototype=I===null?Object.create(I):(B.prototype=I.prototype,new B)}function We(q,I,B,Q){return new(B||(B=Promise))(function(te,$){function Ue(wt){try{pt(Q.next(wt))}catch(lt){$(lt)}}function at(wt){try{pt(Q.throw(wt))}catch(lt){$(lt)}}function pt(wt){var lt;wt.done?te(wt.value):(lt=wt.value,lt instanceof B?lt:new B(function(It){It(lt)})).then(Ue,at)}pt((Q=Q.apply(q,I||[])).next())})}function ze(q,I){var B,Q,te,$,Ue={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return $={next:at(0),throw:at(1),return:at(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function at(pt){return function(wt){return function(lt){if(B)throw new TypeError("Generator is already executing.");for(;Ue;)try{if(B=1,Q&&(te=2&lt[0]?Q.return:lt[0]?Q.throw||((te=Q.return)&&te.call(Q),0):Q.next)&&!(te=te.call(Q,lt[1])).done)return te;switch(Q=0,te&&(lt=[2&lt[0],te.value]),lt[0]){case 0:case 1:te=lt;break;case 4:return Ue.label++,{value:lt[1],done:!1};case 5:Ue.label++,Q=lt[1],lt=[0];continue;case 7:lt=Ue.ops.pop(),Ue.trys.pop();continue;default:if(!(te=Ue.trys,(te=te.length>0&&te[te.length-1])||lt[0]!==6&&lt[0]!==2)){Ue=0;continue}if(lt[0]===3&&(!te||lt[1]>te[0]&&lt[1]<te[3])){Ue.label=lt[1];break}if(lt[0]===6&&Ue.label<te[1]){Ue.label=te[1],te=lt;break}if(te&&Ue.label<te[2]){Ue.label=te[2],Ue.ops.push(lt);break}te[2]&&Ue.ops.pop(),Ue.trys.pop();continue}lt=I.call(q,Ue)}catch(It){lt=[6,It],Q=0}finally{B=te=0}if(5&lt[0])throw lt[1];return{value:lt[0]?lt[1]:void 0,done:!0}}([pt,wt])}}}function Ae(){for(var q=0,I=0,B=arguments.length;I<B;I++)q+=arguments[I].length;var Q=Array(q),te=0;for(I=0;I<B;I++)for(var $=arguments[I],Ue=0,at=$.length;Ue<at;Ue++,te++)Q[te]=$[Ue];return Q}var xe=function(){function q(){}return q.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},q.setAttributes=function(I,B){for(var Q=0,te=B;Q<te.length;Q++){var $=te[Q],Ue=$[0],at=$[1];I.setAttribute(Ue,at)}},q.createRect=function(I,B,Q){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",I.toString()),te.setAttribute("height",B.toString()),Q&&q.setAttributes(te,Q),te},q.createLine=function(I,B,Q,te,$){var Ue=document.createElementNS("http://www.w3.org/2000/svg","line");return Ue.setAttribute("x1",I.toString()),Ue.setAttribute("y1",B.toString()),Ue.setAttribute("x2",Q.toString()),Ue.setAttribute("y2",te.toString()),$&&q.setAttributes(Ue,$),Ue},q.createPolygon=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","polygon");return Q.setAttribute("points",I),B&&q.setAttributes(Q,B),Q},q.createCircle=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","circle");return Q.setAttribute("cx",(I/2).toString()),Q.setAttribute("cy",(I/2).toString()),Q.setAttribute("r",I.toString()),B&&q.setAttributes(Q,B),Q},q.createEllipse=function(I,B,Q){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(I/2).toString()),te.setAttribute("cy",(B/2).toString()),te.setAttribute("rx",(I/2).toString()),te.setAttribute("ry",(B/2).toString()),Q&&q.setAttributes(te,Q),te},q.createGroup=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","g");return I&&q.setAttributes(B,I),B},q.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},q.createMarker=function(I,B,Q,te,$,Ue,at){var pt=document.createElementNS("http://www.w3.org/2000/svg","marker");return q.setAttributes(pt,[["id",I],["orient",B],["markerWidth",Q.toString()],["markerHeight",te.toString()],["refX",$.toString()],["refY",Ue.toString()]]),pt.appendChild(at),pt},q.createText=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","text");return B.setAttribute("x","0"),B.setAttribute("y","0"),I&&q.setAttributes(B,I),B},q.createTSpan=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","tspan");return Q.textContent=I,B&&q.setAttributes(Q,B),Q},q.createImage=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","image");return I&&q.setAttributes(B,I),B},q.createPoint=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return Q.x=I,Q.y=B,Q},q.createPath=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","path");return Q.setAttribute("d",I),B&&q.setAttributes(Q,B),Q},q}(),le=function(){function q(){}return q.addKey=function(I){q.key=I},Object.defineProperty(q,"isLicensed",{get:function(){return!!q.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(q.key)},enumerable:!1,configurable:!0}),q}(),Se=function(){function q(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return q.prototype.rasterize=function(I,B,Q){var te=this;return new Promise(function($){var Ue=Q!==void 0?Q:document.createElement("canvas");I===null&&(te.markersOnly=!0,te.naturalSize=!1);var at=document.createElementNS("http://www.w3.org/2000/svg","svg");at.setAttribute("xmlns","http://www.w3.org/2000/svg"),at.setAttribute("width",B.width.baseVal.valueAsString),at.setAttribute("height",B.height.baseVal.valueAsString),at.setAttribute("viewBox","0 0 "+B.viewBox.baseVal.width.toString()+" "+B.viewBox.baseVal.height.toString()),at.innerHTML=B.innerHTML,te.naturalSize===!0?(at.width.baseVal.value=I.naturalWidth,at.height.baseVal.value=I.naturalHeight):te.width!==void 0&&te.height!==void 0&&(at.width.baseVal.value=te.width,at.height.baseVal.value=te.height),Ue.width=at.width.baseVal.value,Ue.height=at.height.baseVal.value;var pt=at.outerHTML,wt=Ue.getContext("2d");te.markersOnly!==!0&&wt.drawImage(I,0,0,Ue.width,Ue.height);var lt=window.URL,It=new Image(Ue.width,Ue.height);It.setAttribute("crossOrigin","anonymous");var jt=new Blob([pt],{type:"image/svg+xml"}),nr=lt.createObjectURL(jt);It.onload=function(){wt.drawImage(It,0,0),lt.revokeObjectURL(nr);var Gr=Ue.toDataURL(te.imageType,te.imageQuality);$(Gr)},It.src=nr})},q}(),pe=function(){},Ge=function(){function q(I){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+I+"_"}return Object.defineProperty(q.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),q.prototype.addClass=function(I){return this.styleSheet===void 0&&this.addStyleSheet(),I.name=""+this.classNamePrefix+I.localName,this.classes.push(I),this.styleSheet.sheet.insertRule("."+I.name+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length),I},q.prototype.addRule=function(I){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(I),this.styleSheet.sheet.insertRule(I.selector+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length)},q.prototype.addStyleSheet=function(){var I;this.styleSheet=document.createElement("style"),((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).appendChild(this.styleSheet),this.addRule(new fe("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new fe("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new fe("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ge("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ge("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},q.prototype.removeStyleSheet=function(){var I;this.styleSheet&&(((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},q}(),fe=function(q,I){this.selector=q,this.style=I},ge=function(q,I){this.localName=q,this.style=I},De=function(){function q(I,B,Q,te,$){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=I,this.displayMode=B,this.markerItems=Q,this.uiStyleSettings=te,this.styles=$,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return q.prototype.show=function(I){var B=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=I,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var Q=document.createElement("div");Q.className=this.toolbarBlockStyleClass.name,Q.style.whiteSpace="nowrap",this.uiContainer.appendChild(Q),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(Q,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function($){var Ue=document.createElement("div");Ue.className=""+B.toolbarButtonStyleClass.name,Ue.setAttribute("data-type-name",$.typeName),Ue.innerHTML=$.icon,Ue.addEventListener("click",function(){B.markerToolbarButtonClicked(Ue,$)}),B.buttons.push(Ue),B.markerButtons.push(Ue)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var te=document.createElement("div");te.className=this.toolbarBlockStyleClass.name,te.style.whiteSpace="nowrap",te.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(te),this.addActionButton(te,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(te,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},q.prototype.addButtonClickListener=function(I){this.buttonClickListeners.push(I)},q.prototype.removeButtonClickListener=function(I){this.buttonClickListeners.indexOf(I)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(I),1)},q.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},q.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var I=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var B=0;B<this.markerButtons.length;B++)B<I||B===I&&this.markerButtons.length-1===I?this.markerButtonBlock.appendChild(this.markerButtons[B]):(B===I&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[B]))}},q.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},q.prototype.resetButtonStyles=function(){var I=this;this.buttons.forEach(function(B){B.className=B.className.replace(I.uiStyleSettings.toolbarButtonStyleColorsClassName?I.uiStyleSettings.toolbarButtonStyleColorsClassName:I.toolbarButtonStyleColorsClass.name,"").trim(),B.className=B.className.replace(I.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?I.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:I.toolbarActiveButtonStyleColorsClass.name,"").trim(),B.className+=" "+(I.uiStyleSettings.toolbarButtonStyleColorsClassName?I.uiStyleSettings.toolbarButtonStyleColorsClassName:I.toolbarButtonStyleColorsClass.name)})},q.prototype.addActionButton=function(I,B,Q){var te=this,$=document.createElement("div");switch($.className=""+this.toolbarButtonStyleClass.name,$.innerHTML=B,$.setAttribute("data-action",Q),$.addEventListener("click",function(){te.actionToolbarButtonClicked($,Q)}),Q){case"select":$.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":$.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":$.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":$.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":$.style.fill=this.uiStyleSettings.closeButtonColor}I.appendChild($),this.buttons.push($)},q.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ge("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new ge("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ge("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new ge("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new ge("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var I=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ge("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px;
padding: `+I+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new fe("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new fe("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},q.prototype.markerToolbarButtonClicked=function(I,B){this.setActiveButton(I),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(Q){return Q("marker",B)}),this.markerButtonOverflowBlock.style.display="none"},q.prototype.actionToolbarButtonClicked=function(I,B){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(Q){return Q("action",B)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},q.prototype.setActiveButton=function(I){this.resetButtonStyles(),I.className=I.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),I.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},q.prototype.setActiveMarkerButton=function(I){var B=this.markerButtons.find(function(Q){return Q.getAttribute("data-type-name")===I});B&&this.setActiveButton(B)},q.prototype.setCurrentMarker=function(I){var B=this;this.currentMarker=I,this.buttons.filter(function(Q){return/delete|notes/.test(Q.getAttribute("data-action"))}).forEach(function(Q){B.currentMarker===void 0?(Q.style.fillOpacity="0.4",Q.style.pointerEvents="none"):(Q.style.fillOpacity="1",Q.style.pointerEvents="all")})},q}(),Ve=function(){function q(I,B,Q,te){this.panels=[],this.panelButtons=[],this.markerjsContainer=I,this.displayMode=B,this.uiStyleSettings=Q,this.styles=te,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return q.prototype.addStyles=function(){var I;this.toolboxStyleClass=this.styles.addClass(new ge("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new ge("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var B=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new ge("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new ge("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new ge("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new ge("toolbox-panel-row_colors",`
background-color: `+((I=this.uiStyleSettings.toolboxBackgroundColor)!==null&&I!==void 0?I:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new ge("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*B)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*B)+`px;
padding: `+B+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new ge("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new fe("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new fe("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},q.prototype.show=function(I){var B;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=I,this.uiContainer.className=this.toolboxStyleClass.name+" "+((B=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},q.prototype.setPanelButtons=function(I){var B,Q,te=this;this.panels=I,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((B=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&B!==void 0?B:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((Q=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&Q!==void 0?Q:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function($){var Ue;$.uiStyleSettings=te.uiStyleSettings;var at=document.createElement("div");at.className=te.toolboxButtonStyleClass.name+" "+((Ue=te.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Ue!==void 0?Ue:te.toolboxButtonStyleColorsClass.name),at.innerHTML=$.icon,at.title=$.title,at.addEventListener("click",function(){te.panelButtonClick($)}),te.panelButtons.push(at),te.buttonRow.appendChild(at)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},q.prototype.panelButtonClick=function(I){var B=this,Q=-1;if(I!==this.activePanel){Q=this.panels.indexOf(I),this.panelRow.innerHTML="";var te=I.getUi();te.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(te),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=I}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){B.displayMode==="inline"?B.panelRow.style.display="none":B.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function($,Ue){var at,pt;$.className=B.toolboxButtonStyleClass.name+" "+(Ue===Q?""+((at=B.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&at!==void 0?at:B.toolboxActiveButtonStyleColorsClass.name):""+((pt=B.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&pt!==void 0?pt:B.toolboxButtonStyleColorsClass.name))})},q}(),Qe=function(q,I){this.title=q,this.icon=I},ke=function(q){function I(B,Q,te,$){var Ue=q.call(this,B,$||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return Ue.colors=[],Ue.addTransparent=!1,Ue.colorBoxes=[],Ue.colors=Q,Ue.currentColor=te,Ue.setCurrentColor=Ue.setCurrentColor.bind(Ue),Ue.getColorBox=Ue.getColorBox.bind(Ue),Ue}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");return Q.style.overflow="hidden",Q.style.whiteSpace="nowrap",this.colors.forEach(function(te){var $=B.getColorBox(te);Q.appendChild($),B.colorBoxes.push($)}),Q},I.prototype.getColorBox=function(B){var Q=this,te=this.uiStyleSettings.toolbarHeight/4,$=this.uiStyleSettings.toolbarHeight-te,Ue=document.createElement("div");Ue.style.display="inline-block",Ue.style.boxSizing="content-box",Ue.style.width=$-2+"px",Ue.style.height=$-2+"px",Ue.style.padding="1px",Ue.style.marginRight="2px",Ue.style.marginBottom="2px",Ue.style.borderWidth="2px",Ue.style.borderStyle="solid",Ue.style.borderRadius=($+2)/2+"px",Ue.style.borderColor=B===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",Ue.addEventListener("click",function(){Q.setCurrentColor(B,Ue)});var at=document.createElement("div");return at.style.display="inline-block",at.style.width=$-2+"px",at.style.height=$-2+"px",at.style.backgroundColor=B,at.style.borderRadius=$/2+"px",B==="transparent"&&(at.style.fill=this.uiStyleSettings.toolboxAccentColor,at.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),Ue.appendChild(at),Ue},I.prototype.setCurrentColor=function(B,Q){var te=this;this.currentColor=B,this.colorBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(B)},I}(Qe),Fe=function(){function q(I,B,Q){this._state="new",this._isSelected=!1,this._container=I,this._overlayContainer=B,this.globalSettings=Q,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(q.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),q.prototype.ownsTarget=function(I){return!1},Object.defineProperty(q.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),q.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},q.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},q.prototype.pointerDown=function(I,B){},q.prototype.dblClick=function(I,B){},q.prototype.manipulate=function(I){},q.prototype.pointerUp=function(I){this.stateChanged()},q.prototype.dispose=function(){},q.prototype.addMarkerVisualToContainer=function(I){this.container.childNodes.length>0?this.container.insertBefore(I,this.container.childNodes[0]):this.container.appendChild(I)},q.prototype.getState=function(){return{typeName:q.typeName,state:this.state,notes:this.notes}},q.prototype.restoreState=function(I){this._state=I.state,this.notes=I.notes},q.prototype.scale=function(I,B){},q.prototype.colorChanged=function(I){this.onColorChanged&&this.onColorChanged(I),this.stateChanged()},q.prototype.fillColorChanged=function(I){this.onFillColorChanged&&this.onFillColorChanged(I),this.stateChanged()},q.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var I=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),I.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(I)&&this.onStateChanged(this)}},q.typeName="MarkerBase",q}(),Ne=function(){function q(){this.findGripByVisual=this.findGripByVisual.bind(this)}return q.prototype.findGripByVisual=function(I){return this.topLeft.ownsTarget(I)?this.topLeft:this.topCenter.ownsTarget(I)?this.topCenter:this.topRight.ownsTarget(I)?this.topRight:this.centerLeft.ownsTarget(I)?this.centerLeft:this.centerRight.ownsTarget(I)?this.centerRight:this.bottomLeft.ownsTarget(I)?this.bottomLeft:this.bottomCenter.ownsTarget(I)?this.bottomCenter:this.bottomRight.ownsTarget(I)?this.bottomRight:void 0},q}(),Me=function(){function q(){this.GRIP_SIZE=10,this.visual=xe.createGroup(),this.visual.appendChild(xe.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(xe.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return q.prototype.ownsTarget=function(I){return I===this.visual||I===this.visual.childNodes[0]||I===this.visual.childNodes[1]},q}(),ne=function(){function q(){}return q.toITransformMatrix=function(I){return{a:I.a,b:I.b,c:I.c,d:I.d,e:I.e,f:I.f}},q.toSVGMatrix=function(I,B){return I.a=B.a,I.b=B.b,I.c=B.c,I.d=B.d,I.e=B.e,I.f=B.f,I},q}(),_e=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.left=0,$.top=0,$.width=0,$.height=0,$.defaultSize={x:50,y:20},$.offsetX=0,$.offsetY=0,$.rotationAngle=0,$.CB_DISTANCE=10,$._suppressMarkerCreateEvent=!1,$.container.transform.baseVal.appendItem(xe.createTransform()),$.setupControlBox(),$}return Oe(I,q),Object.defineProperty(I.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"visual",{get:function(){return this._visual},set:function(B){this._visual=B;var Q=xe.createTransform();this._visual.transform.baseVal.appendItem(Q)},enumerable:!1,configurable:!0}),I.prototype.ownsTarget=function(B){return!!q.prototype.ownsTarget.call(this,B)||!!(this.controlGrips.findGripByVisual(B)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(B))},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="new"&&(this.left=B.x,this.top=B.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var te=this.unrotatePoint(B);if(this.manipulationStartX=te.x,this.manipulationStartY=te.y,this.offsetX=te.x-this.left,this.offsetY=te.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(Q),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(Q)){this.activeGrip=this.rotatorGrip;var $=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=$.x-this.width/2,this.top=$.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var Ue=this.container.transform.baseVal.getItem(0);Ue.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(Ue,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},I.prototype.pointerUp=function(B){var Q=this.state;q.prototype.pointerUp.call(this,B),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(B),this._state="select",Q==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},I.prototype.moveVisual=function(B){this.visual.style.transform="translate("+B.x+"px, "+B.y+"px)"},I.prototype.manipulate=function(B){var Q=this.unrotatePoint(B);this.state==="creating"?this.resize(B):this.state==="move"?(this.left=this.manipulationStartLeft+(Q.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(Q.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(Q):this.state==="rotate"&&this.rotate(B)},I.prototype.resize=function(B){var Q=this.manipulationStartLeft,te=this.manipulationStartWidth,$=this.manipulationStartTop,Ue=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:Q=this.manipulationStartLeft+B.x-this.manipulationStartX,te=this.manipulationStartWidth+this.manipulationStartLeft-Q;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:te=this.manipulationStartWidth+B.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:$=this.manipulationStartTop+B.y-this.manipulationStartY,Ue=this.manipulationStartHeight+this.manipulationStartTop-$;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:Ue=this.manipulationStartHeight+B.y-this.manipulationStartY}te>=0?(this.left=Q,this.width=te):(this.left=Q+te,this.width=-te),Ue>=0?(this.top=$,this.height=Ue):(this.top=$+Ue,this.height=-Ue),this.setSize()},I.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},I.prototype.rotate=function(B){if(Math.abs(B.x-this.centerX)>.1){var Q=Math.sign(B.x-this.centerX);this.rotationAngle=180*Math.atan((B.y-this.centerY)/(B.x-this.centerX))/Math.PI+90*Q,this.applyRotation()}},I.prototype.applyRotation=function(){var B=this.container.transform.baseVal.getItem(0);B.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(B,0)},I.prototype.rotatePoint=function(B){if(this.rotationAngle===0)return B;var Q=this.container.getCTM(),te=xe.createPoint(B.x,B.y);return{x:(te=te.matrixTransform(Q)).x,y:te.y}},I.prototype.unrotatePoint=function(B){if(this.rotationAngle===0)return B;var Q=this.container.getCTM();Q=Q.inverse();var te=xe.createPoint(B.x,B.y);return{x:(te=te.matrixTransform(Q)).x,y:te.y}},I.prototype.select=function(){q.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},I.prototype.deselect=function(){q.prototype.deselect.call(this),this.controlBox.style.display="none"},I.prototype.setupControlBox=function(){this.controlBox=xe.createGroup();var B=xe.createTransform();B.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(B),this.container.appendChild(this.controlBox),this.controlRect=xe.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=xe.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ne,this.addControlGrips(),this.controlBox.style.display="none"},I.prototype.adjustControlBox=function(){var B=this.controlBox.transform.baseVal.getItem(0);B.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(B,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},I.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},I.prototype.createGrip=function(){var B=new Me;return B.visual.transform.baseVal.appendItem(xe.createTransform()),this.controlBox.appendChild(B.visual),B},I.prototype.positionGrips=function(){var B=this.controlGrips.topLeft.GRIP_SIZE,Q=-B/2,te=Q,$=(this.width+this.CB_DISTANCE)/2-B/2,Ue=(this.height+this.CB_DISTANCE)/2-B/2,at=this.height+this.CB_DISTANCE-B/2,pt=this.width+this.CB_DISTANCE-B/2;this.positionGrip(this.controlGrips.topLeft.visual,Q,te),this.positionGrip(this.controlGrips.topCenter.visual,$,te),this.positionGrip(this.controlGrips.topRight.visual,pt,te),this.positionGrip(this.controlGrips.centerLeft.visual,Q,Ue),this.positionGrip(this.controlGrips.centerRight.visual,pt,Ue),this.positionGrip(this.controlGrips.bottomLeft.visual,Q,at),this.positionGrip(this.controlGrips.bottomCenter.visual,$,at),this.positionGrip(this.controlGrips.bottomRight.visual,pt,at),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,$,te-3*this.CB_DISTANCE)},I.prototype.positionGrip=function(B,Q,te){var $=B.transform.baseVal.getItem(0);$.setTranslate(Q,te),B.transform.baseVal.replaceItem($,0)},I.prototype.hideControlBox=function(){this.controlBox.style.display="none"},I.prototype.showControlBox=function(){this.controlBox.style.display=""},I.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ne.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ne.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},q.prototype.getState.call(this))},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B);var Q=B;this.left=Q.left,this.top=Q.top,this.width=Q.width,this.height=Q.height,this.rotationAngle=Q.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,Q.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,Q.containerTransformMatrix))},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q);var te=this.rotatePoint({x:this.left,y:this.top}),$=this.unrotatePoint({x:te.x*B,y:te.y*Q});this.left=$.x,this.top=$.y,this.width=this.width*B,this.height=this.height*Q,this.adjustControlBox()},I}(Fe),ae=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.fillColor="transparent",$.strokeColor="transparent",$.strokeWidth=0,$.strokeDasharray="",$.opacity=1,$.setStrokeColor=$.setStrokeColor.bind($),$.setFillColor=$.setFillColor.bind($),$.setStrokeWidth=$.setStrokeWidth.bind($),$.setStrokeDasharray=$.setStrokeDasharray.bind($),$.createVisual=$.createVisual.bind($),$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.visual)},I.prototype.createVisual=function(){this.visual=xe.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="new"&&(this.createVisual(),this.moveVisual(B),this._state="creating")},I.prototype.manipulate=function(B){q.prototype.manipulate.call(this,B)},I.prototype.resize=function(B){q.prototype.resize.call(this,B),this.setSize()},I.prototype.setSize=function(){q.prototype.setSize.call(this),xe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},I.prototype.pointerUp=function(B){q.prototype.pointerUp.call(this,B),this.setSize()},I.prototype.setStrokeColor=function(B){this.strokeColor=B,this.visual&&xe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(B),this.stateChanged()},I.prototype.setFillColor=function(B){this.fillColor=B,this.visual&&xe.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},I.prototype.setStrokeWidth=function(B){this.strokeWidth=B,this.visual&&xe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},I.prototype.setStrokeDasharray=function(B){this.strokeDasharray=B,this.visual&&xe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},I.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},q.prototype.getState.call(this))},I.prototype.restoreState=function(B){var Q=B;this.fillColor=Q.fillColor,this.strokeColor=Q.strokeColor,this.strokeWidth=Q.strokeWidth,this.strokeDasharray=Q.strokeDasharray,this.opacity=Q.opacity,this.createVisual(),q.prototype.restoreState.call(this,B),this.setSize()},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.setSize()},I.title="Rectangle marker",I}(_e),Ie=function(q){function I(B,Q,te,$){var Ue=q.call(this,B,$||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return Ue.widths=[],Ue.widthBoxes=[],Ue.widths=Q,Ue.currentWidth=te,Ue.setCurrentWidth=Ue.setCurrentWidth.bind(Ue),Ue}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");return Q.style.display="flex",Q.style.overflow="hidden",Q.style.flexGrow="2",this.widths.forEach(function(te){var $=document.createElement("div");$.style.display="flex",$.style.flexGrow="2",$.style.alignItems="center",$.style.justifyContent="space-between",$.style.padding="5px",$.style.borderWidth="2px",$.style.borderStyle="solid",$.style.borderColor=te===B.currentWidth?B.uiStyleSettings.toolboxAccentColor:"transparent",$.addEventListener("click",function(){B.setCurrentWidth(te,$)}),Q.appendChild($);var Ue=document.createElement("div");Ue.innerText=te.toString(),Ue.style.marginRight="5px",$.appendChild(Ue);var at=document.createElement("div");at.style.minHeight="20px",at.style.flexGrow="2",at.style.display="flex",at.style.alignItems="center";var pt=document.createElement("hr");pt.style.minWidth="20px",pt.style.border="0px",pt.style.borderTop=te+"px solid "+B.uiStyleSettings.toolboxColor,pt.style.flexGrow="2",at.appendChild(pt),$.appendChild(at),B.widthBoxes.push($)}),Q},I.prototype.setCurrentWidth=function(B,Q){var te=this;this.currentWidth=B,this.widthBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},I}(Qe),Je=function(q){function I(B,Q,te,$){var Ue=q.call(this,B,$||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return Ue.styles=[],Ue.styleBoxes=[],Ue.styles=Q,Ue.currentStyle=te,Ue.setCurrentStyle=Ue.setCurrentStyle.bind(Ue),Ue}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");return Q.style.display="flex",Q.style.overflow="hidden",Q.style.flexGrow="2",this.styles.forEach(function(te){var $=document.createElement("div");$.style.display="flex",$.style.alignItems="center",$.style.justifyContent="space-between",$.style.padding="5px",$.style.borderWidth="2px",$.style.borderStyle="solid",$.style.overflow="hidden",$.style.maxWidth=100/B.styles.length-5+"%",$.style.borderColor=te===B.currentStyle?B.uiStyleSettings.toolboxAccentColor:"transparent",$.addEventListener("click",function(){B.setCurrentStyle(te,$)}),Q.appendChild($);var Ue=document.createElement("div");Ue.style.minHeight="20px",Ue.style.flexGrow="2",Ue.style.overflow="hidden";var at=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+B.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(te!==""?'stroke-dasharray="'+te+'"':"")+` />
</svg>`;Ue.innerHTML=at,$.appendChild(Ue),B.styleBoxes.push($)}),Q},I.prototype.setCurrentStyle=function(B,Q){var te=this;this.currentStyle=B,this.styleBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},I}(Qe),et=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.strokeColor=te.defaultColor,$.strokeWidth=te.defaultStrokeWidth,$.strokeDasharray=te.defaultStrokeDasharray,$.strokePanel=new ke("Line color",te.defaultColorSet,te.defaultColor),$.strokePanel.onColorChanged=$.setStrokeColor,$.strokeWidthPanel=new Ie("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),$.strokeWidthPanel.onWidthChanged=$.setStrokeWidth,$.strokeStylePanel=new Je("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),$.strokeStylePanel.onStyleChanged=$.setStrokeDasharray,$}return Oe(I,q),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=q.prototype.getState.call(this);return B.typeName=I.typeName,B},I.typeName="FrameMarker",I.title="Frame marker",I.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',I}(ae),Ke=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},it=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.x1=0,$.y1=0,$.x2=0,$.y2=0,$.defaultLength=50,$.manipulationStartX=0,$.manipulationStartY=0,$.manipulationStartX1=0,$.manipulationStartY1=0,$.manipulationStartX2=0,$.manipulationStartY2=0,$.setupControlBox(),$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!!q.prototype.ownsTarget.call(this,B)||!(!this.grip1.ownsTarget(B)&&!this.grip2.ownsTarget(B))},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.manipulationStartX=B.x,this.manipulationStartY=B.y,this.state==="new"&&(this.x1=B.x,this.y1=B.y,this.x2=B.x,this.y2=B.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(Q)?this.activeGrip=this.grip1:this.grip2.ownsTarget(Q)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},I.prototype.pointerUp=function(B){var Q=this.state;q.prototype.pointerUp.call(this,B),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(B),this._state="select",Q==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},I.prototype.adjustVisual=function(){},I.prototype.manipulate=function(B){this.state==="creating"?this.resize(B):this.state==="move"?(this.x1=this.manipulationStartX1+B.x-this.manipulationStartX,this.y1=this.manipulationStartY1+B.y-this.manipulationStartY,this.x2=this.manipulationStartX2+B.x-this.manipulationStartX,this.y2=this.manipulationStartY2+B.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(B)},I.prototype.resize=function(B){switch(this.activeGrip){case this.grip1:this.x1=B.x,this.y1=B.y;break;case this.grip2:case void 0:this.x2=B.x,this.y2=B.y}this.adjustVisual(),this.adjustControlBox()},I.prototype.select=function(){q.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},I.prototype.deselect=function(){q.prototype.deselect.call(this),this.controlBox.style.display="none"},I.prototype.setupControlBox=function(){this.controlBox=xe.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},I.prototype.adjustControlBox=function(){this.positionGrips()},I.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},I.prototype.createGrip=function(){var B=new Me;return B.visual.transform.baseVal.appendItem(xe.createTransform()),this.controlBox.appendChild(B.visual),B},I.prototype.positionGrips=function(){var B=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-B/2,this.y1-B/2),this.positionGrip(this.grip2.visual,this.x2-B/2,this.y2-B/2)},I.prototype.positionGrip=function(B,Q,te){var $=B.transform.baseVal.getItem(0);$.setTranslate(Q,te),B.transform.baseVal.replaceItem($,0)},I.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},q.prototype.getState.call(this))},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B);var Q=B;this.x1=Q.x1,this.y1=Q.y1,this.x2=Q.x2,this.y2=Q.y2},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.x1=this.x1*B,this.y1=this.y1*Q,this.x2=this.x2*B,this.y2=this.y2*Q,this.adjustVisual(),this.adjustControlBox()},I}(Fe),he=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.strokeColor="transparent",$.strokeWidth=0,$.strokeDasharray="",$.setStrokeColor=$.setStrokeColor.bind($),$.setStrokeWidth=$.setStrokeWidth.bind($),$.setStrokeDasharray=$.setStrokeDasharray.bind($),$.strokeColor=te.defaultColor,$.strokeWidth=te.defaultStrokeWidth,$.strokeDasharray=te.defaultStrokeDasharray,$.strokePanel=new ke("Line color",te.defaultColorSet,te.defaultColor),$.strokePanel.onColorChanged=$.setStrokeColor,$.strokeWidthPanel=new Ie("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),$.strokeWidthPanel.onWidthChanged=$.setStrokeWidth,$.strokeStylePanel=new Je("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),$.strokeStylePanel.onStyleChanged=$.setStrokeDasharray,$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.visual&&B!==this.selectorLine&&B!==this.visibleLine)},I.prototype.createVisual=function(){this.visual=xe.createGroup(),this.selectorLine=xe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=xe.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},I.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),xe.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),xe.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),xe.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},I.prototype.setStrokeColor=function(B){this.strokeColor=B,this.adjustVisual(),this.colorChanged(B)},I.prototype.setStrokeWidth=function(B){this.strokeWidth=B,this.adjustVisual()},I.prototype.setStrokeDasharray=function(B){this.strokeDasharray=B,this.adjustVisual(),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B);var Q=B;this.strokeColor=Q.strokeColor,this.strokeWidth=Q.strokeWidth,this.strokeDasharray=Q.strokeDasharray,this.createVisual(),this.adjustVisual()},I.typeName="LineMarker",I.title="Line marker",I.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',I}(it),Re=function(q){function I(B,Q,te,$){var Ue=q.call(this,B,$||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return Ue.fonts=[],Ue.fontBoxes=[],Ue.fonts=Q,Ue.currentFont=te,Ue.setCurrentFont=Ue.setCurrentFont.bind(Ue),Ue}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");return Q.style.overflow="hidden",Q.style.flexGrow="2",this.fonts.forEach(function(te){var $=document.createElement("div");$.style.display="inline-block",$.style.alignItems="center",$.style.justifyContent="space-between",$.style.padding="5px",$.style.borderWidth="2px",$.style.borderStyle="solid",$.style.overflow="hidden",$.style.maxWidth=100/B.fonts.length-5+"%",$.style.borderColor=te===B.currentFont?B.uiStyleSettings.toolboxAccentColor:"transparent",$.addEventListener("click",function(){B.setCurrentFont(te,$)}),Q.appendChild($);var Ue=document.createElement("div");Ue.style.display="flex",Ue.style.minHeight="20px",Ue.style.flexGrow="2",Ue.style.fontFamily=te,Ue.style.overflow="hidden";var at=document.createElement("div");at.style.whiteSpace="nowrap",at.style.overflow="hidden",at.style.textOverflow="ellipsis",at.innerHTML="The quick brown fox jumps over the lazy dog",Ue.appendChild(at),$.appendChild(Ue),B.fontBoxes.push($)}),Q},I.prototype.setCurrentFont=function(B,Q){var te=this;this.currentFont=B,this.fontBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},I}(Qe),He=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.color="transparent",$.padding=5,$.DEFAULT_TEXT="your text here",$.text=$.DEFAULT_TEXT,$.isMoved=!1,$.color=te.defaultColor,$.fontFamily=te.defaultFontFamily,$.defaultSize={x:100,y:30},$.setColor=$.setColor.bind($),$.setFont=$.setFont.bind($),$.renderText=$.renderText.bind($),$.sizeText=$.sizeText.bind($),$.textEditDivClicked=$.textEditDivClicked.bind($),$.showTextEditor=$.showTextEditor.bind($),$.setSize=$.setSize.bind($),$.positionTextEditor=$.positionTextEditor.bind($),$.colorPanel=new ke("Color",te.defaultColorSet,te.defaultColor),$.colorPanel.onColorChanged=$.setColor,$.fontFamilyPanel=new Re("Font",te.defaultFontFamilies,te.defaultFontFamily),$.fontFamilyPanel.onFontChanged=$.setFont,$}return Oe(I,q),I.prototype.ownsTarget=function(B){if(q.prototype.ownsTarget.call(this,B)||B===this.visual||B===this.textElement||B===this.bgRectangle)return!0;var Q=!1;return this.textElement.childNodes.forEach(function(te){te===B&&(Q=!0)}),Q},I.prototype.createVisual=function(){this.visual=xe.createGroup(),this.bgRectangle=xe.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=xe.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(xe.createTransform()),this.textElement.transform.baseVal.appendItem(xe.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.isMoved=!1,this.pointerDownPoint=B,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(B),this._state="creating")},I.prototype.renderText=function(){var B=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(Q){B.textElement.appendChild(xe.createTSpan(Q.trim()===""?" ":Q.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},I.prototype.getTextScale=function(){var B=this.textElement.getBBox(),Q=1;if(B.width>0&&B.height>0){var te=(1*this.width-this.width*this.padding*2/100)/B.width,$=(1*this.height-this.height*this.padding*2/100)/B.height;Q=Math.min(te,$)}return Q},I.prototype.getTextPosition=function(B){var Q=this.textElement.getBBox(),te=0,$=0;return Q.width>0&&Q.height>0&&(te=(this.width-Q.width*B)/2,$=this.height/2-Q.height*B/2),{x:te,y:$}},I.prototype.sizeText=function(){var B=this.textElement.getBBox(),Q=this.getTextScale(),te=this.getTextPosition(Q);te.y-=B.y*Q,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+te.x+"px, "+te.y+"px) scale("+Q+", "+Q+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(te.x,te.y),this.textElement.transform.baseVal.getItem(1).setScale(Q,Q))},I.prototype.manipulate=function(B){q.prototype.manipulate.call(this,B),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(B.x-this.pointerDownPoint.x)>5||Math.abs(B.y-this.pointerDownPoint.y)>5)},I.prototype.resize=function(B){q.prototype.resize.call(this,B),this.isMoved=!0,this.setSize(),this.sizeText()},I.prototype.setSize=function(){q.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(xe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),xe.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},I.prototype.pointerUp=function(B){var Q=this.state;Q==="creating"&&(this._suppressMarkerCreateEvent=!0),q.prototype.pointerUp.call(this,B),this.setSize(),(Q==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},I.prototype.showTextEditor=function(){var B=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(Q){Q.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var Q=Number.parseFloat(B.textEditor.style.fontSize);B.textEditor.clientWidth>=Number.parseInt(B.textEditor.style.maxWidth)&&Q>.9;)Q-=.1,B.textEditor.style.fontSize=Math.max(Q,.9)+"em"}),this.textEditor.addEventListener("keyup",function(Q){Q.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(Q){if(Q.clipboardData){var te=Q.clipboardData.getData("text"),$=window.getSelection();if(!$.rangeCount)return!1;$.deleteFromDocument(),$.getRangeAt(0).insertNode(document.createTextNode(te)),Q.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){B.textEditDivClicked(B.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},I.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var B=this.getTextScale(),Q=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),te=this.textElement.getBBox(),$={x:te.width*B,y:te.height*B};Q.x-=$.x/2,Q.y-=$.y/2,this.textEditor.style.top=Q.y+"px",this.textEditor.style.left=Q.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-Q.x+"px",this.textEditor.style.fontSize=Math.max(16*B,12)+"px",this.textElement.style.display="none"}},I.prototype.textEditDivClicked=function(B){this.text=B.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},I.prototype.select=function(){q.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},I.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),q.prototype.deselect.call(this)},I.prototype.dblClick=function(B,Q){q.prototype.dblClick.call(this,B,Q),this.showTextEditor()},I.prototype.setColor=function(B){this.textElement&&xe.setAttributes(this.textElement,[["fill",B]]),this.color=B,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(B)},I.prototype.setFont=function(B){this.textElement&&xe.setAttributes(this.textElement,[["font-family",B]]),this.fontFamily=B,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},I.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},I.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){var Q=B;this.color=Q.color,this.fontFamily=Q.fontFamily,this.padding=Q.padding,this.text=Q.text,this.createVisual(),q.prototype.restoreState.call(this,B),this.setSize()},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.setSize(),this.sizeText(),this.positionTextEditor()},I.typeName="TextMarker",I.title="Text marker",I.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',I}(_e),Ee=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.color="transparent",$.lineWidth=3,$.drawing=!1,$.pixelRatio=1,$.color=te.defaultColor,$.lineWidth=te.defaultStrokeWidth,$.pixelRatio=te.freehandPixelRatio,$.setColor=$.setColor.bind($),$.addCanvas=$.addCanvas.bind($),$.finishCreation=$.finishCreation.bind($),$.setLineWidth=$.setLineWidth.bind($),$.colorPanel=new ke("Color",te.defaultColorSet,te.defaultColor),$.colorPanel.onColorChanged=$.setColor,$.lineWidthPanel=new Ie("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),$.lineWidthPanel.onWidthChanged=$.setLineWidth,$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.visual&&B!==this.drawingImage)},I.prototype.createVisual=function(){this.visual=xe.createGroup(),this.drawingImage=xe.createImage(),this.visual.appendChild(this.drawingImage);var B=xe.createTransform();this.visual.transform.baseVal.appendItem(B),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(B,Q){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(B.x,B.y),this.drawing=!0):q.prototype.pointerDown.call(this,B,Q)},I.prototype.manipulate=function(B){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(B.x,B.y),this.canvasContext.stroke()):q.prototype.manipulate.call(this,B)},I.prototype.resize=function(B){q.prototype.resize.call(this,B),xe.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),xe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},I.prototype.pointerUp=function(B){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):q.prototype.pointerUp.call(this,B)},I.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},I.prototype.select=function(){this.state==="creating"&&this.finishCreation(),q.prototype.select.call(this)},I.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),q.prototype.deselect.call(this)},I.prototype.finishCreation=function(){for(var B=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),Q=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],te=Q[0],$=Q[1],Ue=Q[2],at=Q[3],pt=!1,wt=0;wt<this.canvasElement.height;wt++)for(var lt=0;lt<this.canvasElement.width;lt++)B.data[wt*this.canvasElement.width*4+4*lt+3]>0&&(pt=!0,wt<$&&($=wt),lt<te&&(te=lt),wt>at&&(at=wt),lt>Ue&&(Ue=lt));if(pt){this.left=te/this.pixelRatio,this.top=$/this.pixelRatio,this.width=(Ue-te)/this.pixelRatio,this.height=(at-$)/this.pixelRatio;var It=document.createElement("canvas");It.width=Ue-te,It.height=at-$,It.getContext("2d").putImageData(this.canvasContext.getImageData(te,$,Ue-te,at-$),0,0),this.drawingImgUrl=It.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},I.prototype.setDrawingImage=function(){xe.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),xe.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},I.prototype.setColor=function(B){this.color=B,this.colorChanged(B)},I.prototype.setLineWidth=function(B){this.lineWidth=B},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({drawingImgUrl:this.drawingImgUrl},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){this.createVisual(),q.prototype.restoreState.call(this,B),this.drawingImgUrl=B.drawingImgUrl,this.setDrawingImage()},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.setDrawingImage()},I.typeName="FreehandMarker",I.title="Freehand marker",I.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',I}(_e),ve=function(q){function I(B,Q,te){var $=q.call(this,B,te||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return $.typeBoxes=[],$.currentType=Q,$.setCurrentType=$.setCurrentType.bind($),$}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");Q.style.display="flex",Q.style.overflow="hidden",Q.style.flexGrow="2";for(var te=function(at){var pt="both";switch(at){case 0:pt="both";break;case 1:pt="start";break;case 2:pt="end";break;case 3:pt="none"}var wt=document.createElement("div");if(wt.style.display="flex",wt.style.flexGrow="2",wt.style.alignItems="center",wt.style.justifyContent="space-between",wt.style.padding="5px",wt.style.borderWidth="2px",wt.style.borderStyle="solid",wt.style.borderColor=pt===$.currentType?$.uiStyleSettings.toolboxAccentColor:"transparent",wt.addEventListener("click",function(){B.setCurrentType(pt,wt)}),Q.appendChild(wt),pt==="both"||pt==="start"){var lt=document.createElement("div");lt.style.display="flex",lt.style.alignItems="center",lt.style.minHeight="20px",lt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+($.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,lt.style.marginLeft="5px",wt.appendChild(lt)}var It=document.createElement("div");It.style.display="flex",It.style.alignItems="center",It.style.minHeight="20px",It.style.flexGrow="2";var jt=document.createElement("hr");if(jt.style.minWidth="20px",jt.style.border="0px",jt.style.borderTop="3px solid "+($.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxColor:"#eeeeee"),jt.style.flexGrow="2",It.appendChild(jt),wt.appendChild(It),pt==="both"||pt==="end"){var nr=document.createElement("div");nr.style.display="flex",nr.style.alignItems="center",nr.style.minHeight="20px",nr.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+($.uiStyleSettings!==void 0?$.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,nr.style.marginRight="5px",wt.appendChild(nr)}$.typeBoxes.push(wt)},$=this,Ue=0;Ue<4;Ue++)te(Ue);return Q},I.prototype.setCurrentType=function(B,Q){var te=this;this.currentType=B,this.typeBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings!==void 0?te.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},I}(Qe),be=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.arrowType="end",$.arrowBaseHeight=10,$.arrowBaseWidth=10,$.getArrowPoints=$.getArrowPoints.bind($),$.setArrowType=$.setArrowType.bind($),$.arrowTypePanel=new ve("Arrow type","end"),$.arrowTypePanel.onArrowTypeChanged=$.setArrowType,$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.arrow1&&B!==this.arrow2)},I.prototype.getArrowPoints=function(B,Q){var te=this.arrowBaseWidth+2*this.strokeWidth,$=this.arrowBaseHeight+2*this.strokeWidth;return B-te/2+","+(Q+$/2)+" "+B+","+(Q-$/2)+" "+(B+te/2)+","+(Q+$/2)},I.prototype.createTips=function(){this.arrow1=xe.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(xe.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=xe.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(xe.createTransform()),this.visual.appendChild(this.arrow2)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="creating"&&this.createTips()},I.prototype.adjustVisual=function(){if(q.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",xe.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),xe.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var B=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),Q=this.arrow1.transform.baseVal.getItem(0);Q.setRotate(B,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(Q,0);var te=this.arrow2.transform.baseVal.getItem(0);te.setRotate(B+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(te,0)}},I.prototype.setArrowType=function(B){this.arrowType=B,this.adjustVisual(),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({arrowType:this.arrowType},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B);var Q=B;this.arrowType=Q.arrowType,this.createTips(),this.adjustVisual()},I.typeName="ArrowMarker",I.title="Arrow marker",I.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',I}(he),J=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.fillColor=te.defaultFillColor,$.strokeWidth=0,$.fillPanel=new ke("Color",te.defaultColorSet,te.defaultFillColor),$.fillPanel.onColorChanged=$.setFillColor,$}return Oe(I,q),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=q.prototype.getState.call(this);return B.typeName=I.typeName,B},I.typeName="CoverMarker",I.title="Cover marker",I.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',I}(ae),oe=function(q){function I(B,Q,te,$){var Ue=q.call(this,B,$||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return Ue.opacities=[],Ue.opacityBoxes=[],Ue.opacities=Q,Ue.currentOpacity=te,Ue.setCurrentOpacity=Ue.setCurrentOpacity.bind(Ue),Ue}return Oe(I,q),I.prototype.getUi=function(){var B=this,Q=document.createElement("div");return Q.style.display="flex",Q.style.overflow="hidden",Q.style.flexGrow="2",Q.style.justifyContent="space-between",this.opacities.forEach(function(te){var $=document.createElement("div");$.style.display="flex",$.style.alignItems="center",$.style.justifyContent="center",$.style.padding="5px",$.style.borderWidth="2px",$.style.borderStyle="solid",$.style.borderColor=te===B.currentOpacity?B.uiStyleSettings.toolboxAccentColor:"transparent",$.addEventListener("click",function(){B.setCurrentOpacity(te,$)}),Q.appendChild($);var Ue=document.createElement("div");Ue.innerText=100*te+"%",$.appendChild(Ue),B.opacityBoxes.push($)}),Q},I.prototype.setCurrentOpacity=function(B,Q){var te=this;this.currentOpacity=B,this.opacityBoxes.forEach(function($){$.style.borderColor=$===Q?te.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},I}(Qe),Z=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.setOpacity=$.setOpacity.bind($),$.fillColor=te.defaultHighlightColor,$.strokeWidth=0,$.opacity=te.defaultHighlightOpacity,$.fillPanel=new ke("Color",te.defaultColorSet,$.fillColor),$.fillPanel.onColorChanged=$.setFillColor,$.opacityPanel=new oe("Opacity",te.defaultOpacitySteps,$.opacity),$.opacityPanel.onOpacityChanged=$.setOpacity,$}return Oe(I,q),I.prototype.setOpacity=function(B){this.opacity=B,this.visual&&xe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=q.prototype.getState.call(this);return B.typeName=I.typeName,B},I.typeName="HighlightMarker",I.title="Highlight marker",I.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',I}(J),me='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',Xe=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.bgColor="transparent",$.tipPosition={x:0,y:0},$.tipBase1Position={x:0,y:0},$.tipBase2Position={x:0,y:0},$.tipMoving=!1,$.color=te.defaultStrokeColor,$.bgColor=te.defaultFillColor,$.fontFamily=te.defaultFontFamily,$.defaultSize={x:100,y:30},$.setBgColor=$.setBgColor.bind($),$.getTipPoints=$.getTipPoints.bind($),$.positionTip=$.positionTip.bind($),$.setTipPoints=$.setTipPoints.bind($),$.colorPanel=new ke("Text color",te.defaultColorSet,$.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),$.colorPanel.onColorChanged=$.setColor,$.bgColorPanel=new ke("Fill color",te.defaultColorSet,$.bgColor,me),$.bgColorPanel.onColorChanged=$.setBgColor,$.fontFamilyPanel=new Re("Font",te.defaultFontFamilies,te.defaultFontFamily),$.fontFamilyPanel.onFontChanged=$.setFont,$.tipGrip=new Me,$.tipGrip.visual.transform.baseVal.appendItem(xe.createTransform()),$.controlBox.appendChild($.tipGrip.visual),$}return Oe(I,q),I.prototype.ownsTarget=function(B){return q.prototype.ownsTarget.call(this,B)||this.tipGrip.ownsTarget(B)||this.tip===B},I.prototype.createTip=function(){xe.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=xe.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},I.prototype.pointerDown=function(B,Q){this.state==="new"&&q.prototype.pointerDown.call(this,B,Q),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(Q)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):q.prototype.pointerDown.call(this,B,Q)},I.prototype.pointerUp=function(B){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,q.prototype.pointerUp.call(this,B);else{var Q=this.state==="creating";q.prototype.pointerUp.call(this,B),this.setTipPoints(Q),this.positionTip()}},I.prototype.manipulate=function(B){if(this.tipMoving){var Q=this.unrotatePoint(B);this.tipPosition={x:Q.x-this.manipulationStartLeft,y:Q.y-this.manipulationStartTop},this.positionTip()}else q.prototype.manipulate.call(this,B)},I.prototype.setBgColor=function(B){this.bgRectangle&&this.tip&&(xe.setAttributes(this.bgRectangle,[["fill",B]]),xe.setAttributes(this.tip,[["fill",B]])),this.bgColor=B,this.fillColorChanged(B)},I.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},I.prototype.setTipPoints=function(B){B===void 0&&(B=!1);var Q=Math.min(this.height/2,15),te=this.height/5;B&&(this.tipPosition={x:Q+te/2,y:this.height+20});var $=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?$<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(te=this.width/5,Q=Math.min(this.width/2,15),this.tipBase1Position={x:Q,y:0},this.tipBase2Position={x:Q+te,y:0}):(this.tipBase1Position={x:0,y:Q},this.tipBase2Position={x:0,y:Q+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?$<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(te=this.width/5,Q=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-Q-te,y:0},this.tipBase2Position={x:this.width-Q,y:0}):(this.tipBase1Position={x:this.width,y:Q},this.tipBase2Position={x:this.width,y:Q+te}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?$<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(te=this.width/5,Q=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-Q-te,y:this.height},this.tipBase2Position={x:this.width-Q,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-Q-te},this.tipBase2Position={x:this.width,y:this.height-Q}):$<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(te=this.width/5,Q=Math.min(this.width/2,15),this.tipBase1Position={x:Q,y:this.height},this.tipBase2Position={x:Q+te,y:this.height}):(this.tipBase1Position={x:0,y:this.height-Q},this.tipBase2Position={x:0,y:this.height-Q-te})},I.prototype.resize=function(B){q.prototype.resize.call(this,B),this.positionTip()},I.prototype.positionTip=function(){xe.setAttributes(this.tip,[["points",this.getTipPoints()]]);var B=this.tipGrip.visual.transform.baseVal.getItem(0);B.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(B,0)},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),I.prototype.select=function(){this.positionTip(),q.prototype.select.call(this)},I.prototype.getState=function(){var B=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){var Q=B;this.bgColor=Q.bgColor,this.tipPosition=Q.tipPosition,q.prototype.restoreState.call(this,B),this.createTip(),this.setTipPoints()},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.tipPosition={x:this.tipPosition.x*B,y:this.tipPosition.y*Q},this.positionTip()},I.typeName="CalloutMarker",I.title="Callout marker",I.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',I}(He),j=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.fillColor="transparent",$.strokeColor="transparent",$.strokeWidth=0,$.strokeDasharray="",$.opacity=1,$.strokeColor=te.defaultColor,$.strokeWidth=te.defaultStrokeWidth,$.strokeDasharray=te.defaultStrokeDasharray,$.fillColor=te.defaultFillColor,$.setStrokeColor=$.setStrokeColor.bind($),$.setFillColor=$.setFillColor.bind($),$.setStrokeWidth=$.setStrokeWidth.bind($),$.setStrokeDasharray=$.setStrokeDasharray.bind($),$.setOpacity=$.setOpacity.bind($),$.createVisual=$.createVisual.bind($),$.strokePanel=new ke("Line color",Ae(te.defaultColorSet,["transparent"]),te.defaultColor),$.strokePanel.onColorChanged=$.setStrokeColor,$.fillPanel=new ke("Fill color",Ae(te.defaultColorSet,["transparent"]),$.fillColor,me),$.fillPanel.onColorChanged=$.setFillColor,$.strokeWidthPanel=new Ie("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),$.strokeWidthPanel.onWidthChanged=$.setStrokeWidth,$.strokeStylePanel=new Je("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),$.strokeStylePanel.onStyleChanged=$.setStrokeDasharray,$.opacityPanel=new oe("Opacity",te.defaultOpacitySteps,$.opacity),$.opacityPanel.onOpacityChanged=$.setOpacity,$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.visual)},I.prototype.createVisual=function(){this.visual=xe.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="new"&&(this.createVisual(),this.moveVisual(B),this._state="creating")},I.prototype.manipulate=function(B){q.prototype.manipulate.call(this,B)},I.prototype.resize=function(B){q.prototype.resize.call(this,B),this.setSize()},I.prototype.setSize=function(){q.prototype.setSize.call(this),xe.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},I.prototype.pointerUp=function(B){q.prototype.pointerUp.call(this,B),this.setSize()},I.prototype.setStrokeColor=function(B){this.strokeColor=B,this.visual&&xe.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(B),this.stateChanged()},I.prototype.setFillColor=function(B){this.fillColor=B,this.visual&&xe.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(B),this.stateChanged()},I.prototype.setStrokeWidth=function(B){this.strokeWidth=B,this.visual&&xe.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},I.prototype.setStrokeDasharray=function(B){this.strokeDasharray=B,this.visual&&xe.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},I.prototype.setOpacity=function(B){this.opacity=B,this.visual&&xe.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){var Q=B;this.fillColor=Q.fillColor,this.strokeColor=Q.strokeColor,this.strokeWidth=Q.strokeWidth,this.strokeDasharray=Q.strokeDasharray,this.opacity=Q.opacity,this.createVisual(),q.prototype.restoreState.call(this,B),this.setSize()},I.prototype.scale=function(B,Q){q.prototype.scale.call(this,B,Q),this.setSize()},I.typeName="EllipseMarker",I.title="Ellipse marker",I.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',I}(_e),we=function(q){function I(B,Q,te){return q.call(this,B,Q,te)||this}return Oe(I,q),Object.defineProperty(I.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.tip1&&B!==this.tip2)},I.prototype.createTips=function(){this.tip1=xe.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(xe.createTransform()),this.visual.appendChild(this.tip1),this.tip2=xe.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(xe.createTransform()),this.visual.appendChild(this.tip2)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.state==="creating"&&this.createTips()},I.prototype.adjustVisual=function(){if(q.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(xe.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),xe.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var B=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),Q=this.tip1.transform.baseVal.getItem(0);Q.setRotate(B,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(Q,0);var te=this.tip2.transform.baseVal.getItem(0);te.setRotate(B+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(te,0)}},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=q.prototype.getState.call(this);return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B),this.createTips(),this.adjustVisual()},I.typeName="MeasurementMarker",I.title="Measurement marker",I.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',I}(he),Be=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.strokePanel.colors=te.defaultColorSet,$.fillColor="transparent",$}return Oe(I,q),Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=q.prototype.getState.call(this);return B.typeName=I.typeName,B},I.typeName="EllipseFrameMarker",I.title="Ellipse frame marker",I.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',I}(j),de=function(){function q(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(q.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),q.prototype.addUndoStep=function(I){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(I)||(this.undoStack.push(I),JSON.stringify(this.lastRedoStep)!==JSON.stringify(I)&&this.redoStack.splice(0,this.redoStack.length))},q.prototype.replaceLastUndoStep=function(I){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=I)},q.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},q.prototype.undo=function(){if(this.undoStack.length>1){var I=this.undoStack.pop();return I!==void 0&&this.redoStack.push(I),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},q.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},q}(),Ce=function(q){function I(B,Q,te){var $=q.call(this,B,Q,te)||this;return $.strokeColor="transparent",$.strokeWidth=0,$.strokeDasharray="",$.curveX=0,$.curveY=0,$.manipulationStartCurveX=0,$.manipulationStartCurveY=0,$.setStrokeColor=$.setStrokeColor.bind($),$.setStrokeWidth=$.setStrokeWidth.bind($),$.setStrokeDasharray=$.setStrokeDasharray.bind($),$.positionGrips=$.positionGrips.bind($),$.addControlGrips=$.addControlGrips.bind($),$.adjustVisual=$.adjustVisual.bind($),$.setupControlBox=$.setupControlBox.bind($),$.resize=$.resize.bind($),$.strokeColor=te.defaultColor,$.strokeWidth=te.defaultStrokeWidth,$.strokeDasharray=te.defaultStrokeDasharray,$.strokePanel=new ke("Line color",te.defaultColorSet,te.defaultColor),$.strokePanel.onColorChanged=$.setStrokeColor,$.strokeWidthPanel=new Ie("Line width",te.defaultStrokeWidths,te.defaultStrokeWidth),$.strokeWidthPanel.onWidthChanged=$.setStrokeWidth,$.strokeStylePanel=new Je("Line style",te.defaultStrokeDasharrays,te.defaultStrokeDasharray),$.strokeStylePanel.onStyleChanged=$.setStrokeDasharray,$}return Oe(I,q),I.prototype.ownsTarget=function(B){return!(!q.prototype.ownsTarget.call(this,B)&&B!==this.visual&&B!==this.selectorCurve&&B!==this.visibleCurve&&!this.curveGrip.ownsTarget(B))},I.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},I.prototype.createVisual=function(){this.visual=xe.createGroup(),this.selectorCurve=xe.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=xe.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},I.prototype.pointerDown=function(B,Q){q.prototype.pointerDown.call(this,B,Q),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=B.x,this.curveY=B.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(Q)&&(this.activeGrip=this.curveGrip,this._state="resize")},I.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),xe.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),xe.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),xe.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},I.prototype.setupControlBox=function(){q.prototype.setupControlBox.call(this),this.curveControlLine1=xe.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=xe.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},I.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,q.prototype.addControlGrips.call(this)},I.prototype.positionGrips=function(){q.prototype.positionGrips.call(this);var B=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-B/2,this.curveY-B/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},I.prototype.manipulate=function(B){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+B.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+B.y-this.manipulationStartY),q.prototype.manipulate.call(this,B)},I.prototype.resize=function(B){this.activeGrip===this.curveGrip&&(this.curveX=B.x,this.curveY=B.y),q.prototype.resize.call(this,B),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},I.prototype.setStrokeColor=function(B){this.strokeColor=B,this.adjustVisual(),this.colorChanged(B)},I.prototype.setStrokeWidth=function(B){this.strokeWidth=B,this.adjustVisual()},I.prototype.setStrokeDasharray=function(B){this.strokeDasharray=B,this.adjustVisual()},I.prototype.scale=function(B,Q){this.curveX=this.curveX*B,this.curveY=this.curveY*Q,q.prototype.scale.call(this,B,Q)},Object.defineProperty(I.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),I.prototype.getState=function(){var B=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},q.prototype.getState.call(this));return B.typeName=I.typeName,B},I.prototype.restoreState=function(B){q.prototype.restoreState.call(this,B);var Q=B;this.strokeColor=Q.strokeColor,this.strokeWidth=Q.strokeWidth,this.strokeDasharray=Q.strokeDasharray,this.curveX=Q.curveX,this.curveY=Q.curveY,this.createVisual(),this.adjustVisual()},I.typeName="CurveMarker",I.title="Curve marker",I.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',I}(it),je=function(){function q(I,B){B===void 0&&(B=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=I,this.cancelable=B}return Object.defineProperty(q.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),q.prototype.preventDefault=function(){this._defaultPrevented=!0},q}(),ut=function(q){function I(B,Q,te){var $=q.call(this,B,!1)||this;return $.dataUrl=Q,$.state=te,$}return Oe(I,q),I}(je),tt=function(q){function I(B,Q,te){te===void 0&&(te=!1);var $=q.call(this,B,te)||this;return $.marker=Q,$}return Oe(I,q),I}(je),st=function(){function q(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return q.prototype.addEventListener=function(I,B){this[I].push(B)},q.prototype.removeEventListener=function(I,B){var Q=this[I].indexOf(B);Q>-1&&this[I].splice(Q,1)},q}(),gt=function(){function q(I){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Ke,this._isOpen=!1,this.undoRedoManager=new de,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new st,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=q.instanceCounter++,this.styles=new Ge(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=I,this.targetRoot=document.body,this.width=I.clientWidth,this.height=I.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(q.prototype,"ALL_MARKER_TYPES",{get:function(){return[et,Ee,be,He,Be,j,Z,Xe,we,J,he,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[et,Ee,be,He,j,Z,Xe]},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"BASIC_MARKER_TYPES",{get:function(){return[et,Ee,be,He,Z]},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(I){var B=this;this._availableMarkerTypes.splice(0),I.forEach(function(Q){if(typeof Q=="string"){var te=B.ALL_MARKER_TYPES.find(function($){return $.typeName===Q});te!==void 0&&B._availableMarkerTypes.push(te)}else B._availableMarkerTypes.push(Q)})},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(I){this._zoomLevel=I,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),q.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),le.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},q.prototype.show=function(){var I=this;this.styles.styleSheetRoot===void 0&&pe.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=pe.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(B){return B(new je(I))})},q.prototype.render=function(){return We(this,void 0,void 0,function(){var I;return ze(this,function(B){switch(B.label){case 0:return this.setCurrentMarker(),(I=new Se).naturalSize=this.renderAtNaturalSize,I.imageType=this.renderImageType,I.imageQuality=this.renderImageQuality,I.markersOnly=this.renderMarkersOnly,I.width=this.renderWidth,I.height=this.renderHeight,[4,I.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return B.sent(),[4,I.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,B.sent()]}})})},q.prototype.close=function(I){var B=this;if(I===void 0&&(I=!1),this.isOpen){var Q=!1;I||this.eventListeners.beforeclose.forEach(function(te){var $=new je(B,!0);te($),$.defaultPrevented&&(Q=!0)}),Q||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(te){return te(new je(B))}),this.detachEvents(),this._isOpen=!1)}},q.prototype.addMarkersToToolbar=function(){for(var I,B=[],Q=0;Q<arguments.length;Q++)B[Q]=arguments[Q];(I=this._availableMarkerTypes).push.apply(I,B)},q.prototype.addRenderEventListener=function(I){this.addEventListener("render",function(B){I(B.dataUrl,B.state)})},q.prototype.removeRenderEventListener=function(I){},q.prototype.addCloseEventListener=function(I){this.addEventListener("close",function(){I()})},q.prototype.removeCloseEventListener=function(I){},q.prototype.setupResizeObserver=function(){var I=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){I.resize(I.target.clientWidth,I.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return I.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},q.prototype.onPopupTargetResize=function(){var I=1*this.target.clientWidth/this.target.clientHeight,B=this.editorCanvas.clientWidth/I>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*I:this.editorCanvas.clientWidth,Q=B<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/I;this.resize(B,Q)},q.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},q.prototype.resize=function(I,B){this._isResizing=!0;var Q=I/this.imageWidth,te=B/this.imageHeight;this.imageWidth=Math.round(I),this.imageHeight=Math.round(B),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(Q,te),this._isResizing=!1},q.prototype.scaleMarkers=function(I,B){var Q,te=this;this._currentMarker&&this._currentMarker instanceof He?this._currentMarker.scale(I,B):(Q=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function($){$!==te._currentMarker&&$.scale(I,B)}),Q!==void 0&&this.setCurrentMarker(Q)},q.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},q.prototype.setTopLeft=function(){var I=this.editingTarget.getBoundingClientRect(),B=this.editorCanvas.getBoundingClientRect();this.left=I.left-B.left,this.top=I.top-B.top},q.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},q.prototype.addDefs=function(){for(var I,B=[],Q=0;Q<arguments.length;Q++)B[Q]=arguments[Q];this.defs=xe.createDefs(),this.addDefsToImage(),(I=this.defs).append.apply(I,B)},q.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},q.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},q.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},q.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},q.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},q.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},q.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},q.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var I=document.createElement("a");I.href="https://markerjs.com/",I.target="_blank",I.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',I.title="Powered by marker.js",I.style.display="grid",I.style.alignItems="center",I.style.justifyItems="center",I.style.padding="3px",I.style.width="20px",I.style.height="20px",this.logoUI.appendChild(I),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},q.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},q.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},q.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},q.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var I=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=I+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new De(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Ve(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},q.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},q.prototype.removeMarker=function(I){this.markerImage.removeChild(I.container),this.markers.indexOf(I)>-1&&this.markers.splice(this.markers.indexOf(I),1),I.dispose()},q.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},q.prototype.toolbarButtonClicked=function(I,B){if(I==="marker"&&B!==void 0)this.createNewMarker(B);else if(I==="action")switch(B){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},q.prototype.deleteSelectedMarker=function(){var I=this;if(this._currentMarker!==void 0){var B=!1;if(this.eventListeners.markerbeforedelete.forEach(function(te){var $=new tt(I,I._currentMarker,!0);te($),$.defaultPrevented&&(B=!0)}),!B){var Q=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(te){return te(new tt(I,Q))})}}},q.prototype.clear=function(){var I=this,B=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(Ue){var at=new tt(I,void 0,!0);Ue(at),at.defaultPrevented&&(B=!0)}),!B)){this.setCurrentMarker();for(var Q=function(Ue){var at=te.markers[Ue];te.setCurrentMarker(te.markers[Ue]),te._currentMarker.dispose(),te.markerImage.removeChild(te._currentMarker.container),te.markers.splice(te.markers.indexOf(te._currentMarker),1),te.eventListeners.markerdelete.forEach(function(pt){return pt(new tt(I,at))})},te=this,$=this.markers.length-1;$>=0;$--)Q($);this.addUndoStep()}},Object.defineProperty(q.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),q.prototype.showNotesEditor=function(){var I;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(I=this._currentMarker.notes)!==null&&I!==void 0?I:"",this.overlayContainer.appendChild(this.notesArea))},q.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},q.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},q.prototype.addUndoStep=function(){var I=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var B=this.getState(),Q=this.undoRedoManager.getLastUndoStep();if(!Q||Q.width===B.width&&Q.height===B.height){var te=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(B),te<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function($){return $(new je(I))})}else this.undoRedoManager.replaceLastUndoStep(B),this.eventListeners.statechange.forEach(function($){return $(new je(I))})}},q.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},q.prototype.undoStep=function(){var I=this,B=this.undoRedoManager.undo();B!==void 0&&(this.restoreState(B),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(Q){return Q(new je(I))}))},q.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},q.prototype.redoStep=function(){var I=this,B=this.undoRedoManager.redo();B!==void 0&&(this.restoreState(B),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(Q){return Q(new je(I))}))},q.prototype.stepZoom=function(){var I=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=I<this.zoomSteps.length-1?this.zoomSteps[I+1]:this.zoomSteps[0]},q.prototype.panTo=function(I){this.contentDiv.scrollBy({left:this.prevPanPoint.x-I.x,top:this.prevPanPoint.y-I.y}),this.prevPanPoint=I},q.prototype.startRenderAndClose=function(){return We(this,void 0,void 0,function(){var I,B,Q=this;return ze(this,function(te){switch(te.label){case 0:return[4,this.render()];case 1:return I=te.sent(),B=this.getState(),this.eventListeners.render.forEach(function($){return $(new ut(Q,I,B))}),this.close(!0),[2]}})})},q.prototype.getState=function(I){I===!0&&this.setCurrentMarker();var B={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(Q){return B.markers.push(Q.getState())}),B},q.prototype.restoreState=function(I){var B=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);I.markers.forEach(function(Q){var te=B._availableMarkerTypes.find(function(Ue){return Ue.typeName===Q.typeName});if(te!==void 0){var $=B.addNewMarker(te);$.restoreState(Q),B.markers.push($)}}),I.width&&I.height&&(I.width!==this.imageWidth||I.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/I.width,this.imageHeight/I.height),this.eventListeners.restorestate.forEach(function(Q){return Q(new je(B))})},q.prototype.addNewMarker=function(I){var B=xe.createGroup();return this.markerImage.appendChild(B),new I(B,this.overlayContainer,this.settings)},q.prototype.createNewMarker=function(I){var B,Q=this;(B=typeof I=="string"?this._availableMarkerTypes.find(function(te){return te.typeName===I}):I)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(B),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(B.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(te){return te(new tt(Q,Q._currentMarker))}))},q.prototype.markerCreated=function(I){var B=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(I),this.setCurrentMarker(I),I instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(Q){return Q(new tt(B,B._currentMarker))})},q.prototype.colorChanged=function(I){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=I,this.settings.defaultStrokeColor=I)},q.prototype.fillColorChanged=function(I){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=I)},q.prototype.markerStateChanged=function(I){var B=this;this.eventListeners.markerchange.forEach(function(Q){return Q(new tt(B,I))})},q.prototype.setCurrentMarker=function(I){var B=this;this._currentMarker!==I&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(Q){return Q(new tt(B,B._currentMarker))})),this._currentMarker=I,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(Q){return Q(new tt(B,B._currentMarker))}))},q.prototype.onPointerDown=function(I){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||I.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var B=this.markers.find(function(Q){return Q.ownsTarget(I.target)});B!==void 0?(this.setCurrentMarker(B),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(I.clientX,I.clientY),I.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:I.clientX,y:I.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(I.clientX,I.clientY))},q.prototype.onDblClick=function(I){if(this._isFocused||this.focus(),this.mode==="select"){var B=this.markers.find(function(Q){return Q.ownsTarget(I.target)});B!==void 0&&B!==this._currentMarker&&this.setCurrentMarker(B),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(I.clientX,I.clientY),I.target):this.setCurrentMarker()}},q.prototype.onPointerMove=function(I){this.touchPoints!==1&&I.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||I.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(I.clientX,I.clientY)):this.zoomLevel>1&&this.panTo({x:I.clientX,y:I.clientY}))},q.prototype.onPointerUp=function(I){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(I.clientX,I.clientY)),this.isDragging=!1,this.addUndoStep()},q.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},q.prototype.onKeyUp=function(I){this._currentMarker===void 0||this.notesArea!==void 0||I.key!=="Delete"&&I.key!=="Backspace"||this.deleteSelectedMarker()},q.prototype.clientToLocalCoordinates=function(I,B){var Q=this.markerImage.getBoundingClientRect();return{x:(I-Q.left)/this.zoomLevel,y:(B-Q.top)/this.zoomLevel}},q.prototype.onWindowResize=function(){this.positionUI()},q.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var I=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=I+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},q.prototype.addLicenseKey=function(I){le.addKey(I)},q.prototype.addEventListener=function(I,B){this.eventListeners.addEventListener(I,B)},q.prototype.removeEventListener=function(I,B){this.eventListeners.removeEventListener(I,B)},q.prototype.renderState=function(I){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(I),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(q.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),q.prototype.focus=function(){var I=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(B){return B(new je(I))}))},q.prototype.blur=function(){var I=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(B){return B(new je(I))}))},q.instanceCounter=0,q}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var At=function(q,I){return(At=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,Q){B.__proto__=Q}||function(B,Q){for(var te in Q)Object.prototype.hasOwnProperty.call(Q,te)&&(B[te]=Q[te])})(q,I)};function bt(q,I){if(typeof I!="function"&&I!==null)throw new TypeError("Class extends value "+String(I)+" is not a constructor or null");function B(){this.constructor=q}At(q,I),q.prototype=I===null?Object.create(I):(B.prototype=I.prototype,new B)}function ht(q,I,B,Q){return new(B||(B=Promise))(function(te,$){function Ue(wt){try{pt(Q.next(wt))}catch(lt){$(lt)}}function at(wt){try{pt(Q.throw(wt))}catch(lt){$(lt)}}function pt(wt){var lt;wt.done?te(wt.value):(lt=wt.value,lt instanceof B?lt:new B(function(It){It(lt)})).then(Ue,at)}pt((Q=Q.apply(q,I||[])).next())})}function Ot(q,I){var B,Q,te,$,Ue={label:0,sent:function(){if(1&te[0])throw te[1];return te[1]},trys:[],ops:[]};return $={next:at(0),throw:at(1),return:at(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function at(pt){return function(wt){return function(lt){if(B)throw new TypeError("Generator is already executing.");for(;Ue;)try{if(B=1,Q&&(te=2&lt[0]?Q.return:lt[0]?Q.throw||((te=Q.return)&&te.call(Q),0):Q.next)&&!(te=te.call(Q,lt[1])).done)return te;switch(Q=0,te&&(lt=[2&lt[0],te.value]),lt[0]){case 0:case 1:te=lt;break;case 4:return Ue.label++,{value:lt[1],done:!1};case 5:Ue.label++,Q=lt[1],lt=[0];continue;case 7:lt=Ue.ops.pop(),Ue.trys.pop();continue;default:if(!(te=Ue.trys,(te=te.length>0&&te[te.length-1])||lt[0]!==6&&lt[0]!==2)){Ue=0;continue}if(lt[0]===3&&(!te||lt[1]>te[0]&&lt[1]<te[3])){Ue.label=lt[1];break}if(lt[0]===6&&Ue.label<te[1]){Ue.label=te[1],te=lt;break}if(te&&Ue.label<te[2]){Ue.label=te[2],Ue.ops.push(lt);break}te[2]&&Ue.ops.pop(),Ue.trys.pop();continue}lt=I.call(q,Ue)}catch(It){lt=[6,It],Q=0}finally{B=te=0}if(5&lt[0])throw lt[1];return{value:lt[0]?lt[1]:void 0,done:!0}}([pt,wt])}}}var Bt=function(){function q(){}return q.addKey=function(I){q.key=I},Object.defineProperty(q,"isLicensed",{get:function(){return!!q.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(q.key)},enumerable:!1,configurable:!0}),q}(),mt=function(){function q(){}return q.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},q.setAttributes=function(I,B){for(var Q=0,te=B;Q<te.length;Q++){var $=te[Q],Ue=$[0],at=$[1];I.setAttribute(Ue,at)}},q.createRect=function(I,B,Q){var te=document.createElementNS("http://www.w3.org/2000/svg","rect");return te.setAttribute("width",I.toString()),te.setAttribute("height",B.toString()),Q&&q.setAttributes(te,Q),te},q.createLine=function(I,B,Q,te,$){var Ue=document.createElementNS("http://www.w3.org/2000/svg","line");return Ue.setAttribute("x1",I.toString()),Ue.setAttribute("y1",B.toString()),Ue.setAttribute("x2",Q.toString()),Ue.setAttribute("y2",te.toString()),$&&q.setAttributes(Ue,$),Ue},q.createPolygon=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","polygon");return Q.setAttribute("points",I),B&&q.setAttributes(Q,B),Q},q.createCircle=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","circle");return Q.setAttribute("cx",(I/2).toString()),Q.setAttribute("cy",(I/2).toString()),Q.setAttribute("r",I.toString()),B&&q.setAttributes(Q,B),Q},q.createEllipse=function(I,B,Q){var te=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return te.setAttribute("cx",(I/2).toString()),te.setAttribute("cy",(B/2).toString()),te.setAttribute("rx",(I/2).toString()),te.setAttribute("ry",(B/2).toString()),Q&&q.setAttributes(te,Q),te},q.createGroup=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","g");return I&&q.setAttributes(B,I),B},q.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},q.createMarker=function(I,B,Q,te,$,Ue,at){var pt=document.createElementNS("http://www.w3.org/2000/svg","marker");return q.setAttributes(pt,[["id",I],["orient",B],["markerWidth",Q.toString()],["markerHeight",te.toString()],["refX",$.toString()],["refY",Ue.toString()]]),pt.appendChild(at),pt},q.createText=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","text");return B.setAttribute("x","0"),B.setAttribute("y","0"),I&&q.setAttributes(B,I),B},q.createTSpan=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","tspan");return Q.textContent=I,B&&q.setAttributes(Q,B),Q},q.createImage=function(I){var B=document.createElementNS("http://www.w3.org/2000/svg","image");return I&&q.setAttributes(B,I),B},q.createPoint=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return Q.x=I,Q.y=B,Q},q.createPath=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg","path");return Q.setAttribute("d",I),B&&q.setAttributes(Q,B),Q},q.createElement=function(I,B){var Q=document.createElementNS("http://www.w3.org/2000/svg",I);return B&&q.setAttributes(Q,B),Q},q.getHollowRectanglePath=function(I,B,Q,te,$,Ue,at,pt){return"M"+I+","+B+"V"+(B+te)+"H"+(I+Q)+"V"+B+"H"+$+"V"+Ue+"H"+($+at)+"V"+(Ue+pt)+"H"+$+"V"+B+"Z"},q}(),St=function(){function q(I){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+I+"_"}return Object.defineProperty(q.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),q.prototype.addClass=function(I){return this.styleSheet===void 0&&this.addStyleSheet(),I.name=""+this.classNamePrefix+I.localName,this.classes.push(I),this.styleSheet.sheet.insertRule("."+I.name+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length),I},q.prototype.addRule=function(I){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(I),this.styleSheet.sheet.insertRule(I.selector+" {"+I.style+"}",this.styleSheet.sheet.cssRules.length)},q.prototype.addStyleSheet=function(){var I;this.styleSheet=document.createElement("style"),((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).appendChild(this.styleSheet),this.addRule(new ft("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new ft("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new ft("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new _t("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new _t("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},q.prototype.removeStyleSheet=function(){var I;this.styleSheet&&(((I=this.styleSheetRoot)!==null&&I!==void 0?I:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},q}(),ft=function(q,I){this.selector=q,this.style=I},_t=function(q,I){this.localName=q,this.style=I},Pt=function(){function q(){this.blocks=[],this.display=""}return q.prototype.addButtonBlock=function(I){I.className=this.blockClassName,I.buttonClassName=this.buttonClassName,I.buttonColorsClassName=this.buttonColorsClassName,I.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(I)},q.prototype.addElementBlock=function(I){I.className===void 0&&(I.className=this.blockClassName),this.blocks.push(I)},q.prototype.getUI=function(){var I=document.createElement("div");return I.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,I.style.display=this.display,this.blocks.forEach(function(B){return I.appendChild(B.getUI())}),I},q}(),Nt=function(){function q(){}return q.prototype.getUI=function(){var I=document.createElement("div");if(I.className=this.className,this.minWidth!==void 0&&(I.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":I.style.justifyContent="flex-start";break;case"center":I.style.justifyContent="center";break;case"end":I.style.justifyContent="flex-end"}return I.style.whiteSpace="nowrap",I},q}(),zt=function(q){function I(){var B=q!==null&&q.apply(this,arguments)||this;return B.buttons=[],B}return bt(I,q),I.prototype.addButton=function(B){B.className=this.buttonClassName,B.colorsClassName=this.buttonColorsClassName,B.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(B)},I.prototype.getUI=function(){var B=q.prototype.getUI.call(this);return this.buttons.forEach(function(Q){return B.appendChild(Q.getUI())}),B},I}(Nt),Dt=function(){function q(I,B){this._isActive=!1,this._isHidden=!1,this._icon=I,this.title=B,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(q.prototype,"icon",{get:function(){return this._icon},set:function(I){this._icon=I,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isActive",{get:function(){return this._isActive},set:function(I){this._isActive=I,this.adjustClassName()},enumerable:!1,configurable:!0}),q.prototype.getUI=function(){var I=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return I.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},q.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},q.prototype.hide=function(){this._isHidden=!0},q}(),Ct=function(q){function I(){var B=q!==null&&q.apply(this,arguments)||this;return B.elements=[],B}return bt(I,q),I.prototype.addElement=function(B){this.elements.push(B)},I.prototype.getUI=function(){var B=q.prototype.getUI.call(this);return this.elements.forEach(function(Q){return B.appendChild(Q)}),B},I}(Nt),Mr=function(){function q(I,B){this.horizontal=I,this.vertical=B}return Object.defineProperty(q.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),q.prototype.getVerticalLength=function(I){return I/this.ratio},q.prototype.getHorizontalLength=function(I){return I*this.ratio},q}(),ti=function(){function q(){}return q.getIcon=function(I,B){if(I>0&&B>0){var Q=new Mr(I,B),te=Q.ratio>=1?20:Q.getHorizontalLength(20),$=Q.ratio<1?20:Q.getVerticalLength(20),Ue=document.createElementNS("http://www.w3.org/2000/svg","svg");Ue.setAttribute("xmlns","http://www.w3.org/2000/svg"),Ue.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(Ue);var at=mt.createDefs();Ue.appendChild(at);var pt=mt.createElement("clipPath",[["id","text-bg-clip"]]);at.appendChild(pt);var wt=mt.createPath(mt.getHollowRectanglePath((24-te)/2,(24-$)/2,te,$,(24-te)/2+2,(24-$)/2+2,te-4,$-4));Ue.appendChild(wt);var lt=mt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);lt.appendChild(mt.createTSpan(I+":"+B)),Ue.appendChild(lt);var It=lt.getBBox();mt.setAttributes(lt,[["x",((24-It.width)/2).toString()],["y",((24-It.height)/2-It.y).toString()]]);var jt=mt.createPath(mt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(It.width))/2,(24-Math.ceil(It.height))/2,Math.ceil(It.width),Math.ceil(It.height)));return pt.appendChild(jt),mt.setAttributes(wt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(Ue),Ue.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},q}(),Tr=function(q){function I(B,Q,te){var $=q.call(this,B,Q)||this;return $.isDropdownOpen=!1,$.onClick=$.dropdownButtonClicked,$.dropdownButtons=te,$}return bt(I,q),I.prototype.setupDropdown=function(){var B=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(Q){Q.className=B.className,Q.colorsClassName=B.colorsClassName,B.dropdownBlock.appendChild(Q.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},I.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},I.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},I.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},I.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},I.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},I}(Dt),Ut=function(){function q(I,B){this.GRIP_SIZE=10,this.color=I,this.fillColor=B,this.visual=mt.createGroup(),this.visual.appendChild(mt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(mt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return q.prototype.ownsTarget=function(I){return I===this.visual||I===this.visual.childNodes[0]||I===this.visual.childNodes[1]},q.prototype.setCenter=function(I,B){this.visual.childNodes.forEach(function(Q){return mt.setAttributes(Q,[["cx",I.toString()],["cy",B.toString()]])})},q}(),kr=function(){function q(I,B,Q,te){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=I,this.canvasHeight=B,this.margin=Q,this.container=te,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(q.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(I){this._aspectRatio=I,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(I){this._isGridVisible=I,this.gridContainer&&mt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(I){this._zoomFactor=I,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),q.prototype.open=function(){var I=this;this.cropShadeElement=mt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=mt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var B=0;B<this.numberOfGridLines;B++)this.horizontalGridLines.push(mt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(mt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(Q){return I.gridContainer.appendChild(Q)}),this.verticalGridLines.forEach(function(Q){return I.gridContainer.appendChild(Q)}),this.cropRectElement=mt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ut(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ut(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ut(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ut(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},q.prototype.setCropRectangle=function(I){this.cropRect=I;var B=Object.assign({},this.cropRect);this.zoomFactor!==1&&(B.width=this.cropRect.width*this.zoomFactor,B.height=this.cropRect.height*this.zoomFactor,B.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-B.width/2,B.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-B.height/2),mt.setAttributes(this.cropRectElement,[["x",B.x.toString()],["y",B.y.toString()],["width",B.width.toString()],["height",B.height.toString()]]);var Q=B.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function($,Ue){var at=B.y+Q*(Ue+1);mt.setAttributes($,[["x1",""+B.x],["y1",""+at],["x2",""+(B.x+B.width)],["y2",""+at]])});var te=B.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function($,Ue){var at=B.x+te*(Ue+1);mt.setAttributes($,[["x1",""+at],["y1",""+B.y],["x2",""+at],["y2",""+(B.y+B.height)]])}),mt.setAttributes(this.cropShadeElement,[["d",mt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,B.x,B.y,B.width,B.height)]]),this.topLeftGrip.setCenter(B.x,B.y),this.topRightGrip.setCenter(B.x+B.width,B.y),this.bottomLeftGrip.setCenter(B.x,B.y+B.height),this.bottomRightGrip.setCenter(B.x+B.width,B.y+B.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},q.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},q.prototype.clientToLocalCoordinates=function(I,B){var Q=this.container.getBoundingClientRect();return{x:I-Q.left+this.margin,y:B-Q.top+this.margin}},q.prototype.onPointerDown=function(I){this.container.setPointerCapture(I.pointerId),this.previousPoint=this.clientToLocalCoordinates(I.clientX,I.clientY),this.cropRectElement===I.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(I.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(I.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(I.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(I.target)&&(this.activeGrip=this.bottomRightGrip)},q.prototype.onPointerMove=function(I){if(this.isMoving)this.move(this.clientToLocalCoordinates(I.clientX,I.clientY));else if(this.activeGrip){var B=this.clientToLocalCoordinates(I.clientX,I.clientY);this.resize(B)}I.preventDefault()},q.prototype.onPointerUp=function(I){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(I.pointerId)},q.prototype.move=function(I){var B=I.x-this.previousPoint.x,Q=I.y-this.previousPoint.y;this.zoomFactor!==1&&(B=-B/this.zoomFactor,Q=-Q/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+B),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+Q),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=I},q.prototype.resize=function(I){var B=Object.assign({},this.cropRect),Q=I.x-this.previousPoint.x,te=I.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:B.x+Q<this.margin&&(Q=this.margin-B.x),B.x+=Q,B.width=this.cropRect.x+this.cropRect.width-B.x;break;case this.bottomRightGrip:case this.topRightGrip:B.width+Q>this.canvasWidth*this.zoomFactor&&(Q=this.canvasWidth*this.zoomFactor-B.width),B.width+=Q}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(B.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(Q),B.height=this.aspectRatio.getVerticalLength(B.width)):(B.y+=te,B.height=this.cropRect.y+this.cropRect.height-B.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?B.height=this.aspectRatio.getVerticalLength(B.width):B.height+=te}B.width<10&&(B.x=this.cropRect.x,B.width=10),B.height<10&&(B.y=this.cropRect.y,B.height=10),this.previousPoint=I,B.x>=this.margin&&B.y>=this.margin&&B.x-this.margin+B.width<=this.canvasWidth&&B.y-this.margin+B.height<=this.canvasHeight&&(this.cropRect=B,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},q.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var I=this.cropRect.x+this.cropRect.width/2,B=this.cropRect.y+this.cropRect.height/2,Q=this.aspectRatio.getHorizontalLength(this.cropRect.height),te=this.aspectRatio.getVerticalLength(this.cropRect.width);Q/this.canvasWidth<te/this.canvasHeight?this.cropRect.width=Q:this.cropRect.height=te,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=I-this.cropRect.width/2,this.cropRect.y=B-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},q.prototype.getRescaledRect=function(I,B,Q,te,$,Ue){var at=Q/I,pt=te/B;return{x:($.x-Ue)*at+Ue,y:($.y-Ue)*pt+Ue,width:$.width*at,height:$.height*pt}},q.prototype.scaleCanvas=function(I,B){var Q=this.getRescaledRect(this.canvasWidth,this.canvasHeight,I,B,this.cropRect,this.margin);this.canvasWidth=I,this.canvasHeight=B,this.onCropChange&&this.onCropChange(Q),this.setCropRectangle(Q)},q}(),zr=function(){function q(I){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=I,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(q.prototype,"angle",{get:function(){return this._angle},set:function(I){this._angle=I,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),q.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},q.prototype.onPointerDown=function(I){this.controlContainer.setPointerCapture(I.pointerId),this.isDragging=!0,this.previousPoint={x:I.clientX,y:I.clientY}},q.prototype.onPointerMove=function(I){this.isDragging&&(this.onAngleChange&&this.onAngleChange((I.clientX-this.previousPoint.x)/5),this.previousPoint.x=I.clientX)},q.prototype.onPointerUp=function(I){this.isDragging&&this.onAngleChange&&this.onAngleChange((I.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(I.pointerId)},q.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var I=this.angleLabelText.getBBox();mt.setAttributes(this.angleLabelElement,[["x",((this.width-I.width)/2).toString()],["y",(this.height/2).toString()]])}},q.prototype.positionScaleShape=function(){if(this.scaleShape){var I=this.scaleShape.transform.baseVal.getItem(0);I.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(I,0)}},q.prototype.getVisual=function(){var I=document.createElementNS("http://www.w3.org/2000/svg","svg");I.setAttribute("xmlns","http://www.w3.org/2000/svg"),I.setAttribute("width",this.width+"px"),I.setAttribute("height",this.height+"px"),I.setAttribute("viewBox","0 0 "+this.width+" "+this.height),I.style.flexShrink="0",document.body.appendChild(I);for(var B="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,Q=1;Q<=this.width/5+10;Q++){var te=Q%5==0?this.height/3:this.height/6;B+="h4v"+-te+"h1v"+te}B+="v1H0Z",this.scaleShape=mt.createPath(B);var $=mt.createTransform();this.scaleShape.transform.baseVal.appendItem($),I.appendChild(this.scaleShape),this.angleLabelElement=mt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=mt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var Ue=mt.createTSpan("");return Ue.innerHTML="&deg;",this.angleLabelElement.appendChild(Ue),I.appendChild(this.angleLabelElement),document.body.removeChild(I),I},q}(),ri=function(){function q(){this.naturalSize=!1,this.imageType="image/png"}return q.prototype.rasterize=function(I,B,Q,te,$,Ue,at){var pt=this;return new Promise(function(wt){var lt=document.createElement("canvas");lt.width=I.width.baseVal.value-2*te,lt.height=I.height.baseVal.value-2*te;var It=1,jt=1;pt.naturalSize===!0?(It=B.naturalWidth/(I.width.baseVal.value-2*te)/Ue,jt=B.naturalHeight/(I.height.baseVal.value-2*te)/at,lt.width=B.naturalWidth/Ue,lt.height=B.naturalHeight/at):pt.width!==void 0&&pt.height!==void 0&&(It=pt.width/Q.width,jt=pt.height/Q.height,lt.width*=It,lt.height*=jt);var nr=lt.getContext("2d");nr.translate(lt.width/2,lt.height/2),nr.rotate($*Math.PI/180),nr.scale(Ue,at),nr.translate(-lt.width/2,-lt.height/2),nr.drawImage(B,0,0,lt.width,lt.height);var Gr=document.createElement("canvas");Gr.width=Q.width*It,Gr.height=Q.height*jt,Gr.getContext("2d").putImageData(nr.getImageData((Q.x-te)*It,(Q.y-te)*jt,Q.width*It,Q.height*jt),0,0),wt(Gr.toDataURL(pt.imageType,pt.imageQuality))})},q}(),nt=function(){function q(I){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=q.instanceCounter++,this.styles=new St(this.instanceNo),this.target=I,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(q.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(I){this._zoomToCropEnabled=I,I?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(I){this._isGridVisible=I,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"gridLines",{get:function(){return this._gridLines},set:function(I){this._gridLines=I,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(I){this._rotationAngle=I,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(q.prototype,"aspectRatio",{get:function(){var I;return(I=this._aspectRatio)!==null&&I!==void 0?I:this.aspectRatios[0]},set:function(I){this._aspectRatio=I},enumerable:!1,configurable:!0}),q.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},q.prototype.show=function(){this.showUI(),this.open()},q.prototype.close=function(I){I===void 0&&(I=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),I||this.closeEventListeners.forEach(function(B){return B()}),this._isOpen=!1)},q.prototype.addRenderEventListener=function(I){this.renderEventListeners.push(I)},q.prototype.removeRenderEventListener=function(I){this.renderEventListeners.indexOf(I)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(I),1)},q.prototype.addCloseEventListener=function(I){this.closeEventListeners.push(I)},q.prototype.removeCloseEventListener=function(I){this.closeEventListeners.indexOf(I)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(I),1)},q.prototype.setupResizeObserver=function(){var I=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){I.resize(I.target.clientWidth,I.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},q.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var I=1*this.target.clientWidth/this.target.clientHeight,B=this.contentDiv.clientWidth/I>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*I:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,Q=B+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/I;this.resize(B,Q)}},q.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},q.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",mt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},q.prototype.resize=function(I,B){this.imageWidth=Math.round(I),this.imageHeight=Math.round(B),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},q.prototype.setEditingTarget=function(){var I=document.createElement("canvas");I.width=this.target.naturalWidth,I.height=this.target.naturalHeight,I.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var B=I.toDataURL();mt.setAttributes(this.editingTarget,[["href",B]]),this.setEditingTargetSize()},q.prototype.setTopLeft=function(){var I=this.target.getBoundingClientRect(),B=this.editorCanvas.getBoundingClientRect();this.left=I.left-B.left-this.CANVAS_MARGIN,this.top=I.top-B.top-this.CANVAS_MARGIN},q.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=mt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=mt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=mt.createGroup(),this.editingTargetRotationScaleContainer=mt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var I=mt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(I);var B=mt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(B),this.editingTargetContainer=mt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},q.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},q.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=mt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new kr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},q.prototype.zoomToCrop=function(){if(this.cropRect){var I=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,B=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=I+"px "+B+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-I+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-B+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},q.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},q.prototype.cropRectChanged=function(I){this.cropRect=I,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},q.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},q.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},q.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},q.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var I=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,B=this.target.offsetTop>I+this.CANVAS_MARGIN?this.target.offsetTop-(I+this.CANVAS_MARGIN):0;this.coverDiv.style.top=B+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},q.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},q.prototype.addTopToolbar=function(){var I=this;this.topToolbar=new Pt,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var B=new zt;B.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(B);var Q=[];this.aspectRatios.forEach(function(jt){var nr=new Dt(ti.getIcon(jt.horizontal,jt.vertical),jt.horizontal===0&&jt.vertical===0?"FREE":jt.horizontal+":"+jt.vertical);nr.onClick=function(){return I.ratioButtonClicked(jt)},Q.push(nr)}),this.aspectRatioButton=new Tr(ti.getIcon(0,0),"Aspect ratio",Q),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,B.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var te=new Dt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");te.isActive=this.isGridVisible,te.onClick=function(){I.isGridVisible=!I.isGridVisible,te.isActive=I.isGridVisible},B.addButton(te);var $=new Dt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if($.isActive=this.zoomToCropEnabled,$.onClick=function(){I.zoomToCropEnabled=!I.zoomToCropEnabled,$.isActive=I.zoomToCropEnabled},B.addButton($),!Bt.isLicensed){var Ue=new Ct;this.topToolbar.addElementBlock(Ue);var at=document.createElement("div");at.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var pt=document.createElement("a");pt.style.color="currentColor",pt.href="https://markerjs.com/products/cropro",pt.target="_blank",pt.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',at.appendChild(pt),Ue.addElement(at)}var wt=new zt;wt.minWidth=3*this.toolbarHeight+"px",wt.contentAlign="end",this.topToolbar.addButtonBlock(wt);var lt=new Dt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");lt.onClick=this.startRenderAndClose,wt.addButton(lt),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(lt.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var It=new Dt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");It.onClick=this.close,wt.addButton(It),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(It.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},q.prototype.addBottomToolbar=function(){var I=this;this.bottomToolbar=new Pt,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var B=new zt;B.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(B);var Q=new Dt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");Q.onClick=this.rotateLeftButtonClicked,B.addButton(Q);var te=new Dt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");te.onClick=this.rotateRightButtonClicked,B.addButton(te);var $=new Ct;$.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock($),this.straightener=new zr("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(wt){I.rotateBy(wt),I.straightener.angle=I.rotationAngle},$.addElement(this.straightener.getUI());var Ue=new zt;Ue.minWidth=2*this.toolbarHeight+"px",Ue.contentAlign="end",this.bottomToolbar.addButtonBlock(Ue);var at=new Dt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");at.onClick=this.flipHorizontallyButtonClicked,Ue.addButton(at);var pt=new Dt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");pt.onClick=this.flipVerticallyButtonClicked,Ue.addButton(pt)},q.prototype.ratioButtonClicked=function(I){this.aspectRatio=I,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},q.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=ti.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},q.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Mr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},q.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},q.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},q.prototype.restoreState=function(I){if(I){var B=this.cropLayer.getRescaledRect(I.width,I.height,this.imageWidth,this.imageHeight,I.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(B),this.cropRectChanged(B),this.flippedHorizontally=I.flippedHorizontally,this.flippedVertically=I.flippedVertically,this.applyFlip(),this.rotationAngle=I.rotationAngle,this.applyRotation()}},q.prototype.clientToLocalCoordinates=function(I,B){var Q=this.cropImage.getBoundingClientRect();return{x:I-Q.left,y:B-Q.top}},q.prototype.onWindowResize=function(){this.positionUI()},q.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var I=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=I+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},q.prototype.rotateLeftButtonClicked=function(){var I=this.rotationAngle-90;this.rotationAngle%90!=0&&(I+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(I)},q.prototype.rotateRightButtonClicked=function(){var I=this.rotationAngle+90;this.rotationAngle%90!=0&&(I-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(I)},q.prototype.rotateTo=function(I){I=(I=I>180?I-360:I)<=-180?I+360:I,this.rotationAngle=I,this.applyRotation()},q.prototype.rotateBy=function(I){this.rotateTo((this.rotationAngle+I)%360)},q.prototype.applyRotation=function(){var I=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var B=this.editingTargetRotationContainer.transform.baseVal.getItem(0);B.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(B,0);var Q=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/Q.width,this.imageHeight/Q.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=I},q.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},q.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},q.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},q.prototype.startRenderAndClose=function(){return ht(this,void 0,void 0,function(){var I,B;return Ot(this,function(Q){switch(Q.label){case 0:return[4,this.render()];case 1:return I=Q.sent(),B=this.getState(),this.renderEventListeners.forEach(function(te){return te(I,B)}),this.close(!0),[2]}})})},q.prototype.render=function(){return ht(this,void 0,void 0,function(){var I;return Ot(this,function(B){switch(B.label){case 0:return(I=new ri).naturalSize=this.renderAtNaturalSize,I.imageType=this.renderImageType,I.imageQuality=this.renderImageQuality,I.width=this.renderWidth,I.height=this.renderHeight,this.unzoomFromCrop(),mt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,I.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return B.sent(),[4,I.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,B.sent()]}})})},q.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new _t("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new _t("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new _t("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var I=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new _t("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*I)+`px;
height: `+(this.toolbarHeight-2*I)+`px;
padding: `+I+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new _t("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new _t("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new ft("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new ft("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new _t("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new _t("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new _t("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new _t("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*I)+`px;
padding: `+I+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new _t("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},q.instanceCounter=0,q}(),xt=ee("8hTe"),Ht=ee.n(xt),qt=/<pre[^>]*>/g;function er(q){var I=document.createElement("div");return I.innerHTML=q,I.childNodes.length===0?"":I.childNodes[0].nodeValue}var ir=se.a=function(q){var I=q.value,B=I===void 0?"":I,Q=q.edit,te=Q===void 0?!1:Q,$=q.className,Ue=q.showTextOnly,at=q.showLines,pt=q.replaces,wt=q.zoomImg,lt=q.hasMask,It=q.style,jt=It===void 0?{}:It,nr=q.stylesPrev,Gr=nr===void 0?{}:nr,Vr=String(B),gr=Object(c.useRef)(),$r=Object(c.useRef)(),Xi=Object(c.useState)(""),Or=Object(S.a)(Xi,2),Yr=Or[0],Hr=Or[1],yi=Object(c.useState)("office"),ii=Object(S.a)(yi,2),pi=ii[0],ui=ii[1],hn=function(){var Yt=new nt($r.current);Yt.displayMode="popup",Yt.addRenderEventListener(function(){var Sr=Object(f.a)(p.a.mark(function Vt(dr){var $t;return p.a.wrap(function(cr){for(;;)switch(cr.prev=cr.next){case 0:return gr.current.style.display="none",cr.next=3,Object(Ze.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr}});case 3:$t=cr.sent,$t!=null&&$t.id&&pt($r.current.getAttribute("src").replace(ce.a.API_SERVER,""),"/api/attachments/".concat($t==null?void 0:$t.id,"?type=").concat($t.content_type));case 5:case"end":return cr.stop()}},Vt)}));return function(Vt){return Sr.apply(this,arguments)}}()),Yt.show()},ji=function(){var Yt=new gt($r.current);Yt.settings.displayMode="popup",Yt.addEventListener("render",function(){var Sr=Object(f.a)(p.a.mark(function Vt(dr){var $t;return p.a.wrap(function(cr){for(;;)switch(cr.prev=cr.next){case 0:if(gr.current.style.display="none",!$r.current){cr.next=6;break}return cr.next=4,Object(Ze.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:dr.dataUrl}});case 4:$t=cr.sent,$t!=null&&$t.id&&pt($r.current.getAttribute("src").replace(ce.a.API_SERVER,""),"/api/attachments/".concat($t==null?void 0:$t.id,"?type=").concat($t.content_type));case 6:case"end":return cr.stop()}},Vt)}));return function(Vt){return Sr.apply(this,arguments)}}()),Yt.show(),window.markerArea=Yt},ni=Object(c.useMemo)(function(){try{var lr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Yt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Sr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Vr=Vr.replace(lr,"("+ce.a.API_SERVER+"/api/attachments/").replace(Yt,'"'+ce.a.API_SERVER+"/api/attachments/").replace(Sr,'"'+ce.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,`
`),Vr=Vr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ci){}var Vt=G(Vr),dr=P();if(Vr.match(/\[TOC\]/)&&(Vt=Vt.replace("<p>[TOC]</p>",T()),y()),Vt=Vt.replace(/(__special_katext_id_\d+__)/g,function(ci,cr){var Ir=dr[cr],Wi=Ir.type,zi=Ir.expression;return Object(ye.renderToString)(er(zi)||"",{displayMode:Wi==="block",throwOnError:!1,output:"html"})}),Vt=Vt.replace(/▁/g,"\u2581\u2581\u2581"),O(),Ue){var $t=document.createElement("div");return $t.innerHTML=Vt,$t.innerText}return setTimeout(function(){return Ri()},500),Vt},[Vr]),Qr=Object(c.useRef)();m.WebkitLineClamp=at,at&&(jt=Object(M.a)(Object(M.a)({},jt),m));function ki(lr){var Yt=lr.target;if(Yt.tagName.toUpperCase()==="IMG"){if(wt){var Sr=Yt.getAttribute("src");Hr(Sr),ui("image")}}else if(Yt.tagName.toUpperCase()==="A"){var Vt=Yt.getAttribute("href");if(Vt.indexOf("office")>-1)lr.preventDefault(),Hr(Vt),ui("office");else if(Vt.indexOf("application/pdf")>-1)lr.preventDefault(),Hr(Vt),ui("pdf");else if(Vt.indexOf("type=text")>-1)lr.preventDefault(),Hr(Vt),ui("html");else if(Vt.startsWith("#")){lr.preventDefault();var dr=document.getElementById(Vt.replace("#",""));dr&&dr.scrollIntoView(!0)}}}var Ri=function(){var Yt,Sr=(Yt=Qr.current)===null||Yt===void 0?void 0:Yt.querySelectorAll("video");Sr==null||Sr.forEach(function(Vt){if(Vt.oncontextmenu=function(){return!1},Vt.src.indexOf(".m3u8")>-1&&!Vt.canPlayType("application/vnd.apple.mpegurl")){if(V.a.isSupported()){var dr=new V.a;dr.loadSource(Vt.src),dr.attachMedia(Vt)}}})};Object(c.useEffect)(function(){if(Qr.current&&ni&&(ni.match(qt)&&window.PR.prettyPrint()),Qr.current)return Qr.current.addEventListener("click",ki),function(){Qr.current.removeEventListener("click",ki),O(),y()}},[ni,Qr.current,ki]);var dn=function(Yt){if(!te)return;Yt.target.nodeName==="IMG"?(gr.current.style.display="flex",gr.current.style.width=Yt.target.clientWidth+"px",gr.current.style.height=Yt.target.clientHeight+"px",gr.current.style.top=Yt.target.offsetTop+"px",gr.current.style.left=Yt.target.offsetLeft+"px",$r.current.src=Yt.target.getAttribute("src")):gr.current.style.display="none"};return o.a.createElement("div",{style:{position:"relative"}},o.a.createElement("div",{ref:Qr,style:Object(M.a)({},jt),className:"".concat($||""," markdown-body ").concat(Ht.a.mdBody),onMouseOver:dn,dangerouslySetInnerHTML:{__html:ni}}),o.a.createElement("div",{ref:gr,className:Ht.a.button},o.a.createElement(L.a,null,o.a.createElement(k.a,{onClick:function(){return hn()}},"\u88C1\u526A"),o.a.createElement(k.a,{onClick:function(){return ji()}},"\u7F16\u8F91"))),o.a.createElement("img",{ref:$r,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),o.a.createElement(Le.a,{close:!0,data:Yr,hasMask:lt,type:Yr!=null&&Yr.length?pi:"",style:Object(M.a)({},Gr),onClose:function(){return Hr("")}}))}},"9VGf":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return D});var z=ee("q1tI"),L=ee.n(z);function D(k,M){var f=Object(z.useRef)();Object(z.useEffect)(function(){f.current=k}),Object(z.useEffect)(function(){function S(){f.current()}if(M!==null){var _=setInterval(S,M);return function(){return clearInterval(_)}}},[M])}},BU3w:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return f});var z=ee("MNnm"),L="rc-util-key";function D(S){if(S.attachTo)return S.attachTo;var _=document.querySelector("head");return _||document.body}function k(S){var _,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(z.a)())return null;var c=document.createElement("style");if((_=p.csp)===null||_===void 0?void 0:_.nonce){var o;c.nonce=(o=p.csp)===null||o===void 0?void 0:o.nonce}c.innerHTML=S;var u=D(p),s=u.firstChild;return p.prepend&&u.prepend?u.prepend(c):p.prepend&&s?u.insertBefore(c,s):u.appendChild(c),c}var M=new Map;function f(S,_){var p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=D(p);if(!M.has(c)){var o=k("",p),u=o.parentNode;M.set(c,u),u.removeChild(o)}var s=Array.from(M.get(c).children).find(function(r){return r.tagName==="STYLE"&&r[L]===_});if(s){var l,t;if(((l=p.csp)===null||l===void 0?void 0:l.nonce)&&s.nonce!==((t=p.csp)===null||t===void 0?void 0:t.nonce)){var a;s.nonce=(a=p.csp)===null||a===void 0?void 0:a.nonce}return s.innerHTML!==S&&(s.innerHTML=S),s}var i=k(S,p);return i[L]=_,i}},Bd2K:function(ot,se,ee){(function(z){z(ee("VrN/"),ee("osHv"))})(function(z){z.defineOption("autoCloseTags",!1,function(p,c,o){if(o!=z.Init&&o&&p.removeKeyMap("autoCloseTags"),!c)return;var u={name:"autoCloseTags"};(typeof c!="object"||c.whenClosing!==!1)&&(u["'/'"]=function(s){return f(s)}),(typeof c!="object"||c.whenOpening!==!1)&&(u["'>'"]=function(s){return k(s)}),p.addKeyMap(u)});var L=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function k(p){if(p.getOption("disableInput"))return z.Pass;for(var c=p.listSelections(),o=[],u=p.getOption("autoCloseTags"),s=0;s<c.length;s++){if(!c[s].empty())return z.Pass;var l=c[s].head,t=p.getTokenAt(l),a=z.innerMode(p.getMode(),t.state),i=a.state,r=a.mode.xmlCurrentTag&&a.mode.xmlCurrentTag(i),h=r&&r.name;if(!h)return z.Pass;var d=a.mode.configuration=="html",y=typeof u=="object"&&u.dontCloseTags||d&&L,m=typeof u=="object"&&u.indentTags||d&&D;t.end>l.ch&&(h=h.slice(0,h.length-t.end+l.ch));var C=h.toLowerCase();if(!h||t.type=="string"&&(t.end!=l.ch||!/[\"\']/.test(t.string.charAt(t.string.length-1))||t.string.length==1)||t.type=="tag"&&r.close||t.string.indexOf("/")==l.ch-t.start-1||y&&S(y,C)>-1||_(p,a.mode.xmlCurrentContext&&a.mode.xmlCurrentContext(i)||[],h,l,!0))return z.Pass;var T=typeof u=="object"&&u.emptyTags;if(T&&S(T,h)>-1){o[s]={text:"/>",newPos:z.Pos(l.line,l.ch+2)};continue}var x=m&&S(m,C)>-1;o[s]={indent:x,text:">"+(x?`
`:"")+"</"+h+">",newPos:x?z.Pos(l.line+1,0):z.Pos(l.line,l.ch+1)}}for(var E=typeof u=="object"&&u.dontIndentOnAutoClose,s=c.length-1;s>=0;s--){var w=o[s];p.replaceRange(w.text,c[s].head,c[s].anchor,"+insert");var A=p.listSelections().slice(0);A[s]={head:w.newPos,anchor:w.newPos},p.setSelections(A),!E&&w.indent&&(p.indentLine(w.newPos.line,null,!0),p.indentLine(w.newPos.line+1,null,!0))}}function M(p,c){for(var o=p.listSelections(),u=[],s=c?"/":"</",l=p.getOption("autoCloseTags"),t=typeof l=="object"&&l.dontIndentOnSlash,a=0;a<o.length;a++){if(!o[a].empty())return z.Pass;var i=o[a].head,r=p.getTokenAt(i),h=z.innerMode(p.getMode(),r.state),d=h.state;if(c&&(r.type=="string"||r.string.charAt(0)!="<"||r.start!=i.ch-1))return z.Pass;var y,m=h.mode.name!="xml"&&p.getMode().name=="htmlmixed";if(m&&h.mode.name=="javascript")y=s+"script";else if(m&&h.mode.name=="css")y=s+"style";else{var C=h.mode.xmlCurrentContext&&h.mode.xmlCurrentContext(d);if(!C||C.length&&_(p,C,C[C.length-1],i))return z.Pass;y=s+C[C.length-1]}p.getLine(i.line).charAt(r.end)!=">"&&(y+=">"),u[a]=y}if(p.replaceSelections(u),o=p.listSelections(),!t)for(var a=0;a<o.length;a++)(a==o.length-1||o[a].head.line<o[a+1].head.line)&&p.indentLine(o[a].head.line)}function f(p){return p.getOption("disableInput")?z.Pass:M(p,!0)}z.commands.closeTag=function(p){return M(p)};function S(p,c){if(p.indexOf)return p.indexOf(c);for(var o=0,u=p.length;o<u;++o)if(p[o]==c)return o;return-1}function _(p,c,o,u,s){if(!z.scanForClosingTag)return!1;var l=Math.min(p.lastLine()+1,u.line+500),t=z.scanForClosingTag(p,u,null,l);if(!t||t.tag!=o)return!1;for(var a=s?1:0,i=c.length-1;i>=0&&c[i]==o;i--)++a;u=t.to;for(var i=1;i<a;i++){var r=z.scanForClosingTag(p,u,null,l);if(!r||r.tag!=o)return!1;u=r.to}return!0}})},BjJ7:function(ot,se,ee){"use strict";ee.d(se,"d",function(){return L}),ee.d(se,"c",function(){return D}),ee.d(se,"e",function(){return k}),ee.d(se,"b",function(){return M}),ee.d(se,"a",function(){return S});var z=ee("m3rI");function L(_){var p=!0;if(_.length>0){for(var c=0;c<_.length;c++)if(_[c].compile_success==0||!_[c].compile_success){p=!1;break}}else p=!1;return p}function D(_){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",c=[],o=0;o<_.length;o++){var u=_[o],s=p?"".concat(p,"/").concat(u.name):"".concat(u.name);c.push({title:u.name,isLeaf:!(u.type==="tree"),key:s})}return c}function k(_,p,c){for(var o=0;o<_.length;o++){var u=_[o];if(u.key===p){u.children=c;break}u.children&&k(u.children,p,c)}return _}function M(_,p,c){var o;return function(){var u=this,s=arguments,l=function(){o=null,c||_.apply(u,s)},t=c&&!o;clearTimeout(o),o=setTimeout(l,p),t&&_.apply(u,s)}}var f=!0,S=z.a.API_SERVER},"C+DQ":function(ot,se,ee){},"C/vA":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return z});function z(L){var D=this,k=!1,M;return function(){return k||(k=!0,M=L.apply(D,arguments)),M}}},"Cg/j":function(ot,se,ee){"use strict";ee.d(se,"b",function(){return z}),ee.d(se,"a",function(){return L}),ee.d(se,"c",function(){return k}),ee.d(se,"d",function(){return M});var z;(function(f){f.serviceIds=new Map,f.DI_TARGET="$di$target",f.DI_DEPENDENCIES="$di$dependencies";function S(_){return _[f.DI_DEPENDENCIES]||[]}f.getServiceDependencies=S})(z||(z={}));var L=k("instantiationService");function D(f,S,_,p){S[z.DI_TARGET]===S?S[z.DI_DEPENDENCIES].push({id:f,index:_,optional:p}):(S[z.DI_DEPENDENCIES]=[{id:f,index:_,optional:p}],S[z.DI_TARGET]=S)}function k(f){if(z.serviceIds.has(f))return z.serviceIds.get(f);var S=function(_,p,c){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");D(S,_,c,!1)};return S.toString=function(){return f},z.serviceIds.set(f,S),S}function M(f){return function(S,_,p){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");D(f,S,p,!0)}}},DlQD:function(ot,se,ee){(function(z,L){ot.exports=L()})(this,function(){"use strict";function z(Ee,ve){for(var be=0;be<ve.length;be++){var J=ve[be];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(Ee,J.key,J)}}function L(Ee,ve,be){return ve&&z(Ee.prototype,ve),be&&z(Ee,be),Ee}function D(Ee,ve){if(!Ee)return;if(typeof Ee=="string")return k(Ee,ve);var be=Object.prototype.toString.call(Ee).slice(8,-1);if(be==="Object"&&Ee.constructor&&(be=Ee.constructor.name),be==="Map"||be==="Set")return Array.from(Ee);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return k(Ee,ve)}function k(Ee,ve){(ve==null||ve>Ee.length)&&(ve=Ee.length);for(var be=0,J=new Array(ve);be<ve;be++)J[be]=Ee[be];return J}function M(Ee,ve){var be;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(be=D(Ee))||ve&&Ee&&typeof Ee.length=="number"){be&&(Ee=be);var J=0;return function(){return J>=Ee.length?{done:!0}:{done:!1,value:Ee[J++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return be=Ee[Symbol.iterator](),be.next.bind(be)}function f(Ee,ve){return ve={exports:{}},Ee(ve,ve.exports),ve.exports}var S=f(function(Ee){function ve(){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 be(J){Ee.exports.defaults=J}Ee.exports={defaults:ve(),getDefaults:ve,changeDefaults:be}}),_=S.defaults,p=S.getDefaults,c=S.changeDefaults,o=/[&<>"']/,u=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,l=/[<>"']|&(?!#?\w+;)/g,t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=function(ve){return t[ve]};function i(Ee,ve){if(ve){if(o.test(Ee))return Ee.replace(u,a)}else if(s.test(Ee))return Ee.replace(l,a);return Ee}var r=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function h(Ee){return Ee.replace(r,function(ve,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var d=/(^|[^\[])\^/g;function y(Ee,ve){Ee=Ee.source||Ee,ve=ve||"";var be={replace:function(oe,Z){return Z=Z.source||Z,Z=Z.replace(d,"$1"),Ee=Ee.replace(oe,Z),be},getRegex:function(){return new RegExp(Ee,ve)}};return be}var m=/[^\w:]/g,C=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function T(Ee,ve,be){if(Ee){var J;try{J=decodeURIComponent(h(be)).replace(m,"").toLowerCase()}catch(oe){return null}if(J.indexOf("javascript:")===0||J.indexOf("vbscript:")===0||J.indexOf("data:")===0)return null}ve&&!C.test(be)&&(be=g(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(oe){return null}return be}var x={},E=/^[^:]+:\/*[^/]*$/,w=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function g(Ee,ve){x[" "+Ee]||(E.test(Ee)?x[" "+Ee]=Ee+"/":x[" "+Ee]=X(Ee,"/",!0)),Ee=x[" "+Ee];var be=Ee.indexOf(":")===-1;return ve.substring(0,2)==="//"?be?ve:Ee.replace(w,"$1")+ve:ve.charAt(0)==="/"?be?ve:Ee.replace(A,"$1")+ve:Ee+ve}var P={exec:function(){}};function O(Ee){for(var ve=1,be,J;ve<arguments.length;ve++){be=arguments[ve];for(J in be)Object.prototype.hasOwnProperty.call(be,J)&&(Ee[J]=be[J])}return Ee}function F(Ee,ve){var be=Ee.replace(/\|/g,function(Z,me,Xe){for(var j=!1,we=me;--we>=0&&Xe[we]==="\\";)j=!j;return j?"|":" |"}),J=be.split(/ \|/),oe=0;if(J.length>ve)J.splice(ve);else for(;J.length<ve;)J.push("");for(;oe<J.length;oe++)J[oe]=J[oe].trim().replace(/\\\|/g,"|");return J}function X(Ee,ve,be){var J=Ee.length;if(J===0)return"";for(var oe=0;oe<J;){var Z=Ee.charAt(J-oe-1);if(Z===ve&&!be)oe++;else if(Z!==ve&&be)oe++;else break}return Ee.substr(0,J-oe)}function W(Ee,ve){if(Ee.indexOf(ve[1])===-1)return-1;for(var be=Ee.length,J=0,oe=0;oe<be;oe++)if(Ee[oe]==="\\")oe++;else if(Ee[oe]===ve[0])J++;else if(Ee[oe]===ve[1]&&(J--,J<0))return oe;return-1}function N(Ee){Ee&&Ee.sanitize&&!Ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var G={escape:i,unescape:h,edit:y,cleanUrl:T,resolveUrl:g,noopTest:P,merge:O,splitCells:F,rtrim:X,findClosingBracket:W,checkSanitizeDeprecation:N},U=S.defaults,H=G.rtrim,V=G.splitCells,ce=G.escape,ye=G.findClosingBracket;function Le(Ee,ve,be){var J=ve.href,oe=ve.title?ce(ve.title):null,Z=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:be,href:J,title:oe,text:Z}:{type:"image",raw:be,href:J,title:oe,text:ce(Z)}}function Ze(Ee,ve){var be=Ee.match(/^(\s+)(?:```)/);if(be===null)return ve;var J=be[1];return ve.split(`
`).map(function(oe){var Z=oe.match(/^\s+/);if(Z===null)return oe;var me=Z[0];return me.length>=J.length?oe.slice(J.length):oe}).join(`
`)}var Ye=function(){function Ee(be){this.options=be||U}var ve=Ee.prototype;return ve.space=function(J){var oe=this.rules.block.newline.exec(J);if(oe)return oe[0].length>1?{type:"space",raw:oe[0]}:{raw:`
`}},ve.code=function(J,oe){var Z=this.rules.block.code.exec(J);if(Z){var me=oe[oe.length-1];if(me&&me.type==="paragraph")return{raw:Z[0],text:Z[0].trimRight()};var Xe=Z[0].replace(/^ {4}/gm,"");return{type:"code",raw:Z[0],codeBlockStyle:"indented",text:this.options.pedantic?Xe:H(Xe,`
`)}}},ve.fences=function(J){var oe=this.rules.block.fences.exec(J);if(oe){var Z=oe[0],me=Ze(Z,oe[3]||"");return{type:"code",raw:Z,lang:oe[2]?oe[2].trim():oe[2],text:me}}},ve.heading=function(J){var oe=this.rules.block.heading.exec(J);if(oe)return{type:"heading",raw:oe[0],depth:oe[1].length,text:oe[2]}},ve.nptable=function(J){var oe=this.rules.block.nptable.exec(J);if(oe){var Z={type:"table",header:V(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[],raw:oe[0]};if(Z.header.length===Z.align.length){var me=Z.align.length,Xe;for(Xe=0;Xe<me;Xe++)/^ *-+: *$/.test(Z.align[Xe])?Z.align[Xe]="right":/^ *:-+: *$/.test(Z.align[Xe])?Z.align[Xe]="center":/^ *:-+ *$/.test(Z.align[Xe])?Z.align[Xe]="left":Z.align[Xe]=null;for(me=Z.cells.length,Xe=0;Xe<me;Xe++)Z.cells[Xe]=V(Z.cells[Xe],Z.header.length);return Z}}},ve.hr=function(J){var oe=this.rules.block.hr.exec(J);if(oe)return{type:"hr",raw:oe[0]}},ve.blockquote=function(J){var oe=this.rules.block.blockquote.exec(J);if(oe){var Z=oe[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:oe[0],text:Z}}},ve.list=function(J){var oe=this.rules.block.list.exec(J);if(oe){for(var Z=oe[0],me=oe[2],Xe=me.length>1,j=me[me.length-1]===")",we={type:"list",raw:Z,ordered:Xe,start:Xe?+me.slice(0,-1):"",loose:!1,items:[]},Be=oe[0].match(this.rules.block.item),de=!1,Ce,je,ut,tt,st,gt,At,bt=Be.length,ht=0;ht<bt;ht++)Ce=Be[ht],Z=Ce,je=Ce.length,Ce=Ce.replace(/^ *([*+-]|\d+[.)]) */,""),~Ce.indexOf(`
`)&&(je-=Ce.length,Ce=this.options.pedantic?Ce.replace(/^ {1,4}/gm,""):Ce.replace(new RegExp("^ {1,"+je+"}","gm"),"")),ht!==bt-1&&(ut=this.rules.block.bullet.exec(Be[ht+1])[0],(Xe?ut.length===1||!j&&ut[ut.length-1]===")":ut.length>1||this.options.smartLists&&ut!==me)&&(tt=Be.slice(ht+1).join(`
`),we.raw=we.raw.substring(0,we.raw.length-tt.length),ht=bt-1)),st=de||/\n\n(?!\s*$)/.test(Ce),ht!==bt-1&&(de=Ce.charAt(Ce.length-1)===`
`,st||(st=de)),st&&(we.loose=!0),gt=/^\[[ xX]\] /.test(Ce),At=void 0,gt&&(At=Ce[1]!==" ",Ce=Ce.replace(/^\[[ xX]\] +/,"")),we.items.push({type:"list_item",raw:Z,task:gt,checked:At,loose:st,text:Ce});return we}},ve.html=function(J){var oe=this.rules.block.html.exec(J);if(oe)return{type:this.options.sanitize?"paragraph":"html",raw:oe[0],pre:!this.options.sanitizer&&(oe[1]==="pre"||oe[1]==="script"||oe[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(oe[0]):ce(oe[0]):oe[0]}},ve.def=function(J){var oe=this.rules.block.def.exec(J);if(oe){oe[3]&&(oe[3]=oe[3].substring(1,oe[3].length-1));var Z=oe[1].toLowerCase().replace(/\s+/g," ");return{tag:Z,raw:oe[0],href:oe[2],title:oe[3]}}},ve.table=function(J){var oe=this.rules.block.table.exec(J);if(oe){var Z={type:"table",header:V(oe[1].replace(/^ *| *\| *$/g,"")),align:oe[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:oe[3]?oe[3].replace(/\n$/,"").split(`
`):[]};if(Z.header.length===Z.align.length){Z.raw=oe[0];var me=Z.align.length,Xe;for(Xe=0;Xe<me;Xe++)/^ *-+: *$/.test(Z.align[Xe])?Z.align[Xe]="right":/^ *:-+: *$/.test(Z.align[Xe])?Z.align[Xe]="center":/^ *:-+ *$/.test(Z.align[Xe])?Z.align[Xe]="left":Z.align[Xe]=null;for(me=Z.cells.length,Xe=0;Xe<me;Xe++)Z.cells[Xe]=V(Z.cells[Xe].replace(/^ *\| *| *\| *$/g,""),Z.header.length);return Z}}},ve.lheading=function(J){var oe=this.rules.block.lheading.exec(J);if(oe)return{type:"heading",raw:oe[0],depth:oe[2].charAt(0)==="="?1:2,text:oe[1]}},ve.paragraph=function(J){var oe=this.rules.block.paragraph.exec(J);if(oe)return{type:"paragraph",raw:oe[0],text:oe[1].charAt(oe[1].length-1)===`
`?oe[1].slice(0,-1):oe[1]}},ve.text=function(J,oe){var Z=this.rules.block.text.exec(J);if(Z){var me=oe[oe.length-1];return me&&me.type==="text"?{raw:Z[0],text:Z[0]}:{type:"text",raw:Z[0],text:Z[0]}}},ve.escape=function(J){var oe=this.rules.inline.escape.exec(J);if(oe)return{type:"escape",raw:oe[0],text:ce(oe[1])}},ve.tag=function(J,oe,Z){var me=this.rules.inline.tag.exec(J);if(me)return!oe&&/^<a /i.test(me[0])?oe=!0:oe&&/^<\/a>/i.test(me[0])&&(oe=!1),!Z&&/^<(pre|code|kbd|script)(\s|>)/i.test(me[0])?Z=!0:Z&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(me[0])&&(Z=!1),{type:this.options.sanitize?"text":"html",raw:me[0],inLink:oe,inRawBlock:Z,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):ce(me[0]):me[0]}},ve.link=function(J){var oe=this.rules.inline.link.exec(J);if(oe){var Z=ye(oe[2],"()");if(Z>-1){var me=oe[0].indexOf("!")===0?5:4,Xe=me+oe[1].length+Z;oe[2]=oe[2].substring(0,Z),oe[0]=oe[0].substring(0,Xe).trim(),oe[3]=""}var j=oe[2],we="";if(this.options.pedantic){var Be=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(j);Be?(j=Be[1],we=Be[3]):we=""}else we=oe[3]?oe[3].slice(1,-1):"";j=j.trim().replace(/^<([\s\S]*)>$/,"$1");var de=Le(oe,{href:j&&j.replace(this.rules.inline._escapes,"$1"),title:we&&we.replace(this.rules.inline._escapes,"$1")},oe[0]);return de}},ve.reflink=function(J,oe){var Z;if((Z=this.rules.inline.reflink.exec(J))||(Z=this.rules.inline.nolink.exec(J))){var me=(Z[2]||Z[1]).replace(/\s+/g," ");if(me=oe[me.toLowerCase()],!me||!me.href){var Xe=Z[0].charAt(0);return{type:"text",raw:Xe,text:Xe}}var j=Le(Z,me,Z[0]);return j}},ve.strong=function(J,oe,Z){Z===void 0&&(Z="");var me=this.rules.inline.strong.start.exec(J);if(me&&(!me[1]||me[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){oe=oe.slice(-1*J.length);var Xe=me[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Xe.lastIndex=0;for(var j;(me=Xe.exec(oe))!=null;)if(j=this.rules.inline.strong.middle.exec(oe.slice(0,me.index+3)),j)return{type:"strong",raw:J.slice(0,j[0].length),text:J.slice(2,j[0].length-2)}}},ve.em=function(J,oe,Z){Z===void 0&&(Z="");var me=this.rules.inline.em.start.exec(J);if(me&&(!me[1]||me[1]&&(Z===""||this.rules.inline.punctuation.exec(Z)))){oe=oe.slice(-1*J.length);var Xe=me[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Xe.lastIndex=0;for(var j;(me=Xe.exec(oe))!=null;)if(j=this.rules.inline.em.middle.exec(oe.slice(0,me.index+2)),j)return{type:"em",raw:J.slice(0,j[0].length),text:J.slice(1,j[0].length-1)}}},ve.codespan=function(J){var oe=this.rules.inline.code.exec(J);if(oe){var Z=oe[2].replace(/\n/g," "),me=/[^ ]/.test(Z),Xe=Z.startsWith(" ")&&Z.endsWith(" ");return me&&Xe&&(Z=Z.substring(1,Z.length-1)),Z=ce(Z,!0),{type:"codespan",raw:oe[0],text:Z}}},ve.br=function(J){var oe=this.rules.inline.br.exec(J);if(oe)return{type:"br",raw:oe[0]}},ve.del=function(J){var oe=this.rules.inline.del.exec(J);if(oe)return{type:"del",raw:oe[0],text:oe[1]}},ve.autolink=function(J,oe){var Z=this.rules.inline.autolink.exec(J);if(Z){var me,Xe;return Z[2]==="@"?(me=ce(this.options.mangle?oe(Z[1]):Z[1]),Xe="mailto:"+me):(me=ce(Z[1]),Xe=me),{type:"link",raw:Z[0],text:me,href:Xe,tokens:[{type:"text",raw:me,text:me}]}}},ve.url=function(J,oe){var Z;if(Z=this.rules.inline.url.exec(J)){var me,Xe;if(Z[2]==="@")me=ce(this.options.mangle?oe(Z[0]):Z[0]),Xe="mailto:"+me;else{var j;do j=Z[0],Z[0]=this.rules.inline._backpedal.exec(Z[0])[0];while(j!==Z[0]);me=ce(Z[0]),Z[1]==="www."?Xe="http://"+me:Xe=me}return{type:"link",raw:Z[0],text:me,href:Xe,tokens:[{type:"text",raw:me,text:me}]}}},ve.inlineText=function(J,oe,Z){var me=this.rules.inline.text.exec(J);if(me){var Xe;return oe?Xe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(me[0]):ce(me[0]):me[0]:Xe=ce(this.options.smartypants?Z(me[0]):me[0]),{type:"text",raw:me[0],text:Xe}}},Ee}(),Oe=G.noopTest,We=G.edit,ze=G.merge,Ae={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Oe,table:Oe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};Ae._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Ae._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Ae.def=We(Ae.def).replace("label",Ae._label).replace("title",Ae._title).getRegex(),Ae.bullet=/(?:[*+-]|\d{1,9}[.)])/,Ae.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,Ae.item=We(Ae.item,"gm").replace(/bull/g,Ae.bullet).getRegex(),Ae.list=We(Ae.list).replace(/bull/g,Ae.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ae.def.source+")").getRegex(),Ae._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ae._comment=/<!--(?!-?>)[\s\S]*?-->/,Ae.html=We(Ae.html,"i").replace("comment",Ae._comment).replace("tag",Ae._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ae.paragraph=We(Ae._paragraph).replace("hr",Ae.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ae._tag).getRegex(),Ae.blockquote=We(Ae.blockquote).replace("paragraph",Ae.paragraph).getRegex(),Ae.normal=ze({},Ae),Ae.gfm=ze({},Ae.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Ae.gfm.nptable=We(Ae.gfm.nptable).replace("hr",Ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ae._tag).getRegex(),Ae.gfm.table=We(Ae.gfm.table).replace("hr",Ae.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",Ae._tag).getRegex(),Ae.pedantic=ze({},Ae.normal,{html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ae._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:Oe,paragraph:We(Ae.normal._paragraph).replace("hr",Ae.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Ae.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var xe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Oe,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:Oe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};xe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",xe.punctuation=We(xe.punctuation).replace(/punctuation/g,xe._punctuation).getRegex(),xe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",xe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",xe.em.start=We(xe.em.start).replace(/punctuation/g,xe._punctuation).getRegex(),xe.em.middle=We(xe.em.middle).replace(/punctuation/g,xe._punctuation).replace(/overlapSkip/g,xe._overlapSkip).getRegex(),xe.em.endAst=We(xe.em.endAst,"g").replace(/punctuation/g,xe._punctuation).getRegex(),xe.em.endUnd=We(xe.em.endUnd,"g").replace(/punctuation/g,xe._punctuation).getRegex(),xe.strong.start=We(xe.strong.start).replace(/punctuation/g,xe._punctuation).getRegex(),xe.strong.middle=We(xe.strong.middle).replace(/punctuation/g,xe._punctuation).replace(/blockSkip/g,xe._blockSkip).getRegex(),xe.strong.endAst=We(xe.strong.endAst,"g").replace(/punctuation/g,xe._punctuation).getRegex(),xe.strong.endUnd=We(xe.strong.endUnd,"g").replace(/punctuation/g,xe._punctuation).getRegex(),xe.blockSkip=We(xe._blockSkip,"g").getRegex(),xe.overlapSkip=We(xe._overlapSkip,"g").getRegex(),xe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,xe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,xe._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])?)+(?![-_])/,xe.autolink=We(xe.autolink).replace("scheme",xe._scheme).replace("email",xe._email).getRegex(),xe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,xe.tag=We(xe.tag).replace("comment",Ae._comment).replace("attribute",xe._attribute).getRegex(),xe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,xe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,xe.link=We(xe.link).replace("label",xe._label).replace("href",xe._href).replace("title",xe._title).getRegex(),xe.reflink=We(xe.reflink).replace("label",xe._label).getRegex(),xe.reflinkSearch=We(xe.reflinkSearch,"g").replace("reflink",xe.reflink).replace("nolink",xe.nolink).getRegex(),xe.normal=ze({},xe),xe.pedantic=ze({},xe.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:We(/^!?\[(label)\]\((.*?)\)/).replace("label",xe._label).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xe._label).getRegex()}),xe.gfm=ze({},xe.normal,{escape:We(xe.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),xe.gfm.url=We(xe.gfm.url,"i").replace("email",xe.gfm._extended_email).getRegex(),xe.breaks=ze({},xe.gfm,{br:We(xe.br).replace("{2,}","*").getRegex(),text:We(xe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var le={block:Ae,inline:xe},Se=S.defaults,pe=le.block,Ge=le.inline;function fe(Ee){return Ee.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 ge(Ee){var ve="",be,J,oe=Ee.length;for(be=0;be<oe;be++)J=Ee.charCodeAt(be),Math.random()>.5&&(J="x"+J.toString(16)),ve+="&#"+J+";";return ve}var De=function(){function Ee(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||Se,this.options.tokenizer=this.options.tokenizer||new Ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var J={block:pe.normal,inline:Ge.normal};this.options.pedantic?(J.block=pe.pedantic,J.inline=Ge.pedantic):this.options.gfm&&(J.block=pe.gfm,this.options.breaks?J.inline=Ge.breaks:J.inline=Ge.gfm),this.tokenizer.rules=J}Ee.lex=function(J,oe){var Z=new Ee(oe);return Z.lex(J)};var ve=Ee.prototype;return ve.lex=function(J){return J=J.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(J,this.tokens,!0),this.inline(this.tokens),this.tokens},ve.blockTokens=function(J,oe,Z){oe===void 0&&(oe=[]),Z===void 0&&(Z=!0),J=J.replace(/^ +$/gm,"");for(var me,Xe,j,we;J;){if(me=this.tokenizer.space(J)){J=J.substring(me.raw.length),me.type&&oe.push(me);continue}if(me=this.tokenizer.code(J,oe)){J=J.substring(me.raw.length),me.type?oe.push(me):(we=oe[oe.length-1],we.raw+=`
`+me.raw,we.text+=`
`+me.text);continue}if(me=this.tokenizer.fences(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.heading(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.nptable(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.hr(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.blockquote(J)){J=J.substring(me.raw.length),me.tokens=this.blockTokens(me.text,[],Z),oe.push(me);continue}if(me=this.tokenizer.list(J)){for(J=J.substring(me.raw.length),j=me.items.length,Xe=0;Xe<j;Xe++)me.items[Xe].tokens=this.blockTokens(me.items[Xe].text,[],!1);oe.push(me);continue}if(me=this.tokenizer.html(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(Z&&(me=this.tokenizer.def(J))){J=J.substring(me.raw.length),this.tokens.links[me.tag]||(this.tokens.links[me.tag]={href:me.href,title:me.title});continue}if(me=this.tokenizer.table(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.lheading(J)){J=J.substring(me.raw.length),oe.push(me);continue}if(Z&&(me=this.tokenizer.paragraph(J))){J=J.substring(me.raw.length),oe.push(me);continue}if(me=this.tokenizer.text(J,oe)){J=J.substring(me.raw.length),me.type?oe.push(me):(we=oe[oe.length-1],we.raw+=`
`+me.raw,we.text+=`
`+me.text);continue}if(J){var Be="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Be);break}else throw new Error(Be)}}return oe},ve.inline=function(J){var oe,Z,me,Xe,j,we,Be=J.length;for(oe=0;oe<Be;oe++){we=J[oe];switch(we.type){case"paragraph":case"text":case"heading":{we.tokens=[],this.inlineTokens(we.text,we.tokens);break}case"table":{for(we.tokens={header:[],cells:[]},Xe=we.header.length,Z=0;Z<Xe;Z++)we.tokens.header[Z]=[],this.inlineTokens(we.header[Z],we.tokens.header[Z]);for(Xe=we.cells.length,Z=0;Z<Xe;Z++)for(j=we.cells[Z],we.tokens.cells[Z]=[],me=0;me<j.length;me++)we.tokens.cells[Z][me]=[],this.inlineTokens(j[me],we.tokens.cells[Z][me]);break}case"blockquote":{this.inline(we.tokens);break}case"list":{for(Xe=we.items.length,Z=0;Z<Xe;Z++)this.inline(we.items[Z].tokens);break}}}return J},ve.inlineTokens=function(J,oe,Z,me,Xe){oe===void 0&&(oe=[]),Z===void 0&&(Z=!1),me===void 0&&(me=!1),Xe===void 0&&(Xe="");var j,we=J,Be;if(this.tokens.links){var de=Object.keys(this.tokens.links);if(de.length>0)for(;(Be=this.tokenizer.rules.inline.reflinkSearch.exec(we))!=null;)de.includes(Be[0].slice(Be[0].lastIndexOf("[")+1,-1))&&(we=we.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Be=this.tokenizer.rules.inline.blockSkip.exec(we))!=null;)we=we.slice(0,Be.index)+"["+"a".repeat(Be[0].length-2)+"]"+we.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;J;){if(j=this.tokenizer.escape(J)){J=J.substring(j.raw.length),oe.push(j);continue}if(j=this.tokenizer.tag(J,Z,me)){J=J.substring(j.raw.length),Z=j.inLink,me=j.inRawBlock,oe.push(j);continue}if(j=this.tokenizer.link(J)){J=J.substring(j.raw.length),j.type==="link"&&(j.tokens=this.inlineTokens(j.text,[],!0,me)),oe.push(j);continue}if(j=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(j.raw.length),j.type==="link"&&(j.tokens=this.inlineTokens(j.text,[],!0,me)),oe.push(j);continue}if(j=this.tokenizer.strong(J,we,Xe)){J=J.substring(j.raw.length),j.tokens=this.inlineTokens(j.text,[],Z,me),oe.push(j);continue}if(j=this.tokenizer.em(J,we,Xe)){J=J.substring(j.raw.length),j.tokens=this.inlineTokens(j.text,[],Z,me),oe.push(j);continue}if(j=this.tokenizer.codespan(J)){J=J.substring(j.raw.length),oe.push(j);continue}if(j=this.tokenizer.br(J)){J=J.substring(j.raw.length),oe.push(j);continue}if(j=this.tokenizer.del(J)){J=J.substring(j.raw.length),j.tokens=this.inlineTokens(j.text,[],Z,me),oe.push(j);continue}if(j=this.tokenizer.autolink(J,ge)){J=J.substring(j.raw.length),oe.push(j);continue}if(!Z&&(j=this.tokenizer.url(J,ge))){J=J.substring(j.raw.length),oe.push(j);continue}if(j=this.tokenizer.inlineText(J,me,fe)){J=J.substring(j.raw.length),Xe=j.raw.slice(-1),oe.push(j);continue}if(J){var Ce="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(Ce);break}else throw new Error(Ce)}}return oe},L(Ee,null,[{key:"rules",get:function(){return{block:pe,inline:Ge}}}]),Ee}(),Ve=S.defaults,Qe=G.cleanUrl,ke=G.escape,Fe=function(){function Ee(be){this.options=be||Ve}var ve=Ee.prototype;return ve.code=function(J,oe,Z){var me=(oe||"").match(/\S*/)[0];if(this.options.highlight){var Xe=this.options.highlight(J,me);Xe!=null&&Xe!==J&&(Z=!0,J=Xe)}return me?'<pre><code class="'+this.options.langPrefix+ke(me,!0)+'">'+(Z?J:ke(J,!0))+`</code></pre>
`:"<pre><code>"+(Z?J:ke(J,!0))+`</code></pre>
`},ve.blockquote=function(J){return`<blockquote>
`+J+`</blockquote>
`},ve.html=function(J){return J},ve.heading=function(J,oe,Z,me){return this.options.headerIds?"<h"+oe+' id="'+this.options.headerPrefix+me.slug(Z)+'">'+J+"</h"+oe+`>
`:"<h"+oe+">"+J+"</h"+oe+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(J,oe,Z){var me=oe?"ol":"ul",Xe=oe&&Z!==1?' start="'+Z+'"':"";return"<"+me+Xe+`>
`+J+"</"+me+`>
`},ve.listitem=function(J){return"<li>"+J+`</li>
`},ve.checkbox=function(J){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(J){return"<p>"+J+`</p>
`},ve.table=function(J,oe){return oe&&(oe="<tbody>"+oe+"</tbody>"),`<table>
<thead>
`+J+`</thead>
`+oe+`</table>
`},ve.tablerow=function(J){return`<tr>
`+J+`</tr>
`},ve.tablecell=function(J,oe){var Z=oe.header?"th":"td",me=oe.align?"<"+Z+' align="'+oe.align+'">':"<"+Z+">";return me+J+"</"+Z+`>
`},ve.strong=function(J){return"<strong>"+J+"</strong>"},ve.em=function(J){return"<em>"+J+"</em>"},ve.codespan=function(J){return"<code>"+J+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(J){return"<del>"+J+"</del>"},ve.link=function(J,oe,Z){if(J=Qe(this.options.sanitize,this.options.baseUrl,J),J===null)return Z;var me='<a href="'+ke(J)+'"';return oe&&(me+=' title="'+oe+'"'),me+=">"+Z+"</a>",me},ve.image=function(J,oe,Z){if(J=Qe(this.options.sanitize,this.options.baseUrl,J),J===null)return Z;var me='<img src="'+J+'" alt="'+Z+'"';return oe&&(me+=' title="'+oe+'"'),me+=this.options.xhtml?"/>":">",me},ve.text=function(J){return J},Ee}(),Ne=function(){function Ee(){}var ve=Ee.prototype;return ve.strong=function(J){return J},ve.em=function(J){return J},ve.codespan=function(J){return J},ve.del=function(J){return J},ve.html=function(J){return J},ve.text=function(J){return J},ve.link=function(J,oe,Z){return""+Z},ve.image=function(J,oe,Z){return""+Z},ve.br=function(){return""},Ee}(),Me=function(){function Ee(){this.seen={}}var ve=Ee.prototype;return ve.slug=function(J){var oe=J.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(oe)){var Z=oe;do this.seen[Z]++,oe=Z+"-"+this.seen[Z];while(this.seen.hasOwnProperty(oe))}return this.seen[oe]=0,oe},Ee}(),ne=S.defaults,_e=G.unescape,ae=function(){function Ee(be){this.options=be||ne,this.options.renderer=this.options.renderer||new Fe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ne,this.slugger=new Me}Ee.parse=function(J,oe){var Z=new Ee(oe);return Z.parse(J)};var ve=Ee.prototype;return ve.parse=function(J,oe){oe===void 0&&(oe=!0);var Z="",me,Xe,j,we,Be,de,Ce,je,ut,tt,st,gt,At,bt,ht,Ot,Bt,mt,St=J.length;for(me=0;me<St;me++){tt=J[me];switch(tt.type){case"space":continue;case"hr":{Z+=this.renderer.hr();continue}case"heading":{Z+=this.renderer.heading(this.parseInline(tt.tokens),tt.depth,_e(this.parseInline(tt.tokens,this.textRenderer)),this.slugger);continue}case"code":{Z+=this.renderer.code(tt.text,tt.lang,tt.escaped);continue}case"table":{for(je="",Ce="",we=tt.header.length,Xe=0;Xe<we;Xe++)Ce+=this.renderer.tablecell(this.parseInline(tt.tokens.header[Xe]),{header:!0,align:tt.align[Xe]});for(je+=this.renderer.tablerow(Ce),ut="",we=tt.cells.length,Xe=0;Xe<we;Xe++){for(de=tt.tokens.cells[Xe],Ce="",Be=de.length,j=0;j<Be;j++)Ce+=this.renderer.tablecell(this.parseInline(de[j]),{header:!1,align:tt.align[j]});ut+=this.renderer.tablerow(Ce)}Z+=this.renderer.table(je,ut);continue}case"blockquote":{ut=this.parse(tt.tokens),Z+=this.renderer.blockquote(ut);continue}case"list":{for(st=tt.ordered,gt=tt.start,At=tt.loose,we=tt.items.length,ut="",Xe=0;Xe<we;Xe++)ht=tt.items[Xe],Ot=ht.checked,Bt=ht.task,bt="",ht.task&&(mt=this.renderer.checkbox(Ot),At?ht.tokens.length>0&&ht.tokens[0].type==="text"?(ht.tokens[0].text=mt+" "+ht.tokens[0].text,ht.tokens[0].tokens&&ht.tokens[0].tokens.length>0&&ht.tokens[0].tokens[0].type==="text"&&(ht.tokens[0].tokens[0].text=mt+" "+ht.tokens[0].tokens[0].text)):ht.tokens.unshift({type:"text",text:mt}):bt+=mt),bt+=this.parse(ht.tokens,At),ut+=this.renderer.listitem(bt,Bt,Ot);Z+=this.renderer.list(ut,st,gt);continue}case"html":{Z+=this.renderer.html(tt.text);continue}case"paragraph":{Z+=this.renderer.paragraph(this.parseInline(tt.tokens));continue}case"text":{for(ut=tt.tokens?this.parseInline(tt.tokens):tt.text;me+1<St&&J[me+1].type==="text";)tt=J[++me],ut+=`
`+(tt.tokens?this.parseInline(tt.tokens):tt.text);Z+=oe?this.renderer.paragraph(ut):ut;continue}default:{var ft='Token with "'+tt.type+'" type was not found.';if(this.options.silent){console.error(ft);return}else throw new Error(ft)}}}return Z},ve.parseInline=function(J,oe){oe=oe||this.renderer;var Z="",me,Xe,j=J.length;for(me=0;me<j;me++){Xe=J[me];switch(Xe.type){case"escape":{Z+=oe.text(Xe.text);break}case"html":{Z+=oe.html(Xe.text);break}case"link":{Z+=oe.link(Xe.href,Xe.title,this.parseInline(Xe.tokens,oe));break}case"image":{Z+=oe.image(Xe.href,Xe.title,Xe.text);break}case"strong":{Z+=oe.strong(this.parseInline(Xe.tokens,oe));break}case"em":{Z+=oe.em(this.parseInline(Xe.tokens,oe));break}case"codespan":{Z+=oe.codespan(Xe.text);break}case"br":{Z+=oe.br();break}case"del":{Z+=oe.del(this.parseInline(Xe.tokens,oe));break}case"text":{Z+=oe.text(Xe.text);break}default:{var we='Token with "'+Xe.type+'" type was not found.';if(this.options.silent){console.error(we);return}else throw new Error(we)}}}return Z},Ee}(),Ie=G.merge,Je=G.checkSanitizeDeprecation,et=G.escape,Ke=S.getDefaults,it=S.changeDefaults,he=S.defaults;function Re(Ee,ve,be){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof ve=="function"&&(be=ve,ve=null),ve=Ie({},Re.defaults,ve||{}),Je(ve),be){var J=ve.highlight,oe;try{oe=De.lex(Ee,ve)}catch(j){return be(j)}var Z=function(we){var Be;if(!we)try{Be=ae.parse(oe,ve)}catch(de){we=de}return ve.highlight=J,we?be(we):be(null,Be)};if(!J||J.length<3)return Z();if(delete ve.highlight,!oe.length)return Z();var me=0;Re.walkTokens(oe,function(j){j.type==="code"&&(me++,setTimeout(function(){J(j.text,j.lang,function(we,Be){if(we)return Z(we);Be!=null&&Be!==j.text&&(j.text=Be,j.escaped=!0),me--,me===0&&Z()})},0))}),me===0&&Z();return}try{var Xe=De.lex(Ee,ve);return ve.walkTokens&&Re.walkTokens(Xe,ve.walkTokens),ae.parse(Xe,ve)}catch(j){if(j.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+et(j.message+"",!0)+"</pre>";throw j}}Re.options=Re.setOptions=function(Ee){return Ie(Re.defaults,Ee),it(Re.defaults),Re},Re.getDefaults=Ke,Re.defaults=he,Re.use=function(Ee){var ve=Ie({},Ee);if(Ee.renderer&&function(){var J=Re.defaults.renderer||new Fe,oe=function(Xe){var j=J[Xe];J[Xe]=function(){for(var we=arguments.length,Be=new Array(we),de=0;de<we;de++)Be[de]=arguments[de];var Ce=Ee.renderer[Xe].apply(J,Be);return Ce===!1&&(Ce=j.apply(J,Be)),Ce}};for(var Z in Ee.renderer)oe(Z);ve.renderer=J}(),Ee.tokenizer&&function(){var J=Re.defaults.tokenizer||new Ye,oe=function(Xe){var j=J[Xe];J[Xe]=function(){for(var we=arguments.length,Be=new Array(we),de=0;de<we;de++)Be[de]=arguments[de];var Ce=Ee.tokenizer[Xe].apply(J,Be);return Ce===!1&&(Ce=j.apply(J,Be)),Ce}};for(var Z in Ee.tokenizer)oe(Z);ve.tokenizer=J}(),Ee.walkTokens){var be=Re.defaults.walkTokens;ve.walkTokens=function(J){Ee.walkTokens(J),be&&be(J)}}Re.setOptions(ve)},Re.walkTokens=function(Ee,ve){for(var be=M(Ee),J;!(J=be()).done;){var oe=J.value;ve(oe);switch(oe.type){case"table":{for(var Z=M(oe.tokens.header),me;!(me=Z()).done;){var Xe=me.value;Re.walkTokens(Xe,ve)}for(var j=M(oe.tokens.cells),we;!(we=j()).done;)for(var Be=we.value,de=M(Be),Ce;!(Ce=de()).done;){var je=Ce.value;Re.walkTokens(je,ve)}break}case"list":{Re.walkTokens(oe.items,ve);break}default:oe.tokens&&Re.walkTokens(oe.tokens,ve)}}},Re.Parser=ae,Re.parser=ae.parse,Re.Renderer=Fe,Re.TextRenderer=Ne,Re.Lexer=De,Re.lexer=De.lex,Re.Tokenizer=Ye,Re.Slugger=Me,Re.parse=Re;var He=Re;return He})},Dqnf:function(ot,se,ee){"use strict";var z=ee("k1fw"),L=ee("tJVT"),D=ee("rAM+"),k=ee("q1tI"),M=ee.n(k),f=ee("J66h"),S=ee.n(f),_=ee("/POA"),p=ee.n(_),c=ee("q7KB"),o=ee.n(c),u=ee("ER/M"),s=ee.n(u),l=ee("dhSg"),t=ee("bdgK");function a(h,d,y){var m=y._core._renderService.dimensions.actualCellWidth||9.5,C=y._core._renderService.dimensions.actualCellHeight||18,T=Math.floor(d/C),x=Math.floor(h/m);return[x,T]}function i(h,d){var y=new t.default(function(m){var C=Object(D.a)(m),T;try{for(C.s();!(T=C.n()).done;){var x=T.value;if(x.target.offsetHeight>0||x.target.offsetWidth>0){var E=a(x.target.offsetWidth,x.target.offsetHeight,h),w=Object(L.a)(E,2),A=w[0],g=w[1];console.log("cols, rows",A,g),l.a.publish("ssh-xterm-resize",{columns:A,rows:g,width:x.target.offsetWidth,height:x.target.offsetHeight}),h.resize(A,g);var P=f.Base64.decode("IA=="),O=f.Base64.decode("CBtbSw==");h.write(P),h.write(O)}}}catch(F){C.e(F)}finally{C.f()}});return y.observe(d),y}var r=3e4;se.a=function(h){var d=h.sshConfigData,y=h.sid,m=Object(k.useState)(null),C=Object(L.a)(m,2),T=C[0],x=C[1],E=d.ws_url,w=d.password,A=d.port,g=Object(k.useRef)(),P=Object(k.useRef)(),O=Object(k.useRef)(!1);return Object(k.useEffect)(function(){if(g.current&&E){var F=new _.Terminal({fontSize:16,rendererType:"dom"});F.open(g.current),F.onData(function(W){P.current&&(P.current.readyState===1&&(P.current.send(JSON.stringify({tp:"client",data:W})),l.a.publish("on-operating-ssh")))}),F.write("Connecting..."),x(F);var X=i(F,g.current);return function(){F.dispose(),X.unobserve(g.current)}}},[E,g.current]),Object(k.useEffect)(function(){if(T&&E){function F(){var H=new WebSocket(E);P.current=H,H.onopen=function(){var V=T.element.parentElement;if(V){var ce=V.offsetWidth,ye=V.offsetHeight;console.log("init",{tp:"init",data:Object(z.a)(Object(z.a)({},d),{},{secret:w,width:ce,height:ye,rows:T.rows,columns:T.cols})}),H.send(JSON.stringify({tp:"init",data:Object(z.a)(Object(z.a)({},d),{},{secret:w,width:ce,height:ye,rows:T.rows,columns:T.cols})}))}T.focus()},H.onerror=function(V){console.log("------in socket error----",V,H,E)},H.onmessage=function(V){O.current||(T.write("\r"),setTimeout(function(){},1e3)),O.current=!0,console.log("event:",V);var ce=f.Base64.decode(V.data.toString()),ye=T._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",ce,ye,T),T.write(ce)},H.onclose=function(V){X&&clearInterval(X),T.write(`\r
connection closed`)}}var X=setInterval(function(){P.current&&P.current.send(JSON.stringify({tp:"h"}))},r),W=l.a.subscribe("create-socket",function(H){y==H&&(P.current&&P.current.readyState===1?T.focus():F(),T.focus())}),N=l.a.subscribe("close-socket",function(H){y===H&&(P.current&&(P.current.close(),O.current=!1,T.clear()),P.current=null)}),G=l.a.subscribe("ssh-xterm-resize",function(H){P.current&&P.current.readyState===1&&P.current.send(JSON.stringify({tp:"resize",data:Object(z.a)({},H)}))}),U=l.a.subscribe("ssh-add-connect-time",function(){P.current&&P.current.readyState===1&&P.current.send(JSON.stringify({tp:"overtime"}))});return function(){N(),W(),G(),U(),P.current&&(P.current.close(),O.current=!1)}}},[T,E,A]),M.a.createElement("div",{ref:g,className:s.a["xterm-panel"]},E?null:M.a.createElement("p",{style:{color:"#fff"}},"\u6B63\u5728\u8FDE\u63A5\u547D\u4EE4\u884C\u670D\u52A1..."))}},ELLl:function(ot,se,ee){(function(z){z(ee("VrN/"))})(function(z){var L={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=z.Pos;z.defineOption("autoCloseBrackets",!1,function(t,a,i){i&&i!=z.Init&&(t.removeKeyMap(M),t.state.closeBrackets=null),a&&(f(k(a,"pairs")),t.state.closeBrackets=a,t.addKeyMap(M))});function k(t,a){return a=="pairs"&&typeof t=="string"?t:typeof t=="object"&&t[a]!=null?t[a]:L[a]}var M={Backspace:p,Enter:c};function f(t){for(var a=0;a<t.length;a++){var i=t.charAt(a),r="'"+i+"'";M[r]||(M[r]=S(i))}}f(L.pairs+"`");function S(t){return function(a){return u(a,t)}}function _(t){var a=t.state.closeBrackets;if(!a||a.override)return a;var i=t.getModeAt(t.getCursor());return i.closeBrackets||a}function p(t){var a=_(t);if(!a||t.getOption("disableInput"))return z.Pass;for(var i=k(a,"pairs"),r=t.listSelections(),h=0;h<r.length;h++){if(!r[h].empty())return z.Pass;var d=s(t,r[h].head);if(!d||i.indexOf(d)%2!=0)return z.Pass}for(var h=r.length-1;h>=0;h--){var y=r[h].head;t.replaceRange("",D(y.line,y.ch-1),D(y.line,y.ch+1),"+delete")}}function c(t){var a=_(t),i=a&&k(a,"explode");if(!i||t.getOption("disableInput"))return z.Pass;for(var r=t.listSelections(),h=0;h<r.length;h++){if(!r[h].empty())return z.Pass;var d=s(t,r[h].head);if(!d||i.indexOf(d)%2!=0)return z.Pass}t.operation(function(){var y=t.lineSeparator()||`
`;t.replaceSelection(y+y,null),t.execCommand("goCharLeft"),r=t.listSelections();for(var m=0;m<r.length;m++){var C=r[m].head.line;t.indentLine(C,null,!0),t.indentLine(C+1,null,!0)}})}function o(t){var a=z.cmpPos(t.anchor,t.head)>0;return{anchor:new D(t.anchor.line,t.anchor.ch+(a?-1:1)),head:new D(t.head.line,t.head.ch+(a?1:-1))}}function u(t,a){var i=_(t);if(!i||t.getOption("disableInput"))return z.Pass;var r=k(i,"pairs"),h=r.indexOf(a);if(h==-1)return z.Pass;for(var d=k(i,"closeBefore"),y=k(i,"triples"),m=r.charAt(h+1)==a,C=t.listSelections(),T=h%2==0,x,E=0;E<C.length;E++){var w=C[E],A=w.head,g,P=t.getRange(A,D(A.line,A.ch+1));if(T&&!w.empty())g="surround";else if((m||!T)&&P==a)m&&l(t,A)?g="both":y.indexOf(a)>=0&&t.getRange(A,D(A.line,A.ch+3))==a+a+a?g="skipThree":g="skip";else if(m&&A.ch>1&&y.indexOf(a)>=0&&t.getRange(D(A.line,A.ch-2),A)==a+a){if(A.ch>2&&/\bstring/.test(t.getTokenTypeAt(D(A.line,A.ch-2))))return z.Pass;g="addFour"}else if(m){var O=A.ch==0?" ":t.getRange(D(A.line,A.ch-1),A);if(!z.isWordChar(P)&&O!=a&&!z.isWordChar(O))g="both";else return z.Pass}else if(T&&(P.length===0||/\s/.test(P)||d.indexOf(P)>-1))g="both";else return z.Pass;if(!x)x=g;else if(x!=g)return z.Pass}var F=h%2?r.charAt(h-1):a,X=h%2?a:r.charAt(h+1);t.operation(function(){if(x=="skip")t.execCommand("goCharRight");else if(x=="skipThree")for(var W=0;W<3;W++)t.execCommand("goCharRight");else if(x=="surround"){for(var N=t.getSelections(),W=0;W<N.length;W++)N[W]=F+N[W]+X;t.replaceSelections(N,"around"),N=t.listSelections().slice();for(var W=0;W<N.length;W++)N[W]=o(N[W]);t.setSelections(N)}else x=="both"?(t.replaceSelection(F+X,null),t.triggerElectric(F+X),t.execCommand("goCharLeft")):x=="addFour"&&(t.replaceSelection(F+F+F+F,"before"),t.execCommand("goCharRight"))})}function s(t,a){var i=t.getRange(D(a.line,a.ch-1),D(a.line,a.ch+1));return i.length==2?i:null}function l(t,a){var i=t.getTokenAt(D(a.line,a.ch+1));return/\bstring/.test(i.type)&&i.start==a.ch&&(a.ch==0||!/\bstring/.test(t.getTokenTypeAt(a)))}})},"ER/M":function(ot,se,ee){ot.exports={"xterm-panel":"xterm-panel___2r2xx"}},Fv0C:function(ot,se,ee){"use strict";function z(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(a){return typeof a}:z=function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},z(l)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=p(ee("Lo0S")),D=ee("vewr"),k=p(ee("8CQX")),M=S(ee("mHUz")),f=p(ee("GdRQ"));function S(l){return l&&l.__esModule?l:{default:l}}function _(){if(typeof WeakMap!="function")return null;var l=new WeakMap;return _=function(){return l},l}function p(l){if(l&&l.__esModule)return l;if(l===null||z(l)!=="object"&&typeof l!="function")return{default:l};var t=_();if(t&&t.has(l))return t.get(l);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in l)if(Object.prototype.hasOwnProperty.call(l,r)){var h=i?Object.getOwnPropertyDescriptor(l,r):null;h&&(h.get||h.set)?Object.defineProperty(a,r,h):a[r]=l[r]}return a.default=l,t&&t.set(l,a),a}function c(l,t){if(!(l instanceof t))throw new TypeError("Cannot call a class as a function")}function o(l,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function u(l,t,a){return t&&o(l.prototype,t),a&&o(l,a),l}var s=function(){function l(t){c(this,l),this._target=t||null,this._keyDownList={},this._pendingKey=null,this._altGrArmed=!1,this._eventHandlers={keyup:this._handleKeyUp.bind(this),keydown:this._handleKeyDown.bind(this),keypress:this._handleKeyPress.bind(this),blur:this._allKeysUp.bind(this),checkalt:this._checkAlt.bind(this)},this.onkeyevent=function(){}}return u(l,[{key:"_sendKeyEvent",value:function(a,i,r){if(r)this._keyDownList[i]=a;else{if(!(i in this._keyDownList))return;delete this._keyDownList[i]}L.Debug("onkeyevent "+(r?"down":"up")+", keysym: "+a,", code: "+i),this.onkeyevent(a,i,r)}},{key:"_getKeyCode",value:function(a){var i=k.getKeycode(a);if(i!=="Unidentified")return i;if(a.keyCode&&a.type!=="keypress"&&a.keyCode!==229)return"Platform"+a.keyCode;if(a.keyIdentifier){if(a.keyIdentifier.substr(0,2)!=="U+")return a.keyIdentifier;var r=parseInt(a.keyIdentifier.substr(2),16),h=String.fromCharCode(r).toUpperCase();return"Platform"+h.charCodeAt()}return"Unidentified"}},{key:"_handleKeyDown",value:function(a){var i=this._getKeyCode(a),r=k.getKeysym(a);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),i==="AltRight"&&a.timeStamp-this._altGrCtrlTime<50?r=M.default.XK_ISO_Level3_Shift:this._sendKeyEvent(M.default.XK_Control_L,"ControlLeft",!0)),i==="Unidentified"){r&&(this._sendKeyEvent(r,i,!0),this._sendKeyEvent(r,i,!1)),(0,D.stopEvent)(a);return}if(f.isMac()||f.isIOS())switch(r){case M.default.XK_Super_L:r=M.default.XK_Alt_L;break;case M.default.XK_Super_R:r=M.default.XK_Super_L;break;case M.default.XK_Alt_L:r=M.default.XK_Mode_switch;break;case M.default.XK_Alt_R:r=M.default.XK_ISO_Level3_Shift;break}if(i in this._keyDownList&&(r=this._keyDownList[i]),(f.isMac()||f.isIOS())&&i==="CapsLock"){this._sendKeyEvent(M.default.XK_Caps_Lock,"CapsLock",!0),this._sendKeyEvent(M.default.XK_Caps_Lock,"CapsLock",!1),(0,D.stopEvent)(a);return}if(!r&&(!a.key||f.isIE()||f.isEdge())){this._pendingKey=i,setTimeout(this._handleKeyPressTimeout.bind(this),10,a);return}if(this._pendingKey=null,(0,D.stopEvent)(a),i==="ControlLeft"&&f.isWindows()&&!("ControlLeft"in this._keyDownList)){this._altGrArmed=!0,this._altGrTimeout=setTimeout(this._handleAltGrTimeout.bind(this),100),this._altGrCtrlTime=a.timeStamp;return}this._sendKeyEvent(r,i,!0)}},{key:"_handleKeyPress",value:function(a){if((0,D.stopEvent)(a),this._pendingKey===null)return;var i=this._getKeyCode(a),r=k.getKeysym(a);if(i!=="Unidentified"&&i!=this._pendingKey)return;if(i=this._pendingKey,this._pendingKey=null,!r){L.Info("keypress with no keysym:",a);return}this._sendKeyEvent(r,i,!0)}},{key:"_handleKeyPressTimeout",value:function(a){if(this._pendingKey===null)return;var i,r=this._pendingKey;if(this._pendingKey=null,a.keyCode>=48&&a.keyCode<=57)i=a.keyCode;else if(a.keyCode>=65&&a.keyCode<=90){var h=String.fromCharCode(a.keyCode);a.shiftKey?h=h.toUpperCase():h=h.toLowerCase(),i=h.charCodeAt()}else i=0;this._sendKeyEvent(i,r,!0)}},{key:"_handleKeyUp",value:function(a){(0,D.stopEvent)(a);var i=this._getKeyCode(a);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(M.default.XK_Control_L,"ControlLeft",!0)),(f.isMac()||f.isIOS())&&i==="CapsLock"){this._sendKeyEvent(M.default.XK_Caps_Lock,"CapsLock",!0),this._sendKeyEvent(M.default.XK_Caps_Lock,"CapsLock",!1);return}this._sendKeyEvent(this._keyDownList[i],i,!1),f.isWindows()&&(i==="ShiftLeft"||i==="ShiftRight")&&("ShiftRight"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftRight,"ShiftRight",!1),"ShiftLeft"in this._keyDownList&&this._sendKeyEvent(this._keyDownList.ShiftLeft,"ShiftLeft",!1))}},{key:"_handleAltGrTimeout",value:function(){this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(M.default.XK_Control_L,"ControlLeft",!0)}},{key:"_allKeysUp",value:function(){L.Debug(">> Keyboard.allKeysUp");for(var a in this._keyDownList)this._sendKeyEvent(this._keyDownList[a],a,!1);L.Debug("<< Keyboard.allKeysUp")}},{key:"_checkAlt",value:function(a){if(a.skipCheckAlt)return;if(a.altKey)return;var i=this._target,r=this._keyDownList;["AltLeft","AltRight"].forEach(function(h){if(!(h in r))return;var d=new KeyboardEvent("keyup",{key:r[h],code:h});d.skipCheckAlt=!0,i.dispatchEvent(d)})}},{key:"grab",value:function(){if(this._target.addEventListener("keydown",this._eventHandlers.keydown),this._target.addEventListener("keyup",this._eventHandlers.keyup),this._target.addEventListener("keypress",this._eventHandlers.keypress),window.addEventListener("blur",this._eventHandlers.blur),f.isWindows()&&f.isFirefox()){var a=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach(function(i){return document.addEventListener(i,a,{capture:!0,passive:!0})})}}},{key:"ungrab",value:function(){if(f.isWindows()&&f.isFirefox()){var a=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach(function(i){return document.removeEventListener(i,a)})}this._target.removeEventListener("keydown",this._eventHandlers.keydown),this._target.removeEventListener("keyup",this._eventHandlers.keyup),this._target.removeEventListener("keypress",this._eventHandlers.keypress),window.removeEventListener("blur",this._eventHandlers.blur),this._allKeysUp()}}]),l}();se.default=s},GQ8N:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.toUnsigned32bit=z,se.toSigned32bit=L;function z(D){return D>>>0}function L(D){return D|0}},GdRQ:function(ot,se,ee){"use strict";function z(T){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(E){return typeof E}:z=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},z(T)}Object.defineProperty(se,"__esModule",{value:!0}),se.isMac=i,se.isWindows=r,se.isIOS=h,se.isSafari=d,se.isIE=y,se.isEdge=m,se.isFirefox=C,se.hasScrollbarGutter=se.supportsImageMetadata=se.supportsCursorURIs=se.dragThreshold=se.isTouchDevice=void 0;var L=k(ee("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var T=new WeakMap;return D=function(){return T},T}function k(T){if(T&&T.__esModule)return T;if(T===null||z(T)!=="object"&&typeof T!="function")return{default:T};var x=D();if(x&&x.has(T))return x.get(T);var E={},w=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in T)if(Object.prototype.hasOwnProperty.call(T,A)){var g=w?Object.getOwnPropertyDescriptor(T,A):null;g&&(g.get||g.set)?Object.defineProperty(E,A,g):E[A]=T[A]}return E.default=T,x&&x.set(T,E),E}var M="ontouchstart"in document.documentElement||document.ontouchstart!==void 0||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;se.isTouchDevice=M,window.addEventListener("touchstart",function T(){se.isTouchDevice=M=!0,window.removeEventListener("touchstart",T,!1)},!1);var f=10*(window.devicePixelRatio||1);se.dragThreshold=f;var S=!1;try{var _=document.createElement("canvas");_.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',_.style.cursor.indexOf("url")===0?(L.Info("Data URI scheme cursor supported"),S=!0):L.Warn("Data URI scheme cursor not supported")}catch(T){L.Error("Data URI scheme cursor test exception: "+T)}var p=S;se.supportsCursorURIs=p;var c=!1;try{new ImageData(new Uint8ClampedArray(4),1,1),c=!0}catch(T){}var o=c;se.supportsImageMetadata=o;var u=!0;try{var s=document.createElement("div");s.style.visibility="hidden",s.style.overflow="scroll",document.body.appendChild(s);var l=document.createElement("div");s.appendChild(l);var t=s.offsetWidth-l.offsetWidth;s.parentNode.removeChild(s),u=t!=0}catch(T){L.Error("Scrollbar test exception: "+T)}var a=u;se.hasScrollbarGutter=a;function i(){return navigator&&!!/mac/i.exec(navigator.platform)}function r(){return navigator&&!!/win/i.exec(navigator.platform)}function h(){return navigator&&(!!/ipad/i.exec(navigator.platform)||!!/iphone/i.exec(navigator.platform)||!!/ipod/i.exec(navigator.platform))}function d(){return navigator&&navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1}function y(){return navigator&&!!/trident/i.exec(navigator.userAgent)}function m(){return navigator&&!!/edge/i.exec(navigator.userAgent)}function C(){return navigator&&!!/firefox/i.exec(navigator.userAgent)}},Gytx:function(ot,se){ot.exports=function(z,L,D,k){var M=D?D.call(k,z,L):void 0;if(M!==void 0)return!!M;if(z===L)return!0;if(typeof z!="object"||!z||typeof L!="object"||!L)return!1;var f=Object.keys(z),S=Object.keys(L);if(f.length!==S.length)return!1;for(var _=Object.prototype.hasOwnProperty.bind(L),p=0;p<f.length;p++){var c=f[p];if(!_(c))return!1;var o=z[c],u=L[c];if(M=D?D.call(k,o,u,c):void 0,M===!1||M===void 0&&o!==u)return!1}return!0}},HmJG:function(ot,se,ee){},ItS6:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=ee("eP3c"),L=D(ee("1q3G"));function D(_){return _&&_.__esModule?_:{default:_}}function k(_,p){if(!(_ instanceof p))throw new TypeError("Cannot call a class as a function")}function M(_,p){for(var c=0;c<p.length;c++){var o=p[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(_,o.key,o)}}function f(_,p,c){return p&&M(_.prototype,p),c&&M(_,c),_}var S=function(){function _(){k(this,_),this.strm=new L.default,this.chunkSize=1024*10*10,this.strm.output=new Uint8Array(this.chunkSize),this.windowBits=5,(0,z.inflateInit)(this.strm,this.windowBits)}return f(_,[{key:"setInput",value:function(c){c?(this.strm.input=c,this.strm.avail_in=this.strm.input.length,this.strm.next_in=0):(this.strm.input=null,this.strm.avail_in=0,this.strm.next_in=0)}},{key:"inflate",value:function(c){c>this.chunkSize&&(this.chunkSize=c,this.strm.output=new Uint8Array(this.chunkSize)),this.strm.next_out=0,this.strm.avail_out=c;var o=(0,z.inflate)(this.strm,0);if(o<0)throw new Error("zlib inflate failed");if(this.strm.next_out!=c)throw new Error("Incomplete zlib block");return new Uint8Array(this.strm.output.buffer,0,this.strm.next_out)}},{key:"reset",value:function(){(0,z.inflateReset)(this.strm)}}]),_}();se.default=S},IxHN:function(ot,se,ee){"use strict";var z=ee("q1tI"),L=ee.n(z),D=ee("07cG"),k=ee.n(D);se.a=function(M){var f=M.message,S=M.className,_=M.children,p=M.style,c=p===void 0?{}:p;return L.a.createElement("div",{className:"".concat(k.a.idsRingWrapper," ").concat(S)},L.a.createElement("div",{className:k.a.ldsRing},L.a.createElement("div",null),L.a.createElement("div",null),L.a.createElement("div",null),L.a.createElement("div",null)),f?L.a.createElement("p",{style:c},f):null,_)}},J66h:function(ot,se,ee){(function(z){var L,D;(function(k,M){ot.exports=M(k)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof z!="undefined"?z:this,function(k){"use strict";k=k||{};var M=k.Base64,f="2.6.4",S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=function(F){for(var X={},W=0,N=F.length;W<N;W++)X[F.charAt(W)]=W;return X}(S),p=String.fromCharCode,c=function(F){if(F.length<2){var X=F.charCodeAt(0);return X<128?F:X<2048?p(192|X>>>6)+p(128|X&63):p(224|X>>>12&15)+p(128|X>>>6&63)+p(128|X&63)}else{var X=65536+(F.charCodeAt(0)-55296)*1024+(F.charCodeAt(1)-56320);return p(240|X>>>18&7)+p(128|X>>>12&63)+p(128|X>>>6&63)+p(128|X&63)}},o=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,u=function(F){return F.replace(o,c)},s=function(F){var X=[0,2,1][F.length%3],W=F.charCodeAt(0)<<16|(F.length>1?F.charCodeAt(1):0)<<8|(F.length>2?F.charCodeAt(2):0),N=[S.charAt(W>>>18),S.charAt(W>>>12&63),X>=2?"=":S.charAt(W>>>6&63),X>=1?"=":S.charAt(W&63)];return N.join("")},l=k.btoa&&typeof k.btoa=="function"?function(F){return k.btoa(F)}:function(F){if(F.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return F.replace(/[\s\S]{1,3}/g,s)},t=function(F){return l(u(String(F)))},a=function(F){return F.replace(/[+\/]/g,function(X){return X=="+"?"-":"_"}).replace(/=/g,"")},i=function(F,X){return X?a(t(F)):t(F)},r=function(F){return i(F,!0)},h;k.Uint8Array&&(h=function(F,X){for(var W="",N=0,G=F.length;N<G;N+=3){var U=F[N],H=F[N+1],V=F[N+2],ce=U<<16|H<<8|V;W+=S.charAt(ce>>>18)+S.charAt(ce>>>12&63)+(typeof H!="undefined"?S.charAt(ce>>>6&63):"=")+(typeof V!="undefined"?S.charAt(ce&63):"=")}return X?a(W):W});var d=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,y=function(F){switch(F.length){case 4:var X=(7&F.charCodeAt(0))<<18|(63&F.charCodeAt(1))<<12|(63&F.charCodeAt(2))<<6|63&F.charCodeAt(3),W=X-65536;return p((W>>>10)+55296)+p((W&1023)+56320);case 3:return p((15&F.charCodeAt(0))<<12|(63&F.charCodeAt(1))<<6|63&F.charCodeAt(2));default:return p((31&F.charCodeAt(0))<<6|63&F.charCodeAt(1))}},m=function(F){return F.replace(d,y)},C=function(F){var X=F.length,W=X%4,N=(X>0?_[F.charAt(0)]<<18:0)|(X>1?_[F.charAt(1)]<<12:0)|(X>2?_[F.charAt(2)]<<6:0)|(X>3?_[F.charAt(3)]:0),G=[p(N>>>16),p(N>>>8&255),p(N&255)];return G.length-=[0,0,2,1][W],G.join("")},T=k.atob&&typeof k.atob=="function"?function(F){return k.atob(F)}:function(F){return F.replace(/\S{1,4}/g,C)},x=function(F){return T(String(F).replace(/[^A-Za-z0-9\+\/]/g,""))},E=function(F){return m(T(F))},w=function(F){return String(F).replace(/[-_]/g,function(X){return X=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},A=function(F){return E(w(F))},g;k.Uint8Array&&(g=function(F){return Uint8Array.from(x(w(F)),function(X){return X.charCodeAt(0)})});var P=function(){var F=k.Base64;return k.Base64=M,F};if(k.Base64={VERSION:f,atob:x,btoa:l,fromBase64:A,toBase64:i,utob:u,encode:i,encodeURI:r,btou:m,decode:A,noConflict:P,fromUint8Array:h,toUint8Array:g},typeof Object.defineProperty=="function"){var O=function(F){return{value:F,enumerable:!1,writable:!0,configurable:!0}};k.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",O(function(){return A(this)})),Object.defineProperty(String.prototype,"toBase64",O(function(F){return i(this,F)})),Object.defineProperty(String.prototype,"toBase64URI",O(function(){return i(this,!0)}))}}return k.Meteor&&(Base64=k.Base64),ot.exports?ot.exports.Base64=k.Base64:!(L=[],D=function(){return k.Base64}.apply(se,L),D!==void 0&&(ot.exports=D)),{Base64:k.Base64}})}).call(this,ee("IyRk"))},JSwD:function(ot,se,ee){"use strict";function z(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(r){return typeof r}:z=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},z(a)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=t;var L=k(ee("6BzB"));function D(){if(typeof WeakMap!="function")return null;var a=new WeakMap;return D=function(){return a},a}function k(a){if(a&&a.__esModule)return a;if(a===null||z(a)!=="object"&&typeof a!="function")return{default:a};var i=D();if(i&&i.has(a))return i.get(a);var r={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var d in a)if(Object.prototype.hasOwnProperty.call(a,d)){var y=h?Object.getOwnPropertyDescriptor(a,d):null;y&&(y.get||y.set)?Object.defineProperty(r,d,y):r[d]=a[d]}return r.default=a,i&&i.set(a,r),r}var M=15,f=852,S=592,_=0,p=1,c=2,o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],l=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function t(a,i,r,h,d,y,m,C){var T=C.bits,x=0,E=0,w=0,A=0,g=0,P=0,O=0,F=0,X=0,W=0,N,G,U,H,V,ce=null,ye=0,Le,Ze=new L.Buf16(M+1),Ye=new L.Buf16(M+1),Oe=null,We=0,ze,Ae,xe;for(x=0;x<=M;x++)Ze[x]=0;for(E=0;E<h;E++)Ze[i[r+E]]++;for(g=T,A=M;A>=1&&!(Ze[A]!==0);A--);if(g>A&&(g=A),A===0)return d[y++]=1<<24|64<<16|0,d[y++]=1<<24|64<<16|0,C.bits=1,0;for(w=1;w<A&&!(Ze[w]!==0);w++);for(g<w&&(g=w),F=1,x=1;x<=M;x++)if(F<<=1,F-=Ze[x],F<0)return-1;if(F>0&&(a===_||A!==1))return-1;for(Ye[1]=0,x=1;x<M;x++)Ye[x+1]=Ye[x]+Ze[x];for(E=0;E<h;E++)i[r+E]!==0&&(m[Ye[i[r+E]]++]=E);if(a===_?(ce=Oe=m,Le=19):a===p?(ce=o,ye-=257,Oe=u,We-=257,Le=256):(ce=s,Oe=l,Le=-1),W=0,E=0,x=w,V=y,P=g,O=0,U=-1,X=1<<g,H=X-1,a===p&&X>f||a===c&&X>S)return 1;for(;;){ze=x-O,m[E]<Le?(Ae=0,xe=m[E]):m[E]>Le?(Ae=Oe[We+m[E]],xe=ce[ye+m[E]]):(Ae=32+64,xe=0),N=1<<x-O,G=1<<P,w=G;do G-=N,d[V+(W>>O)+G]=ze<<24|Ae<<16|xe|0;while(G!==0);for(N=1<<x-1;W&N;)N>>=1;if(N!==0?(W&=N-1,W+=N):W=0,E++,--Ze[x]===0){if(x===A)break;x=i[r+m[E]]}if(x>g&&(W&H)!==U){for(O===0&&(O=g),V+=w,P=x-O,F=1<<P;P+O<A&&!(F-=Ze[P+O],F<=0);)P++,F<<=1;if(X+=1<<P,a===p&&X>f||a===c&&X>S)return 1;U=W&H,d[U]=g<<24|P<<16|V-y|0}}return W!==0&&(d[V+W]=x-O<<24|64<<16|0),C.bits=g,0}},JYp7:function(ot,se,ee){"use strict";ee.d(se,"c",function(){return L}),ee.d(se,"d",function(){return D}),ee.d(se,"f",function(){return M}),ee.d(se,"a",function(){return f}),ee.d(se,"b",function(){return S}),ee.d(se,"e",function(){return _});var z=function(){var p=function(c,o){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,s){u.__proto__=s}||function(u,s){for(var l in s)s.hasOwnProperty(l)&&(u[l]=s[l])},p(c,o)};return function(c,o){p(c,o);function u(){this.constructor=c}c.prototype=o===null?Object.create(o):(u.prototype=o.prototype,new u)}}(),L={done:!0,value:void 0},D;(function(p){var c={next:function(){return L}};function o(){return c}p.empty=o;function u(m){var C=!1;return{next:function(){return C?L:(C=!0,{done:!1,value:m})}}}p.single=u;function s(m,C,T){return C===void 0&&(C=0),T===void 0&&(T=m.length),{next:function(){return C>=T?L:{done:!1,value:m[C++]}}}}p.fromArray=s;function l(m){return{next:function(){var C=m.next();return C.done?L:{done:!1,value:C.value}}}}p.fromNativeIterator=l;function t(m){return m?Array.isArray(m)?p.fromArray(m):m:p.empty()}p.from=t;function a(m,C){return{next:function(){var T=m.next();return T.done?L:{done:!1,value:C(T.value)}}}}p.map=a;function i(m,C){return{next:function(){for(;;){var T=m.next();if(T.done)return L;if(C(T.value))return{done:!1,value:T.value}}}}}p.filter=i;function r(m,C){for(var T=m.next();!T.done;T=m.next())C(T.value)}p.forEach=r;function h(m,C){C===void 0&&(C=Number.POSITIVE_INFINITY);var T=[];if(C===0)return T;for(var x=0,E=m.next();!E.done&&!(T.push(E.value),++x>=C);E=m.next());return T}p.collect=h;function d(){for(var m=[],C=0;C<arguments.length;C++)m[C]=arguments[C];var T=0;return{next:function(){if(T>=m.length)return L;var x=m[T],E=x.next();return E.done?(T++,this.next()):E}}}p.concat=d;function y(m){return new k(m)}p.chain=y})(D||(D={}));var k=function(){function p(c){this.it=c}return p.prototype.next=function(){return this.it.next()},p}();function M(p){return Array.isArray(p)?D.fromArray(p):p||D.empty()}var f=function(){function p(c,o,u,s){o===void 0&&(o=0),u===void 0&&(u=c.length),s===void 0&&(s=o-1),this.items=c,this.start=o,this.end=u,this.index=s}return p.prototype.first=function(){return this.index=this.start,this.current()},p.prototype.next=function(){return this.index=Math.min(this.index+1,this.end),this.current()},p.prototype.current=function(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]},p}(),S=function(p){z(c,p);function c(o,u,s,l){return u===void 0&&(u=0),s===void 0&&(s=o.length),l===void 0&&(l=u-1),p.call(this,o,u,s,l)||this}return c.prototype.current=function(){return p.prototype.current.call(this)},c.prototype.previous=function(){return this.index=Math.max(this.index-1,this.start-1),this.current()},c.prototype.first=function(){return this.index=this.start,this.current()},c.prototype.last=function(){return this.index=this.end-1,this.current()},c.prototype.parent=function(){return null},c}(f),_=function(){function p(c,o){this.iterator=c,this.fn=o}return p.prototype.next=function(){return this.fn(this.iterator.next())},p}()},LCi9:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(d,y){if(!(d instanceof y))throw new TypeError("Cannot call a class as a function")}function L(d,y){for(var m=0;m<y.length;m++){var C=y[m];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(d,C.key,C)}}function D(d,y,m){return y&&L(d.prototype,y),m&&L(d,m),d}var k=0,M=1,f=2,S=4,_=8,p=16,c=32,o=64,u=127,s=50,l=90,t=250,a=1e3,i=1e3,r=50,h=function(){function d(){z(this,d),this._target=null,this._state=u,this._tracked=[],this._ignored=[],this._waitingRelease=!1,this._releaseStart=0,this._longpressTimeoutId=null,this._twoTouchTimeoutId=null,this._boundEventHandler=this._eventHandler.bind(this)}return D(d,[{key:"attach",value:function(m){this.detach(),this._target=m,this._target.addEventListener("touchstart",this._boundEventHandler),this._target.addEventListener("touchmove",this._boundEventHandler),this._target.addEventListener("touchend",this._boundEventHandler),this._target.addEventListener("touchcancel",this._boundEventHandler)}},{key:"detach",value:function(){if(!this._target)return;this._stopLongpressTimeout(),this._stopTwoTouchTimeout(),this._target.removeEventListener("touchstart",this._boundEventHandler),this._target.removeEventListener("touchmove",this._boundEventHandler),this._target.removeEventListener("touchend",this._boundEventHandler),this._target.removeEventListener("touchcancel",this._boundEventHandler),this._target=null}},{key:"_eventHandler",value:function(m){var C;m.stopPropagation(),m.preventDefault();switch(m.type){case"touchstart":C=this._touchStart;break;case"touchmove":C=this._touchMove;break;case"touchend":case"touchcancel":C=this._touchEnd;break}for(var T=0;T<m.changedTouches.length;T++){var x=m.changedTouches[T];C.call(this,x.identifier,x.clientX,x.clientY)}}},{key:"_touchStart",value:function(m,C,T){if(this._hasDetectedGesture()||this._state===k){this._ignored.push(m);return}if(this._tracked.length>0&&Date.now()-this._tracked[0].started>t){this._state=k,this._ignored.push(m);return}if(this._waitingRelease){this._state=k,this._ignored.push(m);return}this._tracked.push({id:m,started:Date.now(),active:!0,firstX:C,firstY:T,lastX:C,lastY:T,angle:0});switch(this._tracked.length){case 1:this._startLongpressTimeout();break;case 2:this._state&=~(M|_|p),this._stopLongpressTimeout();break;case 3:this._state&=~(f|c|o);break;default:this._state=k}}},{key:"_touchMove",value:function(m,C,T){var x=this._tracked.find(function(O){return O.id===m});if(x===void 0)return;x.lastX=C,x.lastY=T;var E=C-x.firstX,w=T-x.firstY;if((x.firstX!==x.lastX||x.firstY!==x.lastY)&&(x.angle=Math.atan2(w,E)*180/Math.PI),!this._hasDetectedGesture()){if(Math.hypot(E,w)<s)return;if(this._state&=~(M|f|S|p),this._stopLongpressTimeout(),this._tracked.length!==1&&(this._state&=~_),this._tracked.length!==2&&(this._state&=~(c|o)),this._tracked.length===2){var A=this._tracked.find(function(O){return O.id!==m}),g=Math.hypot(A.firstX-A.lastX,A.firstY-A.lastY);if(g>s){var P=Math.abs(x.angle-A.angle);P=Math.abs((P+180)%360-180),P>l?this._state&=~c:this._state&=~o,this._isTwoTouchTimeoutRunning()&&this._stopTwoTouchTimeout()}else this._isTwoTouchTimeoutRunning()||this._startTwoTouchTimeout()}if(!this._hasDetectedGesture())return;this._pushEvent("gesturestart")}this._pushEvent("gesturemove")}},{key:"_touchEnd",value:function(m,C,T){if(this._ignored.indexOf(m)!==-1){this._ignored.splice(this._ignored.indexOf(m),1),this._ignored.length===0&&this._tracked.length===0&&(this._state=u,this._waitingRelease=!1);return}if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning()&&(this._stopTwoTouchTimeout(),this._state=k),!this._hasDetectedGesture()&&(this._state&=~(_|c|o),this._state&=~p,this._stopLongpressTimeout(),!this._waitingRelease)){this._releaseStart=Date.now(),this._waitingRelease=!0;switch(this._tracked.length){case 1:this._state&=~(f|S);break;case 2:this._state&=~(M|S);break}}if(this._waitingRelease){Date.now()-this._releaseStart>t&&(this._state=k),this._tracked.some(function(w){return Date.now()-w.started>a})&&(this._state=k);var x=this._tracked.find(function(w){return w.id===m});if(x.active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(this._state!==k)return}this._hasDetectedGesture()&&this._pushEvent("gestureend");for(var E=0;E<this._tracked.length;E++)this._tracked[E].active&&this._ignored.push(this._tracked[E].id);this._tracked=[],this._state=k,this._ignored.indexOf(m)!==-1&&this._ignored.splice(this._ignored.indexOf(m),1),this._ignored.length===0&&(this._state=u,this._waitingRelease=!1)}},{key:"_hasDetectedGesture",value:function(){return this._state===k||this._state&this._state-1?!1:!(this._state&(M|f|S)&&this._tracked.some(function(m){return m.active}))}},{key:"_startLongpressTimeout",value:function(){var m=this;this._stopLongpressTimeout(),this._longpressTimeoutId=setTimeout(function(){return m._longpressTimeout()},i)}},{key:"_stopLongpressTimeout",value:function(){clearTimeout(this._longpressTimeoutId),this._longpressTimeoutId=null}},{key:"_longpressTimeout",value:function(){if(this._hasDetectedGesture())throw new Error("A longpress gesture failed, conflict with a different gesture");this._state=p,this._pushEvent("gesturestart")}},{key:"_startTwoTouchTimeout",value:function(){var m=this;this._stopTwoTouchTimeout(),this._twoTouchTimeoutId=setTimeout(function(){return m._twoTouchTimeout()},r)}},{key:"_stopTwoTouchTimeout",value:function(){clearTimeout(this._twoTouchTimeoutId),this._twoTouchTimeoutId=null}},{key:"_isTwoTouchTimeoutRunning",value:function(){return this._twoTouchTimeoutId!==null}},{key:"_twoTouchTimeout",value:function(){if(this._tracked.length===0)throw new Error("A pinch or two drag gesture failed, no tracked touches");var m=this._getAverageMovement(),C=Math.abs(m.x),T=Math.abs(m.y),x=this._getAverageDistance(),E=Math.abs(Math.hypot(x.first.x,x.first.y)-Math.hypot(x.last.x,x.last.y));T<E&&C<E?this._state=o:this._state=c,this._pushEvent("gesturestart"),this._pushEvent("gesturemove")}},{key:"_pushEvent",value:function(m){var C={type:this._stateToGesture(this._state)},T=this._getPosition(),x=T.last;m==="gesturestart"&&(x=T.first);switch(this._state){case c:case o:x=T.first;break}if(C.clientX=x.x,C.clientY=x.y,this._state===o){var E=this._getAverageDistance();m==="gesturestart"?(C.magnitudeX=E.first.x,C.magnitudeY=E.first.y):(C.magnitudeX=E.last.x,C.magnitudeY=E.last.y)}else if(this._state===c)if(m==="gesturestart")C.magnitudeX=0,C.magnitudeY=0;else{var w=this._getAverageMovement();C.magnitudeX=w.x,C.magnitudeY=w.y}var A=new CustomEvent(m,{detail:C});this._target.dispatchEvent(A)}},{key:"_stateToGesture",value:function(m){switch(m){case M:return"onetap";case f:return"twotap";case S:return"threetap";case _:return"drag";case p:return"longpress";case c:return"twodrag";case o:return"pinch"}throw new Error("Unknown gesture state: "+m)}},{key:"_getPosition",value:function(){if(this._tracked.length===0)throw new Error("Failed to get gesture position, no tracked touches");for(var m=this._tracked.length,C=0,T=0,x=0,E=0,w=0;w<this._tracked.length;w++)C+=this._tracked[w].firstX,T+=this._tracked[w].firstY,x+=this._tracked[w].lastX,E+=this._tracked[w].lastY;return{first:{x:C/m,y:T/m},last:{x:x/m,y:E/m}}}},{key:"_getAverageMovement",value:function(){if(this._tracked.length===0)throw new Error("Failed to get gesture movement, no tracked touches");var m,C;m=C=0;for(var T=this._tracked.length,x=0;x<this._tracked.length;x++)m+=this._tracked[x].lastX-this._tracked[x].firstX,C+=this._tracked[x].lastY-this._tracked[x].firstY;return{x:m/T,y:C/T}}},{key:"_getAverageDistance",value:function(){if(this._tracked.length===0)throw new Error("Failed to get gesture distance, no tracked touches");var m=this._tracked[0],C=this._tracked[this._tracked.length-1],T=Math.abs(C.firstX-m.firstX),x=Math.abs(C.firstY-m.firstY),E=Math.abs(C.lastX-m.lastX),w=Math.abs(C.lastY-m.lastY);return{first:{x:T,y:x},last:{x:E,y:w}}}}]),d}();se.default=h},LdHM:function(ot,se,ee){"use strict";ee.d(se,"b",function(){return d}),ee.d(se,"a",function(){return m});var z=ee("1OyB"),L=ee("vuIU"),D=ee("Ji7U"),k=ee("LK+K"),M=ee("q1tI"),f=ee("rePB"),S=ee("Ff2n"),_=ee("ODXe"),p=ee("4IlW"),c=ee("bX4T"),o=ee("YrtM"),u=ee("TSYQ"),s=ee.n(u),l=ee("+nKL"),t=ee("8OUc"),a=function(V,ce){var ye=V.prefixCls,Le=V.id,Ze=V.flattenOptions,Ye=V.childrenAsData,Oe=V.values,We=V.searchValue,ze=V.multiple,Ae=V.defaultActiveFirstOption,xe=V.height,le=V.itemHeight,Se=V.notFoundContent,pe=V.open,Ge=V.menuItemSelectedIcon,fe=V.virtual,ge=V.onSelect,De=V.onToggleOpen,Ve=V.onActiveValue,Qe=V.onScroll,ke=V.onMouseEnter,Fe="".concat(ye,"-item"),Ne=Object(o.a)(function(){return Ze},[pe,Ze],function(He,Ee){return Ee[0]&&He[1]!==Ee[1]}),Me=M.useRef(null),ne=function(Ee){Ee.preventDefault()},_e=function(Ee){Me.current&&Me.current.scrollTo({index:Ee})},ae=function(Ee){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ne.length,J=0;J<be;J+=1){var oe=(Ee+J*ve+be)%be,Z=Ne[oe],me=Z.group,Xe=Z.data;if(!me&&!Xe.disabled)return oe}return-1},Ie=M.useState(function(){return ae(0)}),Je=Object(_.a)(Ie,2),et=Je[0],Ke=Je[1],it=function(Ee){Ke(Ee);var ve=Ne[Ee];if(!ve){Ve(null,-1);return}Ve(ve.data.value,Ee)};M.useEffect(function(){it(Ae!==!1?ae(0):-1)},[Ne.length,We]),M.useEffect(function(){var He=setTimeout(function(){if(!ze&&pe&&Oe.size===1){var Ee=Array.from(Oe)[0],ve=Ne.findIndex(function(be){var J=be.data;return J.value===Ee});it(ve),_e(ve)}});return function(){return clearTimeout(He)}},[pe]);var he=function(Ee){Ee!==void 0&&ge(Ee,{selected:!Oe.has(Ee)}),ze||De(!1)};if(M.useImperativeHandle(ce,function(){return{onKeyDown:function(Ee){var ve=Ee.which;switch(ve){case p.a.UP:case p.a.DOWN:{var be=0;if(ve===p.a.UP?be=-1:ve===p.a.DOWN&&(be=1),be!==0){var J=ae(et+be,be);_e(J),it(J)}break}case p.a.ENTER:{var oe=Ne[et];oe&&!oe.data.disabled?he(oe.data.value):he(void 0),pe&&Ee.preventDefault();break}case p.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(Ee){_e(Ee)}}}),Ne.length===0)return M.createElement("div",{role:"listbox",id:"".concat(Le,"_list"),className:"".concat(Fe,"-empty"),onMouseDown:ne},Se);function Re(He){var Ee=Ne[He];if(!Ee)return null;var ve=Ee.data||{},be=ve.value,J=ve.label,oe=ve.children,Z=Object(c.a)(ve,!0),me=Ye?oe:J;return Ee?M.createElement("div",Object.assign({"aria-label":typeof me=="string"?me:null},Z,{key:He,role:"option",id:"".concat(Le,"_list_").concat(He),"aria-selected":Oe.has(be)}),be):null}return M.createElement(M.Fragment,null,M.createElement("div",{role:"listbox",id:"".concat(Le,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re(et-1),Re(et),Re(et+1)),M.createElement(l.a,{itemKey:"key",ref:Me,data:Ne,height:xe,itemHeight:le,fullHeight:!1,onMouseDown:ne,onScroll:Qe,virtual:fe,onMouseEnter:ke},function(He,Ee){var ve,be=He.group,J=He.groupOption,oe=He.data,Z=oe.label,me=oe.key;if(be)return M.createElement("div",{className:s()(Fe,"".concat(Fe,"-group"))},Z!==void 0?Z:me);var Xe=oe.disabled,j=oe.value,we=oe.title,Be=oe.children,de=oe.style,Ce=oe.className,je=Object(S.a)(oe,["disabled","value","title","children","style","className"]),ut=Oe.has(j),tt="".concat(Fe,"-option"),st=s()(Fe,tt,Ce,(ve={},Object(f.a)(ve,"".concat(tt,"-grouped"),J),Object(f.a)(ve,"".concat(tt,"-active"),et===Ee&&!Xe),Object(f.a)(ve,"".concat(tt,"-disabled"),Xe),Object(f.a)(ve,"".concat(tt,"-selected"),ut),ve)),gt=Ye?Be:Z,At=!Ge||typeof Ge=="function"||ut;return M.createElement("div",Object.assign({},je,{"aria-selected":ut,className:st,title:we,onMouseMove:function(){if(et===Ee||Xe)return;it(Ee)},onClick:function(){Xe||he(j)},style:de}),M.createElement("div",{className:"".concat(tt,"-content")},gt||j),M.isValidElement(Ge)||ut,At&&M.createElement(t.a,{className:"".concat(Fe,"-option-state"),customizeIcon:Ge,customizeIconProps:{isSelected:ut}},ut?"\u2713":null))}))},i=M.forwardRef(a);i.displayName="OptionList";var r=i,h=function(){return null};h.isSelectOption=!0;var d=h,y=function(){return null};y.isSelectOptGroup=!0;var m=y,C=ee("VTBJ"),T=ee("Zm9Q");function x(H){var V=H.key,ce=H.props,ye=ce.children,Le=ce.value,Ze=Object(S.a)(ce,["children","value"]);return Object(C.a)({key:V,value:Le!==void 0?Le:V,children:ye},Ze)}function E(H){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(T.a)(H).map(function(ce,ye){if(!M.isValidElement(ce)||!ce.type)return null;var Le=ce.type.isSelectOptGroup,Ze=ce.key,Ye=ce.props,Oe=Ye.children,We=Object(S.a)(Ye,["children"]);return V||!Le?x(ce):Object(C.a)(Object(C.a)({key:"__RC_SELECT_GRP__".concat(Ze===null?ye:Ze,"__"),label:Ze},We),{},{options:E(Oe)})}).filter(function(ce){return ce})}var w=ee("2Qr1"),A=ee("qNPg"),g=ee("U8pU"),P=ee("Kwbf"),O=ee("WKfj");function F(H){var V=H.mode,ce=H.options,ye=H.children,Le=H.backfill,Ze=H.allowClear,Ye=H.placeholder,Oe=H.getInputElement,We=H.showSearch,ze=H.onSearch,Ae=H.defaultOpen,xe=H.autoFocus,le=H.labelInValue,Se=H.value,pe=H.inputValue,Ge=H.optionLabelProp,fe=V==="multiple"||V==="tags",ge=We!==void 0?We:fe||V==="combobox",De=ce||E(ye);if(Object(P.a)(V!=="tags"||De.every(function(Fe){return!Fe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),V==="tags"||V==="combobox"){var Ve=De.some(function(Fe){return Fe.options?Fe.options.some(function(Ne){return typeof("value"in Ne?Ne.value:Ne.key)=="number"}):typeof("value"in Fe?Fe.value:Fe.key)=="number"});Object(P.a)(!Ve,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(P.a)(V!=="combobox"||!Ge,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(P.a)(V==="combobox"||!Le,"`backfill` only works with `combobox` mode."),Object(P.a)(V==="combobox"||!Oe,"`getInputElement` only work with `combobox` mode."),Object(P.b)(V!=="combobox"||!Oe||!Ze||!Ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ze&&!ge&&V!=="combobox"&&V!=="tags"&&Object(P.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(P.b)(!Ae||xe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Se!=null){var Qe=Object(O.d)(Se);Object(P.a)(!le||Qe.every(function(Fe){return Object(g.a)(Fe)==="object"&&("key"in Fe||"value"in Fe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(P.a)(!fe||Array.isArray(Se),"`value` should be array when `mode` is `multiple` or `tags`")}if(ye){var ke=null;Object(T.a)(ye).some(function(Fe){if(!M.isValidElement(Fe)||!Fe.type)return!1;var Ne=Fe.type;if(Ne.isSelectOption)return!1;if(Ne.isSelectOptGroup){var Me=Object(T.a)(Fe.props.children).every(function(ne){return!M.isValidElement(ne)||!Fe.type||ne.type.isSelectOption?!0:(ke=ne.type,!1)});return!Me}return ke=Ne,!0}),ke&&Object(P.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(P.a)(pe===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var X=F,W=Object(A.a)({prefixCls:"rc-select",components:{optionList:r},convertChildrenToData:E,flattenOptions:w.d,getLabeledValue:w.e,filterOptions:w.b,isValueDisabled:w.g,findValueOption:w.c,warningProps:X,fillOptionsWithMissingValue:w.a}),N=function(H){Object(D.a)(ce,H);var V=Object(k.a)(ce);function ce(){var ye;return Object(z.a)(this,ce),ye=V.apply(this,arguments),ye.selectRef=M.createRef(),ye.focus=function(){ye.selectRef.current.focus()},ye.blur=function(){ye.selectRef.current.blur()},ye}return Object(L.a)(ce,[{key:"render",value:function(){return M.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ce}(M.Component);N.Option=d,N.OptGroup=m;var G=N,U=se.c=G},Lmeb:function(ot,se,ee){},Lo0S:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.initLogging=f,se.getLogging=S,se.Error=se.Warn=se.Info=se.Debug=void 0;var z="warn",L=function(){};se.Debug=L;var D=function(){};se.Info=D;var k=function(){};se.Warn=k;var M=function(){};se.Error=M;function f(_){if(typeof _=="undefined"?_=z:z=_,se.Debug=L=se.Info=D=se.Warn=k=se.Error=M=function(){},typeof window.console!="undefined")switch(_){case"debug":se.Debug=L=console.debug.bind(window.console);case"info":se.Info=D=console.info.bind(window.console);case"warn":se.Warn=k=console.warn.bind(window.console);case"error":se.Error=M=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+_+"'")}}function S(){return z}f()},M8RZ:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return p});var z=ee("fWQN"),L=ee("mtLc"),D=ee("yKVA"),k=ee("879j"),M=ee("q1tI"),f=ee.n(M),S=ee("i8i4"),_=ee.n(S),p=function(c){Object(D.a)(u,c);var o=Object(k.a)(u);function u(s){var l;Object(z.a)(this,u),l=o.call(this,s);var t=window.document;return l.node=t.createElement("div"),t.body.appendChild(l.node),l}return Object(L.a)(u,[{key:"render",value:function(){var l=this.props.children;return Object(S.createPortal)(l,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),u}(f.a.Component)},MI8n:function(ot,se,ee){"use strict";ee.d(se,"b",function(){return f}),ee.d(se,"a",function(){return p}),ee.d(se,"e",function(){return c}),ee.d(se,"d",function(){return o}),ee.d(se,"c",function(){return u}),ee.d(se,"f",function(){return s});var z=ee("/cxE"),L=ee("C/vA"),D=ee("pmY6"),k=ee("24hK"),M=function(){var l=function(t,a){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var h in r)r.hasOwnProperty(h)&&(i[h]=r[h])},l(t,a)};return function(t,a){l(t,a);function i(){this.constructor=t}t.prototype=a===null?Object.create(a):(i.prototype=a.prototype,new i)}}(),f;(function(l){l.None=function(){return D.a.None};function t(X){return function(W,N,G){N===void 0&&(N=null);var U=!1,H;return H=X(function(V){return U?void 0:(H?H.dispose():U=!0,W.call(N,V))},null,G),U&&H.dispose(),H}}l.once=t;function a(X,W){return m(function(N,G,U){return G===void 0&&(G=null),X(function(H){return N.call(G,W(H))},null,U)})}l.map=a;function i(X,W){return m(function(N,G,U){return G===void 0&&(G=null),X(function(H){W(H),N.call(G,H)},null,U)})}l.forEach=i;function r(X,W){return m(function(N,G,U){return G===void 0&&(G=null),X(function(H){return W(H)&&N.call(G,H)},null,U)})}l.filter=r;function h(X){return X}l.signal=h;function d(){for(var X=[],W=0;W<arguments.length;W++)X[W]=arguments[W];return function(N,G,U){return G===void 0&&(G=null),D.e.apply(void 0,X.map(function(H){return H(function(V){return N.call(G,V)},null,U)}))}}l.any=d;function y(X,W,N){var G=N;return a(X,function(U){return G=W(G,U),G})}l.reduce=y;function m(X){var W,N=new p({onFirstListenerAdd:function(){W=X(N.fire,N)},onLastListenerRemove:function(){W.dispose()}});return N.event}l.snapshot=m;function C(X,W,N,G,U){N===void 0&&(N=100),G===void 0&&(G=!1);var H,V=void 0,ce=void 0,ye=0,Le=new p({leakWarningThreshold:U,onFirstListenerAdd:function(){H=X(function(Ze){ye++,V=W(V,Ze),G&&!ce&&(Le.fire(V),V=void 0),clearTimeout(ce),ce=setTimeout(function(){var Ye=V;V=void 0,ce=void 0,(!G||ye>1)&&Le.fire(Ye),ye=0},N)})},onLastListenerRemove:function(){H.dispose()}});return Le.event}l.debounce=C;function T(X){var W=new Date().getTime();return a(t(X),function(N){return new Date().getTime()-W})}l.stopwatch=T;function x(X){var W=!0,N;return r(X,function(G){var U=W||G!==N;return W=!1,N=G,U})}l.latch=x;function E(X,W,N){W===void 0&&(W=!1),N===void 0&&(N=[]);var G=N.slice(),U=X(function(ce){G?G.push(ce):V.fire(ce)}),H=function(){G&&G.forEach(function(ce){return V.fire(ce)}),G=null},V=new p({onFirstListenerAdd:function(){U||(U=X(function(ce){return V.fire(ce)}))},onFirstListenerDidAdd:function(){G&&(W?setTimeout(H):H())},onLastListenerRemove:function(){U&&U.dispose(),U=null}});return V.event}l.buffer=E;var w=function(){function X(W){this.event=W}return X.prototype.map=function(W){return new X(a(this.event,W))},X.prototype.forEach=function(W){return new X(i(this.event,W))},X.prototype.filter=function(W){return new X(r(this.event,W))},X.prototype.reduce=function(W,N){return new X(y(this.event,W,N))},X.prototype.latch=function(){return new X(x(this.event))},X.prototype.debounce=function(W,N,G,U){return N===void 0&&(N=100),G===void 0&&(G=!1),new X(C(this.event,W,N,G,U))},X.prototype.on=function(W,N,G){return this.event(W,N,G)},X.prototype.once=function(W,N,G){return t(this.event)(W,N,G)},X}();function A(X){return new w(X)}l.chain=A;function g(X,W,N){N===void 0&&(N=function(ce){return ce});var G=function(){for(var ce=[],ye=0;ye<arguments.length;ye++)ce[ye]=arguments[ye];return V.fire(N.apply(void 0,ce))},U=function(){return X.on(W,G)},H=function(){return X.removeListener(W,G)},V=new p({onFirstListenerAdd:U,onLastListenerRemove:H});return V.event}l.fromNodeEventEmitter=g;function P(X,W,N){N===void 0&&(N=function(ce){return ce});var G=function(){for(var ce=[],ye=0;ye<arguments.length;ye++)ce[ye]=arguments[ye];return V.fire(N.apply(void 0,ce))},U=function(){return X.addEventListener(W,G)},H=function(){return X.removeEventListener(W,G)},V=new p({onFirstListenerAdd:U,onLastListenerRemove:H});return V.event}l.fromDOMEventEmitter=P;function O(X){var W=new p,N=!1;return X.then(void 0,function(){return null}).then(function(){N?W.fire(void 0):setTimeout(function(){return W.fire(void 0)},0)}),N=!0,W.event}l.fromPromise=O;function F(X){return new Promise(function(W){return t(X)(W)})}l.toPromise=F})(f||(f={}));var S=-1,_=function(){function l(t,a){a===void 0&&(a=Math.random().toString(18).slice(2,5)),this.customThreshold=t,this.name=a,this._warnCountdown=0}return l.prototype.dispose=function(){this._stacks&&this._stacks.clear()},l.prototype.check=function(t){var a=this,i=S;if(typeof this.customThreshold=="number"&&(i=this.customThreshold),i<=0||t<i)return;this._stacks||(this._stacks=new Map);var r=new Error().stack.split(`
`).slice(3).join(`
`),h=this._stacks.get(r)||0;if(this._stacks.set(r,h+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;var d,y=0;this._stacks.forEach(function(m,C){(!d||y<m)&&(d=C,y=m)}),console.warn("["+this.name+"] potential listener LEAK detected, having "+t+" listeners already. MOST frequent listener ("+y+"):"),console.warn(d)}return function(){var m=a._stacks.get(r)||0;a._stacks.set(r,m-1)}},l}(),p=function(){function l(t){this._disposed=!1,this._options=t,this._leakageMon=S>0?new _(this._options&&this._options.leakWarningThreshold):void 0}return Object.defineProperty(l.prototype,"event",{get:function(){var t=this;return this._event||(this._event=function(a,i,r){t._listeners||(t._listeners=new k.a);var h=t._listeners.isEmpty();h&&t._options&&t._options.onFirstListenerAdd&&t._options.onFirstListenerAdd(t);var d=t._listeners.push(i?[a,i]:a);h&&t._options&&t._options.onFirstListenerDidAdd&&t._options.onFirstListenerDidAdd(t),t._options&&t._options.onListenerDidAdd&&t._options.onListenerDidAdd(t,a,i);var y;t._leakageMon&&(y=t._leakageMon.check(t._listeners.size));var m;return m={dispose:function(){if(y&&y(),m.dispose=l._noop,!t._disposed&&(d(),t._options&&t._options.onLastListenerRemove)){var C=t._listeners&&!t._listeners.isEmpty();C||t._options.onLastListenerRemove(t)}}},r instanceof D.b?r.add(m):Array.isArray(r)&&r.push(m),m}),this._event},enumerable:!0,configurable:!0}),l.prototype.fire=function(t){if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new k.a);for(var a=this._listeners.iterator(),i=a.next();!i.done;i=a.next())this._deliveryQueue.push([i.value,t]);for(;this._deliveryQueue.size>0;){var r=this._deliveryQueue.shift(),h=r[0],d=r[1];try{typeof h=="function"?h.call(void 0,d):h[0].call(h[1],d)}catch(y){Object(z.e)(y)}}}},l.prototype.dispose=function(){this._listeners&&this._listeners.clear(),this._deliveryQueue&&this._deliveryQueue.clear(),this._leakageMon&&this._leakageMon.dispose(),this._disposed=!0},l._noop=function(){},l}(),c=function(l){M(t,l);function t(a){var i=l.call(this,a)||this;return i._isPaused=0,i._eventQueue=new k.a,i._mergeFn=a&&a.merge,i}return t.prototype.pause=function(){this._isPaused++},t.prototype.resume=function(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){var a=this._eventQueue.toArray();this._eventQueue.clear(),l.prototype.fire.call(this,this._mergeFn(a))}else for(;!this._isPaused&&this._eventQueue.size!==0;)l.prototype.fire.call(this,this._eventQueue.shift())},t.prototype.fire=function(a){this._listeners&&(this._isPaused!==0?this._eventQueue.push(a):l.prototype.fire.call(this,a))},t}(p),o=function(){function l(){var t=this;this.hasListeners=!1,this.events=[],this.emitter=new p({onFirstListenerAdd:function(){return t.onFirstListenerAdd()},onLastListenerRemove:function(){return t.onLastListenerRemove()}})}return Object.defineProperty(l.prototype,"event",{get:function(){return this.emitter.event},enumerable:!0,configurable:!0}),l.prototype.add=function(t){var a=this,i={event:t,listener:null};this.events.push(i),this.hasListeners&&this.hook(i);var r=function(){a.hasListeners&&a.unhook(i);var h=a.events.indexOf(i);a.events.splice(h,1)};return Object(D.h)(Object(L.a)(r))},l.prototype.onFirstListenerAdd=function(){var t=this;this.hasListeners=!0,this.events.forEach(function(a){return t.hook(a)})},l.prototype.onLastListenerRemove=function(){var t=this;this.hasListeners=!1,this.events.forEach(function(a){return t.unhook(a)})},l.prototype.hook=function(t){var a=this;t.listener=t.event(function(i){return a.emitter.fire(i)})},l.prototype.unhook=function(t){t.listener&&t.listener.dispose(),t.listener=null},l.prototype.dispose=function(){this.emitter.dispose()},l}(),u=function(){function l(){this.buffers=[]}return l.prototype.wrapEvent=function(t){var a=this;return function(i,r,h){return t(function(d){var y=a.buffers[a.buffers.length-1];y?y.push(function(){return i.call(r,d)}):i.call(r,d)},void 0,h)}},l.prototype.bufferEvents=function(t){var a=[];this.buffers.push(a);var i=t();return this.buffers.pop(),a.forEach(function(r){return r()}),i},l}(),s=function(){function l(){var t=this;this.listening=!1,this.inputEvent=f.None,this.inputEventListener=D.a.None,this.emitter=new p({onFirstListenerDidAdd:function(){t.listening=!0,t.inputEventListener=t.inputEvent(t.emitter.fire,t.emitter)},onLastListenerRemove:function(){t.listening=!1,t.inputEventListener.dispose()}}),this.event=this.emitter.event}return Object.defineProperty(l.prototype,"input",{set:function(t){this.inputEvent=t,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=t(this.emitter.fire,this.emitter))},enumerable:!0,configurable:!0}),l.prototype.dispose=function(){this.inputEventListener.dispose(),this.emitter.dispose()},l}()},MZdM:function(ot,se,ee){"use strict";function z(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(t){return typeof t}:z=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(s)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=_(ee("Lo0S")),D=f(ee("N/zr")),k=ee("GdRQ"),M=ee("GQ8N");function f(s){return s&&s.__esModule?s:{default:s}}function S(){if(typeof WeakMap!="function")return null;var s=new WeakMap;return S=function(){return s},s}function _(s){if(s&&s.__esModule)return s;if(s===null||z(s)!=="object"&&typeof s!="function")return{default:s};var l=S();if(l&&l.has(s))return l.get(s);var t={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in s)if(Object.prototype.hasOwnProperty.call(s,i)){var r=a?Object.getOwnPropertyDescriptor(s,i):null;r&&(r.get||r.set)?Object.defineProperty(t,i,r):t[i]=s[i]}return t.default=s,l&&l.set(s,t),t}function p(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}function c(s,l){for(var t=0;t<l.length;t++){var a=l[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function o(s,l,t){return l&&c(s.prototype,l),t&&c(s,t),s}var u=function(){function s(l){if(p(this,s),this._drawCtx=null,this._renderQ=[],this._flushing=!1,this._fbWidth=0,this._fbHeight=0,this._prevDrawStyle="",this._tile=null,this._tile16x16=null,this._tileX=0,this._tileY=0,L.Debug(">> Display.constructor"),this._target=l,!this._target)throw new Error("Target must be set");if(typeof this._target=="string")throw new Error("target must be a DOM element");if(!this._target.getContext)throw new Error("no getContext method");if(this._targetCtx=this._target.getContext("2d"),this._viewportLoc={x:0,y:0,w:this._target.width,h:this._target.height},this._backbuffer=document.createElement("canvas"),this._drawCtx=this._backbuffer.getContext("2d"),this._damageBounds={left:0,top:0,right:this._backbuffer.width,bottom:this._backbuffer.height},L.Debug("User Agent: "+navigator.userAgent),!("createImageData"in this._drawCtx))throw new Error("Canvas does not support createImageData");this._tile16x16=this._drawCtx.createImageData(16,16),L.Debug("<< Display.constructor"),this._scale=1,this._clipViewport=!1,this.onflush=function(){}}return o(s,[{key:"viewportChangePos",value:function(t,a){var i=this._viewportLoc;t=Math.floor(t),a=Math.floor(a),this._clipViewport||(t=-i.w,a=-i.h);var r=i.x+i.w-1,h=i.y+i.h-1;if(t<0&&i.x+t<0&&(t=-i.x),r+t>=this._fbWidth&&(t-=r+t-this._fbWidth+1),i.y+a<0&&(a=-i.y),h+a>=this._fbHeight&&(a-=h+a-this._fbHeight+1),t===0&&a===0)return;L.Debug("viewportChange deltaX: "+t+", deltaY: "+a),i.x+=t,i.y+=a,this._damage(i.x,i.y,i.w,i.h),this.flip()}},{key:"viewportChangeSize",value:function(t,a){(!this._clipViewport||typeof t=="undefined"||typeof a=="undefined")&&(L.Debug("Setting viewport to full display region"),t=this._fbWidth,a=this._fbHeight),t=Math.floor(t),a=Math.floor(a),t>this._fbWidth&&(t=this._fbWidth),a>this._fbHeight&&(a=this._fbHeight);var i=this._viewportLoc;if(i.w!==t||i.h!==a){i.w=t,i.h=a;var r=this._target;r.width=t,r.height=a,this.viewportChangePos(0,0),this._damage(i.x,i.y,i.w,i.h),this.flip(),this._rescale(this._scale)}}},{key:"absX",value:function(t){return this._scale===0?0:(0,M.toSigned32bit)(t/this._scale+this._viewportLoc.x)}},{key:"absY",value:function(t){return this._scale===0?0:(0,M.toSigned32bit)(t/this._scale+this._viewportLoc.y)}},{key:"resize",value:function(t,a){this._prevDrawStyle="",this._fbWidth=t,this._fbHeight=a;var i=this._backbuffer;if(i.width!==t||i.height!==a){var r=null;i.width>0&&i.height>0&&(r=this._drawCtx.getImageData(0,0,i.width,i.height)),i.width!==t&&(i.width=t),i.height!==a&&(i.height=a),r&&this._drawCtx.putImageData(r,0,0)}var h=this._viewportLoc;this.viewportChangeSize(h.w,h.h),this.viewportChangePos(0,0)}},{key:"_damage",value:function(t,a,i,r){t<this._damageBounds.left&&(this._damageBounds.left=t),a<this._damageBounds.top&&(this._damageBounds.top=a),t+i>this._damageBounds.right&&(this._damageBounds.right=t+i),a+r>this._damageBounds.bottom&&(this._damageBounds.bottom=a+r)}},{key:"flip",value:function(t){if(this._renderQ.length!==0&&!t)this._renderQPush({type:"flip"});else{var a=this._damageBounds.left,i=this._damageBounds.top,r=this._damageBounds.right-a,h=this._damageBounds.bottom-i,d=a-this._viewportLoc.x,y=i-this._viewportLoc.y;d<0&&(r+=d,a-=d,d=0),y<0&&(h+=y,i-=y,y=0),d+r>this._viewportLoc.w&&(r=this._viewportLoc.w-d),y+h>this._viewportLoc.h&&(h=this._viewportLoc.h-y),r>0&&h>0&&this._targetCtx.drawImage(this._backbuffer,a,i,r,h,d,y,r,h),this._damageBounds.left=this._damageBounds.top=65535,this._damageBounds.right=this._damageBounds.bottom=0}}},{key:"pending",value:function(){return this._renderQ.length>0}},{key:"flush",value:function(){this._renderQ.length===0?this.onflush():this._flushing=!0}},{key:"fillRect",value:function(t,a,i,r,h,d){this._renderQ.length!==0&&!d?this._renderQPush({type:"fill",x:t,y:a,width:i,height:r,color:h}):(this._setFillColor(h),this._drawCtx.fillRect(t,a,i,r),this._damage(t,a,i,r))}},{key:"copyImage",value:function(t,a,i,r,h,d,y){this._renderQ.length!==0&&!y?this._renderQPush({type:"copy",oldX:t,oldY:a,x:i,y:r,width:h,height:d}):(this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,t,a,h,d,i,r,h,d),this._damage(i,r,h,d))}},{key:"imageRect",value:function(t,a,i,r,h,d){if(i===0||r===0)return;var y=new Image;y.src="data: "+h+";base64,"+D.default.encode(d),this._renderQPush({type:"img",img:y,x:t,y:a,width:i,height:r})}},{key:"startTile",value:function(t,a,i,r,h){this._tileX=t,this._tileY=a,i===16&&r===16?this._tile=this._tile16x16:this._tile=this._drawCtx.createImageData(i,r);for(var d=h[2],y=h[1],m=h[0],C=this._tile.data,T=0;T<i*r*4;T+=4)C[T]=d,C[T+1]=y,C[T+2]=m,C[T+3]=255}},{key:"subTile",value:function(t,a,i,r,h){for(var d=h[2],y=h[1],m=h[0],C=t+i,T=a+r,x=this._tile.data,E=this._tile.width,w=a;w<T;w++)for(var A=t;A<C;A++){var g=(A+w*E)*4;x[g]=d,x[g+1]=y,x[g+2]=m,x[g+3]=255}}},{key:"finishTile",value:function(){this._drawCtx.putImageData(this._tile,this._tileX,this._tileY),this._damage(this._tileX,this._tileY,this._tile.width,this._tile.height)}},{key:"blitImage",value:function(t,a,i,r,h,d,y){if(this._renderQ.length!==0&&!y){var m=new Uint8Array(i*r*4);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blit",data:m,x:t,y:a,width:i,height:r})}else this._bgrxImageData(t,a,i,r,h,d)}},{key:"blitRgbImage",value:function(t,a,i,r,h,d,y){if(this._renderQ.length!==0&&!y){var m=new Uint8Array(i*r*3);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blitRgb",data:m,x:t,y:a,width:i,height:r})}else this._rgbImageData(t,a,i,r,h,d)}},{key:"blitRgbxImage",value:function(t,a,i,r,h,d,y){if(this._renderQ.length!==0&&!y){var m=new Uint8Array(i*r*4);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blitRgbx",data:m,x:t,y:a,width:i,height:r})}else this._rgbxImageData(t,a,i,r,h,d)}},{key:"drawImage",value:function(t,a,i){this._drawCtx.drawImage(t,a,i),this._damage(a,i,t.width,t.height)}},{key:"autoscale",value:function(t,a){var i;if(t===0||a===0)i=0;else{var r=this._viewportLoc,h=t/a,d=r.w/r.h;d>=h?i=t/r.w:i=a/r.h}this._rescale(i)}},{key:"_rescale",value:function(t){this._scale=t;var a=this._viewportLoc,i=t*a.w+"px",r=t*a.h+"px";(this._target.style.width!==i||this._target.style.height!==r)&&(this._target.style.width=i,this._target.style.height=r)}},{key:"_setFillColor",value:function(t){var a="rgb("+t[2]+","+t[1]+","+t[0]+")";a!==this._prevDrawStyle&&(this._drawCtx.fillStyle=a,this._prevDrawStyle=a)}},{key:"_rgbImageData",value:function(t,a,i,r,h,d){for(var y=this._drawCtx.createImageData(i,r),m=y.data,C=0,T=d;C<i*r*4;C+=4,T+=3)m[C]=h[T],m[C+1]=h[T+1],m[C+2]=h[T+2],m[C+3]=255;this._drawCtx.putImageData(y,t,a),this._damage(t,a,y.width,y.height)}},{key:"_bgrxImageData",value:function(t,a,i,r,h,d){for(var y=this._drawCtx.createImageData(i,r),m=y.data,C=0,T=d;C<i*r*4;C+=4,T+=4)m[C]=h[T+2],m[C+1]=h[T+1],m[C+2]=h[T],m[C+3]=255;this._drawCtx.putImageData(y,t,a),this._damage(t,a,y.width,y.height)}},{key:"_rgbxImageData",value:function(t,a,i,r,h,d){var y;k.supportsImageMetadata?y=new ImageData(new Uint8ClampedArray(h.buffer,h.byteOffset,i*r*4),i,r):(y=this._drawCtx.createImageData(i,r),y.data.set(new Uint8ClampedArray(h.buffer,h.byteOffset,i*r*4))),this._drawCtx.putImageData(y,t,a),this._damage(t,a,y.width,y.height)}},{key:"_renderQPush",value:function(t){this._renderQ.push(t),this._renderQ.length===1&&this._scanRenderQ()}},{key:"_resumeRenderQ",value:function(){this.removeEventListener("load",this._noVNCDisplay._resumeRenderQ),this._noVNCDisplay._scanRenderQ()}},{key:"_scanRenderQ",value:function(){for(var t=!0;t&&this._renderQ.length>0;){var a=this._renderQ[0];switch(a.type){case"flip":this.flip(!0);break;case"copy":this.copyImage(a.oldX,a.oldY,a.x,a.y,a.width,a.height,!0);break;case"fill":this.fillRect(a.x,a.y,a.width,a.height,a.color,!0);break;case"blit":this.blitImage(a.x,a.y,a.width,a.height,a.data,0,!0);break;case"blitRgb":this.blitRgbImage(a.x,a.y,a.width,a.height,a.data,0,!0);break;case"blitRgbx":this.blitRgbxImage(a.x,a.y,a.width,a.height,a.data,0,!0);break;case"img":if(a.img.complete&&a.img.width!==0&&a.img.height!==0){if(a.img.width!==a.width||a.img.height!==a.height){L.Error("Decoded image has incorrect dimensions. Got "+a.img.width+"x"+a.img.height+". Expected "+a.width+"x"+a.height+".");return}this.drawImage(a.img,a.x,a.y)}else a.img._noVNCDisplay=this,a.img.addEventListener("load",this._resumeRenderQ),t=!1;break}t&&this._renderQ.shift()}this._renderQ.length===0&&this._flushing&&(this._flushing=!1,this.onflush())}},{key:"scale",get:function(){return this._scale},set:function(t){this._rescale(t)}},{key:"clipViewport",get:function(){return this._clipViewport},set:function(t){this._clipViewport=t;var a=this._viewportLoc;this.viewportChangeSize(a.w,a.h),this.viewportChangePos(0,0)}},{key:"width",get:function(){return this._fbWidth}},{key:"height",get:function(){return this._fbHeight}}]),s}();se.default=u},Mmt2:function(ot,se,ee){"use strict";function z(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(s){return typeof s}:z=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},z(o)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=k(ee("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var o=new WeakMap;return D=function(){return o},o}function k(o){if(o&&o.__esModule)return o;if(o===null||z(o)!=="object"&&typeof o!="function")return{default:o};var u=D();if(u&&u.has(o))return u.get(o);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in o)if(Object.prototype.hasOwnProperty.call(o,t)){var a=l?Object.getOwnPropertyDescriptor(o,t):null;a&&(a.get||a.set)?Object.defineProperty(s,t,a):s[t]=o[t]}return s.default=o,u&&u.set(o,s),s}function M(o,u){if(!(o instanceof u))throw new TypeError("Cannot call a class as a function")}function f(o,u){for(var s=0;s<u.length;s++){var l=u[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function S(o,u,s){return u&&f(o.prototype,u),s&&f(o,s),o}var _=!1,p=40*1024*1024,c=function(){function o(){M(this,o),this._websocket=null,this._rQi=0,this._rQlen=0,this._rQbufferSize=1024*1024*4,this._rQ=null,this._sQbufferSize=1024*10,this._sQlen=0,this._sQ=null,this._eventHandlers={message:function(){},open:function(){},close:function(){},error:function(){}}}return S(o,[{key:"rQpeek8",value:function(){return this._rQ[this._rQi]}},{key:"rQskipBytes",value:function(s){this._rQi+=s}},{key:"rQshift8",value:function(){return this._rQshift(1)}},{key:"rQshift16",value:function(){return this._rQshift(2)}},{key:"rQshift32",value:function(){return this._rQshift(4)}},{key:"_rQshift",value:function(s){for(var l=0,t=s-1;t>=0;t--)l+=this._rQ[this._rQi++]<<t*8;return l}},{key:"rQshiftStr",value:function(s){typeof s=="undefined"&&(s=this.rQlen);for(var l="",t=0;t<s;t+=4096){var a=this.rQshiftBytes(Math.min(4096,s-t));l+=String.fromCharCode.apply(null,a)}return l}},{key:"rQshiftBytes",value:function(s){return typeof s=="undefined"&&(s=this.rQlen),this._rQi+=s,new Uint8Array(this._rQ.buffer,this._rQi-s,s)}},{key:"rQshiftTo",value:function(s,l){l===void 0&&(l=this.rQlen),s.set(new Uint8Array(this._rQ.buffer,this._rQi,l)),this._rQi+=l}},{key:"rQslice",value:function(s){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.rQlen;return new Uint8Array(this._rQ.buffer,this._rQi+s,l-s)}},{key:"rQwait",value:function(s,l,t){if(this.rQlen<l){if(t){if(this._rQi<t)throw new Error("rQwait cannot backup "+t+" bytes");this._rQi-=t}return!0}return!1}},{key:"flush",value:function(){this._sQlen>0&&this._websocket.readyState===WebSocket.OPEN&&(this._websocket.send(this._encodeMessage()),this._sQlen=0)}},{key:"send",value:function(s){this._sQ.set(s,this._sQlen),this._sQlen+=s.length,this.flush()}},{key:"sendString",value:function(s){this.send(s.split("").map(function(l){return l.charCodeAt(0)}))}},{key:"off",value:function(s){this._eventHandlers[s]=function(){}}},{key:"on",value:function(s,l){this._eventHandlers[s]=l}},{key:"_allocateBuffers",value:function(){this._rQ=new Uint8Array(this._rQbufferSize),this._sQ=new Uint8Array(this._sQbufferSize)}},{key:"init",value:function(){this._allocateBuffers(),this._rQi=0,this._websocket=null}},{key:"open",value:function(s,l){var t=this;this.init(),this._websocket=new WebSocket(s,l),this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=function(){L.Debug(">> WebSock.onopen"),t._websocket.protocol&&L.Info("Server choose sub-protocol: "+t._websocket.protocol),t._eventHandlers.open(),L.Debug("<< WebSock.onopen")},this._websocket.onclose=function(a){L.Debug(">> WebSock.onclose"),t._eventHandlers.close(a),L.Debug("<< WebSock.onclose")},this._websocket.onerror=function(a){L.Debug(">> WebSock.onerror: "+a),t._eventHandlers.error(a),L.Debug("<< WebSock.onerror: "+a)}}},{key:"close",value:function(){this._websocket&&((this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(L.Info("Closing WebSocket connection"),this._websocket.close()),this._websocket.onmessage=function(){})}},{key:"_encodeMessage",value:function(){return new Uint8Array(this._sQ.buffer,0,this._sQlen)}},{key:"_expandCompactRQ",value:function(s){var l=(this._rQlen-this._rQi+s)*8,t=this._rQbufferSize<l;if(t&&(this._rQbufferSize=Math.max(this._rQbufferSize*2,l)),this._rQbufferSize>p&&(this._rQbufferSize=p,this._rQbufferSize-this.rQlen<s))throw new Error("Receive Queue buffer exceeded "+p+" bytes, and the new message could not fit");if(t){var a=this._rQ.buffer;this._rQ=new Uint8Array(this._rQbufferSize),this._rQ.set(new Uint8Array(a,this._rQi,this._rQlen-this._rQi))}else _?this._rQ.copyWithin(0,this._rQi,this._rQlen):this._rQ.set(new Uint8Array(this._rQ.buffer,this._rQi,this._rQlen-this._rQi));this._rQlen=this._rQlen-this._rQi,this._rQi=0}},{key:"_DecodeMessage",value:function(s){var l=new Uint8Array(s);l.length>this._rQbufferSize-this._rQlen&&this._expandCompactRQ(l.length),this._rQ.set(l,this._rQlen),this._rQlen+=l.length}},{key:"_recvMessage",value:function(s){this._DecodeMessage(s.data),this.rQlen>0?(this._eventHandlers.message(),this._rQlen==this._rQi&&(this._rQlen=0,this._rQi=0)):L.Debug("Ignoring empty message")}},{key:"sQ",get:function(){return this._sQ}},{key:"rQ",get:function(){return this._rQ}},{key:"rQi",get:function(){return this._rQi},set:function(s){this._rQi=s}},{key:"rQlen",get:function(){return this._rQlen-this._rQi}}]),o}();se.default=c},"N/zr":function(ot,se,ee){"use strict";function z(f){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(_){return typeof _}:z=function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},z(f)}Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var L=k(ee("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var f=new WeakMap;return D=function(){return f},f}function k(f){if(f&&f.__esModule)return f;if(f===null||z(f)!=="object"&&typeof f!="function")return{default:f};var S=D();if(S&&S.has(f))return S.get(f);var _={},p=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in f)if(Object.prototype.hasOwnProperty.call(f,c)){var o=p?Object.getOwnPropertyDescriptor(f,c):null;o&&(o.get||o.set)?Object.defineProperty(_,c,o):_[c]=f[c]}return _.default=f,S&&S.set(f,_),_}var M={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode:function(S){"use strict";for(var _="",p=S.length,c=p%3,o=0;o<p-2;o+=3)_+=this.toBase64Table[S[o]>>2],_+=this.toBase64Table[((S[o]&3)<<4)+(S[o+1]>>4)],_+=this.toBase64Table[((S[o+1]&15)<<2)+(S[o+2]>>6)],_+=this.toBase64Table[S[o+2]&63];var u=p-c;return c===2?(_+=this.toBase64Table[S[u]>>2],_+=this.toBase64Table[((S[u]&3)<<4)+(S[u+1]>>4)],_+=this.toBase64Table[(S[u+1]&15)<<2],_+=this.toBase64Table[64]):c===1&&(_+=this.toBase64Table[S[u]>>2],_+=this.toBase64Table[(S[u]&3)<<4],_+=this.toBase64Table[64],_+=this.toBase64Table[64]),_},toBinaryTable:[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1],decode:function(S){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=S.indexOf("=")-_;p<0&&(p=S.length-_);for(var c=(p>>2)*3+Math.floor(p%4/1.5),o=new Array(c),u=0,s=0,l=0,t=_;t<S.length;t++){var a=this.toBinaryTable[S.charCodeAt(t)&127],i=S.charAt(t)===this.base64Pad;if(a===-1){L.Error("Illegal character code "+S.charCodeAt(t)+" at position "+t);continue}s=s<<6|a,u+=6,u>=8&&(u-=8,i||(o[l++]=s>>u&255),s&=(1<<u)-1)}if(u){var r=new Error("Corrupted base64 string");throw r.name="Base64-Error",r}return o}};se.default=M},N0LK:function(ot,se,ee){"use strict";ee.d(se,"x",function(){return z}),ee.d(se,"F",function(){return L}),ee.d(se,"r",function(){return k}),ee.d(se,"o",function(){return M}),ee.d(se,"p",function(){return f}),ee.d(se,"Q",function(){return S}),ee.d(se,"K",function(){return p}),ee.d(se,"k",function(){return c}),ee.d(se,"N",function(){return o}),ee.d(se,"m",function(){return u}),ee.d(se,"l",function(){return s}),ee.d(se,"I",function(){return l}),ee.d(se,"H",function(){return t}),ee.d(se,"q",function(){return a}),ee.d(se,"t",function(){return i}),ee.d(se,"D",function(){return r}),ee.d(se,"e",function(){return h}),ee.d(se,"f",function(){return d}),ee.d(se,"B",function(){return y}),ee.d(se,"C",function(){return m}),ee.d(se,"n",function(){return T}),ee.d(se,"O",function(){return E}),ee.d(se,"c",function(){return w}),ee.d(se,"d",function(){return A}),ee.d(se,"z",function(){return g}),ee.d(se,"A",function(){return P}),ee.d(se,"u",function(){return O}),ee.d(se,"E",function(){return X}),ee.d(se,"G",function(){return W}),ee.d(se,"i",function(){return G}),ee.d(se,"g",function(){return H}),ee.d(se,"v",function(){return ce}),ee.d(se,"h",function(){return ye}),ee.d(se,"y",function(){return Le}),ee.d(se,"w",function(){return Ze}),ee.d(se,"a",function(){return Ye}),ee.d(se,"P",function(){return Oe}),ee.d(se,"L",function(){return We}),ee.d(se,"J",function(){return ze}),ee.d(se,"j",function(){return Ae}),ee.d(se,"M",function(){return xe}),ee.d(se,"s",function(){return le}),ee.d(se,"b",function(){return Se});function z(fe){return!fe||typeof fe!="string"?!0:fe.trim().length===0}function L(fe,ge,De){De===void 0&&(De="0");for(var Ve=""+fe,Qe=[Ve],ke=Ve.length;ke<ge;ke++)Qe.push(De);return Qe.reverse().join("")}var D=/{(\d+)}/g;function k(fe){for(var ge=[],De=1;De<arguments.length;De++)ge[De-1]=arguments[De];return ge.length===0?fe:fe.replace(D,function(Ve,Qe){var ke=parseInt(Qe,10);return isNaN(ke)||ke<0||ke>=ge.length?Ve:ge[ke]})}function M(fe){return fe.replace(/[<>&]/g,function(ge){switch(ge){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ge}})}function f(fe){return fe.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function S(fe,ge){ge===void 0&&(ge=" ");var De=_(fe,ge);return p(De,ge)}function _(fe,ge){if(!fe||!ge)return fe;var De=ge.length;if(De===0||fe.length===0)return fe;for(var Ve=0;fe.indexOf(ge,Ve)===Ve;)Ve=Ve+De;return fe.substring(Ve)}function p(fe,ge){if(!fe||!ge)return fe;var De=ge.length,Ve=fe.length;if(De===0||Ve===0)return fe;for(var Qe=Ve,ke=-1;!(ke=fe.lastIndexOf(ge,Qe-1),ke===-1||ke+De!==Qe);){if(ke===0)return"";Qe=ke}return fe.substring(0,Qe)}function c(fe){return fe.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function o(fe,ge){if(fe.length<ge.length)return!1;if(fe===ge)return!0;for(var De=0;De<ge.length;De++)if(fe[De]!==ge[De])return!1;return!0}function u(fe,ge){var De=fe.length-ge.length;return De>0?fe.indexOf(ge,De)===De:De===0?fe===ge:!1}function s(fe,ge,De){if(De===void 0&&(De={}),!fe)throw new Error("Cannot create regex from empty string");ge||(fe=f(fe)),De.wholeWord&&(/\B/.test(fe.charAt(0))||(fe="\\b"+fe),/\B/.test(fe.charAt(fe.length-1))||(fe=fe+"\\b"));var Ve="";return De.global&&(Ve+="g"),De.matchCase||(Ve+="i"),De.multiline&&(Ve+="m"),De.unicode&&(Ve+="u"),new RegExp(fe,Ve)}function l(fe){if(fe.source==="^"||fe.source==="^$"||fe.source==="$"||fe.source==="^\\s*$")return!1;var ge=fe.exec("");return!!(ge&&fe.lastIndex===0)}function t(fe){return(fe.global?"g":"")+(fe.ignoreCase?"i":"")+(fe.multiline?"m":"")+(fe.unicode?"u":"")}function a(fe){for(var ge=0,De=fe.length;ge<De;ge++){var Ve=fe.charCodeAt(ge);if(Ve!==32&&Ve!==9)return ge}return-1}function i(fe,ge,De){ge===void 0&&(ge=0),De===void 0&&(De=fe.length);for(var Ve=ge;Ve<De;Ve++){var Qe=fe.charCodeAt(Ve);if(Qe!==32&&Qe!==9)return fe.substring(ge,Ve)}return fe.substring(ge,De)}function r(fe,ge){ge===void 0&&(ge=fe.length-1);for(var De=ge;De>=0;De--){var Ve=fe.charCodeAt(De);if(Ve!==32&&Ve!==9)return De}return-1}function h(fe,ge){return fe<ge?-1:fe>ge?1:0}function d(fe,ge){for(var De=Math.min(fe.length,ge.length),Ve=0;Ve<De;Ve++){var Qe=fe.charCodeAt(Ve),ke=ge.charCodeAt(Ve);if(Qe===ke)continue;m(Qe)&&(Qe+=32),m(ke)&&(ke+=32);var Fe=Qe-ke;if(Fe===0)continue;return y(Qe)&&y(ke)?Fe:h(fe.toLowerCase(),ge.toLowerCase())}return fe.length<ge.length?-1:fe.length>ge.length?1:0}function y(fe){return fe>=97&&fe<=122}function m(fe){return fe>=65&&fe<=90}function C(fe){return y(fe)||m(fe)}function T(fe,ge){return fe.length===ge.length&&x(fe,ge)}function x(fe,ge,De){De===void 0&&(De=fe.length);for(var Ve=0;Ve<De;Ve++){var Qe=fe.charCodeAt(Ve),ke=ge.charCodeAt(Ve);if(Qe===ke)continue;if(C(Qe)&&C(ke)){var Fe=Math.abs(Qe-ke);if(Fe!==0&&Fe!==32)return!1}else if(String.fromCharCode(Qe).toLowerCase()!==String.fromCharCode(ke).toLowerCase())return!1}return!0}function E(fe,ge){var De=ge.length;return ge.length>fe.length?!1:x(fe,ge,De)}function w(fe,ge){var De,Ve=Math.min(fe.length,ge.length);for(De=0;De<Ve;De++)if(fe.charCodeAt(De)!==ge.charCodeAt(De))return De;return Ve}function A(fe,ge){var De,Ve=Math.min(fe.length,ge.length),Qe=fe.length-1,ke=ge.length-1;for(De=0;De<Ve;De++)if(fe.charCodeAt(Qe-De)!==ge.charCodeAt(ke-De))return De;return Ve}function g(fe){return 55296<=fe&&fe<=56319}function P(fe){return 56320<=fe&&fe<=57343}function O(fe,ge,De){var Ve=fe.charCodeAt(De);if(g(Ve)&&De+1<ge){var Qe=fe.charCodeAt(De+1);if(P(Qe))return(Ve-55296<<10)+(Qe-56320)+65536}return Ve}function F(fe,ge){var De=fe.charCodeAt(ge-1);if(P(De)&&ge>1){var Ve=fe.charCodeAt(ge-2);if(g(Ve))return(Ve-55296<<10)+(De-56320)+65536}return De}function X(fe,ge){var De=pe.getInstance(),Ve=ge,Qe=fe.length,ke=O(fe,Qe,ge);ge+=ke>=65536?2:1;for(var Fe=De.getGraphemeBreakType(ke);ge<Qe;){var Ne=O(fe,Qe,ge),Me=De.getGraphemeBreakType(Ne);if(Se(Fe,Me))break;ge+=Ne>=65536?2:1,Fe=Me}return ge-Ve}function W(fe,ge){var De=pe.getInstance(),Ve=ge,Qe=F(fe,ge);ge-=Qe>=65536?2:1;for(var ke=De.getGraphemeBreakType(Qe);ge>0;){var Fe=F(fe,ge),Ne=De.getGraphemeBreakType(Fe);if(Se(Ne,ke))break;ge-=Fe>=65536?2:1,ke=Ne}return Ve-ge}var N=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function G(fe){return N.test(fe)}var U=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDE73\uDE78-\uDE82\uDE90-\uDE95])/;function H(fe){return U.test(fe)}var V=/^[\t\n\r\x20-\x7E]*$/;function ce(fe){return V.test(fe)}function ye(fe){for(var ge=0,De=fe.length;ge<De;ge++)if(Le(fe.charCodeAt(ge)))return!0;return!1}function Le(fe){return fe=+fe,fe>=11904&&fe<=55215||fe>=63744&&fe<=64255||fe>=65281&&fe<=65374}function Ze(fe){return fe>=127462&&fe<=127487||fe>=9728&&fe<=10175||fe>=127744&&fe<=128591||fe>=128640&&fe<=128764||fe>=128992&&fe<=129003||fe>=129280&&fe<=129535||fe>=129648&&fe<=129651||fe>=129656&&fe<=129666||fe>=129680&&fe<=129685}var Ye=String.fromCharCode(65279);function Oe(fe){return!!(fe&&fe.length>0&&fe.charCodeAt(0)===65279)}function We(fe){return btoa(encodeURIComponent(fe))}function ze(fe,ge){for(var De="",Ve=0;Ve<ge;Ve++)De+=fe;return De}function Ae(fe,ge){return ge===void 0&&(ge=!1),fe?(ge&&(fe=fe.replace(/\\./g,"")),fe.toLowerCase()!==fe):!1}function xe(fe){var ge=90-65+1;return fe=fe%(2*ge),fe<ge?String.fromCharCode(97+fe):String.fromCharCode(65+fe-ge)}function le(fe){var ge=pe.getInstance();return ge.getGraphemeBreakType(fe)}function Se(fe,ge){return fe===0?ge!==5&&ge!==7:fe===2&&ge===3?!1:fe===4||fe===2||fe===3||(ge===4||ge===2||ge===3)?!0:fe===8&&(ge===8||ge===9||ge===11||ge===12)||((fe===11||fe===9)&&(ge===9||ge===10)||((fe===12||fe===10)&&ge===10||(ge===5||ge===13||(ge===7||(fe===1||fe===13&&ge===14)))))?!1:!(fe===6&&ge===6)}var pe=function(){function fe(){this._data=Ge()}return fe.getInstance=function(){return fe._INSTANCE||(fe._INSTANCE=new fe),fe._INSTANCE},fe.prototype.getGraphemeBreakType=function(ge){if(ge<32)return ge===10?3:ge===13?2:4;if(ge<127)return 0;for(var De=this._data,Ve=De.length/3,Qe=1;Qe<=Ve;)if(ge<De[3*Qe])Qe=2*Qe;else if(ge>De[3*Qe+1])Qe=2*Qe+1;else return De[3*Qe+2];return 0},fe._INSTANCE=null,fe}();function Ge(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}},NBmB:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.encodingName=L,se.encodings=void 0;var z={encodingRaw:0,encodingCopyRect:1,encodingRRE:2,encodingHextile:5,encodingTight:7,encodingTightPNG:-260,pseudoEncodingQualityLevel9:-23,pseudoEncodingQualityLevel0:-32,pseudoEncodingDesktopSize:-223,pseudoEncodingLastRect:-224,pseudoEncodingCursor:-239,pseudoEncodingQEMUExtendedKeyEvent:-258,pseudoEncodingDesktopName:-307,pseudoEncodingExtendedDesktopSize:-308,pseudoEncodingXvp:-309,pseudoEncodingFence:-312,pseudoEncodingContinuousUpdates:-313,pseudoEncodingCompressLevel9:-247,pseudoEncodingCompressLevel0:-256,pseudoEncodingVMwareCursor:1464686180,pseudoEncodingExtendedClipboard:3231835598};se.encodings=z;function L(D){switch(D){case z.encodingRaw:return"Raw";case z.encodingCopyRect:return"CopyRect";case z.encodingRRE:return"RRE";case z.encodingHextile:return"Hextile";case z.encodingTight:return"Tight";case z.encodingTightPNG:return"TightPNG";default:return"[unknown encoding "+D+"]"}}},OLES:function(ot,se,ee){"use strict";var z=ee("U8pU"),L=ee("VTBJ"),D=ee("Ff2n"),k=ee("q1tI"),M=ee("uciX"),f=ee("7ixt"),S=function(s){var l=s.overlay,t=s.prefixCls,a=s.id,i=s.overlayInnerStyle;return k.createElement("div",{className:"".concat(t,"-inner"),id:a,role:"tooltip",style:i},typeof l=="function"?l():l)},_=S,p=function(s,l){var t=s.overlayClassName,a=s.trigger,i=a===void 0?["hover"]:a,r=s.mouseEnterDelay,h=r===void 0?0:r,d=s.mouseLeaveDelay,y=d===void 0?.1:d,m=s.overlayStyle,C=s.prefixCls,T=C===void 0?"rc-tooltip":C,x=s.children,E=s.onVisibleChange,w=s.afterVisibleChange,A=s.transitionName,g=s.animation,P=s.placement,O=P===void 0?"right":P,F=s.align,X=F===void 0?{}:F,W=s.destroyTooltipOnHide,N=W===void 0?!1:W,G=s.defaultVisible,U=s.getTooltipContainer,H=s.overlayInnerStyle,V=Object(D.a)(s,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),ce=Object(k.useRef)(null);Object(k.useImperativeHandle)(l,function(){return ce.current});var ye=Object(L.a)({},V);"visible"in s&&(ye.popupVisible=s.visible);var Le=function(){var ze=s.arrowContent,Ae=ze===void 0?null:ze,xe=s.overlay,le=s.id;return[k.createElement("div",{className:"".concat(T,"-arrow"),key:"arrow"},Ae),k.createElement(_,{key:"content",prefixCls:T,id:le,overlay:xe,overlayInnerStyle:H})]},Ze=!1,Ye=!1;if(typeof N=="boolean")Ze=N;else if(N&&Object(z.a)(N)==="object"){var Oe=N.keepParent;Ze=Oe===!0,Ye=Oe===!1}return k.createElement(M.a,Object.assign({popupClassName:t,prefixCls:T,popup:Le,action:i,builtinPlacements:f.a,popupPlacement:O,ref:ce,popupAlign:X,getPopupContainer:U,onPopupVisibleChange:E,afterPopupVisibleChange:w,popupTransitionName:A,popupAnimation:g,defaultPopupVisible:G,destroyPopupOnHide:Ze,autoDestroy:Ye,mouseLeaveDelay:y,popupStyle:m,mouseEnterDelay:h},ye),x)},c=Object(k.forwardRef)(p),o=se.a=c},Ot1p:function(ot,se,ee){"use strict";var z=ee("2qtc"),L=ee("kLXV"),D=ee("rAM+"),k=ee("miYZ"),M=ee("tsqr"),f=ee("9og8"),S=ee("tJVT"),_=ee("jrin"),p=ee("WmNS"),c=ee.n(p),o=ee("q1tI"),u=ee.n(o),s=ee("VrN/"),l=ee.n(s),t=ee("bdgK"),a=ee("p77/"),i=ee("Bd2K"),r=ee("ELLl"),h=ee("19Vz"),d=ee("lZu9"),y=ee("+NIl"),m=ee("kSUc"),C=ee("9Bee"),T=function(j){var we=j.value,Be=we===void 0?"":we,de=j.className,Ce=j.showTextOnly,je=j.showLines,ut=j.style,tt=ut===void 0?{}:ut,st=Object(o.useMemo)(function(){return""},[Be]);return u.a.createElement(u.a.Fragment,null,u.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},x=ee("0Owb"),E=ee("dejd"),w=ee("C+DQ"),A=ee("1vsH"),g=ee("m3rI"),P=[{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 O(j){var we=j.onActionCallback,Be=j.title,de=j.icon,Ce=j.actionName,je=j.className,ut=je===void 0?"":je,tt=j.children;function st(){we(Ce)}return u.a.createElement("a",{title:Be,className:ut,onClick:st},u.a.createElement("i",{className:"md-iconfont ".concat(de)}),tt)}var F=function(j){var we=j.watch,Be=j.showNullButton,de=j.onActionCallback,Ce=j.fullScreen,je=j.insertTemp,ut=j.hidetoolBar,tt=j.uuid,st=j.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(A.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(A.D)("_educoder_session"),"&key=").concat(tt,"&api=").concat(encodeURIComponent(g.a.PROXY_SERVER)));var gt=[].concat(P,[{title:"".concat(we?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(we?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return u.a.createElement("ul",{className:"markdown-toolbar-container"},!ut&&gt.map(function(At,bt){return u.a.createElement("li",{key:bt},At.actionName?u.a.createElement(O,Object(x.a)({},At,{onActionCallback:de})):u.a.createElement("span",{className:"v-line"}))}),Be?u.a.createElement("li",null,u.a.createElement(O,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:de},u.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,je&&u.a.createElement("li",null,u.a.createElement(O,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(je),onActionCallback:de},u.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),u.a.createElement("li",{className:"btn-full-screen"},u.a.createElement(O,{icon:"".concat(Ce?"icon-shrink":"icon-enlarge"),title:Ce?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:de})))},X=ee("M8RZ"),W=ee("+L6B"),N=ee("2/Rp"),G=ee("y8nQ"),U=ee("Vl3Y"),H=ee("5NDa"),V=ee("5rEg"),ce={labelCol:{span:4},wrapperCol:{span:20}},ye=function(j){var we=j.callback,Be=j.onCancel;function de(Ce){we(Ce)}return u.a.createElement(U.a,Object(x.a)({},ce,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:de}),u.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},u.a.createElement(V.a,null)),u.a.createElement(U.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},u.a.createElement(V.a,null)),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(N.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Le=ee("7ahc"),Ze=ee("k1fw"),Ye=ee("HmJG"),Oe=ee("BjJ7"),We=U.a.useForm,ze={width:280,marginRight:10},Ae={labelCol:{span:5},wrapperCol:{span:19}},xe=function(j){var we=j.callback,Be=j.onCancel,de=We(),Ce=Object(S.a)(de,1),je=Ce[0],ut=Object(o.useRef)();function tt(At){we(Object(Ze.a)(Object(Ze.a)({},At),{},{name:ut.current}))}function st(At,bt){je.setFieldsValue({src:"/api/attachments/".concat(At.id,"?type=").concat(At.content_type),type:bt.type})}function gt(At){var bt=At.target.files[0];ut.current=bt.name,Se(bt,st)}return u.a.createElement(U.a,Object(x.a)({form:je},Ae,{className:"upload-image-panel",onFinish:tt}),u.a.createElement(U.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},u.a.createElement("div",{className:"flex-container"},u.a.createElement(U.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},u.a.createElement(V.a,{style:ze})),u.a.createElement(le,{onFileChange:gt}))),u.a.createElement(U.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},u.a.createElement(V.a,{style:{width:264}})),u.a.createElement(U.a.Item,{style:{textAlign:"right"}},u.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(N.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))};function le(j){var we=j.onFileChange;return u.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",u.a.createElement("input",{type:"file",onChange:we}))}function Se(j,we){if(!j)throw new String("\u6CA1\u6709\u6587\u4EF6");var Be=new FormData;Be.append("editormd-image-file",j),Be.append("file_param_name","editormd-image-file"),Be.append("byxhr","true");var de=new window.XMLHttpRequest;de.withCredentials=!0,de.addEventListener("load",function(Ce){we(JSON.parse(Ce.target.responseText),j)},!1),de.addEventListener("error",function(Ce){console.error(Ce)},!1),de.open("POST","".concat(Oe.a,"/api/attachments.json")),de.send(Be)}var pe=ee("giR+"),Ge=ee("fyUT"),fe=ee("7Kak"),ge=ee("9yH6"),De=ge.a.Group,Ve={margin:"0 8px"},Qe=function(j){var we=j.callback,Be=j.onCancel;function de(Ce){we(Ce)}return u.a.createElement(U.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:de},u.a.createElement("div",{className:"flex-container"},u.a.createElement("span",{style:Ve},"\u5355\u5143\u683C\u6570\uFF1A"),u.a.createElement("span",{style:Ve},"\u884C\u6570"),u.a.createElement(U.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},u.a.createElement(Ge.a,null)),u.a.createElement("span",{style:Ve},"\u5217\u6570"),u.a.createElement(U.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},u.a.createElement(Ge.a,null))),u.a.createElement("div",{className:"flex-container",style:{marginTop:12}},u.a.createElement("span",{style:Ve},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),u.a.createElement(U.a.Item,{name:"align"},u.a.createElement(De,null,u.a.createElement(ge.a,{value:"default"},u.a.createElement("i",{className:"fa fa-align-justify"})),u.a.createElement(ge.a,{value:"left"},u.a.createElement("i",{className:"fa fa-align-left"})),u.a.createElement(ge.a,{value:"center"},u.a.createElement("i",{className:"fa fa-align-center"})),u.a.createElement(ge.a,{value:"right"},u.a.createElement("i",{className:"fa fa-align-right"}))))),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(N.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),u.a.createElement(N.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},ke=ee("ErOA"),Fe=ee("7Cbv"),Ne="link",Me="upload-image",ne="code-block",_e="add-table",ae="------------",Ie={default:ae,left:":".concat(ae),center:":".concat(ae,":"),right:"".concat(ae,":")},Je=ee("9VGf"),et,Ke;function it(){}var he=0,Re=1e4,He="\u2581",Ee=`
**\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 ve(j){return/^\d+$/.test(j)?"".concat(j,"px"):j}var be=navigator.platform.toUpperCase().indexOf("MAC")>=0,J=be?"Cmd":"Ctrl",oe=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],Z=(et={},Object(_.a)(et,J+"-B","bold"),Object(_.a)(et,J+"-I","italic"),et),me=(Ke={},Object(_.a)(Ke,Ne,"\u6DFB\u52A0\u94FE\u63A5"),Object(_.a)(Ke,ne,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(_.a)(Ke,Me,"\u6DFB\u52A0\u6587\u4EF6"),Object(_.a)(Ke,_e,"\u6DFB\u52A0\u8868\u683C"),Ke),Xe=se.a=function(j){var we=j.defaultValue,Be=we===void 0?"":we,de=j.onChange,Ce=j.width,je=Ce===void 0?"100%":Ce,ut=j.height,tt=ut===void 0?400:ut,st=j.miniToolbar,gt=st===void 0?!1:st,At=j.isFocus,bt=At===void 0?!1:At,ht=j.watch,Ot=j.insertTemp,Bt=j.mode,mt=Bt===void 0?"markdown":Bt,St=j.id,ft=St===void 0?"markdown-editor-id":St,_t=j.showResizeBar,Pt=_t===void 0?!1:_t,Nt=j.noStorage,zt=Nt===void 0?!1:Nt,Dt=j.showNullButton,Ct=Dt===void 0?!1:Dt,Mr=j.hidetoolBar,ti=Mr===void 0?!1:Mr,Tr=j.fullScreen,Ut=Tr===void 0?!1:Tr,kr=j.onBlur,zr=j.onCMBeforeChange,ri=j.onFullScreen,nt=j.className,xt=nt===void 0?"":nt,Ht=j.disablePaste,qt=Ht===void 0?!1:Ht,er=j.placeholder,ir=er===void 0?"":er,q=j.values,I=q===void 0?"":q,B=Object(o.useState)(null),Q=Object(S.a)(B,2),te=Q[0],$=Q[1],Ue=Object(o.useState)(Be),at=Object(S.a)(Ue,2),pt=at[0],wt=at[1],lt=Object(o.useState)(ht),It=Object(S.a)(lt,2),jt=It[0],nr=It[1],Gr=Object(o.useState)(Ut),Vr=Object(S.a)(Gr,2),gr=Vr[0],$r=Vr[1],Xi=Object(o.useState)(""),Or=Object(S.a)(Xi,2),Yr=Or[0],Hr=Or[1],yi=Object(o.useState)(0),ii=Object(S.a)(yi,2),pi=ii[0],ui=ii[1],hn=Object(o.useState)(tt),ji=Object(S.a)(hn,2),ni=ji[0],Qr=ji[1],ki=Object(o.useState)(!1),Ri=Object(S.a)(ki,2),dn=Ri[0],lr=Ri[1],Yt=Object(o.useRef)(Object(Fe.a)()),Sr=Object(o.useRef)(!1),Vt=Object(o.useRef)(),dr=Object(o.useRef)(),$t=Object(o.useRef)(),ci=Object(o.useRef)(),cr=Object(o.useRef)(),Ir=function(){var Lt=Object(f.a)(c.a.mark(function Ft(){var Rt,Xt;return c.a.wrap(function(tr){for(;;)switch(tr.prev=tr.next){case 0:return tr.next=2,Object(ke.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Yt.current}});case 2:Xt=tr.sent,Xt!=null&&(Rt=Xt.attachments)!==null&&Rt!==void 0&&Rt.length&&(console.log("cm:",te,dr),Xt.attachments.map(function(Gt){Gt.content_type.indexOf("image")>-1?te.replaceSelection("![,](/api/attachments/".concat(Gt.id,"?type=").concat(Gt.content_type,")")):Gt.content_type.indexOf("video")>-1?te.replaceSelection('<video width="100%" controls src="'.concat(g.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Gt.content_type.indexOf("pdf")>-1?te.replaceSelection('<a href="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,'&disposition=inline" target="_blank">').concat(Gt.name,"</a>")):te.replaceSelection("[".concat(Gt.name,"](").concat(g.a.API_SERVER,"/api/attachments/").concat(Gt.id,"?type=").concat(Gt.content_type,")"))}));case 4:case"end":return tr.stop()}},Ft)}));return function(){return Lt.apply(this,arguments)}}();Object(o.useEffect)(function(){wt(I),te==null||te.setValue(I)},[I]),Object(o.useEffect)(function(){ri==null||ri(gr)},[gr]),Object(o.useEffect)(function(){if(dr.current){var Lt=l.a.fromTextArea(dr.current,{mode:mt,lineNumbers:!gt,lineWrapping:!0,value:Be,autoCloseTags:!0,autoCloseBrackets:!0});bt&&Lt.focus();function Ft(Rt,Xt){if(qt){Xt.preventDefault();return}var Qt=Xt.clipboardData;if(Qt){var tr=Qt.types.toString(),Gt=Qt.items;if(tr==="Files"||Qt.types.indexOf("Files")>-1){if(Xt.preventDefault(),mt=="stex")return;try{var fr,Pr=Gt[1];((fr=Gt[0])===null||fr===void 0?void 0:fr.kind)==="file"&&(Pr=Gt[0]);var Wt=Pr.getAsFile(),bi=Wt.name.split(".").pop();Se(Wt,function(Zt){if(Zt.id){var yr,Jr,ei;(Wt==null||((yr=Wt.type)===null||yr===void 0)?void 0:yr.indexOf("image"))>-1?Lt.replaceSelection("![,](/api/attachments/".concat(Zt.id,"?type=").concat(Zt.content_type,")")):(Wt==null||((Jr=Wt.type)===null||Jr===void 0)?void 0:Jr.indexOf("video"))>-1?Lt.replaceSelection('<video width="100%" controls src="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,'"></video>')):(Wt==null||((ei=Wt.type)===null||ei===void 0)?void 0:ei.indexOf("pdf"))>-1?Lt.replaceSelection('<a href="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):oe.includes(bi)?Lt.replaceSelection('<a href="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):Lt.replaceSelection("[".concat(Wt.name,"](").concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,")"))}else(Zt==null?void 0:Zt.status)===401&&(document.location.href="/user/login")})}catch(Zt){M.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Lt.on("paste",Ft),Lt.on("dragleave",function(Rt,Xt){$t.current.classList.remove("mouse-hover-md")}),Lt.on("dragover",function(Rt,Xt){$t.current.classList.add("mouse-hover-md")}),Lt.on("drop",function(Rt,Xt){$t.current.classList.add("mouse-hover-md");var Qt;if(Qt=Xt.dataTransfer.files,Qt.length>0){Xt.preventDefault(),Xt.stopPropagation();for(var tr=function(Pr){var Wt=Qt[Pr],bi=Wt.name.split(".").pop();Se(Wt,function(Zt){if(Zt.id){var yr,Jr,ei;(Wt==null||((yr=Wt.type)===null||yr===void 0)?void 0:yr.indexOf("image"))>-1?Lt.replaceSelection("![,](/api/attachments/".concat(Zt.id,"?type=").concat(Zt.content_type,")")):(Wt==null||((Jr=Wt.type)===null||Jr===void 0)?void 0:Jr.indexOf("video"))>-1?Lt.replaceSelection('<video width="100%" controls src="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,'"></video>')):(Wt==null||((ei=Wt.type)===null||ei===void 0)?void 0:ei.indexOf("pdf"))>-1?Lt.replaceSelection('<a href="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Wt.type,'&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):oe.includes(bi)?Lt.replaceSelection('<a href="'.concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,'?type=office&disposition=inline" target="_blank">').concat(Wt.name,"</a>")):Lt.replaceSelection("[".concat(Wt.name,"](").concat(g.a.API_SERVER,"/api/attachments/").concat(Zt.id,"?type=").concat(Zt.content_type,")"))}else(Zt==null?void 0:Zt.status)===401&&(document.location.href="/user/login")})},Gt=0;Gt<Qt.length;Gt++)tr(Gt)}}),$(Lt),function(){Lt.off("paste",Ft)}}},[]);var Wi=Object(o.useCallback)(function(){if($t.current)try{}catch(Lt){console.log(Lt,"---- to set md editor body height")}},[ni,$t,gr]);Object(o.useEffect)(function(){function Lt(){var Rt=new t.default(function(Xt){var Qt=Object(D.a)(Xt),tr;try{for(Qt.s();!(tr=Qt.n()).done;){var Gt=tr.value;(Gt.target.offsetHeight>0||Gt.target.offsetWidth>0)&&(Wi(),te.setSize("100%","100%"),te.refresh())}}catch(fr){Qt.e(fr)}finally{Qt.f()}});return Rt.observe(dr.current.parentElement),Rt}if(te){var Ft=Lt();return function(){Ft.unobserve(dr.current.parentElement)}}},[te,Wi]),Object(o.useEffect)(function(){if(te){for(var Lt=[],Ft=function(){var Gt=Xt[Rt];Qt=Object(S.a)(Gt,2);var fr=Qt[0],Pr=Qt[1],Wt=Object(_.a)({},fr,function(){zi(Pr)});Lt.push(Wt),te.addKeyMap(Wt)},Rt=0,Xt=Object.entries(Z);Rt<Xt.length;Rt++){var Qt;Ft()}return Vt.current=setInterval(function(){Sr.current&&Ir()},4e3),function(){clearInterval(Vt.current);var tr=Object(D.a)(Lt),Gt;try{for(tr.s();!(Gt=tr.n()).done;){var fr=Gt.value;te.removeKeyMap(fr)}}catch(Pr){tr.e(Pr)}finally{tr.f()}}}},[te]),Object(o.useEffect)(function(){Ut!==gr&&$r(Ut)},[Ut]),Object(Je.a)(function(){if(!zt&&pi>0){var Lt=new Date().getTime(),Ft=window.sessionStorage.getItem(ft);Lt>=pi+Re&&(!Ft||Ft!==pt)&&(window.sessionStorage.setItem(ft,pt),lr(!0))}},Re),Object(o.useEffect)(function(){nr(ht)},[te,ht]),Object(o.useEffect)(function(){te&&(bt&&te.focus())},[te,bt]),Object(o.useEffect)(function(){if(jt&&te){var Lt=te.getScrollerElement();function Ft(Rt){var Xt=Rt.target;if(cr.current){var Qt=Xt.scrollTop/Xt.scrollHeight;cr.current.scrollTop=cr.current.scrollHeight*Qt}}return Lt.addEventListener("scroll",Ft),function(){Lt.removeEventListener("scroll",Ft)}}},[te,jt]),Object(o.useEffect)(function(){if(te&&zr){function Lt(Ft,Rt){zr(Ft,Rt)}return te.on("beforeChange",Lt),function(){te.off("beforeChange",Lt)}}},[te,zr]),Object(o.useEffect)(function(){if(te&&kr){function Lt(){kr(te.getValue())}return te.on("blur",Lt),function(){te.off("blur",Lt)}}},[te,kr]),Object(o.useEffect)(function(){if(te){function Lt(Ft){var Rt=Ft.getValue();wt(Rt),ui(new Date().getTime()),Ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),de&&de(Rt)}return te.on("change",Lt),function(){te.off("change",Lt)}}},[te,de]),Object(o.useEffect)(function(){te&&(Be==null?(te.setValue(""),wt("")):Be!==te.getValue()&&(te.setValue(Be),wt(Be),te.setCursor(te.lineCount(),0)))},[te,Be]);var zi=Object(o.useCallback)(function(Lt){var Ft=te.getCursor(),Rt=te.getSelection(),Xt=Rt.split(`
`);switch(Lt){case"bold":return te.replaceSelection("**"+Rt+"**"),Rt===""&&te.setCursor(Ft.line,Ft.ch+2),te.focus();case"italic":return te.replaceSelection("*"+Rt+"*"),Rt===""&&te.setCursor(Ft.line,Ft.ch+1),te.focus();case"code":return te.replaceSelection("`"+Rt+"`"),Rt===""&&te.setCursor(Ft.line,Ft.ch+1),te.focus();case"inline-latex":return te.replaceSelection("`$$"+Rt+"$$`"),Rt===""&&te.setCursor(Ft.line,Ft.ch+3),te.focus();case"latex":return te.replaceSelection("```latex\n"+Rt+"\n```"),te.setCursor(Ft.line+1,Rt.length+1),te.focus();case"line-break":return te.replaceSelection(`<br/>
`),te.focus();case"list-ul":return Rt===""?te.replaceSelection("- "+Rt):te.replaceSelection(Xt.map(function(Qt){return Qt===""?"":"- ".concat(Qt)}).join(`
`)),te.focus();case"list-ol":return Rt===""?te.replaceSelection("1. "+Rt):te.replaceSelection(Xt.map(function(Qt,tr){return Qt===""?"":"".concat(tr+1,". ").concat(Qt)}).join(`
`)),te.focus();case"add-null-ch":return Rt===""&&te.setCursor(Ft.line,Ft.ch+1),te.replaceSelection(He),te.focus();case"inster-template-1":return Rt===""&&te.setCursor(Ft.line,Ft.ch),te.replaceSelection(Ee),te.focus();case"eraser":return te.setValue(""),te.focus();case"trigger-watch":return nr(!jt),te.focus();case"trigger-full-screen":return $r(!gr),te.focus();case Ne:Hr(Ne);return;case ne:Hr(ne);return;case Me:Hr(Me);return;case _e:Hr(_e);return;default:throw new Error}},[te,jt,gr]),_i=Object(o.useCallback)(function(Lt){Hr("");switch(Yr){case Ne:var Ft=Lt.title,Rt=Lt.link;return te.replaceSelection("[".concat(Ft,"](").concat(Rt,")")),te.focus();case ne:var Xt=Lt.language,Qt=Lt.content;return te.replaceSelection(["```"+Xt,Qt,"```"].join(`
`)),te.focus();case Me:var tr=Lt.src,Gt=Lt.alt,fr=Lt.name;return tr.indexOf("type=image")>-1?te.replaceSelection("![ ".concat(Gt||""," ]( ").concat(tr,' "').concat(Gt||"",'" )')):tr.indexOf("type=application/pdf")>-1?te.replaceSelection('<a href="'.concat(tr,'&disposition=inline" target="_blank">').concat(fr,"</a>")):te.replaceSelection('<a href="'.concat(tr,'" target="_blank">').concat(fr,"</a>")),te.focus();case _e:for(var Pr=Lt.row,Wt=Lt.col,bi=Lt.align,Zt=`
`,yr=0;yr<Pr;yr++){for(var Jr=[],ei=[],Hn=0;Hn<Wt;Hn++)yr===1&&ei.push(Ie[bi]),Jr.push(" ");yr===1&&(Zt+="| ".concat(ei.join(" | "),` |
`)),Zt+="| ".concat(Jr.join(Wt===1?"":" | "),` |
`)}return te.replaceSelection(Zt+`
`),te.focus();default:throw new Error}},[te,Yr]),Un=Object(o.useMemo)(function(){switch(Yr){case Ne:return u.a.createElement(ye,{callback:_i,onCancel:Xr});case ne:return u.a.createElement(Le.b,{callback:_i,onCancel:Xr});case Me:return u.a.createElement(xe,{callback:_i,onCancel:Xr});case _e:return u.a.createElement(Qe,{callback:_i,onCancel:Xr});default:return null}},[Yr]);function Xr(){Hr("")}Object(o.useEffect)(function(){if(ci.current){var Lt=ci.current,Ft=!1,Rt=0;function Xt(Gt){Ft=!0,Rt=Gt.pageY}function Qt(){Ft=!1}function tr(Gt){if(Ft){var fr=Gt.pageY-Rt;fr<0&&(fr=0),fr>300&&(fr=300);var Pr=tt+fr+"px";Qr(Pr)}}return Lt.addEventListener("mousedown",Xt),document.addEventListener("mousemove",tr),document.addEventListener("mouseup",Qt),function(){Lt.removeEventListener("mousedown",Xt),document.removeEventListener("mousemove",tr),document.removeEventListener("mouseup",Qt)}}},[te,ci]),Object(o.useEffect)(function(){Qr(tt)},[tt]);var fn=ve(je),oi=ve(ni),Gi={width:fn,height:oi},Kn=Object(o.useMemo)(function(){if(pi){var Lt=new Date(pi),Ft=Lt.getHours(),Rt=Lt.getMinutes(),Xt=Lt.getSeconds();return Ft=Ft<10?"0"+Ft:Ft,Rt=Rt<10?"0"+Rt:Rt,Xt=Xt<10?"0"+Xt:Xt,"".concat(Ft,":").concat(Rt,":").concat(Xt)}return 0},[pi]);function Di(){window.sessionStorage.removeItem(ft),lr(!1),ui(0)}function Zo(){lr(!1),ui(0),te.setValue(window.sessionStorage.getItem(ft))}function co(Lt,Ft){var Rt=te.getValue();Rt=Rt.replace(Lt,Ft),wt(Rt),te==null||te.setValue(Rt)}return u.a.createElement(o.Fragment,null,u.a.createElement("div",{className:"markdown-editor-wrapper",ref:$t},u.a.createElement("div",{className:"markdown-editor-container ".concat(xt," ").concat(jt?"on-preview":""," ").concat(gt?"mini":""," ").concat(gr?"full-screen":""),style:Gi},u.a.createElement(F,{insertTemp:Ot,watch:jt,fullScreen:gr,showNullButton:Ct,onActionCallback:zi,hidetoolBar:ti,uuid:Yt.current,setOpenPhones:function(){Sr.current=!0}}),u.a.createElement("div",{className:"markdown-editor-body"},u.a.createElement("div",{className:"codemirror-container"},u.a.createElement("textarea",{ref:dr,placeholder:ir})),jt?u.a.createElement("div",{ref:cr,className:"preview-container"},mt==="stex"&&u.a.createElement(T,{value:pt}),mt!=="stex"&&u.a.createElement(C.a,{edit:!0,value:pt,replaces:co})):null))),Pt?u.a.createElement("a",{ref:ci,className:"editor-resize"}):null,u.a.createElement(X.a,null,me[Yr]?u.a.createElement(L.a,{centered:!0,title:me[Yr],visible:!0,onCancel:Xr,footer:null},Un):null))}},P2ho:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={Again:57349,AltLeft:56,AltRight:57400,ArrowDown:57424,ArrowLeft:57419,ArrowRight:57421,ArrowUp:57416,AudioVolumeDown:57390,AudioVolumeMute:57376,AudioVolumeUp:57392,Backquote:41,Backslash:43,Backspace:14,BracketLeft:26,BracketRight:27,BrowserBack:57450,BrowserFavorites:57446,BrowserForward:57449,BrowserHome:57394,BrowserRefresh:57447,BrowserSearch:57445,BrowserStop:57448,CapsLock:58,Comma:51,ContextMenu:57437,ControlLeft:29,ControlRight:57373,Convert:121,Copy:57464,Cut:57404,Delete:57427,Digit0:11,Digit1:2,Digit2:3,Digit3:4,Digit4:5,Digit5:6,Digit6:7,Digit7:8,Digit8:9,Digit9:10,Eject:57469,End:57423,Enter:28,Equal:13,Escape:1,F1:59,F10:68,F11:87,F12:88,F13:93,F14:94,F15:95,F16:85,F17:57347,F18:57463,F19:57348,F2:60,F20:90,F21:116,F22:57465,F23:109,F24:111,F3:61,F4:62,F5:63,F6:64,F7:65,F8:66,F9:67,Find:57409,Help:57461,Hiragana:119,Home:57415,Insert:57426,IntlBackslash:86,IntlRo:115,IntlYen:125,KanaMode:112,Katakana:120,KeyA:30,KeyB:48,KeyC:46,KeyD:32,KeyE:18,KeyF:33,KeyG:34,KeyH:35,KeyI:23,KeyJ:36,KeyK:37,KeyL:38,KeyM:50,KeyN:49,KeyO:24,KeyP:25,KeyQ:16,KeyR:19,KeyS:31,KeyT:20,KeyU:22,KeyV:47,KeyW:17,KeyX:45,KeyY:21,KeyZ:44,Lang3:120,Lang4:119,Lang5:118,LaunchApp1:57451,LaunchApp2:57377,LaunchMail:57452,MediaPlayPause:57378,MediaSelect:57453,MediaStop:57380,MediaTrackNext:57369,MediaTrackPrevious:57360,MetaLeft:57435,MetaRight:57436,Minus:12,NonConvert:123,NumLock:69,Numpad0:82,Numpad1:79,Numpad2:80,Numpad3:81,Numpad4:75,Numpad5:76,Numpad6:77,Numpad7:71,Numpad8:72,Numpad9:73,NumpadAdd:78,NumpadComma:126,NumpadDecimal:83,NumpadDivide:57397,NumpadEnter:57372,NumpadEqual:89,NumpadMultiply:55,NumpadParenLeft:57462,NumpadParenRight:57467,NumpadSubtract:74,Open:100,PageDown:57425,PageUp:57417,Paste:101,Pause:57414,Period:52,Power:57438,PrintScreen:84,Props:57350,Quote:40,ScrollLock:70,Semicolon:39,ShiftLeft:42,ShiftRight:54,Slash:53,Sleep:57439,Space:57,Suspend:57381,Tab:15,Undo:57351,WakeUp:57443};se.default=z},QDVR:function(ot,se,ee){"use strict";ee.d(se,"e",function(){return L}),ee.d(se,"d",function(){return D}),ee.d(se,"c",function(){return S}),ee.d(se,"b",function(){return _}),ee.d(se,"a",function(){return c});var z=function(){var o=function(u,s){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,t){l.__proto__=t}||function(l,t){for(var a in t)t.hasOwnProperty(a)&&(l[a]=t[a])},o(u,s)};return function(u,s){o(u,s);function l(){this.constructor=u}u.prototype=s===null?Object.create(s):(l.prototype=s.prototype,new l)}}();function L(o){var u=[];return o.forEach(function(s){return u.push(s)}),u}function D(o){var u=[];return o.forEach(function(s,l){return u.push(l)}),u}var k=function(){function o(){this._value="",this._pos=0}return o.prototype.reset=function(u){return this._value=u,this._pos=0,this},o.prototype.next=function(){return this._pos+=1,this},o.prototype.hasNext=function(){return this._pos<this._value.length-1},o.prototype.cmp=function(u){var s=u.charCodeAt(0),l=this._value.charCodeAt(this._pos);return s-l},o.prototype.value=function(){return this._value[this._pos]},o}(),M=function(){function o(u){u===void 0&&(u=!0),this._splitOnBackslash=u}return o.prototype.reset=function(u){return this._value=u.replace(/\\$|\/$/,""),this._from=0,this._to=0,this.next()},o.prototype.hasNext=function(){return this._to<this._value.length},o.prototype.next=function(){this._from=this._to;for(var u=!0;this._to<this._value.length;this._to++){var s=this._value.charCodeAt(this._to);if(s===47||this._splitOnBackslash&&s===92)if(u)this._from++;else break;else u=!1}return this},o.prototype.cmp=function(u){for(var s=0,l=u.length,t=this._from;s<l&&t<this._to;){var a=u.charCodeAt(s)-this._value.charCodeAt(t);if(a!==0)return a;s+=1,t+=1}return l===this._to-this._from?0:s<l?-1:1},o.prototype.value=function(){return this._value.substring(this._from,this._to)},o}(),f=function(){function o(){}return o}(),S=function(){function o(u){this._iter=u}return o.forPaths=function(){return new o(new M)},o.forStrings=function(){return new o(new k)},o.prototype.clear=function(){this._root=void 0},o.prototype.set=function(u,s){var l=this._iter.reset(u),t;for(this._root||(this._root=new f,this._root.segment=l.value()),t=this._root;;){var a=l.cmp(t.segment);if(a>0)t.left||(t.left=new f,t.left.segment=l.value()),t=t.left;else if(a<0)t.right||(t.right=new f,t.right.segment=l.value()),t=t.right;else if(l.hasNext())l.next(),t.mid||(t.mid=new f,t.mid.segment=l.value()),t=t.mid;else break}var i=t.value;return t.value=s,t.key=u,i},o.prototype.get=function(u){for(var s=this._iter.reset(u),l=this._root;l;){var t=s.cmp(l.segment);if(t>0)l=l.left;else if(t<0)l=l.right;else if(s.hasNext())s.next(),l=l.mid;else break}return l?l.value:void 0},o.prototype.findSubstr=function(u){for(var s=this._iter.reset(u),l=this._root,t=void 0;l;){var a=s.cmp(l.segment);if(a>0)l=l.left;else if(a<0)l=l.right;else if(s.hasNext())s.next(),t=l.value||t,l=l.mid;else break}return l&&l.value||t},o.prototype.forEach=function(u){this._forEach(this._root,u)},o.prototype._forEach=function(u,s){u&&(this._forEach(u.left,s),u.value&&s(u.value,u.key),this._forEach(u.mid,s),this._forEach(u.right,s))},o}(),_=function(){function o(){this.map=new Map,this.ignoreCase=!1}return o.prototype.set=function(u,s){this.map.set(this.toKey(u),s)},o.prototype.get=function(u){return this.map.get(this.toKey(u))},o.prototype.toKey=function(u){var s=u.toString();return this.ignoreCase&&(s=s.toLowerCase()),s},o}(),p=function(){function o(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0}return o.prototype.clear=function(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0},Object.defineProperty(o.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),o.prototype.get=function(u,s){s===void 0&&(s=0);var l=this._map.get(u);return l?(s!==0&&this.touch(l,s),l.value):void 0},o.prototype.set=function(u,s,l){l===void 0&&(l=0);var t=this._map.get(u);if(t)t.value=s,l!==0&&this.touch(t,l);else{t={key:u,value:s,next:void 0,previous:void 0};switch(l){case 0:this.addItemLast(t);break;case 1:this.addItemFirst(t);break;case 2:this.addItemLast(t);break;default:this.addItemLast(t);break}this._map.set(u,t),this._size++}},o.prototype.delete=function(u){return!!this.remove(u)},o.prototype.remove=function(u){var s=this._map.get(u);return s?(this._map.delete(u),this.removeItem(s),this._size--,s.value):void 0},o.prototype.forEach=function(u,s){for(var l=this._head;l;)s?u.bind(s)(l.value,l.key,this):u(l.value,l.key,this),l=l.next},o.prototype.trimOld=function(u){if(u>=this.size)return;if(u===0){this.clear();return}for(var s=this._head,l=this.size;s&&l>u;)this._map.delete(s.key),s=s.next,l--;this._head=s,this._size=l,s&&(s.previous=void 0)},o.prototype.addItemFirst=function(u){if(!this._head&&!this._tail)this._tail=u;else if(this._head)u.next=this._head,this._head.previous=u;else throw new Error("Invalid list");this._head=u},o.prototype.addItemLast=function(u){if(!this._head&&!this._tail)this._head=u;else if(this._tail)u.previous=this._tail,this._tail.next=u;else throw new Error("Invalid list");this._tail=u},o.prototype.removeItem=function(u){if(u===this._head&&u===this._tail)this._head=void 0,this._tail=void 0;else if(u===this._head){if(!u.next)throw new Error("Invalid list");u.next.previous=void 0,this._head=u.next}else if(u===this._tail){if(!u.previous)throw new Error("Invalid list");u.previous.next=void 0,this._tail=u.previous}else{var s=u.next,l=u.previous;if(!s||!l)throw new Error("Invalid list");s.previous=l,l.next=s}u.next=void 0,u.previous=void 0},o.prototype.touch=function(u,s){if(!this._head||!this._tail)throw new Error("Invalid list");if(s!==1&&s!==2)return;if(s===1){if(u===this._head)return;var l=u.next,t=u.previous;u===this._tail?(t.next=void 0,this._tail=t):(l.previous=t,t.next=l),u.previous=void 0,u.next=this._head,this._head.previous=u,this._head=u}else if(s===2){if(u===this._tail)return;var l=u.next,t=u.previous;u===this._head?(l.previous=void 0,this._head=l):(l.previous=t,t.next=l),u.next=void 0,u.previous=this._tail,this._tail.next=u,this._tail=u}},o.prototype.toJSON=function(){var u=[];return this.forEach(function(s,l){u.push([l,s])}),u},o}(),c=function(o){z(u,o);function u(s,l){l===void 0&&(l=1);var t=o.call(this)||this;return t._limit=s,t._ratio=Math.min(Math.max(0,l),1),t}return u.prototype.get=function(s){return o.prototype.get.call(this,s,2)},u.prototype.peek=function(s){return o.prototype.get.call(this,s,0)},u.prototype.set=function(s,l){o.prototype.set.call(this,s,l,2),this.checkTrim()},u.prototype.checkTrim=function(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))},u}(p)},QV2g:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=z;function z(){for(var k,M=[],f=0;f<256;f++){k=f;for(var S=0;S<8;S++)k=k&1?3988292384^k>>>1:k>>>1;M[f]=k}return M}var L=z();function D(k,M,f,S){var _=L,p=S+f;k^=-1;for(var c=S;c<p;c++)k=k>>>8^_[(k^M[c])&255];return k^-1}},SJMd:function(ot,se){/**
* @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 ee,z,L,D=!1,k,M;window.PR_SHOULD_USE_CONTINUATION=!0;var f,S;(function(){var _=window,p=["break,continue,do,else,for,if,return,while"],c=[p,"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"],o=[c,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],u=[o,"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"],s=[o,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],l=[o,"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"],t="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",a=[o,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],i="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",r=[p,"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"],h=[p,"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"],d=[p,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],y=[u,l,s,a,i,r,h,d],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,C="str",T="kwd",x="com",E="typ",w="lit",A="pun",g="pln",P="tag",O="dec",F="src",X="atn",W="atv",N="nocode",G="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function U(ge){for(var De=0,Ve=!1,Qe=!1,ke=0,Fe=ge.length;ke<Fe;++ke){var Ne=ge[ke];if(Ne.ignoreCase)Qe=!0;else if(/[a-z]/i.test(Ne.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ve=!0,Qe=!1;break}}var Me={b:8,t:9,n:10,v:11,f:12,r:13};function ne(et){var Ke=et.charCodeAt(0);if(Ke!==92)return Ke;var it=et.charAt(1);return Ke=Me[it],Ke||("0"<=it&&it<="7"?parseInt(et.substring(1),8):it==="u"||it==="x"?parseInt(et.substring(2),16):et.charCodeAt(1))}function _e(et){if(et<32)return(et<16?"\\x0":"\\x")+et.toString(16);var Ke=String.fromCharCode(et);return Ke==="\\"||Ke==="-"||Ke==="]"||Ke==="^"?"\\"+Ke:Ke}function ae(et){var Ke=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=[],he=Ke[0]==="^",Re=["["];he&&Re.push("^");for(var He=he?1:0,Ee=Ke.length;He<Ee;++He){var ve=Ke[He];if(/\\[bdsw]/i.test(ve))Re.push(ve);else{var be=ne(ve),J;He+2<Ee&&Ke[He+1]==="-"?(J=ne(Ke[He+2]),He+=2):J=be,it.push([be,J]),J<65||be>122||(J<65||be>90||it.push([Math.max(65,be)|32,Math.min(J,90)|32]),J<97||be>122||it.push([Math.max(97,be)&~32,Math.min(J,122)&~32]))}}it.sort(function(Xe,j){return Xe[0]-j[0]||j[1]-Xe[1]});for(var oe=[],Z=[],He=0;He<it.length;++He){var me=it[He];me[0]<=Z[1]+1?Z[1]=Math.max(Z[1],me[1]):oe.push(Z=me)}for(var He=0;He<oe.length;++He){var me=oe[He];Re.push(_e(me[0])),me[1]>me[0]&&(me[1]+1>me[0]&&Re.push("-"),Re.push(_e(me[1])))}return Re.push("]"),Re.join("")}function Ie(et){for(var Ke=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=Ke.length,he=[],Re=0,He=0;Re<it;++Re){var Ee=Ke[Re];if(Ee==="(")++He;else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&(ve<=He?he[ve]=-1:Ke[Re]=_e(ve))}}for(var Re=1;Re<he.length;++Re)he[Re]===-1&&(he[Re]=++De);for(var Re=0,He=0;Re<it;++Re){var Ee=Ke[Re];if(Ee==="(")++He,he[He]||(Ke[Re]="(?:");else if(Ee.charAt(0)==="\\"){var ve=+Ee.substring(1);ve&&ve<=He&&(Ke[Re]="\\"+he[ve])}}for(var Re=0;Re<it;++Re)Ke[Re]==="^"&&Ke[Re+1]!=="^"&&(Ke[Re]="");if(et.ignoreCase&&Ve)for(var Re=0;Re<it;++Re){var Ee=Ke[Re],be=Ee.charAt(0);Ee.length>=2&&be==="["?Ke[Re]=ae(Ee):be!=="\\"&&(Ke[Re]=Ee.replace(/[a-zA-Z]/g,function(Z){var me=Z.charCodeAt(0);return"["+String.fromCharCode(me&~32,me|32)+"]"}))}return Ke.join("")}for(var Je=[],ke=0,Fe=ge.length;ke<Fe;++ke){var Ne=ge[ke];if(Ne.global||Ne.multiline)throw new Error(""+Ne);Je.push("(?:"+Ie(Ne)+")")}return new RegExp(Je.join("|"),Qe?"gi":"g")}function H(ge,De){var Ve=/(?:^|\s)nocode(?:\s|$)/,Qe=[],ke=0,Fe=[],Ne=0;function Me(ne){var _e=ne.nodeType;if(_e==1){if(Ve.test(ne.className))return;for(var ae=ne.firstChild;ae;ae=ae.nextSibling)Me(ae);var Ie=ne.nodeName.toLowerCase();(Ie==="br"||Ie==="li")&&(Qe[Ne]=`
`,Fe[Ne<<1]=ke++,Fe[Ne++<<1|1]=ne)}else if(_e==3||_e==4){var Je=ne.nodeValue;Je.length&&(De?Je=Je.replace(/\r\n?/g,`
`):Je=Je.replace(/[ \t\r\n]+/g," "),Qe[Ne]=Je,Fe[Ne<<1]=ke,ke+=Je.length,Fe[Ne++<<1|1]=ne)}}return Me(ge),{sourceCode:Qe.join("").replace(/\n$/,""),spans:Fe}}function V(ge,De,Ve,Qe,ke){if(!Ve)return;var Fe={sourceNode:ge,pre:1,langExtension:null,numberLines:null,sourceCode:Ve,spans:null,basePos:De,decorations:null};Qe(Fe),ke.push.apply(ke,Fe.decorations)}var ce=/\S/;function ye(ge){for(var De=void 0,Ve=ge.firstChild;Ve;Ve=Ve.nextSibling){var Qe=Ve.nodeType;De=Qe===1?De?ge:Ve:Qe===3&&ce.test(Ve.nodeValue)?ge:De}return De===ge?void 0:De}function Le(ge,De){var Ve={},Qe;(function(){for(var Ne=ge.concat(De),Me=[],ne={},_e=0,ae=Ne.length;_e<ae;++_e){var Ie=Ne[_e],Je=Ie[3];if(Je)for(var et=Je.length;--et>=0;)Ve[Je.charAt(et)]=Ie;var Ke=Ie[1],it=""+Ke;ne.hasOwnProperty(it)||(Me.push(Ke),ne[it]=null)}Me.push(/[\0-\uffff]/),Qe=U(Me)})();var ke=De.length,Fe=function(Ne){for(var Me=Ne.sourceCode,ne=Ne.basePos,_e=Ne.sourceNode,ae=[ne,g],Ie=0,Je=Me.match(Qe)||[],et={},Ke=0,it=Je.length;Ke<it;++Ke){var he=Je[Ke],Re=et[he],He=void 0,Ee;if(typeof Re=="string")Ee=!1;else{var ve=Ve[he.charAt(0)];if(ve)He=he.match(ve[1]),Re=ve[0];else{for(var be=0;be<ke;++be)if(ve=De[be],He=he.match(ve[1]),He){Re=ve[0];break}He||(Re=g)}Ee=Re.length>=5&&Re.substring(0,5)==="lang-",Ee&&!(He&&typeof He[1]=="string")&&(Ee=!1,Re=F),Ee||(et[he]=Re)}var J=Ie;if(Ie+=he.length,!Ee)ae.push(ne+J,Re);else{var oe=He[1],Z=he.indexOf(oe),me=Z+oe.length;He[2]&&(me=he.length-He[2].length,Z=me-oe.length);var Xe=Re.substring(5);V(_e,ne+J,he.substring(0,Z),Fe,ae),V(_e,ne+J+Z,oe,xe(Xe,oe),ae),V(_e,ne+J+me,he.substring(me),Fe,ae)}}Ne.decorations=ae};return Fe}function Ze(ge){var De=[],Ve=[];ge.tripleQuotedStrings?De.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ge.multiLineStrings?De.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ge.verbatimStrings&&Ve.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Qe=ge.hashComments;Qe&&(ge.cStyleComments?(Qe>1?De.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ve.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([x,/^#[^\r\n]*/,null,"#"])),ge.cStyleComments&&(Ve.push([x,/^\/\/[^\r\n]*/,null]),Ve.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=ge.regexLiterals;if(ke){var Fe=ke>1?"":`
\r`,Ne=Fe?".":"[\\S\\s]",Me="/(?=[^/*"+Fe+"])(?:[^/\\x5B\\x5C"+Fe+"]|\\x5C"+Ne+"|\\x5B(?:[^\\x5C\\x5D"+Fe+"]|\\x5C"+Ne+")*(?:\\x5D|$))+/";Ve.push(["lang-regex",RegExp("^"+G+"("+Me+")")])}var ne=ge.types;ne&&Ve.push([E,ne]);var _e=(""+ge.keywords).replace(/^ | $/g,"");_e.length&&Ve.push([T,new RegExp("^(?:"+_e.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([g,/^\s+/,null,` \r
\xA0`]);var ae="^.[^\\s\\w.$@'\"`/\\\\]*";return ge.regexLiterals&&(ae+="(?!s*/)"),Ve.push([w,/^@[a-z_$][a-z_$@0-9]*/i,null],[E,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[g,/^[a-z_$][a-z_$@0-9]*/i,null],[w,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[g,/^\\[\s\S]?/,null],[A,new RegExp(ae),null]),Le(De,Ve)}var Ye=Ze({keywords:y,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Oe(ge,De,Ve){for(var Qe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Fe=ge.ownerDocument,Ne=Fe.createElement("li");ge.firstChild;)Ne.appendChild(ge.firstChild);var Me=[Ne];function ne(Ke){var it=Ke.nodeType;if(it==1&&!Qe.test(Ke.className))if(Ke.nodeName==="br")_e(Ke),Ke.parentNode&&Ke.parentNode.removeChild(Ke);else for(var he=Ke.firstChild;he;he=he.nextSibling)ne(he);else if((it==3||it==4)&&Ve){var Re=Ke.nodeValue,He=Re.match(ke);if(He){var Ee=Re.substring(0,He.index);Ke.nodeValue=Ee;var ve=Re.substring(He.index+He[0].length);if(ve){var be=Ke.parentNode;be.insertBefore(Fe.createTextNode(ve),Ke.nextSibling)}_e(Ke),Ee||Ke.parentNode.removeChild(Ke)}}}function _e(Ke){for(;!Ke.nextSibling;)if(Ke=Ke.parentNode,!Ke)return;function it(He,Ee){var ve=Ee?He.cloneNode(!1):He,be=He.parentNode;if(be){var J=it(be,1),oe=He.nextSibling;J.appendChild(ve);for(var Z=oe;Z;Z=oe)oe=Z.nextSibling,J.appendChild(Z)}return ve}for(var he=it(Ke.nextSibling,0),Re;(Re=he.parentNode)&&Re.nodeType===1;)he=Re;Me.push(he)}for(var ae=0;ae<Me.length;++ae)ne(Me[ae]);De===(De|0)&&Me[0].setAttribute("value",De);var Ie=Fe.createElement("ol");Ie.className="linenums";for(var Je=Math.max(0,De-1|0)||0,ae=0,et=Me.length;ae<et;++ae)Ne=Me[ae],Ne.className="L"+(ae+Je)%10,Ne.firstChild||Ne.appendChild(Fe.createTextNode("\xA0")),Ie.appendChild(Ne);ge.appendChild(Ie)}function We(ge){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var Ve=/\n/g,Qe=ge.sourceCode,ke=Qe.length,Fe=0,Ne=ge.spans,Me=Ne.length,ne=0,_e=ge.decorations,ae=_e.length,Ie=0;_e[ae]=ke;var Je,et;for(et=Je=0;et<ae;)_e[et]!==_e[et+2]?(_e[Je++]=_e[et++],_e[Je++]=_e[et++]):et+=2;for(ae=Je,et=Je=0;et<ae;){for(var Ke=_e[et],it=_e[et+1],he=et+2;he+2<=ae&&_e[he+1]===it;)he+=2;_e[Je++]=Ke,_e[Je++]=it,et=he}ae=_e.length=Je;var Re=ge.sourceNode,He="";Re&&(He=Re.style.display,Re.style.display="none");try{for(var Ee=null;ne<Me;){var ve=Ne[ne],be=Ne[ne+2]||ke,J=_e[Ie+2]||ke,he=Math.min(be,J),oe=Ne[ne+1],Z;if(oe.nodeType!==1&&(Z=Qe.substring(Fe,he))){De&&(Z=Z.replace(Ve,"\r")),oe.nodeValue=Z;var me=oe.ownerDocument,Xe=me.createElement("span");Xe.className=_e[Ie+1];var j=oe.parentNode;j.replaceChild(Xe,oe),Xe.appendChild(oe),Fe<be&&(Ne[ne+1]=oe=me.createTextNode(Qe.substring(he,be)),j.insertBefore(oe,Xe.nextSibling))}Fe=he,Fe>=be&&(ne+=2),Fe>=J&&(Ie+=2)}}finally{Re&&(Re.style.display=He)}}var ze={};function Ae(ge,De){for(var Ve=De.length;--Ve>=0;){var Qe=De[Ve];ze.hasOwnProperty(Qe)?_.console&&console.warn("cannot override language handler %s",Qe):ze[Qe]=ge}}function xe(ge,De){return ge&&ze.hasOwnProperty(ge)||(ge=/^\s*</.test(De)?"default-markup":"default-code"),ze[ge]}Ae(Ye,["default-code"]),Ae(Le([],[[g,/^[^<?]+/],[O,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[A,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Ae(Le([[g,/^[\s]+/,null,` \r
`],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[P,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[X,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[A,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Ae(Le([],[[W,/^[\s\S]+/]]),["uq.val"]),Ae(Ze({keywords:u,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),Ae(Ze({keywords:"null,true,false"}),["json"]),Ae(Ze({keywords:l,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),Ae(Ze({keywords:s,cStyleComments:!0}),["java"]),Ae(Ze({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ae(Ze({keywords:r,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ae(Ze({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ae(Ze({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ae(Ze({keywords:a,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ae(Ze({keywords:t,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ae(Le([],[[C,/^[\s\S]+/]]),["regex"]);function le(ge){var De=ge.langExtension;try{var Ve=H(ge.sourceNode,ge.pre),Qe=Ve.sourceCode;ge.sourceCode=Qe,ge.spans=Ve.spans,ge.basePos=0,xe(De,Qe)(ge),We(ge)}catch(ke){_.console&&console.log(ke&&ke.stack||ke)}}function Se(ge,De,Ve){var Qe=Ve||!1,ke=De||null,Fe=document.createElement("div");Fe.innerHTML="<pre>"+ge+"</pre>",Fe=Fe.firstChild,Qe&&Oe(Fe,Qe,!0);var Ne={langExtension:ke,numberLines:Qe,sourceNode:Fe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return le(Ne),Fe.innerHTML}function pe(ge,De){var Ve=De||document.body,Qe=Ve.ownerDocument||document;function ke(ve){return Ve.getElementsByTagName(ve)}for(var Fe=[ke("pre"),ke("code"),ke("xmp")],Ne=[],Me=0;Me<Fe.length;++Me)for(var ne=0,_e=Fe[Me].length;ne<_e;++ne)Ne.push(Fe[Me][ne]);Fe=null;var ae=Date;ae.now||(ae={now:function(){return+new Date}});var Ie=0,Je=/\blang(?:uage)?-([\w.]+)(?!\S)/,et=/\bprettyprint\b/,Ke=/\bprettyprinted\b/,it=/pre|xmp/i,he=/^code$/i,Re=/^(?:pre|code|xmp)$/i,He={};function Ee(){for(var ve=_.PR_SHOULD_USE_CONTINUATION?ae.now()+250:Infinity;Ie<Ne.length&&ae.now()<ve;Ie++){for(var be=Ne[Ie],J=He,oe=be;oe=oe.previousSibling;){var Z=oe.nodeType,me=(Z===7||Z===8)&&oe.nodeValue;if(me?!/^\??prettify\b/.test(me):Z!==3||/\S/.test(oe.nodeValue))break;if(me){J={},me.replace(/\b(\w+)=([\w:.%+-]+)/g,function(bt,ht,Ot){J[ht]=Ot});break}}var Xe=be.className;if((J!==He||et.test(Xe))&&!Ke.test(Xe)){for(var j=!1,we=be.parentNode;we;we=we.parentNode){var Be=we.tagName;if(Re.test(Be)&&we.className&&et.test(we.className)){j=!0;break}}if(!j){be.className+=" prettyprinted";var de=J.lang;if(!de){de=Xe.match(Je);var Ce;!de&&(Ce=ye(be))&&he.test(Ce.tagName)&&(de=Ce.className.match(Je)),de&&(de=de[1])}var je;if(it.test(be.tagName))je=1;else{var ut=be.currentStyle,tt=Qe.defaultView,st=ut?ut.whiteSpace:tt&&tt.getComputedStyle?tt.getComputedStyle(be,null).getPropertyValue("white-space"):0;je=st&&st.substring(0,3)==="pre"}var gt=J.linenums;(gt=gt==="true"||+gt)||(gt=Xe.match(/\blinenums\b(?::(\d+))?/),gt=gt?gt[1]&&gt[1].length?+gt[1]:!0:!1),gt&&Oe(be,gt,je);var At={langExtension:de,sourceNode:be,numberLines:gt,pre:je,sourceCode:null,basePos:null,spans:null,decorations:null};le(At)}}}Ie<Ne.length?_.setTimeout(Ee,250):typeof ge=="function"&&ge()}Ee()}var Ge=_.PR={createSimpleLexer:Le,registerLangHandler:Ae,sourceDecorator:Ze,PR_ATTRIB_NAME:X,PR_ATTRIB_VALUE:W,PR_COMMENT:x,PR_DECLARATION:O,PR_KEYWORD:T,PR_LITERAL:w,PR_NOCODE:N,PR_PLAIN:g,PR_PUNCTUATION:A,PR_SOURCE:F,PR_STRING:C,PR_TAG:P,PR_TYPE:E,prettyPrintOne:D?_.prettyPrintOne=Se:f=Se,prettyPrint:S=D?_.prettyPrint=pe:S=pe},fe=_.define;typeof fe=="function"&&fe.amd&&fe("google-code-prettify",[],function(){return Ge})})()},SZEN:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.clientToElement=z;function z(L,D,k){var M=k.getBoundingClientRect(),f={x:0,y:0};return L<M.left?f.x=0:L>=M.right?f.x=M.width-1:f.x=L-M.left,D<M.top?f.y=0:D>=M.bottom?f.y=M.height-1:f.y=D-M.top,f}},SgaC:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(M,f){if(!(M instanceof f))throw new TypeError("Cannot call a class as a function")}function L(M,f){for(var S=0;S<f.length;S++){var _=f[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function D(M,f,S){return f&&L(M.prototype,f),S&&L(M,S),M}var k=function(){function M(){z(this,M),this._subrects=0}return D(M,[{key:"decodeRect",value:function(S,_,p,c,o,u,s){if(this._subrects===0){if(o.rQwait("RRE",4+4))return!1;this._subrects=o.rQshift32();var l=o.rQshiftBytes(4);u.fillRect(S,_,p,c,l)}for(;this._subrects>0;){if(o.rQwait("RRE",4+8))return!1;var t=o.rQshiftBytes(4),a=o.rQshift16(),i=o.rQshift16(),r=o.rQshift16(),h=o.rQshift16();u.fillRect(S+a,_+i,r,h,t),this._subrects--}return!0}}]),M}();se.default=k},T8No:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return k}),ee.d(se,"b",function(){return s}),ee.d(se,"d",function(){return l}),ee.d(se,"c",function(){return t}),ee.d(se,"e",function(){return a});var z=ee("N0LK"),L=ee("Cg/j"),D=function(){var i=function(r,h){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,y){d.__proto__=y}||function(d,y){for(var m in y)y.hasOwnProperty(m)&&(d[m]=y[m])},i(r,h)};return function(r,h){i(r,h);function d(){this.constructor=r}r.prototype=h===null?Object.create(h):(d.prototype=h.prototype,new d)}}(),k=function(){function i(){}return i.has=function(r){return f.create(r)},i.equals=function(r,h){return S.create(r,h)},i.regex=function(r,h){return c.create(r,h)},i.not=function(r){return p.create(r)},i.and=function(){for(var r=[],h=0;h<arguments.length;h++)r[h]=arguments[h];return u.create(r)},i.or=function(){for(var r=[],h=0;h<arguments.length;h++)r[h]=arguments[h];return s.create(r)},i.deserialize=function(r,h){return h===void 0&&(h=!1),r?this._deserializeOrExpression(r,h):void 0},i._deserializeOrExpression=function(r,h){var d=this,y=r.split("||");return s.create(y.map(function(m){return d._deserializeAndExpression(m,h)}))},i._deserializeAndExpression=function(r,h){var d=this,y=r.split("&&");return u.create(y.map(function(m){return d._deserializeOne(m,h)}))},i._deserializeOne=function(r,h){if(r=r.trim(),r.indexOf("!=")>=0){var d=r.split("!=");return _.create(d[0].trim(),this._deserializeValue(d[1],h))}if(r.indexOf("==")>=0){var d=r.split("==");return S.create(d[0].trim(),this._deserializeValue(d[1],h))}if(r.indexOf("=~")>=0){var d=r.split("=~");return c.create(d[0].trim(),this._deserializeRegexValue(d[1],h))}return/^\!\s*/.test(r)?p.create(r.substr(1).trim()):f.create(r)},i._deserializeValue=function(r,h){if(r=r.trim(),r==="true")return!0;if(r==="false")return!1;var d=/^'([^']*)'$/.exec(r);return d?d[1].trim():r},i._deserializeRegexValue=function(r,h){if(Object(z.x)(r)){if(h)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}var d=r.indexOf("/"),y=r.lastIndexOf("/");if(d===y||d<0){if(h)throw new Error("bad regexp-value '"+r+"', missing /-enclosure");return console.warn("bad regexp-value '"+r+"', missing /-enclosure"),null}var m=r.slice(d+1,y),C=r[y+1]==="i"?"i":"";try{return new RegExp(m,C)}catch(T){if(h)throw new Error("bad regexp-value '"+r+"', parse error: "+T);return console.warn("bad regexp-value '"+r+"', parse error: "+T),null}},i}();function M(i,r){var h=i.getType(),d=r.getType();if(h!==d)return h-d;switch(h){case 1:return i.cmp(r);case 2:return i.cmp(r);case 3:return i.cmp(r);case 4:return i.cmp(r);case 6:return i.cmp(r);case 7:return i.cmp(r);case 5:return i.cmp(r);default:throw new Error("Unknown ContextKeyExpr!")}}var f=function(){function i(r){this.key=r}return i.create=function(r){return new i(r)},i.prototype.getType=function(){return 1},i.prototype.cmp=function(r){return this.key<r.key?-1:this.key>r.key?1:0},i.prototype.equals=function(r){return r instanceof i?this.key===r.key:!1},i.prototype.evaluate=function(r){return!!r.getValue(this.key)},i.prototype.keys=function(){return[this.key]},i.prototype.negate=function(){return p.create(this.key)},i}(),S=function(){function i(r,h){this.key=r,this.value=h}return i.create=function(r,h){return typeof h=="boolean"?h?f.create(r):p.create(r):new i(r,h)},i.prototype.getType=function(){return 3},i.prototype.cmp=function(r){return this.key<r.key?-1:this.key>r.key?1:this.value<r.value?-1:this.value>r.value?1:0},i.prototype.equals=function(r){return r instanceof i?this.key===r.key&&this.value===r.value:!1},i.prototype.evaluate=function(r){return r.getValue(this.key)==this.value},i.prototype.keys=function(){return[this.key]},i.prototype.negate=function(){return _.create(this.key,this.value)},i}(),_=function(){function i(r,h){this.key=r,this.value=h}return i.create=function(r,h){return typeof h=="boolean"?h?p.create(r):f.create(r):new i(r,h)},i.prototype.getType=function(){return 4},i.prototype.cmp=function(r){return this.key<r.key?-1:this.key>r.key?1:this.value<r.value?-1:this.value>r.value?1:0},i.prototype.equals=function(r){return r instanceof i?this.key===r.key&&this.value===r.value:!1},i.prototype.evaluate=function(r){return r.getValue(this.key)!=this.value},i.prototype.keys=function(){return[this.key]},i.prototype.negate=function(){return S.create(this.key,this.value)},i}(),p=function(){function i(r){this.key=r}return i.create=function(r){return new i(r)},i.prototype.getType=function(){return 2},i.prototype.cmp=function(r){return this.key<r.key?-1:this.key>r.key?1:0},i.prototype.equals=function(r){return r instanceof i?this.key===r.key:!1},i.prototype.evaluate=function(r){return!r.getValue(this.key)},i.prototype.keys=function(){return[this.key]},i.prototype.negate=function(){return f.create(this.key)},i}(),c=function(){function i(r,h){this.key=r,this.regexp=h}return i.create=function(r,h){return new i(r,h)},i.prototype.getType=function(){return 6},i.prototype.cmp=function(r){if(this.key<r.key)return-1;if(this.key>r.key)return 1;var h=this.regexp?this.regexp.source:"",d=r.regexp?r.regexp.source:"";return h<d?-1:h>d?1:0},i.prototype.equals=function(r){if(r instanceof i){var h=this.regexp?this.regexp.source:"",d=r.regexp?r.regexp.source:"";return this.key===r.key&&h===d}return!1},i.prototype.evaluate=function(r){var h=r.getValue(this.key);return this.regexp?this.regexp.test(h):!1},i.prototype.keys=function(){return[this.key]},i.prototype.negate=function(){return o.create(this)},i}(),o=function(){function i(r){this._actual=r}return i.create=function(r){return new i(r)},i.prototype.getType=function(){return 7},i.prototype.cmp=function(r){return this._actual.cmp(r._actual)},i.prototype.equals=function(r){return r instanceof i?this._actual.equals(r._actual):!1},i.prototype.evaluate=function(r){return!this._actual.evaluate(r)},i.prototype.keys=function(){return this._actual.keys()},i.prototype.negate=function(){return this._actual},i}(),u=function(){function i(r){this.expr=r}return i.create=function(r){var h=i._normalizeArr(r);return h.length===0?void 0:h.length===1?h[0]:new i(h)},i.prototype.getType=function(){return 5},i.prototype.cmp=function(r){if(this.expr.length<r.expr.length)return-1;if(this.expr.length>r.expr.length)return 1;for(var h=0,d=this.expr.length;h<d;h++){var y=M(this.expr[h],r.expr[h]);if(y!==0)return y}return 0},i.prototype.equals=function(r){if(r instanceof i){if(this.expr.length!==r.expr.length)return!1;for(var h=0,d=this.expr.length;h<d;h++)if(!this.expr[h].equals(r.expr[h]))return!1;return!0}return!1},i.prototype.evaluate=function(r){for(var h=0,d=this.expr.length;h<d;h++)if(!this.expr[h].evaluate(r))return!1;return!0},i._normalizeArr=function(r){var h=[];if(r){for(var d=0,y=r.length;d<y;d++){var m=r[d];if(!m)continue;if(m instanceof i){h=h.concat(m.expr);continue}if(m instanceof s)throw new Error('It is not allowed to have an or expression here due to lack of parens! For example "a && (b||c)" is not supported, use "(a&&b) || (a&&c)" instead.');h.push(m)}h.sort(M)}return h},i.prototype.keys=function(){for(var r=[],h=0,d=this.expr;h<d.length;h++){var y=d[h];r.push.apply(r,y.keys())}return r},i.prototype.negate=function(){for(var r=[],h=0,d=this.expr;h<d.length;h++){var y=d[h];r.push(y.negate())}return s.create(r)},i}(),s=function(){function i(r){this.expr=r}return i.create=function(r){var h=i._normalizeArr(r);return h.length===0?void 0:h.length===1?h[0]:new i(h)},i.prototype.getType=function(){return 8},i.prototype.equals=function(r){if(r instanceof i){if(this.expr.length!==r.expr.length)return!1;for(var h=0,d=this.expr.length;h<d;h++)if(!this.expr[h].equals(r.expr[h]))return!1;return!0}return!1},i.prototype.evaluate=function(r){for(var h=0,d=this.expr.length;h<d;h++)if(this.expr[h].evaluate(r))return!0;return!1},i._normalizeArr=function(r){var h=[];if(r){for(var d=0,y=r.length;d<y;d++){var m=r[d];if(!m)continue;if(m instanceof i){h=h.concat(m.expr);continue}h.push(m)}h.sort(M)}return h},i.prototype.keys=function(){for(var r=[],h=0,d=this.expr;h<d.length;h++){var y=d[h];r.push.apply(r,y.keys())}return r},i.prototype.negate=function(){for(var r=[],h=0,d=this.expr;h<d.length;h++){var y=d[h];r.push(y.negate())}for(var m=function(F){return F instanceof i?F.expr:[F]};r.length>1;){for(var C=r.shift(),T=r.shift(),x=[],E=0,w=m(C);E<w.length;E++)for(var A=w[E],g=0,P=m(T);g<P.length;g++){var O=P[g];x.push(k.and(A,O))}r.unshift(k.or.apply(k,x))}return r[0]},i}(),l=function(i){D(r,i);function r(h,d){var y=i.call(this,h)||this;return y._defaultValue=d,y}return r.prototype.bindTo=function(h){return h.createKey(this.key,this._defaultValue)},r.prototype.getValue=function(h){return h.getContextKeyValue(this.key)},r.prototype.toNegated=function(){return k.not(this.key)},r}(f),t=Object(L.c)("contextKeyService"),a="setContext"},VSMT:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.decodeUTF8=z,se.encodeUTF8=L;function z(D){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;try{return decodeURIComponent(escape(D))}catch(M){if(M instanceof URIError&&k)return D;throw M}}function L(D){return unescape(encodeURIComponent(D))}},"VaU+":function(ot,se,ee){ot.exports={wrp:"wrp___1lJPu",header:"header___2p05v",cuttDown:"cuttDown___1-ls7",container:"container___1Nx55",info:"info___2lI6e",buttons:"buttons___3Q0yr",fullBtn:"fullBtn___18HVx",shrink:"shrink___367DS",elseShrink:"elseShrink___3Anw7",spin:"spin___3h9s3"}},"VrN/":function(ot,se,ee){(function(z,L){ot.exports=L()})(this,function(){"use strict";var z=navigator.userAgent,L=navigator.platform,D=/gecko\/\d/i.test(z),k=/MSIE \d/.test(z),M=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(z),f=/Edge\/(\d+)/.exec(z),S=k||M||f,_=S&&(k?document.documentMode||6:+(f||M)[1]),p=!f&&/WebKit\//.test(z),c=p&&/Qt\/\d+\.\d+/.test(z),o=!f&&/Chrome\//.test(z),u=/Opera\//.test(z),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(z),t=/PhantomJS/.test(z),a=!f&&/AppleWebKit/.test(z)&&/Mobile\/\w+/.test(z),i=/Android/.test(z),r=a||i||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(z),h=a||/Mac/.test(L),d=/\bCrOS\b/.test(z),y=/win/i.test(L),m=u&&z.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(u=!1,p=!0);var C=h&&(c||u&&(m==null||m<12.11)),T=D||S&&_>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var E=function(e,n){var b=e.className,v=x(n).exec(b);if(v){var R=b.slice(v.index+v[0].length);e.className=b.slice(0,v.index)+(R?v[1]+R:"")}};function w(e){for(var n=e.childNodes.length;n>0;--n)e.removeChild(e.firstChild);return e}function A(e,n){return w(e).appendChild(n)}function g(e,n,b,v){var R=document.createElement(e);if(b&&(R.className=b),v&&(R.style.cssText=v),typeof n=="string")R.appendChild(document.createTextNode(n));else if(n)for(var K=0;K<n.length;++K)R.appendChild(n[K]);return R}function P(e,n,b,v){var R=g(e,n,b,v);return R.setAttribute("role","presentation"),R}var O;document.createRange?O=function(e,n,b,v){var R=document.createRange();return R.setEnd(v||e,b),R.setStart(e,n),R}:O=function(e,n,b){var v=document.body.createTextRange();try{v.moveToElementText(e.parentNode)}catch(R){return v}return v.collapse(!0),v.moveEnd("character",b),v.moveStart("character",n),v};function F(e,n){if(n.nodeType==3&&(n=n.parentNode),e.contains)return e.contains(n);do if(n.nodeType==11&&(n=n.host),n==e)return!0;while(n=n.parentNode)}function X(){var e;try{e=document.activeElement}catch(n){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function W(e,n){var b=e.className;x(n).test(b)||(e.className+=(b?" ":"")+n)}function N(e,n){for(var b=e.split(" "),v=0;v<b.length;v++)b[v]&&!x(b[v]).test(n)&&(n+=" "+b[v]);return n}var G=function(e){e.select()};a?G=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:S&&(G=function(e){try{e.select()}catch(n){}});function U(e){var n=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,n)}}function H(e,n,b){n||(n={});for(var v in e)e.hasOwnProperty(v)&&(b!==!1||!n.hasOwnProperty(v))&&(n[v]=e[v]);return n}function V(e,n,b,v,R){n==null&&(n=e.search(/[^\s\u00a0]/),n==-1&&(n=e.length));for(var K=v||0,Y=R||0;;){var re=e.indexOf(" ",K);if(re<0||re>=n)return Y+(n-K);Y+=re-K,Y+=b-Y%b,K=re+1}}var ce=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ce.prototype.set=function(e,n){this.f=n;var b=+new Date+e;(!this.id||b<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=b)};function ye(e,n){for(var b=0;b<e.length;++b)if(e[b]==n)return b;return-1}var Le=50,Ze={toString:function(){return"CodeMirror.Pass"}},Ye={scroll:!1},Oe={origin:"*mouse"},We={origin:"+move"};function ze(e,n,b){for(var v=0,R=0;;){var K=e.indexOf(" ",v);K==-1&&(K=e.length);var Y=K-v;if(K==e.length||R+Y>=n)return v+Math.min(Y,n-R);if(R+=K-v,R+=b-R%b,v=K+1,R>=n)return v}}var Ae=[""];function xe(e){for(;Ae.length<=e;)Ae.push(le(Ae)+" ");return Ae[e]}function le(e){return e[e.length-1]}function Se(e,n){for(var b=[],v=0;v<e.length;v++)b[v]=n(e[v],v);return b}function pe(e,n,b){for(var v=0,R=b(n);v<e.length&&b(e[v])<=R;)v++;e.splice(v,0,n)}function Ge(){}function fe(e,n){var b;return Object.create?b=Object.create(e):(Ge.prototype=e,b=new Ge),n&&H(n,b),b}var ge=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ge.test(e))}function Ve(e,n){return n?n.source.indexOf("\\w")>-1&&De(e)?!0:n.test(e):De(e)}function Qe(e){for(var n in e)if(e.hasOwnProperty(n)&&e[n])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Fe(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Ne(e,n,b){for(;(b<0?n>0:n<e.length)&&Fe(e.charAt(n));)n+=b;return n}function Me(e,n,b){for(var v=n>b?-1:1;;){if(n==b)return n;var R=(n+b)/2,K=v<0?Math.ceil(R):Math.floor(R);if(K==n)return e(K)?n:b;e(K)?b=K:n=K+v}}function ne(e,n,b,v){if(!e)return v(n,b,"ltr",0);for(var R=!1,K=0;K<e.length;++K){var Y=e[K];(Y.from<b&&Y.to>n||n==b&&Y.to==n)&&(v(Math.max(Y.from,n),Math.min(Y.to,b),Y.level==1?"rtl":"ltr",K),R=!0)}R||v(n,b,"ltr")}var _e=null;function ae(e,n,b){var v;_e=null;for(var R=0;R<e.length;++R){var K=e[R];if(K.from<n&&K.to>n)return R;K.to==n&&(K.from!=K.to&&b=="before"?v=R:_e=R),K.from==n&&(K.from!=K.to&&b!="before"?v=R:_e=R)}return v!=null?v:_e}var Ie=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function b(ue){return ue<=247?e.charAt(ue):1424<=ue&&ue<=1524?"R":1536<=ue&&ue<=1785?n.charAt(ue-1536):1774<=ue&&ue<=2220?"r":8192<=ue&&ue<=8203?"w":ue==8204?"b":"L"}var v=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,R=/[stwN]/,K=/[LRr]/,Y=/[Lb1n]/,re=/[1n]/;function ie(ue,Te,Pe){this.level=ue,this.from=Te,this.to=Pe}return function(ue,Te){var Pe=Te=="ltr"?"L":"R";if(ue.length==0||Te=="ltr"&&!v.test(ue))return!1;for(var $e=ue.length,qe=[],rt=0;rt<$e;++rt)qe.push(b(ue.charCodeAt(rt)));for(var ct=0,dt=Pe;ct<$e;++ct){var vt=qe[ct];vt=="m"?qe[ct]=dt:dt=vt}for(var Et=0,yt=Pe;Et<$e;++Et){var Tt=qe[Et];Tt=="1"&&yt=="r"?qe[Et]="n":K.test(Tt)&&(yt=Tt,Tt=="r"&&(qe[Et]="R"))}for(var Mt=1,kt=qe[0];Mt<$e-1;++Mt){var Kt=qe[Mt];Kt=="+"&&kt=="1"&&qe[Mt+1]=="1"?qe[Mt]="1":Kt==","&&kt==qe[Mt+1]&&(kt=="1"||kt=="n")&&(qe[Mt]=kt),kt=Kt}for(var or=0;or<$e;++or){var xr=qe[or];if(xr==",")qe[or]="N";else if(xr=="%"){var sr=void 0;for(sr=or+1;sr<$e&&qe[sr]=="%";++sr);for(var Wr=or&&qe[or-1]=="!"||sr<$e&&qe[sr]=="1"?"1":"N",Br=or;Br<sr;++Br)qe[Br]=Wr;or=sr-1}}for(var pr=0,Ur=Pe;pr<$e;++pr){var wr=qe[pr];Ur=="L"&&wr=="1"?qe[pr]="L":K.test(wr)&&(Ur=wr)}for(var vr=0;vr<$e;++vr)if(R.test(qe[vr])){var mr=void 0;for(mr=vr+1;mr<$e&&R.test(qe[mr]);++mr);for(var ur=(vr?qe[vr-1]:Pe)=="L",Kr=(mr<$e?qe[mr]:Pe)=="L",un=ur==Kr?ur?"L":"R":Pe,Li=vr;Li<mr;++Li)qe[Li]=un;vr=mr-1}for(var Lr=[],fi,Er=0;Er<$e;)if(Y.test(qe[Er])){var Yo=Er;for(++Er;Er<$e&&Y.test(qe[Er]);++Er);Lr.push(new ie(0,Yo,Er))}else{var vi=Er,Ki=Lr.length,Hi=Te=="rtl"?1:0;for(++Er;Er<$e&&qe[Er]!="L";++Er);for(var Dr=vi;Dr<Er;)if(re.test(qe[Dr])){vi<Dr&&(Lr.splice(Ki,0,new ie(1,vi,Dr)),Ki+=Hi);var cn=Dr;for(++Dr;Dr<Er&&re.test(qe[Dr]);++Dr);Lr.splice(Ki,0,new ie(2,cn,Dr)),Ki+=Hi,vi=Dr}else++Dr;vi<Er&&Lr.splice(Ki,0,new ie(1,vi,Er))}return Te=="ltr"&&(Lr[0].level==1&&(fi=ue.match(/^\s+/))&&(Lr[0].from=fi[0].length,Lr.unshift(new ie(0,0,fi[0].length))),le(Lr).level==1&&(fi=ue.match(/\s+$/))&&(le(Lr).to-=fi[0].length,Lr.push(new ie(0,$e-fi[0].length,$e)))),Te=="rtl"?Lr.reverse():Lr}}();function Je(e,n){var b=e.order;return b==null&&(b=e.order=Ie(e.text,n)),b}var et=[],Ke=function(e,n,b){if(e.addEventListener)e.addEventListener(n,b,!1);else if(e.attachEvent)e.attachEvent("on"+n,b);else{var v=e._handlers||(e._handlers={});v[n]=(v[n]||et).concat(b)}};function it(e,n){return e._handlers&&e._handlers[n]||et}function he(e,n,b){if(e.removeEventListener)e.removeEventListener(n,b,!1);else if(e.detachEvent)e.detachEvent("on"+n,b);else{var v=e._handlers,R=v&&v[n];if(R){var K=ye(R,b);K>-1&&(v[n]=R.slice(0,K).concat(R.slice(K+1)))}}}function Re(e,n){var b=it(e,n);if(!b.length)return;for(var v=Array.prototype.slice.call(arguments,2),R=0;R<b.length;++R)b[R].apply(null,v)}function He(e,n,b){return typeof n=="string"&&(n={type:n,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,b||n.type,e,n),Z(n)||n.codemirrorIgnore}function Ee(e){var n=e._handlers&&e._handlers.cursorActivity;if(!n)return;for(var b=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),v=0;v<n.length;++v)ye(b,n[v])==-1&&b.push(n[v])}function ve(e,n){return it(e,n).length>0}function be(e){e.prototype.on=function(n,b){Ke(this,n,b)},e.prototype.off=function(n,b){he(this,n,b)}}function J(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function oe(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Z(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function me(e){J(e),oe(e)}function Xe(e){return e.target||e.srcElement}function j(e){var n=e.which;return n==null&&(e.button&1?n=1:e.button&2?n=3:e.button&4&&(n=2)),h&&e.ctrlKey&&n==1&&(n=3),n}var we=function(){if(S&&_<9)return!1;var e=g("div");return"draggable"in e||"dragDrop"in e}(),Be;function de(e){if(Be==null){var n=g("span","\u200B");A(e,g("span",[n,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Be=n.offsetWidth<=1&&n.offsetHeight>2&&!(S&&_<8))}var b=Be?g("span","\u200B"):g("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return b.setAttribute("cm-text",""),b}var Ce;function je(e){if(Ce!=null)return Ce;var n=A(e,document.createTextNode("A\u062EA")),b=O(n,0,1).getBoundingClientRect(),v=O(n,1,2).getBoundingClientRect();return w(e),!b||b.left==b.right?!1:Ce=v.right-b.right<3}var ut=`
b`.split(/\n/).length!=3?function(e){for(var n=0,b=[],v=e.length;n<=v;){var R=e.indexOf(`
`,n);R==-1&&(R=e.length);var K=e.slice(n,e.charAt(R-1)=="\r"?R-1:R),Y=K.indexOf("\r");Y!=-1?(b.push(K.slice(0,Y)),n+=Y+1):(b.push(K),n=R+1)}return b}:function(e){return e.split(/\r\n?|\n/)},tt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(n){return!1}}:function(e){var n;try{n=e.ownerDocument.selection.createRange()}catch(b){}return!n||n.parentElement()!=e?!1:n.compareEndPoints("StartToEnd",n)!=0},st=function(){var e=g("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),gt=null;function At(e){if(gt!=null)return gt;var n=A(e,g("span","x")),b=n.getBoundingClientRect(),v=O(n,0,1).getBoundingClientRect();return gt=Math.abs(b.left-v.left)>1}var bt={},ht={};function Ot(e,n){arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),bt[e]=n}function Bt(e,n){ht[e]=n}function mt(e){if(typeof e=="string"&&ht.hasOwnProperty(e))e=ht[e];else if(e&&typeof e.name=="string"&&ht.hasOwnProperty(e.name)){var n=ht[e.name];typeof n=="string"&&(n={name:n}),e=fe(n,e),e.name=n.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return mt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return mt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function St(e,n){n=mt(n);var b=bt[n.name];if(!b)return St(e,"text/plain");var v=b(e,n);if(ft.hasOwnProperty(n.name)){var R=ft[n.name];for(var K in R){if(!R.hasOwnProperty(K))continue;v.hasOwnProperty(K)&&(v["_"+K]=v[K]),v[K]=R[K]}}if(v.name=n.name,n.helperType&&(v.helperType=n.helperType),n.modeProps)for(var Y in n.modeProps)v[Y]=n.modeProps[Y];return v}var ft={};function _t(e,n){var b=ft.hasOwnProperty(e)?ft[e]:ft[e]={};H(n,b)}function Pt(e,n){if(n===!0)return n;if(e.copyState)return e.copyState(n);var b={};for(var v in n){var R=n[v];R instanceof Array&&(R=R.concat([])),b[v]=R}return b}function Nt(e,n){for(var b;e.innerMode&&!(b=e.innerMode(n),!b||b.mode==e);)n=b.state,e=b.mode;return b||{mode:e,state:n}}function zt(e,n,b){return e.startState?e.startState(n,b):!0}var Dt=function(e,n,b){this.pos=this.start=0,this.string=e,this.tabSize=n||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=b};Dt.prototype.eol=function(){return this.pos>=this.string.length},Dt.prototype.sol=function(){return this.pos==this.lineStart},Dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Dt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Dt.prototype.eat=function(e){var n=this.string.charAt(this.pos),b;if(typeof e=="string"?b=n==e:b=n&&(e.test?e.test(n):e(n)),b)return++this.pos,n},Dt.prototype.eatWhile=function(e){for(var n=this.pos;this.eat(e););return this.pos>n},Dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Dt.prototype.skipToEnd=function(){this.pos=this.string.length},Dt.prototype.skipTo=function(e){var n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0},Dt.prototype.backUp=function(e){this.pos-=e},Dt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=V(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.indentation=function(){return V(this.string,null,this.tabSize)-(this.lineStart?V(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.match=function(e,n,b){if(typeof e=="string"){var v=function(Y){return b?Y.toLowerCase():Y},R=this.string.substr(this.pos,e.length);if(v(R)==v(e))return n!==!1&&(this.pos+=e.length),!0}else{var K=this.string.slice(this.pos).match(e);return K&&K.index>0?null:(K&&n!==!1&&(this.pos+=K[0].length),K)}},Dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Dt.prototype.hideFirstChars=function(e,n){this.lineStart+=e;try{return n()}finally{this.lineStart-=e}},Dt.prototype.lookAhead=function(e){var n=this.lineOracle;return n&&n.lookAhead(e)},Dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ct(e,n){if(n-=e.first,n<0||n>=e.size)throw new Error("There is no line "+(n+e.first)+" in the document.");for(var b=e;!b.lines;)for(var v=0;;++v){var R=b.children[v],K=R.chunkSize();if(n<K){b=R;break}n-=K}return b.lines[n]}function Mr(e,n,b){var v=[],R=n.line;return e.iter(n.line,b.line+1,function(K){var Y=K.text;R==b.line&&(Y=Y.slice(0,b.ch)),R==n.line&&(Y=Y.slice(n.ch)),v.push(Y),++R}),v}function ti(e,n,b){var v=[];return e.iter(n,b,function(R){v.push(R.text)}),v}function Tr(e,n){var b=n-e.height;if(b)for(var v=e;v;v=v.parent)v.height+=b}function Ut(e){if(e.parent==null)return null;for(var n=e.parent,b=ye(n.lines,e),v=n.parent;v;n=v,v=v.parent)for(var R=0;!(v.children[R]==n);++R)b+=v.children[R].chunkSize();return b+n.first}function kr(e,n){var b=e.first;e:do{for(var v=0;v<e.children.length;++v){var R=e.children[v],K=R.height;if(n<K){e=R;continue e}n-=K,b+=R.chunkSize()}return b}while(!e.lines);for(var Y=0;Y<e.lines.length;++Y){var re=e.lines[Y],ie=re.height;if(n<ie)break;n-=ie}return b+Y}function zr(e,n){return n>=e.first&&n<e.first+e.size}function ri(e,n){return String(e.lineNumberFormatter(n+e.firstLineNumber))}function nt(e,n,b){if(b===void 0&&(b=null),!(this instanceof nt))return new nt(e,n,b);this.line=e,this.ch=n,this.sticky=b}function xt(e,n){return e.line-n.line||e.ch-n.ch}function Ht(e,n){return e.sticky==n.sticky&&xt(e,n)==0}function qt(e){return nt(e.line,e.ch)}function er(e,n){return xt(e,n)<0?n:e}function ir(e,n){return xt(e,n)<0?e:n}function q(e,n){return Math.max(e.first,Math.min(n,e.first+e.size-1))}function I(e,n){if(n.line<e.first)return nt(e.first,0);var b=e.first+e.size-1;return n.line>b?nt(b,Ct(e,b).text.length):B(n,Ct(e,n.line).text.length)}function B(e,n){var b=e.ch;return b==null||b>n?nt(e.line,n):b<0?nt(e.line,0):e}function Q(e,n){for(var b=[],v=0;v<n.length;v++)b[v]=I(e,n[v]);return b}var te=function(e,n){this.state=e,this.lookAhead=n},$=function(e,n,b,v){this.state=n,this.doc=e,this.line=b,this.maxLookAhead=v||0,this.baseTokens=null,this.baseTokenPos=1};$.prototype.lookAhead=function(e){var n=this.doc.getLine(this.line+e);return n!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),n},$.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},$.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},$.fromSaved=function(e,n,b){return n instanceof te?new $(e,Pt(e.mode,n.state),b,n.lookAhead):new $(e,Pt(e.mode,n),b)},$.prototype.save=function(e){var n=e!==!1?Pt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new te(n,this.maxLookAhead):n};function Ue(e,n,b,v){var R=[e.state.modeGen],K={};Vr(e,n.text,e.doc.mode,b,function(ue,Te){return R.push(ue,Te)},K,v);for(var Y=b.state,re=function(ue){b.baseTokens=R;var Te=e.state.overlays[ue],Pe=1,$e=0;b.state=!0,Vr(e,n.text,Te.mode,b,function(qe,rt){for(var ct=Pe;$e<qe;){var dt=R[Pe];dt>qe&&R.splice(Pe,1,qe,R[Pe+1],dt),Pe+=2,$e=Math.min(qe,dt)}if(!rt)return;if(Te.opaque)R.splice(ct,Pe-ct,qe,"overlay "+rt),Pe=ct+2;else for(;ct<Pe;ct+=2){var vt=R[ct+1];R[ct+1]=(vt?vt+" ":"")+"overlay "+rt}},K),b.state=Y,b.baseTokens=null,b.baseTokenPos=1},ie=0;ie<e.state.overlays.length;++ie)re(ie);return{styles:R,classes:K.bgClass||K.textClass?K:null}}function at(e,n,b){if(!n.styles||n.styles[0]!=e.state.modeGen){var v=pt(e,Ut(n)),R=n.text.length>e.options.maxHighlightLength&&Pt(e.doc.mode,v.state),K=Ue(e,n,v);R&&(v.state=R),n.stateAfter=v.save(!R),n.styles=K.styles,K.classes?n.styleClasses=K.classes:n.styleClasses&&(n.styleClasses=null),b===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return n.styles}function pt(e,n,b){var v=e.doc,R=e.display;if(!v.mode.startState)return new $(v,!0,n);var K=gr(e,n,b),Y=K>v.first&&Ct(v,K-1).stateAfter,re=Y?$.fromSaved(v,Y,K):new $(v,zt(v.mode),K);return v.iter(K,n,function(ie){wt(e,ie.text,re);var ue=re.line;ie.stateAfter=ue==n-1||ue%5==0||ue>=R.viewFrom&&ue<R.viewTo?re.save():null,re.nextLine()}),b&&(v.modeFrontier=re.line),re}function wt(e,n,b,v){var R=e.doc.mode,K=new Dt(n,e.options.tabSize,b);for(K.start=K.pos=v||0,n==""&&lt(R,b.state);!K.eol();)It(R,K,b.state),K.start=K.pos}function lt(e,n){if(e.blankLine)return e.blankLine(n);if(!e.innerMode)return;var b=Nt(e,n);if(b.mode.blankLine)return b.mode.blankLine(b.state)}function It(e,n,b,v){for(var R=0;R<10;R++){v&&(v[0]=Nt(e,b).mode);var K=e.token(n,b);if(n.pos>n.start)return K}throw new Error("Mode "+e.name+" failed to advance stream.")}var jt=function(e,n,b){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=n||null,this.state=b};function nr(e,n,b,v){var R=e.doc,K=R.mode,Y;n=I(R,n);var re=Ct(R,n.line),ie=pt(e,n.line,b),ue=new Dt(re.text,e.options.tabSize,ie),Te;for(v&&(Te=[]);(v||ue.pos<n.ch)&&!ue.eol();)ue.start=ue.pos,Y=It(K,ue,ie.state),v&&Te.push(new jt(ue,Y,Pt(R.mode,ie.state)));return v?Te:new jt(ue,Y,ie.state)}function Gr(e,n){if(e)for(;;){var b=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!b)break;e=e.slice(0,b.index)+e.slice(b.index+b[0].length);var v=b[1]?"bgClass":"textClass";n[v]==null?n[v]=b[2]:new RegExp("(?:^|\\s)"+b[2]+"(?:$|\\s)").test(n[v])||(n[v]+=" "+b[2])}return e}function Vr(e,n,b,v,R,K,Y){var re=b.flattenSpans;re==null&&(re=e.options.flattenSpans);var ie=0,ue=null,Te=new Dt(n,e.options.tabSize,v),Pe,$e=e.options.addModeClass&&[null];for(n==""&&Gr(lt(b,v.state),K);!Te.eol();){if(Te.pos>e.options.maxHighlightLength?(re=!1,Y&&wt(e,n,v,Te.pos),Te.pos=n.length,Pe=null):Pe=Gr(It(b,Te,v.state,$e),K),$e){var qe=$e[0].name;qe&&(Pe="m-"+(Pe?qe+" "+Pe:qe))}if(!re||ue!=Pe){for(;ie<Te.start;)ie=Math.min(Te.start,ie+5e3),R(ie,ue);ue=Pe}Te.start=Te.pos}for(;ie<Te.pos;){var rt=Math.min(Te.pos,ie+5e3);R(rt,ue),ie=rt}}function gr(e,n,b){for(var v,R,K=e.doc,Y=b?-1:n-(e.doc.mode.innerMode?1e3:100),re=n;re>Y;--re){if(re<=K.first)return K.first;var ie=Ct(K,re-1),ue=ie.stateAfter;if(ue&&(!b||re+(ue instanceof te?ue.lookAhead:0)<=K.modeFrontier))return re;var Te=V(ie.text,null,e.options.tabSize);(R==null||v>Te)&&(R=re-1,v=Te)}return R}function $r(e,n){if(e.modeFrontier=Math.min(e.modeFrontier,n),e.highlightFrontier<n-10)return;for(var b=e.first,v=n-1;v>b;v--){var R=Ct(e,v).stateAfter;if(R&&(!(R instanceof te)||v+R.lookAhead<n)){b=v+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,b)}var Xi=!1,Or=!1;function Yr(){Xi=!0}function Hr(){Or=!0}function yi(e,n,b){this.marker=e,this.from=n,this.to=b}function ii(e,n){if(e)for(var b=0;b<e.length;++b){var v=e[b];if(v.marker==n)return v}}function pi(e,n){for(var b,v=0;v<e.length;++v)e[v]!=n&&(b||(b=[])).push(e[v]);return b}function ui(e,n){e.markedSpans=e.markedSpans?e.markedSpans.concat([n]):[n],n.marker.attachLine(e)}function hn(e,n,b){var v;if(e)for(var R=0;R<e.length;++R){var K=e[R],Y=K.marker,re=K.from==null||(Y.inclusiveLeft?K.from<=n:K.from<n);if(re||K.from==n&&Y.type=="bookmark"&&(!b||!K.marker.insertLeft)){var ie=K.to==null||(Y.inclusiveRight?K.to>=n:K.to>n);(v||(v=[])).push(new yi(Y,K.from,ie?null:K.to))}}return v}function ji(e,n,b){var v;if(e)for(var R=0;R<e.length;++R){var K=e[R],Y=K.marker,re=K.to==null||(Y.inclusiveRight?K.to>=n:K.to>n);if(re||K.from==n&&Y.type=="bookmark"&&(!b||K.marker.insertLeft)){var ie=K.from==null||(Y.inclusiveLeft?K.from<=n:K.from<n);(v||(v=[])).push(new yi(Y,ie?null:K.from-n,K.to==null?null:K.to-n))}}return v}function ni(e,n){if(n.full)return null;var b=zr(e,n.from.line)&&Ct(e,n.from.line).markedSpans,v=zr(e,n.to.line)&&Ct(e,n.to.line).markedSpans;if(!b&&!v)return null;var R=n.from.ch,K=n.to.ch,Y=xt(n.from,n.to)==0,re=hn(b,R,Y),ie=ji(v,K,Y),ue=n.text.length==1,Te=le(n.text).length+(ue?R:0);if(re)for(var Pe=0;Pe<re.length;++Pe){var $e=re[Pe];if($e.to==null){var qe=ii(ie,$e.marker);qe?ue&&($e.to=qe.to==null?null:qe.to+Te):$e.to=R}}if(ie)for(var rt=0;rt<ie.length;++rt){var ct=ie[rt];if(ct.to!=null&&(ct.to+=Te),ct.from==null){var dt=ii(re,ct.marker);dt||(ct.from=Te,ue&&(re||(re=[])).push(ct))}else ct.from+=Te,ue&&(re||(re=[])).push(ct)}re&&(re=Qr(re)),ie&&ie!=re&&(ie=Qr(ie));var vt=[re];if(!ue){var Et=n.text.length-2,yt;if(Et>0&&re)for(var Tt=0;Tt<re.length;++Tt)re[Tt].to==null&&(yt||(yt=[])).push(new yi(re[Tt].marker,null,null));for(var Mt=0;Mt<Et;++Mt)vt.push(yt);vt.push(ie)}return vt}function Qr(e){for(var n=0;n<e.length;++n){var b=e[n];b.from!=null&&b.from==b.to&&b.marker.clearWhenEmpty!==!1&&e.splice(n--,1)}return e.length?e:null}function ki(e,n,b){var v=null;if(e.iter(n.line,b.line+1,function(qe){if(qe.markedSpans)for(var rt=0;rt<qe.markedSpans.length;++rt){var ct=qe.markedSpans[rt].marker;ct.readOnly&&(!v||ye(v,ct)==-1)&&(v||(v=[])).push(ct)}}),!v)return null;for(var R=[{from:n,to:b}],K=0;K<v.length;++K)for(var Y=v[K],re=Y.find(0),ie=0;ie<R.length;++ie){var ue=R[ie];if(xt(ue.to,re.from)<0||xt(ue.from,re.to)>0)continue;var Te=[ie,1],Pe=xt(ue.from,re.from),$e=xt(ue.to,re.to);(Pe<0||!Y.inclusiveLeft&&!Pe)&&Te.push({from:ue.from,to:re.from}),($e>0||!Y.inclusiveRight&&!$e)&&Te.push({from:re.to,to:ue.to}),R.splice.apply(R,Te),ie+=Te.length-3}return R}function Ri(e){var n=e.markedSpans;if(!n)return;for(var b=0;b<n.length;++b)n[b].marker.detachLine(e);e.markedSpans=null}function dn(e,n){if(!n)return;for(var b=0;b<n.length;++b)n[b].marker.attachLine(e);e.markedSpans=n}function lr(e){return e.inclusiveLeft?-1:0}function Yt(e){return e.inclusiveRight?1:0}function Sr(e,n){var b=e.lines.length-n.lines.length;if(b!=0)return b;var v=e.find(),R=n.find(),K=xt(v.from,R.from)||lr(e)-lr(n);if(K)return-K;var Y=xt(v.to,R.to)||Yt(e)-Yt(n);return Y||n.id-e.id}function Vt(e,n){var b=Or&&e.markedSpans,v;if(b)for(var R=void 0,K=0;K<b.length;++K)R=b[K],R.marker.collapsed&&(n?R.from:R.to)==null&&(!v||Sr(v,R.marker)<0)&&(v=R.marker);return v}function dr(e){return Vt(e,!0)}function $t(e){return Vt(e,!1)}function ci(e,n){var b=Or&&e.markedSpans,v;if(b)for(var R=0;R<b.length;++R){var K=b[R];K.marker.collapsed&&(K.from==null||K.from<n)&&(K.to==null||K.to>n)&&(!v||Sr(v,K.marker)<0)&&(v=K.marker)}return v}function cr(e,n,b,v,R){var K=Ct(e,n),Y=Or&&K.markedSpans;if(Y)for(var re=0;re<Y.length;++re){var ie=Y[re];if(!ie.marker.collapsed)continue;var ue=ie.marker.find(0),Te=xt(ue.from,b)||lr(ie.marker)-lr(R),Pe=xt(ue.to,v)||Yt(ie.marker)-Yt(R);if(Te>=0&&Pe<=0||Te<=0&&Pe>=0)continue;if(Te<=0&&(ie.marker.inclusiveRight&&R.inclusiveLeft?xt(ue.to,b)>=0:xt(ue.to,b)>0)||Te>=0&&(ie.marker.inclusiveRight&&R.inclusiveLeft?xt(ue.from,v)<=0:xt(ue.from,v)<0))return!0}}function Ir(e){for(var n;n=dr(e);)e=n.find(-1,!0).line;return e}function Wi(e){for(var n;n=$t(e);)e=n.find(1,!0).line;return e}function zi(e){for(var n,b;n=$t(e);)e=n.find(1,!0).line,(b||(b=[])).push(e);return b}function _i(e,n){var b=Ct(e,n),v=Ir(b);return b==v?n:Ut(v)}function Un(e,n){if(n>e.lastLine())return n;var b=Ct(e,n),v;if(!Xr(e,b))return n;for(;v=$t(b);)b=v.find(1,!0).line;return Ut(b)+1}function Xr(e,n){var b=Or&&n.markedSpans;if(b)for(var v=void 0,R=0;R<b.length;++R){if(v=b[R],!v.marker.collapsed)continue;if(v.from==null)return!0;if(v.marker.widgetNode)continue;if(v.from==0&&v.marker.inclusiveLeft&&fn(e,n,v))return!0}}function fn(e,n,b){if(b.to==null){var v=b.marker.find(1,!0);return fn(e,v.line,ii(v.line.markedSpans,b.marker))}if(b.marker.inclusiveRight&&b.to==n.text.length)return!0;for(var R=void 0,K=0;K<n.markedSpans.length;++K)if(R=n.markedSpans[K],R.marker.collapsed&&!R.marker.widgetNode&&R.from==b.to&&(R.to==null||R.to!=b.from)&&(R.marker.inclusiveLeft||b.marker.inclusiveRight)&&fn(e,n,R))return!0}function oi(e){e=Ir(e);for(var n=0,b=e.parent,v=0;v<b.lines.length;++v){var R=b.lines[v];if(R==e)break;n+=R.height}for(var K=b.parent;K;b=K,K=b.parent)for(var Y=0;Y<K.children.length;++Y){var re=K.children[Y];if(re==b)break;n+=re.height}return n}function Gi(e){if(e.height==0)return 0;for(var n=e.text.length,b,v=e;b=dr(v);){var R=b.find(0,!0);v=R.from.line,n+=R.from.ch-R.to.ch}for(v=e;b=$t(v);){var K=b.find(0,!0);n-=v.text.length-K.from.ch,v=K.to.line,n+=v.text.length-K.to.ch}return n}function Kn(e){var n=e.display,b=e.doc;n.maxLine=Ct(b,b.first),n.maxLineLength=Gi(n.maxLine),n.maxLineChanged=!0,b.iter(function(v){var R=Gi(v);R>n.maxLineLength&&(n.maxLineLength=R,n.maxLine=v)})}var Di=function(e,n,b){this.text=e,dn(this,n),this.height=b?b(this):1};Di.prototype.lineNo=function(){return Ut(this)},be(Di);function Zo(e,n,b,v){e.text=n,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ri(e),dn(e,b);var R=v?v(e):1;R!=e.height&&Tr(e,R)}function co(e){e.parent=null,Ri(e)}var Lt={},Ft={};function Rt(e,n){if(!e||/^\s*$/.test(e))return null;var b=n.addModeClass?Ft:Lt;return b[e]||(b[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,n){var b=P("span",null,null,p?"padding-right: .1px":null),v={pre:P("pre",[b],"CodeMirror-line"),content:b,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};n.measure={};for(var R=0;R<=(n.rest?n.rest.length:0);R++){var K=R?n.rest[R-1]:n.line,Y=void 0;v.pos=0,v.addToken=tr,je(e.display.measure)&&(Y=Je(K,e.doc.direction))&&(v.addToken=fr(v.addToken,Y)),v.map=[];var re=n!=e.display.externalMeasured&&Ut(K);Wt(K,v,at(e,K,re)),K.styleClasses&&(K.styleClasses.bgClass&&(v.bgClass=N(K.styleClasses.bgClass,v.bgClass||"")),K.styleClasses.textClass&&(v.textClass=N(K.styleClasses.textClass,v.textClass||""))),v.map.length==0&&v.map.push(0,0,v.content.appendChild(de(e.display.measure))),R==0?(n.measure.map=v.map,n.measure.cache={}):((n.measure.maps||(n.measure.maps=[])).push(v.map),(n.measure.caches||(n.measure.caches=[])).push({}))}if(p){var ie=v.content.lastChild;(/\bcm-tab\b/.test(ie.className)||ie.querySelector&&ie.querySelector(".cm-tab"))&&(v.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,n.line,v.pre),v.pre.className&&(v.textClass=N(v.pre.className,v.textClass||"")),v}function Qt(e){var n=g("span","\u2022","cm-invalidchar");return n.title="\\u"+e.charCodeAt(0).toString(16),n.setAttribute("aria-label",n.title),n}function tr(e,n,b,v,R,K,Y){if(!n)return;var re=e.splitSpaces?Gt(n,e.trailingSpace):n,ie=e.cm.state.specialChars,ue=!1,Te;if(!ie.test(n))e.col+=n.length,Te=document.createTextNode(re),e.map.push(e.pos,e.pos+n.length,Te),S&&_<9&&(ue=!0),e.pos+=n.length;else{Te=document.createDocumentFragment();for(var Pe=0;;){ie.lastIndex=Pe;var $e=ie.exec(n),qe=$e?$e.index-Pe:n.length-Pe;if(qe){var rt=document.createTextNode(re.slice(Pe,Pe+qe));S&&_<9?Te.appendChild(g("span",[rt])):Te.appendChild(rt),e.map.push(e.pos,e.pos+qe,rt),e.col+=qe,e.pos+=qe}if(!$e)break;Pe+=qe+1;var ct=void 0;if($e[0]==" "){var dt=e.cm.options.tabSize,vt=dt-e.col%dt;ct=Te.appendChild(g("span",xe(vt),"cm-tab")),ct.setAttribute("role","presentation"),ct.setAttribute("cm-text"," "),e.col+=vt}else $e[0]=="\r"||$e[0]==`
`?(ct=Te.appendChild(g("span",$e[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ct.setAttribute("cm-text",$e[0]),e.col+=1):(ct=e.cm.options.specialCharPlaceholder($e[0]),ct.setAttribute("cm-text",$e[0]),S&&_<9?Te.appendChild(g("span",[ct])):Te.appendChild(ct),e.col+=1);e.map.push(e.pos,e.pos+1,ct),e.pos++}}if(e.trailingSpace=re.charCodeAt(n.length-1)==32,b||v||R||ue||K||Y){var Et=b||"";v&&(Et+=v),R&&(Et+=R);var yt=g("span",[Te],Et,K);if(Y)for(var Tt in Y)Y.hasOwnProperty(Tt)&&Tt!="style"&&Tt!="class"&&yt.setAttribute(Tt,Y[Tt]);return e.content.appendChild(yt)}e.content.appendChild(Te)}function Gt(e,n){if(e.length>1&&!/ /.test(e))return e;for(var b=n,v="",R=0;R<e.length;R++){var K=e.charAt(R);K==" "&&b&&(R==e.length-1||e.charCodeAt(R+1)==32)&&(K="\xA0"),v+=K,b=K==" "}return v}function fr(e,n){return function(b,v,R,K,Y,re,ie){R=R?R+" cm-force-border":"cm-force-border";for(var ue=b.pos,Te=ue+v.length;;){for(var Pe=void 0,$e=0;$e<n.length&&!(Pe=n[$e],Pe.to>ue&&Pe.from<=ue);$e++);if(Pe.to>=Te)return e(b,v,R,K,Y,re,ie);e(b,v.slice(0,Pe.to-ue),R,K,null,re,ie),K=null,v=v.slice(Pe.to-ue),ue=Pe.to}}}function Pr(e,n,b,v){var R=!v&&b.widgetNode;R&&e.map.push(e.pos,e.pos+n,R),!v&&e.cm.display.input.needsContentAttribute&&(R||(R=e.content.appendChild(document.createElement("span"))),R.setAttribute("cm-marker",b.id)),R&&(e.cm.display.input.setUneditable(R),e.content.appendChild(R)),e.pos+=n,e.trailingSpace=!1}function Wt(e,n,b){var v=e.markedSpans,R=e.text,K=0;if(!v){for(var Y=1;Y<b.length;Y+=2)n.addToken(n,R.slice(K,K=b[Y]),Rt(b[Y+1],n.cm.options));return}for(var re=R.length,ie=0,ue=1,Te="",Pe,$e,qe=0,rt,ct,dt,vt,Et;;){if(qe==ie){rt=ct=dt=$e="",Et=null,vt=null,qe=Infinity;for(var yt=[],Tt=void 0,Mt=0;Mt<v.length;++Mt){var kt=v[Mt],Kt=kt.marker;if(Kt.type=="bookmark"&&kt.from==ie&&Kt.widgetNode)yt.push(Kt);else if(kt.from<=ie&&(kt.to==null||kt.to>ie||Kt.collapsed&&kt.to==ie&&kt.from==ie)){if(kt.to!=null&&kt.to!=ie&&qe>kt.to&&(qe=kt.to,ct=""),Kt.className&&(rt+=" "+Kt.className),Kt.css&&($e=($e?$e+";":"")+Kt.css),Kt.startStyle&&kt.from==ie&&(dt+=" "+Kt.startStyle),Kt.endStyle&&kt.to==qe&&(Tt||(Tt=[])).push(Kt.endStyle,kt.to),Kt.title&&((Et||(Et={})).title=Kt.title),Kt.attributes)for(var or in Kt.attributes)(Et||(Et={}))[or]=Kt.attributes[or];Kt.collapsed&&(!vt||Sr(vt.marker,Kt)<0)&&(vt=kt)}else kt.from>ie&&qe>kt.from&&(qe=kt.from)}if(Tt)for(var xr=0;xr<Tt.length;xr+=2)Tt[xr+1]==qe&&(ct+=" "+Tt[xr]);if(!vt||vt.from==ie)for(var sr=0;sr<yt.length;++sr)Pr(n,0,yt[sr]);if(vt&&(vt.from||0)==ie){if(Pr(n,(vt.to==null?re+1:vt.to)-ie,vt.marker,vt.from==null),vt.to==null)return;vt.to==ie&&(vt=!1)}}if(ie>=re)break;for(var Wr=Math.min(re,qe);;){if(Te){var Br=ie+Te.length;if(!vt){var pr=Br>Wr?Te.slice(0,Wr-ie):Te;n.addToken(n,pr,Pe?Pe+rt:rt,dt,ie+pr.length==qe?ct:"",$e,Et)}if(Br>=Wr){Te=Te.slice(Wr-ie),ie=Wr;break}ie=Br,dt=""}Te=R.slice(K,K=b[ue++]),Pe=Rt(b[ue++],n.cm.options)}}}function bi(e,n,b){this.line=n,this.rest=zi(n),this.size=this.rest?Ut(le(this.rest))-b+1:1,this.node=this.text=null,this.hidden=Xr(e,n)}function Zt(e,n,b){for(var v=[],R,K=n;K<b;K=R){var Y=new bi(e.doc,Ct(e.doc,K),K);R=K+Y.size,v.push(Y)}return v}var yr=null;function Jr(e){yr?yr.ops.push(e):e.ownsGroup=yr={ops:[e],delayedCallbacks:[]}}function ei(e){var n=e.delayedCallbacks,b=0;do{for(;b<n.length;b++)n[b].call(null);for(var v=0;v<e.ops.length;v++){var R=e.ops[v];if(R.cursorActivityHandlers)for(;R.cursorActivityCalled<R.cursorActivityHandlers.length;)R.cursorActivityHandlers[R.cursorActivityCalled++].call(null,R.cm)}}while(b<n.length)}function Hn(e,n){var b=e.ownsGroup;if(!b)return;try{ei(b)}finally{yr=null,n(b)}}var pn=null;function Cr(e,n){var b=it(e,n);if(!b.length)return;var v=Array.prototype.slice.call(arguments,2),R;yr?R=yr.delayedCallbacks:pn?R=pn:(R=pn=[],setTimeout(Ms,0));for(var K=function(re){R.push(function(){return b[re].apply(null,v)})},Y=0;Y<b.length;++Y)K(Y)}function Ms(){var e=pn;pn=null;for(var n=0;n<e.length;++n)e[n]()}function qo(e,n,b,v){for(var R=0;R<n.changes.length;R++){var K=n.changes[R];K=="text"?Is(e,n):K=="gutter"?Jo(e,n,b,v):K=="class"?ho(e,n):K=="widget"&&Ps(e,n,v)}n.changes=null}function mn(e){return e.node==e.text&&(e.node=g("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),S&&_<8&&(e.node.style.zIndex=2)),e.node}function Os(e,n){var b=n.bgClass?n.bgClass+" "+(n.line.bgClass||""):n.line.bgClass;if(b&&(b+=" CodeMirror-linebackground"),n.background)b?n.background.className=b:(n.background.parentNode.removeChild(n.background),n.background=null);else if(b){var v=mn(n);n.background=v.insertBefore(g("div",null,b),v.firstChild),e.display.input.setUneditable(n.background)}}function $o(e,n){var b=e.display.externalMeasured;return b&&b.line==n.line?(e.display.externalMeasured=null,n.measure=b.measure,b.built):Xt(e,n)}function Is(e,n){var b=n.text.className,v=$o(e,n);n.text==n.node&&(n.node=v.pre),n.text.parentNode.replaceChild(v.pre,n.text),n.text=v.pre,v.bgClass!=n.bgClass||v.textClass!=n.textClass?(n.bgClass=v.bgClass,n.textClass=v.textClass,ho(e,n)):b&&(n.text.className=b)}function ho(e,n){Os(e,n),n.line.wrapClass?mn(n).className=n.line.wrapClass:n.node!=n.text&&(n.node.className="");var b=n.textClass?n.textClass+" "+(n.line.textClass||""):n.line.textClass;n.text.className=b||""}function Jo(e,n,b,v){if(n.gutter&&(n.node.removeChild(n.gutter),n.gutter=null),n.gutterBackground&&(n.node.removeChild(n.gutterBackground),n.gutterBackground=null),n.line.gutterClass){var R=mn(n);n.gutterBackground=g("div",null,"CodeMirror-gutter-background "+n.line.gutterClass,"left: "+(e.options.fixedGutter?v.fixedPos:-v.gutterTotalWidth)+"px; width: "+v.gutterTotalWidth+"px"),e.display.input.setUneditable(n.gutterBackground),R.insertBefore(n.gutterBackground,n.text)}var K=n.line.gutterMarkers;if(e.options.lineNumbers||K){var Y=mn(n),re=n.gutter=g("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?v.fixedPos:-v.gutterTotalWidth)+"px");if(e.display.input.setUneditable(re),Y.insertBefore(re,n.text),n.line.gutterClass&&(re.className+=" "+n.line.gutterClass),e.options.lineNumbers&&(!K||!K["CodeMirror-linenumbers"])&&(n.lineNumber=re.appendChild(g("div",ri(e.options,b),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+v.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),K)for(var ie=0;ie<e.display.gutterSpecs.length;++ie){var ue=e.display.gutterSpecs[ie].className,Te=K.hasOwnProperty(ue)&&K[ue];Te&&re.appendChild(g("div",[Te],"CodeMirror-gutter-elt","left: "+v.gutterLeft[ue]+"px; width: "+v.gutterWidth[ue]+"px"))}}}function Ps(e,n,b){n.alignable&&(n.alignable=null);for(var v=x("CodeMirror-linewidget"),R=n.node.firstChild,K=void 0;R;R=K)K=R.nextSibling,v.test(R.className)&&n.node.removeChild(R);ea(e,n,b)}function Fs(e,n,b,v){var R=$o(e,n);return n.text=n.node=R.pre,R.bgClass&&(n.bgClass=R.bgClass),R.textClass&&(n.textClass=R.textClass),ho(e,n),Jo(e,n,b,v),ea(e,n,v),n.node}function ea(e,n,b){if(ta(e,n.line,n,b,!0),n.rest)for(var v=0;v<n.rest.length;v++)ta(e,n.rest[v],n,b,!1)}function ta(e,n,b,v,R){if(!n.widgets)return;for(var K=mn(b),Y=0,re=n.widgets;Y<re.length;++Y){var ie=re[Y],ue=g("div",[ie.node],"CodeMirror-linewidget"+(ie.className?" "+ie.className:""));ie.handleMouseEvents||ue.setAttribute("cm-ignore-events","true"),Ns(ie,ue,b,v),e.display.input.setUneditable(ue),R&&ie.above?K.insertBefore(ue,b.gutter||b.text):K.appendChild(ue),Cr(ie,"redraw")}}function Ns(e,n,b,v){if(e.noHScroll){(b.alignable||(b.alignable=[])).push(n);var R=v.wrapperWidth;n.style.left=v.fixedPos+"px",e.coverGutter||(R-=v.gutterTotalWidth,n.style.paddingLeft=v.gutterTotalWidth+"px"),n.style.width=R+"px"}e.coverGutter&&(n.style.zIndex=5,n.style.position="relative",e.noHScroll||(n.style.marginLeft=-v.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var n=e.doc.cm;if(!n)return 0;if(!F(document.body,e.node)){var b="position: relative;";e.coverGutter&&(b+="margin-left: -"+n.display.gutters.offsetWidth+"px;"),e.noHScroll&&(b+="width: "+n.display.wrapper.clientWidth+"px;"),A(n.display.measure,g("div",[e.node],null,b))}return e.height=e.node.parentNode.offsetHeight}function mi(e,n){for(var b=Xe(n);b!=e.wrapper;b=b.parentNode)if(!b||b.nodeType==1&&b.getAttribute("cm-ignore-events")=="true"||b.parentNode==e.sizer&&b!=e.mover)return!0}function Xn(e){return e.lineSpace.offsetTop}function fo(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ra(e){if(e.cachedPaddingH)return e.cachedPaddingH;var n=A(e.measure,g("pre","x","CodeMirror-line-like")),b=window.getComputedStyle?window.getComputedStyle(n):n.currentStyle,v={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};return!isNaN(v.left)&&!isNaN(v.right)&&(e.cachedPaddingH=v),v}function hi(e){return Le-e.display.nativeBarWidth}function Mi(e){return e.display.scroller.clientWidth-hi(e)-e.display.barWidth}function po(e){return e.display.scroller.clientHeight-hi(e)-e.display.barHeight}function Bs(e,n,b){var v=e.options.lineWrapping,R=v&&Mi(e);if(!n.measure.heights||v&&n.measure.width!=R){var K=n.measure.heights=[];if(v){n.measure.width=R;for(var Y=n.text.firstChild.getClientRects(),re=0;re<Y.length-1;re++){var ie=Y[re],ue=Y[re+1];Math.abs(ie.bottom-ue.bottom)>2&&K.push((ie.bottom+ue.top)/2-b.top)}}K.push(b.bottom-b.top)}}function ia(e,n,b){if(e.line==n)return{map:e.measure.map,cache:e.measure.cache};for(var v=0;v<e.rest.length;v++)if(e.rest[v]==n)return{map:e.measure.maps[v],cache:e.measure.caches[v]};for(var R=0;R<e.rest.length;R++)if(Ut(e.rest[R])>b)return{map:e.measure.maps[R],cache:e.measure.caches[R],before:!0}}function Us(e,n){n=Ir(n);var b=Ut(n),v=e.display.externalMeasured=new bi(e.doc,n,b);v.lineN=b;var R=v.built=Xt(e,v);return v.text=R.pre,A(e.display.lineMeasure,R.pre),v}function na(e,n,b,v){return di(e,Vi(e,n),b,v)}function mo(e,n){if(n>=e.display.viewFrom&&n<e.display.viewTo)return e.display.view[Pi(e,n)];var b=e.display.externalMeasured;if(b&&n>=b.lineN&&n<b.lineN+b.size)return b}function Vi(e,n){var b=Ut(n),v=mo(e,b);v&&!v.text?v=null:v&&v.changes&&(qo(e,v,b,xo(e)),e.curOp.forceUpdate=!0),v||(v=Us(e,n));var R=ia(v,n,b);return{line:n,view:v,rect:null,map:R.map,cache:R.cache,before:R.before,hasHeights:!1}}function di(e,n,b,v,R){n.before&&(b=-1);var K=b+(v||""),Y;return n.cache.hasOwnProperty(K)?Y=n.cache[K]:(n.rect||(n.rect=n.view.text.getBoundingClientRect()),n.hasHeights||(Bs(e,n.view,n.rect),n.hasHeights=!0),Y=Hs(e,n,b,v),Y.bogus||(n.cache[K]=Y)),{left:Y.left,right:Y.right,top:R?Y.rtop:Y.top,bottom:R?Y.rbottom:Y.bottom}}var oa={left:0,right:0,top:0,bottom:0};function aa(e,n,b){for(var v,R,K,Y,re,ie,ue=0;ue<e.length;ue+=3)if(re=e[ue],ie=e[ue+1],n<re?(R=0,K=1,Y="left"):n<ie?(R=n-re,K=R+1):(ue==e.length-3||n==ie&&e[ue+3]>n)&&(K=ie-re,R=K-1,n>=ie&&(Y="right")),R!=null){if(v=e[ue+2],re==ie&&b==(v.insertLeft?"left":"right")&&(Y=b),b=="left"&&R==0)for(;ue&&e[ue-2]==e[ue-3]&&e[ue-1].insertLeft;)v=e[(ue-=3)+2],Y="left";if(b=="right"&&R==ie-re)for(;ue<e.length-3&&e[ue+3]==e[ue+4]&&!e[ue+5].insertLeft;)v=e[(ue+=3)+2],Y="right";break}return{node:v,start:R,end:K,collapse:Y,coverStart:re,coverEnd:ie}}function Ks(e,n){var b=oa;if(n=="left")for(var v=0;v<e.length&&!((b=e[v]).left!=b.right);v++);else for(var R=e.length-1;R>=0&&!((b=e[R]).left!=b.right);R--);return b}function Hs(e,n,b,v){var R=aa(n.map,b,v),K=R.node,Y=R.start,re=R.end,ie=R.collapse,ue;if(K.nodeType==3){for(var Te=0;Te<4;Te++){for(;Y&&Fe(n.line.text.charAt(R.coverStart+Y));)--Y;for(;R.coverStart+re<R.coverEnd&&Fe(n.line.text.charAt(R.coverStart+re));)++re;if(S&&_<9&&Y==0&&re==R.coverEnd-R.coverStart?ue=K.parentNode.getBoundingClientRect():ue=Ks(O(K,Y,re).getClientRects(),v),ue.left||ue.right||Y==0)break;re=Y,Y=Y-1,ie="right"}S&&_<11&&(ue=Xs(e.display.measure,ue))}else{Y>0&&(ie=v="right");var Pe;e.options.lineWrapping&&(Pe=K.getClientRects()).length>1?ue=Pe[v=="right"?Pe.length-1:0]:ue=K.getBoundingClientRect()}if(S&&_<9&&!Y&&(!ue||!ue.left&&!ue.right)){var $e=K.parentNode.getClientRects()[0];$e?ue={left:$e.left,right:$e.left+Qi(e.display),top:$e.top,bottom:$e.bottom}:ue=oa}for(var qe=ue.top-n.rect.top,rt=ue.bottom-n.rect.top,ct=(qe+rt)/2,dt=n.view.measure.heights,vt=0;vt<dt.length-1&&!(ct<dt[vt]);vt++);var Et=vt?dt[vt-1]:0,yt=dt[vt],Tt={left:(ie=="right"?ue.right:ue.left)-n.rect.left,right:(ie=="left"?ue.left:ue.right)-n.rect.left,top:Et,bottom:yt};return!ue.left&&!ue.right&&(Tt.bogus=!0),e.options.singleCursorHeightPerLine||(Tt.rtop=qe,Tt.rbottom=rt),Tt}function Xs(e,n){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!At(e))return n;var b=screen.logicalXDPI/screen.deviceXDPI,v=screen.logicalYDPI/screen.deviceYDPI;return{left:n.left*b,right:n.right*b,top:n.top*v,bottom:n.bottom*v}}function sa(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var n=0;n<e.rest.length;n++)e.measure.caches[n]={}}function la(e){e.display.externalMeasure=null,w(e.display.lineMeasure);for(var n=0;n<e.display.view.length;n++)sa(e.display.view[n])}function vn(e){la(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function ua(){return o&&i?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ca(){return o&&i?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function go(e){var n=0;if(e.widgets)for(var b=0;b<e.widgets.length;++b)e.widgets[b].above&&(n+=gn(e.widgets[b]));return n}function jn(e,n,b,v,R){if(!R){var K=go(n);b.top+=K,b.bottom+=K}if(v=="line")return b;v||(v="local");var Y=oi(n);if(v=="local"?Y+=Xn(e.display):Y-=e.display.viewOffset,v=="page"||v=="window"){var re=e.display.lineSpace.getBoundingClientRect();Y+=re.top+(v=="window"?0:ca());var ie=re.left+(v=="window"?0:ua());b.left+=ie,b.right+=ie}return b.top+=Y,b.bottom+=Y,b}function ha(e,n,b){if(b=="div")return n;var v=n.left,R=n.top;if(b=="page")v-=ua(),R-=ca();else if(b=="local"||!b){var K=e.display.sizer.getBoundingClientRect();v+=K.left,R+=K.top}var Y=e.display.lineSpace.getBoundingClientRect();return{left:v-Y.left,top:R-Y.top}}function vo(e,n,b,v,R){return v||(v=Ct(e.doc,n.line)),jn(e,v,na(e,v,n.ch,R),b)}function ai(e,n,b,v,R,K){v=v||Ct(e.doc,n.line),R||(R=Vi(e,v));function Y(rt,ct){var dt=di(e,R,rt,ct?"right":"left",K);return ct?dt.left=dt.right:dt.right=dt.left,jn(e,v,dt,b)}var re=Je(v,e.doc.direction),ie=n.ch,ue=n.sticky;if(ie>=v.text.length?(ie=v.text.length,ue="before"):ie<=0&&(ie=0,ue="after"),!re)return Y(ue=="before"?ie-1:ie,ue=="before");function Te(rt,ct,dt){var vt=re[ct],Et=vt.level==1;return Y(dt?rt-1:rt,Et!=dt)}var Pe=ae(re,ie,ue),$e=_e,qe=Te(ie,Pe,ue=="before");return $e!=null&&(qe.other=Te(ie,$e,ue!="before")),qe}function da(e,n){var b=0;n=I(e.doc,n),e.options.lineWrapping||(b=Qi(e.display)*n.ch);var v=Ct(e.doc,n.line),R=oi(v)+Xn(e.display);return{left:b,right:b,top:R,bottom:R+v.height}}function yo(e,n,b,v,R){var K=nt(e,n,b);return K.xRel=R,v&&(K.outside=v),K}function _o(e,n,b){var v=e.doc;if(b+=e.display.viewOffset,b<0)return yo(v.first,0,null,-1,-1);var R=kr(v,b),K=v.first+v.size-1;if(R>K)return yo(v.first+v.size-1,Ct(v,K).text.length,null,1,1);n<0&&(n=0);for(var Y=Ct(v,R);;){var re=js(e,Y,R,n,b),ie=ci(Y,re.ch+(re.xRel>0||re.outside>0?1:0));if(!ie)return re;var ue=ie.find(1);if(ue.line==R)return ue;Y=Ct(v,R=ue.line)}}function fa(e,n,b,v){v-=go(n);var R=n.text.length,K=Me(function(Y){return di(e,b,Y-1).bottom<=v},R,0);return R=Me(function(Y){return di(e,b,Y).top>v},K,R),{begin:K,end:R}}function pa(e,n,b,v){b||(b=Vi(e,n));var R=jn(e,n,di(e,b,v),"line").top;return fa(e,n,b,R)}function bo(e,n,b,v){return e.bottom<=b?!1:e.top>b?!0:(v?e.left:e.right)>n}function js(e,n,b,v,R){R-=oi(n);var K=Vi(e,n),Y=go(n),re=0,ie=n.text.length,ue=!0,Te=Je(n,e.doc.direction);if(Te){var Pe=(e.options.lineWrapping?zs:Ws)(e,n,b,K,Te,v,R);ue=Pe.level!=1,re=ue?Pe.from:Pe.to-1,ie=ue?Pe.to:Pe.from-1}var $e=null,qe=null,rt=Me(function(Mt){var kt=di(e,K,Mt);return kt.top+=Y,kt.bottom+=Y,bo(kt,v,R,!1)?(kt.top<=R&&kt.left<=v&&($e=Mt,qe=kt),!0):!1},re,ie),ct,dt,vt=!1;if(qe){var Et=v-qe.left<qe.right-v,yt=Et==ue;rt=$e+(yt?0:1),dt=yt?"after":"before",ct=Et?qe.left:qe.right}else{!ue&&(rt==ie||rt==re)&&rt++,dt=rt==0?"after":rt==n.text.length?"before":di(e,K,rt-(ue?1:0)).bottom+Y<=R==ue?"after":"before";var Tt=ai(e,nt(b,rt,dt),"line",n,K);ct=Tt.left,vt=R<Tt.top?-1:R>=Tt.bottom?1:0}return rt=Ne(n.text,rt,1),yo(b,rt,dt,vt,v-ct)}function Ws(e,n,b,v,R,K,Y){var re=Me(function(Pe){var $e=R[Pe],qe=$e.level!=1;return bo(ai(e,nt(b,qe?$e.to:$e.from,qe?"before":"after"),"line",n,v),K,Y,!0)},0,R.length-1),ie=R[re];if(re>0){var ue=ie.level!=1,Te=ai(e,nt(b,ue?ie.from:ie.to,ue?"after":"before"),"line",n,v);bo(Te,K,Y,!0)&&Te.top>Y&&(ie=R[re-1])}return ie}function zs(e,n,b,v,R,K,Y){var re=fa(e,n,v,Y),ie=re.begin,ue=re.end;/\s/.test(n.text.charAt(ue-1))&&ue--;for(var Te=null,Pe=null,$e=0;$e<R.length;$e++){var qe=R[$e];if(qe.from>=ue||qe.to<=ie)continue;var rt=qe.level!=1,ct=di(e,v,rt?Math.min(ue,qe.to)-1:Math.max(ie,qe.from)).right,dt=ct<K?K-ct+1e9:ct-K;(!Te||Pe>dt)&&(Te=qe,Pe=dt)}return Te||(Te=R[R.length-1]),Te.from<ie&&(Te={from:ie,to:Te.to,level:Te.level}),Te.to>ue&&(Te={from:Te.from,to:ue,level:Te.level}),Te}var Oi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Oi==null){Oi=g("pre",null,"CodeMirror-line-like");for(var n=0;n<49;++n)Oi.appendChild(document.createTextNode("x")),Oi.appendChild(g("br"));Oi.appendChild(document.createTextNode("x"))}A(e.measure,Oi);var b=Oi.offsetHeight/50;return b>3&&(e.cachedTextHeight=b),w(e.measure),b||1}function Qi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var n=g("span","xxxxxxxxxx"),b=g("pre",[n],"CodeMirror-line-like");A(e.measure,b);var v=n.getBoundingClientRect(),R=(v.right-v.left)/10;return R>2&&(e.cachedCharWidth=R),R||10}function xo(e){for(var n=e.display,b={},v={},R=n.gutters.clientLeft,K=n.gutters.firstChild,Y=0;K;K=K.nextSibling,++Y){var re=e.display.gutterSpecs[Y].className;b[re]=K.offsetLeft+K.clientLeft+R,v[re]=K.clientWidth}return{fixedPos:Eo(n),gutterTotalWidth:n.gutters.offsetWidth,gutterLeft:b,gutterWidth:v,wrapperWidth:n.wrapper.clientWidth}}function Eo(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ma(e){var n=Yi(e.display),b=e.options.lineWrapping,v=b&&Math.max(5,e.display.scroller.clientWidth/Qi(e.display)-3);return function(R){if(Xr(e.doc,R))return 0;var K=0;if(R.widgets)for(var Y=0;Y<R.widgets.length;Y++)R.widgets[Y].height&&(K+=R.widgets[Y].height);return b?K+(Math.ceil(R.text.length/v)||1)*n:K+n}}function So(e){var n=e.doc,b=ma(e);n.iter(function(v){var R=b(v);R!=v.height&&Tr(v,R)})}function Ii(e,n,b,v){var R=e.display;if(!b&&Xe(n).getAttribute("cm-not-content")=="true")return null;var K,Y,re=R.lineSpace.getBoundingClientRect();try{K=n.clientX-re.left,Y=n.clientY-re.top}catch(Pe){return null}var ie=_o(e,K,Y),ue;if(v&&ie.xRel>0&&(ue=Ct(e.doc,ie.line).text).length==ie.ch){var Te=V(ue,ue.length,e.options.tabSize)-ue.length;ie=nt(ie.line,Math.max(0,Math.round((K-ra(e.display).left)/Qi(e.display))-Te))}return ie}function Pi(e,n){if(n>=e.display.viewTo)return null;if(n-=e.display.viewFrom,n<0)return null;for(var b=e.display.view,v=0;v<b.length;v++)if(n-=b[v].size,n<0)return v}function Fr(e,n,b,v){n==null&&(n=e.doc.first),b==null&&(b=e.doc.first+e.doc.size),v||(v=0);var R=e.display;if(v&&b<R.viewTo&&(R.updateLineNumbers==null||R.updateLineNumbers>n)&&(R.updateLineNumbers=n),e.curOp.viewChanged=!0,n>=R.viewTo)Or&&_i(e.doc,n)<R.viewTo&&Ei(e);else if(b<=R.viewFrom)Or&&Un(e.doc,b+v)>R.viewFrom?Ei(e):(R.viewFrom+=v,R.viewTo+=v);else if(n<=R.viewFrom&&b>=R.viewTo)Ei(e);else if(n<=R.viewFrom){var K=Wn(e,b,b+v,1);K?(R.view=R.view.slice(K.index),R.viewFrom=K.lineN,R.viewTo+=v):Ei(e)}else if(b>=R.viewTo){var Y=Wn(e,n,n,-1);Y?(R.view=R.view.slice(0,Y.index),R.viewTo=Y.lineN):Ei(e)}else{var re=Wn(e,n,n,-1),ie=Wn(e,b,b+v,1);re&&ie?(R.view=R.view.slice(0,re.index).concat(Zt(e,re.lineN,ie.lineN)).concat(R.view.slice(ie.index)),R.viewTo+=v):Ei(e)}var ue=R.externalMeasured;ue&&(b<ue.lineN?ue.lineN+=v:n<ue.lineN+ue.size&&(R.externalMeasured=null))}function xi(e,n,b){e.curOp.viewChanged=!0;var v=e.display,R=e.display.externalMeasured;if(R&&n>=R.lineN&&n<R.lineN+R.size&&(v.externalMeasured=null),n<v.viewFrom||n>=v.viewTo)return;var K=v.view[Pi(e,n)];if(K.node==null)return;var Y=K.changes||(K.changes=[]);ye(Y,b)==-1&&Y.push(b)}function Ei(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Wn(e,n,b,v){var R=Pi(e,n),K,Y=e.display.view;if(!Or||b==e.doc.first+e.doc.size)return{index:R,lineN:b};for(var re=e.display.viewFrom,ie=0;ie<R;ie++)re+=Y[ie].size;if(re!=n){if(v>0){if(R==Y.length-1)return null;K=re+Y[R].size-n,R++}else K=re-n;n+=K,b+=K}for(;_i(e.doc,b)!=b;){if(R==(v<0?0:Y.length-1))return null;b+=v*Y[R-(v<0?1:0)].size,R+=v}return{index:R,lineN:b}}function Gs(e,n,b){var v=e.display,R=v.view;R.length==0||n>=v.viewTo||b<=v.viewFrom?(v.view=Zt(e,n,b),v.viewFrom=n):(v.viewFrom>n?v.view=Zt(e,n,v.viewFrom).concat(v.view):v.viewFrom<n&&(v.view=v.view.slice(Pi(e,n))),v.viewFrom=n,v.viewTo<b?v.view=v.view.concat(Zt(e,v.viewTo,b)):v.viewTo>b&&(v.view=v.view.slice(0,Pi(e,b)))),v.viewTo=b}function ga(e){for(var n=e.display.view,b=0,v=0;v<n.length;v++){var R=n[v];!R.hidden&&(!R.node||R.changes)&&++b}return b}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function va(e,n){n===void 0&&(n=!0);for(var b=e.doc,v={},R=v.cursors=document.createDocumentFragment(),K=v.selection=document.createDocumentFragment(),Y=0;Y<b.sel.ranges.length;Y++){if(!n&&Y==b.sel.primIndex)continue;var re=b.sel.ranges[Y];if(re.from().line>=e.display.viewTo||re.to().line<e.display.viewFrom)continue;var ie=re.empty();(ie||e.options.showCursorWhenSelecting)&&ya(e,re.head,R),ie||Vs(e,re,K)}return v}function ya(e,n,b){var v=ai(e,n,"div",null,null,!e.options.singleCursorHeightPerLine),R=b.appendChild(g("div","\xA0","CodeMirror-cursor"));if(R.style.left=v.left+"px",R.style.top=v.top+"px",R.style.height=Math.max(0,v.bottom-v.top)*e.options.cursorHeight+"px",v.other){var K=b.appendChild(g("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));K.style.display="",K.style.left=v.other.left+"px",K.style.top=v.other.top+"px",K.style.height=(v.other.bottom-v.other.top)*.85+"px"}}function zn(e,n){return e.top-n.top||e.left-n.left}function Vs(e,n,b){var v=e.display,R=e.doc,K=document.createDocumentFragment(),Y=ra(e.display),re=Y.left,ie=Math.max(v.sizerWidth,Mi(e)-v.sizer.offsetLeft)-Y.right,ue=R.direction=="ltr";function Te(yt,Tt,Mt,kt){Tt<0&&(Tt=0),Tt=Math.round(Tt),kt=Math.round(kt),K.appendChild(g("div",null,"CodeMirror-selected","position: absolute; left: "+yt+`px;
top: `+Tt+"px; width: "+(Mt==null?ie-yt:Mt)+`px;
height: `+(kt-Tt)+"px"))}function Pe(yt,Tt,Mt){var kt=Ct(R,yt),Kt=kt.text.length,or,xr;function sr(pr,Ur){return vo(e,nt(yt,pr),"div",kt,Ur)}function Wr(pr,Ur,wr){var vr=pa(e,kt,null,pr),mr=Ur=="ltr"==(wr=="after")?"left":"right",ur=wr=="after"?vr.begin:vr.end-(/\s/.test(kt.text.charAt(vr.end-1))?2:1);return sr(ur,mr)[mr]}var Br=Je(kt,R.direction);return ne(Br,Tt||0,Mt==null?Kt:Mt,function(pr,Ur,wr,vr){var mr=wr=="ltr",ur=sr(pr,mr?"left":"right"),Kr=sr(Ur-1,mr?"right":"left"),un=Tt==null&&pr==0,Li=Mt==null&&Ur==Kt,Lr=vr==0,fi=!Br||vr==Br.length-1;if(Kr.top-ur.top<=3){var Er=(ue?un:Li)&&Lr,Yo=(ue?Li:un)&&fi,vi=Er?re:(mr?ur:Kr).left,Ki=Yo?ie:(mr?Kr:ur).right;Te(vi,ur.top,Ki-vi,ur.bottom)}else{var Hi,Dr,cn,Qo;mr?(Hi=ue&&un&&Lr?re:ur.left,Dr=ue?ie:Wr(pr,wr,"before"),cn=ue?re:Wr(Ur,wr,"after"),Qo=ue&&Li&&fi?ie:Kr.right):(Hi=ue?Wr(pr,wr,"before"):re,Dr=!ue&&un&&Lr?ie:ur.right,cn=!ue&&Li&&fi?re:Kr.left,Qo=ue?Wr(Ur,wr,"after"):ie),Te(Hi,ur.top,Dr-Hi,ur.bottom),ur.bottom<Kr.top&&Te(re,ur.bottom,null,Kr.top),Te(cn,Kr.top,Qo-cn,Kr.bottom)}(!or||zn(ur,or)<0)&&(or=ur),zn(Kr,or)<0&&(or=Kr),(!xr||zn(ur,xr)<0)&&(xr=ur),zn(Kr,xr)<0&&(xr=Kr)}),{start:or,end:xr}}var $e=n.from(),qe=n.to();if($e.line==qe.line)Pe($e.line,$e.ch,qe.ch);else{var rt=Ct(R,$e.line),ct=Ct(R,qe.line),dt=Ir(rt)==Ir(ct),vt=Pe($e.line,$e.ch,dt?rt.text.length+1:null).end,Et=Pe(qe.line,dt?0:null,qe.ch).start;dt&&(vt.top<Et.top-2?(Te(vt.right,vt.top,null,vt.bottom),Te(re,Et.top,Et.left,Et.bottom)):Te(vt.right,vt.top,Et.left-vt.right,vt.bottom)),vt.bottom<Et.top&&Te(re,vt.bottom,null,Et.top)}b.appendChild(K)}function Co(e){if(!e.state.focused)return;var n=e.display;clearInterval(n.blinker);var b=!0;n.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?n.blinker=setInterval(function(){e.hasFocus()||Zi(e),n.cursorDiv.style.visibility=(b=!b)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(n.cursorDiv.style.visibility="hidden")}function _a(e){e.state.focused||(e.display.input.focus(),wo(e))}function ba(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function wo(e,n){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,n),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),p&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Co(e)}function Zi(e,n){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,n),e.state.focused=!1,E(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Gn(e){for(var n=e.display,b=n.lineDiv.offsetTop,v=0;v<n.view.length;v++){var R=n.view[v],K=e.options.lineWrapping,Y=void 0,re=0;if(R.hidden)continue;if(S&&_<8){var ie=R.node.offsetTop+R.node.offsetHeight;Y=ie-b,b=ie}else{var ue=R.node.getBoundingClientRect();Y=ue.bottom-ue.top,!K&&R.text.firstChild&&(re=R.text.firstChild.getBoundingClientRect().right-ue.left-1)}var Te=R.line.height-Y;if((Te>.005||Te<-.005)&&(Tr(R.line,Y),xa(R.line),R.rest))for(var Pe=0;Pe<R.rest.length;Pe++)xa(R.rest[Pe]);if(re>e.display.sizerWidth){var $e=Math.ceil(re/Qi(e.display));$e>e.display.maxLineLength&&(e.display.maxLineLength=$e,e.display.maxLine=R.line,e.display.maxLineChanged=!0)}}}function xa(e){if(e.widgets)for(var n=0;n<e.widgets.length;++n){var b=e.widgets[n],v=b.node.parentNode;v&&(b.height=v.offsetHeight)}}function Vn(e,n,b){var v=b&&b.top!=null?Math.max(0,b.top):e.scroller.scrollTop;v=Math.floor(v-Xn(e));var R=b&&b.bottom!=null?b.bottom:v+e.wrapper.clientHeight,K=kr(n,v),Y=kr(n,R);if(b&&b.ensure){var re=b.ensure.from.line,ie=b.ensure.to.line;re<K?(K=re,Y=kr(n,oi(Ct(n,re))+e.wrapper.clientHeight)):Math.min(ie,n.lastLine())>=Y&&(K=kr(n,oi(Ct(n,ie))-e.wrapper.clientHeight),Y=ie)}return{from:K,to:Math.max(Y,K+1)}}function Ys(e,n){if(He(e,"scrollCursorIntoView"))return;var b=e.display,v=b.sizer.getBoundingClientRect(),R=null;if(n.top+v.top<0?R=!0:n.bottom+v.top>(window.innerHeight||document.documentElement.clientHeight)&&(R=!1),R!=null&&!t){var K=g("div","\u200B",null,`position: absolute;
top: `+(n.top-b.viewOffset-Xn(e.display))+`px;
height: `+(n.bottom-n.top+hi(e)+b.barHeight)+`px;
left: `+n.left+"px; width: "+Math.max(2,n.right-n.left)+"px;");e.display.lineSpace.appendChild(K),K.scrollIntoView(R),e.display.lineSpace.removeChild(K)}}function Qs(e,n,b,v){v==null&&(v=0);var R;!e.options.lineWrapping&&n==b&&(n=n.ch?nt(n.line,n.sticky=="before"?n.ch-1:n.ch,"after"):n,b=n.sticky=="before"?nt(n.line,n.ch+1,"before"):n);for(var K=0;K<5;K++){var Y=!1,re=ai(e,n),ie=!b||b==n?re:ai(e,b);R={left:Math.min(re.left,ie.left),top:Math.min(re.top,ie.top)-v,right:Math.max(re.left,ie.left),bottom:Math.max(re.bottom,ie.bottom)+v};var ue=To(e,R),Te=e.doc.scrollTop,Pe=e.doc.scrollLeft;if(ue.scrollTop!=null&&(bn(e,ue.scrollTop),Math.abs(e.doc.scrollTop-Te)>1&&(Y=!0)),ue.scrollLeft!=null&&(Fi(e,ue.scrollLeft),Math.abs(e.doc.scrollLeft-Pe)>1&&(Y=!0)),!Y)break}return R}function Zs(e,n){var b=To(e,n);b.scrollTop!=null&&bn(e,b.scrollTop),b.scrollLeft!=null&&Fi(e,b.scrollLeft)}function To(e,n){var b=e.display,v=Yi(e.display);n.top<0&&(n.top=0);var R=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:b.scroller.scrollTop,K=po(e),Y={};n.bottom-n.top>K&&(n.bottom=n.top+K);var re=e.doc.height+fo(b),ie=n.top<v,ue=n.bottom>re-v;if(n.top<R)Y.scrollTop=ie?0:n.top;else if(n.bottom>R+K){var Te=Math.min(n.top,(ue?re:n.bottom)-K);Te!=R&&(Y.scrollTop=Te)}var Pe=e.options.fixedGutter?0:b.gutters.offsetWidth,$e=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:b.scroller.scrollLeft-Pe,qe=Mi(e)-b.gutters.offsetWidth,rt=n.right-n.left>qe;return rt&&(n.right=n.left+qe),n.left<10?Y.scrollLeft=0:n.left<$e?Y.scrollLeft=Math.max(0,n.left+Pe-(rt?0:10)):n.right>qe+$e-3&&(Y.scrollLeft=n.right+(rt?0:10)-qe),Y}function Ao(e,n){if(n==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+n}function qi(e){Yn(e);var n=e.getCursor();e.curOp.scrollToPos={from:n,to:n,margin:e.options.cursorScrollMargin}}function _n(e,n,b){(n!=null||b!=null)&&Yn(e),n!=null&&(e.curOp.scrollLeft=n),b!=null&&(e.curOp.scrollTop=b)}function qs(e,n){Yn(e),e.curOp.scrollToPos=n}function Yn(e){var n=e.curOp.scrollToPos;if(n){e.curOp.scrollToPos=null;var b=da(e,n.from),v=da(e,n.to);Ea(e,b,v,n.margin)}}function Ea(e,n,b,v){var R=To(e,{left:Math.min(n.left,b.left),top:Math.min(n.top,b.top)-v,right:Math.max(n.right,b.right),bottom:Math.max(n.bottom,b.bottom)+v});_n(e,R.scrollLeft,R.scrollTop)}function bn(e,n){if(Math.abs(e.doc.scrollTop-n)<2)return;D||ko(e,{top:n}),Sa(e,n,!0),D&&ko(e),Sn(e,100)}function Sa(e,n,b){if(n=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,n)),e.display.scroller.scrollTop==n&&!b)return;e.doc.scrollTop=n,e.display.scrollbars.setScrollTop(n),e.display.scroller.scrollTop!=n&&(e.display.scroller.scrollTop=n)}function Fi(e,n,b,v){if(n=Math.max(0,Math.min(n,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(b?n==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-n)<2)&&!v)return;e.doc.scrollLeft=n,La(e),e.display.scroller.scrollLeft!=n&&(e.display.scroller.scrollLeft=n),e.display.scrollbars.setScrollLeft(n)}function xn(e){var n=e.display,b=n.gutters.offsetWidth,v=Math.round(e.doc.height+fo(e.display));return{clientHeight:n.scroller.clientHeight,viewHeight:n.wrapper.clientHeight,scrollWidth:n.scroller.scrollWidth,clientWidth:n.scroller.clientWidth,viewWidth:n.wrapper.clientWidth,barLeft:e.options.fixedGutter?b:0,docHeight:v,scrollHeight:v+hi(e)+n.barHeight,nativeBarWidth:n.nativeBarWidth,gutterWidth:b}}var Ni=function(e,n,b){this.cm=b;var v=this.vert=g("div",[g("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),R=this.horiz=g("div",[g("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");v.tabIndex=R.tabIndex=-1,e(v),e(R),Ke(v,"scroll",function(){v.clientHeight&&n(v.scrollTop,"vertical")}),Ke(R,"scroll",function(){R.clientWidth&&n(R.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,S&&_<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ni.prototype.update=function(e){var n=e.scrollWidth>e.clientWidth+1,b=e.scrollHeight>e.clientHeight+1,v=e.nativeBarWidth;if(b){this.vert.style.display="block",this.vert.style.bottom=n?v+"px":"0";var R=e.viewHeight-(n?v:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+R)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(n){this.horiz.style.display="block",this.horiz.style.right=b?v+"px":"0",this.horiz.style.left=e.barLeft+"px";var K=e.viewWidth-e.barLeft-(b?v:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+K)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(v==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:b?v:0,bottom:n?v:0}},Ni.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ni.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ni.prototype.zeroWidthHack=function(){var e=h&&!l?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ce,this.disableVert=new ce},Ni.prototype.enableZeroWidthBar=function(e,n,b){e.style.pointerEvents="auto";function v(){var R=e.getBoundingClientRect(),K=b=="vert"?document.elementFromPoint(R.right-1,(R.top+R.bottom)/2):document.elementFromPoint((R.right+R.left)/2,R.bottom-1);K!=e?e.style.pointerEvents="none":n.set(1e3,v)}n.set(1e3,v)},Ni.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var En=function(){};En.prototype.update=function(){return{bottom:0,right:0}},En.prototype.setScrollLeft=function(){},En.prototype.setScrollTop=function(){},En.prototype.clear=function(){};function $i(e,n){n||(n=xn(e));var b=e.display.barWidth,v=e.display.barHeight;Ca(e,n);for(var R=0;R<4&&b!=e.display.barWidth||v!=e.display.barHeight;R++)b!=e.display.barWidth&&e.options.lineWrapping&&Gn(e),Ca(e,xn(e)),b=e.display.barWidth,v=e.display.barHeight}function Ca(e,n){var b=e.display,v=b.scrollbars.update(n);b.sizer.style.paddingRight=(b.barWidth=v.right)+"px",b.sizer.style.paddingBottom=(b.barHeight=v.bottom)+"px",b.heightForcer.style.borderBottom=v.bottom+"px solid transparent",v.right&&v.bottom?(b.scrollbarFiller.style.display="block",b.scrollbarFiller.style.height=v.bottom+"px",b.scrollbarFiller.style.width=v.right+"px"):b.scrollbarFiller.style.display="",v.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(b.gutterFiller.style.display="block",b.gutterFiller.style.height=v.bottom+"px",b.gutterFiller.style.width=n.gutterWidth+"px"):b.gutterFiller.style.display=""}var wa={native:Ni,null:En};function Ta(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&E(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wa[e.options.scrollbarStyle](function(n){e.display.wrapper.insertBefore(n,e.display.scrollbarFiller),Ke(n,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),n.setAttribute("cm-not-content","true")},function(n,b){b=="horizontal"?Fi(e,n):bn(e,n)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var $s=0;function Bi(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++$s},Jr(e.curOp)}function Ui(e){var n=e.curOp;n&&Hn(n,function(b){for(var v=0;v<b.ops.length;v++)b.ops[v].cm.curOp=null;Js(b)})}function Js(e){for(var n=e.ops,b=0;b<n.length;b++)el(n[b]);for(var v=0;v<n.length;v++)tl(n[v]);for(var R=0;R<n.length;R++)rl(n[R]);for(var K=0;K<n.length;K++)il(n[K]);for(var Y=0;Y<n.length;Y++)nl(n[Y])}function el(e){var n=e.cm,b=n.display;al(n),e.updateMaxLine&&Kn(n),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<b.viewFrom||e.scrollToPos.to.line>=b.viewTo)||b.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new Qn(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Lo(e.cm,e.update)}function rl(e){var n=e.cm,b=n.display;e.updatedDisplay&&Gn(n),e.barMeasure=xn(n),b.maxLineChanged&&!n.options.lineWrapping&&(e.adjustWidthTo=na(n,b.maxLine,b.maxLine.text.length).left+3,n.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(b.scroller.clientWidth,b.sizer.offsetLeft+e.adjustWidthTo+hi(n)+n.display.barWidth),e.maxScrollLeft=Math.max(0,b.sizer.offsetLeft+e.adjustWidthTo-Mi(n))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=b.input.prepareSelection())}function il(e){var n=e.cm;e.adjustWidthTo!=null&&(n.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<n.doc.scrollLeft&&Fi(n,Math.min(n.display.scroller.scrollLeft,e.maxScrollLeft),!0),n.display.maxLineChanged=!1);var b=e.focus&&e.focus==X();e.preparedSelection&&n.display.input.showSelection(e.preparedSelection,b),(e.updatedDisplay||e.startHeight!=n.doc.height)&&$i(n,e.barMeasure),e.updatedDisplay&&Do(n,e.barMeasure),e.selectionChanged&&Co(n),n.state.focused&&e.updateInput&&n.display.input.reset(e.typing),b&&_a(e.cm)}function nl(e){var n=e.cm,b=n.display,v=n.doc;if(e.updatedDisplay&&Aa(n,e.update),b.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(b.wheelStartX=b.wheelStartY=null),e.scrollTop!=null&&Sa(n,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(n,e.scrollLeft,!0,!0),e.scrollToPos){var R=Qs(n,I(v,e.scrollToPos.from),I(v,e.scrollToPos.to),e.scrollToPos.margin);Ys(n,R)}var K=e.maybeHiddenMarkers,Y=e.maybeUnhiddenMarkers;if(K)for(var re=0;re<K.length;++re)K[re].lines.length||Re(K[re],"hide");if(Y)for(var ie=0;ie<Y.length;++ie)Y[ie].lines.length&&Re(Y[ie],"unhide");b.wrapper.offsetHeight&&(v.scrollTop=n.display.scroller.scrollTop),e.changeObjs&&Re(n,"changes",n,e.changeObjs),e.update&&e.update.finish()}function jr(e,n){if(e.curOp)return n();Bi(e);try{return n()}finally{Ui(e)}}function _r(e,n){return function(){if(e.curOp)return n.apply(e,arguments);Bi(e);try{return n.apply(e,arguments)}finally{Ui(e)}}}function Rr(e){return function(){if(this.curOp)return e.apply(this,arguments);Bi(this);try{return e.apply(this,arguments)}finally{Ui(this)}}}function br(e){return function(){var n=this.cm;if(!n||n.curOp)return e.apply(this,arguments);Bi(n);try{return e.apply(this,arguments)}finally{Ui(n)}}}function Sn(e,n){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(n,U(ol,e))}function ol(e){var n=e.doc;if(n.highlightFrontier>=e.display.viewTo)return;var b=+new Date+e.options.workTime,v=pt(e,n.highlightFrontier),R=[];n.iter(v.line,Math.min(n.first+n.size,e.display.viewTo+500),function(K){if(v.line>=e.display.viewFrom){var Y=K.styles,re=K.text.length>e.options.maxHighlightLength?Pt(n.mode,v.state):null,ie=Ue(e,K,v,!0);re&&(v.state=re),K.styles=ie.styles;var ue=K.styleClasses,Te=ie.classes;Te?K.styleClasses=Te:ue&&(K.styleClasses=null);for(var Pe=!Y||Y.length!=K.styles.length||ue!=Te&&(!ue||!Te||ue.bgClass!=Te.bgClass||ue.textClass!=Te.textClass),$e=0;!Pe&&$e<Y.length;++$e)Pe=Y[$e]!=K.styles[$e];Pe&&R.push(v.line),K.stateAfter=v.save(),v.nextLine()}else K.text.length<=e.options.maxHighlightLength&&wt(e,K.text,v),K.stateAfter=v.line%5==0?v.save():null,v.nextLine();if(+new Date>b)return Sn(e,e.options.workDelay),!0}),n.highlightFrontier=v.line,n.modeFrontier=Math.max(n.modeFrontier,v.line),R.length&&jr(e,function(){for(var K=0;K<R.length;K++)xi(e,R[K],"text")})}var Qn=function(e,n,b){var v=e.display;this.viewport=n,this.visible=Vn(v,e.doc,n),this.editorIsHidden=!v.wrapper.offsetWidth,this.wrapperHeight=v.wrapper.clientHeight,this.wrapperWidth=v.wrapper.clientWidth,this.oldDisplayWidth=Mi(e),this.force=b,this.dims=xo(e),this.events=[]};Qn.prototype.signal=function(e,n){ve(e,n)&&this.events.push(arguments)},Qn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function al(e){var n=e.display;!n.scrollbarsClipped&&n.scroller.offsetWidth&&(n.nativeBarWidth=n.scroller.offsetWidth-n.scroller.clientWidth,n.heightForcer.style.height=hi(e)+"px",n.sizer.style.marginBottom=-n.nativeBarWidth+"px",n.sizer.style.borderRightWidth=hi(e)+"px",n.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var n=X();if(!n||!F(e.display.lineDiv,n))return null;var b={activeElt:n};if(window.getSelection){var v=window.getSelection();v.anchorNode&&v.extend&&F(e.display.lineDiv,v.anchorNode)&&(b.anchorNode=v.anchorNode,b.anchorOffset=v.anchorOffset,b.focusNode=v.focusNode,b.focusOffset=v.focusOffset)}return b}function ll(e){if(!e||!e.activeElt||e.activeElt==X())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&F(document.body,e.anchorNode)&&F(document.body,e.focusNode)){var n=window.getSelection(),b=document.createRange();b.setEnd(e.anchorNode,e.anchorOffset),b.collapse(!1),n.removeAllRanges(),n.addRange(b),n.extend(e.focusNode,e.focusOffset)}}function Lo(e,n){var b=e.display,v=e.doc;if(n.editorIsHidden)return Ei(e),!1;if(!n.force&&n.visible.from>=b.viewFrom&&n.visible.to<=b.viewTo&&(b.updateLineNumbers==null||b.updateLineNumbers>=b.viewTo)&&b.renderedView==b.view&&ga(e)==0)return!1;ka(e)&&(Ei(e),n.dims=xo(e));var R=v.first+v.size,K=Math.max(n.visible.from-e.options.viewportMargin,v.first),Y=Math.min(R,n.visible.to+e.options.viewportMargin);b.viewFrom<K&&K-b.viewFrom<20&&(K=Math.max(v.first,b.viewFrom)),b.viewTo>Y&&b.viewTo-Y<20&&(Y=Math.min(R,b.viewTo)),Or&&(K=_i(e.doc,K),Y=Un(e.doc,Y));var re=K!=b.viewFrom||Y!=b.viewTo||b.lastWrapHeight!=n.wrapperHeight||b.lastWrapWidth!=n.wrapperWidth;Gs(e,K,Y),b.viewOffset=oi(Ct(e.doc,b.viewFrom)),e.display.mover.style.top=b.viewOffset+"px";var ie=ga(e);if(!re&&ie==0&&!n.force&&b.renderedView==b.view&&(b.updateLineNumbers==null||b.updateLineNumbers>=b.viewTo))return!1;var ue=sl(e);return ie>4&&(b.lineDiv.style.display="none"),ul(e,b.updateLineNumbers,n.dims),ie>4&&(b.lineDiv.style.display=""),b.renderedView=b.view,ll(ue),w(b.cursorDiv),w(b.selectionDiv),b.gutters.style.height=b.sizer.style.minHeight=0,re&&(b.lastWrapHeight=n.wrapperHeight,b.lastWrapWidth=n.wrapperWidth,Sn(e,400)),b.updateLineNumbers=null,!0}function Aa(e,n){for(var b=n.viewport,v=!0;;v=!1){if(!v||!e.options.lineWrapping||n.oldDisplayWidth==Mi(e)){if(b&&b.top!=null&&(b={top:Math.min(e.doc.height+fo(e.display)-po(e),b.top)}),n.visible=Vn(e.display,e.doc,b),n.visible.from>=e.display.viewFrom&&n.visible.to<=e.display.viewTo)break}else v&&(n.visible=Vn(e.display,e.doc,b));if(!Lo(e,n))break;Gn(e);var R=xn(e);yn(e),$i(e,R),Do(e,R),n.force=!1}n.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(n.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ko(e,n){var b=new Qn(e,n);if(Lo(e,b)){Gn(e),Aa(e,b);var v=xn(e);yn(e),$i(e,v),Do(e,v),b.finish()}}function ul(e,n,b){var v=e.display,R=e.options.lineNumbers,K=v.lineDiv,Y=K.firstChild;function re(rt){var ct=rt.nextSibling;return p&&h&&e.display.currentWheelTarget==rt?rt.style.display="none":rt.parentNode.removeChild(rt),ct}for(var ie=v.view,ue=v.viewFrom,Te=0;Te<ie.length;Te++){var Pe=ie[Te];if(!Pe.hidden)if(!Pe.node||Pe.node.parentNode!=K){var $e=Fs(e,Pe,ue,b);K.insertBefore($e,Y)}else{for(;Y!=Pe.node;)Y=re(Y);var qe=R&&n!=null&&n<=ue&&Pe.lineNumber;Pe.changes&&(ye(Pe.changes,"gutter")>-1&&(qe=!1),qo(e,Pe,ue,b)),qe&&(w(Pe.lineNumber),Pe.lineNumber.appendChild(document.createTextNode(ri(e.options,ue)))),Y=Pe.node.nextSibling}ue+=Pe.size}for(;Y;)Y=re(Y)}function Ro(e){var n=e.gutters.offsetWidth;e.sizer.style.marginLeft=n+"px"}function Do(e,n){e.display.sizer.style.minHeight=n.docHeight+"px",e.display.heightForcer.style.top=n.docHeight+"px",e.display.gutters.style.height=n.docHeight+e.display.barHeight+hi(e)+"px"}function La(e){var n=e.display,b=n.view;if(!n.alignWidgets&&(!n.gutters.firstChild||!e.options.fixedGutter))return;for(var v=Eo(n)-n.scroller.scrollLeft+e.doc.scrollLeft,R=n.gutters.offsetWidth,K=v+"px",Y=0;Y<b.length;Y++)if(!b[Y].hidden){e.options.fixedGutter&&(b[Y].gutter&&(b[Y].gutter.style.left=K),b[Y].gutterBackground&&(b[Y].gutterBackground.style.left=K));var re=b[Y].alignable;if(re)for(var ie=0;ie<re.length;ie++)re[ie].style.left=K}e.options.fixedGutter&&(n.gutters.style.left=v+R+"px")}function ka(e){if(!e.options.lineNumbers)return!1;var n=e.doc,b=ri(e.options,n.first+n.size-1),v=e.display;if(b.length!=v.lineNumChars){var R=v.measure.appendChild(g("div",[g("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),K=R.firstChild.offsetWidth,Y=R.offsetWidth-K;return v.lineGutter.style.width="",v.lineNumInnerWidth=Math.max(K,v.lineGutter.offsetWidth-Y)+1,v.lineNumWidth=v.lineNumInnerWidth+Y,v.lineNumChars=v.lineNumInnerWidth?b.length:-1,v.lineGutter.style.width=v.lineNumWidth+"px",Ro(e.display),!0}return!1}function Mo(e,n){for(var b=[],v=!1,R=0;R<e.length;R++){var K=e[R],Y=null;if(typeof K!="string"&&(Y=K.style,K=K.className),K=="CodeMirror-linenumbers")if(n)v=!0;else continue;b.push({className:K,style:Y})}return n&&!v&&b.push({className:"CodeMirror-linenumbers",style:null}),b}function Ra(e){var n=e.gutters,b=e.gutterSpecs;w(n),e.lineGutter=null;for(var v=0;v<b.length;++v){var R=b[v],K=R.className,Y=R.style,re=n.appendChild(g("div",null,"CodeMirror-gutter "+K));Y&&(re.style.cssText=Y),K=="CodeMirror-linenumbers"&&(e.lineGutter=re,re.style.width=(e.lineNumWidth||1)+"px")}n.style.display=b.length?"":"none",Ro(e)}function Cn(e){Ra(e.display),Fr(e),La(e)}function cl(e,n,b,v){var R=this;this.input=b,R.scrollbarFiller=g("div",null,"CodeMirror-scrollbar-filler"),R.scrollbarFiller.setAttribute("cm-not-content","true"),R.gutterFiller=g("div",null,"CodeMirror-gutter-filler"),R.gutterFiller.setAttribute("cm-not-content","true"),R.lineDiv=P("div",null,"CodeMirror-code"),R.selectionDiv=g("div",null,null,"position: relative; z-index: 1"),R.cursorDiv=g("div",null,"CodeMirror-cursors"),R.measure=g("div",null,"CodeMirror-measure"),R.lineMeasure=g("div",null,"CodeMirror-measure"),R.lineSpace=P("div",[R.measure,R.lineMeasure,R.selectionDiv,R.cursorDiv,R.lineDiv],null,"position: relative; outline: none");var K=P("div",[R.lineSpace],"CodeMirror-lines");R.mover=g("div",[K],null,"position: relative"),R.sizer=g("div",[R.mover],"CodeMirror-sizer"),R.sizerWidth=null,R.heightForcer=g("div",null,null,"position: absolute; height: "+Le+"px; width: 1px;"),R.gutters=g("div",null,"CodeMirror-gutters"),R.lineGutter=null,R.scroller=g("div",[R.sizer,R.heightForcer,R.gutters],"CodeMirror-scroll"),R.scroller.setAttribute("tabIndex","-1"),R.wrapper=g("div",[R.scrollbarFiller,R.gutterFiller,R.scroller],"CodeMirror"),S&&_<8&&(R.gutters.style.zIndex=-1,R.scroller.style.paddingRight=0),!p&&!(D&&r)&&(R.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(R.wrapper):e(R.wrapper)),R.viewFrom=R.viewTo=n.first,R.reportedViewFrom=R.reportedViewTo=n.first,R.view=[],R.renderedView=null,R.externalMeasured=null,R.viewOffset=0,R.lastWrapHeight=R.lastWrapWidth=0,R.updateLineNumbers=null,R.nativeBarWidth=R.barHeight=R.barWidth=0,R.scrollbarsClipped=!1,R.lineNumWidth=R.lineNumInnerWidth=R.lineNumChars=null,R.alignWidgets=!1,R.cachedCharWidth=R.cachedTextHeight=R.cachedPaddingH=null,R.maxLine=null,R.maxLineLength=0,R.maxLineChanged=!1,R.wheelDX=R.wheelDY=R.wheelStartX=R.wheelStartY=null,R.shift=!1,R.selForContextMenu=null,R.activeTouch=null,R.gutterSpecs=Mo(v.gutters,v.lineNumbers),Ra(R),b.init(R)}var Zn=0,Zr=null;S?Zr=-.53:D?Zr=15:o?Zr=-.7:s&&(Zr=-1/3);function Da(e){var n=e.wheelDeltaX,b=e.wheelDeltaY;return n==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(n=e.detail),b==null&&e.detail&&e.axis==e.VERTICAL_AXIS?b=e.detail:b==null&&(b=e.wheelDelta),{x:n,y:b}}function hl(e){var n=Da(e);return n.x*=Zr,n.y*=Zr,n}function Ma(e,n){var b=Da(n),v=b.x,R=b.y,K=e.display,Y=K.scroller,re=Y.scrollWidth>Y.clientWidth,ie=Y.scrollHeight>Y.clientHeight;if(!(v&&re||R&&ie))return;if(R&&h&&p){e:for(var ue=n.target,Te=K.view;ue!=Y;ue=ue.parentNode)for(var Pe=0;Pe<Te.length;Pe++)if(Te[Pe].node==ue){e.display.currentWheelTarget=ue;break e}}if(v&&!D&&!u&&Zr!=null){R&&ie&&bn(e,Math.max(0,Y.scrollTop+R*Zr)),Fi(e,Math.max(0,Y.scrollLeft+v*Zr)),(!R||R&&ie)&&J(n),K.wheelStartX=null;return}if(R&&Zr!=null){var $e=R*Zr,qe=e.doc.scrollTop,rt=qe+K.wrapper.clientHeight;$e<0?qe=Math.max(0,qe+$e-50):rt=Math.min(e.doc.height,rt+$e+50),ko(e,{top:qe,bottom:rt})}Zn<20&&(K.wheelStartX==null?(K.wheelStartX=Y.scrollLeft,K.wheelStartY=Y.scrollTop,K.wheelDX=v,K.wheelDY=R,setTimeout(function(){if(K.wheelStartX==null)return;var ct=Y.scrollLeft-K.wheelStartX,dt=Y.scrollTop-K.wheelStartY,vt=dt&&K.wheelDY&&dt/K.wheelDY||ct&&K.wheelDX&&ct/K.wheelDX;if(K.wheelStartX=K.wheelStartY=null,!vt)return;Zr=(Zr*Zn+vt)/(Zn+1),++Zn},200)):(K.wheelDX+=v,K.wheelDY+=R))}var qr=function(e,n){this.ranges=e,this.primIndex=n};qr.prototype.primary=function(){return this.ranges[this.primIndex]},qr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var b=this.ranges[n],v=e.ranges[n];if(!Ht(b.anchor,v.anchor)||!Ht(b.head,v.head))return!1}return!0},qr.prototype.deepCopy=function(){for(var e=[],n=0;n<this.ranges.length;n++)e[n]=new Jt(qt(this.ranges[n].anchor),qt(this.ranges[n].head));return new qr(e,this.primIndex)},qr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},qr.prototype.contains=function(e,n){n||(n=e);for(var b=0;b<this.ranges.length;b++){var v=this.ranges[b];if(xt(n,v.from())>=0&&xt(e,v.to())<=0)return b}return-1};var Jt=function(e,n){this.anchor=e,this.head=n};Jt.prototype.from=function(){return ir(this.anchor,this.head)},Jt.prototype.to=function(){return er(this.anchor,this.head)},Jt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function si(e,n,b){var v=e&&e.options.selectionsMayTouch,R=n[b];n.sort(function($e,qe){return xt($e.from(),qe.from())}),b=ye(n,R);for(var K=1;K<n.length;K++){var Y=n[K],re=n[K-1],ie=xt(re.to(),Y.from());if(v&&!Y.empty()?ie>0:ie>=0){var ue=ir(re.from(),Y.from()),Te=er(re.to(),Y.to()),Pe=re.empty()?Y.from()==Y.head:re.from()==re.head;K<=b&&--b,n.splice(--K,2,new Jt(Pe?Te:ue,Pe?ue:Te))}}return new qr(n,b)}function Si(e,n){return new qr([new Jt(e,n||e)],0)}function Ci(e){return e.text?nt(e.from.line+e.text.length-1,le(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Oa(e,n){if(xt(e,n.from)<0)return e;if(xt(e,n.to)<=0)return Ci(n);var b=e.line+n.text.length-(n.to.line-n.from.line)-1,v=e.ch;return e.line==n.to.line&&(v+=Ci(n).ch-n.to.ch),nt(b,v)}function Oo(e,n){for(var b=[],v=0;v<e.sel.ranges.length;v++){var R=e.sel.ranges[v];b.push(new Jt(Oa(R.anchor,n),Oa(R.head,n)))}return si(e.cm,b,e.sel.primIndex)}function Ia(e,n,b){return e.line==n.line?nt(b.line,e.ch-n.ch+b.ch):nt(b.line+(e.line-n.line),e.ch)}function dl(e,n,b){for(var v=[],R=nt(e.first,0),K=R,Y=0;Y<n.length;Y++){var re=n[Y],ie=Ia(re.from,R,K),ue=Ia(Ci(re),R,K);if(R=re.to,K=ue,b=="around"){var Te=e.sel.ranges[Y],Pe=xt(Te.head,Te.anchor)<0;v[Y]=new Jt(Pe?ue:ie,Pe?ie:ue)}else v[Y]=new Jt(ie,ie)}return new qr(v,e.sel.primIndex)}function Io(e){e.doc.mode=St(e.options,e.doc.modeOption),wn(e)}function wn(e){e.doc.iter(function(n){n.stateAfter&&(n.stateAfter=null),n.styles&&(n.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Sn(e,100),e.state.modeGen++,e.curOp&&Fr(e)}function Pa(e,n){return n.from.ch==0&&n.to.ch==0&&le(n.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Po(e,n,b,v){function R(Et){return b?b[Et]:null}function K(Et,yt,Tt){Zo(Et,yt,Tt,v),Cr(Et,"change",Et,n)}function Y(Et,yt){for(var Tt=[],Mt=Et;Mt<yt;++Mt)Tt.push(new Di(ue[Mt],R(Mt),v));return Tt}var re=n.from,ie=n.to,ue=n.text,Te=Ct(e,re.line),Pe=Ct(e,ie.line),$e=le(ue),qe=R(ue.length-1),rt=ie.line-re.line;if(n.full)e.insert(0,Y(0,ue.length)),e.remove(ue.length,e.size-ue.length);else if(Pa(e,n)){var ct=Y(0,ue.length-1);K(Pe,Pe.text,qe),rt&&e.remove(re.line,rt),ct.length&&e.insert(re.line,ct)}else if(Te==Pe)if(ue.length==1)K(Te,Te.text.slice(0,re.ch)+$e+Te.text.slice(ie.ch),qe);else{var dt=Y(1,ue.length-1);dt.push(new Di($e+Te.text.slice(ie.ch),qe,v)),K(Te,Te.text.slice(0,re.ch)+ue[0],R(0)),e.insert(re.line+1,dt)}else if(ue.length==1)K(Te,Te.text.slice(0,re.ch)+ue[0]+Pe.text.slice(ie.ch),R(0)),e.remove(re.line+1,rt);else{K(Te,Te.text.slice(0,re.ch)+ue[0],R(0)),K(Pe,$e+Pe.text.slice(ie.ch),qe);var vt=Y(1,ue.length-1);rt>1&&e.remove(re.line+1,rt-1),e.insert(re.line+1,vt)}Cr(e,"change",e,n)}function wi(e,n,b){function v(R,K,Y){if(R.linked)for(var re=0;re<R.linked.length;++re){var ie=R.linked[re];if(ie.doc==K)continue;var ue=Y&&ie.sharedHist;if(b&&!ue)continue;n(ie.doc,ue),v(ie.doc,R,ue)}}v(e,null,!0)}function Fa(e,n){if(n.cm)throw new Error("This document is already in use.");e.doc=n,n.cm=e,So(e),Io(e),Na(e),e.options.lineWrapping||Kn(e),e.options.mode=n.modeOption,Fr(e)}function Na(e){(e.doc.direction=="rtl"?W:E)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){jr(e,function(){Na(e),Fr(e)})}function qn(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 Fo(e,n){var b={from:qt(n.from),to:Ci(n),text:Mr(e,n.from,n.to)};return Ka(e,b,n.from.line,n.to.line+1),wi(e,function(v){return Ka(v,b,n.from.line,n.to.line+1)},!0),b}function Ba(e){for(;e.length;){var n=le(e);if(n.ranges)e.pop();else break}}function pl(e,n){if(n)return Ba(e.done),le(e.done);if(e.done.length&&!le(e.done).ranges)return le(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),le(e.done)}function Ua(e,n,b,v){var R=e.history;R.undone.length=0;var K=+new Date,Y,re;if((R.lastOp==v||R.lastOrigin==n.origin&&n.origin&&(n.origin.charAt(0)=="+"&&R.lastModTime>K-(e.cm?e.cm.options.historyEventDelay:500)||n.origin.charAt(0)=="*"))&&(Y=pl(R,R.lastOp==v)))re=le(Y.changes),xt(n.from,n.to)==0&&xt(n.from,re.to)==0?re.to=Ci(n):Y.changes.push(Fo(e,n));else{var ie=le(R.done);for((!ie||!ie.ranges)&&$n(e.sel,R.done),Y={changes:[Fo(e,n)],generation:R.generation},R.done.push(Y);R.done.length>R.undoDepth;)R.done.shift(),R.done[0].ranges||R.done.shift()}R.done.push(b),R.generation=++R.maxGeneration,R.lastModTime=R.lastSelTime=K,R.lastOp=R.lastSelOp=v,R.lastOrigin=R.lastSelOrigin=n.origin,re||Re(e,"historyAdded")}function ml(e,n,b,v){var R=n.charAt(0);return R=="*"||R=="+"&&b.ranges.length==v.ranges.length&&b.somethingSelected()==v.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,n,b,v){var R=e.history,K=v&&v.origin;b==R.lastSelOp||K&&R.lastSelOrigin==K&&(R.lastModTime==R.lastSelTime&&R.lastOrigin==K||ml(e,K,le(R.done),n))?R.done[R.done.length-1]=n:$n(n,R.done),R.lastSelTime=+new Date,R.lastSelOrigin=K,R.lastSelOp=b,v&&v.clearRedo!==!1&&Ba(R.undone)}function $n(e,n){var b=le(n);b&&b.ranges&&b.equals(e)||n.push(e)}function Ka(e,n,b,v){var R=n["spans_"+e.id],K=0;e.iter(Math.max(e.first,b),Math.min(e.first+e.size,v),function(Y){Y.markedSpans&&((R||(R=n["spans_"+e.id]={}))[K]=Y.markedSpans),++K})}function vl(e){if(!e)return null;for(var n,b=0;b<e.length;++b)e[b].marker.explicitlyCleared?n||(n=e.slice(0,b)):n&&n.push(e[b]);return n?n.length?n:null:e}function yl(e,n){var b=n["spans_"+e.id];if(!b)return null;for(var v=[],R=0;R<n.text.length;++R)v.push(vl(b[R]));return v}function Ha(e,n){var b=yl(e,n),v=ni(e,n);if(!b)return v;if(!v)return b;for(var R=0;R<b.length;++R){var K=b[R],Y=v[R];if(K&&Y){e:for(var re=0;re<Y.length;++re){for(var ie=Y[re],ue=0;ue<K.length;++ue)if(K[ue].marker==ie.marker)continue e;K.push(ie)}}else Y&&(b[R]=Y)}return b}function Ji(e,n,b){for(var v=[],R=0;R<e.length;++R){var K=e[R];if(K.ranges){v.push(b?qr.prototype.deepCopy.call(K):K);continue}var Y=K.changes,re=[];v.push({changes:re});for(var ie=0;ie<Y.length;++ie){var ue=Y[ie],Te=void 0;if(re.push({from:ue.from,to:ue.to,text:ue.text}),n)for(var Pe in ue)(Te=Pe.match(/^spans_(\d+)$/))&&(ye(n,Number(Te[1]))>-1&&(le(re)[Pe]=ue[Pe],delete ue[Pe]))}}return v}function No(e,n,b,v){if(v){var R=e.anchor;if(b){var K=xt(n,R)<0;K!=xt(b,R)<0?(R=n,n=b):K!=xt(n,b)<0&&(n=b)}return new Jt(R,n)}else return new Jt(b||n,n)}function Jn(e,n,b,v,R){R==null&&(R=e.cm&&(e.cm.display.shift||e.extend)),Ar(e,new qr([No(e.sel.primary(),n,b,R)],0),v)}function Xa(e,n,b){for(var v=[],R=e.cm&&(e.cm.display.shift||e.extend),K=0;K<e.sel.ranges.length;K++)v[K]=No(e.sel.ranges[K],n[K],null,R);var Y=si(e.cm,v,e.sel.primIndex);Ar(e,Y,b)}function Bo(e,n,b,v){var R=e.sel.ranges.slice(0);R[n]=b,Ar(e,si(e.cm,R,e.sel.primIndex),v)}function ja(e,n,b,v){Ar(e,Si(n,b),v)}function _l(e,n,b){var v={ranges:n.ranges,update:function(R){this.ranges=[];for(var K=0;K<R.length;K++)this.ranges[K]=new Jt(I(e,R[K].anchor),I(e,R[K].head))},origin:b&&b.origin};return Re(e,"beforeSelectionChange",e,v),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,v),v.ranges!=n.ranges?si(e.cm,v.ranges,v.ranges.length-1):n}function Wa(e,n,b){var v=e.history.done,R=le(v);R&&R.ranges?(v[v.length-1]=n,eo(e,n,b)):Ar(e,n,b)}function Ar(e,n,b){eo(e,n,b),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,b)}function eo(e,n,b){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(n=_l(e,n,b));var v=b&&b.bias||(xt(n.primary().head,e.sel.primary().head)<0?-1:1);za(e,Va(e,n,v,!0)),!(b&&b.scroll===!1)&&e.cm&&qi(e.cm)}function za(e,n){if(n.equals(e.sel))return;e.sel=n,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),Cr(e,"cursorActivity",e)}function Ga(e){za(e,Va(e,e.sel,null,!1))}function Va(e,n,b,v){for(var R,K=0;K<n.ranges.length;K++){var Y=n.ranges[K],re=n.ranges.length==e.sel.ranges.length&&e.sel.ranges[K],ie=to(e,Y.anchor,re&&re.anchor,b,v),ue=to(e,Y.head,re&&re.head,b,v);(R||ie!=Y.anchor||ue!=Y.head)&&(R||(R=n.ranges.slice(0,K)),R[K]=new Jt(ie,ue))}return R?si(e.cm,R,n.primIndex):n}function en(e,n,b,v,R){var K=Ct(e,n.line);if(K.markedSpans)for(var Y=0;Y<K.markedSpans.length;++Y){var re=K.markedSpans[Y],ie=re.marker,ue="selectLeft"in ie?!ie.selectLeft:ie.inclusiveLeft,Te="selectRight"in ie?!ie.selectRight:ie.inclusiveRight;if((re.from==null||(ue?re.from<=n.ch:re.from<n.ch))&&(re.to==null||(Te?re.to>=n.ch:re.to>n.ch))){if(R&&(Re(ie,"beforeCursorEnter"),ie.explicitlyCleared))if(K.markedSpans){--Y;continue}else break;if(!ie.atomic)continue;if(b){var Pe=ie.find(v<0?1:-1),$e=void 0;if((v<0?Te:ue)&&(Pe=Ya(e,Pe,-v,Pe&&Pe.line==n.line?K:null)),Pe&&Pe.line==n.line&&($e=xt(Pe,b))&&(v<0?$e<0:$e>0))return en(e,Pe,n,v,R)}var qe=ie.find(v<0?-1:1);return(v<0?ue:Te)&&(qe=Ya(e,qe,v,qe.line==n.line?K:null)),qe?en(e,qe,n,v,R):null}}return n}function to(e,n,b,v,R){var K=v||1,Y=en(e,n,b,K,R)||!R&&en(e,n,b,K,!0)||en(e,n,b,-K,R)||!R&&en(e,n,b,-K,!0);return Y||(e.cantEdit=!0,nt(e.first,0))}function Ya(e,n,b,v){return b<0&&n.ch==0?n.line>e.first?I(e,nt(n.line-1)):null:b>0&&n.ch==(v||Ct(e,n.line)).text.length?n.line<e.first+e.size-1?nt(n.line+1,0):null:new nt(n.line,n.ch+b)}function Qa(e){e.setSelection(nt(e.firstLine(),0),nt(e.lastLine()),Ye)}function Za(e,n,b){var v={canceled:!1,from:n.from,to:n.to,text:n.text,origin:n.origin,cancel:function(){return v.canceled=!0}};return b&&(v.update=function(R,K,Y,re){R&&(v.from=I(e,R)),K&&(v.to=I(e,K)),Y&&(v.text=Y),re!==void 0&&(v.origin=re)}),Re(e,"beforeChange",e,v),e.cm&&Re(e.cm,"beforeChange",e.cm,v),v.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:v.from,to:v.to,text:v.text,origin:v.origin}}function tn(e,n,b){if(e.cm){if(!e.cm.curOp)return _r(e.cm,tn)(e,n,b);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(n=Za(e,n,!0),!n))return;var v=Xi&&!b&&ki(e,n.from,n.to);if(v)for(var R=v.length-1;R>=0;--R)qa(e,{from:v[R].from,to:v[R].to,text:R?[""]:n.text,origin:n.origin});else qa(e,n)}function qa(e,n){if(n.text.length==1&&n.text[0]==""&&xt(n.from,n.to)==0)return;var b=Oo(e,n);Ua(e,n,b,e.cm?e.cm.curOp.id:NaN),Tn(e,n,b,ni(e,n));var v=[];wi(e,function(R,K){!K&&ye(v,R.history)==-1&&(ts(R.history,n),v.push(R.history)),Tn(R,n,null,ni(R,n))})}function ro(e,n,b){var v=e.cm&&e.cm.state.suppressEdits;if(v&&!b)return;for(var R=e.history,K,Y=e.sel,re=n=="undo"?R.done:R.undone,ie=n=="undo"?R.undone:R.done,ue=0;ue<re.length&&!(K=re[ue],b?K.ranges&&!K.equals(e.sel):!K.ranges);ue++);if(ue==re.length)return;for(R.lastOrigin=R.lastSelOrigin=null;;)if(K=re.pop(),K.ranges){if($n(K,ie),b&&!K.equals(e.sel)){Ar(e,K,{clearRedo:!1});return}Y=K}else if(v){re.push(K);return}else break;var Te=[];$n(Y,ie),ie.push({changes:Te,generation:R.generation}),R.generation=K.generation||++R.maxGeneration;for(var Pe=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),$e=function(ct){var dt=K.changes[ct];if(dt.origin=n,Pe&&!Za(e,dt,!1))return re.length=0,{};Te.push(Fo(e,dt));var vt=ct?Oo(e,dt):le(re);Tn(e,dt,vt,Ha(e,dt)),!ct&&e.cm&&e.cm.scrollIntoView({from:dt.from,to:Ci(dt)});var Et=[];wi(e,function(yt,Tt){!Tt&&ye(Et,yt.history)==-1&&(ts(yt.history,dt),Et.push(yt.history)),Tn(yt,dt,null,Ha(yt,dt))})},qe=K.changes.length-1;qe>=0;--qe){var rt=$e(qe);if(rt)return rt.v}}function $a(e,n){if(n==0)return;if(e.first+=n,e.sel=new qr(Se(e.sel.ranges,function(R){return new Jt(nt(R.anchor.line+n,R.anchor.ch),nt(R.head.line+n,R.head.ch))}),e.sel.primIndex),e.cm){Fr(e.cm,e.first,e.first-n,n);for(var b=e.cm.display,v=b.viewFrom;v<b.viewTo;v++)xi(e.cm,v,"gutter")}}function Tn(e,n,b,v){if(e.cm&&!e.cm.curOp)return _r(e.cm,Tn)(e,n,b,v);if(n.to.line<e.first){$a(e,n.text.length-1-(n.to.line-n.from.line));return}if(n.from.line>e.lastLine())return;if(n.from.line<e.first){var R=n.text.length-1-(e.first-n.from.line);$a(e,R),n={from:nt(e.first,0),to:nt(n.to.line+R,n.to.ch),text:[le(n.text)],origin:n.origin}}var K=e.lastLine();n.to.line>K&&(n={from:n.from,to:nt(K,Ct(e,K).text.length),text:[n.text[0]],origin:n.origin}),n.removed=Mr(e,n.from,n.to),b||(b=Oo(e,n)),e.cm?bl(e.cm,n,v):Po(e,n,v),eo(e,b,Ye),e.cantEdit&&to(e,nt(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,n,b){var v=e.doc,R=e.display,K=n.from,Y=n.to,re=!1,ie=K.line;e.options.lineWrapping||(ie=Ut(Ir(Ct(v,K.line))),v.iter(ie,Y.line+1,function(qe){if(qe==R.maxLine)return re=!0,!0})),v.sel.contains(n.from,n.to)>-1&&Ee(e),Po(v,n,b,ma(e)),e.options.lineWrapping||(v.iter(ie,K.line+n.text.length,function(qe){var rt=Gi(qe);rt>R.maxLineLength&&(R.maxLine=qe,R.maxLineLength=rt,R.maxLineChanged=!0,re=!1)}),re&&(e.curOp.updateMaxLine=!0)),$r(v,K.line),Sn(e,400);var ue=n.text.length-(Y.line-K.line)-1;n.full?Fr(e):K.line==Y.line&&n.text.length==1&&!Pa(e.doc,n)?xi(e,K.line,"text"):Fr(e,K.line,Y.line+1,ue);var Te=ve(e,"changes"),Pe=ve(e,"change");if(Pe||Te){var $e={from:K,to:Y,text:n.text,removed:n.removed,origin:n.origin};Pe&&Cr(e,"change",e,$e),Te&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push($e)}e.display.selForContextMenu=null}function rn(e,n,b,v,R){var K;v||(v=b),xt(v,b)<0&&(K=[v,b],b=K[0],v=K[1]),typeof n=="string"&&(n=e.splitLines(n)),tn(e,{from:b,to:v,text:n,origin:R})}function Ja(e,n,b,v){b<e.line?e.line+=v:n<e.line&&(e.line=n,e.ch=0)}function es(e,n,b,v){for(var R=0;R<e.length;++R){var K=e[R],Y=!0;if(K.ranges){K.copied||(K=e[R]=K.deepCopy(),K.copied=!0);for(var re=0;re<K.ranges.length;re++)Ja(K.ranges[re].anchor,n,b,v),Ja(K.ranges[re].head,n,b,v);continue}for(var ie=0;ie<K.changes.length;++ie){var ue=K.changes[ie];if(b<ue.from.line)ue.from=nt(ue.from.line+v,ue.from.ch),ue.to=nt(ue.to.line+v,ue.to.ch);else if(n<=ue.to.line){Y=!1;break}}Y||(e.splice(0,R+1),R=0)}}function ts(e,n){var b=n.from.line,v=n.to.line,R=n.text.length-(v-b)-1;es(e.done,b,v,R),es(e.undone,b,v,R)}function An(e,n,b,v){var R=n,K=n;return typeof n=="number"?K=Ct(e,q(e,n)):R=Ut(n),R==null?null:(v(K,R)&&e.cm&&xi(e.cm,R,b),K)}function Ln(e){this.lines=e,this.parent=null;for(var n=0,b=0;b<e.length;++b)e[b].parent=this,n+=e[b].height;this.height=n}Ln.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,n){for(var b=e,v=e+n;b<v;++b){var R=this.lines[b];this.height-=R.height,co(R),Cr(R,"delete")}this.lines.splice(e,n)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,n,b){this.height+=b,this.lines=this.lines.slice(0,e).concat(n).concat(this.lines.slice(e));for(var v=0;v<n.length;++v)n[v].parent=this},iterN:function(e,n,b){for(var v=e+n;e<v;++e)if(b(this.lines[e]))return!0}};function kn(e){this.children=e;for(var n=0,b=0,v=0;v<e.length;++v){var R=e[v];n+=R.chunkSize(),b+=R.height,R.parent=this}this.size=n,this.height=b,this.parent=null}kn.prototype={chunkSize:function(){return this.size},removeInner:function(e,n){this.size-=n;for(var b=0;b<this.children.length;++b){var v=this.children[b],R=v.chunkSize();if(e<R){var K=Math.min(n,R-e),Y=v.height;if(v.removeInner(e,K),this.height-=Y-v.height,R==K&&(this.children.splice(b--,1),v.parent=null),(n-=K)==0)break;e=0}else e-=R}if(this.size-n<25&&(this.children.length>1||!(this.children[0]instanceof Ln))){var re=[];this.collapse(re),this.children=[new Ln(re)],this.children[0].parent=this}},collapse:function(e){for(var n=0;n<this.children.length;++n)this.children[n].collapse(e)},insertInner:function(e,n,b){this.size+=n.length,this.height+=b;for(var v=0;v<this.children.length;++v){var R=this.children[v],K=R.chunkSize();if(e<=K){if(R.insertInner(e,n,b),R.lines&&R.lines.length>50){for(var Y=R.lines.length%25+25,re=Y;re<R.lines.length;){var ie=new Ln(R.lines.slice(re,re+=25));R.height-=ie.height,this.children.splice(++v,0,ie),ie.parent=this}R.lines=R.lines.slice(0,Y),this.maybeSpill()}break}e-=K}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var n=e.children.splice(e.children.length-5,5),b=new kn(n);if(e.parent){e.size-=b.size,e.height-=b.height;var R=ye(e.parent.children,e);e.parent.children.splice(R+1,0,b)}else{var v=new kn(e.children);v.parent=e,e.children=[v,b],e=v}b.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,n,b){for(var v=0;v<this.children.length;++v){var R=this.children[v],K=R.chunkSize();if(e<K){var Y=Math.min(n,K-e);if(R.iterN(e,Y,b))return!0;if((n-=Y)==0)break;e=0}else e-=K}}};var Rn=function(e,n,b){if(b)for(var v in b)b.hasOwnProperty(v)&&(this[v]=b[v]);this.doc=e,this.node=n};Rn.prototype.clear=function(){var e=this.doc.cm,n=this.line.widgets,b=this.line,v=Ut(b);if(v==null||!n)return;for(var R=0;R<n.length;++R)n[R]==this&&n.splice(R--,1);n.length||(b.widgets=null);var K=gn(this);Tr(b,Math.max(0,b.height-K)),e&&(jr(e,function(){rs(e,b,-K),xi(e,v,"widget")}),Cr(e,"lineWidgetCleared",e,this,v))},Rn.prototype.changed=function(){var e=this,n=this.height,b=this.doc.cm,v=this.line;this.height=null;var R=gn(this)-n;if(!R)return;Xr(this.doc,v)||Tr(v,v.height+R),b&&jr(b,function(){b.curOp.forceUpdate=!0,rs(b,v,R),Cr(b,"lineWidgetChanged",b,e,Ut(v))})},be(Rn);function rs(e,n,b){oi(n)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ao(e,b)}function xl(e,n,b,v){var R=new Rn(e,b,v),K=e.cm;return K&&R.noHScroll&&(K.display.alignWidgets=!0),An(e,n,"widget",function(Y){var re=Y.widgets||(Y.widgets=[]);if(R.insertAt==null?re.push(R):re.splice(Math.min(re.length-1,Math.max(0,R.insertAt)),0,R),R.line=Y,K&&!Xr(e,Y)){var ie=oi(Y)<e.scrollTop;Tr(Y,Y.height+gn(R)),ie&&Ao(K,R.height),K.curOp.forceUpdate=!0}return!0}),K&&Cr(K,"lineWidgetAdded",K,R,typeof n=="number"?n:Ut(n)),R}var is=0,Ti=function(e,n){this.lines=[],this.type=n,this.doc=e,this.id=++is};Ti.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,n=e&&!e.curOp;if(n&&Bi(e),ve(this,"clear")){var b=this.find();b&&Cr(this,"clear",b.from,b.to)}for(var v=null,R=null,K=0;K<this.lines.length;++K){var Y=this.lines[K],re=ii(Y.markedSpans,this);e&&!this.collapsed?xi(e,Ut(Y),"text"):e&&(re.to!=null&&(R=Ut(Y)),re.from!=null&&(v=Ut(Y))),Y.markedSpans=pi(Y.markedSpans,re),re.from==null&&this.collapsed&&!Xr(this.doc,Y)&&e&&Tr(Y,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var ie=0;ie<this.lines.length;++ie){var ue=Ir(this.lines[ie]),Te=Gi(ue);Te>e.display.maxLineLength&&(e.display.maxLine=ue,e.display.maxLineLength=Te,e.display.maxLineChanged=!0)}v!=null&&e&&this.collapsed&&Fr(e,v,R+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ga(e.doc)),e&&Cr(e,"markerCleared",e,this,v,R),n&&Ui(e),this.parent&&this.parent.clear()},Ti.prototype.find=function(e,n){e==null&&this.type=="bookmark"&&(e=1);for(var b,v,R=0;R<this.lines.length;++R){var K=this.lines[R],Y=ii(K.markedSpans,this);if(Y.from!=null&&(b=nt(n?K:Ut(K),Y.from),e==-1))return b;if(Y.to!=null&&(v=nt(n?K:Ut(K),Y.to),e==1))return v}return b&&{from:b,to:v}},Ti.prototype.changed=function(){var e=this,n=this.find(-1,!0),b=this,v=this.doc.cm;if(!n||!v)return;jr(v,function(){var R=n.line,K=Ut(n.line),Y=mo(v,K);if(Y&&(sa(Y),v.curOp.selectionChanged=v.curOp.forceUpdate=!0),v.curOp.updateMaxLine=!0,!Xr(b.doc,R)&&b.height!=null){var re=b.height;b.height=null;var ie=gn(b)-re;ie&&Tr(R,R.height+ie)}Cr(v,"markerChanged",v,e)})},Ti.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(!n.maybeHiddenMarkers||ye(n.maybeHiddenMarkers,this)==-1)&&(n.maybeUnhiddenMarkers||(n.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ti.prototype.detachLine=function(e){if(this.lines.splice(ye(this.lines,e),1),!this.lines.length&&this.doc.cm){var n=this.doc.cm.curOp;(n.maybeHiddenMarkers||(n.maybeHiddenMarkers=[])).push(this)}},be(Ti);function nn(e,n,b,v,R){if(v&&v.shared)return El(e,n,b,v,R);if(e.cm&&!e.cm.curOp)return _r(e.cm,nn)(e,n,b,v,R);var K=new Ti(e,R),Y=xt(n,b);if(v&&H(v,K,!1),Y>0||Y==0&&K.clearWhenEmpty!==!1)return K;if(K.replacedWith&&(K.collapsed=!0,K.widgetNode=P("span",[K.replacedWith],"CodeMirror-widget"),v.handleMouseEvents||K.widgetNode.setAttribute("cm-ignore-events","true"),v.insertLeft&&(K.widgetNode.insertLeft=!0)),K.collapsed){if(cr(e,n.line,n,b,K)||n.line!=b.line&&cr(e,b.line,n,b,K))throw new Error("Inserting collapsed marker partially overlapping an existing one");Hr()}K.addToHistory&&Ua(e,{from:n,to:b,origin:"markText"},e.sel,NaN);var re=n.line,ie=e.cm,ue;if(e.iter(re,b.line+1,function(Pe){ie&&K.collapsed&&!ie.options.lineWrapping&&Ir(Pe)==ie.display.maxLine&&(ue=!0),K.collapsed&&re!=n.line&&Tr(Pe,0),ui(Pe,new yi(K,re==n.line?n.ch:null,re==b.line?b.ch:null)),++re}),K.collapsed&&e.iter(n.line,b.line+1,function(Pe){Xr(e,Pe)&&Tr(Pe,0)}),K.clearOnEnter&&Ke(K,"beforeCursorEnter",function(){return K.clear()}),K.readOnly&&(Yr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),K.collapsed&&(K.id=++is,K.atomic=!0),ie){if(ue&&(ie.curOp.updateMaxLine=!0),K.collapsed)Fr(ie,n.line,b.line+1);else if(K.className||K.startStyle||K.endStyle||K.css||K.attributes||K.title)for(var Te=n.line;Te<=b.line;Te++)xi(ie,Te,"text");K.atomic&&Ga(ie.doc),Cr(ie,"markerAdded",ie,K)}return K}var Dn=function(e,n){this.markers=e,this.primary=n;for(var b=0;b<e.length;++b)e[b].parent=this};Dn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Cr(this,"clear")},Dn.prototype.find=function(e,n){return this.primary.find(e,n)},be(Dn);function El(e,n,b,v,R){v=H(v),v.shared=!1;var K=[nn(e,n,b,v,R)],Y=K[0],re=v.widgetNode;return wi(e,function(ie){re&&(v.widgetNode=re.cloneNode(!0)),K.push(nn(ie,I(ie,n),I(ie,b),v,R));for(var ue=0;ue<ie.linked.length;++ue)if(ie.linked[ue].isParent)return;Y=le(K)}),new Dn(K,Y)}function ns(e){return e.findMarks(nt(e.first,0),e.clipPos(nt(e.lastLine())),function(n){return n.parent})}function Sl(e,n){for(var b=0;b<n.length;b++){var v=n[b],R=v.find(),K=e.clipPos(R.from),Y=e.clipPos(R.to);if(xt(K,Y)){var re=nn(e,K,Y,v.primary,v.primary.type);v.markers.push(re),re.parent=v}}}function Cl(e){for(var n=function(v){var R=e[v],K=[R.primary.doc];wi(R.primary.doc,function(ie){return K.push(ie)});for(var Y=0;Y<R.markers.length;Y++){var re=R.markers[Y];ye(K,re.doc)==-1&&(re.parent=null,R.markers.splice(Y--,1))}},b=0;b<e.length;b++)n(b)}var wl=0,Nr=function(e,n,b,v,R){if(!(this instanceof Nr))return new Nr(e,n,b,v,R);b==null&&(b=0),kn.call(this,[new Ln([new Di("",null)])]),this.first=b,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=b;var K=nt(b,0);this.sel=Si(K),this.history=new qn(null),this.id=++wl,this.modeOption=n,this.lineSep=v,this.direction=R=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Po(this,{from:K,to:K,text:e}),Ar(this,Si(K),Ye)};Nr.prototype=fe(kn.prototype,{constructor:Nr,iter:function(e,n,b){b?this.iterN(e-this.first,n-e,b):this.iterN(this.first,this.first+this.size,e)},insert:function(e,n){for(var b=0,v=0;v<n.length;++v)b+=n[v].height;this.insertInner(e-this.first,n,b)},remove:function(e,n){this.removeInner(e-this.first,n)},getValue:function(e){var n=ti(this,this.first,this.first+this.size);return e===!1?n:n.join(e||this.lineSeparator())},setValue:br(function(e){var n=nt(this.first,0),b=this.first+this.size-1;tn(this,{from:n,to:nt(b,Ct(this,b).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&_n(this.cm,0,0),Ar(this,Si(n),Ye)}),replaceRange:function(e,n,b,v){n=I(this,n),b=b?I(this,b):n,rn(this,e,n,b,v)},getRange:function(e,n,b){var v=Mr(this,I(this,e),I(this,n));return b===!1?v:v.join(b||this.lineSeparator())},getLine:function(e){var n=this.getLineHandle(e);return n&&n.text},getLineHandle:function(e){if(zr(this,e))return Ct(this,e)},getLineNumber:function(e){return Ut(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ct(this,e)),Ir(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return I(this,e)},getCursor:function(e){var n=this.sel.primary(),b;return e==null||e=="head"?b=n.head:e=="anchor"?b=n.anchor:e=="end"||e=="to"||e===!1?b=n.to():b=n.from(),b},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:br(function(e,n,b){ja(this,I(this,typeof e=="number"?nt(e,n||0):e),null,b)}),setSelection:br(function(e,n,b){ja(this,I(this,e),I(this,n||e),b)}),extendSelection:br(function(e,n,b){Jn(this,I(this,e),n&&I(this,n),b)}),extendSelections:br(function(e,n){Xa(this,Q(this,e),n)}),extendSelectionsBy:br(function(e,n){var b=Se(this.sel.ranges,e);Xa(this,Q(this,b),n)}),setSelections:br(function(e,n,b){if(!e.length)return;for(var v=[],R=0;R<e.length;R++)v[R]=new Jt(I(this,e[R].anchor),I(this,e[R].head));n==null&&(n=Math.min(e.length-1,this.sel.primIndex)),Ar(this,si(this.cm,v,n),b)}),addSelection:br(function(e,n,b){var v=this.sel.ranges.slice(0);v.push(new Jt(I(this,e),I(this,n||e))),Ar(this,si(this.cm,v,v.length-1),b)}),getSelection:function(e){for(var n=this.sel.ranges,b,v=0;v<n.length;v++){var R=Mr(this,n[v].from(),n[v].to());b=b?b.concat(R):R}return e===!1?b:b.join(e||this.lineSeparator())},getSelections:function(e){for(var n=[],b=this.sel.ranges,v=0;v<b.length;v++){var R=Mr(this,b[v].from(),b[v].to());e!==!1&&(R=R.join(e||this.lineSeparator())),n[v]=R}return n},replaceSelection:function(e,n,b){for(var v=[],R=0;R<this.sel.ranges.length;R++)v[R]=e;this.replaceSelections(v,n,b||"+input")},replaceSelections:br(function(e,n,b){for(var v=[],R=this.sel,K=0;K<R.ranges.length;K++){var Y=R.ranges[K];v[K]={from:Y.from(),to:Y.to(),text:this.splitLines(e[K]),origin:b}}for(var re=n&&n!="end"&&dl(this,v,n),ie=v.length-1;ie>=0;ie--)tn(this,v[ie]);re?Wa(this,re):this.cm&&qi(this.cm)}),undo:br(function(){ro(this,"undo")}),redo:br(function(){ro(this,"redo")}),undoSelection:br(function(){ro(this,"undo",!0)}),redoSelection:br(function(){ro(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,n=0,b=0,v=0;v<e.done.length;v++)e.done[v].ranges||++n;for(var R=0;R<e.undone.length;R++)e.undone[R].ranges||++b;return{undo:n,redo:b}},clearHistory:function(){var e=this;this.history=new qn(this.history.maxGeneration),wi(this,function(n){return n.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:Ji(this.history.done),undone:Ji(this.history.undone)}},setHistory:function(e){var n=this.history=new qn(this.history.maxGeneration);n.done=Ji(e.done.slice(0),null,!0),n.undone=Ji(e.undone.slice(0),null,!0)},setGutterMarker:br(function(e,n,b){return An(this,e,"gutter",function(v){var R=v.gutterMarkers||(v.gutterMarkers={});return R[n]=b,!b&&Qe(R)&&(v.gutterMarkers=null),!0})}),clearGutter:br(function(e){var n=this;this.iter(function(b){b.gutterMarkers&&b.gutterMarkers[e]&&An(n,b,"gutter",function(){return b.gutterMarkers[e]=null,Qe(b.gutterMarkers)&&(b.gutterMarkers=null),!0})})}),lineInfo:function(e){var n;if(typeof e=="number"){if(!zr(this,e))return null;if(n=e,e=Ct(this,e),!e)return null}else if(n=Ut(e),n==null)return null;return{line:n,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:br(function(e,n,b){return An(this,e,n=="gutter"?"gutter":"class",function(v){var R=n=="text"?"textClass":n=="background"?"bgClass":n=="gutter"?"gutterClass":"wrapClass";if(!v[R])v[R]=b;else{if(x(b).test(v[R]))return!1;v[R]+=" "+b}return!0})}),removeLineClass:br(function(e,n,b){return An(this,e,n=="gutter"?"gutter":"class",function(v){var R=n=="text"?"textClass":n=="background"?"bgClass":n=="gutter"?"gutterClass":"wrapClass",K=v[R];if(K)if(b==null)v[R]=null;else{var Y=K.match(x(b));if(!Y)return!1;var re=Y.index+Y[0].length;v[R]=K.slice(0,Y.index)+(!Y.index||re==K.length?"":" ")+K.slice(re)||null}else return!1;return!0})}),addLineWidget:br(function(e,n,b){return xl(this,e,n,b)}),removeLineWidget:function(e){e.clear()},markText:function(e,n,b){return nn(this,I(this,e),I(this,n),b,b&&b.type||"range")},setBookmark:function(e,n){var b={replacedWith:n&&(n.nodeType==null?n.widget:n),insertLeft:n&&n.insertLeft,clearWhenEmpty:!1,shared:n&&n.shared,handleMouseEvents:n&&n.handleMouseEvents};return e=I(this,e),nn(this,e,e,b,"bookmark")},findMarksAt:function(e){e=I(this,e);var n=[],b=Ct(this,e.line).markedSpans;if(b)for(var v=0;v<b.length;++v){var R=b[v];(R.from==null||R.from<=e.ch)&&(R.to==null||R.to>=e.ch)&&n.push(R.marker.parent||R.marker)}return n},findMarks:function(e,n,b){e=I(this,e),n=I(this,n);var v=[],R=e.line;return this.iter(e.line,n.line+1,function(K){var Y=K.markedSpans;if(Y)for(var re=0;re<Y.length;re++){var ie=Y[re];!(ie.to!=null&&R==e.line&&e.ch>=ie.to||ie.from==null&&R!=e.line||ie.from!=null&&R==n.line&&ie.from>=n.ch)&&(!b||b(ie.marker))&&v.push(ie.marker.parent||ie.marker)}++R}),v},getAllMarks:function(){var e=[];return this.iter(function(n){var b=n.markedSpans;if(b)for(var v=0;v<b.length;++v)b[v].from!=null&&e.push(b[v].marker)}),e},posFromIndex:function(e){var n,b=this.first,v=this.lineSeparator().length;return this.iter(function(R){var K=R.text.length+v;if(K>e)return n=e,!0;e-=K,++b}),I(this,nt(b,n))},indexFromPos:function(e){e=I(this,e);var n=e.ch;if(e.line<this.first||e.ch<0)return 0;var b=this.lineSeparator().length;return this.iter(this.first,e.line,function(v){n+=v.text.length+b}),n},copy:function(e){var n=new Nr(ti(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return n.scrollTop=this.scrollTop,n.scrollLeft=this.scrollLeft,n.sel=this.sel,n.extend=!1,e&&(n.history.undoDepth=this.history.undoDepth,n.setHistory(this.getHistory())),n},linkedDoc:function(e){e||(e={});var n=this.first,b=this.first+this.size;e.from!=null&&e.from>n&&(n=e.from),e.to!=null&&e.to<b&&(b=e.to);var v=new Nr(ti(this,n,b),e.mode||this.modeOption,n,this.lineSep,this.direction);return e.sharedHist&&(v.history=this.history),(this.linked||(this.linked=[])).push({doc:v,sharedHist:e.sharedHist}),v.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(v,ns(this)),v},unlinkDoc:function(e){if(e instanceof ar&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n){var b=this.linked[n];if(b.doc!=e)continue;this.linked.splice(n,1),e.unlinkDoc(this),Cl(ns(this));break}if(e.history==this.history){var v=[e.id];wi(e,function(R){return v.push(R.id)},!0),e.history=new qn(null),e.history.done=Ji(this.history.done,v),e.history.undone=Ji(this.history.undone,v)}},iterLinkedDocs:function(e){wi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ut(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:br(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(n){return n.order=null}),this.cm&&fl(this.cm)})}),Nr.prototype.eachLine=Nr.prototype.iter;var os=0;function Tl(e){var n=this;if(as(n),He(n,e)||mi(n.display,e))return;J(e),S&&(os=+new Date);var b=Ii(n,e,!0),v=e.dataTransfer.files;if(!b||n.isReadOnly())return;if(v&&v.length&&window.FileReader&&window.File)for(var R=v.length,K=Array(R),Y=0,re=function(){++Y==R&&_r(n,function(){b=I(n.doc,b);var qe={from:b,to:b,text:n.doc.splitLines(K.filter(function(rt){return rt!=null}).join(n.doc.lineSeparator())),origin:"paste"};tn(n.doc,qe),Wa(n.doc,Si(I(n.doc,b),I(n.doc,Ci(qe))))})()},ie=function(qe,rt){if(n.options.allowDropFileTypes&&ye(n.options.allowDropFileTypes,qe.type)==-1){re();return}var ct=new FileReader;ct.onerror=function(){return re()},ct.onload=function(){var dt=ct.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(dt)){re();return}K[rt]=dt,re()},ct.readAsText(qe)},ue=0;ue<v.length;ue++)ie(v[ue],ue);else{if(n.state.draggingText&&n.doc.sel.contains(b)>-1){n.state.draggingText(e),setTimeout(function(){return n.display.input.focus()},20);return}try{var Te=e.dataTransfer.getData("Text");if(Te){var Pe;if(n.state.draggingText&&!n.state.draggingText.copy&&(Pe=n.listSelections()),eo(n.doc,Si(b,b)),Pe)for(var $e=0;$e<Pe.length;++$e)rn(n.doc,"",Pe[$e].anchor,Pe[$e].head,"drag");n.replaceSelection(Te,"around","paste"),n.display.input.focus()}}catch(qe){}}}function Al(e,n){if(S&&(!e.state.draggingText||+new Date-os<100)){me(n);return}if(He(e,n)||mi(e.display,n))return;if(n.dataTransfer.setData("Text",e.getSelection()),n.dataTransfer.effectAllowed="copyMove",n.dataTransfer.setDragImage&&!s){var b=g("img",null,null,"position: fixed; left: 0; top: 0;");b.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",u&&(b.width=b.height=1,e.display.wrapper.appendChild(b),b._top=b.offsetTop),n.dataTransfer.setDragImage(b,0,0),u&&b.parentNode.removeChild(b)}}function Ll(e,n){var b=Ii(e,n);if(!b)return;var v=document.createDocumentFragment();ya(e,b,v),e.display.dragCursor||(e.display.dragCursor=g("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,v)}function as(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var n=document.getElementsByClassName("CodeMirror"),b=[],v=0;v<n.length;v++){var R=n[v].CodeMirror;R&&b.push(R)}b.length&&b[0].operation(function(){for(var K=0;K<b.length;K++)e(b[K])})}var ls=!1;function kl(){if(ls)return;Rl(),ls=!0}function Rl(){var e;Ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Dl)},100))}),Ke(window,"blur",function(){return ss(Zi)})}function Dl(e){var n=e.display;n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.scrollbarsClipped=!1,e.setSize()}for(var Ai={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"},Mn=0;Mn<10;Mn++)Ai[Mn+48]=Ai[Mn+96]=String(Mn);for(var io=65;io<=90;io++)Ai[io]=String.fromCharCode(io);for(var On=1;On<=12;On++)Ai[On+111]=Ai[On+63235]="F"+On;var gi={};gi.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"},gi.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"},gi.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"},gi.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"]},gi.default=h?gi.macDefault:gi.pcDefault;function Ml(e){var n=e.split(/-(?!$)/);e=n[n.length-1];for(var b,v,R,K,Y=0;Y<n.length-1;Y++){var re=n[Y];if(/^(cmd|meta|m)$/i.test(re))K=!0;else if(/^a(lt)?$/i.test(re))b=!0;else if(/^(c|ctrl|control)$/i.test(re))v=!0;else if(/^s(hift)?$/i.test(re))R=!0;else throw new Error("Unrecognized modifier name: "+re)}return b&&(e="Alt-"+e),v&&(e="Ctrl-"+e),K&&(e="Cmd-"+e),R&&(e="Shift-"+e),e}function Ol(e){var n={};for(var b in e)if(e.hasOwnProperty(b)){var v=e[b];if(/^(name|fallthrough|(de|at)tach)$/.test(b))continue;if(v=="..."){delete e[b];continue}for(var R=Se(b.split(" "),Ml),K=0;K<R.length;K++){var Y=void 0,re=void 0;K==R.length-1?(re=R.join(" "),Y=v):(re=R.slice(0,K+1).join(" "),Y="...");var ie=n[re];if(!ie)n[re]=Y;else if(ie!=Y)throw new Error("Inconsistent bindings for "+re)}delete e[b]}for(var ue in n)e[ue]=n[ue];return e}function on(e,n,b,v){n=no(n);var R=n.call?n.call(e,v):n[e];if(R===!1)return"nothing";if(R==="...")return"multi";if(R!=null&&b(R))return"handled";if(n.fallthrough){if(Object.prototype.toString.call(n.fallthrough)!="[object Array]")return on(e,n.fallthrough,b,v);for(var K=0;K<n.fallthrough.length;K++){var Y=on(e,n.fallthrough[K],b,v);if(Y)return Y}}}function us(e){var n=typeof e=="string"?e:Ai[e.keyCode];return n=="Ctrl"||n=="Alt"||n=="Shift"||n=="Mod"}function cs(e,n,b){var v=e;return n.altKey&&v!="Alt"&&(e="Alt-"+e),(C?n.metaKey:n.ctrlKey)&&v!="Ctrl"&&(e="Ctrl-"+e),(C?n.ctrlKey:n.metaKey)&&v!="Mod"&&(e="Cmd-"+e),!b&&n.shiftKey&&v!="Shift"&&(e="Shift-"+e),e}function hs(e,n){if(u&&e.keyCode==34&&e.char)return!1;var b=Ai[e.keyCode];return b==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(b=e.code),cs(b,e,n))}function no(e){return typeof e=="string"?gi[e]:e}function an(e,n){for(var b=e.doc.sel.ranges,v=[],R=0;R<b.length;R++){for(var K=n(b[R]);v.length&&xt(K.from,le(v).to)<=0;){var Y=v.pop();if(xt(Y.from,K.from)<0){K.from=Y.from;break}}v.push(K)}jr(e,function(){for(var re=v.length-1;re>=0;re--)rn(e.doc,"",v[re].from,v[re].to,"+delete");qi(e)})}function Uo(e,n,b){var v=Ne(e.text,n+b,b);return v<0||v>e.text.length?null:v}function Ko(e,n,b){var v=Uo(e,n.ch,b);return v==null?null:new nt(n.line,v,b<0?"after":"before")}function Ho(e,n,b,v,R){if(e){n.doc.direction=="rtl"&&(R=-R);var K=Je(b,n.doc.direction);if(K){var Y=R<0?le(K):K[0],re=R<0==(Y.level==1),ie=re?"after":"before",ue;if(Y.level>0||n.doc.direction=="rtl"){var Te=Vi(n,b);ue=R<0?b.text.length-1:0;var Pe=di(n,Te,ue).top;ue=Me(function($e){return di(n,Te,$e).top==Pe},R<0==(Y.level==1)?Y.from:Y.to-1,ue),ie=="before"&&(ue=Uo(b,ue,1))}else ue=R<0?Y.to:Y.from;return new nt(v,ue,ie)}}return new nt(v,R<0?b.text.length:0,R<0?"before":"after")}function Il(e,n,b,v){var R=Je(n,e.doc.direction);if(!R)return Ko(n,b,v);b.ch>=n.text.length?(b.ch=n.text.length,b.sticky="before"):b.ch<=0&&(b.ch=0,b.sticky="after");var K=ae(R,b.ch,b.sticky),Y=R[K];if(e.doc.direction=="ltr"&&Y.level%2==0&&(v>0?Y.to>b.ch:Y.from<b.ch))return Ko(n,b,v);var re=function(vt,Et){return Uo(n,vt instanceof nt?vt.ch:vt,Et)},ie,ue=function(vt){return e.options.lineWrapping?(ie=ie||Vi(e,n),pa(e,n,ie,vt)):{begin:0,end:n.text.length}},Te=ue(b.sticky=="before"?re(b,-1):b.ch);if(e.doc.direction=="rtl"||Y.level==1){var Pe=Y.level==1==v<0,$e=re(b,Pe?1:-1);if($e!=null&&(Pe?$e<=Y.to&&$e<=Te.end:$e>=Y.from&&$e>=Te.begin)){var qe=Pe?"before":"after";return new nt(b.line,$e,qe)}}var rt=function(vt,Et,yt){for(var Tt=function(or,xr){return xr?new nt(b.line,re(or,1),"before"):new nt(b.line,or,"after")};vt>=0&&vt<R.length;vt+=Et){var Mt=R[vt],kt=Et>0==(Mt.level!=1),Kt=kt?yt.begin:re(yt.end,-1);if(Mt.from<=Kt&&Kt<Mt.to)return Tt(Kt,kt);if(Kt=kt?Mt.from:re(Mt.to,-1),yt.begin<=Kt&&Kt<yt.end)return Tt(Kt,kt)}},ct=rt(K+v,v,Te);if(ct)return ct;var dt=v>0?Te.end:re(Te.begin,-1);return dt!=null&&!(v>0&&dt==n.text.length)&&(ct=rt(v>0?0:R.length-1,v,ue(dt)),ct)?ct:null}var In={selectAll:Qa,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ye)},killLine:function(e){return an(e,function(n){if(n.empty()){var b=Ct(e.doc,n.head.line).text.length;return n.head.ch==b&&n.head.line<e.lastLine()?{from:n.head,to:nt(n.head.line+1,0)}:{from:n.head,to:nt(n.head.line,b)}}else return{from:n.from(),to:n.to()}})},deleteLine:function(e){return an(e,function(n){return{from:nt(n.from().line,0),to:I(e.doc,nt(n.to().line+1,0))}})},delLineLeft:function(e){return an(e,function(n){return{from:nt(n.from().line,0),to:n.from()}})},delWrappedLineLeft:function(e){return an(e,function(n){var b=e.charCoords(n.head,"div").top+5,v=e.coordsChar({left:0,top:b},"div");return{from:v,to:n.from()}})},delWrappedLineRight:function(e){return an(e,function(n){var b=e.charCoords(n.head,"div").top+5,v=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:b},"div");return{from:n.from(),to:v}})},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(nt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(nt(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(n){return ds(e,n.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(n){return fs(e,n.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(n){return Pl(e,n.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(n){var b=e.cursorCoords(n.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:b},"div")},We)},goLineLeft:function(e){return e.extendSelectionsBy(function(n){var b=e.cursorCoords(n.head,"div").top+5;return e.coordsChar({left:0,top:b},"div")},We)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(n){var b=e.cursorCoords(n.head,"div").top+5,v=e.coordsChar({left:0,top:b},"div");return v.ch<e.getLine(v.line).search(/\S/)?fs(e,n.head):v},We)},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 n=[],b=e.listSelections(),v=e.options.tabSize,R=0;R<b.length;R++){var K=b[R].from(),Y=V(e.getLine(K.line),K.ch,v);n.push(xe(v-Y%v))}e.replaceSelections(n)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return jr(e,function(){for(var n=e.listSelections(),b=[],v=0;v<n.length;v++){if(!n[v].empty())continue;var R=n[v].head,K=Ct(e.doc,R.line).text;if(K){if(R.ch==K.length&&(R=new nt(R.line,R.ch-1)),R.ch>0)R=new nt(R.line,R.ch+1),e.replaceRange(K.charAt(R.ch-1)+K.charAt(R.ch-2),nt(R.line,R.ch-2),R,"+transpose");else if(R.line>e.doc.first){var Y=Ct(e.doc,R.line-1).text;Y&&(R=new nt(R.line,1),e.replaceRange(K.charAt(0)+e.doc.lineSeparator()+Y.charAt(Y.length-1),nt(R.line-1,Y.length-1),R,"+transpose"))}}b.push(new Jt(R,R))}e.setSelections(b)})},newlineAndIndent:function(e){return jr(e,function(){for(var n=e.listSelections(),b=n.length-1;b>=0;b--)e.replaceRange(e.doc.lineSeparator(),n[b].anchor,n[b].head,"+input");n=e.listSelections();for(var v=0;v<n.length;v++)e.indentLine(n[v].from().line,null,!0);qi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,n){var b=Ct(e.doc,n),v=Ir(b);return v!=b&&(n=Ut(v)),Ho(!0,e,v,n,1)}function Pl(e,n){var b=Ct(e.doc,n),v=Wi(b);return v!=b&&(n=Ut(v)),Ho(!0,e,b,n,-1)}function fs(e,n){var b=ds(e,n.line),v=Ct(e.doc,b.line),R=Je(v,e.doc.direction);if(!R||R[0].level==0){var K=Math.max(b.ch,v.text.search(/\S/)),Y=n.line==b.line&&n.ch<=K&&n.ch;return nt(b.line,Y?0:K,b.sticky)}return b}function oo(e,n,b){if(typeof n=="string"&&(n=In[n],!n))return!1;e.display.input.ensurePolled();var v=e.display.shift,R=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),b&&(e.display.shift=!1),R=n(e)!=Ze}finally{e.display.shift=v,e.state.suppressEdits=!1}return R}function Fl(e,n,b){for(var v=0;v<e.state.keyMaps.length;v++){var R=on(n,e.state.keyMaps[v],b,e);if(R)return R}return e.options.extraKeys&&on(n,e.options.extraKeys,b,e)||on(n,e.options.keyMap,b,e)}var Nl=new ce;function Pn(e,n,b,v){var R=e.state.keySeq;if(R){if(us(n))return"handled";if(/\'$/.test(n)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==R&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,R+" "+n,b,v))return!0}return ps(e,n,b,v)}function ps(e,n,b,v){var R=Fl(e,n,v);return R=="multi"&&(e.state.keySeq=n),R=="handled"&&Cr(e,"keyHandled",e,n,b),(R=="handled"||R=="multi")&&(J(b),Co(e)),!!R}function ms(e,n){var b=hs(n,!0);return b?n.shiftKey&&!e.state.keySeq?Pn(e,"Shift-"+b,n,function(v){return oo(e,v,!0)})||Pn(e,b,n,function(v){if(typeof v=="string"?/^go[A-Z]/.test(v):v.motion)return oo(e,v)}):Pn(e,b,n,function(v){return oo(e,v)}):!1}function Bl(e,n,b){return Pn(e,"'"+b+"'",n,function(v){return oo(e,v,!0)})}var Xo=null;function gs(e){var n=this;if(e.target&&e.target!=n.display.input.getField())return;if(n.curOp.focus=X(),He(n,e))return;S&&_<11&&e.keyCode==27&&(e.returnValue=!1);var b=e.keyCode;n.display.shift=b==16||e.shiftKey;var v=ms(n,e);u&&(Xo=v?b:null,!v&&b==88&&!st&&(h?e.metaKey:e.ctrlKey)&&n.replaceSelection("",null,"cut")),D&&!h&&!v&&b==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),b==18&&!/\bCodeMirror-crosshair\b/.test(n.display.lineDiv.className)&&Ul(n)}function Ul(e){var n=e.display.lineDiv;W(n,"CodeMirror-crosshair");function b(v){(v.keyCode==18||!v.altKey)&&(E(n,"CodeMirror-crosshair"),he(document,"keyup",b),he(document,"mouseover",b))}Ke(document,"keyup",b),Ke(document,"mouseover",b)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),He(this,e)}function ys(e){var n=this;if(e.target&&e.target!=n.display.input.getField())return;if(mi(n.display,e)||He(n,e)||e.ctrlKey&&!e.altKey||h&&e.metaKey)return;var b=e.keyCode,v=e.charCode;if(u&&b==Xo){Xo=null,J(e);return}if(u&&(!e.which||e.which<10)&&ms(n,e))return;var R=String.fromCharCode(v==null?b:v);if(R=="\b")return;if(Bl(n,e,R))return;n.display.input.onKeyPress(e)}var Kl=400,jo=function(e,n,b){this.time=e,this.pos=n,this.button=b};jo.prototype.compare=function(e,n,b){return this.time+Kl>e&&xt(n,this.pos)==0&&b==this.button};var Fn,Nn;function Hl(e,n){var b=+new Date;return Nn&&Nn.compare(b,e,n)?(Fn=Nn=null,"triple"):Fn&&Fn.compare(b,e,n)?(Nn=new jo(b,e,n),Fn=null,"double"):(Fn=new jo(b,e,n),Nn=null,"single")}function _s(e){var n=this,b=n.display;if(He(n,e)||b.activeTouch&&b.input.supportsTouch())return;if(b.input.ensurePolled(),b.shift=e.shiftKey,mi(b,e)){p||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));return}if(Wo(n,e))return;var v=Ii(n,e),R=j(e),K=v?Hl(v,R):"single";if(window.focus(),R==1&&n.state.selectingText&&n.state.selectingText(e),v&&Xl(n,R,v,K,e))return;R==1?v?Wl(n,v,K,e):Xe(e)==b.scroller&&J(e):R==2?(v&&Jn(n.doc,v),setTimeout(function(){return b.input.focus()},20)):R==3&&(T?n.display.input.onContextMenu(e):ba(n))}function Xl(e,n,b,v,R){var K="Click";return v=="double"?K="Double"+K:v=="triple"&&(K="Triple"+K),K=(n==1?"Left":n==2?"Middle":"Right")+K,Pn(e,cs(K,R),R,function(Y){if(typeof Y=="string"&&(Y=In[Y]),!Y)return!1;var re=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),re=Y(e,b)!=Ze}finally{e.state.suppressEdits=!1}return re})}function jl(e,n,b){var v=e.getOption("configureMouse"),R=v?v(e,n,b):{};if(R.unit==null){var K=d?b.shiftKey&&b.metaKey:b.altKey;R.unit=K?"rectangle":n=="single"?"char":n=="double"?"word":"line"}return(R.extend==null||e.doc.extend)&&(R.extend=e.doc.extend||b.shiftKey),R.addNew==null&&(R.addNew=h?b.metaKey:b.ctrlKey),R.moveOnDrag==null&&(R.moveOnDrag=!(h?b.altKey:b.ctrlKey)),R}function Wl(e,n,b,v){S?setTimeout(U(_a,e),0):e.curOp.focus=X();var R=jl(e,b,v),K=e.doc.sel,Y;e.options.dragDrop&&we&&!e.isReadOnly()&&b=="single"&&(Y=K.contains(n))>-1&&(xt((Y=K.ranges[Y]).from(),n)<0||n.xRel>0)&&(xt(Y.to(),n)>0||n.xRel<0)?zl(e,v,n,R):Gl(e,v,n,R)}function zl(e,n,b,v){var R=e.display,K=!1,Y=_r(e,function(ue){p&&(R.scroller.draggable=!1),e.state.draggingText=!1,he(R.wrapper.ownerDocument,"mouseup",Y),he(R.wrapper.ownerDocument,"mousemove",re),he(R.scroller,"dragstart",ie),he(R.scroller,"drop",Y),K||(J(ue),v.addNew||Jn(e.doc,b,null,null,v.extend),p&&!s||S&&_==9?setTimeout(function(){R.wrapper.ownerDocument.body.focus({preventScroll:!0}),R.input.focus()},20):R.input.focus())}),re=function(ue){K=K||Math.abs(n.clientX-ue.clientX)+Math.abs(n.clientY-ue.clientY)>=10},ie=function(){return K=!0};p&&(R.scroller.draggable=!0),e.state.draggingText=Y,Y.copy=!v.moveOnDrag,R.scroller.dragDrop&&R.scroller.dragDrop(),Ke(R.wrapper.ownerDocument,"mouseup",Y),Ke(R.wrapper.ownerDocument,"mousemove",re),Ke(R.scroller,"dragstart",ie),Ke(R.scroller,"drop",Y),ba(e),setTimeout(function(){return R.input.focus()},20)}function bs(e,n,b){if(b=="char")return new Jt(n,n);if(b=="word")return e.findWordAt(n);if(b=="line")return new Jt(nt(n.line,0),I(e.doc,nt(n.line+1,0)));var v=b(e,n);return new Jt(v.from,v.to)}function Gl(e,n,b,v){var R=e.display,K=e.doc;J(n);var Y,re,ie=K.sel,ue=ie.ranges;if(v.addNew&&!v.extend?(re=K.sel.contains(b),re>-1?Y=ue[re]:Y=new Jt(b,b)):(Y=K.sel.primary(),re=K.sel.primIndex),v.unit=="rectangle")v.addNew||(Y=new Jt(b,b)),b=Ii(e,n,!0,!0),re=-1;else{var Te=bs(e,b,v.unit);v.extend?Y=No(Y,Te.anchor,Te.head,v.extend):Y=Te}v.addNew?re==-1?(re=ue.length,Ar(K,si(e,ue.concat([Y]),re),{scroll:!1,origin:"*mouse"})):ue.length>1&&ue[re].empty()&&v.unit=="char"&&!v.extend?(Ar(K,si(e,ue.slice(0,re).concat(ue.slice(re+1)),0),{scroll:!1,origin:"*mouse"}),ie=K.sel):Bo(K,re,Y,Oe):(re=0,Ar(K,new qr([Y],0),Oe),ie=K.sel);var Pe=b;function $e(yt){if(xt(Pe,yt)==0)return;if(Pe=yt,v.unit=="rectangle"){for(var Tt=[],Mt=e.options.tabSize,kt=V(Ct(K,b.line).text,b.ch,Mt),Kt=V(Ct(K,yt.line).text,yt.ch,Mt),or=Math.min(kt,Kt),xr=Math.max(kt,Kt),sr=Math.min(b.line,yt.line),Wr=Math.min(e.lastLine(),Math.max(b.line,yt.line));sr<=Wr;sr++){var Br=Ct(K,sr).text,pr=ze(Br,or,Mt);or==xr?Tt.push(new Jt(nt(sr,pr),nt(sr,pr))):Br.length>pr&&Tt.push(new Jt(nt(sr,pr),nt(sr,ze(Br,xr,Mt))))}Tt.length||Tt.push(new Jt(b,b)),Ar(K,si(e,ie.ranges.slice(0,re).concat(Tt),re),{origin:"*mouse",scroll:!1}),e.scrollIntoView(yt)}else{var Ur=Y,wr=bs(e,yt,v.unit),vr=Ur.anchor,mr;xt(wr.anchor,vr)>0?(mr=wr.head,vr=ir(Ur.from(),wr.anchor)):(mr=wr.anchor,vr=er(Ur.to(),wr.head));var ur=ie.ranges.slice(0);ur[re]=Vl(e,new Jt(I(K,vr),mr)),Ar(K,si(e,ur,re),Oe)}}var qe=R.wrapper.getBoundingClientRect(),rt=0;function ct(yt){var Tt=++rt,Mt=Ii(e,yt,!0,v.unit=="rectangle");if(!Mt)return;if(xt(Mt,Pe)!=0){e.curOp.focus=X(),$e(Mt);var kt=Vn(R,K);(Mt.line>=kt.to||Mt.line<kt.from)&&setTimeout(_r(e,function(){rt==Tt&&ct(yt)}),150)}else{var Kt=yt.clientY<qe.top?-20:yt.clientY>qe.bottom?20:0;Kt&&setTimeout(_r(e,function(){if(rt!=Tt)return;R.scroller.scrollTop+=Kt,ct(yt)}),50)}}function dt(yt){e.state.selectingText=!1,rt=Infinity,yt&&(J(yt),R.input.focus()),he(R.wrapper.ownerDocument,"mousemove",vt),he(R.wrapper.ownerDocument,"mouseup",Et),K.history.lastSelOrigin=null}var vt=_r(e,function(yt){yt.buttons===0||!j(yt)?dt(yt):ct(yt)}),Et=_r(e,dt);e.state.selectingText=Et,Ke(R.wrapper.ownerDocument,"mousemove",vt),Ke(R.wrapper.ownerDocument,"mouseup",Et)}function Vl(e,n){var b=n.anchor,v=n.head,R=Ct(e.doc,b.line);if(xt(b,v)==0&&b.sticky==v.sticky)return n;var K=Je(R);if(!K)return n;var Y=ae(K,b.ch,b.sticky),re=K[Y];if(re.from!=b.ch&&re.to!=b.ch)return n;var ie=Y+(re.from==b.ch==(re.level!=1)?0:1);if(ie==0||ie==K.length)return n;var ue;if(v.line!=b.line)ue=(v.line-b.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Te=ae(K,v.ch,v.sticky),Pe=Te-Y||(v.ch-b.ch)*(re.level==1?-1:1);Te==ie-1||Te==ie?ue=Pe<0:ue=Pe>0}var $e=K[ie+(ue?-1:0)],qe=ue==($e.level==1),rt=qe?$e.from:$e.to,ct=qe?"after":"before";return b.ch==rt&&b.sticky==ct?n:new Jt(new nt(b.line,rt,ct),v)}function xs(e,n,b,v){var R,K;if(n.touches)R=n.touches[0].clientX,K=n.touches[0].clientY;else try{R=n.clientX,K=n.clientY}catch($e){return!1}if(R>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;v&&J(n);var Y=e.display,re=Y.lineDiv.getBoundingClientRect();if(K>re.bottom||!ve(e,b))return Z(n);K-=re.top-Y.viewOffset;for(var ie=0;ie<e.display.gutterSpecs.length;++ie){var ue=Y.gutters.childNodes[ie];if(ue&&ue.getBoundingClientRect().right>=R){var Te=kr(e.doc,K),Pe=e.display.gutterSpecs[ie];return Re(e,b,e,Te,Pe.className,n),Z(n)}}}function Wo(e,n){return xs(e,n,"gutterClick",!0)}function Es(e,n){if(mi(e.display,n)||Yl(e,n))return;if(He(e,n,"contextmenu"))return;T||e.display.input.onContextMenu(n)}function Yl(e,n){return ve(e,"gutterContextMenu")?xs(e,n,"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-"),vn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Cs={},ao={};function Ql(e){var n=e.optionHandlers;function b(v,R,K,Y){e.defaults[v]=R,K&&(n[v]=Y?function(re,ie,ue){ue!=sn&&K(re,ie,ue)}:K)}e.defineOption=b,e.Init=sn,b("value","",function(v,R){return v.setValue(R)},!0),b("mode",null,function(v,R){v.doc.modeOption=R,Io(v)},!0),b("indentUnit",2,Io,!0),b("indentWithTabs",!1),b("smartIndent",!0),b("tabSize",4,function(v){wn(v),vn(v),Fr(v)},!0),b("lineSeparator",null,function(v,R){if(v.doc.lineSep=R,!R)return;var K=[],Y=v.doc.first;v.doc.iter(function(ie){for(var ue=0;;){var Te=ie.text.indexOf(R,ue);if(Te==-1)break;ue=Te+R.length,K.push(nt(Y,Te))}Y++});for(var re=K.length-1;re>=0;re--)rn(v.doc,R,K[re],nt(K[re].line,K[re].ch+R.length))}),b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(v,R,K){v.state.specialChars=new RegExp(R.source+(R.test(" ")?"":"| "),"g"),K!=sn&&v.refresh()}),b("specialCharPlaceholder",Qt,function(v){return v.refresh()},!0),b("electricChars",!0),b("inputStyle",r?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),b("spellcheck",!1,function(v,R){return v.getInputField().spellcheck=R},!0),b("autocorrect",!1,function(v,R){return v.getInputField().autocorrect=R},!0),b("autocapitalize",!1,function(v,R){return v.getInputField().autocapitalize=R},!0),b("rtlMoveVisually",!y),b("wholeLineUpdateBefore",!0),b("theme","default",function(v){Ss(v),Cn(v)},!0),b("keyMap","default",function(v,R,K){var Y=no(R),re=K!=sn&&no(K);re&&re.detach&&re.detach(v,Y),Y.attach&&Y.attach(v,re||null)}),b("extraKeys",null),b("configureMouse",null),b("lineWrapping",!1,ql,!0),b("gutters",[],function(v,R){v.display.gutterSpecs=Mo(R,v.options.lineNumbers),Cn(v)},!0),b("fixedGutter",!0,function(v,R){v.display.gutters.style.left=R?Eo(v.display)+"px":"0",v.refresh()},!0),b("coverGutterNextToScrollbar",!1,function(v){return $i(v)},!0),b("scrollbarStyle","native",function(v){Ta(v),$i(v),v.display.scrollbars.setScrollTop(v.doc.scrollTop),v.display.scrollbars.setScrollLeft(v.doc.scrollLeft)},!0),b("lineNumbers",!1,function(v,R){v.display.gutterSpecs=Mo(v.options.gutters,R),Cn(v)},!0),b("firstLineNumber",1,Cn,!0),b("lineNumberFormatter",function(v){return v},Cn,!0),b("showCursorWhenSelecting",!1,yn,!0),b("resetSelectionOnContextMenu",!0),b("lineWiseCopyCut",!0),b("pasteLinesPerSelection",!0),b("selectionsMayTouch",!1),b("readOnly",!1,function(v,R){R=="nocursor"&&(Zi(v),v.display.input.blur()),v.display.input.readOnlyChanged(R)}),b("screenReaderLabel",null,function(v,R){R=R===""?null:R,v.display.input.screenReaderLabelChanged(R)}),b("disableInput",!1,function(v,R){R||v.display.input.reset()},!0),b("dragDrop",!0,Zl),b("allowDropFileTypes",null),b("cursorBlinkRate",530),b("cursorScrollMargin",0),b("cursorHeight",1,yn,!0),b("singleCursorHeightPerLine",!0,yn,!0),b("workTime",100),b("workDelay",100),b("flattenSpans",!0,wn,!0),b("addModeClass",!1,wn,!0),b("pollInterval",100),b("undoDepth",200,function(v,R){return v.doc.history.undoDepth=R}),b("historyEventDelay",1250),b("viewportMargin",10,function(v){return v.refresh()},!0),b("maxHighlightLength",1e4,wn,!0),b("moveInputWithCursor",!0,function(v,R){R||v.display.input.resetPosition()}),b("tabindex",null,function(v,R){return v.display.input.getField().tabIndex=R||""}),b("autofocus",null),b("direction","ltr",function(v,R){return v.doc.setDirection(R)},!0),b("phrases",null)}function Zl(e,n,b){var v=b&&b!=sn;if(!n!=!v){var R=e.display.dragFunctions,K=n?Ke:he;K(e.display.scroller,"dragstart",R.start),K(e.display.scroller,"dragenter",R.enter),K(e.display.scroller,"dragover",R.over),K(e.display.scroller,"dragleave",R.leave),K(e.display.scroller,"drop",R.drop)}}function ql(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(E(e.display.wrapper,"CodeMirror-wrap"),Kn(e)),So(e),Fr(e),vn(e),setTimeout(function(){return $i(e)},100)}function ar(e,n){var b=this;if(!(this instanceof ar))return new ar(e,n);this.options=n=n?H(n):{},H(Cs,n,!1);var v=n.value;typeof v=="string"?v=new Nr(v,n.mode,null,n.lineSeparator,n.direction):n.mode&&(v.modeOption=n.mode),this.doc=v;var R=new ar.inputStyles[n.inputStyle](this),K=this.display=new cl(e,v,R,n);K.wrapper.CodeMirror=this,Ss(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ta(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 ce,keySeq:null,specialChars:null},n.autofocus&&!r&&K.input.focus(),S&&_<11&&setTimeout(function(){return b.display.input.reset(!0)},20),$l(this),kl(),Bi(this),this.curOp.forceUpdate=!0,Fa(this,v),n.autofocus&&!r||this.hasFocus()?setTimeout(function(){b.hasFocus()&&!b.state.focused&&wo(b)},20):Zi(this);for(var Y in ao)ao.hasOwnProperty(Y)&&ao[Y](this,n[Y],sn);ka(this),n.finishInit&&n.finishInit(this);for(var re=0;re<zo.length;++re)zo[re](this);Ui(this),p&&n.lineWrapping&&getComputedStyle(K.lineDiv).textRendering=="optimizelegibility"&&(K.lineDiv.style.textRendering="auto")}ar.defaults=Cs,ar.optionHandlers=ao;function $l(e){var n=e.display;Ke(n.scroller,"mousedown",_r(e,_s)),S&&_<11?Ke(n.scroller,"dblclick",_r(e,function(ie){if(He(e,ie))return;var ue=Ii(e,ie);if(!ue||Wo(e,ie)||mi(e.display,ie))return;J(ie);var Te=e.findWordAt(ue);Jn(e.doc,Te.anchor,Te.head)})):Ke(n.scroller,"dblclick",function(ie){return He(e,ie)||J(ie)}),Ke(n.scroller,"contextmenu",function(ie){return Es(e,ie)}),Ke(n.input.getField(),"contextmenu",function(ie){n.scroller.contains(ie.target)||Es(e,ie)});var b,v={end:0};function R(){n.activeTouch&&(b=setTimeout(function(){return n.activeTouch=null},1e3),v=n.activeTouch,v.end=+new Date)}function K(ie){if(ie.touches.length!=1)return!1;var ue=ie.touches[0];return ue.radiusX<=1&&ue.radiusY<=1}function Y(ie,ue){if(ue.left==null)return!0;var Te=ue.left-ie.left,Pe=ue.top-ie.top;return Te*Te+Pe*Pe>20*20}Ke(n.scroller,"touchstart",function(ie){if(!He(e,ie)&&!K(ie)&&!Wo(e,ie)){n.input.ensurePolled(),clearTimeout(b);var ue=+new Date;n.activeTouch={start:ue,moved:!1,prev:ue-v.end<=300?v:null},ie.touches.length==1&&(n.activeTouch.left=ie.touches[0].pageX,n.activeTouch.top=ie.touches[0].pageY)}}),Ke(n.scroller,"touchmove",function(){n.activeTouch&&(n.activeTouch.moved=!0)}),Ke(n.scroller,"touchend",function(ie){var ue=n.activeTouch;if(ue&&!mi(n,ie)&&ue.left!=null&&!ue.moved&&new Date-ue.start<300){var Te=e.coordsChar(n.activeTouch,"page"),Pe;!ue.prev||Y(ue,ue.prev)?Pe=new Jt(Te,Te):!ue.prev.prev||Y(ue,ue.prev.prev)?Pe=e.findWordAt(Te):Pe=new Jt(nt(Te.line,0),I(e.doc,nt(Te.line+1,0))),e.setSelection(Pe.anchor,Pe.head),e.focus(),J(ie)}R()}),Ke(n.scroller,"touchcancel",R),Ke(n.scroller,"scroll",function(){n.scroller.clientHeight&&(bn(e,n.scroller.scrollTop),Fi(e,n.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ke(n.scroller,"mousewheel",function(ie){return Ma(e,ie)}),Ke(n.scroller,"DOMMouseScroll",function(ie){return Ma(e,ie)}),Ke(n.wrapper,"scroll",function(){return n.wrapper.scrollTop=n.wrapper.scrollLeft=0}),n.dragFunctions={enter:function(ie){He(e,ie)||me(ie)},over:function(ie){He(e,ie)||(Ll(e,ie),me(ie))},start:function(ie){return Al(e,ie)},drop:_r(e,Tl),leave:function(ie){He(e,ie)||as(e)}};var re=n.input.getField();Ke(re,"keyup",function(ie){return vs.call(e,ie)}),Ke(re,"keydown",_r(e,gs)),Ke(re,"keypress",_r(e,ys)),Ke(re,"focus",function(ie){return wo(e,ie)}),Ke(re,"blur",function(ie){return Zi(e,ie)})}var zo=[];ar.defineInitHook=function(e){return zo.push(e)};function Bn(e,n,b,v){var R=e.doc,K;b==null&&(b="add"),b=="smart"&&(R.mode.indent?K=pt(e,n).state:b="prev");var Y=e.options.tabSize,re=Ct(R,n),ie=V(re.text,null,Y);re.stateAfter&&(re.stateAfter=null);var ue=re.text.match(/^\s*/)[0],Te;if(!v&&!/\S/.test(re.text))Te=0,b="not";else if(b=="smart"&&(Te=R.mode.indent(K,re.text.slice(ue.length),re.text),Te==Ze||Te>150)){if(!v)return;b="prev"}b=="prev"?n>R.first?Te=V(Ct(R,n-1).text,null,Y):Te=0:b=="add"?Te=ie+e.options.indentUnit:b=="subtract"?Te=ie-e.options.indentUnit:typeof b=="number"&&(Te=ie+b),Te=Math.max(0,Te);var Pe="",$e=0;if(e.options.indentWithTabs)for(var qe=Math.floor(Te/Y);qe;--qe)$e+=Y,Pe+=" ";if($e<Te&&(Pe+=xe(Te-$e)),Pe!=ue)return rn(R,Pe,nt(n,0),nt(n,ue.length),"+input"),re.stateAfter=null,!0;for(var rt=0;rt<R.sel.ranges.length;rt++){var ct=R.sel.ranges[rt];if(ct.head.line==n&&ct.head.ch<ue.length){var dt=nt(n,ue.length);Bo(R,rt,new Jt(dt,dt));break}}}var li=null;function so(e){li=e}function Go(e,n,b,v,R){var K=e.doc;e.display.shift=!1,v||(v=K.sel);var Y=+new Date-200,re=R=="paste"||e.state.pasteIncoming>Y,ie=ut(n),ue=null;if(re&&v.ranges.length>1)if(li&&li.text.join(`
`)==n){if(v.ranges.length%li.text.length==0){ue=[];for(var Te=0;Te<li.text.length;Te++)ue.push(K.splitLines(li.text[Te]))}}else ie.length==v.ranges.length&&e.options.pasteLinesPerSelection&&(ue=Se(ie,function(vt){return[vt]}));for(var Pe=e.curOp.updateInput,$e=v.ranges.length-1;$e>=0;$e--){var qe=v.ranges[$e],rt=qe.from(),ct=qe.to();qe.empty()&&(b&&b>0?rt=nt(rt.line,rt.ch-b):e.state.overwrite&&!re?ct=nt(ct.line,Math.min(Ct(K,ct.line).text.length,ct.ch+le(ie).length)):re&&li&&li.lineWise&&li.text.join(`
`)==ie.join(`
`)&&(rt=ct=nt(rt.line,0)));var dt={from:rt,to:ct,text:ue?ue[$e%ue.length]:ie,origin:R||(re?"paste":e.state.cutIncoming>Y?"cut":"+input")};tn(e.doc,dt),Cr(e,"inputRead",e,dt)}n&&!re&&Ts(e,n),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Pe),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,n){var b=e.clipboardData&&e.clipboardData.getData("Text");if(b)return e.preventDefault(),!n.isReadOnly()&&!n.options.disableInput&&jr(n,function(){return Go(n,b,0,null,"paste")}),!0}function Ts(e,n){if(!e.options.electricChars||!e.options.smartIndent)return;for(var b=e.doc.sel,v=b.ranges.length-1;v>=0;v--){var R=b.ranges[v];if(R.head.ch>100||v&&b.ranges[v-1].head.line==R.head.line)continue;var K=e.getModeAt(R.head),Y=!1;if(K.electricChars){for(var re=0;re<K.electricChars.length;re++)if(n.indexOf(K.electricChars.charAt(re))>-1){Y=Bn(e,R.head.line,"smart");break}}else K.electricInput&&(K.electricInput.test(Ct(e.doc,R.head.line).text.slice(0,R.head.ch))&&(Y=Bn(e,R.head.line,"smart")));Y&&Cr(e,"electricInput",e,R.head.line)}}function As(e){for(var n=[],b=[],v=0;v<e.doc.sel.ranges.length;v++){var R=e.doc.sel.ranges[v].head.line,K={anchor:nt(R,0),head:nt(R+1,0)};b.push(K),n.push(e.getRange(K.anchor,K.head))}return{text:n,ranges:b}}function Ls(e,n,b,v){e.setAttribute("autocorrect",b?"":"off"),e.setAttribute("autocapitalize",v?"":"off"),e.setAttribute("spellcheck",!!n)}function ks(){var e=g("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),n=g("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return p?e.style.width="1000px":e.setAttribute("wrap","off"),a&&(e.style.border="1px solid black"),Ls(e),n}function Jl(e){var n=e.optionHandlers,b=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(v,R){var K=this.options,Y=K[v];if(K[v]==R&&v!="mode")return;K[v]=R,n.hasOwnProperty(v)&&_r(this,n[v])(this,R,Y),Re(this,"optionChange",this,v)},getOption:function(v){return this.options[v]},getDoc:function(){return this.doc},addKeyMap:function(v,R){this.state.keyMaps[R?"push":"unshift"](no(v))},removeKeyMap:function(v){for(var R=this.state.keyMaps,K=0;K<R.length;++K)if(R[K]==v||R[K].name==v)return R.splice(K,1),!0},addOverlay:Rr(function(v,R){var K=v.token?v:e.getMode(this.options,v);if(K.startState)throw new Error("Overlays may not be stateful.");pe(this.state.overlays,{mode:K,modeSpec:v,opaque:R&&R.opaque,priority:R&&R.priority||0},function(Y){return Y.priority}),this.state.modeGen++,Fr(this)}),removeOverlay:Rr(function(v){for(var R=this.state.overlays,K=0;K<R.length;++K){var Y=R[K].modeSpec;if(Y==v||typeof v=="string"&&Y.name==v){R.splice(K,1),this.state.modeGen++,Fr(this);return}}}),indentLine:Rr(function(v,R,K){typeof R!="string"&&typeof R!="number"&&(R==null?R=this.options.smartIndent?"smart":"prev":R=R?"add":"subtract"),zr(this.doc,v)&&Bn(this,v,R,K)}),indentSelection:Rr(function(v){for(var R=this.doc.sel.ranges,K=-1,Y=0;Y<R.length;Y++){var re=R[Y];if(re.empty())re.head.line>K&&(Bn(this,re.head.line,v,!0),K=re.head.line,Y==this.doc.sel.primIndex&&qi(this));else{var ie=re.from(),ue=re.to(),Te=Math.max(K,ie.line);K=Math.min(this.lastLine(),ue.line-(ue.ch?0:1))+1;for(var Pe=Te;Pe<K;++Pe)Bn(this,Pe,v);var $e=this.doc.sel.ranges;ie.ch==0&&R.length==$e.length&&$e[Y].from().ch>0&&Bo(this.doc,Y,new Jt(ie,$e[Y].to()),Ye)}}}),getTokenAt:function(v,R){return nr(this,v,R)},getLineTokens:function(v,R){return nr(this,nt(v),R,!0)},getTokenTypeAt:function(v){v=I(this.doc,v);var R=at(this,Ct(this.doc,v.line)),K=0,Y=(R.length-1)/2,re=v.ch,ie;if(re==0)ie=R[2];else for(;;){var ue=K+Y>>1;if((ue?R[ue*2-1]:0)>=re)Y=ue;else if(R[ue*2+1]<re)K=ue+1;else{ie=R[ue*2+2];break}}var Te=ie?ie.indexOf("overlay "):-1;return Te<0?ie:Te==0?null:ie.slice(0,Te-1)},getModeAt:function(v){var R=this.doc.mode;return R.innerMode?e.innerMode(R,this.getTokenAt(v).state).mode:R},getHelper:function(v,R){return this.getHelpers(v,R)[0]},getHelpers:function(v,R){var K=[];if(!b.hasOwnProperty(R))return K;var Y=b[R],re=this.getModeAt(v);if(typeof re[R]=="string")Y[re[R]]&&K.push(Y[re[R]]);else if(re[R])for(var ie=0;ie<re[R].length;ie++){var ue=Y[re[R][ie]];ue&&K.push(ue)}else re.helperType&&Y[re.helperType]?K.push(Y[re.helperType]):Y[re.name]&&K.push(Y[re.name]);for(var Te=0;Te<Y._global.length;Te++){var Pe=Y._global[Te];Pe.pred(re,this)&&ye(K,Pe.val)==-1&&K.push(Pe.val)}return K},getStateAfter:function(v,R){var K=this.doc;return v=q(K,v==null?K.first+K.size-1:v),pt(this,v+1,R).state},cursorCoords:function(v,R){var K,Y=this.doc.sel.primary();return v==null?K=Y.head:typeof v=="object"?K=I(this.doc,v):K=v?Y.from():Y.to(),ai(this,K,R||"page")},charCoords:function(v,R){return vo(this,I(this.doc,v),R||"page")},coordsChar:function(v,R){return v=ha(this,v,R||"page"),_o(this,v.left,v.top)},lineAtHeight:function(v,R){return v=ha(this,{top:v,left:0},R||"page").top,kr(this.doc,v+this.display.viewOffset)},heightAtLine:function(v,R,K){var Y=!1,re;if(typeof v=="number"){var ie=this.doc.first+this.doc.size-1;v<this.doc.first?v=this.doc.first:v>ie&&(v=ie,Y=!0),re=Ct(this.doc,v)}else re=v;return jn(this,re,{top:0,left:0},R||"page",K||Y).top+(Y?this.doc.height-oi(re):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return Qi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(v,R,K,Y,re){var ie=this.display;v=ai(this,I(this.doc,v));var ue=v.bottom,Te=v.left;if(R.style.position="absolute",R.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(R),ie.sizer.appendChild(R),Y=="over")ue=v.top;else if(Y=="above"||Y=="near"){var Pe=Math.max(ie.wrapper.clientHeight,this.doc.height),$e=Math.max(ie.sizer.clientWidth,ie.lineSpace.clientWidth);(Y=="above"||v.bottom+R.offsetHeight>Pe)&&v.top>R.offsetHeight?ue=v.top-R.offsetHeight:v.bottom+R.offsetHeight<=Pe&&(ue=v.bottom),Te+R.offsetWidth>$e&&(Te=$e-R.offsetWidth)}R.style.top=ue+"px",R.style.left=R.style.right="",re=="right"?(Te=ie.sizer.clientWidth-R.offsetWidth,R.style.right="0px"):(re=="left"?Te=0:re=="middle"&&(Te=(ie.sizer.clientWidth-R.offsetWidth)/2),R.style.left=Te+"px"),K&&Zs(this,{left:Te,top:ue,right:Te+R.offsetWidth,bottom:ue+R.offsetHeight})},triggerOnKeyDown:Rr(gs),triggerOnKeyPress:Rr(ys),triggerOnKeyUp:vs,triggerOnMouseDown:Rr(_s),execCommand:function(v){if(In.hasOwnProperty(v))return In[v].call(null,this)},triggerElectric:Rr(function(v){Ts(this,v)}),findPosH:function(v,R,K,Y){var re=1;R<0&&(re=-1,R=-R);for(var ie=I(this.doc,v),ue=0;ue<R&&!(ie=Vo(this.doc,ie,re,K,Y),ie.hitSide);++ue);return ie},moveH:Rr(function(v,R){var K=this;this.extendSelectionsBy(function(Y){return K.display.shift||K.doc.extend||Y.empty()?Vo(K.doc,Y.head,v,R,K.options.rtlMoveVisually):v<0?Y.from():Y.to()},We)}),deleteH:Rr(function(v,R){var K=this.doc.sel,Y=this.doc;K.somethingSelected()?Y.replaceSelection("",null,"+delete"):an(this,function(re){var ie=Vo(Y,re.head,v,R,!1);return v<0?{from:ie,to:re.head}:{from:re.head,to:ie}})}),findPosV:function(v,R,K,Y){var re=1,ie=Y;R<0&&(re=-1,R=-R);for(var ue=I(this.doc,v),Te=0;Te<R;++Te){var Pe=ai(this,ue,"div");if(ie==null?ie=Pe.left:Pe.left=ie,ue=Rs(this,Pe,re,K),ue.hitSide)break}return ue},moveV:Rr(function(v,R){var K=this,Y=this.doc,re=[],ie=!this.display.shift&&!Y.extend&&Y.sel.somethingSelected();if(Y.extendSelectionsBy(function(Te){if(ie)return v<0?Te.from():Te.to();var Pe=ai(K,Te.head,"div");Te.goalColumn!=null&&(Pe.left=Te.goalColumn),re.push(Pe.left);var $e=Rs(K,Pe,v,R);return R=="page"&&Te==Y.sel.primary()&&Ao(K,vo(K,$e,"div").top-Pe.top),$e},We),re.length)for(var ue=0;ue<Y.sel.ranges.length;ue++)Y.sel.ranges[ue].goalColumn=re[ue]}),findWordAt:function(v){var R=this.doc,K=Ct(R,v.line).text,Y=v.ch,re=v.ch;if(K){var ie=this.getHelper(v,"wordChars");(v.sticky=="before"||re==K.length)&&Y?--Y:++re;for(var ue=K.charAt(Y),Te=Ve(ue,ie)?function(Pe){return Ve(Pe,ie)}:/\s/.test(ue)?function(Pe){return/\s/.test(Pe)}:function(Pe){return!/\s/.test(Pe)&&!Ve(Pe)};Y>0&&Te(K.charAt(Y-1));)--Y;for(;re<K.length&&Te(K.charAt(re));)++re}return new Jt(nt(v.line,Y),nt(v.line,re))},toggleOverwrite:function(v){if(v!=null&&v==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):E(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==X()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Rr(function(v,R){_n(this,v,R)}),getScrollInfo:function(){var v=this.display.scroller;return{left:v.scrollLeft,top:v.scrollTop,height:v.scrollHeight-hi(this)-this.display.barHeight,width:v.scrollWidth-hi(this)-this.display.barWidth,clientHeight:po(this),clientWidth:Mi(this)}},scrollIntoView:Rr(function(v,R){v==null?(v={from:this.doc.sel.primary().head,to:null},R==null&&(R=this.options.cursorScrollMargin)):typeof v=="number"?v={from:nt(v,0),to:null}:v.from==null&&(v={from:v,to:null}),v.to||(v.to=v.from),v.margin=R||0,v.from.line!=null?qs(this,v):Ea(this,v.from,v.to,v.margin)}),setSize:Rr(function(v,R){var K=this,Y=function(ie){return typeof ie=="number"||/^\d+$/.test(String(ie))?ie+"px":ie};v!=null&&(this.display.wrapper.style.width=Y(v)),R!=null&&(this.display.wrapper.style.height=Y(R)),this.options.lineWrapping&&la(this);var re=this.display.viewFrom;this.doc.iter(re,this.display.viewTo,function(ie){if(ie.widgets){for(var ue=0;ue<ie.widgets.length;ue++)if(ie.widgets[ue].noHScroll){xi(K,re,"widget");break}}++re}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(v){return jr(this,v)},startOperation:function(){return Bi(this)},endOperation:function(){return Ui(this)},refresh:Rr(function(){var v=this.display.cachedTextHeight;Fr(this),this.curOp.forceUpdate=!0,vn(this),_n(this,this.doc.scrollLeft,this.doc.scrollTop),Ro(this.display),(v==null||Math.abs(v-Yi(this.display))>.5||this.options.lineWrapping)&&So(this),Re(this,"refresh",this)}),swapDoc:Rr(function(v){var R=this.doc;return R.cm=null,this.state.selectingText&&this.state.selectingText(),Fa(this,v),vn(this),this.display.input.reset(),_n(this,v.scrollLeft,v.scrollTop),this.curOp.forceScroll=!0,Cr(this,"swapDoc",this,R),R}),phrase:function(v){var R=this.options.phrases;return R&&Object.prototype.hasOwnProperty.call(R,v)?R[v]:v},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}},be(e),e.registerHelper=function(v,R,K){b.hasOwnProperty(v)||(b[v]=e[v]={_global:[]}),b[v][R]=K},e.registerGlobalHelper=function(v,R,K,Y){e.registerHelper(v,R,Y),b[v]._global.push({pred:K,val:Y})}}function Vo(e,n,b,v,R){var K=n,Y=b,re=Ct(e,n.line),ie=R&&e.direction=="rtl"?-b:b;function ue(){var Et=n.line+ie;return Et<e.first||Et>=e.first+e.size?!1:(n=new nt(Et,n.ch,n.sticky),re=Ct(e,Et))}function Te(Et){var yt;if(v=="codepoint"){var Tt=re.text.charCodeAt(n.ch+(v>0?0:-1));isNaN(Tt)?yt=null:yt=new nt(n.line,Math.max(0,Math.min(re.text.length,n.ch+b*(Tt>=55296&&Tt<56320?2:1))),-b)}else R?yt=Il(e.cm,re,n,b):yt=Ko(re,n,b);if(yt==null)if(!Et&&ue())n=Ho(R,e.cm,re,n.line,ie);else return!1;else n=yt;return!0}if(v=="char"||v=="codepoint")Te();else if(v=="column")Te(!0);else if(v=="word"||v=="group")for(var Pe=null,$e=v=="group",qe=e.cm&&e.cm.getHelper(n,"wordChars"),rt=!0;!(b<0&&!Te(!rt));rt=!1){var ct=re.text.charAt(n.ch)||`
`,dt=Ve(ct,qe)?"w":$e&&ct==`
`?"n":!$e||/\s/.test(ct)?null:"p";if($e&&!rt&&!dt&&(dt="s"),Pe&&Pe!=dt){b<0&&(b=1,Te(),n.sticky="after");break}if(dt&&(Pe=dt),b>0&&!Te(!rt))break}var vt=to(e,n,K,Y,!0);return Ht(K,vt)&&(vt.hitSide=!0),vt}function Rs(e,n,b,v){var R=e.doc,K=n.left,Y;if(v=="page"){var re=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),ie=Math.max(re-.5*Yi(e.display),3);Y=(b>0?n.bottom:n.top)+b*ie}else v=="line"&&(Y=b>0?n.bottom+3:n.top-3);for(var ue;!(ue=_o(e,K,Y),!ue.outside);){if(b<0?Y<=0:Y>=R.height){ue.hitSide=!0;break}Y+=b*5}return ue}var rr=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ce,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};rr.prototype.init=function(e){var n=this,b=this,v=b.cm,R=b.div=e.lineDiv;Ls(R,v.options.spellcheck,v.options.autocorrect,v.options.autocapitalize);function K(re){for(var ie=re.target;ie;ie=ie.parentNode){if(ie==R)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(ie.className))break}return!1}Ke(R,"paste",function(re){if(!K(re)||He(v,re)||ws(re,v))return;_<=11&&setTimeout(_r(v,function(){return n.updateFromDOM()}),20)}),Ke(R,"compositionstart",function(re){n.composing={data:re.data,done:!1}}),Ke(R,"compositionupdate",function(re){n.composing||(n.composing={data:re.data,done:!1})}),Ke(R,"compositionend",function(re){n.composing&&(re.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),Ke(R,"touchstart",function(){return b.forceCompositionEnd()}),Ke(R,"input",function(){n.composing||n.readFromDOMSoon()});function Y(re){if(!K(re)||He(v,re))return;if(v.somethingSelected())so({lineWise:!1,text:v.getSelections()}),re.type=="cut"&&v.replaceSelection("",null,"cut");else if(v.options.lineWiseCopyCut){var ie=As(v);so({lineWise:!0,text:ie.text}),re.type=="cut"&&v.operation(function(){v.setSelections(ie.ranges,0,Ye),v.replaceSelection("",null,"cut")})}else return;if(re.clipboardData){re.clipboardData.clearData();var ue=li.text.join(`
`);if(re.clipboardData.setData("Text",ue),re.clipboardData.getData("Text")==ue){re.preventDefault();return}}var Te=ks(),Pe=Te.firstChild;v.display.lineSpace.insertBefore(Te,v.display.lineSpace.firstChild),Pe.value=li.text.join(`
`);var $e=document.activeElement;G(Pe),setTimeout(function(){v.display.lineSpace.removeChild(Te),$e.focus(),$e==R&&b.showPrimarySelection()},50)}Ke(R,"copy",Y),Ke(R,"cut",Y)},rr.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},rr.prototype.prepareSelection=function(){var e=va(this.cm,!1);return e.focus=document.activeElement==this.div,e},rr.prototype.showSelection=function(e,n){if(!e||!this.cm.display.view.length)return;(e.focus||n)&&this.showPrimarySelection(),this.showMultipleSelections(e)},rr.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},rr.prototype.showPrimarySelection=function(){var e=this.getSelection(),n=this.cm,b=n.doc.sel.primary(),v=b.from(),R=b.to();if(n.display.viewTo==n.display.viewFrom||v.line>=n.display.viewTo||R.line<n.display.viewFrom){e.removeAllRanges();return}var K=lo(n,e.anchorNode,e.anchorOffset),Y=lo(n,e.focusNode,e.focusOffset);if(K&&!K.bad&&Y&&!Y.bad&&xt(ir(K,Y),v)==0&&xt(er(K,Y),R)==0)return;var re=n.display.view,ie=v.line>=n.display.viewFrom&&Ds(n,v)||{node:re[0].measure.map[2],offset:0},ue=R.line<n.display.viewTo&&Ds(n,R);if(!ue){var Te=re[re.length-1].measure,Pe=Te.maps?Te.maps[Te.maps.length-1]:Te.map;ue={node:Pe[Pe.length-1],offset:Pe[Pe.length-2]-Pe[Pe.length-3]}}if(!ie||!ue){e.removeAllRanges();return}var $e=e.rangeCount&&e.getRangeAt(0),qe;try{qe=O(ie.node,ie.offset,ue.offset,ue.node)}catch(rt){}qe&&(!D&&n.state.focused?(e.collapse(ie.node,ie.offset),qe.collapsed||(e.removeAllRanges(),e.addRange(qe))):(e.removeAllRanges(),e.addRange(qe)),$e&&e.anchorNode==null?e.addRange($e):D&&this.startGracePeriod()),this.rememberSelection()},rr.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)},rr.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},rr.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},rr.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var n=e.getRangeAt(0).commonAncestorContainer;return F(this.div,n)},rr.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},rr.prototype.blur=function(){this.div.blur()},rr.prototype.getField=function(){return this.div},rr.prototype.supportsTouch=function(){return!0},rr.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():jr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function n(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},rr.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},rr.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),n=this.cm;if(i&&o&&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 b=lo(n,e.anchorNode,e.anchorOffset),v=lo(n,e.focusNode,e.focusOffset);b&&v&&jr(n,function(){Ar(n.doc,Si(b,v),Ye),(b.bad||v.bad)&&(n.curOp.selectionChanged=!0)})},rr.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,n=e.display,b=e.doc.sel.primary(),v=b.from(),R=b.to();if(v.ch==0&&v.line>e.firstLine()&&(v=nt(v.line-1,Ct(e.doc,v.line-1).length)),R.ch==Ct(e.doc,R.line).text.length&&R.line<e.lastLine()&&(R=nt(R.line+1,0)),v.line<n.viewFrom||R.line>n.viewTo-1)return!1;var K,Y,re;v.line==n.viewFrom||(K=Pi(e,v.line))==0?(Y=Ut(n.view[0].line),re=n.view[0].node):(Y=Ut(n.view[K].line),re=n.view[K-1].node.nextSibling);var ie=Pi(e,R.line),ue,Te;if(ie==n.view.length-1?(ue=n.viewTo-1,Te=n.lineDiv.lastChild):(ue=Ut(n.view[ie+1].line)-1,Te=n.view[ie+1].node.previousSibling),!re)return!1;for(var Pe=e.doc.splitLines(tu(e,re,Te,Y,ue)),$e=Mr(e.doc,nt(Y,0),nt(ue,Ct(e.doc,ue).text.length));Pe.length>1&&$e.length>1;)if(le(Pe)==le($e))Pe.pop(),$e.pop(),ue--;else if(Pe[0]==$e[0])Pe.shift(),$e.shift(),Y++;else break;for(var qe=0,rt=0,ct=Pe[0],dt=$e[0],vt=Math.min(ct.length,dt.length);qe<vt&&ct.charCodeAt(qe)==dt.charCodeAt(qe);)++qe;for(var Et=le(Pe),yt=le($e),Tt=Math.min(Et.length-(Pe.length==1?qe:0),yt.length-($e.length==1?qe:0));rt<Tt&&Et.charCodeAt(Et.length-rt-1)==yt.charCodeAt(yt.length-rt-1);)++rt;if(Pe.length==1&&$e.length==1&&Y==v.line)for(;qe&&qe>v.ch&&Et.charCodeAt(Et.length-rt-1)==yt.charCodeAt(yt.length-rt-1);)qe--,rt++;Pe[Pe.length-1]=Et.slice(0,Et.length-rt).replace(/^\u200b+/,""),Pe[0]=Pe[0].slice(qe).replace(/\u200b+$/,"");var Mt=nt(Y,qe),kt=nt(ue,$e.length?le($e).length-rt:0);if(Pe.length>1||Pe[0]||xt(Mt,kt))return rn(e.doc,Pe,Mt,kt,"+input"),!0},rr.prototype.ensurePolled=function(){this.forceCompositionEnd()},rr.prototype.reset=function(){this.forceCompositionEnd()},rr.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},rr.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)},rr.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&jr(this.cm,function(){return Fr(e.cm)})},rr.prototype.setUneditable=function(e){e.contentEditable="false"},rr.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||_r(this.cm,Go)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},rr.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},rr.prototype.onContextMenu=function(){},rr.prototype.resetPosition=function(){},rr.prototype.needsContentAttribute=!0;function Ds(e,n){var b=mo(e,n.line);if(!b||b.hidden)return null;var v=Ct(e.doc,n.line),R=ia(b,v,n.line),K=Je(v,e.doc.direction),Y="left";if(K){var re=ae(K,n.ch);Y=re%2?"right":"left"}var ie=aa(R.map,n.ch,Y);return ie.offset=ie.collapse=="right"?ie.end:ie.start,ie}function eu(e){for(var n=e;n;n=n.parentNode)if(/CodeMirror-gutter-wrapper/.test(n.className))return!0;return!1}function ln(e,n){return n&&(e.bad=!0),e}function tu(e,n,b,v,R){var K="",Y=!1,re=e.doc.lineSeparator(),ie=!1;function ue(qe){return function(rt){return rt.id==qe}}function Te(){Y&&(K+=re,ie&&(K+=re),Y=ie=!1)}function Pe(qe){qe&&(Te(),K+=qe)}function $e(qe){if(qe.nodeType==1){var rt=qe.getAttribute("cm-text");if(rt){Pe(rt);return}var ct=qe.getAttribute("cm-marker"),dt;if(ct){var vt=e.findMarks(nt(v,0),nt(R+1,0),ue(+ct));vt.length&&(dt=vt[0].find(0))&&Pe(Mr(e.doc,dt.from,dt.to).join(re));return}if(qe.getAttribute("contenteditable")=="false")return;var Et=/^(pre|div|p|li|table|br)$/i.test(qe.nodeName);if(!/^br$/i.test(qe.nodeName)&&qe.textContent.length==0)return;Et&&Te();for(var yt=0;yt<qe.childNodes.length;yt++)$e(qe.childNodes[yt]);/^(pre|p)$/i.test(qe.nodeName)&&(ie=!0),Et&&(Y=!0)}else qe.nodeType==3&&Pe(qe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!($e(n),n==b);)n=n.nextSibling,ie=!1;return K}function lo(e,n,b){var v;if(n==e.display.lineDiv){if(v=e.display.lineDiv.childNodes[b],!v)return ln(e.clipPos(nt(e.display.viewTo-1)),!0);n=null,b=0}else for(v=n;;v=v.parentNode){if(!v||v==e.display.lineDiv)return null;if(v.parentNode&&v.parentNode==e.display.lineDiv)break}for(var R=0;R<e.display.view.length;R++){var K=e.display.view[R];if(K.node==v)return ru(K,n,b)}}function ru(e,n,b){var v=e.text.firstChild,R=!1;if(!n||!F(v,n))return ln(nt(Ut(e.line),0),!0);if(n==v&&(R=!0,n=v.childNodes[b],b=0,!n)){var K=e.rest?le(e.rest):e.line;return ln(nt(Ut(K),K.text.length),R)}var Y=n.nodeType==3?n:null,re=n;for(!Y&&n.childNodes.length==1&&n.firstChild.nodeType==3&&(Y=n.firstChild,b&&(b=Y.nodeValue.length));re.parentNode!=v;)re=re.parentNode;var ie=e.measure,ue=ie.maps;function Te(dt,vt,Et){for(var yt=-1;yt<(ue?ue.length:0);yt++)for(var Tt=yt<0?ie.map:ue[yt],Mt=0;Mt<Tt.length;Mt+=3){var kt=Tt[Mt+2];if(kt==dt||kt==vt){var Kt=Ut(yt<0?e.line:e.rest[yt]),or=Tt[Mt]+Et;return(Et<0||kt!=dt)&&(or=Tt[Mt+(Et?1:0)]),nt(Kt,or)}}}var Pe=Te(Y,re,b);if(Pe)return ln(Pe,R);for(var $e=re.nextSibling,qe=Y?Y.nodeValue.length-b:0;$e;$e=$e.nextSibling){if(Pe=Te($e,$e.firstChild,0),Pe)return ln(nt(Pe.line,Pe.ch-qe),R);qe+=$e.textContent.length}for(var rt=re.previousSibling,ct=b;rt;rt=rt.previousSibling){if(Pe=Te(rt,rt.firstChild,-1),Pe)return ln(nt(Pe.line,Pe.ch+ct),R);ct+=rt.textContent.length}}var hr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ce,this.hasSelection=!1,this.composing=null};hr.prototype.init=function(e){var n=this,b=this,v=this.cm;this.createField(e);var R=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),a&&(R.style.width="0px"),Ke(R,"input",function(){S&&_>=9&&n.hasSelection&&(n.hasSelection=null),b.poll()}),Ke(R,"paste",function(Y){if(He(v,Y)||ws(Y,v))return;v.state.pasteIncoming=+new Date,b.fastPoll()});function K(Y){if(He(v,Y))return;if(v.somethingSelected())so({lineWise:!1,text:v.getSelections()});else if(v.options.lineWiseCopyCut){var re=As(v);so({lineWise:!0,text:re.text}),Y.type=="cut"?v.setSelections(re.ranges,null,Ye):(b.prevInput="",R.value=re.text.join(`
`),G(R))}else return;Y.type=="cut"&&(v.state.cutIncoming=+new Date)}Ke(R,"cut",K),Ke(R,"copy",K),Ke(e.scroller,"paste",function(Y){if(mi(e,Y)||He(v,Y))return;if(!R.dispatchEvent){v.state.pasteIncoming=+new Date,b.focus();return}var re=new Event("paste");re.clipboardData=Y.clipboardData,R.dispatchEvent(re)}),Ke(e.lineSpace,"selectstart",function(Y){mi(e,Y)||J(Y)}),Ke(R,"compositionstart",function(){var Y=v.getCursor("from");b.composing&&b.composing.range.clear(),b.composing={start:Y,range:v.markText(Y,v.getCursor("to"),{className:"CodeMirror-composing"})}}),Ke(R,"compositionend",function(){b.composing&&(b.poll(),b.composing.range.clear(),b.composing=null)})},hr.prototype.createField=function(e){this.wrapper=ks(),this.textarea=this.wrapper.firstChild},hr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},hr.prototype.prepareSelection=function(){var e=this.cm,n=e.display,b=e.doc,v=va(e);if(e.options.moveInputWithCursor){var R=ai(e,b.sel.primary().head,"div"),K=n.wrapper.getBoundingClientRect(),Y=n.lineDiv.getBoundingClientRect();v.teTop=Math.max(0,Math.min(n.wrapper.clientHeight-10,R.top+Y.top-K.top)),v.teLeft=Math.max(0,Math.min(n.wrapper.clientWidth-10,R.left+Y.left-K.left))}return v},hr.prototype.showSelection=function(e){var n=this.cm,b=n.display;A(b.cursorDiv,e.cursors),A(b.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},hr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var n=this.cm;if(n.somethingSelected()){this.prevInput="";var b=n.getSelection();this.textarea.value=b,n.state.focused&&G(this.textarea),S&&_>=9&&(this.hasSelection=b)}else e||(this.prevInput=this.textarea.value="",S&&_>=9&&(this.hasSelection=null))},hr.prototype.getField=function(){return this.textarea},hr.prototype.supportsTouch=function(){return!1},hr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!r||X()!=this.textarea))try{this.textarea.focus()}catch(e){}},hr.prototype.blur=function(){this.textarea.blur()},hr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},hr.prototype.receivedFocus=function(){this.slowPoll()},hr.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()})},hr.prototype.fastPoll=function(){var e=!1,n=this;n.pollingFast=!0;function b(){var v=n.poll();!v&&!e?(e=!0,n.polling.set(60,b)):(n.pollingFast=!1,n.slowPoll())}n.polling.set(20,b)},hr.prototype.poll=function(){var e=this,n=this.cm,b=this.textarea,v=this.prevInput;if(this.contextMenuPending||!n.state.focused||tt(b)&&!v&&!this.composing||n.isReadOnly()||n.options.disableInput||n.state.keySeq)return!1;var R=b.value;if(R==v&&!n.somethingSelected())return!1;if(S&&_>=9&&this.hasSelection===R||h&&/[\uf700-\uf7ff]/.test(R))return n.display.input.reset(),!1;if(n.doc.sel==n.display.selForContextMenu){var K=R.charCodeAt(0);if(K==8203&&!v&&(v="\u200B"),K==8666)return this.reset(),this.cm.execCommand("undo")}for(var Y=0,re=Math.min(v.length,R.length);Y<re&&v.charCodeAt(Y)==R.charCodeAt(Y);)++Y;return jr(n,function(){Go(n,R.slice(Y),v.length-Y,null,e.composing?"*compose":null),R.length>1e3||R.indexOf(`
`)>-1?b.value=e.prevInput="":e.prevInput=R,e.composing&&(e.composing.range.clear(),e.composing.range=n.markText(e.composing.start,n.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},hr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},hr.prototype.onKeyPress=function(){S&&_>=9&&(this.hasSelection=null),this.fastPoll()},hr.prototype.onContextMenu=function(e){var n=this,b=n.cm,v=b.display,R=n.textarea;n.contextMenuPending&&n.contextMenuPending();var K=Ii(b,e),Y=v.scroller.scrollTop;if(!K||u)return;var re=b.options.resetSelectionOnContextMenu;re&&b.doc.sel.contains(K)==-1&&_r(b,Ar)(b.doc,Si(K),Ye);var ie=R.style.cssText,ue=n.wrapper.style.cssText,Te=n.wrapper.offsetParent.getBoundingClientRect();n.wrapper.style.cssText="position: static",R.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-Te.top-5)+"px; left: "+(e.clientX-Te.left-5)+`px;
z-index: 1000; background: `+(S?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Pe;p&&(Pe=window.scrollY),v.input.focus(),p&&window.scrollTo(null,Pe),v.input.reset(),b.somethingSelected()||(R.value=n.prevInput=" "),n.contextMenuPending=qe,v.selForContextMenu=b.doc.sel,clearTimeout(v.detectingSelectAll);function $e(){if(R.selectionStart!=null){var ct=b.somethingSelected(),dt="\u200B"+(ct?R.value:"");R.value="\u21DA",R.value=dt,n.prevInput=ct?"":"\u200B",R.selectionStart=1,R.selectionEnd=dt.length,v.selForContextMenu=b.doc.sel}}function qe(){if(n.contextMenuPending!=qe)return;if(n.contextMenuPending=!1,n.wrapper.style.cssText=ue,R.style.cssText=ie,S&&_<9&&v.scrollbars.setScrollTop(v.scroller.scrollTop=Y),R.selectionStart!=null){(!S||S&&_<9)&&$e();var ct=0,dt=function(){v.selForContextMenu==b.doc.sel&&R.selectionStart==0&&R.selectionEnd>0&&n.prevInput=="\u200B"?_r(b,Qa)(b):ct++<10?v.detectingSelectAll=setTimeout(dt,500):(v.selForContextMenu=null,v.input.reset())};v.detectingSelectAll=setTimeout(dt,200)}}if(S&&_>=9&&$e(),T){me(e);var rt=function(){he(window,"mouseup",rt),setTimeout(qe,20)};Ke(window,"mouseup",rt)}else setTimeout(qe,50)},hr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},hr.prototype.setUneditable=function(){},hr.prototype.needsContentAttribute=!1;function iu(e,n){if(n=n?H(n):{},n.value=e.value,!n.tabindex&&e.tabIndex&&(n.tabindex=e.tabIndex),!n.placeholder&&e.placeholder&&(n.placeholder=e.placeholder),n.autofocus==null){var b=X();n.autofocus=b==e||e.getAttribute("autofocus")!=null&&b==document.body}function v(){e.value=re.getValue()}var R;if(e.form&&(Ke(e.form,"submit",v),!n.leaveSubmitMethodAlone)){var K=e.form;R=K.submit;try{var Y=K.submit=function(){v(),K.submit=R,K.submit(),K.submit=Y}}catch(ie){}}n.finishInit=function(ie){ie.save=v,ie.getTextArea=function(){return e},ie.toTextArea=function(){ie.toTextArea=isNaN,v(),e.parentNode.removeChild(ie.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",v),!n.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=R))}},e.style.display="none";var re=ar(function(ie){return e.parentNode.insertBefore(ie,e.nextSibling)},n);return re}function nu(e){e.off=he,e.on=Ke,e.wheelEventPixels=hl,e.Doc=Nr,e.splitLines=ut,e.countColumn=V,e.findColumn=ze,e.isWordChar=De,e.Pass=Ze,e.signal=Re,e.Line=Di,e.changeEnd=Ci,e.scrollbarModel=wa,e.Pos=nt,e.cmpPos=xt,e.modes=bt,e.mimeModes=ht,e.resolveMode=mt,e.getMode=St,e.modeExtensions=ft,e.extendMode=_t,e.copyState=Pt,e.startState=zt,e.innerMode=Nt,e.commands=In,e.keyMap=gi,e.keyName=hs,e.isModifierKey=us,e.lookupKey=on,e.normalizeKeyMap=Ol,e.StringStream=Dt,e.SharedTextMarker=Dn,e.TextMarker=Ti,e.LineWidget=Rn,e.e_preventDefault=J,e.e_stopPropagation=oe,e.e_stop=me,e.addClass=W,e.contains=F,e.rmClass=E,e.keyNames=Ai}Ql(ar),Jl(ar);var ou="iter insert remove copy getEditor constructor".split(" ");for(var uo in Nr.prototype)Nr.prototype.hasOwnProperty(uo)&&ye(ou,uo)<0&&(ar.prototype[uo]=function(e){return function(){return e.apply(this.doc,arguments)}}(Nr.prototype[uo]));return be(Nr),ar.inputStyles={textarea:hr,contenteditable:rr},ar.defineMode=function(e){!ar.defaults.mode&&e!="null"&&(ar.defaults.mode=e),Ot.apply(this,arguments)},ar.defineMIME=Bt,ar.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),ar.defineMIME("text/plain","null"),ar.defineExtension=function(e,n){ar.prototype[e]=n},ar.defineDocExtension=function(e,n){Nr.prototype[e]=n},ar.fromTextArea=iu,nu(ar),ar.version="5.58.2",ar})},Y1PL:function(ot,se,ee){"use strict";ee.r(se),ee.d(se,"ResizableTextArea",function(){return ye});var z=ee("wx14"),L=ee("1OyB"),D=ee("vuIU"),k=ee("Ji7U"),M=ee("LK+K"),f=ee("q1tI"),S=ee("VTBJ"),_=ee("rePB"),p=ee("Zm9Q"),c=ee("Kwbf"),o=ee("c+Xe"),u=ee("m+aA"),s=ee("bdgK"),l=new Map;function t(Ye){Ye.forEach(function(Oe){var We,ze=Oe.target;(We=l.get(ze))===null||We===void 0||We.forEach(function(Ae){return Ae(ze)})})}var a=new s.default(t),i=null,r=null;function h(Ye,Oe){l.has(Ye)||(l.set(Ye,new Set),a.observe(Ye)),l.get(Ye).add(Oe)}function d(Ye,Oe){l.has(Ye)&&(l.get(Ye).delete(Oe),l.get(Ye).size||(a.unobserve(Ye),l.delete(Ye)))}var y=function(Ye){Object(k.a)(We,Ye);var Oe=Object(M.a)(We);function We(){return Object(L.a)(this,We),Oe.apply(this,arguments)}return Object(D.a)(We,[{key:"render",value:function(){return this.props.children}}]),We}(f.Component),m=f.createContext(null);function C(Ye){var Oe=Ye.children,We=Ye.onBatchResize,ze=f.useRef(0),Ae=f.useRef([]),xe=f.useContext(m),le=f.useCallback(function(Se,pe,Ge){ze.current+=1;var fe=ze.current;Ae.current.push({size:Se,element:pe,data:Ge}),Promise.resolve().then(function(){fe===ze.current&&(We==null||We(Ae.current),Ae.current=[])}),xe==null||xe(Se,pe,Ge)},[We,xe]);return f.createElement(m.Provider,{value:le},Oe)}function T(Ye){var Oe=Ye.children,We=Ye.disabled,ze=f.useRef(null),Ae=f.useRef(null),xe=f.useContext(m),le=f.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Se=f.isValidElement(Oe)&&Object(o.c)(Oe),pe=Se?Oe.ref:null,Ge=f.useMemo(function(){return Object(o.a)(pe,ze)},[pe,ze]),fe=f.useRef(Ye);fe.current=Ye;var ge=f.useCallback(function(De){var Ve=fe.current,Qe=Ve.onResize,ke=Ve.data,Fe=De.getBoundingClientRect(),Ne=Fe.width,Me=Fe.height,ne=De.offsetWidth,_e=De.offsetHeight,ae=Math.floor(Ne),Ie=Math.floor(Me);if(le.current.width!==ae||le.current.height!==Ie||le.current.offsetWidth!==ne||le.current.offsetHeight!==_e){var Je={width:ae,height:Ie,offsetWidth:ne,offsetHeight:_e};le.current=Je;var et=ne===Math.round(Ne)?Ne:ne,Ke=_e===Math.round(Me)?Me:_e,it=Object(S.a)(Object(S.a)({},Je),{},{offsetWidth:et,offsetHeight:Ke});xe==null||xe(it,De,ke),Qe&&Promise.resolve().then(function(){Qe(it,De)})}},[]);return f.useEffect(function(){var De=Object(u.a)(ze.current)||Object(u.a)(Ae.current);return De&&!We&&h(De,ge),function(){return d(De,ge)}},[ze.current,We]),f.createElement(y,{ref:Ae},Se?f.cloneElement(Oe,{ref:Ge}):Oe)}var x="rc-observer-key";function E(Ye){var Oe=Ye.children,We=Object(p.a)(Oe);return We.map(function(ze,Ae){var xe=(ze==null?void 0:ze.key)||"".concat(x,"-").concat(Ae);return f.createElement(T,Object(z.a)({},Ye,{key:xe}),ze)})}E.Collection=C;var w=E,A=ee("bT9E"),g=ee("TSYQ"),P=ee.n(g),O=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,F=["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"],X={},W;function N(Ye){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=Ye.getAttribute("id")||Ye.getAttribute("data-reactid")||Ye.getAttribute("name");if(Oe&&X[We])return X[We];var ze=window.getComputedStyle(Ye),Ae=ze.getPropertyValue("box-sizing")||ze.getPropertyValue("-moz-box-sizing")||ze.getPropertyValue("-webkit-box-sizing"),xe=parseFloat(ze.getPropertyValue("padding-bottom"))+parseFloat(ze.getPropertyValue("padding-top")),le=parseFloat(ze.getPropertyValue("border-bottom-width"))+parseFloat(ze.getPropertyValue("border-top-width")),Se=F.map(function(Ge){return"".concat(Ge,":").concat(ze.getPropertyValue(Ge))}).join(";"),pe={sizingStyle:Se,paddingSize:xe,borderSize:le,boxSizing:Ae};return Oe&&We&&(X[We]=pe),pe}function G(Ye){var Oe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,We=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ze=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),Ye.getAttribute("wrap")?W.setAttribute("wrap",Ye.getAttribute("wrap")):W.removeAttribute("wrap");var Ae=N(Ye,Oe),xe=Ae.paddingSize,le=Ae.borderSize,Se=Ae.boxSizing,pe=Ae.sizingStyle;W.setAttribute("style","".concat(pe,";").concat(O)),W.value=Ye.value||Ye.placeholder||"";var Ge=Number.MIN_SAFE_INTEGER,fe=Number.MAX_SAFE_INTEGER,ge=W.scrollHeight,De;if(Se==="border-box"?ge+=le:Se==="content-box"&&(ge-=xe),We!==null||ze!==null){W.value=" ";var Ve=W.scrollHeight-xe;We!==null&&(Ge=Ve*We,Se==="border-box"&&(Ge=Ge+xe+le),ge=Math.max(Ge,ge)),ze!==null&&(fe=Ve*ze,Se==="border-box"&&(fe=fe+xe+le),De=ge>fe?"":"hidden",ge=Math.min(fe,ge))}return{height:ge,minHeight:Ge,maxHeight:fe,overflowY:De,resize:"none"}}var U=ee("Gytx"),H=ee.n(U),V;(function(Ye){Ye[Ye.NONE=0]="NONE",Ye[Ye.RESIZING=1]="RESIZING",Ye[Ye.RESIZED=2]="RESIZED"})(V||(V={}));var ce=function(Ye){Object(k.a)(We,Ye);var Oe=Object(M.a)(We);function We(ze){var Ae;return Object(L.a)(this,We),Ae=Oe.call(this,ze),Ae.nextFrameActionId=void 0,Ae.resizeFrameId=void 0,Ae.textArea=void 0,Ae.saveTextArea=function(xe){Ae.textArea=xe},Ae.handleResize=function(xe){var le=Ae.state.resizeStatus,Se=Ae.props,pe=Se.autoSize,Ge=Se.onResize;if(le!==V.NONE)return;typeof Ge=="function"&&Ge(xe),pe&&Ae.resizeOnNextFrame()},Ae.resizeOnNextFrame=function(){cancelAnimationFrame(Ae.nextFrameActionId),Ae.nextFrameActionId=requestAnimationFrame(Ae.resizeTextarea)},Ae.resizeTextarea=function(){var xe=Ae.props.autoSize;if(!xe||!Ae.textArea)return;var le=xe.minRows,Se=xe.maxRows,pe=G(Ae.textArea,!1,le,Se);Ae.setState({textareaStyles:pe,resizeStatus:V.RESIZING},function(){cancelAnimationFrame(Ae.resizeFrameId),Ae.resizeFrameId=requestAnimationFrame(function(){Ae.setState({resizeStatus:V.RESIZED},function(){Ae.resizeFrameId=requestAnimationFrame(function(){Ae.setState({resizeStatus:V.NONE}),Ae.fixFirefoxAutoScroll()})})})})},Ae.renderTextArea=function(){var xe=Ae.props,le=xe.prefixCls,Se=le===void 0?"rc-textarea":le,pe=xe.autoSize,Ge=xe.onResize,fe=xe.className,ge=xe.disabled,De=Ae.state,Ve=De.textareaStyles,Qe=De.resizeStatus,ke=Object(A.a)(Ae.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Fe=P()(Se,fe,Object(_.a)({},"".concat(Se,"-disabled"),ge));"value"in ke&&(ke.value=ke.value||"");var Ne=Object(S.a)(Object(S.a)(Object(S.a)({},Ae.props.style),Ve),Qe===V.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return f.createElement(w,{onResize:Ae.handleResize,disabled:!(pe||Ge)},f.createElement("textarea",Object(z.a)({},ke,{className:Fe,style:Ne,ref:Ae.saveTextArea})))},Ae.state={textareaStyles:{},resizeStatus:V.NONE},Ae}return Object(D.a)(We,[{key:"componentDidUpdate",value:function(Ae){(Ae.value!==this.props.value||!H()(Ae.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var Ae=this.textArea.selectionStart,xe=this.textArea.selectionEnd;this.textArea.setSelectionRange(Ae,xe)}}catch(le){}}},{key:"render",value:function(){return this.renderTextArea()}}]),We}(f.Component),ye=ce,Le=function(Ye){Object(k.a)(We,Ye);var Oe=Object(M.a)(We);function We(ze){var Ae;Object(L.a)(this,We),Ae=Oe.call(this,ze),Ae.resizableTextArea=void 0,Ae.focus=function(){Ae.resizableTextArea.textArea.focus()},Ae.saveTextArea=function(le){Ae.resizableTextArea=le},Ae.handleChange=function(le){var Se=Ae.props.onChange;Ae.setValue(le.target.value,function(){Ae.resizableTextArea.resizeTextarea()}),Se&&Se(le)},Ae.handleKeyDown=function(le){var Se=Ae.props,pe=Se.onPressEnter,Ge=Se.onKeyDown;le.keyCode===13&&pe&&pe(le),Ge&&Ge(le)};var xe=typeof ze.value=="undefined"||ze.value===null?ze.defaultValue:ze.value;return Ae.state={value:xe},Ae}return Object(D.a)(We,[{key:"setValue",value:function(Ae,xe){"value"in this.props||this.setState({value:Ae},xe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return f.createElement(ye,Object(z.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(Ae){return"value"in Ae?{value:Ae.value}:null}}]),We}(f.Component),Ze=se.default=Le},YJ9k:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(M,f){if(!(M instanceof f))throw new TypeError("Cannot call a class as a function")}function L(M,f){for(var S=0;S<f.length;S++){var _=f[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function D(M,f,S){return f&&L(M.prototype,f),S&&L(M,S),M}var k=function(){function M(){z(this,M),this._listeners=new Map}return D(M,[{key:"addEventListener",value:function(S,_){this._listeners.has(S)||this._listeners.set(S,new Set),this._listeners.get(S).add(_)}},{key:"removeEventListener",value:function(S,_){this._listeners.has(S)&&this._listeners.get(S).delete(_)}},{key:"dispatchEvent",value:function(S){var _=this;return this._listeners.has(S.type)?(this._listeners.get(S.type).forEach(function(p){return p.call(_,S)}),!S.defaultPrevented):!0}}]),M}();se.default=k},ZW9T:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return w});var z=ee("k1fw"),L=ee("oBTY"),D=ee("9og8"),k=ee("miYZ"),M=ee("tsqr"),f=ee("rAM+"),S=ee("tJVT"),_=ee("PpiC"),p=ee("WmNS"),c=ee.n(p),o=ee("q1tI"),u=ee.n(o),s=ee("bdgK");function l(A,g,P,O,F){var X=g.getWordUntilPosition(P),W={startLineNumber:P.lineNumber,endLineNumber:P.lineNumber,startColumn:X.startColumn,endColumn:X.endColumn},N=O.map(function(G){return{label:G,kind:A.languages.CompletionItemKind.Keyword,insertText:G,insertTextRules:A.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:W}});return F.map(function(G){N.push(Object(z.a)(Object(z.a)({},G),{},{range:W}))}),N}var t=function(A){var g={label:"ifelse",kind:A.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:A.languages.CompletionItemInsertTextRule.InsertAsSnippet},P=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];A.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(W,N){var G=l(A,W,N,P,[g]);return{suggestions:G}}});var O=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];A.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(W,N){var G=[{label:"print",kind:A.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:A.languages.CompletionItemInsertTextRule.InsertAsSnippet}],U=l(A,W,N,O,G);return{suggestions:U}}});var F=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];A.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(W,N){var G=[g,{label:"main",kind:A.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:A.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:A.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:A.languages.CompletionItemInsertTextRule.InsertAsSnippet}],U=l(A,W,N,F,G);return{suggestions:U}}})},a="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",i=ee("fjLI"),r=ee("LvDl"),h=ee("+ua5");function d(A){return/^\d+$/.test(A)?"".concat(A,"px"):A}function y(){}var m=!1,C={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale"};function T(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=A;if(Array.isArray(A)){for(var P=0;P<A.length;P++){var O=C[A[P]];if(O)return O}return g[0]}return C[g]||g}var x=null,E=se.b=function(A){var g=A.width,P=g===void 0?"100%":g,O=A.height,F=O===void 0?"100%":O,X=A.value,W=A.language,N=W===void 0?"javascript":W,G=A.style,U=G===void 0?{}:G,H=A.options,V=H===void 0?{}:H,ce=A.overrideServices,ye=ce===void 0?{}:ce,Le=A.theme,Ze=Le===void 0?"vs-dark":Le,Ye=A.onEditBlur,Oe=A.onSave,We=A.autoHeight,ze=We===void 0?!1:We,Ae=A.forbidCopy,xe=Ae===void 0?!1:Ae,le=A.onChange,Se=le===void 0?y:le,pe=A.editorDidMount,Ge=pe===void 0?y:pe,fe=A.onFocus,ge=fe===void 0?y:fe,De=A.onBreakPoint,Ve=De===void 0?y:De,Qe=A.breakPointValue,ke=Qe===void 0?[]:Qe,Fe=A.filename,Ne=Fe===void 0?"educoder.txt":Fe,Me=A.errorLine,ne=A.errorContent,_e=ne===void 0?"":ne,ae=A.highlightLine,Ie=A.openBreakPoint,Je=Ie===void 0?!1:Ie,et=Object(_.a)(A,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint"]),Ke=Object(o.useRef)(),it=Object(o.useRef)({}),he=Object(o.useRef)(),Re=Object(o.useRef)(),He=Object(o.useRef)([]),Ee=Object(o.useRef)(!1),ve=Object(o.useRef)(),be=Object(o.useState)(!1),J=Object(S.a)(be,2),oe=J[0],Z=J[1];function me(){var St;return Ke.current&&(St=new s.default(function(ft){var _t=Object(f.a)(ft),Pt;try{for(_t.s();!(Pt=_t.n()).done;){var Nt=Pt.value;(Nt.target.offsetHeight>0||Nt.target.offsetWidth>0)&&it.current.instance.layout()}}catch(zt){_t.e(zt)}finally{_t.f()}}),St.observe(Ke.current)),St}function Xe(){M.b.warn({content:decodeURIComponent(a),key:"monaco-editor-tip"})}var j=function(){var ft=it.current.instance;if(X!=null&&ft&&oe){var _t=ft.getModel();_t&&X!==_t.getValue()&&(m=!0,_t.setValue(X),ft.layout(),m=!1)}};Object(o.useEffect)(function(){try{var St,ft=it.current.instance;Re.current&&clearTimeout(Re.current),Re.current=setTimeout(function(){j()},500),ft==null||((St=ft.updateOptions)===null||St===void 0)||St.call(ft,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(X.split(/\r\n|\r|\n/g).length))+3,5)})}catch(_t){debugger}},[X,oe,it.current]),Object(o.useEffect)(function(){try{if(Me&&it.current&&it.current.instance){var St=it.current.instance;St.changeViewZones(function(_t){var Pt=document.createElement("div");Pt.style.padding="10px 20px",Pt.style.width="calc(100% - 20px)",Pt.className="my-error-line-wrp",Pt.innerHTML=_e,_t.addZone({afterLineNumber:Me||11,heightInLines:3,domNode:Pt})});var ft={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};St.addOverlayWidget(ft),St.revealPositionInCenter({lineNumber:20,column:1})}}catch(_t){debugger}},[Me,it.current,oe]),Object(o.useEffect)(function(){var St;if((St=it.current)!==null&&St!==void 0&&St.instance&&oe&&Je){var ft=it.current.instance,_t=ft.getModel();if(!_t)return;var Pt=function(){var xt=[],Ht=[],qt=_t.getAllDecorations(),er=Object(f.a)(qt),ir;try{for(er.s();!(ir=er.n()).done;){var q=ir.value;if(q.options.className==="highlighted-line"){var I;xt.push(q==null||((I=q.range)===null||I===void 0)?void 0:I.startLineNumber),Ht.push(q==null?void 0:q.id)}}}catch(Q){er.e(Q)}finally{er.f()}_t.deltaDecorations(Ht,[]);var B=_t.getLineCount();!!ae&&ae<=B&&(ft.deltaDecorations([],[{range:new x.Range(ae,1,ae,_t.getLineMaxColumn(ae)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ft.revealLineInCenter(ae))};Pt();var Nt=function(){var xt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Ht=[],qt=[],er=_t.getAllDecorations(),ir=Object(f.a)(er),q;try{for(ir.s();!(q=ir.n()).done;){var I=q.value;if(I.options.linesDecorationsClassName==="breakpoints"){var B;Ht.push(I==null||((B=I.range)===null||B===void 0)?void 0:B.startLineNumber),qt.push(I==null?void 0:I.id)}}}catch(Q){ir.e(Q)}finally{ir.f()}if(xt)return{lines:Ht,ids:qt};Ve(Ht)},zt=function(){var nt=Object(D.a)(c.a.mark(function xt(Ht){var qt;return c.a.wrap(function(ir){for(;;)switch(ir.prev=ir.next){case 0:return qt={range:new x.Range(Ht,1,Ht,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}},ir.next=3,_t.deltaDecorations([],[qt]);case 3:Nt();case 4:case"end":return ir.stop()}},xt)}));return function(Ht){return nt.apply(this,arguments)}}(),Dt=function(){var nt=Object(D.a)(c.a.mark(function xt(Ht){var qt,er,ir,q,I;return c.a.wrap(function(Q){for(;;)switch(Q.prev=Q.next){case 0:qt=[],er=ft.getLineDecorations(Ht),ir=Object(f.a)(er);try{for(ir.s();!(q=ir.n()).done;)I=q.value,I.options.linesDecorationsClassName==="breakpoints"&&qt.push(I.id)}catch(te){ir.e(te)}finally{ir.f()}return Q.next=6,_t.deltaDecorations(qt,[]);case 6:Nt();case 7:case"end":return Q.stop()}},xt)}));return function(Ht){return nt.apply(this,arguments)}}(),Ct=function(xt){var Ht=ft.getLineDecorations(xt),qt=Object(f.a)(Ht),er;try{for(qt.s();!(er=qt.n()).done;){var ir=er.value;if(ir.options.linesDecorationsClassName==="breakpoints")return!0}}catch(q){qt.e(q)}finally{qt.f()}return!1};if(!Object(r.isEqual)(ke,Nt(!0).lines)){_t.deltaDecorations(Nt(!0).ids,[]);var Mr=ke.map(function(nt){return{range:new x.Range(nt,1,nt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints"}}});_t.deltaDecorations([],Mr)}var ti=ft.onDidChangeModelContent(function(nt){var xt=ft.getPosition();if(xt){var Ht=xt.lineNumber;_t.getLineContent(Ht).trim()===""?Dt(Ht):Ct(Ht)&&(Dt(Ht),zt(Ht))}}),Tr=ft.onMouseDown(function(nt){var xt,Ht,qt;if(nt.target.detail&&(xt=nt.target)!==null&&xt!==void 0&&(Ht=xt.element)!==null&&Ht!==void 0&&(qt=Ht.className)!==null&&qt!==void 0&&qt.includes("line-numbers")){var er=nt.target.position.lineNumber;if(_t.getLineContent(er).trim()==="")return;Ct(er)?Dt(er):zt(er)}}),Ut=function(xt){var Ht={range:new x.Range(xt,1,xt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};He.current=ft.deltaDecorations(He.current,[Ht])},kr=function(){He.current=ft.deltaDecorations(He.current,[])},zr=ft.onMouseMove(function(nt){var xt,Ht,qt;if(kr(),nt.target.detail&&(xt=nt.target)!==null&&xt!==void 0&&(Ht=xt.element)!==null&&Ht!==void 0&&(qt=Ht.className)!==null&&qt!==void 0&&qt.includes("line-numbers")){var er=nt.target.position.lineNumber;if(_t.getLineContent(er).trim()==="")return;Ut(er)}}),ri=ft.onMouseLeave(function(){kr()});return function(){ti.dispose(),Tr.dispose(),zr.dispose(),ri.dispose()}}},[it.current,oe,ke,ae,Je]);function we(){var St=it.current.instance;if(St){var ft=St.getSelection(),_t=it.current.pastePos||{},Pt=new x.Range(_t.startLineNumber||ft.endLineNumber,_t.startColumn||ft.endColumn,_t.endLineNumber||ft.endLineNumber,_t.endColumn||ft.endColumn);setTimeout(function(){St.executeEdits("",[{range:Pt,text:""}])},300)}}function Be(St){(window.navigator.platform.match("Mac")?St.metaKey:St.ctrlKey)&&St.keyCode==83&&(St.preventDefault(),Oe())}var de=function(){if(ze&&it.current.instance){var ft=it.current.instance.getContentHeight();Bt(ft<F?F:ft)}else Bt(F)};function Ce(St){var ft=document.createEvent("MouseEvents");ft.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),St.dispatchEvent(ft)}var je=function(ft){var _t=ft.keyCode,Pt=ft.ctrlKey,Nt=ft.metaKey,zt=ft.target,Dt=ft.type;return(Dt==="paste"||(_t===67||_t===86)&&(Nt||Pt))&&zt.nodeName==="TEXTAREA"&&(Xe(),ft.preventDefault()),!1};function ut(St,ft){var _t=window.URL||window.webkitURL||window,Pt=new Blob([ft]),Nt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Nt.href=_t.createObjectURL(Pt),Nt.download=St,Ce(Nt)}Object(o.useEffect)(function(){de()},[de]),Object(o.useEffect)(function(){Ke.current&&!oe&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(St){try{x=St,it.current.instance=x.editor.create(Ke.current,{value:X,language:T(N),theme:Ze,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0},ye);var ft=it.current.instance,_t=i.c._menuItems,Pt=Object(L.a)(_t).find(function(zt){return zt[0]._debugName=="EditorContext"});if(Ge(ft,x),setTimeout(function(){de(),it.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){ut(Ne||"educoder.txt",ft.getValue())}}),ft.getDomNode().addEventListener("input",function(){he.current.autoFormat&&ft.getAction("editor.action.formatDocument").run()})},500),it.current.subscription=ft.onDidChangeModelContent(function(zt){debugger;Ee.current?clearTimeout(ve.current):(de(),Se(ft.getValue(),zt)),ve.current=setTimeout(function(){Ee.current=!1},500)}),window.Monaco||t(x,T(N)),xe&&(Ke.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",je),window.removeEventListener("paste",je),window.addEventListener("keydown",je),window.addEventListener("paste",je)),window.Monaco=x,Ye&&ft.onDidBlurEditorWidget(function(){Ye(ft.getValue())}),ge&&ft.onDidFocusEditorText(function(){ge(ft.getValue())}),xe)try{window.addEventListener("paste",we)}catch(zt){}var Nt=me();return Z(!0),function(){var zt=it.current.instance;zt.dispose();var Dt=zt.getModel();Dt&&Dt.dispose(),it.current.subscription&&it.current.subscription.dispose(),xe&&window.removeEventListener("paste",we),Nt.unobserve(Ke.current)}}catch(zt){debugger}})},[]),Object(o.useEffect)(function(){var St=it.current.instance;if(St&&oe)return document.addEventListener("keydown",Be,!1),function(){document.removeEventListener("keydown",Be)}},[Oe,oe]),Object(o.useEffect)(function(){var St=it.current.instance;if(St&&oe){var ft=T(N);x.editor.setModelLanguage(St.getModel(),ft)}},[N,oe]),Object(o.useEffect)(function(){var St=it.current.instance;St&&oe&&x.editor.setTheme(Ze)},[Ze,oe]),Object(o.useEffect)(function(){var St=it.current.instance;he.current=V,St&&oe&&(St.updateOptions(Object(z.a)({},V)),setTimeout(function(){St.getModel().updateOptions(Object(z.a)({},V))},200))},[JSON.stringify(V),oe]),Object(o.useEffect)(function(){var St=it.current.instance;St&&oe&&St.layout()},[P,F,oe]);var tt=Object(o.useState)(d(P)),st=Object(S.a)(tt,2),gt=st[0],At=st[1],bt=Object(o.useState)(d(F)),ht=Object(S.a)(bt,2),Ot=ht[0],Bt=ht[1],mt=Object(z.a)(Object(z.a)({},U),{},{width:gt,height:Ot});return u.a.createElement("div",{className:"my-monaco-editor",ref:Ke,style:mt})};function w(A){var g=A.width,P=g===void 0?"100%":g,O=A.height,F=O===void 0?"100%":O,X=A.original,W=A.modified,N=A.language,G=A.options,U=G===void 0?{}:G,H=Object(o.useRef)(),V=Object(o.useState)(null),ce=Object(S.a)(V,2),ye=ce[0],Le=ce[1];function Ze(ze){var Ae;return H.current&&(Ae=new s.default(function(xe){var le=Object(f.a)(xe),Se;try{for(le.s();!(Se=le.n()).done;){var pe=Se.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&ze.layout()}}catch(Ge){le.e(Ge)}finally{le.f()}}),Ae.observe(H.current)),Ae}Object(o.useEffect)(function(){return H.current&&ee.e(27).then(ee.t.bind(null,"M/lh",7)).then(function(ze){x=ze;var Ae=x.editor.createDiffEditor(H.current,Object(z.a)(Object(z.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},U),{},{wordWrap:!0}));Le(Ae);var xe=Ze(Ae);return function(){Ae.dispose();var le=Ae.getModel();le&&le.dispose(),xe.unobserve(H.current)}}),function(){window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}},[]),Object(o.useEffect)(function(){ye&&ye.setModel({original:x.editor.createModel(X,N),modified:x.editor.createModel(W,N)})},[X,W,N,ye]);var Ye=d(P),Oe=d(F),We={width:Ye,height:Oe};return u.a.createElement("div",{className:"my-diff-editor",ref:H,style:We})}},ZpRC:function(ot,se,ee){"use strict";function z(o){return typeof o=="object"&&o!=null&&o.nodeType===1}function L(o,u){return(!u||o!=="hidden")&&o!=="visible"&&o!=="clip"}function D(o,u){if(o.clientHeight<o.scrollHeight||o.clientWidth<o.scrollWidth){var s=getComputedStyle(o,null);return L(s.overflowY,u)||L(s.overflowX,u)||function(l){var t=function(a){if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch(i){return null}}(l);return!!t&&(t.clientHeight<l.scrollHeight||t.clientWidth<l.scrollWidth)}(o)}return!1}function k(o,u,s,l,t,a,i,r){return a<o&&i>u||a>o&&i<u?0:a<=o&&r<=s||i>=u&&r>=s?a-o-l:i>u&&r<s||a<o&&r>s?i-u+t:0}var M=function(o,u){var s=window,l=u.scrollMode,t=u.block,a=u.inline,i=u.boundary,r=u.skipOverflowHiddenElements,h=typeof i=="function"?i:function(Ve){return Ve!==i};if(!z(o))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,y=[],m=o;z(m)&&h(m);){if((m=m.parentElement)===d){y.push(m);break}m!=null&&m===document.body&&D(m)&&!D(document.documentElement)||m!=null&&D(m,r)&&y.push(m)}for(var C=s.visualViewport?s.visualViewport.width:innerWidth,T=s.visualViewport?s.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,E=window.scrollY||pageYOffset,w=o.getBoundingClientRect(),A=w.height,g=w.width,P=w.top,O=w.right,F=w.bottom,X=w.left,W=t==="start"||t==="nearest"?P:t==="end"?F:P+A/2,N=a==="center"?X+g/2:a==="end"?O:X,G=[],U=0;U<y.length;U++){var H=y[U],V=H.getBoundingClientRect(),ce=V.height,ye=V.width,Le=V.top,Ze=V.right,Ye=V.bottom,Oe=V.left;if(l==="if-needed"&&P>=0&&X>=0&&F<=T&&O<=C&&P>=Le&&F<=Ye&&X>=Oe&&O<=Ze)return G;var We=getComputedStyle(H),ze=parseInt(We.borderLeftWidth,10),Ae=parseInt(We.borderTopWidth,10),xe=parseInt(We.borderRightWidth,10),le=parseInt(We.borderBottomWidth,10),Se=0,pe=0,Ge="offsetWidth"in H?H.offsetWidth-H.clientWidth-ze-xe:0,fe="offsetHeight"in H?H.offsetHeight-H.clientHeight-Ae-le:0;if(d===H)Se=t==="start"?W:t==="end"?W-T:t==="nearest"?k(E,E+T,T,Ae,le,E+W,E+W+A,A):W-T/2,pe=a==="start"?N:a==="center"?N-C/2:a==="end"?N-C:k(x,x+C,C,ze,xe,x+N,x+N+g,g),Se=Math.max(0,Se+E),pe=Math.max(0,pe+x);else{Se=t==="start"?W-Le-Ae:t==="end"?W-Ye+le+fe:t==="nearest"?k(Le,Ye,ce,Ae,le+fe,W,W+A,A):W-(Le+ce/2)+fe/2,pe=a==="start"?N-Oe-ze:a==="center"?N-(Oe+ye/2)+Ge/2:a==="end"?N-Ze+xe+Ge:k(Oe,Ze,ye,ze,xe+Ge,N,N+g,g);var ge=H.scrollLeft,De=H.scrollTop;W+=De-(Se=Math.max(0,Math.min(De+Se,H.scrollHeight-ce+fe))),N+=ge-(pe=Math.max(0,Math.min(ge+pe,H.scrollWidth-ye+Ge)))}G.push({el:H,top:Se,left:pe})}return G};function f(o){return o===Object(o)&&Object.keys(o).length!==0}function S(o,u){u===void 0&&(u="auto");var s="scrollBehavior"in document.body.style;o.forEach(function(l){var t=l.el,a=l.top,i=l.left;t.scroll&&s?t.scroll({top:a,left:i,behavior:u}):(t.scrollTop=a,t.scrollLeft=i)})}function _(o){return o===!1?{block:"end",inline:"nearest"}:f(o)?o:{block:"start",inline:"nearest"}}function p(o,u){var s=!o.ownerDocument.documentElement.contains(o);if(f(u)&&typeof u.behavior=="function")return u.behavior(s?[]:M(o,u));if(s)return;var l=_(u);return S(M(o,l),l.behavior)}var c=se.a=p},Zss7:function(ot,se,ee){var z;(function(L){var D=/^\s+/,k=/\s+$/,M=0,f=L.round,S=L.min,_=L.max,p=L.random;function c(le,Se){if(le=le||"",Se=Se||{},le instanceof c)return le;if(!(this instanceof c))return new c(le,Se);var pe=o(le);this._originalInput=le,this._r=pe.r,this._g=pe.g,this._b=pe.b,this._a=pe.a,this._roundA=f(100*this._a)/100,this._format=Se.format||pe.format,this._gradientType=Se.gradientType,this._r<1&&(this._r=f(this._r)),this._g<1&&(this._g=f(this._g)),this._b<1&&(this._b=f(this._b)),this._ok=pe.ok,this._tc_id=M++}c.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var le=this.toRgb();return(le.r*299+le.g*587+le.b*114)/1e3},getLuminance:function(){var le=this.toRgb(),Se,pe,Ge,fe,ge,De;return Se=le.r/255,pe=le.g/255,Ge=le.b/255,Se<=.03928?fe=Se/12.92:fe=L.pow((Se+.055)/1.055,2.4),pe<=.03928?ge=pe/12.92:ge=L.pow((pe+.055)/1.055,2.4),Ge<=.03928?De=Ge/12.92:De=L.pow((Ge+.055)/1.055,2.4),.2126*fe+.7152*ge+.0722*De},setAlpha:function(le){return this._a=G(le),this._roundA=f(100*this._a)/100,this},toHsv:function(){var le=t(this._r,this._g,this._b);return{h:le.h*360,s:le.s,v:le.v,a:this._a}},toHsvString:function(){var le=t(this._r,this._g,this._b),Se=f(le.h*360),pe=f(le.s*100),Ge=f(le.v*100);return this._a==1?"hsv("+Se+", "+pe+"%, "+Ge+"%)":"hsva("+Se+", "+pe+"%, "+Ge+"%, "+this._roundA+")"},toHsl:function(){var le=s(this._r,this._g,this._b);return{h:le.h*360,s:le.s,l:le.l,a:this._a}},toHslString:function(){var le=s(this._r,this._g,this._b),Se=f(le.h*360),pe=f(le.s*100),Ge=f(le.l*100);return this._a==1?"hsl("+Se+", "+pe+"%, "+Ge+"%)":"hsla("+Se+", "+pe+"%, "+Ge+"%, "+this._roundA+")"},toHex:function(le){return i(this._r,this._g,this._b,le)},toHexString:function(le){return"#"+this.toHex(le)},toHex8:function(le){return r(this._r,this._g,this._b,this._a,le)},toHex8String:function(le){return"#"+this.toHex8(le)},toRgb:function(){return{r:f(this._r),g:f(this._g),b:f(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+f(this._r)+", "+f(this._g)+", "+f(this._b)+")":"rgba("+f(this._r)+", "+f(this._g)+", "+f(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:f(U(this._r,255)*100)+"%",g:f(U(this._g,255)*100)+"%",b:f(U(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+f(U(this._r,255)*100)+"%, "+f(U(this._g,255)*100)+"%, "+f(U(this._b,255)*100)+"%)":"rgba("+f(U(this._r,255)*100)+"%, "+f(U(this._g,255)*100)+"%, "+f(U(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:W[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(le){var Se="#"+h(this._r,this._g,this._b,this._a),pe=Se,Ge=this._gradientType?"GradientType = 1, ":"";if(le){var fe=c(le);pe="#"+h(fe._r,fe._g,fe._b,fe._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ge+"startColorstr="+Se+",endColorstr="+pe+")"},toString:function(le){var Se=!!le;le=le||this._format;var pe=!1,Ge=this._a<1&&this._a>=0,fe=!Se&&Ge&&(le==="hex"||le==="hex6"||le==="hex3"||le==="hex4"||le==="hex8"||le==="name");return fe?le==="name"&&this._a===0?this.toName():this.toRgbString():(le==="rgb"&&(pe=this.toRgbString()),le==="prgb"&&(pe=this.toPercentageRgbString()),(le==="hex"||le==="hex6")&&(pe=this.toHexString()),le==="hex3"&&(pe=this.toHexString(!0)),le==="hex4"&&(pe=this.toHex8String(!0)),le==="hex8"&&(pe=this.toHex8String()),le==="name"&&(pe=this.toName()),le==="hsl"&&(pe=this.toHslString()),le==="hsv"&&(pe=this.toHsvString()),pe||this.toHexString())},clone:function(){return c(this.toString())},_applyModification:function(le,Se){var pe=le.apply(null,[this].concat([].slice.call(Se)));return this._r=pe._r,this._g=pe._g,this._b=pe._b,this.setAlpha(pe._a),this},lighten:function(){return this._applyModification(C,arguments)},brighten:function(){return this._applyModification(T,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(E,arguments)},_applyCombination:function(le,Se){return le.apply(null,[this].concat([].slice.call(Se)))},analogous:function(){return this._applyCombination(O,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(F,arguments)},splitcomplement:function(){return this._applyCombination(P,arguments)},triad:function(){return this._applyCombination(A,arguments)},tetrad:function(){return this._applyCombination(g,arguments)}},c.fromRatio=function(le,Se){if(typeof le=="object"){var pe={};for(var Ge in le)le.hasOwnProperty(Ge)&&(Ge==="a"?pe[Ge]=le[Ge]:pe[Ge]=Ze(le[Ge]));le=pe}return c(le,Se)};function o(le){var Se={r:0,g:0,b:0},pe=1,Ge=null,fe=null,ge=null,De=!1,Ve=!1;return typeof le=="string"&&(le=Ae(le)),typeof le=="object"&&(ze(le.r)&&ze(le.g)&&ze(le.b)?(Se=u(le.r,le.g,le.b),De=!0,Ve=String(le.r).substr(-1)==="%"?"prgb":"rgb"):ze(le.h)&&ze(le.s)&&ze(le.v)?(Ge=Ze(le.s),fe=Ze(le.v),Se=a(le.h,Ge,fe),De=!0,Ve="hsv"):ze(le.h)&&ze(le.s)&&ze(le.l)&&(Ge=Ze(le.s),ge=Ze(le.l),Se=l(le.h,Ge,ge),De=!0,Ve="hsl"),le.hasOwnProperty("a")&&(pe=le.a)),pe=G(pe),{ok:De,format:le.format||Ve,r:S(255,_(Se.r,0)),g:S(255,_(Se.g,0)),b:S(255,_(Se.b,0)),a:pe}}function u(le,Se,pe){return{r:U(le,255)*255,g:U(Se,255)*255,b:U(pe,255)*255}}function s(le,Se,pe){le=U(le,255),Se=U(Se,255),pe=U(pe,255);var Ge=_(le,Se,pe),fe=S(le,Se,pe),ge,De,Ve=(Ge+fe)/2;if(Ge==fe)ge=De=0;else{var Qe=Ge-fe;De=Ve>.5?Qe/(2-Ge-fe):Qe/(Ge+fe);switch(Ge){case le:ge=(Se-pe)/Qe+(Se<pe?6:0);break;case Se:ge=(pe-le)/Qe+2;break;case pe:ge=(le-Se)/Qe+4;break}ge/=6}return{h:ge,s:De,l:Ve}}function l(le,Se,pe){var Ge,fe,ge;le=U(le,360),Se=U(Se,100),pe=U(pe,100);function De(ke,Fe,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?ke+(Fe-ke)*6*Ne:Ne<1/2?Fe:Ne<2/3?ke+(Fe-ke)*(2/3-Ne)*6:ke}if(Se===0)Ge=fe=ge=pe;else{var Ve=pe<.5?pe*(1+Se):pe+Se-pe*Se,Qe=2*pe-Ve;Ge=De(Qe,Ve,le+1/3),fe=De(Qe,Ve,le),ge=De(Qe,Ve,le-1/3)}return{r:Ge*255,g:fe*255,b:ge*255}}function t(le,Se,pe){le=U(le,255),Se=U(Se,255),pe=U(pe,255);var Ge=_(le,Se,pe),fe=S(le,Se,pe),ge,De,Ve=Ge,Qe=Ge-fe;if(De=Ge===0?0:Qe/Ge,Ge==fe)ge=0;else{switch(Ge){case le:ge=(Se-pe)/Qe+(Se<pe?6:0);break;case Se:ge=(pe-le)/Qe+2;break;case pe:ge=(le-Se)/Qe+4;break}ge/=6}return{h:ge,s:De,v:Ve}}function a(le,Se,pe){le=U(le,360)*6,Se=U(Se,100),pe=U(pe,100);var Ge=L.floor(le),fe=le-Ge,ge=pe*(1-Se),De=pe*(1-fe*Se),Ve=pe*(1-(1-fe)*Se),Qe=Ge%6,ke=[pe,De,ge,ge,Ve,pe][Qe],Fe=[Ve,pe,pe,De,ge,ge][Qe],Ne=[ge,ge,Ve,pe,pe,De][Qe];return{r:ke*255,g:Fe*255,b:Ne*255}}function i(le,Se,pe,Ge){var fe=[Le(f(le).toString(16)),Le(f(Se).toString(16)),Le(f(pe).toString(16))];return Ge&&fe[0].charAt(0)==fe[0].charAt(1)&&fe[1].charAt(0)==fe[1].charAt(1)&&fe[2].charAt(0)==fe[2].charAt(1)?fe[0].charAt(0)+fe[1].charAt(0)+fe[2].charAt(0):fe.join("")}function r(le,Se,pe,Ge,fe){var ge=[Le(f(le).toString(16)),Le(f(Se).toString(16)),Le(f(pe).toString(16)),Le(Ye(Ge))];return fe&&ge[0].charAt(0)==ge[0].charAt(1)&&ge[1].charAt(0)==ge[1].charAt(1)&&ge[2].charAt(0)==ge[2].charAt(1)&&ge[3].charAt(0)==ge[3].charAt(1)?ge[0].charAt(0)+ge[1].charAt(0)+ge[2].charAt(0)+ge[3].charAt(0):ge.join("")}function h(le,Se,pe,Ge){var fe=[Le(Ye(Ge)),Le(f(le).toString(16)),Le(f(Se).toString(16)),Le(f(pe).toString(16))];return fe.join("")}c.equals=function(le,Se){return!le||!Se?!1:c(le).toRgbString()==c(Se).toRgbString()},c.random=function(){return c.fromRatio({r:p(),g:p(),b:p()})};function d(le,Se){Se=Se===0?0:Se||10;var pe=c(le).toHsl();return pe.s-=Se/100,pe.s=H(pe.s),c(pe)}function y(le,Se){Se=Se===0?0:Se||10;var pe=c(le).toHsl();return pe.s+=Se/100,pe.s=H(pe.s),c(pe)}function m(le){return c(le).desaturate(100)}function C(le,Se){Se=Se===0?0:Se||10;var pe=c(le).toHsl();return pe.l+=Se/100,pe.l=H(pe.l),c(pe)}function T(le,Se){Se=Se===0?0:Se||10;var pe=c(le).toRgb();return pe.r=_(0,S(255,pe.r-f(255*-(Se/100)))),pe.g=_(0,S(255,pe.g-f(255*-(Se/100)))),pe.b=_(0,S(255,pe.b-f(255*-(Se/100)))),c(pe)}function x(le,Se){Se=Se===0?0:Se||10;var pe=c(le).toHsl();return pe.l-=Se/100,pe.l=H(pe.l),c(pe)}function E(le,Se){var pe=c(le).toHsl(),Ge=(pe.h+Se)%360;return pe.h=Ge<0?360+Ge:Ge,c(pe)}function w(le){var Se=c(le).toHsl();return Se.h=(Se.h+180)%360,c(Se)}function A(le){var Se=c(le).toHsl(),pe=Se.h;return[c(le),c({h:(pe+120)%360,s:Se.s,l:Se.l}),c({h:(pe+240)%360,s:Se.s,l:Se.l})]}function g(le){var Se=c(le).toHsl(),pe=Se.h;return[c(le),c({h:(pe+90)%360,s:Se.s,l:Se.l}),c({h:(pe+180)%360,s:Se.s,l:Se.l}),c({h:(pe+270)%360,s:Se.s,l:Se.l})]}function P(le){var Se=c(le).toHsl(),pe=Se.h;return[c(le),c({h:(pe+72)%360,s:Se.s,l:Se.l}),c({h:(pe+216)%360,s:Se.s,l:Se.l})]}function O(le,Se,pe){Se=Se||6,pe=pe||30;var Ge=c(le).toHsl(),fe=360/pe,ge=[c(le)];for(Ge.h=(Ge.h-(fe*Se>>1)+720)%360;--Se;)Ge.h=(Ge.h+fe)%360,ge.push(c(Ge));return ge}function F(le,Se){Se=Se||6;for(var pe=c(le).toHsv(),Ge=pe.h,fe=pe.s,ge=pe.v,De=[],Ve=1/Se;Se--;)De.push(c({h:Ge,s:fe,v:ge})),ge=(ge+Ve)%1;return De}c.mix=function(le,Se,pe){pe=pe===0?0:pe||50;var Ge=c(le).toRgb(),fe=c(Se).toRgb(),ge=pe/100,De={r:(fe.r-Ge.r)*ge+Ge.r,g:(fe.g-Ge.g)*ge+Ge.g,b:(fe.b-Ge.b)*ge+Ge.b,a:(fe.a-Ge.a)*ge+Ge.a};return c(De)},c.readability=function(le,Se){var pe=c(le),Ge=c(Se);return(L.max(pe.getLuminance(),Ge.getLuminance())+.05)/(L.min(pe.getLuminance(),Ge.getLuminance())+.05)},c.isReadable=function(le,Se,pe){var Ge=c.readability(le,Se),fe,ge;ge=!1,fe=xe(pe);switch(fe.level+fe.size){case"AAsmall":case"AAAlarge":ge=Ge>=4.5;break;case"AAlarge":ge=Ge>=3;break;case"AAAsmall":ge=Ge>=7;break}return ge},c.mostReadable=function(le,Se,pe){var Ge=null,fe=0,ge,De,Ve,Qe;pe=pe||{},De=pe.includeFallbackColors,Ve=pe.level,Qe=pe.size;for(var ke=0;ke<Se.length;ke++)ge=c.readability(le,Se[ke]),ge>fe&&(fe=ge,Ge=c(Se[ke]));return c.isReadable(le,Ge,{level:Ve,size:Qe})||!De?Ge:(pe.includeFallbackColors=!1,c.mostReadable(le,["#fff","#000"],pe))};var X=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},W=c.hexNames=N(X);function N(le){var Se={};for(var pe in le)le.hasOwnProperty(pe)&&(Se[le[pe]]=pe);return Se}function G(le){return le=parseFloat(le),(isNaN(le)||le<0||le>1)&&(le=1),le}function U(le,Se){ce(le)&&(le="100%");var pe=ye(le);return le=S(Se,_(0,parseFloat(le))),pe&&(le=parseInt(le*Se,10)/100),L.abs(le-Se)<1e-6?1:le%Se/parseFloat(Se)}function H(le){return S(1,_(0,le))}function V(le){return parseInt(le,16)}function ce(le){return typeof le=="string"&&le.indexOf(".")!=-1&&parseFloat(le)===1}function ye(le){return typeof le=="string"&&le.indexOf("%")!=-1}function Le(le){return le.length==1?"0"+le:""+le}function Ze(le){return le<=1&&(le=le*100+"%"),le}function Ye(le){return L.round(parseFloat(le)*255).toString(16)}function Oe(le){return V(le)/255}var We=function(){var le="[-\\+]?\\d+%?",Se="[-\\+]?\\d*\\.\\d+%?",pe="(?:"+Se+")|(?:"+le+")",Ge="[\\s|\\(]+("+pe+")[,|\\s]+("+pe+")[,|\\s]+("+pe+")\\s*\\)?",fe="[\\s|\\(]+("+pe+")[,|\\s]+("+pe+")[,|\\s]+("+pe+")[,|\\s]+("+pe+")\\s*\\)?";return{CSS_UNIT:new RegExp(pe),rgb:new RegExp("rgb"+Ge),rgba:new RegExp("rgba"+fe),hsl:new RegExp("hsl"+Ge),hsla:new RegExp("hsla"+fe),hsv:new RegExp("hsv"+Ge),hsva:new RegExp("hsva"+fe),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ze(le){return!!We.CSS_UNIT.exec(le)}function Ae(le){le=le.replace(D,"").replace(k,"").toLowerCase();var Se=!1;if(X[le])le=X[le],Se=!0;else if(le=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var pe;return(pe=We.rgb.exec(le))?{r:pe[1],g:pe[2],b:pe[3]}:(pe=We.rgba.exec(le))?{r:pe[1],g:pe[2],b:pe[3],a:pe[4]}:(pe=We.hsl.exec(le))?{h:pe[1],s:pe[2],l:pe[3]}:(pe=We.hsla.exec(le))?{h:pe[1],s:pe[2],l:pe[3],a:pe[4]}:(pe=We.hsv.exec(le))?{h:pe[1],s:pe[2],v:pe[3]}:(pe=We.hsva.exec(le))?{h:pe[1],s:pe[2],v:pe[3],a:pe[4]}:(pe=We.hex8.exec(le))?{r:V(pe[1]),g:V(pe[2]),b:V(pe[3]),a:Oe(pe[4]),format:Se?"name":"hex8"}:(pe=We.hex6.exec(le))?{r:V(pe[1]),g:V(pe[2]),b:V(pe[3]),format:Se?"name":"hex"}:(pe=We.hex4.exec(le))?{r:V(pe[1]+""+pe[1]),g:V(pe[2]+""+pe[2]),b:V(pe[3]+""+pe[3]),a:Oe(pe[4]+""+pe[4]),format:Se?"name":"hex8"}:(pe=We.hex3.exec(le))?{r:V(pe[1]+""+pe[1]),g:V(pe[2]+""+pe[2]),b:V(pe[3]+""+pe[3]),format:Se?"name":"hex"}:!1}function xe(le){var Se,pe;return le=le||{level:"AA",size:"small"},Se=(le.level||"AA").toUpperCase(),pe=(le.size||"small").toLowerCase(),Se!=="AA"&&Se!=="AAA"&&(Se="AA"),pe!=="small"&&pe!=="large"&&(pe="small"),{level:Se,size:pe}}ot.exports?ot.exports=c:!(z=function(){return c}.call(se,ee,se,ot),z!==void 0&&(ot.exports=z))})(Math)},bT9E:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return L});var z=ee("VTBJ");function L(D,k){var M=Object(z.a)({},D);return Array.isArray(k)&&k.forEach(function(f){delete M[f]}),M}},c5Ni:function(ot,se,ee){},c5fP:function(ot,se,ee){"use strict";function z(he){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(He){return typeof He}:z=function(He){return He&&typeof Symbol=="function"&&He.constructor===Symbol&&He!==Symbol.prototype?"symbol":typeof He},z(he)}Object.defineProperty(se,"__esModule",{value:!0}),se._tr_init=Ie,se._tr_stored_block=Je,se._tr_flush_block=Ke,se._tr_tally=it,se._tr_align=et;var L=k(ee("6BzB"));function D(){if(typeof WeakMap!="function")return null;var he=new WeakMap;return D=function(){return he},he}function k(he){if(he&&he.__esModule)return he;if(he===null||z(he)!=="object"&&typeof he!="function")return{default:he};var Re=D();if(Re&&Re.has(he))return Re.get(he);var He={},Ee=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var ve in he)if(Object.prototype.hasOwnProperty.call(he,ve)){var be=Ee?Object.getOwnPropertyDescriptor(he,ve):null;be&&(be.get||be.set)?Object.defineProperty(He,ve,be):He[ve]=he[ve]}return He.default=he,Re&&Re.set(he,He),He}var M=4,f=0,S=1,_=2;function p(he){for(var Re=he.length;--Re>=0;)he[Re]=0}var c=0,o=1,u=2,s=3,l=258,t=29,a=256,i=a+1+t,r=30,h=19,d=2*i+1,y=15,m=16,C=7,T=256,x=16,E=17,w=18,A=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],g=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=512,X=new Array((i+2)*2);p(X);var W=new Array(r*2);p(W);var N=new Array(F);p(N);var G=new Array(l-s+1);p(G);var U=new Array(t);p(U);var H=new Array(r);p(H);function V(he,Re,He,Ee,ve){this.static_tree=he,this.extra_bits=Re,this.extra_base=He,this.elems=Ee,this.max_length=ve,this.has_stree=he&&he.length}var ce,ye,Le;function Ze(he,Re){this.dyn_tree=he,this.max_code=0,this.stat_desc=Re}function Ye(he){return he<256?N[he]:N[256+(he>>>7)]}function Oe(he,Re){he.pending_buf[he.pending++]=Re&255,he.pending_buf[he.pending++]=Re>>>8&255}function We(he,Re,He){he.bi_valid>m-He?(he.bi_buf|=Re<<he.bi_valid&65535,Oe(he,he.bi_buf),he.bi_buf=Re>>m-he.bi_valid,he.bi_valid+=He-m):(he.bi_buf|=Re<<he.bi_valid&65535,he.bi_valid+=He)}function ze(he,Re,He){We(he,He[Re*2],He[Re*2+1])}function Ae(he,Re){var He=0;do He|=he&1,he>>>=1,He<<=1;while(--Re>0);return He>>>1}function xe(he){he.bi_valid===16?(Oe(he,he.bi_buf),he.bi_buf=0,he.bi_valid=0):he.bi_valid>=8&&(he.pending_buf[he.pending++]=he.bi_buf&255,he.bi_buf>>=8,he.bi_valid-=8)}function le(he,Re){var He=Re.dyn_tree,Ee=Re.max_code,ve=Re.stat_desc.static_tree,be=Re.stat_desc.has_stree,J=Re.stat_desc.extra_bits,oe=Re.stat_desc.extra_base,Z=Re.stat_desc.max_length,me,Xe,j,we,Be,de,Ce=0;for(we=0;we<=y;we++)he.bl_count[we]=0;for(He[he.heap[he.heap_max]*2+1]=0,me=he.heap_max+1;me<d;me++){if(Xe=he.heap[me],we=He[He[Xe*2+1]*2+1]+1,we>Z&&(we=Z,Ce++),He[Xe*2+1]=we,Xe>Ee)continue;he.bl_count[we]++,Be=0,Xe>=oe&&(Be=J[Xe-oe]),de=He[Xe*2],he.opt_len+=de*(we+Be),be&&(he.static_len+=de*(ve[Xe*2+1]+Be))}if(Ce===0)return;do{for(we=Z-1;he.bl_count[we]===0;)we--;he.bl_count[we]--,he.bl_count[we+1]+=2,he.bl_count[Z]--,Ce-=2}while(Ce>0);for(we=Z;we!==0;we--)for(Xe=he.bl_count[we];Xe!==0;){if(j=he.heap[--me],j>Ee)continue;He[j*2+1]!==we&&(he.opt_len+=(we-He[j*2+1])*He[j*2],He[j*2+1]=we),Xe--}}function Se(he,Re,He){var Ee=new Array(y+1),ve=0,be,J;for(be=1;be<=y;be++)Ee[be]=ve=ve+He[be-1]<<1;for(J=0;J<=Re;J++){var oe=he[J*2+1];if(oe===0)continue;he[J*2]=Ae(Ee[oe]++,oe)}}function pe(){var he,Re,He,Ee,ve,be=new Array(y+1);for(He=0,Ee=0;Ee<t-1;Ee++)for(U[Ee]=He,he=0;he<1<<A[Ee];he++)G[He++]=Ee;for(G[He-1]=Ee,ve=0,Ee=0;Ee<16;Ee++)for(H[Ee]=ve,he=0;he<1<<g[Ee];he++)N[ve++]=Ee;for(ve>>=7;Ee<r;Ee++)for(H[Ee]=ve<<7,he=0;he<1<<g[Ee]-7;he++)N[256+ve++]=Ee;for(Re=0;Re<=y;Re++)be[Re]=0;for(he=0;he<=143;)X[he*2+1]=8,he++,be[8]++;for(;he<=255;)X[he*2+1]=9,he++,be[9]++;for(;he<=279;)X[he*2+1]=7,he++,be[7]++;for(;he<=287;)X[he*2+1]=8,he++,be[8]++;for(Se(X,i+1,be),he=0;he<r;he++)W[he*2+1]=5,W[he*2]=Ae(he,5);ce=new V(X,A,a+1,i,y),ye=new V(W,g,0,r,y),Le=new V(new Array(0),P,0,h,C)}function Ge(he){var Re;for(Re=0;Re<i;Re++)he.dyn_ltree[Re*2]=0;for(Re=0;Re<r;Re++)he.dyn_dtree[Re*2]=0;for(Re=0;Re<h;Re++)he.bl_tree[Re*2]=0;he.dyn_ltree[T*2]=1,he.opt_len=he.static_len=0,he.last_lit=he.matches=0}function fe(he){he.bi_valid>8?Oe(he,he.bi_buf):he.bi_valid>0&&(he.pending_buf[he.pending++]=he.bi_buf),he.bi_buf=0,he.bi_valid=0}function ge(he,Re,He,Ee){fe(he),Ee&&(Oe(he,He),Oe(he,~He)),L.arraySet(he.pending_buf,he.window,Re,He,he.pending),he.pending+=He}function De(he,Re,He,Ee){var ve=Re*2,be=He*2;return he[ve]<he[be]||he[ve]===he[be]&&Ee[Re]<=Ee[He]}function Ve(he,Re,He){for(var Ee=he.heap[He],ve=He<<1;ve<=he.heap_len&&!(ve<he.heap_len&&De(Re,he.heap[ve+1],he.heap[ve],he.depth)&&ve++,De(Re,Ee,he.heap[ve],he.depth));)he.heap[He]=he.heap[ve],He=ve,ve<<=1;he.heap[He]=Ee}function Qe(he,Re,He){var Ee,ve,be=0,J,oe;if(he.last_lit!==0)do Ee=he.pending_buf[he.d_buf+be*2]<<8|he.pending_buf[he.d_buf+be*2+1],ve=he.pending_buf[he.l_buf+be],be++,Ee===0?ze(he,ve,Re):(J=G[ve],ze(he,J+a+1,Re),oe=A[J],oe!==0&&(ve-=U[J],We(he,ve,oe)),Ee--,J=Ye(Ee),ze(he,J,He),oe=g[J],oe!==0&&(Ee-=H[J],We(he,Ee,oe)));while(be<he.last_lit);ze(he,T,Re)}function ke(he,Re){var He=Re.dyn_tree,Ee=Re.stat_desc.static_tree,ve=Re.stat_desc.has_stree,be=Re.stat_desc.elems,J,oe,Z=-1,me;for(he.heap_len=0,he.heap_max=d,J=0;J<be;J++)He[J*2]!==0?(he.heap[++he.heap_len]=Z=J,he.depth[J]=0):He[J*2+1]=0;for(;he.heap_len<2;)me=he.heap[++he.heap_len]=Z<2?++Z:0,He[me*2]=1,he.depth[me]=0,he.opt_len--,ve&&(he.static_len-=Ee[me*2+1]);for(Re.max_code=Z,J=he.heap_len>>1;J>=1;J--)Ve(he,He,J);me=be;do J=he.heap[1],he.heap[1]=he.heap[he.heap_len--],Ve(he,He,1),oe=he.heap[1],he.heap[--he.heap_max]=J,he.heap[--he.heap_max]=oe,He[me*2]=He[J*2]+He[oe*2],he.depth[me]=(he.depth[J]>=he.depth[oe]?he.depth[J]:he.depth[oe])+1,He[J*2+1]=He[oe*2+1]=me,he.heap[1]=me++,Ve(he,He,1);while(he.heap_len>=2);he.heap[--he.heap_max]=he.heap[1],le(he,Re),Se(He,Z,he.bl_count)}function Fe(he,Re,He){var Ee,ve=-1,be,J=Re[0*2+1],oe=0,Z=7,me=4;for(J===0&&(Z=138,me=3),Re[(He+1)*2+1]=65535,Ee=0;Ee<=He;Ee++){if(be=J,J=Re[(Ee+1)*2+1],++oe<Z&&be===J)continue;oe<me?he.bl_tree[be*2]+=oe:be!==0?(be!==ve&&he.bl_tree[be*2]++,he.bl_tree[x*2]++):oe<=10?he.bl_tree[E*2]++:he.bl_tree[w*2]++,oe=0,ve=be,J===0?(Z=138,me=3):be===J?(Z=6,me=3):(Z=7,me=4)}}function Ne(he,Re,He){var Ee,ve=-1,be,J=Re[0*2+1],oe=0,Z=7,me=4;for(J===0&&(Z=138,me=3),Ee=0;Ee<=He;Ee++){if(be=J,J=Re[(Ee+1)*2+1],++oe<Z&&be===J)continue;if(oe<me)do ze(he,be,he.bl_tree);while(--oe!==0);else be!==0?(be!==ve&&(ze(he,be,he.bl_tree),oe--),ze(he,x,he.bl_tree),We(he,oe-3,2)):oe<=10?(ze(he,E,he.bl_tree),We(he,oe-3,3)):(ze(he,w,he.bl_tree),We(he,oe-11,7));oe=0,ve=be,J===0?(Z=138,me=3):be===J?(Z=6,me=3):(Z=7,me=4)}}function Me(he){var Re;for(Fe(he,he.dyn_ltree,he.l_desc.max_code),Fe(he,he.dyn_dtree,he.d_desc.max_code),ke(he,he.bl_desc),Re=h-1;Re>=3&&!(he.bl_tree[O[Re]*2+1]!==0);Re--);return he.opt_len+=3*(Re+1)+5+5+4,Re}function ne(he,Re,He,Ee){var ve;for(We(he,Re-257,5),We(he,He-1,5),We(he,Ee-4,4),ve=0;ve<Ee;ve++)We(he,he.bl_tree[O[ve]*2+1],3);Ne(he,he.dyn_ltree,Re-1),Ne(he,he.dyn_dtree,He-1)}function _e(he){var Re=4093624447,He;for(He=0;He<=31;He++,Re>>>=1)if(Re&1&&he.dyn_ltree[He*2]!==0)return f;if(he.dyn_ltree[9*2]!==0||he.dyn_ltree[10*2]!==0||he.dyn_ltree[13*2]!==0)return S;for(He=32;He<a;He++)if(he.dyn_ltree[He*2]!==0)return S;return f}var ae=!1;function Ie(he){ae||(pe(),ae=!0),he.l_desc=new Ze(he.dyn_ltree,ce),he.d_desc=new Ze(he.dyn_dtree,ye),he.bl_desc=new Ze(he.bl_tree,Le),he.bi_buf=0,he.bi_valid=0,Ge(he)}function Je(he,Re,He,Ee){We(he,(c<<1)+(Ee?1:0),3),ge(he,Re,He,!0)}function et(he){We(he,o<<1,3),ze(he,T,X),xe(he)}function Ke(he,Re,He,Ee){var ve,be,J=0;he.level>0?(he.strm.data_type===_&&(he.strm.data_type=_e(he)),ke(he,he.l_desc),ke(he,he.d_desc),J=Me(he),ve=he.opt_len+3+7>>>3,be=he.static_len+3+7>>>3,be<=ve&&(ve=be)):ve=be=He+5,He+4<=ve&&Re!==-1?Je(he,Re,He,Ee):he.strategy===M||be===ve?(We(he,(o<<1)+(Ee?1:0),3),Qe(he,X,W)):(We(he,(u<<1)+(Ee?1:0),3),ne(he,he.l_desc.max_code+1,he.d_desc.max_code+1,J+1),Qe(he,he.dyn_ltree,he.dyn_dtree)),Ge(he),Ee&&fe(he)}function it(he,Re,He){return he.pending_buf[he.d_buf+he.last_lit*2]=Re>>>8&255,he.pending_buf[he.d_buf+he.last_lit*2+1]=Re&255,he.pending_buf[he.l_buf+he.last_lit]=He&255,he.last_lit++,Re===0?he.dyn_ltree[He*2]++:(he.matches++,Re--,he.dyn_ltree[(G[He]+a+1)*2]++,he.dyn_dtree[Ye(Re)*2]++),he.last_lit===he.lit_bufsize-1}},dejd:function(ot,se,ee){},dmUQ:function(ot,se,ee){"use strict";var z=ee("Ff2n"),L=ee("rePB"),D=ee("1OyB"),k=ee("vuIU"),M=ee("Ji7U"),f=ee("md7G"),S=ee("foSv"),_=ee("q1tI"),p=ee.n(_),c=ee("TSYQ"),o=ee.n(c),u=ee("4IlW");function s(A,g){var P=Object.keys(A);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(A);g&&(O=O.filter(function(F){return Object.getOwnPropertyDescriptor(A,F).enumerable})),P.push.apply(P,O)}return P}function l(A){for(var g=1;g<arguments.length;g++){var P=arguments[g]!=null?arguments[g]:{};g%2?s(Object(P),!0).forEach(function(O){Object(L.a)(A,O,P[O])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(P)):s(Object(P)).forEach(function(O){Object.defineProperty(A,O,Object.getOwnPropertyDescriptor(P,O))})}return A}function t(A){var g=a();return function(){var O=Object(S.a)(A),F;if(g){var X=Object(S.a)(this).constructor;F=Reflect.construct(O,arguments,X)}else F=O.apply(this,arguments);return Object(f.a)(this,F)}}function a(){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(A){return!1}}function i(){}function r(A){A.preventDefault()}var h=function(g){return g.replace(/[^\w.-]+/g,"")},d=200,y=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,C=function(g){return g!=null},T=function(g,P){return P===g||typeof P=="number"&&typeof g=="number"&&isNaN(P)&&isNaN(g)},x=function(A){Object(M.a)(P,A);var g=t(P);function P(O){var F;Object(D.a)(this,P),F=g.call(this,O),F.onKeyDown=function(N){var G=F.props,U=G.onKeyDown,H=G.onPressEnter;if(N.keyCode===u.a.UP){var V=F.getRatio(N);F.up(N,V,null),F.stop()}else if(N.keyCode===u.a.DOWN){var ce=F.getRatio(N);F.down(N,ce,null),F.stop()}else N.keyCode===u.a.ENTER&&H&&H(N);if(F.recordCursorPosition(),F.lastKeyCode=N.keyCode,U){for(var ye=arguments.length,Le=new Array(ye>1?ye-1:0),Ze=1;Ze<ye;Ze++)Le[Ze-1]=arguments[Ze];U.apply(void 0,[N].concat(Le))}},F.onKeyUp=function(N){var G=F.props.onKeyUp;if(F.stop(),F.recordCursorPosition(),G){for(var U=arguments.length,H=new Array(U>1?U-1:0),V=1;V<U;V++)H[V-1]=arguments[V];G.apply(void 0,[N].concat(H))}},F.onChange=function(N){var G=F.props.onChange;F.state.focused&&(F.inputting=!0),F.rawInput=F.props.parser(F.getValueFromEvent(N)),F.setState({inputValue:F.rawInput}),G(F.toNumber(F.rawInput))},F.onMouseUp=function(){var N=F.props.onMouseUp;F.recordCursorPosition(),N&&N.apply(void 0,arguments)},F.onFocus=function(){var N;F.setState({focused:!0}),(N=F.props).onFocus.apply(N,arguments)},F.onBlur=function(){var N=F.props.onBlur;F.inputting=!1,F.setState({focused:!1});var G=F.getCurrentValidValue(F.state.inputValue),U=F.setValue(G,i);if(N){var H=F.input.value,V=F.getInputDisplayValue({focus:!1,value:U});F.input.value=V&&Number(V),N.apply(void 0,arguments),F.input.value=H}},F.getRatio=function(N){var G=1;return N.metaKey||N.ctrlKey?G=.1:N.shiftKey&&(G=10),G},F.getFullNum=function(N){return isNaN(N)?N:/e/i.test(String(N))?Number(N).toFixed(18).replace(/\.?0+$/,""):N},F.getPrecision=function(N){if(C(F.props.precision))return F.props.precision;var G=String(N);if(G.indexOf("e-")>=0)return parseInt(G.slice(G.indexOf("e-")+2),10);var U=0;return G.indexOf(".")>=0&&(U=G.length-G.indexOf(".")-1),U},F.getInputDisplayValue=function(N){var G=N||F.state,U=G.focused,H=G.inputValue,V=G.value,ce;U?ce=H:ce=F.toPrecisionAsStep(V),ce==null&&(ce="");var ye=F.formatWrapper(ce);return C(F.props.decimalSeparator)&&(ye=ye.toString().replace(".",F.props.decimalSeparator)),ye},F.recordCursorPosition=function(){try{F.cursorStart=F.input.selectionStart,F.cursorEnd=F.input.selectionEnd,F.currentValue=F.input.value,F.cursorBefore=F.input.value.substring(0,F.cursorStart),F.cursorAfter=F.input.value.substring(F.cursorEnd)}catch(N){}},F.restoreByAfter=function(N){if(N===void 0)return!1;var G=F.input.value,U=G.lastIndexOf(N);if(U===-1)return!1;var H=F.cursorBefore.length;return F.lastKeyCode===u.a.DELETE&&F.cursorBefore.charAt(H-1)===N[0]?(F.fixCaret(H,H),!0):U+N.length===G.length?(F.fixCaret(U,U),!0):!1},F.partRestoreByAfter=function(N){return N===void 0?!1:Array.prototype.some.call(N,function(G,U){var H=N.substring(U);return F.restoreByAfter(H)})},F.isNotCompleteNumber=function(N){return isNaN(N)||N===""||N===null||N&&N.toString().indexOf(".")===N.toString().length-1},F.stop=function(){F.autoStepTimer&&clearTimeout(F.autoStepTimer)},F.down=function(N,G,U){F.pressingUpOrDown=!0,F.step("down",N,G,U)},F.up=function(N,G,U){F.pressingUpOrDown=!0,F.step("up",N,G,U)},F.saveInput=function(N){F.input=N};var X=O.value;X===void 0&&(X=O.defaultValue),F.state={focused:O.autoFocus};var W=F.getValidValue(F.toNumber(X));return F.state=l(l({},F.state),{},{inputValue:F.toPrecisionAsStep(W),value:W}),F}return Object(k.a)(P,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(F){var X=this.props,W=X.value,N=X.onChange,G=X.max,U=X.min,H=this.state.focused;if(F){if(!T(F.value,W)||!T(F.max,G)||!T(F.min,U)){var V=H?W:this.getValidValue(W),ce;this.pressingUpOrDown?ce=V:this.inputting?ce=this.rawInput:ce=this.toPrecisionAsStep(V),this.setState({value:V,inputValue:ce})}var ye="value"in this.props?W:this.state.value;"max"in this.props&&F.max!==G&&typeof ye=="number"&&ye>G&&N&&N(G),"min"in this.props&&F.min!==U&&typeof ye=="number"&&ye<U&&N&&N(U)}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===u.a.BACKSPACE?Le=this.cursorStart-1:this.lastKeyCode===u.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 u.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case u.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ze){}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(F){var X=F;return X===""?X="":this.isNotCompleteNumber(parseFloat(X))?X=this.state.value:X=this.getValidValue(X),this.toNumber(X)}},{key:"getValueFromEvent",value:function(F){var X=F.target.value.trim().replace(/。/g,".");return C(this.props.decimalSeparator)&&(X=X.replace(this.props.decimalSeparator,".")),X}},{key:"getValidValue",value:function(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,N=parseFloat(F);return isNaN(N)?F:(N<X&&(N=X),N>W&&(N=W),N)}},{key:"setValue",value:function(F,X){var W=this.props.precision,N=this.isNotCompleteNumber(parseFloat(F))?null:parseFloat(F),G=this.state.value,U=G===void 0?null:G,H=this.state.inputValue,V=H===void 0?null:H,ce=typeof N=="number"?N.toFixed(W):"".concat(N),ye=N!==U||ce!=="".concat(V);return"value"in this.props?(V=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:V},X)):this.setState({value:N,inputValue:this.toPrecisionAsStep(F)},X),ye&&this.props.onChange(N),N}},{key:"getMaxPrecision",value:function(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,N=W.precision,G=W.step;if(C(N))return N;var U=this.getPrecision(X),H=this.getPrecision(G),V=this.getPrecision(F);return F?Math.max(V,U+H):U+H}},{key:"getPrecisionFactor",value:function(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(F,X);return Math.pow(10,W)}},{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(F){return this.props.formatter?this.props.formatter(F):F}},{key:"toPrecisionAsStep",value:function(F){if(this.isNotCompleteNumber(F)||F==="")return F;var X=Math.abs(this.getMaxPrecision(F));return isNaN(X)?F.toString():Number(F).toFixed(X)}},{key:"toNumber",value:function(F){var X=this.props.precision,W=this.state.focused,N=F&&F.length>16&&W;return this.isNotCompleteNumber(F)||N?F:C(X)?Math.round(F*Math.pow(10,X))/Math.pow(10,X):Number(F)}},{key:"upStep",value:function(F,X){var W=this.props.step,N=this.getPrecisionFactor(F,X),G=Math.abs(this.getMaxPrecision(F,X)),U=((N*F+N*W*X)/N).toFixed(G);return this.toNumber(U)}},{key:"downStep",value:function(F,X){var W=this.props.step,N=this.getPrecisionFactor(F,X),G=Math.abs(this.getMaxPrecision(F,X)),U=((N*F-N*W*X)/N).toFixed(G);return this.toNumber(U)}},{key:"step",value:function(F,X){var W=this,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,G=arguments.length>3?arguments[3]:void 0;this.stop(),X&&(X.persist(),X.preventDefault());var U=this.props;if(U.disabled)return;var H=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(H))return;var V=this["".concat(F,"Step")](H,N),ce=V>U.max||V<U.min;if(V>U.max?V=U.max:V<U.min&&(V=U.min),this.setValue(V,null),this.setState({focused:!0},function(){W.pressingUpOrDown=!1}),ce)return;this.autoStepTimer=setTimeout(function(){W[F](X,N,!0)},G?d:y)}},{key:"fixCaret",value:function(F,X){if(F===void 0||X===void 0||!this.input||!this.input.value)return;try{var W=this.input.selectionStart,N=this.input.selectionEnd;(F!==W||X!==N)&&this.input.setSelectionRange(F,X)}catch(G){}}},{key:"render",value:function(){var F,X=this.props,W=X.prefixCls,N=X.disabled,G=X.readOnly,U=X.useTouch,H=X.autoComplete,V=X.upHandler,ce=X.downHandler,ye=X.className,Le=X.max,Ze=X.min,Ye=X.style,Oe=X.title,We=X.onMouseEnter,ze=X.onMouseLeave,Ae=X.onMouseOver,xe=X.onMouseOut,le=X.required,Se=X.onClick,pe=X.tabIndex,Ge=X.type,fe=X.placeholder,ge=X.id,De=X.inputMode,Ve=X.pattern,Qe=X.step,ke=X.maxLength,Fe=X.autoFocus,Ne=X.name,Me=X.onPaste,ne=X.onInput,_e=Object(z.a)(X,["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"]),ae=this.state,Ie=ae.value,Je=ae.focused,et=o()(W,(F={},Object(L.a)(F,ye,!!ye),Object(L.a)(F,"".concat(W,"-disabled"),N),Object(L.a)(F,"".concat(W,"-focused"),Je),F)),Ke={};Object.keys(_e).forEach(function(me){(me.substr(0,5)==="data-"||me.substr(0,5)==="aria-"||me==="role")&&(Ke[me]=_e[me])});var it=!G&&!N,he=this.getInputDisplayValue(null),Re=(Ie||Ie===0)&&(isNaN(Ie)||Number(Ie)>=Le),He=(Ie||Ie===0)&&(isNaN(Ie)||Number(Ie)<=Ze),Ee=Re||N||G,ve=He||N||G,be=o()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object(L.a)({},"".concat(W,"-handler-up-disabled"),Ee)),J=o()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object(L.a)({},"".concat(W,"-handler-down-disabled"),ve)),oe=U?{onTouchStart:Ee?i:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?i:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},Z=U?{onTouchStart:ve?i:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?i:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return p.a.createElement("div",{className:et,style:Ye,title:Oe,onMouseEnter:We,onMouseLeave:ze,onMouseOver:Ae,onMouseOut:xe,onFocus:function(){return null},onBlur:function(){return null}},p.a.createElement("div",{className:"".concat(W,"-handler-wrap")},p.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:be}),V||p.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:r})),p.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:J}),ce||p.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:r}))),p.a.createElement("div",{className:"".concat(W,"-input-wrap")},p.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ze,"aria-valuemax":Le,"aria-valuenow":Ie,required:le,type:Ge,placeholder:fe,onPaste:Me,onClick:Se,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:pe,autoComplete:H,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:it?this.onKeyDown:i,onKeyUp:it?this.onKeyUp:i,autoFocus:Fe,maxLength:ke,readOnly:G,disabled:N,max:Le,min:Ze,step:Qe,name:Ne,title:Oe,id:ge,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(he),pattern:Ve,inputMode:De,onInput:ne},Ke))))}}]),P}(p.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:i,onKeyDown:i,onPressEnter:i,onFocus:i,onBlur:i,parser:h,required:!1,autoComplete:"off"};var E=x,w=se.a=E},eP3c:function(ot,se,ee){"use strict";function z(J){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(Z){return typeof Z}:z=function(Z){return Z&&typeof Symbol=="function"&&Z.constructor===Symbol&&Z!==Symbol.prototype?"symbol":typeof Z},z(J)}Object.defineProperty(se,"__esModule",{value:!0}),se.inflateReset=ne,se.inflateReset2=_e,se.inflateResetKeep=Me,se.inflateInit=Ie,se.inflateInit2=ae,se.inflate=Re,se.inflateEnd=He,se.inflateGetHeader=Ee,se.inflateSetDictionary=ve,se.inflateInfo=se.Z_DEFLATED=se.Z_BUF_ERROR=se.Z_MEM_ERROR=se.Z_DATA_ERROR=se.Z_STREAM_ERROR=se.Z_NEED_DICT=se.Z_STREAM_END=se.Z_OK=se.Z_TREES=se.Z_BLOCK=se.Z_FINISH=void 0;var L=p(ee("6BzB")),D=S(ee("xlC8")),k=S(ee("QV2g")),M=S(ee("sjKO")),f=S(ee("JSwD"));function S(J){return J&&J.__esModule?J:{default:J}}function _(){if(typeof WeakMap!="function")return null;var J=new WeakMap;return _=function(){return J},J}function p(J){if(J&&J.__esModule)return J;if(J===null||z(J)!=="object"&&typeof J!="function")return{default:J};var oe=_();if(oe&&oe.has(J))return oe.get(J);var Z={},me=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Xe in J)if(Object.prototype.hasOwnProperty.call(J,Xe)){var j=me?Object.getOwnPropertyDescriptor(J,Xe):null;j&&(j.get||j.set)?Object.defineProperty(Z,Xe,j):Z[Xe]=J[Xe]}return Z.default=J,oe&&oe.set(J,Z),Z}var c=0,o=1,u=2,s=4;se.Z_FINISH=s;var l=5;se.Z_BLOCK=l;var t=6;se.Z_TREES=t;var a=0;se.Z_OK=a;var i=1;se.Z_STREAM_END=i;var r=2;se.Z_NEED_DICT=r;var h=-2;se.Z_STREAM_ERROR=h;var d=-3;se.Z_DATA_ERROR=d;var y=-4;se.Z_MEM_ERROR=y;var m=-5;se.Z_BUF_ERROR=m;var C=8;se.Z_DEFLATED=C;var T=1,x=2,E=3,w=4,A=5,g=6,P=7,O=8,F=9,X=10,W=11,N=12,G=13,U=14,H=15,V=16,ce=17,ye=18,Le=19,Ze=20,Ye=21,Oe=22,We=23,ze=24,Ae=25,xe=26,le=27,Se=28,pe=29,Ge=30,fe=31,ge=32,De=852,Ve=592,Qe=15,ke=Qe;function Fe(J){return(J>>>24&255)+(J>>>8&65280)+((J&65280)<<8)+((J&255)<<24)}function Ne(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new L.Buf16(320),this.work=new L.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Me(J){var oe;return!J||!J.state?h:(oe=J.state,J.total_in=J.total_out=oe.total=0,J.msg="",oe.wrap&&(J.adler=oe.wrap&1),oe.mode=T,oe.last=0,oe.havedict=0,oe.dmax=32768,oe.head=null,oe.hold=0,oe.bits=0,oe.lencode=oe.lendyn=new L.Buf32(De),oe.distcode=oe.distdyn=new L.Buf32(Ve),oe.sane=1,oe.back=-1,a)}function ne(J){var oe;return!J||!J.state?h:(oe=J.state,oe.wsize=0,oe.whave=0,oe.wnext=0,Me(J))}function _e(J,oe){var Z,me;return!J||!J.state?h:(me=J.state,oe<0?(Z=0,oe=-oe):(Z=(oe>>4)+1,oe<48&&(oe&=15)),oe&&(oe<8||oe>15)?h:(me.window!==null&&me.wbits!==oe&&(me.window=null),me.wrap=Z,me.wbits=oe,ne(J)))}function ae(J,oe){var Z,me;return J?(me=new Ne,J.state=me,me.window=null,Z=_e(J,oe),Z!==a&&(J.state=null),Z):h}function Ie(J){return ae(J,ke)}var Je=!0,et,Ke;function it(J){if(Je){var oe;for(et=new L.Buf32(512),Ke=new L.Buf32(32),oe=0;oe<144;)J.lens[oe++]=8;for(;oe<256;)J.lens[oe++]=9;for(;oe<280;)J.lens[oe++]=7;for(;oe<288;)J.lens[oe++]=8;for((0,f.default)(o,J.lens,0,288,et,0,J.work,{bits:9}),oe=0;oe<32;)J.lens[oe++]=5;(0,f.default)(u,J.lens,0,32,Ke,0,J.work,{bits:5}),Je=!1}J.lencode=et,J.lenbits=9,J.distcode=Ke,J.distbits=5}function he(J,oe,Z,me){var Xe,j=J.state;return j.window===null&&(j.wsize=1<<j.wbits,j.wnext=0,j.whave=0,j.window=new L.Buf8(j.wsize)),me>=j.wsize?(L.arraySet(j.window,oe,Z-j.wsize,j.wsize,0),j.wnext=0,j.whave=j.wsize):(Xe=j.wsize-j.wnext,Xe>me&&(Xe=me),L.arraySet(j.window,oe,Z-me,Xe,j.wnext),me-=Xe,me?(L.arraySet(j.window,oe,Z-me,me,0),j.wnext=me,j.whave=j.wsize):(j.wnext+=Xe,j.wnext===j.wsize&&(j.wnext=0),j.whave<j.wsize&&(j.whave+=Xe))),0}function Re(J,oe){var Z,me,Xe,j,we,Be,de,Ce,je,ut,tt,st,gt,At,bt=0,ht,Ot,Bt,mt,St,ft,_t,Pt,Nt=new L.Buf8(4),zt,Dt,Ct=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!J||!J.state||!J.output||!J.input&&J.avail_in!==0)return h;Z=J.state,Z.mode===N&&(Z.mode=G),we=J.next_out,Xe=J.output,de=J.avail_out,j=J.next_in,me=J.input,Be=J.avail_in,Ce=Z.hold,je=Z.bits,ut=Be,tt=de,Pt=a;e:for(;;)switch(Z.mode){case T:if(Z.wrap===0){Z.mode=G;break}for(;je<16;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Z.wrap&2&&Ce===35615){Z.check=0,Nt[0]=Ce&255,Nt[1]=Ce>>>8&255,Z.check=(0,k.default)(Z.check,Nt,2,0),Ce=0,je=0,Z.mode=x;break}if(Z.flags=0,Z.head&&(Z.head.done=!1),!(Z.wrap&1)||(((Ce&255)<<8)+(Ce>>8))%31){J.msg="incorrect header check",Z.mode=Ge;break}if((Ce&15)!==C){J.msg="unknown compression method",Z.mode=Ge;break}if(Ce>>>=4,je-=4,_t=(Ce&15)+8,Z.wbits===0)Z.wbits=_t;else if(_t>Z.wbits){J.msg="invalid window size",Z.mode=Ge;break}Z.dmax=1<<_t,J.adler=Z.check=1,Z.mode=Ce&512?X:N,Ce=0,je=0;break;case x:for(;je<16;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Z.flags=Ce,(Z.flags&255)!==C){J.msg="unknown compression method",Z.mode=Ge;break}if(Z.flags&57344){J.msg="unknown header flags set",Z.mode=Ge;break}Z.head&&(Z.head.text=Ce>>8&1),Z.flags&512&&(Nt[0]=Ce&255,Nt[1]=Ce>>>8&255,Z.check=(0,k.default)(Z.check,Nt,2,0)),Ce=0,je=0,Z.mode=E;case E:for(;je<32;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.head&&(Z.head.time=Ce),Z.flags&512&&(Nt[0]=Ce&255,Nt[1]=Ce>>>8&255,Nt[2]=Ce>>>16&255,Nt[3]=Ce>>>24&255,Z.check=(0,k.default)(Z.check,Nt,4,0)),Ce=0,je=0,Z.mode=w;case w:for(;je<16;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.head&&(Z.head.xflags=Ce&255,Z.head.os=Ce>>8),Z.flags&512&&(Nt[0]=Ce&255,Nt[1]=Ce>>>8&255,Z.check=(0,k.default)(Z.check,Nt,2,0)),Ce=0,je=0,Z.mode=A;case A:if(Z.flags&1024){for(;je<16;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.length=Ce,Z.head&&(Z.head.extra_len=Ce),Z.flags&512&&(Nt[0]=Ce&255,Nt[1]=Ce>>>8&255,Z.check=(0,k.default)(Z.check,Nt,2,0)),Ce=0,je=0}else Z.head&&(Z.head.extra=null);Z.mode=g;case g:if(Z.flags&1024&&(st=Z.length,st>Be&&(st=Be),st&&(Z.head&&(_t=Z.head.extra_len-Z.length,Z.head.extra||(Z.head.extra=new Array(Z.head.extra_len)),L.arraySet(Z.head.extra,me,j,st,_t)),Z.flags&512&&(Z.check=(0,k.default)(Z.check,me,st,j)),Be-=st,j+=st,Z.length-=st),Z.length))break e;Z.length=0,Z.mode=P;case P:if(Z.flags&2048){if(Be===0)break e;st=0;do _t=me[j+st++],Z.head&&_t&&Z.length<65536&&(Z.head.name+=String.fromCharCode(_t));while(_t&&st<Be);if(Z.flags&512&&(Z.check=(0,k.default)(Z.check,me,st,j)),Be-=st,j+=st,_t)break e}else Z.head&&(Z.head.name=null);Z.length=0,Z.mode=O;case O:if(Z.flags&4096){if(Be===0)break e;st=0;do _t=me[j+st++],Z.head&&_t&&Z.length<65536&&(Z.head.comment+=String.fromCharCode(_t));while(_t&&st<Be);if(Z.flags&512&&(Z.check=(0,k.default)(Z.check,me,st,j)),Be-=st,j+=st,_t)break e}else Z.head&&(Z.head.comment=null);Z.mode=F;case F:if(Z.flags&512){for(;je<16;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Ce!==(Z.check&65535)){J.msg="header crc mismatch",Z.mode=Ge;break}Ce=0,je=0}Z.head&&(Z.head.hcrc=Z.flags>>9&1,Z.head.done=!0),J.adler=Z.check=0,Z.mode=N;break;case X:for(;je<32;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}J.adler=Z.check=Fe(Ce),Ce=0,je=0,Z.mode=W;case W:if(Z.havedict===0)return J.next_out=we,J.avail_out=de,J.next_in=j,J.avail_in=Be,Z.hold=Ce,Z.bits=je,r;J.adler=Z.check=1,Z.mode=N;case N:if(oe===l||oe===t)break e;case G:if(Z.last){Ce>>>=je&7,je-=je&7,Z.mode=le;break}for(;je<3;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.last=Ce&1,Ce>>>=1,je-=1;switch(Ce&3){case 0:Z.mode=U;break;case 1:if(it(Z),Z.mode=Ze,oe===t){Ce>>>=2,je-=2;break e}break;case 2:Z.mode=ce;break;case 3:J.msg="invalid block type",Z.mode=Ge}Ce>>>=2,je-=2;break;case U:for(Ce>>>=je&7,je-=je&7;je<32;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if((Ce&65535)!==(Ce>>>16^65535)){J.msg="invalid stored block lengths",Z.mode=Ge;break}if(Z.length=Ce&65535,Ce=0,je=0,Z.mode=H,oe===t)break e;case H:Z.mode=V;case V:if(st=Z.length,st){if(st>Be&&(st=Be),st>de&&(st=de),st===0)break e;L.arraySet(Xe,me,j,st,we),Be-=st,j+=st,de-=st,we+=st,Z.length-=st;break}Z.mode=N;break;case ce:for(;je<14;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Z.nlen=(Ce&31)+257,Ce>>>=5,je-=5,Z.ndist=(Ce&31)+1,Ce>>>=5,je-=5,Z.ncode=(Ce&15)+4,Ce>>>=4,je-=4,Z.nlen>286||Z.ndist>30){J.msg="too many length or distance symbols",Z.mode=Ge;break}Z.have=0,Z.mode=ye;case ye:for(;Z.have<Z.ncode;){for(;je<3;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.lens[Ct[Z.have++]]=Ce&7,Ce>>>=3,je-=3}for(;Z.have<19;)Z.lens[Ct[Z.have++]]=0;if(Z.lencode=Z.lendyn,Z.lenbits=7,zt={bits:Z.lenbits},Pt=(0,f.default)(c,Z.lens,0,19,Z.lencode,0,Z.work,zt),Z.lenbits=zt.bits,Pt){J.msg="invalid code lengths set",Z.mode=Ge;break}Z.have=0,Z.mode=Le;case Le:for(;Z.have<Z.nlen+Z.ndist;){for(;!(bt=Z.lencode[Ce&(1<<Z.lenbits)-1],ht=bt>>>24,Ot=bt>>>16&255,Bt=bt&65535,ht<=je);){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Bt<16)Ce>>>=ht,je-=ht,Z.lens[Z.have++]=Bt;else{if(Bt===16){for(Dt=ht+2;je<Dt;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Ce>>>=ht,je-=ht,Z.have===0){J.msg="invalid bit length repeat",Z.mode=Ge;break}_t=Z.lens[Z.have-1],st=3+(Ce&3),Ce>>>=2,je-=2}else if(Bt===17){for(Dt=ht+3;je<Dt;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Ce>>>=ht,je-=ht,_t=0,st=3+(Ce&7),Ce>>>=3,je-=3}else{for(Dt=ht+7;je<Dt;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Ce>>>=ht,je-=ht,_t=0,st=11+(Ce&127),Ce>>>=7,je-=7}if(Z.have+st>Z.nlen+Z.ndist){J.msg="invalid bit length repeat",Z.mode=Ge;break}for(;st--;)Z.lens[Z.have++]=_t}}if(Z.mode===Ge)break;if(Z.lens[256]===0){J.msg="invalid code -- missing end-of-block",Z.mode=Ge;break}if(Z.lenbits=9,zt={bits:Z.lenbits},Pt=(0,f.default)(o,Z.lens,0,Z.nlen,Z.lencode,0,Z.work,zt),Z.lenbits=zt.bits,Pt){J.msg="invalid literal/lengths set",Z.mode=Ge;break}if(Z.distbits=6,Z.distcode=Z.distdyn,zt={bits:Z.distbits},Pt=(0,f.default)(u,Z.lens,Z.nlen,Z.ndist,Z.distcode,0,Z.work,zt),Z.distbits=zt.bits,Pt){J.msg="invalid distances set",Z.mode=Ge;break}if(Z.mode=Ze,oe===t)break e;case Ze:Z.mode=Ye;case Ye:if(Be>=6&&de>=258){J.next_out=we,J.avail_out=de,J.next_in=j,J.avail_in=Be,Z.hold=Ce,Z.bits=je,(0,M.default)(J,tt),we=J.next_out,Xe=J.output,de=J.avail_out,j=J.next_in,me=J.input,Be=J.avail_in,Ce=Z.hold,je=Z.bits,Z.mode===N&&(Z.back=-1);break}for(Z.back=0;!(bt=Z.lencode[Ce&(1<<Z.lenbits)-1],ht=bt>>>24,Ot=bt>>>16&255,Bt=bt&65535,ht<=je);){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Ot&&(Ot&240)===0){for(mt=ht,St=Ot,ft=Bt;!(bt=Z.lencode[ft+((Ce&(1<<mt+St)-1)>>mt)],ht=bt>>>24,Ot=bt>>>16&255,Bt=bt&65535,mt+ht<=je);){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Ce>>>=mt,je-=mt,Z.back+=mt}if(Ce>>>=ht,je-=ht,Z.back+=ht,Z.length=Bt,Ot===0){Z.mode=xe;break}if(Ot&32){Z.back=-1,Z.mode=N;break}if(Ot&64){J.msg="invalid literal/length code",Z.mode=Ge;break}Z.extra=Ot&15,Z.mode=Oe;case Oe:if(Z.extra){for(Dt=Z.extra;je<Dt;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.length+=Ce&(1<<Z.extra)-1,Ce>>>=Z.extra,je-=Z.extra,Z.back+=Z.extra}Z.was=Z.length,Z.mode=We;case We:for(;!(bt=Z.distcode[Ce&(1<<Z.distbits)-1],ht=bt>>>24,Ot=bt>>>16&255,Bt=bt&65535,ht<=je);){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if((Ot&240)===0){for(mt=ht,St=Ot,ft=Bt;!(bt=Z.distcode[ft+((Ce&(1<<mt+St)-1)>>mt)],ht=bt>>>24,Ot=bt>>>16&255,Bt=bt&65535,mt+ht<=je);){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Ce>>>=mt,je-=mt,Z.back+=mt}if(Ce>>>=ht,je-=ht,Z.back+=ht,Ot&64){J.msg="invalid distance code",Z.mode=Ge;break}Z.offset=Bt,Z.extra=Ot&15,Z.mode=ze;case ze:if(Z.extra){for(Dt=Z.extra;je<Dt;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}Z.offset+=Ce&(1<<Z.extra)-1,Ce>>>=Z.extra,je-=Z.extra,Z.back+=Z.extra}if(Z.offset>Z.dmax){J.msg="invalid distance too far back",Z.mode=Ge;break}Z.mode=Ae;case Ae:if(de===0)break e;if(st=tt-de,Z.offset>st){if(st=Z.offset-st,st>Z.whave&&Z.sane){J.msg="invalid distance too far back",Z.mode=Ge;break}st>Z.wnext?(st-=Z.wnext,gt=Z.wsize-st):gt=Z.wnext-st,st>Z.length&&(st=Z.length),At=Z.window}else At=Xe,gt=we-Z.offset,st=Z.length;st>de&&(st=de),de-=st,Z.length-=st;do Xe[we++]=At[gt++];while(--st);Z.length===0&&(Z.mode=Ye);break;case xe:if(de===0)break e;Xe[we++]=Z.length,de--,Z.mode=Ye;break;case le:if(Z.wrap){for(;je<32;){if(Be===0)break e;Be--,Ce|=me[j++]<<je,je+=8}if(tt-=de,J.total_out+=tt,Z.total+=tt,tt&&(J.adler=Z.check=Z.flags?(0,k.default)(Z.check,Xe,tt,we-tt):(0,D.default)(Z.check,Xe,tt,we-tt)),tt=de,(Z.flags?Ce:Fe(Ce))!==Z.check){J.msg="incorrect data check",Z.mode=Ge;break}Ce=0,je=0}Z.mode=Se;case Se:if(Z.wrap&&Z.flags){for(;je<32;){if(Be===0)break e;Be--,Ce+=me[j++]<<je,je+=8}if(Ce!==(Z.total&4294967295)){J.msg="incorrect length check",Z.mode=Ge;break}Ce=0,je=0}Z.mode=pe;case pe:Pt=i;break e;case Ge:Pt=d;break e;case fe:return y;case ge:default:return h}return J.next_out=we,J.avail_out=de,J.next_in=j,J.avail_in=Be,Z.hold=Ce,Z.bits=je,(Z.wsize||tt!==J.avail_out&&Z.mode<Ge&&(Z.mode<le||oe!==s))&&he(J,J.output,J.next_out,tt-J.avail_out)?(Z.mode=fe,y):(ut-=J.avail_in,tt-=J.avail_out,J.total_in+=ut,J.total_out+=tt,Z.total+=tt,Z.wrap&&tt&&(J.adler=Z.check=Z.flags?(0,k.default)(Z.check,Xe,tt,J.next_out-tt):(0,D.default)(Z.check,Xe,tt,J.next_out-tt)),J.data_type=Z.bits+(Z.last?64:0)+(Z.mode===N?128:0)+(Z.mode===Ze||Z.mode===H?256:0),(ut===0&&tt===0||oe===s)&&Pt===a&&(Pt=m),Pt)}function He(J){if(!J||!J.state)return h;var oe=J.state;return oe.window&&(oe.window=null),J.state=null,a}function Ee(J,oe){var Z;return!J||!J.state?h:(Z=J.state,(Z.wrap&2)===0?h:(Z.head=oe,oe.done=!1,a))}function ve(J,oe){var Z=oe.length,me,Xe,j;return!J||!J.state?h:(me=J.state,me.wrap!==0&&me.mode!==W?h:me.mode===W&&(Xe=1,Xe=(0,D.default)(Xe,oe,Z,0),Xe!==me.check)?d:(j=he(J,oe,Z,Z),j?(me.mode=fe,y):(me.havedict=1,a)))}var be="pako inflate (from Nodeca project)";se.inflateInfo=be},fjLI:function(ot,se,ee){"use strict";ee.d(se,"e",function(){return c}),ee.d(se,"a",function(){return o}),ee.d(se,"c",function(){return u}),ee.d(se,"d",function(){return l}),ee.d(se,"b",function(){return t});var z=ee("8HAY"),L=ee("Cg/j"),D=ee("T8No"),k=ee("nnTU"),M=ee("MI8n"),f=function(){var a=function(i,r){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,d){h.__proto__=d}||function(h,d){for(var y in d)d.hasOwnProperty(y)&&(h[y]=d[y])},a(i,r)};return function(i,r){a(i,r);function h(){this.constructor=i}i.prototype=r===null?Object.create(r):(h.prototype=r.prototype,new h)}}(),S=function(a,i,r,h){var d=arguments.length,y=d<3?i:h===null?h=Object.getOwnPropertyDescriptor(i,r):h,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(a,i,r,h);else for(var C=a.length-1;C>=0;C--)(m=a[C])&&(y=(d<3?m(y):d>3?m(i,r,y):m(i,r))||y);return d>3&&y&&Object.defineProperty(i,r,y),y},_=function(a,i){return function(r,h){i(r,h,a)}},p=function(){for(var a=0,i=0,r=arguments.length;i<r;i++)a+=arguments[i].length;for(var h=Array(a),d=0,i=0;i<r;i++)for(var y=arguments[i],m=0,C=y.length;m<C;m++,d++)h[d]=y[m];return h};function c(a){return a.command!==void 0}var o=Object(L.c)("menuService"),u=new(function(){function a(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new M.a,this.onDidChangeMenu=this._onDidChangeMenu.event}return a.prototype.addCommand=function(i){var r=this;return this._commands.set(i.id,i),this._onDidChangeMenu.fire(0),{dispose:function(){r._commands.delete(i.id)&&r._onDidChangeMenu.fire(0)}}},a.prototype.getCommand=function(i){return this._commands.get(i)},a.prototype.getCommands=function(){var i=new Map;return this._commands.forEach(function(r,h){return i.set(h,r)}),i},a.prototype.appendMenuItem=function(i,r){var h=this,d=this._menuItems.get(i);return d?d.push(r):(d=[r],this._menuItems.set(i,d)),this._onDidChangeMenu.fire(i),{dispose:function(){var y=d.indexOf(r);y>=0&&(d.splice(y,1),h._onDidChangeMenu.fire(i))}}},a.prototype.getMenuItems=function(i){var r=(this._menuItems.get(i)||[]).slice(0);return i===0&&this._appendImplicitItems(r),r},a.prototype._appendImplicitItems=function(i){for(var r=new Set,h=i.filter(function(x){return c(x)}),d=0,y=h;d<y.length;d++){var m=y[d],C=m.command,T=m.alt;r.add(C.id),T&&r.add(T.id)}this._commands.forEach(function(x,E){r.has(E)||i.push({command:x})})},a}()),s=function(a){f(i,a);function i(r,h,d){var y=a.call(this,r,h)||this;return y._commandService=d,y}return i.prototype.run=function(){for(var r,h=[],d=0;d<arguments.length;d++)h[d]=arguments[d];return(r=this._commandService).executeCommand.apply(r,p([this.id],h))},i=S([_(2,k.b)],i),i}(z.a),l=function(a){f(i,a);function i(r){var h=this;return typeof r.title=="string"?h=a.call(this,"",r.title,"submenu")||this:h=a.call(this,"",r.title.value,"submenu")||this,h.item=r,h}return i}(z.a),t=function(a){f(i,a);function i(r,h,d,y,m){var C=this;return typeof r.title=="string"?C=a.call(this,r.id,r.title,m)||this:C=a.call(this,r.id,r.title.value,m)||this,C._cssClass=void 0,C._enabled=!r.precondition||y.contextMatchesRules(r.precondition),C._checked=Boolean(r.toggled&&y.contextMatchesRules(r.toggled)),C._options=d||{},C.item=r,C.alt=h?new i(h,void 0,C._options,y,m):void 0,C}return i.prototype.dispose=function(){this.alt&&this.alt.dispose(),a.prototype.dispose.call(this)},i.prototype.run=function(){for(var r=[],h=0;h<arguments.length;h++)r[h]=arguments[h];var d=[];return this._options.arg&&(d=p(d,[this._options.arg])),this._options.shouldForwardArgs&&(d=p(d,r)),a.prototype.run.apply(this,d)},i=S([_(3,D.c),_(4,k.b)],i),i}(s)},gIYZ:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={Backspace:"Backspace",AltLeft:"Alt",AltRight:"Alt",CapsLock:"CapsLock",ContextMenu:"ContextMenu",ControlLeft:"Control",ControlRight:"Control",Enter:"Enter",MetaLeft:"Meta",MetaRight:"Meta",ShiftLeft:"Shift",ShiftRight:"Shift",Tab:"Tab",Delete:"Delete",End:"End",Help:"Help",Home:"Home",Insert:"Insert",PageDown:"PageDown",PageUp:"PageUp",ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowRight:"ArrowRight",ArrowUp:"ArrowUp",NumLock:"NumLock",NumpadBackspace:"Backspace",NumpadClear:"Clear",Escape:"Escape",F1:"F1",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",F10:"F10",F11:"F11",F12:"F12",F13:"F13",F14:"F14",F15:"F15",F16:"F16",F17:"F17",F18:"F18",F19:"F19",F20:"F20",F21:"F21",F22:"F22",F23:"F23",F24:"F24",F25:"F25",F26:"F26",F27:"F27",F28:"F28",F29:"F29",F30:"F30",F31:"F31",F32:"F32",F33:"F33",F34:"F34",F35:"F35",PrintScreen:"PrintScreen",ScrollLock:"ScrollLock",Pause:"Pause",BrowserBack:"BrowserBack",BrowserFavorites:"BrowserFavorites",BrowserForward:"BrowserForward",BrowserHome:"BrowserHome",BrowserRefresh:"BrowserRefresh",BrowserSearch:"BrowserSearch",BrowserStop:"BrowserStop",Eject:"Eject",LaunchApp1:"LaunchMyComputer",LaunchApp2:"LaunchCalendar",LaunchMail:"LaunchMail",MediaPlayPause:"MediaPlay",MediaStop:"MediaStop",MediaTrackNext:"MediaTrackNext",MediaTrackPrevious:"MediaTrackPrevious",Power:"Power",Sleep:"Sleep",AudioVolumeDown:"AudioVolumeDown",AudioVolumeMute:"AudioVolumeMute",AudioVolumeUp:"AudioVolumeUp",WakeUp:"WakeUp"};se.default=z},h78n:function(ot,se,ee){"use strict";ee.d(se,"a",function(){return F});var z=ee("q1tI"),L=ee.n(z),D=ee("TSYQ"),k=ee.n(D),M={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},f=function(N){var G=N.map(function(){return Object(z.useRef)()}),U=Object(z.useRef)();return Object(z.useEffect)(function(){var H=Date.now(),V=!1;Object.keys(G).forEach(function(ce){var ye=G[ce].current;if(!ye)return;V=!0;var Le=ye.style;Le.transitionDuration=".3s, .3s, .3s, .06s",U.current&&H-U.current<100&&(Le.transitionDuration="0s, 0s")}),V&&(U.current=Date.now())}),[G]};function S(){return S=Object.assign||function(W){for(var N=1;N<arguments.length;N++){var G=arguments[N];for(var U in G)Object.prototype.hasOwnProperty.call(G,U)&&(W[U]=G[U])}return W},S.apply(this,arguments)}function _(W,N){return s(W)||u(W,N)||c(W,N)||p()}function p(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(W,N){if(!W)return;if(typeof W=="string")return o(W,N);var G=Object.prototype.toString.call(W).slice(8,-1);if(G==="Object"&&W.constructor&&(G=W.constructor.name),G==="Map"||G==="Set")return Array.from(W);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return o(W,N)}function o(W,N){(N==null||N>W.length)&&(N=W.length);for(var G=0,U=new Array(N);G<N;G++)U[G]=W[G];return U}function u(W,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var G=[],U=!0,H=!1,V=void 0;try{for(var ce=W[Symbol.iterator](),ye;!(U=(ye=ce.next()).done)&&!(G.push(ye.value),N&&G.length===N);U=!0);}catch(Le){H=!0,V=Le}finally{try{!U&&ce.return!=null&&ce.return()}finally{if(H)throw V}}return G}function s(W){if(Array.isArray(W))return W}function l(W,N){if(W==null)return{};var G=t(W,N),U,H;if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(W);for(H=0;H<V.length;H++){if(U=V[H],N.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,U))continue;G[U]=W[U]}}return G}function t(W,N){if(W==null)return{};var G={},U=Object.keys(W),H,V;for(V=0;V<U.length;V++){if(H=U[V],N.indexOf(H)>=0)continue;G[H]=W[H]}return G}var a=function(N){var G=N.className,U=N.percent,H=N.prefixCls,V=N.strokeColor,ce=N.strokeLinecap,ye=N.strokeWidth,Le=N.style,Ze=N.trailColor,Ye=N.trailWidth,Oe=N.transition,We=l(N,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete We.gapPosition;var ze=Array.isArray(U)?U:[U],Ae=Array.isArray(V)?V:[V],xe=f(ze),le=_(xe,1),Se=le[0],pe=ye/2,Ge=100-ye/2,fe="M ".concat(ce==="round"?pe:0,",").concat(pe,`
L `).concat(ce==="round"?Ge:100,",").concat(pe),ge="0 0 100 ".concat(ye),De=0;return L.a.createElement("svg",S({className:k()("".concat(H,"-line"),G),viewBox:ge,preserveAspectRatio:"none",style:Le},We),L.a.createElement("path",{className:"".concat(H,"-line-trail"),d:fe,strokeLinecap:ce,stroke:Ze,strokeWidth:Ye||ye,fillOpacity:"0"}),ze.map(function(Ve,Qe){var ke={strokeDasharray:"".concat(Ve,"px, 100px"),strokeDashoffset:"-".concat(De,"px"),transition:Oe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Fe=Ae[Qe]||Ae[Ae.length-1];return De+=Ve,L.a.createElement("path",{key:Qe,className:"".concat(H,"-line-path"),d:fe,strokeLinecap:ce,stroke:Fe,strokeWidth:ye,fillOpacity:"0",ref:Se[Qe],style:ke})}))};a.defaultProps=M;var i=a;function r(){return r=Object.assign||function(W){for(var N=1;N<arguments.length;N++){var G=arguments[N];for(var U in G)Object.prototype.hasOwnProperty.call(G,U)&&(W[U]=G[U])}return W},r.apply(this,arguments)}function h(W,N){return T(W)||C(W,N)||y(W,N)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y(W,N){if(!W)return;if(typeof W=="string")return m(W,N);var G=Object.prototype.toString.call(W).slice(8,-1);if(G==="Object"&&W.constructor&&(G=W.constructor.name),G==="Map"||G==="Set")return Array.from(W);if(G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G))return m(W,N)}function m(W,N){(N==null||N>W.length)&&(N=W.length);for(var G=0,U=new Array(N);G<N;G++)U[G]=W[G];return U}function C(W,N){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var G=[],U=!0,H=!1,V=void 0;try{for(var ce=W[Symbol.iterator](),ye;!(U=(ye=ce.next()).done)&&!(G.push(ye.value),N&&G.length===N);U=!0);}catch(Le){H=!0,V=Le}finally{try{!U&&ce.return!=null&&ce.return()}finally{if(H)throw V}}return G}function T(W){if(Array.isArray(W))return W}function x(W,N){if(W==null)return{};var G=E(W,N),U,H;if(Object.getOwnPropertySymbols){var V=Object.getOwnPropertySymbols(W);for(H=0;H<V.length;H++){if(U=V[H],N.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,U))continue;G[U]=W[U]}}return G}function E(W,N){if(W==null)return{};var G={},U=Object.keys(W),H,V;for(V=0;V<U.length;V++){if(H=U[V],N.indexOf(H)>=0)continue;G[H]=W[H]}return G}var w=0;function A(W){return+W.replace("%","")}function g(W){return Array.isArray(W)?W:[W]}function P(W,N,G,U){var H=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,V=arguments.length>5?arguments[5]:void 0,ce=50-U/2,ye=0,Le=-ce,Ze=0,Ye=-2*ce;switch(V){case"left":ye=-ce,Le=0,Ze=2*ce,Ye=0;break;case"right":ye=ce,Le=0,Ze=-2*ce,Ye=0;break;case"bottom":Le=ce,Ye=2*ce;break;default:}var Oe="M 50,50 m ".concat(ye,",").concat(Le,`
a `).concat(ce,",").concat(ce," 0 1 1 ").concat(Ze,",").concat(-Ye,`
a `).concat(ce,",").concat(ce," 0 1 1 ").concat(-Ze,",").concat(Ye),We=Math.PI*2*ce,ze={stroke:G,strokeDasharray:"".concat(N/100*(We-H),"px ").concat(We,"px"),strokeDashoffset:"-".concat(H/2+W/100*(We-H),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Oe,pathStyle:ze}}var O=function(N){var G=N.prefixCls,U=N.strokeWidth,H=N.trailWidth,V=N.gapDegree,ce=N.gapPosition,ye=N.trailColor,Le=N.strokeLinecap,Ze=N.style,Ye=N.className,Oe=N.strokeColor,We=N.percent,ze=x(N,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),Ae=Object(z.useMemo)(function(){return w+=1,w},[]),xe=P(0,100,ye,U,V,ce),le=xe.pathString,Se=xe.pathStyle,pe=g(We),Ge=g(Oe),fe=Ge.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),ge=f(pe),De=h(ge,1),Ve=De[0],Qe=function(){var Fe=0;return pe.map(function(Ne,Me){var ne=Ge[Me]||Ge[Ge.length-1],_e=Object.prototype.toString.call(ne)==="[object Object]"?"url(#".concat(G,"-gradient-").concat(Ae,")"):"",ae=P(Fe,Ne,ne,U,V,ce);return Fe+=Ne,L.a.createElement("path",{key:Me,className:"".concat(G,"-circle-path"),d:ae.pathString,stroke:_e,strokeLinecap:Le,strokeWidth:U,opacity:Ne===0?0:1,fillOpacity:"0",style:ae.pathStyle,ref:Ve[Me]})})};return L.a.createElement("svg",r({className:k()("".concat(G,"-circle"),Ye),viewBox:"0 0 100 100",style:Ze},ze),fe&&L.a.createElement("defs",null,L.a.createElement("linearGradient",{id:"".concat(G,"-gradient-").concat(Ae),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(fe).sort(function(ke,Fe){return A(ke)-A(Fe)}).map(function(ke,Fe){return L.a.createElement("stop",{key:Fe,offset:ke,stopColor:fe[ke]})}))),L.a.createElement("path",{className:"".concat(G,"-circle-trail"),d:le,stroke:ye,strokeLinecap:Le,strokeWidth:H||U,fillOpacity:"0",style:Se}),Qe().reverse())};O.defaultProps=M;var F=O,X={Line:i,Circle:F}},hXwI:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(M,f){if(!(M instanceof f))throw new TypeError("Cannot call a class as a function")}function L(M,f){for(var S=0;S<f.length;S++){var _=f[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(M,_.key,_)}}function D(M,f,S){return f&&L(M.prototype,f),S&&L(M,S),M}var k=function(){function M(){z(this,M)}return D(M,[{key:"decodeRect",value:function(S,_,p,c,o,u,s){if(o.rQwait("COPYRECT",4))return!1;var l=o.rQshift16(),t=o.rQshift16();return u.copyImage(l,t,S,_,p,c),!0}}]),M}();se.default=k},iJb0:function(ot,se,ee){"use strict";ee.r(se);var z=ee("+L6B"),L=ee("2/Rp"),D=ee("miYZ"),k=ee("tsqr"),M=ee("14J3"),f=ee("BMrR"),S=ee("jCWc"),_=ee("kPKH"),p=ee("k1fw"),c=ee("9og8"),o=ee("2qtc"),u=ee("kLXV"),s=ee("tJVT"),l=ee("PpiC"),t=ee("aHsQ"),a=ee("sGsY"),i=ee("WmNS"),r=ee.n(i),h=ee("q1tI"),d=ee.n(h),y=ee("9kvl"),m=ee("Lmeb"),C=ee("Ot1p"),T=ee("Dqnf"),x=ee("dhSg"),E=ee("MXD1"),w=ee("CFYs"),A=ee("rAM+"),g=ee("IxHN"),P=ee("bdgK"),O=ee("M8RZ"),F=ee("Ty5D"),X=ee("1dTM"),W=ee.n(X),N=ee("HBuW"),G=ee("VaU+"),U=ee.n(G),H=ee("ye1Q"),V=d.a.createElement(H.a,{style:{fontSize:24},spin:!0});function ce(le){return le.replace(/\\u([\dA-Za-z]{4})/g,function(Se,pe){return String.fromCharCode(parseInt("0x"+pe))})}function ye(le){le||(le=window.location.search);var Se=le.substr(1),pe={};return Se.split("&").forEach(function(Ge){var fe=Ge.split("=");pe[fe[0]]=decodeURIComponent(fe[1])}),pe}var Le={loading:!0,isLarge:!1,showClipBoardBox:!1,transferContent:"",mes:"\u5B9E\u9A8C\u73AF\u5883\u51C6\u5907\u4E2D"},Ze;(function(le){le[le.SET_LOADING=0]="SET_LOADING",le[le.SET_IS_LARGE=1]="SET_IS_LARGE",le[le.SET_MES=2]="SET_MES",le[le.SET_STATE=3]="SET_STATE",le[le.SHOW_CLIPBOARD_BOX=4]="SHOW_CLIPBOARD_BOX",le[le.SET_TRANSFER_CONTENT=5]="SET_TRANSFER_CONTENT"})(Ze||(Ze={}));function Ye(le,Se){switch(Se.type){case Ze.SET_LOADING:return Object(p.a)(Object(p.a)({},le),{},{loading:Se.payload});case Ze.SET_IS_LARGE:return Object(p.a)(Object(p.a)({},le),{},{isLarge:Se.payload});case Ze.SET_MES:return Object(p.a)(Object(p.a)({},le),{},{mes:Se.payload});case Ze.SET_STATE:return Object(p.a)(Object(p.a)({},le),Se.payload);case Ze.SET_TRANSFER_CONTENT:return Object(p.a)(Object(p.a)({},le),{},{transferContent:Se.payload});case Ze.SHOW_CLIPBOARD_BOX:return Object(p.a)(Object(p.a)({},le),{},{showClipBoardBox:Se.payload});default:throw new Error}}var Oe=function(le){var Se=le.vnc_url,pe=le.window_vnc_url,Ge=le.taskId,fe=Object(h.useRef)(),ge=Object(h.useRef)(),De=Object(h.useReducer)(Ye,Le),Ve=Object(s.a)(De,2),Qe=Ve[0],ke=Ve[1],Fe=Object(h.useState)(0),Ne=Object(s.a)(Fe,2),Me=Ne[0],ne=Ne[1],_e=Qe.mes,ae=Qe.loading,Ie=Qe.showClipBoardBox,Je=Qe.isLarge,et=Qe.transferContent,Ke=Object(h.useState)(0),it=Object(s.a)(Ke,2),he=it[0],Re=it[1],He,Ee=Object(h.useRef)(),ve=Object(F.i)();function be(){ke({type:Ze.SHOW_CLIPBOARD_BOX,payload:!1})}function J(){ke({type:Ze.SET_IS_LARGE,payload:!Je})}function oe(j){var we;return fe.current&&(we=new P.default(function(Be){var de=Object(A.a)(Be),Ce;try{for(de.s();!(Ce=de.n()).done;){var je=Ce.value;(je.target.offsetHeight>0||je.target.offsetWidth>0)&&j._eventHandlers.windowResize()}}catch(ut){de.e(ut)}finally{de.f()}}),we.observe(fe.current)),we}var Z=function(){var j=Object(c.a)(r.a.mark(function we(){var Be;return r.a.wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.next=2,Object(N.rb)(Object(p.a)({},ve));case 2:if(Be=Ce.sent,!((Be==null?void 0:Be.status)===-3)){Ce.next=5;break}return Ce.abrupt("return",new Promise(function(){var je=Object(c.a)(r.a.mark(function ut(tt,st){return r.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:u.a.confirm({content:"\u68C0\u6D4B\u5230\u60A8\u5DF2\u7ECF\u5F00\u542F\u4E86\u5176\u4ED6windows\u73AF\u5883\uFF0C\u8BF7\u5148\u5173\u95ED\u73AF\u5883\u540E\uFF0C\u518D\u8FDE\u63A5",okText:"\u7ACB\u5373\u5173\u95ED",cancelText:"\u7A0D\u540E\u5173\u95ED",onOk:function(){var bt=Object(c.a)(r.a.mark(function Ot(){return r.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:return clearTimeout(He),Re(0),Z(),mt.abrupt("return");case 4:case"end":return mt.stop()}},Ot)}));function ht(){return bt.apply(this,arguments)}return ht}()});case 1:case"end":return At.stop()}},ut)}));return function(ut,tt){return je.apply(this,arguments)}}()));case 5:if(!((Be==null?void 0:Be.status)===-1)){Ce.next=7;break}throw new String(Be==null?void 0:Be.message);case 7:return x.a.publish("update-windows-time",Be==null?void 0:Be.data),Ce.abrupt("return",Be);case 9:case"end":return Ce.stop()}},we)}));return function(){return j.apply(this,arguments)}}();Object(h.useEffect)(function(){return Ee.current=setTimeout(function(){u.a.confirm({title:d.a.createElement(d.a.Fragment,null,"\u5B9E\u9A8C\u73AF\u5883\u5EF6\u65F6\u63D0\u9192"),content:"\u5F53\u524D\u5B9E\u9A8C\u73AF\u5883\u5C06\u4E8E 5 \u5206\u949F\u540E\u5173\u95ED\uFF0C\u9700\u8981\u5EF6\u957F\u4F7F\u7528\u65F6\u95F4\u5417\uFF1F",okText:"\u7ACB\u5373\u5EF6\u957F",cancelText:"\u4E0D\u9700\u8981",onOk:function(){x.a.publish("delayed-time",1),ne(Me+1)}})},1e3*60*60),function(){clearTimeout(Ee.current)}},[]),Object(h.useEffect)(function(){var j,we;function Be(st){pe&&(k.b.warn("\u7531\u4E8E\u957F\u65F6\u95F4\u672A\u64CD\u4F5C\uFF0C\u8FDE\u63A5\u5931\u6548\uFF0C\u6B63\u5728\u91CD\u65B0\u8FDE\u63A5Windows VNC\u670D\u52A1"),ke({type:Ze.SET_LOADING,payload:!0}),ne(Me+1))}function de(){clearTimeout(He),Re(100),setTimeout(function(){ke({type:Ze.SET_LOADING,payload:!1})},1300),x.a.subscribe("send-ctrl-alt-delete",function(){var st;(st=j)===null||st===void 0||st.sendCtrlAltDel()})}function Ce(st){var gt=ce(st.detail.text);ke({type:Ze.SET_TRANSFER_CONTENT,payload:gt})}if((pe||Se)&&fe.current){new Promise(Object(c.a)(r.a.mark(function st(){var gt,At,bt,ht,Ot,Bt,mt,St,ft,_t;return r.a.wrap(function(Nt){for(;;)switch(Nt.prev=Nt.next){case 0:return gt=ye(),At="",Nt.next=4,Z();case 4:ht=Nt.sent,pe?(bt="Edu123",At=decodeURIComponent(ht==null||((Ot=ht.data)===null||Ot===void 0)?void 0:Ot.vnc_url)):(mt=new URL(ht==null||((Bt=ht.data)===null||Bt===void 0)?void 0:Bt.vnc_url),St=mt.protocol,ft=mt.searchParams,_t=mt.host,bt=ft.get("password"),At="".concat(St==="https:"?"wss":"ws","://").concat(_t,"/").concat(gt.path||"websockify")),j=new W.a(fe.current,At,{credentials:{password:bt},wsProtocols:["binary"]}),we=oe(j),j.viewOnly=gt.view_only||!1,pe?j.scaleViewport=!0:j.scaleViewport=gt.scale||!1,j.scaleViewport=gt.scale||!0,j.resizeSession=!0,ge.current=j,j.addEventListener("disconnect",Be),j.addEventListener("connect",de),j.addEventListener("clipboard",Ce);case 16:case"end":return Nt.stop()}},st)})));var je=x.a.subscribe("vnc-reseting",function(){ke({type:Ze.SET_STATE,payload:{loading:!0,mes:"\u5B9E\u9A8C\u73AF\u5883\u91CD\u7F6E\u4E2D"}})}),ut=x.a.subscribe("vnc-enlarge",function(){ke({type:Ze.SET_IS_LARGE,payload:!0})}),tt=x.a.subscribe("show-clipboard-box",function(){ke({type:Ze.SHOW_CLIPBOARD_BOX,payload:!0})});return Re(0),function(){var st,gt,At,bt;(st=j)===null||st===void 0||st.removeEventListener("disconnect",Be),(gt=j)===null||gt===void 0||gt.removeEventListener("connect",de),(At=j)===null||At===void 0||At.removeEventListener("clipboard",Ce),je(),ut(),tt(),(bt=we)===null||bt===void 0||bt.unobserve(fe.current)}}},[Se,pe,Me]);function me(j){var we;(we=ge.current)===null||we===void 0||we.clipboardPasteFrom(j),ke({type:Ze.SET_TRANSFER_CONTENT,payload:j}),k.b.success("\u4FDD\u5B58\u6210\u529F\uFF01\u4F60\u53EF\u4EE5\u5728\u5B9E\u9A8C\u73AF\u5883\u4E2D\u7C98\u8D34\u8BE5\u5185\u5BB9"),be()}Object(h.useEffect)(function(){he==0&&Xe()},[he]);var Xe=function j(){he>99?he=99:(he=he+1,He=setTimeout(function(){j()},1500)),he<100&&Re(he)};return d.a.createElement(h.Fragment,null,d.a.createElement("div",{style:{backgroundColor:"#000"},className:"".concat(pe?"vnc-panel-wrapper-windows":"vnc-panel-wrapper"," ").concat(Je?"full-screen":"")},d.a.createElement("a",{className:"btn-vnc-resize",onClick:J},d.a.createElement("i",{className:"iconfont ".concat(Je?"icon-tuichuquanping1":"icon-quanping1")})),ae?d.a.createElement(g.a,{className:U.a.spin,message:_e,style:{color:"#0152d9"}},d.a.createElement("div",{className:"tc",style:{width:500,margin:"0 auto",color:"#FFF"}},d.a.createElement(w.a,{percent:he,format:function(we){return d.a.createElement("span",{className:"c-white"},we,"%")}}))):null,d.a.createElement("div",{ref:fe,className:"vnc-panel ".concat(ae?"hide":"animated fadeIn")})),d.a.createElement(O.a,null))},We=ee("m3rI"),ze=a.a.Countdown,Ae=function(Se){var pe,Ge,fe=Se.shixunsDetail,ge=Se.globalSetting,De=Se.loading,Ve=Se.dispatch,Qe=Se.user,ke=Se.history,Fe=Object(l.a)(Se,["shixunsDetail","globalSetting","loading","dispatch","user","history"]),Ne=Object(h.useState)({}),Me=Object(s.a)(Ne,2),ne=Me[0],_e=Me[1],ae=Object(h.useState)(400),Ie=Object(s.a)(ae,2),Je=Ie[0],et=Ie[1],Ke=Object(h.useState)(!1),it=Object(s.a)(Ke,2),he=it[0],Re=it[1],He=Object(h.useState)(""),Ee=Object(s.a)(He,2),ve=Ee[0],be=Ee[1],J=Object(h.useState)(Date.now()+1e3*60*60),oe=Object(s.a)(J,2),Z=oe[0],me=oe[1],Xe=Fe.match.params,j=Fe.location.query,we=Object(h.useState)(!1),Be=Object(s.a)(we,2),de=Be[0],Ce=Be[1],je=fe.mirrorApplies,ut=Object(h.useRef)();Object(h.useEffect)(function(){return Ve({type:"globalSetting/headerFooterToggle",payload:!1}),st(),gt(),window.addEventListener("resize",st),x.a.subscribe("delayed-time",function(){me(Date.now()+1e3*60*60)}),function(){window.removeEventListener("resize",st),clearTimeout(ut.current),Ve({type:"globalSetting/headerFooterToggle",payload:!0})}},[]),Object(h.useEffect)(function(){ne.host&&setTimeout(function(){x.a.publish("create-socket",1)},1500)},[ne]),Object(h.useEffect)(function(){je.webssh&&(tt(),ut.current=setTimeout(function(){u.a.confirm({title:d.a.createElement(d.a.Fragment,null,"\u5B9E\u9A8C\u73AF\u5883\u5EF6\u65F6\u63D0\u9192"),content:"\u5F53\u524D\u5B9E\u9A8C\u73AF\u5883\u5C06\u4E8E 15 \u5206\u949F\u540E\u5173\u95ED\uFF0C\u9700\u8981\u5EF6\u957F\u4F7F\u7528\u65F6\u95F4\u5417\uFF1F",okText:"\u7ACB\u5373\u5EF6\u957F",cancelText:"\u4E0D\u9700\u8981",onOk:function(){x.a.publish("ssh-add-connect-time",{}),x.a.publish("delayed-time",1)}})},1e3*60*60)),je.id&&st()},[je]);var tt=function(){var At=Object(c.a)(r.a.mark(function bt(){var ht;return r.a.wrap(function(Bt){for(;;)switch(Bt.prev=Bt.next){case 0:return Bt.next=2,Object(N.sb)(Object(p.a)({},Xe));case 2:ht=Bt.sent,_e(Object(p.a)({},ht));case 4:case"end":return Bt.stop()}},bt)}));return function(){return At.apply(this,arguments)}}(),st=function(){var bt=window.innerHeight;et(bt-(je.audit_remark?400:270))},gt=function(){var At=Object(c.a)(r.a.mark(function bt(){return r.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:Ve({type:"shixunsDetail/getMirrorApplies",payload:Object(p.a)({},Xe)});case 1:case"end":return Ot.stop()}},bt)}));return function(){return At.apply(this,arguments)}}();return console.log(Qe==null?void 0:Qe.userInfo),d.a.createElement("section",{className:U.a.wrp},d.a.createElement("header",{className:U.a.header},d.a.createElement(f.a,{align:"middle"},d.a.createElement(_.a,{flex:"1"},d.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"40",src:"".concat(We.a.IMG_SERVER,"/images/").concat(Qe==null||((pe=Qe.userInfo)===null||pe===void 0)?void 0:pe.image_url),width:"40",style:{borderRadius:"50%"}}),d.a.createElement("span",{className:"ml10"},Qe==null||((Ge=Qe.userInfo)===null||Ge===void 0)?void 0:Ge.real_name)),d.a.createElement(_.a,{flex:"1"},d.a.createElement("span",{className:"mr10 font18"},je.name)),d.a.createElement(_.a,null,d.a.createElement("span",null,"\u5269\u4F59\u65F6\u957F:",d.a.createElement(ze,{className:U.a.cuttDown,value:Z,format:"mm:ss",valueStyle:{color:"#FFF"}})),d.a.createElement("span",{className:"icon-kaiguan font20 current ml60",onClick:function(){u.a.confirm({title:"\u9000\u51FA\u955C\u50CF",content:"\u4F60\u786E\u5B9A\u8981\u9000\u51FA\u955C\u50CF\u5417\uFF1F",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var ht;ke.push("/users/".concat((ht=Qe.userInfo)===null||ht===void 0?void 0:ht.login,"/experiment-img"))}})}})))),d.a.createElement("aside",{className:U.a.container},d.a.createElement(f.a,null,d.a.createElement(_.a,{style:{position:"relative",width:de?"0%":"40%"}},d.a.createElement("section",{className:"".concat(U.a.info," ml40 mr40"),style:{display:de?"none":"flex"}},d.a.createElement("aside",null,d.a.createElement(f.a,{align:"middle",style:{height:68,borderBottom:"1px solid #f1f1f1"}},d.a.createElement(_.a,{className:"font18"},"\u5B9E\u9A8C\u73AF\u5883\u8BF4\u660E ",d.a.createElement("span",{className:"font16 ml20 c-grey-999"},"\u8BF7\u6309\u6A21\u677F\u586B\u5199\u5B9E\u9A8C\u73AF\u5883\u8BF4\u660E"))),d.a.createElement("aside",{className:"mt30 flex1"},d.a.createElement(C.a,{height:Je,defaultValue:je.description||"",onChange:function(bt){return be(bt)}}),je.audit_remark&&d.a.createElement("aside",{className:"mt10 font16 c-grey-999 mb10"},"\u5BA1\u6838\u4E0D\u901A\u8FC7\u539F\u56E0\uFF1A",d.a.createElement("span",{className:"c-red"},je.audit_remark))),d.a.createElement("aside",{className:"mb20"},d.a.createElement(f.a,{justify:"center",gutter:[20,20],className:U.a.buttons},d.a.createElement(_.a,null,d.a.createElement(L.a,{type:"primary",size:"large",loading:he,onClick:Object(c.a)(r.a.mark(function At(){var bt;return r.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Re(!0),u.a.info({title:"\u4FDD\u5B58\u955C\u50CF",centered:!0,content:"\u4E34\u65F6\u955C\u50CF\u7CFB\u7EDF\u9ED8\u8BA4\u53EA\u4FDD\u5B5830\u5929\uFF0C\u8FC7\u671F\u5C06\u4F1A\u81EA\u52A8\u6E05\u7406\u3002\u8BF7\u5C3D\u5FEB\u7533\u8BF7\u53D1\u5E03\u3002",okText:"\u6211\u77E5\u9053\u4E86",onOk:function(){}}),Ot.next=4,Object(N.ub)(Object(p.a)(Object(p.a)({},Xe),{},{description:ve}));case 4:bt=Ot.sent,(bt==null?void 0:bt.status)===0&&k.b.success("\u4FDD\u5B58\u6210\u529F"),Re(!1);case 7:case"end":return Ot.stop()}},At)}))},"\u4FDD\u5B58")),d.a.createElement(_.a,null,d.a.createElement(L.a,{type:"primary",ghost:!0,size:"large",onClick:Object(c.a)(r.a.mark(function At(){return r.a.wrap(function(ht){for(;;)switch(ht.prev=ht.next){case 0:u.a.confirm({title:"\u7533\u8BF7\u53D1\u5E03",centered:!0,content:"\u4F60\u786E\u5B9A\u8981\u7533\u8BF7\u53D1\u5E03\u8BE5\u955C\u50CF\uFF1F",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:function(){var Ot=Object(c.a)(r.a.mark(function mt(){var St,ft;return r.a.wrap(function(Pt){for(;;)switch(Pt.prev=Pt.next){case 0:return Pt.next=2,Object(N.tb)(Object(p.a)(Object(p.a)({},Xe),{},{description:ve}));case 2:St=Pt.sent,(St==null?void 0:St.status)===0&&(ke.push("/users/".concat((ft=Qe.userInfo)===null||ft===void 0?void 0:ft.login,"/experiment-img")),k.b.success("\u7533\u8BF7\u53D1\u5E03\u6210\u529F"));case 4:case"end":return Pt.stop()}},mt)}));function Bt(){return Ot.apply(this,arguments)}return Bt}()});case 1:case"end":return ht.stop()}},At)}))},"\u7533\u8BF7\u53D1\u5E03")))))),d.a.createElement("div",{className:de?U.a.elseShrink:U.a.shrink,onClick:function(){return Ce(!de)}},d.a.createElement("i",{className:"iconfont icon-cela"}))),d.a.createElement(_.a,{style:{background:"#000",width:de?"100%":"60%"}},d.a.createElement("div",null,d.a.createElement("aside",{className:U.a.fullBtn},d.a.createElement("span",{className:"icon-quanping"})),je.webssh&&d.a.createElement(T.a,{sshConfigData:ne,sid:1}),((je==null?void 0:je.vnc)||(je==null?void 0:je.windows))&&d.a.createElement(Oe,{taskId:je.type==="windows"?"pcf9t4w6vrnz":"ijby95c82nsh",vnc_url:je.vnc,window_vnc_url:je.windows}))))))},xe=se.default=Object(y.a)(function(le){var Se=le.shixunsDetail,pe=le.loading,Ge=le.user,fe=le.globalSetting;return{shixunsDetail:Se,globalSetting:fe,user:Ge,loading:pe.models.shixunsDetail}})(Ae)},iUHT:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;function z(m,C){if(!(m instanceof C))throw new TypeError("Cannot call a class as a function")}function L(m,C){for(var T=0;T<C.length;T++){var x=C[T];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(m,x.key,x)}}function D(m,C,T){return C&&L(m.prototype,C),T&&L(m,T),m}var k=[13,16,10,23,0,4,2,27,14,5,20,9,22,18,11,3,25,7,15,6,26,19,12,1,40,51,30,36,46,54,29,39,50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31],M=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],f=0,S,_,p,c,o,u;S=1<<16,_=1<<24,p=S|_,c=1<<2,o=1<<10,u=c|o;var s=[p|o,f|f,S|f,p|u,p|c,S|u,f|c,S|f,f|o,p|o,p|u,f|o,_|u,p|c,_|f,f|c,f|u,_|o,_|o,S|o,S|o,p|f,p|f,_|u,S|c,_|c,_|c,S|c,f|f,f|u,S|u,_|f,S|f,p|u,f|c,p|f,p|o,_|f,_|f,f|o,p|c,S|f,S|o,_|c,f|o,f|c,_|u,S|u,p|u,S|c,p|f,_|u,_|c,f|u,S|u,p|o,f|u,_|o,_|o,f|f,S|c,S|o,f|f,p|c];S=1<<20,_=1<<31,p=S|_,c=1<<5,o=1<<15,u=c|o;var l=[p|u,_|o,f|o,S|u,S|f,f|c,p|c,_|u,_|c,p|u,p|o,_|f,_|o,S|f,f|c,p|c,S|o,S|c,_|u,f|f,_|f,f|o,S|u,p|f,S|c,_|c,f|f,S|o,f|u,p|o,p|f,f|u,f|f,S|u,p|c,S|f,_|u,p|f,p|o,f|o,p|f,_|o,f|c,p|u,S|u,f|c,f|o,_|f,f|u,p|o,S|f,_|c,S|c,_|u,_|c,S|c,S|o,f|f,_|o,f|u,_|f,p|c,p|u,S|o];S=1<<17,_=1<<27,p=S|_,c=1<<3,o=1<<9,u=c|o;var t=[f|u,p|o,f|f,p|c,_|o,f|f,S|u,_|o,S|c,_|c,_|c,S|f,p|u,S|c,p|f,f|u,_|f,f|c,p|o,f|o,S|o,p|f,p|c,S|u,_|u,S|o,S|f,_|u,f|c,p|u,f|o,_|f,p|o,_|f,S|c,f|u,S|f,p|o,_|o,f|f,f|o,S|c,p|u,_|o,_|c,f|o,f|f,p|c,_|u,S|f,_|f,p|u,f|c,S|u,S|o,_|c,p|f,_|u,f|u,p|f,S|u,f|c,p|c,S|o];S=1<<13,_=1<<23,p=S|_,c=1<<0,o=1<<7,u=c|o;var a=[p|c,S|u,S|u,f|o,p|o,_|u,_|c,S|c,f|f,p|f,p|f,p|u,f|u,f|f,_|o,_|c,f|c,S|f,_|f,p|c,f|o,_|f,S|c,S|o,_|u,f|c,S|o,_|o,S|f,p|o,p|u,f|u,_|o,_|c,p|f,p|u,f|u,f|f,f|f,p|f,S|o,_|o,_|u,f|c,p|c,S|u,S|u,f|o,p|u,f|u,f|c,S|f,_|c,S|c,p|o,_|u,S|c,S|o,_|f,p|c,f|o,_|f,S|f,p|o];S=1<<25,_=1<<30,p=S|_,c=1<<8,o=1<<19,u=c|o;var i=[f|c,S|u,S|o,p|c,f|o,f|c,_|f,S|o,_|u,f|o,S|c,_|u,p|c,p|o,f|u,_|f,S|f,_|o,_|o,f|f,_|c,p|u,p|u,S|c,p|o,_|c,f|f,p|f,S|u,S|f,p|f,f|u,f|o,p|c,f|c,S|f,_|f,S|o,p|c,_|u,S|c,_|f,p|o,S|u,_|u,f|c,S|f,p|o,p|u,f|u,p|f,p|u,S|o,f|f,_|o,p|f,f|u,S|c,_|c,f|o,f|f,_|o,S|u,_|c];S=1<<22,_=1<<29,p=S|_,c=1<<4,o=1<<14,u=c|o;var r=[_|c,p|f,f|o,p|u,p|f,f|c,p|u,S|f,_|o,S|u,S|f,_|c,S|c,_|o,_|f,f|u,f|f,S|c,_|u,f|o,S|o,_|u,f|c,p|c,p|c,f|f,S|u,p|o,f|u,S|o,p|o,_|f,_|o,f|c,p|c,S|o,p|u,S|f,f|u,_|c,S|f,_|o,_|f,f|u,_|c,p|u,S|o,p|f,S|u,p|o,f|f,p|c,f|c,f|o,p|f,S|u,f|o,S|c,_|u,f|f,p|o,_|f,S|c,_|u];S=1<<21,_=1<<26,p=S|_,c=1<<1,o=1<<11,u=c|o;var h=[S|f,p|c,_|u,f|f,f|o,_|u,S|u,p|o,p|u,S|f,f|f,_|c,f|c,_|f,p|c,f|u,_|o,S|u,S|c,_|o,_|c,p|f,p|o,S|c,p|f,f|o,f|u,p|u,S|o,f|c,_|f,S|o,_|f,S|o,S|f,_|u,_|u,p|c,p|c,f|c,S|c,_|f,_|o,S|f,p|o,f|u,S|u,p|o,f|u,_|c,p|u,p|f,S|o,f|f,f|c,p|u,f|f,S|u,p|f,f|o,_|c,_|o,f|o,S|c];S=1<<18,_=1<<28,p=S|_,c=1<<6,o=1<<12,u=c|o;var d=[_|u,f|o,S|f,p|u,_|f,_|u,f|c,_|f,S|c,p|f,p|u,S|o,p|o,S|u,f|o,f|c,p|f,_|c,_|o,f|u,S|o,S|c,p|c,p|o,f|u,f|f,f|f,p|c,_|c,_|o,S|u,S|f,S|u,S|f,p|o,f|o,f|c,p|c,f|o,S|u,_|o,f|c,_|c,p|f,p|c,_|f,S|f,_|u,f|f,p|u,S|c,_|c,p|f,_|o,_|u,f|f,p|u,S|o,S|o,f|u,f|u,S|c,_|f,p|o],y=function(){function m(C){z(this,m),this.keys=[];for(var T=[],x=[],E=[],w=0,A=56;w<56;++w,A-=8){A+=A<-5?65:A<-3?31:A<-1?63:A===27?35:0;var g=A&7;T[w]=(C[A>>>3]&1<<g)!==0?1:0}for(var P=0;P<16;++P){var O=P<<1,F=O+1;E[O]=E[F]=0;for(var X=28;X<59;X+=28)for(var W=X-28;W<X;++W){var N=W+M[P];x[W]=N<X?T[N]:T[N-28]}for(var G=0;G<24;++G)x[k[G]]!==0&&(E[O]|=1<<23-G),x[k[G+24]]!==0&&(E[F]|=1<<23-G)}for(var U=0,H=0,V=0;U<16;++U){var ce=E[H++],ye=E[H++];this.keys[V]=(ce&16515072)<<6,this.keys[V]|=(ce&4032)<<10,this.keys[V]|=(ye&16515072)>>>10,this.keys[V]|=(ye&4032)>>>6,++V,this.keys[V]=(ce&258048)<<12,this.keys[V]|=(ce&63)<<16,this.keys[V]|=(ye&258048)>>>4,this.keys[V]|=ye&63,++V}}return D(m,[{key:"enc8",value:function(T){var x=T.slice(),E=0,w,A,g;w=x[E++]<<24|x[E++]<<16|x[E++]<<8|x[E++],A=x[E++]<<24|x[E++]<<16|x[E++]<<8|x[E++],g=(w>>>4^A)&252645135,A^=g,w^=g<<4,g=(w>>>16^A)&65535,A^=g,w^=g<<16,g=(A>>>2^w)&858993459,w^=g,A^=g<<2,g=(A>>>8^w)&16711935,w^=g,A^=g<<8,A=A<<1|A>>>31&1,g=(w^A)&2863311530,w^=g,A^=g,w=w<<1|w>>>31&1;for(var P=0,O=0;P<8;++P){g=A<<28|A>>>4,g^=this.keys[O++];var F=h[g&63];F|=i[g>>>8&63],F|=t[g>>>16&63],F|=s[g>>>24&63],g=A^this.keys[O++],F|=d[g&63],F|=r[g>>>8&63],F|=a[g>>>16&63],F|=l[g>>>24&63],w^=F,g=w<<28|w>>>4,g^=this.keys[O++],F=h[g&63],F|=i[g>>>8&63],F|=t[g>>>16&63],F|=s[g>>>24&63],g=w^this.keys[O++],F|=d[g&63],F|=r[g>>>8&63],F|=a[g>>>16&63],F|=l[g>>>24&63],A^=F}for(A=A<<31|A>>>1,g=(w^A)&2863311530,w^=g,A^=g,w=w<<31|w>>>1,g=(w>>>8^A)&16711935,A^=g,w^=g<<8,g=(w>>>2^A)&858993459,A^=g,w^=g<<2,g=(A>>>16^w)&65535,w^=g,A^=g<<16,g=(A>>>4^w)&252645135,w^=g,A^=g<<4,g=[A,w],E=0;E<8;E++)x[E]=(g[E>>>2]>>>8*(3-E%4))%256,x[E]<0&&(x[E]+=256);return x}},{key:"encrypt",value:function(T){return this.enc8(T.slice(0,8)).concat(this.enc8(T.slice(8,16)))}}]),m}();se.default=y},kSUc:function(ot,se,ee){},lNSK:function(ot,se,ee){"use strict";function z(j){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?z=function(Be){return typeof Be}:z=function(Be){return Be&&typeof Symbol=="function"&&Be.constructor===Symbol&&Be!==Symbol.prototype?"symbol":typeof Be},z(j)}Object.defineProperty(se,"__esModule",{value:!0}),se.deflateInit=J,se.deflateInit2=be,se.deflateReset=Ee,se.deflateResetKeep=He,se.deflateSetHeader=ve,se.deflate=oe,se.deflateEnd=Z,se.deflateSetDictionary=me,se.deflateInfo=se.Z_DEFLATED=se.Z_UNKNOWN=se.Z_DEFAULT_STRATEGY=se.Z_FIXED=se.Z_RLE=se.Z_HUFFMAN_ONLY=se.Z_FILTERED=se.Z_DEFAULT_COMPRESSION=se.Z_BUF_ERROR=se.Z_DATA_ERROR=se.Z_STREAM_ERROR=se.Z_STREAM_END=se.Z_OK=se.Z_BLOCK=se.Z_FINISH=se.Z_FULL_FLUSH=se.Z_PARTIAL_FLUSH=se.Z_NO_FLUSH=void 0;var L=p(ee("6BzB")),D=p(ee("c5fP")),k=S(ee("xlC8")),M=S(ee("QV2g")),f=S(ee("xSIq"));function S(j){return j&&j.__esModule?j:{default:j}}function _(){if(typeof WeakMap!="function")return null;var j=new WeakMap;return _=function(){return j},j}function p(j){if(j&&j.__esModule)return j;if(j===null||z(j)!=="object"&&typeof j!="function")return{default:j};var we=_();if(we&&we.has(j))return we.get(j);var Be={},de=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Ce in j)if(Object.prototype.hasOwnProperty.call(j,Ce)){var je=de?Object.getOwnPropertyDescriptor(j,Ce):null;je&&(je.get||je.set)?Object.defineProperty(Be,Ce,je):Be[Ce]=j[Ce]}return Be.default=j,we&&we.set(j,Be),Be}var c=0;se.Z_NO_FLUSH=c;var o=1;se.Z_PARTIAL_FLUSH=o;var u=3;se.Z_FULL_FLUSH=u;var s=4;se.Z_FINISH=s;var l=5;se.Z_BLOCK=l;var t=0;se.Z_OK=t;var a=1;se.Z_STREAM_END=a;var i=-2;se.Z_STREAM_ERROR=i;var r=-3;se.Z_DATA_ERROR=r;var h=-5;se.Z_BUF_ERROR=h;var d=-1;se.Z_DEFAULT_COMPRESSION=d;var y=1;se.Z_FILTERED=y;var m=2;se.Z_HUFFMAN_ONLY=m;var C=3;se.Z_RLE=C;var T=4;se.Z_FIXED=T;var x=0;se.Z_DEFAULT_STRATEGY=x;var E=2;se.Z_UNKNOWN=E;var w=8;se.Z_DEFLATED=w;var A=9,g=15,P=8,O=29,F=256,X=F+1+O,W=30,N=19,G=2*X+1,U=15,H=3,V=258,ce=V+H+1,ye=32,Le=42,Ze=69,Ye=73,Oe=91,We=103,ze=113,Ae=666,xe=1,le=2,Se=3,pe=4,Ge=3;function fe(j,we){return j.msg=f.default[we],we}function ge(j){return(j<<1)-(j>4?9:0)}function De(j){for(var we=j.length;--we>=0;)j[we]=0}function Ve(j){var we=j.state,Be=we.pending;if(Be>j.avail_out&&(Be=j.avail_out),Be===0)return;L.arraySet(j.output,we.pending_buf,we.pending_out,Be,j.next_out),j.next_out+=Be,we.pending_out+=Be,j.total_out+=Be,j.avail_out-=Be,we.pending-=Be,we.pending===0&&(we.pending_out=0)}function Qe(j,we){D._tr_flush_block(j,j.block_start>=0?j.block_start:-1,j.strstart-j.block_start,we),j.block_start=j.strstart,Ve(j.strm)}function ke(j,we){j.pending_buf[j.pending++]=we}function Fe(j,we){j.pending_buf[j.pending++]=we>>>8&255,j.pending_buf[j.pending++]=we&255}function Ne(j,we,Be,de){var Ce=j.avail_in;return Ce>de&&(Ce=de),Ce===0?0:(j.avail_in-=Ce,L.arraySet(we,j.input,j.next_in,Ce,Be),j.state.wrap===1?j.adler=(0,k.default)(j.adler,we,Ce,Be):j.state.wrap===2&&(j.adler=(0,M.default)(j.adler,we,Ce,Be)),j.next_in+=Ce,j.total_in+=Ce,Ce)}function Me(j,we){var Be=j.max_chain_length,de=j.strstart,Ce,je,ut=j.prev_length,tt=j.nice_match,st=j.strstart>j.w_size-ce?j.strstart-(j.w_size-ce):0,gt=j.window,At=j.w_mask,bt=j.prev,ht=j.strstart+V,Ot=gt[de+ut-1],Bt=gt[de+ut];j.prev_length>=j.good_match&&(Be>>=2),tt>j.lookahead&&(tt=j.lookahead);do{if(Ce=we,gt[Ce+ut]!==Bt||gt[Ce+ut-1]!==Ot||gt[Ce]!==gt[de]||gt[++Ce]!==gt[de+1])continue;de+=2,Ce++;do;while(gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&gt[++de]===gt[++Ce]&&de<ht);if(je=V-(ht-de),de=ht-V,je>ut){if(j.match_start=we,ut=je,je>=tt)break;Ot=gt[de+ut-1],Bt=gt[de+ut]}}while((we=bt[we&At])>st&&--Be!==0);return ut<=j.lookahead?ut:j.lookahead}function ne(j){var we=j.w_size,Be,de,Ce,je,ut;do{if(je=j.window_size-j.lookahead-j.strstart,j.strstart>=we+(we-ce)){L.arraySet(j.window,j.window,we,we,0),j.match_start-=we,j.strstart-=we,j.block_start-=we,de=j.hash_size,Be=de;do Ce=j.head[--Be],j.head[Be]=Ce>=we?Ce-we:0;while(--de);de=we,Be=de;do Ce=j.prev[--Be],j.prev[Be]=Ce>=we?Ce-we:0;while(--de);je+=we}if(j.strm.avail_in===0)break;if(de=Ne(j.strm,j.window,j.strstart+j.lookahead,je),j.lookahead+=de,j.lookahead+j.insert>=H)for(ut=j.strstart-j.insert,j.ins_h=j.window[ut],j.ins_h=(j.ins_h<<j.hash_shift^j.window[ut+1])&j.hash_mask;j.insert&&!(j.ins_h=(j.ins_h<<j.hash_shift^j.window[ut+H-1])&j.hash_mask,j.prev[ut&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=ut,ut++,j.insert--,j.lookahead+j.insert<H););}while(j.lookahead<ce&&j.strm.avail_in!==0)}function _e(j,we){var Be=65535;for(Be>j.pending_buf_size-5&&(Be=j.pending_buf_size-5);;){if(j.lookahead<=1){if(ne(j),j.lookahead===0&&we===c)return xe;if(j.lookahead===0)break}j.strstart+=j.lookahead,j.lookahead=0;var de=j.block_start+Be;if((j.strstart===0||j.strstart>=de)&&(j.lookahead=j.strstart-de,j.strstart=de,Qe(j,!1),j.strm.avail_out===0))return xe;if(j.strstart-j.block_start>=j.w_size-ce&&(Qe(j,!1),j.strm.avail_out===0))return xe}return j.insert=0,we===s?(Qe(j,!0),j.strm.avail_out===0?Se:pe):(j.strstart>j.block_start&&(Qe(j,!1),j.strm.avail_out===0),xe)}function ae(j,we){for(var Be,de;;){if(j.lookahead<ce){if(ne(j),j.lookahead<ce&&we===c)return xe;if(j.lookahead===0)break}if(Be=0,j.lookahead>=H&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+H-1])&j.hash_mask,Be=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),Be!==0&&j.strstart-Be<=j.w_size-ce&&(j.match_length=Me(j,Be)),j.match_length>=H)if(de=D._tr_tally(j,j.strstart-j.match_start,j.match_length-H),j.lookahead-=j.match_length,j.match_length<=j.max_lazy_match&&j.lookahead>=H){j.match_length--;do j.strstart++,j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+H-1])&j.hash_mask,Be=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart;while(--j.match_length!==0);j.strstart++}else j.strstart+=j.match_length,j.match_length=0,j.ins_h=j.window[j.strstart],j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+1])&j.hash_mask;else de=D._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++;if(de&&(Qe(j,!1),j.strm.avail_out===0))return xe}return j.insert=j.strstart<H-1?j.strstart:H-1,we===s?(Qe(j,!0),j.strm.avail_out===0?Se:pe):j.last_lit&&(Qe(j,!1),j.strm.avail_out===0)?xe:le}function Ie(j,we){for(var Be,de,Ce;;){if(j.lookahead<ce){if(ne(j),j.lookahead<ce&&we===c)return xe;if(j.lookahead===0)break}if(Be=0,j.lookahead>=H&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+H-1])&j.hash_mask,Be=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart),j.prev_length=j.match_length,j.prev_match=j.match_start,j.match_length=H-1,Be!==0&&j.prev_length<j.max_lazy_match&&j.strstart-Be<=j.w_size-ce&&(j.match_length=Me(j,Be),j.match_length<=5&&(j.strategy===y||j.match_length===H&&j.strstart-j.match_start>4096)&&(j.match_length=H-1)),j.prev_length>=H&&j.match_length<=j.prev_length){Ce=j.strstart+j.lookahead-H,de=D._tr_tally(j,j.strstart-1-j.prev_match,j.prev_length-H),j.lookahead-=j.prev_length-1,j.prev_length-=2;do++j.strstart<=Ce&&(j.ins_h=(j.ins_h<<j.hash_shift^j.window[j.strstart+H-1])&j.hash_mask,Be=j.prev[j.strstart&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=j.strstart);while(--j.prev_length!==0);if(j.match_available=0,j.match_length=H-1,j.strstart++,de&&(Qe(j,!1),j.strm.avail_out===0))return xe}else if(j.match_available){if(de=D._tr_tally(j,0,j.window[j.strstart-1]),de&&Qe(j,!1),j.strstart++,j.lookahead--,j.strm.avail_out===0)return xe}else j.match_available=1,j.strstart++,j.lookahead--}return j.match_available&&(de=D._tr_tally(j,0,j.window[j.strstart-1]),j.match_available=0),j.insert=j.strstart<H-1?j.strstart:H-1,we===s?(Qe(j,!0),j.strm.avail_out===0?Se:pe):j.last_lit&&(Qe(j,!1),j.strm.avail_out===0)?xe:le}function Je(j,we){for(var Be,de,Ce,je,ut=j.window;;){if(j.lookahead<=V){if(ne(j),j.lookahead<=V&&we===c)return xe;if(j.lookahead===0)break}if(j.match_length=0,j.lookahead>=H&&j.strstart>0&&(Ce=j.strstart-1,de=ut[Ce],de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce])){je=j.strstart+V;do;while(de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&de===ut[++Ce]&&Ce<je);j.match_length=V-(je-Ce),j.match_length>j.lookahead&&(j.match_length=j.lookahead)}if(j.match_length>=H?(Be=D._tr_tally(j,1,j.match_length-H),j.lookahead-=j.match_length,j.strstart+=j.match_length,j.match_length=0):(Be=D._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++),Be&&(Qe(j,!1),j.strm.avail_out===0))return xe}return j.insert=0,we===s?(Qe(j,!0),j.strm.avail_out===0?Se:pe):j.last_lit&&(Qe(j,!1),j.strm.avail_out===0)?xe:le}function et(j,we){for(var Be;;){if(j.lookahead===0&&(ne(j),j.lookahead===0)){if(we===c)return xe;break}if(j.match_length=0,Be=D._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++,Be&&(Qe(j,!1),j.strm.avail_out===0))return xe}return j.insert=0,we===s?(Qe(j,!0),j.strm.avail_out===0?Se:pe):j.last_lit&&(Qe(j,!1),j.strm.avail_out===0)?xe:le}function Ke(j,we,Be,de,Ce){this.good_length=j,this.max_lazy=we,this.nice_length=Be,this.max_chain=de,this.func=Ce}var it;it=[new Ke(0,0,0,0,_e),new Ke(4,4,8,4,ae),new Ke(4,5,16,8,ae),new Ke(4,6,32,32,ae),new Ke(4,4,16,16,Ie),new Ke(8,16,32,32,Ie),new Ke(8,16,128,128,Ie),new Ke(8,32,128,256,Ie),new Ke(32,128,258,1024,Ie),new Ke(32,258,258,4096,Ie)];function he(j){j.window_size=2*j.w_size,De(j.head),j.max_lazy_match=it[j.level].max_lazy,j.good_match=it[j.level].good_length,j.nice_match=it[j.level].nice_length,j.max_chain_length=it[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=H-1,j.match_available=0,j.ins_h=0}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=w,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new L.Buf16(G*2),this.dyn_dtree=new L.Buf16((2*W+1)*2),this.bl_tree=new L.Buf16((2*N+1)*2),De(this.dyn_ltree),De(this.dyn_dtree),De(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new L.Buf16(U+1),this.heap=new L.Buf16(2*X+1),De(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new L.Buf16(2*X+1),De(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function He(j){var we;return!j||!j.state?fe(j,i):(j.total_in=j.total_out=0,j.data_type=E,we=j.state,we.pending=0,we.pending_out=0,we.wrap<0&&(we.wrap=-we.wrap),we.status=we.wrap?Le:ze,j.adler=we.wrap===2?0:1,we.last_flush=c,D._tr_init(we),t)}function Ee(j){var we=He(j);return we===t&&he(j.state),we}function ve(j,we){return!j||!j.state||j.state.wrap!==2?i:(j.state.gzhead=we,t)}function be(j,we,Be,de,Ce,je){if(!j)return i;var ut=1;if(we===d&&(we=6),de<0?(ut=0,de=-de):de>15&&(ut=2,de-=16),Ce<1||Ce>A||Be!==w||de<8||de>15||we<0||we>9||je<0||je>T)return fe(j,i);de===8&&(de=9);var tt=new Re;return j.state=tt,tt.strm=j,tt.wrap=ut,tt.gzhead=null,tt.w_bits=de,tt.w_size=1<<tt.w_bits,tt.w_mask=tt.w_size-1,tt.hash_bits=Ce+7,tt.hash_size=1<<tt.hash_bits,tt.hash_mask=tt.hash_size-1,tt.hash_shift=~~((tt.hash_bits+H-1)/H),tt.window=new L.Buf8(tt.w_size*2),tt.head=new L.Buf16(tt.hash_size),tt.prev=new L.Buf16(tt.w_size),tt.lit_bufsize=1<<Ce+6,tt.pending_buf_size=tt.lit_bufsize*4,tt.pending_buf=new L.Buf8(tt.pending_buf_size),tt.d_buf=1*tt.lit_bufsize,tt.l_buf=(1+2)*tt.lit_bufsize,tt.level=we,tt.strategy=je,tt.method=Be,Ee(j)}function J(j,we){return be(j,we,w,g,P,x)}function oe(j,we){var Be,de,Ce,je;if(!j||!j.state||we>l||we<0)return j?fe(j,i):i;if(de=j.state,!j.output||!j.input&&j.avail_in!==0||de.status===Ae&&we!==s)return fe(j,j.avail_out===0?h:i);if(de.strm=j,Be=de.last_flush,de.last_flush=we,de.status===Le)if(de.wrap===2)j.adler=0,ke(de,31),ke(de,139),ke(de,8),de.gzhead?(ke(de,(de.gzhead.text?1:0)+(de.gzhead.hcrc?2:0)+(de.gzhead.extra?4:0)+(de.gzhead.name?8:0)+(de.gzhead.comment?16:0)),ke(de,de.gzhead.time&255),ke(de,de.gzhead.time>>8&255),ke(de,de.gzhead.time>>16&255),ke(de,de.gzhead.time>>24&255),ke(de,de.level===9?2:de.strategy>=m||de.level<2?4:0),ke(de,de.gzhead.os&255),de.gzhead.extra&&de.gzhead.extra.length&&(ke(de,de.gzhead.extra.length&255),ke(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=Ze):(ke(de,0),ke(de,0),ke(de,0),ke(de,0),ke(de,0),ke(de,de.level===9?2:de.strategy>=m||de.level<2?4:0),ke(de,Ge),de.status=ze);else{var ut=w+(de.w_bits-8<<4)<<8,tt=-1;de.strategy>=m||de.level<2?tt=0:de.level<6?tt=1:de.level===6?tt=2:tt=3,ut|=tt<<6,de.strstart!==0&&(ut|=ye),ut+=31-ut%31,de.status=ze,Fe(de,ut),de.strstart!==0&&(Fe(de,j.adler>>>16),Fe(de,j.adler&65535)),j.adler=1}if(de.status===Ze)if(de.gzhead.extra){for(Ce=de.pending;de.gzindex<(de.gzhead.extra.length&65535)&&!(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),Ve(j),Ce=de.pending,de.pending===de.pending_buf_size));)ke(de,de.gzhead.extra[de.gzindex]&255),de.gzindex++;de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=Ye)}else de.status=Ye;if(de.status===Ye)if(de.gzhead.name){Ce=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),Ve(j),Ce=de.pending,de.pending===de.pending_buf_size)){je=1;break}de.gzindex<de.gzhead.name.length?je=de.gzhead.name.charCodeAt(de.gzindex++)&255:je=0,ke(de,je)}while(je!==0);de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),je===0&&(de.gzindex=0,de.status=Oe)}else de.status=Oe;if(de.status===Oe)if(de.gzhead.comment){Ce=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),Ve(j),Ce=de.pending,de.pending===de.pending_buf_size)){je=1;break}de.gzindex<de.gzhead.comment.length?je=de.gzhead.comment.charCodeAt(de.gzindex++)&255:je=0,ke(de,je)}while(je!==0);de.gzhead.hcrc&&de.pending>Ce&&(j.adler=(0,M.default)(j.adler,de.pending_buf,de.pending-Ce,Ce)),je===0&&(de.status=We)}else de.status=We;if(de.status===We&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&Ve(j),de.pending+2<=de.pending_buf_size&&(ke(de,j.adler&255),ke(de,j.adler>>8&255),j.adler=0,de.status=ze)):de.status=ze),de.pending!==0){if(Ve(j),j.avail_out===0)return de.last_flush=-1,t}else if(j.avail_in===0&&ge(we)<=ge(Be)&&we!==s)return fe(j,h);if(de.status===Ae&&j.avail_in!==0)return fe(j,h);if(j.avail_in!==0||de.lookahead!==0||we!==c&&de.status!==Ae){var st=de.strategy===m?et(de,we):de.strategy===C?Je(de,we):it[de.level].func(de,we);if((st===Se||st===pe)&&(de.status=Ae),st===xe||st===Se)return j.avail_out===0&&(de.last_flush=-1),t;if(st===le&&(we===o?D._tr_align(de):we!==l&&(D._tr_stored_block(de,0,0,!1),we===u&&(De(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),Ve(j),j.avail_out===0))return de.last_flush=-1,t}return we!==s?t:de.wrap<=0?a:(de.wrap===2?(ke(de,j.adler&255),ke(de,j.adler>>8&255),ke(de,j.adler>>16&255),ke(de,j.adler>>24&255),ke(de,j.total_in&255),ke(de,j.total_in>>8&255),ke(de,j.total_in>>16&255),ke(de,j.total_in>>24&255)):(Fe(de,j.adler>>>16),Fe(de,j.adler&65535)),Ve(j),de.wrap>0&&(de.wrap=-de.wrap),de.pending!==0?t:a)}function Z(j){var we;return!j||!j.state?i:(we=j.state.status,we!==Le&&we!==Ze&&we!==Ye&&we!==Oe&&we!==We&&we!==ze&&we!==Ae?fe(j,i):(j.state=null,we===ze?fe(j,r):t))}function me(j,we){var Be=we.length,de,Ce,je,ut,tt,st,gt,At;if(!j||!j.state)return i;if(de=j.state,ut=de.wrap,ut===2||ut===1&&de.status!==Le||de.lookahead)return i;for(ut===1&&(j.adler=(0,k.default)(j.adler,we,Be,0)),de.wrap=0,Be>=de.w_size&&(ut===0&&(De(de.head),de.strstart=0,de.block_start=0,de.insert=0),At=new L.Buf8(de.w_size),L.arraySet(At,we,Be-de.w_size,de.w_size,0),we=At,Be=de.w_size),tt=j.avail_in,st=j.next_in,gt=j.input,j.avail_in=Be,j.next_in=0,j.input=we,ne(de);de.lookahead>=H;){Ce=de.strstart,je=de.lookahead-(H-1);do de.ins_h=(de.ins_h<<de.hash_shift^de.window[Ce+H-1])&de.hash_mask,de.prev[Ce&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=Ce,Ce++;while(--je);de.strstart=Ce,de.lookahead=H-1,ne(de)}return de.strstart+=de.lookahead,de.block_start=de.strstart,de.insert=de.lookahead,de.lookahead=0,de.match_length=de.prev_length=H-1,de.match_available=0,j.next_in=st,j.input=gt,j.avail_in=tt,de.wrap=ut,t}var Xe="pako deflate (from Nodeca project)";se.deflateInfo=Xe},lZu9:function(ot,se,ee){(function(z){z(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(z){"use strict";z.defineMode("markdown",function(L,D){var k=z.getMode(L,"text/html"),M=k.name=="null";function f(U){if(z.findModeByName){var H=z.findModeByName(U);H&&(U=H.mime||H.mimes[0])}var V=z.getMode(L,U);return V.name=="null"?null:V}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var S={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 _ in S)S.hasOwnProperty(_)&&D.tokenTypeOverrides[_]&&(S[_]=D.tokenTypeOverrides[_]);var p=/^([*\-_])(?:\s*\1){2,}\s*$/,c=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,o=/^\[(x| )\](?=\s)/i,u=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,s=/^ {0,3}(?:\={1,}|-{2,})\s*$/,l=/^[^#!\[\]*_\\<>` "'(~:]+/,t=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,a=/^\s*\[[^\]]+?\]:.*$/,i=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,r=" ";function h(U,H,V){return H.f=H.inline=V,V(U,H)}function d(U,H,V){return H.f=H.block=V,V(U,H)}function y(U){return!U||!/\S/.test(U.string)}function m(U){if(U.linkTitle=!1,U.linkHref=!1,U.linkText=!1,U.em=!1,U.strong=!1,U.strikethrough=!1,U.quote=0,U.indentedCode=!1,U.f==T){var H=M;if(!H){var V=z.innerMode(k,U.htmlState);H=V.mode.name=="xml"&&V.state.tagStart===null&&!V.state.context&&V.state.tokenize.isInText}H&&(U.f=A,U.block=C,U.htmlState=null)}return U.trailingSpace=0,U.trailingSpaceNewLine=!1,U.prevLine=U.thisLine,U.thisLine={stream:null},null}function C(U,H){var V=U.column()===H.indentation,ce=y(H.prevLine.stream),ye=H.indentedCode,Le=H.prevLine.hr,Ze=H.list!==!1,Ye=(H.listStack[H.listStack.length-1]||0)+3;H.indentedCode=!1;var Oe=H.indentation;if(H.indentationDiff===null&&(H.indentationDiff=H.indentation,Ze)){for(H.list=null;Oe<H.listStack[H.listStack.length-1];)H.listStack.pop(),H.listStack.length?H.indentation=H.listStack[H.listStack.length-1]:H.list=!1;H.list!==!1&&(H.indentationDiff=Oe-H.listStack[H.listStack.length-1])}var We=!ce&&!Le&&!H.prevLine.header&&(!Ze||!ye)&&!H.prevLine.fencedCodeEnd,ze=(H.list===!1||Le||ce)&&H.indentation<=Ye&&U.match(p),Ae=null;if(H.indentationDiff>=4&&(ye||H.prevLine.fencedCodeEnd||H.prevLine.header||ce))return U.skipToEnd(),H.indentedCode=!0,S.code;if(U.eatSpace())return null;if(V&&H.indentation<=Ye&&(Ae=U.match(u))&&Ae[1].length<=6)return H.quote=0,H.header=Ae[1].length,H.thisLine.header=!0,D.highlightFormatting&&(H.formatting="header"),H.f=H.inline,E(H);if(H.indentation<=Ye&&U.eat(">"))return H.quote=V?1:H.quote+1,D.highlightFormatting&&(H.formatting="quote"),U.eatSpace(),E(H);if(!ze&&!H.setext&&V&&H.indentation<=Ye&&(Ae=U.match(c))){var xe=Ae[1]?"ol":"ul";return H.indentation=Oe+U.current().length,H.list=!0,H.quote=0,H.listStack.push(H.indentation),H.em=!1,H.strong=!1,H.code=!1,H.strikethrough=!1,D.taskLists&&U.match(o,!1)&&(H.taskList=!0),H.f=H.inline,D.highlightFormatting&&(H.formatting=["list","list-"+xe]),E(H)}else{if(V&&H.indentation<=Ye&&(Ae=U.match(t,!0)))return H.quote=0,H.fencedEndRE=new RegExp(Ae[1]+"+ *$"),H.localMode=D.fencedCodeBlockHighlighting&&f(Ae[2]||D.fencedCodeBlockDefaultMode),H.localMode&&(H.localState=z.startState(H.localMode)),H.f=H.block=x,D.highlightFormatting&&(H.formatting="code-block"),H.code=-1,E(H);if(H.setext||(!We||!Ze)&&!H.quote&&H.list===!1&&!H.code&&!ze&&!a.test(U.string)&&(Ae=U.lookAhead(1))&&(Ae=Ae.match(s)))return H.setext?(H.header=H.setext,H.setext=0,U.skipToEnd(),D.highlightFormatting&&(H.formatting="header")):(H.header=Ae[0].charAt(0)=="="?1:2,H.setext=H.header),H.thisLine.header=!0,H.f=H.inline,E(H);if(ze)return U.skipToEnd(),H.hr=!0,H.thisLine.hr=!0,S.hr;if(U.peek()==="[")return h(U,H,X)}return h(U,H,H.inline)}function T(U,H){var V=k.token(U,H.htmlState);if(!M){var ce=z.innerMode(k,H.htmlState);(ce.mode.name=="xml"&&ce.state.tagStart===null&&!ce.state.context&&ce.state.tokenize.isInText||H.md_inside&&U.current().indexOf(">")>-1)&&(H.f=A,H.block=C,H.htmlState=null)}return V}function x(U,H){var V=H.listStack[H.listStack.length-1]||0,ce=H.indentation<V,ye=V+3;if(H.fencedEndRE&&H.indentation<=ye&&(ce||U.match(H.fencedEndRE))){D.highlightFormatting&&(H.formatting="code-block");var Le;return ce||(Le=E(H)),H.localMode=H.localState=null,H.block=C,H.f=A,H.fencedEndRE=null,H.code=0,H.thisLine.fencedCodeEnd=!0,ce?d(U,H,H.block):Le}else return H.localMode?H.localMode.token(U,H.localState):(U.skipToEnd(),S.code)}function E(U){var H=[];if(U.formatting){H.push(S.formatting),typeof U.formatting=="string"&&(U.formatting=[U.formatting]);for(var V=0;V<U.formatting.length;V++)H.push(S.formatting+"-"+U.formatting[V]),U.formatting[V]==="header"&&H.push(S.formatting+"-"+U.formatting[V]+"-"+U.header),U.formatting[V]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?H.push(S.formatting+"-"+U.formatting[V]+"-"+U.quote):H.push("error"))}if(U.taskOpen)return H.push("meta"),H.length?H.join(" "):null;if(U.taskClosed)return H.push("property"),H.length?H.join(" "):null;if(U.linkHref?H.push(S.linkHref,"url"):(U.strong&&H.push(S.strong),U.em&&H.push(S.em),U.strikethrough&&H.push(S.strikethrough),U.emoji&&H.push(S.emoji),U.linkText&&H.push(S.linkText),U.code&&H.push(S.code),U.image&&H.push(S.image),U.imageAltText&&H.push(S.imageAltText,"link"),U.imageMarker&&H.push(S.imageMarker)),U.header&&H.push(S.header,S.header+"-"+U.header),U.quote&&(H.push(S.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?H.push(S.quote+"-"+U.quote):H.push(S.quote+"-"+D.maxBlockquoteDepth)),U.list!==!1){var ce=(U.listStack.length-1)%3;ce?ce===1?H.push(S.list2):H.push(S.list3):H.push(S.list1)}return U.trailingSpaceNewLine?H.push("trailing-space-new-line"):U.trailingSpace&&H.push("trailing-space-"+(U.trailingSpace%2?"a":"b")),H.length?H.join(" "):null}function w(U,H){return U.match(l,!0)?E(H):void 0}function A(U,H){var V=H.text(U,H);if(typeof V!="undefined")return V;if(H.list)return H.list=null,E(H);if(H.taskList){var ce=U.match(o,!0)[1]===" ";return ce?H.taskOpen=!0:H.taskClosed=!0,D.highlightFormatting&&(H.formatting="task"),H.taskList=!1,E(H)}if(H.taskOpen=!1,H.taskClosed=!1,H.header&&U.match(/^#+$/,!0))return D.highlightFormatting&&(H.formatting="header"),E(H);var ye=U.next();if(H.linkTitle){H.linkTitle=!1;var Le=ye;ye==="("&&(Le=")"),Le=(Le+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ze="^\\s*(?:[^"+Le+"\\\\]+|\\\\\\\\|\\\\.)"+Le;if(U.match(new RegExp(Ze),!0))return S.linkHref}if(ye==="`"){var Ye=H.formatting;D.highlightFormatting&&(H.formatting="code"),U.eatWhile("`");var Oe=U.current().length;if(H.code==0&&(!H.quote||Oe==1))return H.code=Oe,E(H);if(Oe==H.code){var We=E(H);return H.code=0,We}else return H.formatting=Ye,E(H)}else if(H.code)return E(H);if(ye==="\\"&&(U.next(),D.highlightFormatting)){var ze=E(H),Ae=S.formatting+"-escape";return ze?ze+" "+Ae:Ae}if(ye==="!"&&U.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return H.imageMarker=!0,H.image=!0,D.highlightFormatting&&(H.formatting="image"),E(H);if(ye==="["&&H.imageMarker&&U.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return H.imageMarker=!1,H.imageAltText=!0,D.highlightFormatting&&(H.formatting="image"),E(H);if(ye==="]"&&H.imageAltText){D.highlightFormatting&&(H.formatting="image");var ze=E(H);return H.imageAltText=!1,H.image=!1,H.inline=H.f=P,ze}if(ye==="["&&!H.image)return H.linkText&&U.match(/^.*?\]/)||(H.linkText=!0,D.highlightFormatting&&(H.formatting="link")),E(H);if(ye==="]"&&H.linkText){D.highlightFormatting&&(H.formatting="link");var ze=E(H);return H.linkText=!1,H.inline=H.f=U.match(/\(.*?\)| ?\[.*?\]/,!1)?P:A,ze}if(ye==="<"&&U.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){H.f=H.inline=g,D.highlightFormatting&&(H.formatting="link");var ze=E(H);return ze?ze+=" ":ze="",ze+S.linkInline}if(ye==="<"&&U.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){H.f=H.inline=g,D.highlightFormatting&&(H.formatting="link");var ze=E(H);return ze?ze+=" ":ze="",ze+S.linkEmail}if(D.xml&&ye==="<"&&U.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var xe=U.string.indexOf(">",U.pos);if(xe!=-1){var le=U.string.substring(U.start,xe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(le)&&(H.md_inside=!0)}return U.backUp(1),H.htmlState=z.startState(k),d(U,H,T)}if(D.xml&&ye==="<"&&U.match(/^\/\w*?>/))return H.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Se=1,pe=U.pos==1?" ":U.string.charAt(U.pos-2);Se<3&&U.eat(ye);)Se++;var Ge=U.peek()||" ",fe=!/\s/.test(Ge)&&(!i.test(Ge)||/\s/.test(pe)||i.test(pe)),ge=!/\s/.test(pe)&&(!i.test(pe)||/\s/.test(Ge)||i.test(Ge)),De=null,Ve=null;if(Se%2&&(!H.em&&fe&&(ye==="*"||!ge||i.test(pe))?De=!0:H.em==ye&&ge&&(ye==="*"||!fe||i.test(Ge))&&(De=!1)),Se>1&&(!H.strong&&fe&&(ye==="*"||!ge||i.test(pe))?Ve=!0:H.strong==ye&&ge&&(ye==="*"||!fe||i.test(Ge))&&(Ve=!1)),Ve!=null||De!=null){D.highlightFormatting&&(H.formatting=De==null?"strong":Ve==null?"em":"strong em"),De===!0&&(H.em=ye),Ve===!0&&(H.strong=ye);var We=E(H);return De===!1&&(H.em=!1),Ve===!1&&(H.strong=!1),We}}else if(ye===" "&&(U.eat("*")||U.eat("_"))){if(U.peek()===" ")return E(H);U.backUp(1)}if(D.strikethrough){if(ye==="~"&&U.eatWhile(ye)){if(H.strikethrough){D.highlightFormatting&&(H.formatting="strikethrough");var We=E(H);return H.strikethrough=!1,We}else if(U.match(/^[^\s]/,!1))return H.strikethrough=!0,D.highlightFormatting&&(H.formatting="strikethrough"),E(H)}else if(ye===" "&&U.match(/^~~/,!0)){if(U.peek()===" ")return E(H);U.backUp(2)}}if(D.emoji&&ye===":"&&U.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){H.emoji=!0,D.highlightFormatting&&(H.formatting="emoji");var Qe=E(H);return H.emoji=!1,Qe}return ye===" "&&(U.match(/^ +$/,!1)?H.trailingSpace++:H.trailingSpace&&(H.trailingSpaceNewLine=!0)),E(H)}function g(U,H){var V=U.next();if(V===">"){H.f=H.inline=A,D.highlightFormatting&&(H.formatting="link");var ce=E(H);return ce?ce+=" ":ce="",ce+S.linkInline}return U.match(/^[^>]+/,!0),S.linkInline}function P(U,H){if(U.eatSpace())return null;var V=U.next();return V==="("||V==="["?(H.f=H.inline=F(V==="("?")":"]"),D.highlightFormatting&&(H.formatting="link-string"),H.linkHref=!0,E(H)):"error"}var O={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function F(U){return function(H,V){var ce=H.next();if(ce===U){V.f=V.inline=A,D.highlightFormatting&&(V.formatting="link-string");var ye=E(V);return V.linkHref=!1,ye}return H.match(O[U]),V.linkHref=!0,E(V)}}function X(U,H){return U.match(/^([^\]\\]|\\.)*\]:/,!1)?(H.f=W,U.next(),D.highlightFormatting&&(H.formatting="link"),H.linkText=!0,E(H)):h(U,H,A)}function W(U,H){if(U.match(/^\]:/,!0)){H.f=H.inline=N,D.highlightFormatting&&(H.formatting="link");var V=E(H);return H.linkText=!1,V}return U.match(/^([^\]\\]|\\.)+/,!0),S.linkText}function N(U,H){return U.eatSpace()?null:(U.match(/^[^\s]+/,!0),U.peek()===void 0?H.linkTitle=!0:U.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),H.f=H.inline=A,S.linkHref+" url")}var G={startState:function(){return{f:C,prevLine:{stream:null},thisLine:{stream:null},block:C,htmlState:null,indentation:0,inline:A,text:w,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(U){return{f:U.f,prevLine:U.prevLine,thisLine:U.thisLine,block:U.block,htmlState:U.htmlState&&z.copyState(k,U.htmlState),indentation:U.indentation,localMode:U.localMode,localState:U.localMode?z.copyState(U.localMode,U.localState):null,inline:U.inline,text:U.text,formatting:!1,linkText:U.linkText,linkTitle:U.linkTitle,linkHref:U.linkHref,code:U.code,em:U.em,strong:U.strong,strikethrough:U.strikethrough,emoji:U.emoji,header:U.header,setext:U.setext,hr:U.hr,taskList:U.taskList,list:U.list,listStack:U.listStack.slice(0),quote:U.quote,indentedCode:U.indentedCode,trailingSpace:U.trailingSpace,trailingSpaceNewLine:U.trailingSpaceNewLine,md_inside:U.md_inside,fencedEndRE:U.fencedEndRE}},token:function(U,H){if(H.formatting=!1,U!=H.thisLine.stream){if(H.header=0,H.hr=!1,U.match(/^\s*$/,!0))return m(H),null;if(H.prevLine=H.thisLine,H.thisLine={stream:U},H.taskList=!1,H.trailingSpace=0,H.trailingSpaceNewLine=!1,!H.localState&&(H.f=H.block,H.f!=T)){var V=U.match(/^\s*/,!0)[0].replace(/\t/g,r).length;if(H.indentation=V,H.indentationDiff=null,V>0)return null}}return H.f(U,H)},innerMode:function(U){return U.block==T?{state:U.htmlState,mode:k}:U.localState?{state:U.localState,mode:U.localMode}:{state:U,mode:G}},indent:function(U,H,V){return U.block==T&&k.indent?k.indent(U.htmlState,H,V):U.localState&&U.localMode.indent?U.localMode.indent(U.localState,H,V):z.Pass},blankLine:m,getType:E,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return G},"xml"),z.defineMIME("text/markdown","markdown"),z.defineMIME("text/x-markdown","markdown")})},mHUz:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={XK_VoidSymbol:16777215,XK_BackSpace:65288,XK_Tab:65289,XK_Linefeed:65290,XK_Clear:65291,XK_Return:65293,XK_Pause:65299,XK_Scroll_Lock:65300,XK_Sys_Req:65301,XK_Escape:65307,XK_Delete:65535,XK_Multi_key:65312,XK_Codeinput:65335,XK_SingleCandidate:65340,XK_MultipleCandidate:65341,XK_PreviousCandidate:65342,XK_Kanji:65313,XK_Muhenkan:65314,XK_Henkan_Mode:65315,XK_Henkan:65315,XK_Romaji:65316,XK_Hiragana:65317,XK_Katakana:65318,XK_Hiragana_Katakana:65319,XK_Zenkaku:65320,XK_Hankaku:65321,XK_Zenkaku_Hankaku:65322,XK_Touroku:65323,XK_Massyo:65324,XK_Kana_Lock:65325,XK_Kana_Shift:65326,XK_Eisu_Shift:65327,XK_Eisu_toggle:65328,XK_Kanji_Bangou:65335,XK_Zen_Koho:65341,XK_Mae_Koho:65342,XK_Home:65360,XK_Left:65361,XK_Up:65362,XK_Right:65363,XK_Down:65364,XK_Prior:65365,XK_Page_Up:65365,XK_Next:65366,XK_Page_Down:65366,XK_End:65367,XK_Begin:65368,XK_Select:65376,XK_Print:65377,XK_Execute:65378,XK_Insert:65379,XK_Undo:65381,XK_Redo:65382,XK_Menu:65383,XK_Find:65384,XK_Cancel:65385,XK_Help:65386,XK_Break:65387,XK_Mode_switch:65406,XK_script_switch:65406,XK_Num_Lock:65407,XK_KP_Space:65408,XK_KP_Tab:65417,XK_KP_Enter:65421,XK_KP_F1:65425,XK_KP_F2:65426,XK_KP_F3:65427,XK_KP_F4:65428,XK_KP_Home:65429,XK_KP_Left:65430,XK_KP_Up:65431,XK_KP_Right:65432,XK_KP_Down:65433,XK_KP_Prior:65434,XK_KP_Page_Up:65434,XK_KP_Next:65435,XK_KP_Page_Down:65435,XK_KP_End:65436,XK_KP_Begin:65437,XK_KP_Insert:65438,XK_KP_Delete:65439,XK_KP_Equal:65469,XK_KP_Multiply:65450,XK_KP_Add:65451,XK_KP_Separator:65452,XK_KP_Subtract:65453,XK_KP_Decimal:65454,XK_KP_Divide:65455,XK_KP_0:65456,XK_KP_1:65457,XK_KP_2:65458,XK_KP_3:65459,XK_KP_4:65460,XK_KP_5:65461,XK_KP_6:65462,XK_KP_7:65463,XK_KP_8:65464,XK_KP_9:65465,XK_F1:65470,XK_F2:65471,XK_F3:65472,XK_F4:65473,XK_F5:65474,XK_F6:65475,XK_F7:65476,XK_F8:65477,XK_F9:65478,XK_F10:65479,XK_F11:65480,XK_L1:65480,XK_F12:65481,XK_L2:65481,XK_F13:65482,XK_L3:65482,XK_F14:65483,XK_L4:65483,XK_F15:65484,XK_L5:65484,XK_F16:65485,XK_L6:65485,XK_F17:65486,XK_L7:65486,XK_F18:65487,XK_L8:65487,XK_F19:65488,XK_L9:65488,XK_F20:65489,XK_L10:65489,XK_F21:65490,XK_R1:65490,XK_F22:65491,XK_R2:65491,XK_F23:65492,XK_R3:65492,XK_F24:65493,XK_R4:65493,XK_F25:65494,XK_R5:65494,XK_F26:65495,XK_R6:65495,XK_F27:65496,XK_R7:65496,XK_F28:65497,XK_R8:65497,XK_F29:65498,XK_R9:65498,XK_F30:65499,XK_R10:65499,XK_F31:65500,XK_R11:65500,XK_F32:65501,XK_R12:65501,XK_F33:65502,XK_R13:65502,XK_F34:65503,XK_R14:65503,XK_F35:65504,XK_R15:65504,XK_Shift_L:65505,XK_Shift_R:65506,XK_Control_L:65507,XK_Control_R:65508,XK_Caps_Lock:65509,XK_Shift_Lock:65510,XK_Meta_L:65511,XK_Meta_R:65512,XK_Alt_L:65513,XK_Alt_R:65514,XK_Super_L:65515,XK_Super_R:65516,XK_Hyper_L:65517,XK_Hyper_R:65518,XK_ISO_Level3_Shift:65027,XK_ISO_Next_Group:65032,XK_ISO_Prev_Group:65034,XK_ISO_First_Group:65036,XK_ISO_Last_Group:65038,XK_space:32,XK_exclam:33,XK_quotedbl:34,XK_numbersign:35,XK_dollar:36,XK_percent:37,XK_ampersand:38,XK_apostrophe:39,XK_quoteright:39,XK_parenleft:40,XK_parenright:41,XK_asterisk:42,XK_plus:43,XK_comma:44,XK_minus:45,XK_period:46,XK_slash:47,XK_0:48,XK_1:49,XK_2:50,XK_3:51,XK_4:52,XK_5:53,XK_6:54,XK_7:55,XK_8:56,XK_9:57,XK_colon:58,XK_semicolon:59,XK_less:60,XK_equal:61,XK_greater:62,XK_question:63,XK_at:64,XK_A:65,XK_B:66,XK_C:67,XK_D:68,XK_E:69,XK_F:70,XK_G:71,XK_H:72,XK_I:73,XK_J:74,XK_K:75,XK_L:76,XK_M:77,XK_N:78,XK_O:79,XK_P:80,XK_Q:81,XK_R:82,XK_S:83,XK_T:84,XK_U:85,XK_V:86,XK_W:87,XK_X:88,XK_Y:89,XK_Z:90,XK_bracketleft:91,XK_backslash:92,XK_bracketright:93,XK_asciicircum:94,XK_underscore:95,XK_grave:96,XK_quoteleft:96,XK_a:97,XK_b:98,XK_c:99,XK_d:100,XK_e:101,XK_f:102,XK_g:103,XK_h:104,XK_i:105,XK_j:106,XK_k:107,XK_l:108,XK_m:109,XK_n:110,XK_o:111,XK_p:112,XK_q:113,XK_r:114,XK_s:115,XK_t:116,XK_u:117,XK_v:118,XK_w:119,XK_x:120,XK_y:121,XK_z:122,XK_braceleft:123,XK_bar:124,XK_braceright:125,XK_asciitilde:126,XK_nobreakspace:160,XK_exclamdown:161,XK_cent:162,XK_sterling:163,XK_currency:164,XK_yen:165,XK_brokenbar:166,XK_section:167,XK_diaeresis:168,XK_copyright:169,XK_ordfeminine:170,XK_guillemotleft:171,XK_notsign:172,XK_hyphen:173,XK_registered:174,XK_macron:175,XK_degree:176,XK_plusminus:177,XK_twosuperior:178,XK_threesuperior:179,XK_acute:180,XK_mu:181,XK_paragraph:182,XK_periodcentered:183,XK_cedilla:184,XK_onesuperior:185,XK_masculine:186,XK_guillemotright:187,XK_onequarter:188,XK_onehalf:189,XK_threequarters:190,XK_questiondown:191,XK_Agrave:192,XK_Aacute:193,XK_Acircumflex:194,XK_Atilde:195,XK_Adiaeresis:196,XK_Aring:197,XK_AE:198,XK_Ccedilla:199,XK_Egrave:200,XK_Eacute:201,XK_Ecircumflex:202,XK_Ediaeresis:203,XK_Igrave:204,XK_Iacute:205,XK_Icircumflex:206,XK_Idiaeresis:207,XK_ETH:208,XK_Eth:208,XK_Ntilde:209,XK_Ograve:210,XK_Oacute:211,XK_Ocircumflex:212,XK_Otilde:213,XK_Odiaeresis:214,XK_multiply:215,XK_Oslash:216,XK_Ooblique:216,XK_Ugrave:217,XK_Uacute:218,XK_Ucircumflex:219,XK_Udiaeresis:220,XK_Yacute:221,XK_THORN:222,XK_Thorn:222,XK_ssharp:223,XK_agrave:224,XK_aacute:225,XK_acircumflex:226,XK_atilde:227,XK_adiaeresis:228,XK_aring:229,XK_ae:230,XK_ccedilla:231,XK_egrave:232,XK_eacute:233,XK_ecircumflex:234,XK_ediaeresis:235,XK_igrave:236,XK_iacute:237,XK_icircumflex:238,XK_idiaeresis:239,XK_eth:240,XK_ntilde:241,XK_ograve:242,XK_oacute:243,XK_ocircumflex:244,XK_otilde:245,XK_odiaeresis:246,XK_division:247,XK_oslash:248,XK_ooblique:248,XK_ugrave:249,XK_uacute:250,XK_ucircumflex:251,XK_udiaeresis:252,XK_yacute:253,XK_thorn:254,XK_ydiaeresis:255,XK_Hangul:65329,XK_Hangul_Hanja:65332,XK_Hangul_Jeonja:65336,XF86XK_ModeLock:269025025,XF86XK_MonBrightnessUp:269025026,XF86XK_MonBrightnessDown:269025027,XF86XK_KbdLightOnOff:269025028,XF86XK_KbdBrightnessUp:269025029,XF86XK_KbdBrightnessDown:269025030,XF86XK_Standby:269025040,XF86XK_AudioLowerVolume:269025041,XF86XK_AudioMute:269025042,XF86XK_AudioRaiseVolume:269025043,XF86XK_AudioPlay:269025044,XF86XK_AudioStop:269025045,XF86XK_AudioPrev:269025046,XF86XK_AudioNext:269025047,XF86XK_HomePage:269025048,XF86XK_Mail:269025049,XF86XK_Start:269025050,XF86XK_Search:269025051,XF86XK_AudioRecord:269025052,XF86XK_Calculator:269025053,XF86XK_Memo:269025054,XF86XK_ToDoList:269025055,XF86XK_Calendar:269025056,XF86XK_PowerDown:269025057,XF86XK_ContrastAdjust:269025058,XF86XK_RockerUp:269025059,XF86XK_RockerDown:269025060,XF86XK_RockerEnter:269025061,XF86XK_Back:269025062,XF86XK_Forward:269025063,XF86XK_Stop:269025064,XF86XK_Refresh:269025065,XF86XK_PowerOff:269025066,XF86XK_WakeUp:269025067,XF86XK_Eject:269025068,XF86XK_ScreenSaver:269025069,XF86XK_WWW:269025070,XF86XK_Sleep:269025071,XF86XK_Favorites:269025072,XF86XK_AudioPause:269025073,XF86XK_AudioMedia:269025074,XF86XK_MyComputer:269025075,XF86XK_VendorHome:269025076,XF86XK_LightBulb:269025077,XF86XK_Shop:269025078,XF86XK_History:269025079,XF86XK_OpenURL:269025080,XF86XK_AddFavorite:269025081,XF86XK_HotLinks:269025082,XF86XK_BrightnessAdjust:269025083,XF86XK_Finance:269025084,XF86XK_Community:269025085,XF86XK_AudioRewind:269025086,XF86XK_BackForward:269025087,XF86XK_Launch0:269025088,XF86XK_Launch1:269025089,XF86XK_Launch2:269025090,XF86XK_Launch3:269025091,XF86XK_Launch4:269025092,XF86XK_Launch5:269025093,XF86XK_Launch6:269025094,XF86XK_Launch7:269025095,XF86XK_Launch8:269025096,XF86XK_Launch9:269025097,XF86XK_LaunchA:269025098,XF86XK_LaunchB:269025099,XF86XK_LaunchC:269025100,XF86XK_LaunchD:269025101,XF86XK_LaunchE:269025102,XF86XK_LaunchF:269025103,XF86XK_ApplicationLeft:269025104,XF86XK_ApplicationRight:269025105,XF86XK_Book:269025106,XF86XK_CD:269025107,XF86XK_Calculater:269025108,XF86XK_Clear:269025109,XF86XK_Close:269025110,XF86XK_Copy:269025111,XF86XK_Cut:269025112,XF86XK_Display:269025113,XF86XK_DOS:269025114,XF86XK_Documents:269025115,XF86XK_Excel:269025116,XF86XK_Explorer:269025117,XF86XK_Game:269025118,XF86XK_Go:269025119,XF86XK_iTouch:269025120,XF86XK_LogOff:269025121,XF86XK_Market:269025122,XF86XK_Meeting:269025123,XF86XK_MenuKB:269025125,XF86XK_MenuPB:269025126,XF86XK_MySites:269025127,XF86XK_New:269025128,XF86XK_News:269025129,XF86XK_OfficeHome:269025130,XF86XK_Open:269025131,XF86XK_Option:269025132,XF86XK_Paste:269025133,XF86XK_Phone:269025134,XF86XK_Q:269025136,XF86XK_Reply:269025138,XF86XK_Reload:269025139,XF86XK_RotateWindows:269025140,XF86XK_RotationPB:269025141,XF86XK_RotationKB:269025142,XF86XK_Save:269025143,XF86XK_ScrollUp:269025144,XF86XK_ScrollDown:269025145,XF86XK_ScrollClick:269025146,XF86XK_Send:269025147,XF86XK_Spell:269025148,XF86XK_SplitScreen:269025149,XF86XK_Support:269025150,XF86XK_TaskPane:269025151,XF86XK_Terminal:269025152,XF86XK_Tools:269025153,XF86XK_Travel:269025154,XF86XK_UserPB:269025156,XF86XK_User1KB:269025157,XF86XK_User2KB:269025158,XF86XK_Video:269025159,XF86XK_WheelButton:269025160,XF86XK_Word:269025161,XF86XK_Xfer:269025162,XF86XK_ZoomIn:269025163,XF86XK_ZoomOut:269025164,XF86XK_Away:269025165,XF86XK_Messenger:269025166,XF86XK_WebCam:269025167,XF86XK_MailForward:269025168,XF86XK_Pictures:269025169,XF86XK_Music:269025170,XF86XK_Battery:269025171,XF86XK_Bluetooth:269025172,XF86XK_WLAN:269025173,XF86XK_UWB:269025174,XF86XK_AudioForward:269025175,XF86XK_AudioRepeat:269025176,XF86XK_AudioRandomPlay:269025177,XF86XK_Subtitle:269025178,XF86XK_AudioCycleTrack:269025179,XF86XK_CycleAngle:269025180,XF86XK_FrameBack:269025181,XF86XK_FrameForward:269025182,XF86XK_Time:269025183,XF86XK_Select:269025184,XF86XK_View:269025185,XF86XK_TopMenu:269025186,XF86XK_Red:269025187,XF86XK_Green:269025188,XF86XK_Yellow:269025189,XF86XK_Blue:269025190,XF86XK_Suspend:269025191,XF86XK_Hibernate:269025192,XF86XK_TouchpadToggle:269025193,XF86XK_TouchpadOn:269025200,XF86XK_TouchpadOff:269025201,XF86XK_AudioMicMute:269025202,XF86XK_Switch_VT_1:269024769,XF86XK_Switch_VT_2:269024770,XF86XK_Switch_VT_3:269024771,XF86XK_Switch_VT_4:269024772,XF86XK_Switch_VT_5:269024773,XF86XK_Switch_VT_6:269024774,XF86XK_Switch_VT_7:269024775,XF86XK_Switch_VT_8:269024776,XF86XK_Switch_VT_9:269024777,XF86XK_Switch_VT_10:269024778,XF86XK_Switch_VT_11:269024779,XF86XK_Switch_VT_12:269024780,XF86XK_Ungrab:269024800,XF86XK_ClearGrab:269024801,XF86XK_Next_VMode:269024802,XF86XK_Prev_VMode:269024803,XF86XK_LogWindowTree:269024804,XF86XK_LogGrabInfo:269024805};se.default=z},mTgk:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=L(ee("mHUz"));function L(_){return _&&_.__esModule?_:{default:_}}var D={};function k(_,p){if(p===void 0)throw new Error('Undefined keysym for key "'+_+'"');if(_ in D)throw new Error('Duplicate entry for key "'+_+'"');D[_]=[p,p,p,p]}function M(_,p,c){if(p===void 0)throw new Error('Undefined keysym for key "'+_+'"');if(c===void 0)throw new Error('Undefined keysym for key "'+_+'"');if(_ in D)throw new Error('Duplicate entry for key "'+_+'"');D[_]=[p,p,c,p]}function f(_,p,c){if(p===void 0)throw new Error('Undefined keysym for key "'+_+'"');if(c===void 0)throw new Error('Undefined keysym for key "'+_+'"');if(_ in D)throw new Error('Duplicate entry for key "'+_+'"');D[_]=[p,p,p,c]}M("Alt",z.default.XK_Alt_L,z.default.XK_Alt_R),k("AltGraph",z.default.XK_ISO_Level3_Shift),k("CapsLock",z.default.XK_Caps_Lock),M("Control",z.default.XK_Control_L,z.default.XK_Control_R),M("Meta",z.default.XK_Super_L,z.default.XK_Super_R),k("NumLock",z.default.XK_Num_Lock),k("ScrollLock",z.default.XK_Scroll_Lock),M("Shift",z.default.XK_Shift_L,z.default.XK_Shift_R),f("Enter",z.default.XK_Return,z.default.XK_KP_Enter),k("Tab",z.default.XK_Tab),f(" ",z.default.XK_space,z.default.XK_KP_Space),f("ArrowDown",z.default.XK_Down,z.default.XK_KP_Down),f("ArrowUp",z.default.XK_Up,z.default.XK_KP_Up),f("ArrowLeft",z.default.XK_Left,z.default.XK_KP_Left),f("ArrowRight",z.default.XK_Right,z.default.XK_KP_Right),f("End",z.default.XK_End,z.default.XK_KP_End),f("Home",z.default.XK_Home,z.default.XK_KP_Home),f("PageDown",z.default.XK_Next,z.default.XK_KP_Next),f("PageUp",z.default.XK_Prior,z.default.XK_KP_Prior),k("Backspace",z.default.XK_BackSpace),f("Clear",z.default.XK_Clear,z.default.XK_KP_Begin),k("Copy",z.default.XF86XK_Copy),k("Cut",z.default.XF86XK_Cut),f("Delete",z.default.XK_Delete,z.default.XK_KP_Delete),f("Insert",z.default.XK_Insert,z.default.XK_KP_Insert),k("Paste",z.default.XF86XK_Paste),k("Redo",z.default.XK_Redo),k("Undo",z.default.XK_Undo),k("Cancel",z.default.XK_Cancel),k("ContextMenu",z.default.XK_Menu),k("Escape",z.default.XK_Escape),k("Execute",z.default.XK_Execute),k("Find",z.default.XK_Find),k("Help",z.default.XK_Help),k("Pause",z.default.XK_Pause),k("Select",z.default.XK_Select),k("ZoomIn",z.default.XF86XK_ZoomIn),k("ZoomOut",z.default.XF86XK_ZoomOut),k("BrightnessDown",z.default.XF86XK_MonBrightnessDown),k("BrightnessUp",z.default.XF86XK_MonBrightnessUp),k("Eject",z.default.XF86XK_Eject),k("LogOff",z.default.XF86XK_LogOff),k("Power",z.default.XF86XK_PowerOff),k("PowerOff",z.default.XF86XK_PowerDown),k("PrintScreen",z.default.XK_Print),k("Hibernate",z.default.XF86XK_Hibernate),k("Standby",z.default.XF86XK_Standby),k("WakeUp",z.default.XF86XK_WakeUp),k("AllCandidates",z.default.XK_MultipleCandidate),k("Alphanumeric",z.default.XK_Eisu_Shift),k("CodeInput",z.default.XK_Codeinput),k("Compose",z.default.XK_Multi_key),k("Convert",z.default.XK_Henkan),k("GroupFirst",z.default.XK_ISO_First_Group),k("GroupLast",z.default.XK_ISO_Last_Group),k("GroupNext",z.default.XK_ISO_Next_Group),k("GroupPrevious",z.default.XK_ISO_Prev_Group),k("NonConvert",z.default.XK_Muhenkan),k("PreviousCandidate",z.default.XK_PreviousCandidate),k("SingleCandidate",z.default.XK_SingleCandidate),k("HangulMode",z.default.XK_Hangul),k("HanjaMode",z.default.XK_Hangul_Hanja),k("JunjuaMode",z.default.XK_Hangul_Jeonja),k("Eisu",z.default.XK_Eisu_toggle),k("Hankaku",z.default.XK_Hankaku),k("Hiragana",z.default.XK_Hiragana),k("HiraganaKatakana",z.default.XK_Hiragana_Katakana),k("KanaMode",z.default.XK_Kana_Shift),k("KanjiMode",z.default.XK_Kanji),k("Katakana",z.default.XK_Katakana),k("Romaji",z.default.XK_Romaji),k("Zenkaku",z.default.XK_Zenkaku),k("ZenkakuHanaku",z.default.XK_Zenkaku_Hankaku),k("F1",z.default.XK_F1),k("F2",z.default.XK_F2),k("F3",z.default.XK_F3),k("F4",z.default.XK_F4),k("F5",z.default.XK_F5),k("F6",z.default.XK_F6),k("F7",z.default.XK_F7),k("F8",z.default.XK_F8),k("F9",z.default.XK_F9),k("F10",z.default.XK_F10),k("F11",z.default.XK_F11),k("F12",z.default.XK_F12),k("F13",z.default.XK_F13),k("F14",z.default.XK_F14),k("F15",z.default.XK_F15),k("F16",z.default.XK_F16),k("F17",z.default.XK_F17),k("F18",z.default.XK_F18),k("F19",z.default.XK_F19),k("F20",z.default.XK_F20),k("F21",z.default.XK_F21),k("F22",z.default.XK_F22),k("F23",z.default.XK_F23),k("F24",z.default.XK_F24),k("F25",z.default.XK_F25),k("F26",z.default.XK_F26),k("F27",z.default.XK_F27),k("F28",z.default.XK_F28),k("F29",z.default.XK_F29),k("F30",z.default.XK_F30),k("F31",z.default.XK_F31),k("F32",z.default.XK_F32),k("F33",z.default.XK_F33),k("F34",z.default.XK_F34),k("F35",z.default.XK_F35),k("Close",z.default.XF86XK_Close),k("MailForward",z.default.XF86XK_MailForward),k("MailReply",z.default.XF86XK_Reply),k("MailSend",z.default.XF86XK_Send),k("MediaFastForward",z.default.XF86XK_AudioForward),k("MediaPause",z.default.XF86XK_AudioPause),k("MediaPlay",z.default.XF86XK_AudioPlay),k("MediaRecord",z.default.XF86XK_AudioRecord),k("MediaRewind",z.default.XF86XK_AudioRewind),k("MediaStop",z.default.XF86XK_AudioStop),k("MediaTrackNext",z.default.XF86XK_AudioNext),k("MediaTrackPrevious",z.default.XF86XK_AudioPrev),k("New",z.default.XF86XK_New),k("Open",z.default.XF86XK_Open),k("Print",z.default.XK_Print),k("Save",z.default.XF86XK_Save),k("SpellCheck",z.default.XF86XK_Spell),k("AudioVolumeDown",z.default.XF86XK_AudioLowerVolume),k("AudioVolumeUp",z.default.XF86XK_AudioRaiseVolume),k("AudioVolumeMute",z.default.XF86XK_AudioMute),k("MicrophoneVolumeMute",z.default.XF86XK_AudioMicMute),k("LaunchApplication1",z.default.XF86XK_MyComputer),k("LaunchApplication2",z.default.XF86XK_Calculator),k("LaunchCalendar",z.default.XF86XK_Calendar),k("LaunchMail",z.default.XF86XK_Mail),k("LaunchMediaPlayer",z.default.XF86XK_AudioMedia),k("LaunchMusicPlayer",z.default.XF86XK_Music),k("LaunchPhone",z.default.XF86XK_Phone),k("LaunchScreenSaver",z.default.XF86XK_ScreenSaver),k("LaunchSpreadsheet",z.default.XF86XK_Excel),k("LaunchWebBrowser",z.default.XF86XK_WWW),k("LaunchWebCam",z.default.XF86XK_WebCam),k("LaunchWordProcessor",z.default.XF86XK_Word),k("BrowserBack",z.default.XF86XK_Back),k("BrowserFavorites",z.default.XF86XK_Favorites),k("BrowserForward",z.default.XF86XK_Forward),k("BrowserHome",z.default.XF86XK_HomePage),k("BrowserRefresh",z.default.XF86XK_Refresh),k("BrowserSearch",z.default.XF86XK_Search),k("BrowserStop",z.default.XF86XK_Stop),k("Dimmer",z.default.XF86XK_BrightnessAdjust),k("MediaAudioTrack",z.default.XF86XK_AudioCycleTrack),k("RandomToggle",z.default.XF86XK_AudioRandomPlay),k("SplitScreenToggle",z.default.XF86XK_SplitScreen),k("Subtitle",z.default.XF86XK_Subtitle),k("VideoModeNext",z.default.XF86XK_Next_VMode),f("=",z.default.XK_equal,z.default.XK_KP_Equal),f("+",z.default.XK_plus,z.default.XK_KP_Add),f("-",z.default.XK_minus,z.default.XK_KP_Subtract),f("*",z.default.XK_asterisk,z.default.XK_KP_Multiply),f("/",z.default.XK_slash,z.default.XK_KP_Divide),f(".",z.default.XK_period,z.default.XK_KP_Decimal),f(",",z.default.XK_comma,z.default.XK_KP_Separator),f("0",z.default.XK_0,z.default.XK_KP_0),f("1",z.default.XK_1,z.default.XK_KP_1),f("2",z.default.XK_2,z.default.XK_KP_2),f("3",z.default.XK_3,z.default.XK_KP_3),f("4",z.default.XK_4,z.default.XK_KP_4),f("5",z.default.XK_5,z.default.XK_KP_5),f("6",z.default.XK_6,z.default.XK_KP_6),f("7",z.default.XK_7,z.default.XK_KP_7),f("8",z.default.XK_8,z.default.XK_KP_8),f("9",z.default.XK_9,z.default.XK_KP_9);var S=D;se.default=S},mdZa:function(ot,se,ee){"use strict";typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(L,D){"use strict";if(L==null)throw new TypeError("Cannot convert undefined or null to object");for(var k=Object(L),M=1;M<arguments.length;M++){var f=arguments[M];if(f!=null)for(var S in f)Object.prototype.hasOwnProperty.call(f,S)&&(k[S]=f[S])}return k},writable:!0,configurable:!0}),function(){function z(L,D){D=D||{bubbles:!1,cancelable:!1,detail:void 0};var k=document.createEvent("CustomEvent");return k.initCustomEvent(L,D.bubbles,D.cancelable,D.detail),k}z.prototype=window.Event.prototype,typeof window.CustomEvent!="function"&&(window.CustomEvent=z)}(),Number.isInteger=Number.isInteger||function(L){return typeof L=="number"&&isFinite(L)&&Math.floor(L)===L}},nnTU:function(ot,se,ee){"use strict";ee.d(se,"b",function(){return _}),ee.d(se,"a",function(){return p});var z=ee("pmY6"),L=ee("746U"),D=ee("Cg/j"),k=ee("MI8n"),M=ee("24hK"),f=ee("QDVR"),S=function(){for(var c=0,o=0,u=arguments.length;o<u;o++)c+=arguments[o].length;for(var s=Array(c),l=0,o=0;o<u;o++)for(var t=arguments[o],a=0,i=t.length;a<i;a++,l++)s[l]=t[a];return s},_=Object(D.c)("commandService"),p=new(function(){function c(){this._commands=new Map,this._onDidRegisterCommand=new k.a,this.onDidRegisterCommand=this._onDidRegisterCommand.event}return c.prototype.registerCommand=function(o,u){var s=this;if(!o)throw new Error("invalid command");if(typeof o=="string"){if(!u)throw new Error("invalid command");return this.registerCommand({id:o,handler:u})}if(o.description){for(var l=[],t=0,a=o.description.args;t<a.length;t++){var i=a[t];l.push(i.constraint)}var r=o.handler;o.handler=function(C){for(var T=[],x=1;x<arguments.length;x++)T[x-1]=arguments[x];return Object(L.m)(T,l),r.apply(void 0,S([C],T))}}var h=o.id,d=this._commands.get(h);d||(d=new M.a,this._commands.set(h,d));var y=d.unshift(o),m=Object(z.h)(function(){y();var C=s._commands.get(h);(C==null?void 0:C.isEmpty())&&s._commands.delete(h)});return this._onDidRegisterCommand.fire(h),m},c.prototype.registerCommandAlias=function(o,u){return p.registerCommand(o,function(s){for(var l,t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];return(l=s.get(_)).executeCommand.apply(l,S([u],t))})},c.prototype.getCommand=function(o){var u=this._commands.get(o);return!u||u.isEmpty()?void 0:u.iterator().next().value},c.prototype.getCommands=function(){for(var o=new Map,u=0,s=Object(f.d)(this._commands);u<s.length;u++){var l=s[u],t=this.getCommand(l);t&&o.set(l,t)}return o},c}())},osHv:function(ot,se,ee){(function(z){z(ee("VrN/"))})(function(z){"use strict";var L=z.Pos;function D(i,r){return i.line-r.line||i.ch-r.ch}var k="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",M=k+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",f=new RegExp("<(/?)(["+k+"]["+M+"]*)","g");function S(i,r,h,d){this.line=r,this.ch=h,this.cm=i,this.text=i.getLine(r),this.min=d?Math.max(d.from,i.firstLine()):i.firstLine(),this.max=d?Math.min(d.to-1,i.lastLine()):i.lastLine()}function _(i,r){var h=i.cm.getTokenTypeAt(L(i.line,r));return h&&/\btag\b/.test(h)}function p(i){return i.line>=i.max?void 0:(i.ch=0,i.text=i.cm.getLine(++i.line),!0)}function c(i){return i.line<=i.min?void 0:(i.text=i.cm.getLine(--i.line),i.ch=i.text.length,!0)}function o(i){for(;;){var r=i.text.indexOf(">",i.ch);if(r==-1){if(p(i))continue;return}if(!_(i,r+1)){i.ch=r+1;continue}var h=i.text.lastIndexOf("/",r),d=h>-1&&!/\S/.test(i.text.slice(h+1,r));return i.ch=r+1,d?"selfClose":"regular"}}function u(i){for(;;){var r=i.ch?i.text.lastIndexOf("<",i.ch-1):-1;if(r==-1){if(c(i))continue;return}if(!_(i,r+1)){i.ch=r;continue}f.lastIndex=r,i.ch=r;var h=f.exec(i.text);if(h&&h.index==r)return h}}function s(i){for(;;){f.lastIndex=i.ch;var r=f.exec(i.text);if(!r){if(p(i))continue;return}if(!_(i,r.index+1)){i.ch=r.index+1;continue}return i.ch=r.index+r[0].length,r}}function l(i){for(;;){var r=i.ch?i.text.lastIndexOf(">",i.ch-1):-1;if(r==-1){if(c(i))continue;return}if(!_(i,r+1)){i.ch=r;continue}var h=i.text.lastIndexOf("/",r),d=h>-1&&!/\S/.test(i.text.slice(h+1,r));return i.ch=r+1,d?"selfClose":"regular"}}function t(i,r){for(var h=[];;){var d=s(i),y,m=i.line,C=i.ch-(d?d[0].length:0);if(!d||!(y=o(i)))return;if(y=="selfClose")continue;if(d[1]){for(var T=h.length-1;T>=0;--T)if(h[T]==d[2]){h.length=T;break}if(T<0&&(!r||r==d[2]))return{tag:d[2],from:L(m,C),to:L(i.line,i.ch)}}else h.push(d[2])}}function a(i,r){for(var h=[];;){var d=l(i);if(!d)return;if(d=="selfClose"){u(i);continue}var y=i.line,m=i.ch,C=u(i);if(!C)return;if(C[1])h.push(C[2]);else{for(var T=h.length-1;T>=0;--T)if(h[T]==C[2]){h.length=T;break}if(T<0&&(!r||r==C[2]))return{tag:C[2],from:L(i.line,i.ch),to:L(y,m)}}}}z.registerHelper("fold","xml",function(i,r){for(var h=new S(i,r.line,0);;){var d=s(h);if(!d||h.line!=r.line)return;var y=o(h);if(!y)return;if(!d[1]&&y!="selfClose"){var m=L(h.line,h.ch),C=t(h,d[2]);return C&&D(C.from,m)>0?{from:m,to:C.from}:null}}}),z.findMatchingTag=function(i,r,h){var d=new S(i,r.line,r.ch,h);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var y=o(d),m=y&&L(d.line,d.ch),C=y&&u(d);if(!y||!C||D(d,r)>0)return;var T={from:L(d.line,d.ch),to:m,tag:C[2]};return y=="selfClose"?{open:T,close:null,at:"open"}:C[1]?{open:a(d,C[2]),close:T,at:"close"}:(d=new S(i,m.line,m.ch,h),{open:T,close:t(d,C[2]),at:"open"})},z.findEnclosingTag=function(i,r,h,d){for(var y=new S(i,r.line,r.ch,h);;){var m=a(y,d);if(!m)break;var C=new S(i,r.line,r.ch,h),T=t(C,m.tag);if(T)return{open:m,close:T}}},z.scanForClosingTag=function(i,r,h,d){var y=new S(i,r.line,r.ch,d?{from:0,to:d}:null);return t(y,h)}})},p5ED:function(ot,se,ee){"use strict";var z=ee("+L6B"),L=ee("2/Rp"),D=ee("5Dmo"),k=ee("3S7+"),M=ee("k1fw"),f=ee("9og8"),S=ee("tJVT"),_=ee("WmNS"),p=ee.n(_),c=ee("q1tI"),o=ee.n(c),u=ee("vHTk"),s=ee.n(u),l=ee("yEEn"),t=ee("ZW9T"),a=ee("1vsH"),i=ee("V0Rq"),r=ee("m3rI");se.a=function(h){var d,y,m,C,T,x,E=h.editOffice,w=E===void 0?"view":E,A=h.name,g=h.data,P=h.theme,O=h.type,F=h.filename,X=h.monacoEditor,W=h.className,N=h.style,G=h.close,U=h.onClose,H=h.hasMask,V=h.disabledDownload,ce=h.onImgDimensions,ye=h.otherData,Le=Object(c.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Ze=Object(S.a)(Le,2),Ye=Ze[0],Oe=Ze[1],We=Object(c.useState)(""),ze=Object(S.a)(We,2),Ae=ze[0],xe=ze[1],le=Object(c.useState)(),Se=Object(S.a)(le,2),pe=Se[0],Ge=Se[1],fe=window.ENV==="build"?"/react/build":"",ge=location.host.startsWith("localhost")?r.a.PROXY_SERVER:r.a.API_SERVER,De,Ve=1024*1024,Qe=10*Ve,ke=Object(c.useRef)();(d=g)!==null&&d!==void 0&&d.startsWith("/api")&&O!=="txt"&&(g=r.a.API_SERVER+g),O==="office"&&(De=Object(a.P)(g).filesize,De>Qe&&(O="other")),F&&(X.filename=F),Object(c.useEffect)(function(){var ne,_e,ae=(ne=document.cookie)===null||ne===void 0||((_e=ne.replace(/\s/g,""))===null||_e===void 0)?void 0:_e.split(";");ae==null||ae.map(function(Ie){var Je=Ie.split("=");Je[0]==="_educoder_session"&&xe(Je[1])})},[]),Object(c.useEffect)(function(){O==="office"&&Fe()},[O,g]);var Fe=function(){var ne=Object(f.a)(p.a.mark(function _e(){var ae,Ie,Je;return p.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return console.log("data:",g),ae=g,g.startsWith("http")||(ae=location.origin+ae),Ie=new URL(ae).pathname.split("/").pop(),Ke.next=6,Object(i.U)({attachment_id:Ie});case 6:Je=Ke.sent,Ge(Je);case 8:case"end":return Ke.stop()}},_e)}));return function(){return ne.apply(this,arguments)}}(),Ne=function(){if(g.startsWith("http")||g.startsWith("blob:")){Me();return}Object(a.x)(F||"educoder",g,F)},Me=function(){Object(a.v)(F||"educoder",decodeURIComponent(g))};return o.a.createElement("div",{style:Object(M.a)({},N||{}),className:"".concat(H&&s.a.bgBlack," ").concat(O?s.a.wrp:"hide")},G&&o.a.createElement("div",{className:s.a.close,ref:ke},!!ce&&o.a.createElement(k.a,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:function(){return ke.current}},o.a.createElement("span",{onClick:function(){U(),ce()}},o.a.createElement("i",{className:"icon-yulanpizhu"}))),!V&&o.a.createElement(k.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ke.current}},o.a.createElement("span",{onClick:Me},o.a.createElement("i",{className:"icon-quxiaozhiding"}))),o.a.createElement(k.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ke.current}},o.a.createElement("span",{className:"",onClick:U},o.a.createElement("i",{className:"icon-guanbi1"})))),o.a.createElement("div",{className:"".concat(s.a[W]," ").concat(W," ").concat(s.a.monaco," ").concat(O==="txt"?"show":"hide")},O==="txt"&&o.a.createElement(t.b,X)),O==="audio"&&o.a.createElement("audio",{src:"".concat(((y=g)===null||y===void 0?void 0:y.indexOf("http://"))>-1||((m=g)===null||m===void 0?void 0:m.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(g),autoPlay:!0}),O==="video"&&o.a.createElement(o.a.Fragment,null,((C=g)===null||C===void 0?void 0:C.indexOf("http"))>-1?o.a.createElement("video",{controls:!0,src:"".concat(g),autoPlay:!0}):o.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(g),autoPlay:!0})),O==="office"&&pe&&o.a.createElement("iframe",{src:"".concat(fe,"/office.html?key=").concat(pe.key,"&url=").concat(ge+pe.url,"&callbackUrl=").concat(ge+pe.callbackUrl,"&fileType=").concat(pe.fileType,"&title=").concat(pe.title,"&model=").concat(w,"&officeServer=").concat(r.a.OFFICE_SERVER,"&disabledDownload=").concat(!!V)}),(O==="xlsx"||O==="doc"||O==="pptx"||O==="docx")&&o.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(ye.key,"&url=").concat(r.a.API_SERVER+ye.url,"&callbackUrl=").concat(r.a.API_SERVER+ye.callbackUrl,"&fileType=").concat(ye.fileType,"&title=").concat(ye.title,"&model=").concat(ye.model)}),O==="html"&&o.a.createElement("iframe",{src:g+"&disposition=inline"}),O==="pdf"&&o.a.createElement("embed",{className:s.a.embed,src:g}),O==="image"&&o.a.createElement("img",{src:"".concat(((T=g)===null||T===void 0?void 0:T.indexOf("http://"))>-1||((x=g)===null||x===void 0?void 0:x.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(g)}),O==="other"&&o.a.createElement("div",null,o.a.createElement(L.a,{type:"primary",size:"large",onClick:Ne},o.a.createElement(l.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),O==="download"&&o.a.createElement(L.a,{type:"primary",size:"large",onClick:Ne},o.a.createElement(l.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ot,se,ee){},pmY6:function(ot,se,ee){"use strict";ee.d(se,"g",function(){return M}),ee.d(se,"f",function(){return f}),ee.d(se,"e",function(){return S}),ee.d(se,"h",function(){return _}),ee.d(se,"b",function(){return p}),ee.d(se,"a",function(){return c}),ee.d(se,"d",function(){return o}),ee.d(se,"c",function(){return u});var z=!1,L="__is_disposable_tracked__";function D(s){if(!z)return;if(s&&s!==c.None)try{s[L]=!0}catch(l){}}function k(s){if(!z)return s;var l=new Error("Potentially leaked disposable").stack;return setTimeout(function(){s[L]||console.log(l)},3e3),s}function M(s){return typeof s.dispose=="function"&&s.dispose.length===0}function f(s){return Array.isArray(s)?(s.forEach(function(l){l&&(D(l),l.dispose())}),[]):s?(D(s),s.dispose(),s):void 0}function S(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return s.forEach(D),k({dispose:function(){return f(s)}})}function _(s){var l=k({dispose:function(){D(l),s()}});return l}var p=function(){function s(){this._toDispose=new Set,this._isDisposed=!1}return s.prototype.dispose=function(){if(this._isDisposed)return;D(this),this._isDisposed=!0,this.clear()},s.prototype.clear=function(){this._toDispose.forEach(function(l){return l.dispose()}),this._toDispose.clear()},s.prototype.add=function(l){if(!l)return l;if(l===this)throw new Error("Cannot register a disposable on itself!");return D(l),this._isDisposed?console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(l),l},s}(),c=function(){function s(){this._store=new p,k(this)}return s.prototype.dispose=function(){D(this),this._store.dispose()},s.prototype._register=function(l){if(l===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(l)},s.None=Object.freeze({dispose:function(){}}),s}(),o=function(){function s(){this._isDisposed=!1,k(this)}return Object.defineProperty(s.prototype,"value",{get:function(){return this._isDisposed?void 0:this._value},set:function(l){if(this._isDisposed||l===this._value)return;this._value&&this._value.dispose(),l&&D(l),this._value=l},enumerable:!0,configurable:!0}),s.prototype.clear=function(){this.value=void 0},s.prototype.dispose=function(){this._isDisposed=!0,D(this),this._value&&this._value.dispose(),this._value=void 0},s}(),u=function(){function s(l){this.object=l}return s.prototype.dispose=function(){},s}()},q7KB:function(ot,se,ee){},"rAM+":function(ot,se,ee){"use strict";ee.d(se,"a",function(){return L});var z=ee("Qw5x");function L(D,k){var M;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(M=Object(z.a)(D))||k&&D&&typeof D.length=="number"){M&&(D=M);var f=0,S=function(){};return{s:S,n:function(){return f>=D.length?{done:!0}:{done:!1,value:D[f++]}},e:function(u){throw u},f:S}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var _=!0,p=!1,c;return{s:function(){M=D[Symbol.iterator]()},n:function(){var u=M.next();return _=u.done,u},e:function(u){p=!0,c=u},f:function(){try{!_&&M.return!=null&&M.return()}finally{if(p)throw c}}}}},rUJ1:function(ot,se){const ee=/[&<>"']/,z=/[&<>"']/g,L=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,k={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},M=x=>k[x];function f(x,E){if(E){if(ee.test(x))return x.replace(z,M)}else if(L.test(x))return x.replace(D,M);return x}const S=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function _(x){return x.replace(S,(E,w)=>(w=w.toLowerCase(),w==="colon"?":":w.charAt(0)==="#"?w.charAt(1)==="x"?String.fromCharCode(parseInt(w.substring(2),16)):String.fromCharCode(+w.substring(1)):""))}const p=/(^|[^\[])\^/g;function c(x,E){x=x.source||x,E=E||"";const w={replace:(A,g)=>(g=g.source||g,g=g.replace(p,"$1"),x=x.replace(A,g),w),getRegex:()=>new RegExp(x,E)};return w}const o=/[^\w:]/g,u=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function s(x,E,w){if(x){let A;try{A=decodeURIComponent(_(w)).replace(o,"").toLowerCase()}catch(g){return null}if(A.indexOf("javascript:")===0||A.indexOf("vbscript:")===0||A.indexOf("data:")===0)return null}E&&!u.test(w)&&(w=r(E,w));try{w=encodeURI(w).replace(/%25/g,"%")}catch(A){return null}return w}const l={},t=/^[^:]+:\/*[^/]*$/,a=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function r(x,E){l[" "+x]||(t.test(x)?l[" "+x]=x+"/":l[" "+x]=m(x,"/",!0)),x=l[" "+x];const w=x.indexOf(":")===-1;return E.substring(0,2)==="//"?w?E:x.replace(a,"$1")+E:E.charAt(0)==="/"?w?E:x.replace(i,"$1")+E:x+E}const h={exec:function(){}};function d(x){let E=1,w,A;for(;E<arguments.length;E++){w=arguments[E];for(A in w)Object.prototype.hasOwnProperty.call(w,A)&&(x[A]=w[A])}return x}function y(x,E){const w=x.replace(/\|/g,(P,O,F)=>{let X=!1,W=O;for(;--W>=0&&F[W]==="\\";)X=!X;return X?"|":" |"}),A=w.split(/ \|/);let g=0;if(A.length>E)A.splice(E);else for(;A.length<E;)A.push("");for(;g<A.length;g++)A[g]=A[g].trim().replace(/\\\|/g,"|");return A}function m(x,E,w){const A=x.length;if(A===0)return"";let g=0;for(;g<A;){const P=x.charAt(A-g-1);if(P===E&&!w)g++;else if(P!==E&&w)g++;else break}return x.substr(0,A-g)}function C(x,E){if(x.indexOf(E[1])===-1)return-1;const w=x.length;let A=0,g=0;for(;g<w;g++)if(x[g]==="\\")g++;else if(x[g]===E[0])A++;else if(x[g]===E[1]&&(A--,A<0))return g;return-1}function T(x){x&&x.sanitize&&!x.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")}ot.exports={escape:f,unescape:_,edit:c,cleanUrl:s,resolveUrl:r,noopTest:h,merge:d,splitCells:y,rtrim:m,findClosingBracket:C,checkSanitizeDeprecation:T}},rwxt:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=ee("GdRQ");function L(S,_){if(!(S instanceof _))throw new TypeError("Cannot call a class as a function")}function D(S,_){for(var p=0;p<_.length;p++){var c=_[p];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(S,c.key,c)}}function k(S,_,p){return _&&D(S.prototype,_),p&&D(S,p),S}var M=!z.supportsCursorURIs||z.isTouchDevice,f=function(){function S(){L(this,S),this._target=null,this._canvas=document.createElement("canvas"),M&&(this._canvas.style.position="fixed",this._canvas.style.zIndex="65535",this._canvas.style.pointerEvents="none",this._canvas.style.visibility="hidden"),this._position={x:0,y:0},this._hotSpot={x:0,y:0},this._eventHandlers={mouseover:this._handleMouseOver.bind(this),mouseleave:this._handleMouseLeave.bind(this),mousemove:this._handleMouseMove.bind(this),mouseup:this._handleMouseUp.bind(this)}}return k(S,[{key:"attach",value:function(p){if(this._target&&this.detach(),this._target=p,M){document.body.appendChild(this._canvas);var c={capture:!0,passive:!0};this._target.addEventListener("mouseover",this._eventHandlers.mouseover,c),this._target.addEventListener("mouseleave",this._eventHandlers.mouseleave,c),this._target.addEventListener("mousemove",this._eventHandlers.mousemove,c),this._target.addEventListener("mouseup",this._eventHandlers.mouseup,c)}this.clear()}},{key:"detach",value:function(){if(!this._target)return;if(M){var p={capture:!0,passive:!0};this._target.removeEventListener("mouseover",this._eventHandlers.mouseover,p),this._target.removeEventListener("mouseleave",this._eventHandlers.mouseleave,p),this._target.removeEventListener("mousemove",this._eventHandlers.mousemove,p),this._target.removeEventListener("mouseup",this._eventHandlers.mouseup,p),document.body.removeChild(this._canvas)}this._target=null}},{key:"change",value:function(p,c,o,u,s){if(u===0||s===0){this.clear();return}this._position.x=this._position.x+this._hotSpot.x-c,this._position.y=this._position.y+this._hotSpot.y-o,this._hotSpot.x=c,this._hotSpot.y=o;var l=this._canvas.getContext("2d");this._canvas.width=u,this._canvas.height=s;var t;try{t=new ImageData(new Uint8ClampedArray(p),u,s)}catch(i){t=l.createImageData(u,s),t.data.set(new Uint8ClampedArray(p))}if(l.clearRect(0,0,u,s),l.putImageData(t,0,0),M)this._updatePosition();else{var a=this._canvas.toDataURL();this._target.style.cursor="url("+a+")"+c+" "+o+", default"}}},{key:"clear",value:function(){this._target.style.cursor="none",this._canvas.width=0,this._canvas.height=0,this._position.x=this._position.x+this._hotSpot.x,this._position.y=this._position.y+this._hotSpot.y,this._hotSpot.x=0,this._hotSpot.y=0}},{key:"move",value:function(p,c){if(!M)return;window.visualViewport?(this._position.x=p+window.visualViewport.offsetLeft,this._position.y=c+window.visualViewport.offsetTop):(this._position.x=p,this._position.y=c),this._updatePosition();var o=document.elementFromPoint(p,c);this._updateVisibility(o)}},{key:"_handleMouseOver",value:function(p){this._handleMouseMove(p)}},{key:"_handleMouseLeave",value:function(p){this._updateVisibility(p.relatedTarget)}},{key:"_handleMouseMove",value:function(p){this._updateVisibility(p.target),this._position.x=p.clientX-this._hotSpot.x,this._position.y=p.clientY-this._hotSpot.y,this._updatePosition()}},{key:"_handleMouseUp",value:function(p){var c=this,o=document.elementFromPoint(p.clientX,p.clientY);this._updateVisibility(o),this._captureIsActive()&&window.setTimeout(function(){if(!c._target)return;o=document.elementFromPoint(p.clientX,p.clientY),c._updateVisibility(o)},0)}},{key:"_showCursor",value:function(){this._canvas.style.visibility==="hidden"&&(this._canvas.style.visibility="")}},{key:"_hideCursor",value:function(){this._canvas.style.visibility!=="hidden"&&(this._canvas.style.visibility="hidden")}},{key:"_shouldShowCursor",value:function(p){return p?p===this._target?!0:this._target.contains(p)?!(window.getComputedStyle(p).cursor!=="none"):!1:!1}},{key:"_updateVisibility",value:function(p){this._captureIsActive()&&(p=document.captureElement),this._shouldShowCursor(p)?this._showCursor():this._hideCursor()}},{key:"_updatePosition",value:function(){this._canvas.style.left=this._position.x+"px",this._canvas.style.top=this._position.y+"px"}},{key:"_captureIsActive",value:function(){return document.captureElement&&document.documentElement.contains(document.captureElement)}}]),S}();se.default=f},sjKO:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=D;var z=30,L=12;function D(k,M){var f,S,_,p,c,o,u,s,l,t,a,i,r,h,d,y,m,C,T,x,E,w,A,g,P;f=k.state,S=k.next_in,g=k.input,_=S+(k.avail_in-5),p=k.next_out,P=k.output,c=p-(M-k.avail_out),o=p+(k.avail_out-257),u=f.dmax,s=f.wsize,l=f.whave,t=f.wnext,a=f.window,i=f.hold,r=f.bits,h=f.lencode,d=f.distcode,y=(1<<f.lenbits)-1,m=(1<<f.distbits)-1;e:do{r<15&&(i+=g[S++]<<r,r+=8,i+=g[S++]<<r,r+=8),C=h[i&y];t:for(;;){if(T=C>>>24,i>>>=T,r-=T,T=C>>>16&255,T===0)P[p++]=C&65535;else if(T&16){x=C&65535,T&=15,T&&(r<T&&(i+=g[S++]<<r,r+=8),x+=i&(1<<T)-1,i>>>=T,r-=T),r<15&&(i+=g[S++]<<r,r+=8,i+=g[S++]<<r,r+=8),C=d[i&m];r:for(;;){if(T=C>>>24,i>>>=T,r-=T,T=C>>>16&255,T&16){if(E=C&65535,T&=15,r<T&&(i+=g[S++]<<r,r+=8,r<T&&(i+=g[S++]<<r,r+=8)),E+=i&(1<<T)-1,E>u){k.msg="invalid distance too far back",f.mode=z;break e}if(i>>>=T,r-=T,T=p-c,E>T){if(T=E-T,T>l&&f.sane){k.msg="invalid distance too far back",f.mode=z;break e}if(w=0,A=a,t===0){if(w+=s-T,T<x){x-=T;do P[p++]=a[w++];while(--T);w=p-E,A=P}}else if(t<T){if(w+=s+t-T,T-=t,T<x){x-=T;do P[p++]=a[w++];while(--T);if(w=0,t<x){T=t,x-=T;do P[p++]=a[w++];while(--T);w=p-E,A=P}}}else if(w+=t-T,T<x){x-=T;do P[p++]=a[w++];while(--T);w=p-E,A=P}for(;x>2;)P[p++]=A[w++],P[p++]=A[w++],P[p++]=A[w++],x-=3;x&&(P[p++]=A[w++],x>1&&(P[p++]=A[w++]))}else{w=p-E;do P[p++]=P[w++],P[p++]=P[w++],P[p++]=P[w++],x-=3;while(x>2);x&&(P[p++]=P[w++],x>1&&(P[p++]=P[w++]))}}else if((T&64)===0){C=d[(C&65535)+(i&(1<<T)-1)];continue r}else{k.msg="invalid distance code",f.mode=z;break e}break}}else if((T&64)===0){C=h[(C&65535)+(i&(1<<T)-1)];continue t}else if(T&32){f.mode=L;break e}else{k.msg="invalid literal/length code",f.mode=z;break e}break}}while(S<_&&p<o);x=r>>3,S-=x,r-=x<<3,i&=(1<<r)-1,k.next_in=S,k.next_out=p,k.avail_in=S<_?5+(_-S):5-(S-_),k.avail_out=p<o?257+(o-p):257-(p-o),f.hold=i,f.bits=r;return}},ulZh:function(ot,se,ee){typeof window!="undefined"&&function(L,D){ot.exports=D()}(this,function(){return function(z){var L={};function D(k){if(L[k])return L[k].exports;var M=L[k]={i:k,l:!1,exports:{}};return z[k].call(M.exports,M,M.exports,D),M.l=!0,M.exports}return D.m=z,D.c=L,D.d=function(k,M,f){D.o(k,M)||Object.defineProperty(k,M,{enumerable:!0,get:f})},D.r=function(k){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(k,"__esModule",{value:!0})},D.t=function(k,M){if(M&1&&(k=D(k)),M&8)return k;if(M&4&&typeof k=="object"&&k&&k.__esModule)return k;var f=Object.create(null);if(D.r(f),Object.defineProperty(f,"default",{enumerable:!0,value:k}),M&2&&typeof k!="string")for(var S in k)D.d(f,S,function(_){return k[_]}.bind(null,S));return f},D.n=function(k){var M=k&&k.__esModule?function(){return k.default}:function(){return k};return D.d(M,"a",M),M},D.o=function(k,M){return Object.prototype.hasOwnProperty.call(k,M)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(z,L,D){"use strict";var k=Object.prototype.hasOwnProperty,M="~";function f(){}Object.create&&(f.prototype=Object.create(null),new f().__proto__||(M=!1));function S(o,u,s){this.fn=o,this.context=u,this.once=s||!1}function _(o,u,s,l,t){if(typeof s!="function")throw new TypeError("The listener must be a function");var a=new S(s,l||o,t),i=M?M+u:u;return o._events[i]?o._events[i].fn?o._events[i]=[o._events[i],a]:o._events[i].push(a):(o._events[i]=a,o._eventsCount++),o}function p(o,u){--o._eventsCount===0?o._events=new f:delete o._events[u]}function c(){this._events=new f,this._eventsCount=0}c.prototype.eventNames=function(){var u=[],s,l;if(this._eventsCount===0)return u;for(l in s=this._events)k.call(s,l)&&u.push(M?l.slice(1):l);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(s)):u},c.prototype.listeners=function(u){var s=M?M+u:u,l=this._events[s];if(!l)return[];if(l.fn)return[l.fn];for(var t=0,a=l.length,i=new Array(a);t<a;t++)i[t]=l[t].fn;return i},c.prototype.listenerCount=function(u){var s=M?M+u:u,l=this._events[s];return l?l.fn?1:l.length:0},c.prototype.emit=function(u,s,l,t,a,i){var r=M?M+u:u;if(!this._events[r])return!1;var h=this._events[r],d=arguments.length,y,m;if(h.fn){h.once&&this.removeListener(u,h.fn,void 0,!0);switch(d){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,s),!0;case 3:return h.fn.call(h.context,s,l),!0;case 4:return h.fn.call(h.context,s,l,t),!0;case 5:return h.fn.call(h.context,s,l,t,a),!0;case 6:return h.fn.call(h.context,s,l,t,a,i),!0}for(m=1,y=new Array(d-1);m<d;m++)y[m-1]=arguments[m];h.fn.apply(h.context,y)}else{var C=h.length,T;for(m=0;m<C;m++){h[m].once&&this.removeListener(u,h[m].fn,void 0,!0);switch(d){case 1:h[m].fn.call(h[m].context);break;case 2:h[m].fn.call(h[m].context,s);break;case 3:h[m].fn.call(h[m].context,s,l);break;case 4:h[m].fn.call(h[m].context,s,l,t);break;default:if(!y)for(T=1,y=new Array(d-1);T<d;T++)y[T-1]=arguments[T];h[m].fn.apply(h[m].context,y)}}}return!0},c.prototype.on=function(u,s,l){return _(this,u,s,l,!1)},c.prototype.once=function(u,s,l){return _(this,u,s,l,!0)},c.prototype.removeListener=function(u,s,l,t){var a=M?M+u:u;if(!this._events[a])return this;if(!s)return p(this,a),this;var i=this._events[a];if(i.fn)i.fn===s&&(!t||i.once)&&(!l||i.context===l)&&p(this,a);else{for(var r=0,h=[],d=i.length;r<d;r++)(i[r].fn!==s||t&&!i[r].once||l&&i[r].context!==l)&&h.push(i[r]);h.length?this._events[a]=h.length===1?h[0]:h:p(this,a)}return this},c.prototype.removeAllListeners=function(u){var s;return u?(s=M?M+u:u,this._events[s]&&p(this,s)):(this._events=new f,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=M,c.EventEmitter=c,z.exports=c},"./node_modules/url-toolkit/src/url-toolkit.js":function(z,L,D){(function(k){var M=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,f=/^([^\/?#]*)([^]*)$/,S=/(?:\/|^)\.(?=\/)/g,_=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,p={buildAbsoluteURL:function(c,o,u){if(u=u||{},c=c.trim(),o=o.trim(),!o){if(!u.alwaysNormalize)return c;var s=p.parseURL(c);if(!s)throw new Error("Error trying to parse base URL.");return s.path=p.normalizePath(s.path),p.buildURLFromParts(s)}var l=p.parseURL(o);if(!l)throw new Error("Error trying to parse relative URL.");if(l.scheme)return u.alwaysNormalize?(l.path=p.normalizePath(l.path),p.buildURLFromParts(l)):o;var t=p.parseURL(c);if(!t)throw new Error("Error trying to parse base URL.");if(!t.netLoc&&t.path&&t.path[0]!=="/"){var a=f.exec(t.path);t.netLoc=a[1],t.path=a[2]}t.netLoc&&!t.path&&(t.path="/");var i={scheme:t.scheme,netLoc:l.netLoc,path:null,params:l.params,query:l.query,fragment:l.fragment};if(!l.netLoc&&(i.netLoc=t.netLoc,l.path[0]!=="/"))if(!l.path)i.path=t.path,l.params||(i.params=t.params,l.query||(i.query=t.query));else{var r=t.path,h=r.substring(0,r.lastIndexOf("/")+1)+l.path;i.path=p.normalizePath(h)}return i.path===null&&(i.path=u.alwaysNormalize?p.normalizePath(l.path):l.path),p.buildURLFromParts(i)},parseURL:function(c){var o=M.exec(c);return o?{scheme:o[1]||"",netLoc:o[2]||"",path:o[3]||"",params:o[4]||"",query:o[5]||"",fragment:o[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(S,"");c.length!==(c=c.replace(_,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};z.exports=p})(this)},"./node_modules/webworkify-webpack/index.js":function(z,L,D){function k(u){var s={};function l(a){if(s[a])return s[a].exports;var i=s[a]={i:a,l:!1,exports:{}};return u[a].call(i.exports,i,i.exports,l),i.l=!0,i.exports}l.m=u,l.c=s,l.i=function(a){return a},l.d=function(a,i,r){l.o(a,i)||Object.defineProperty(a,i,{configurable:!1,enumerable:!0,get:r})},l.r=function(a){Object.defineProperty(a,"__esModule",{value:!0})},l.n=function(a){var i=a&&a.__esModule?function(){return a.default}:function(){return a};return l.d(i,"a",i),i},l.o=function(a,i){return Object.prototype.hasOwnProperty.call(a,i)},l.p="/",l.oe=function(a){throw console.error(a),a};var t=l(l.s=ENTRY_MODULE);return t.default||t}var M="[\\.|\\-|\\+|\\w|/|@]+",f="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+M+").*?\\)";function S(u){return(u+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function _(u){return!isNaN(1*u)}function p(u,s,l){var t={};t[l]=[];var a=s.toString(),i=a.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!i)return t;for(var r=i[1],h=new RegExp("(\\\\n|\\W)"+S(r)+f,"g"),d;d=h.exec(a);){if(d[3]==="dll-reference")continue;t[l].push(d[3])}for(h=new RegExp("\\("+S(r)+'\\("(dll-reference\\s('+M+'))"\\)\\)'+f,"g");d=h.exec(a);)u[d[2]]||(t[l].push(d[1]),u[d[2]]=D(d[1]).m),t[d[2]]=t[d[2]]||[],t[d[2]].push(d[4]);for(var y=Object.keys(t),m=0;m<y.length;m++)for(var C=0;C<t[y[m]].length;C++)_(t[y[m]][C])&&(t[y[m]][C]=1*t[y[m]][C]);return t}function c(u){var s=Object.keys(u);return s.reduce(function(l,t){return l||u[t].length>0},!1)}function o(u,s){for(var l={main:[s]},t={main:[]},a={main:{}};c(l);)for(var i=Object.keys(l),r=0;r<i.length;r++){var h=i[r],d=l[h],y=d.pop();if(a[h]=a[h]||{},a[h][y]||!u[h][y])continue;a[h][y]=!0,t[h]=t[h]||[],t[h].push(y);for(var m=p(u,u[h][y],h),C=Object.keys(m),T=0;T<C.length;T++)l[C[T]]=l[C[T]]||[],l[C[T]]=l[C[T]].concat(m[C[T]])}return t}z.exports=function(u,s){s=s||{};var l={main:D.m},t=s.all?{main:Object.keys(l.main)}:o(l,u),a="";Object.keys(t).filter(function(y){return y!=="main"}).forEach(function(y){for(var m=0;t[y][m];)m++;t[y].push(m),l[y][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",a=a+"var "+y+" = ("+k.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+t[y].map(function(C){return""+JSON.stringify(C)+": "+l[y][C].toString()}).join(",")+`});
`}),a=a+"new (("+k.toString().replace("ENTRY_MODULE",JSON.stringify(u))+")({"+t.main.map(function(y){return""+JSON.stringify(y)+": "+l.main[y].toString()}).join(",")+"}))(self);";var i=new window.Blob([a],{type:"text/javascript"});if(s.bare)return i;var r=window.URL||window.webkitURL||window.mozURL||window.msURL,h=r.createObjectURL(i),d=new window.Worker(h);return d.objectURL=h,d}},"./src/config.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"hlsDefaultConfig",function(){return T}),D.d(L,"mergeConfig",function(){return E}),D.d(L,"enableStreamingMode",function(){return w});var k=D("./src/controller/abr-controller.ts"),M=D("./src/controller/audio-stream-controller.ts"),f=D("./src/controller/audio-track-controller.ts"),S=D("./src/controller/subtitle-stream-controller.ts"),_=D("./src/controller/subtitle-track-controller.ts"),p=D("./src/controller/buffer-controller.ts"),c=D("./src/controller/timeline-controller.ts"),o=D("./src/controller/cap-level-controller.ts"),u=D("./src/controller/fps-controller.ts"),s=D("./src/controller/eme-controller.ts"),l=D("./src/controller/cmcd-controller.ts"),t=D("./src/utils/xhr-loader.ts"),a=D("./src/utils/fetch-loader.ts"),i=D("./src/utils/cues.ts"),r=D("./src/utils/mediakeys-helper.ts"),h=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(A){for(var g=1;g<arguments.length;g++){var P=arguments[g];for(var O in P)Object.prototype.hasOwnProperty.call(P,O)&&(A[O]=P[O])}return A},d.apply(this,arguments)}function y(A,g){var P=Object.keys(A);if(Object.getOwnPropertySymbols){var O=Object.getOwnPropertySymbols(A);g&&(O=O.filter(function(F){return Object.getOwnPropertyDescriptor(A,F).enumerable})),P.push.apply(P,O)}return P}function m(A){for(var g=1;g<arguments.length;g++){var P=arguments[g]!=null?arguments[g]:{};g%2?y(Object(P),!0).forEach(function(O){C(A,O,P[O])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(P)):y(Object(P)).forEach(function(O){Object.defineProperty(A,O,Object.getOwnPropertyDescriptor(P,O))})}return A}function C(A,g,P){return g in A?Object.defineProperty(A,g,{value:P,enumerable:!0,configurable:!0,writable:!0}):A[g]=P,A}var T=m(m({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:t.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:k.default,bufferController:p.default,capLevelController:o.default,fpsController:u.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:r.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:S.SubtitleStreamController,subtitleTrackController:_.default,timelineController:c.TimelineController,audioStreamController:M.default,audioTrackController:f.default,emeController:s.default,cmcdController:l.default});function x(){return{cueHandler:i.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 E(A,g){if((g.liveSyncDurationCount||g.liveMaxLatencyDurationCount)&&(g.liveSyncDuration||g.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(g.liveMaxLatencyDurationCount!==void 0&&(g.liveSyncDurationCount===void 0||g.liveMaxLatencyDurationCount<=g.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(g.liveMaxLatencyDuration!==void 0&&(g.liveSyncDuration===void 0||g.liveMaxLatencyDuration<=g.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},A,g)}function w(A){var g=A.loader;if(g!==a.default&&g!==t.default)h.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),A.progressive=!1;else{var P=Object(a.fetchSupported)();P&&(A.loader=a.default,A.progressive=!0,A.enableSoftwareAES=!0,h.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/polyfills/number.ts"),M=D("./src/utils/ewma-bandwidth-estimator.ts"),f=D("./src/events.ts"),S=D("./src/utils/buffer-helper.ts"),_=D("./src/errors.ts"),p=D("./src/types/loader.ts"),c=D("./src/utils/logger.ts");function o(l,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function u(l,t,a){return t&&o(l.prototype,t),a&&o(l,a),l}var s=function(){function l(a){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=a;var i=a.config;this.bwEstimator=new M.default(i.abrEwmaSlowVoD,i.abrEwmaFastVoD,i.abrEwmaDefaultEstimate),this.registerListeners()}var t=l.prototype;return t.registerListeners=function(){var i=this.hls;i.on(f.Events.FRAG_LOADING,this.onFragLoading,this),i.on(f.Events.FRAG_LOADED,this.onFragLoaded,this),i.on(f.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.on(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.on(f.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){var i=this.hls;i.off(f.Events.FRAG_LOADING,this.onFragLoading,this),i.off(f.Events.FRAG_LOADED,this.onFragLoaded,this),i.off(f.Events.FRAG_BUFFERED,this.onFragBuffered,this),i.off(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),i.off(f.Events.ERROR,this.onError,this)},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},t.onFragLoading=function(i,r){var h=r.frag;if(h.type===p.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=h,this.partCurrent=(d=r.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},t.onLevelLoaded=function(i,r){var h=this.hls.config;r.details.live?this.bwEstimator.update(h.abrEwmaSlowLive,h.abrEwmaFastLive):this.bwEstimator.update(h.abrEwmaSlowVoD,h.abrEwmaFastVoD)},t._abandonRulesCheck=function(){var i=this.fragCurrent,r=this.partCurrent,h=this.hls,d=h.autoLevelEnabled,y=h.config,m=h.media;if(!i||!m)return;var C=r?r.stats:i.stats,T=r?r.duration:i.duration;if(C.aborted){c.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||m.paused||!m.playbackRate||!m.readyState)return;var x=performance.now()-C.loading.start,E=Math.abs(m.playbackRate);if(x<=500*T/E)return;var w=h.levels,A=h.minAutoLevel,g=w[i.level],P=C.total||Math.max(C.loaded,Math.round(T*g.maxBitrate/8)),O=Math.max(1,C.bwEstimate?C.bwEstimate/8:C.loaded*1e3/x),F=(P-C.loaded)/O,X=m.currentTime,W=(S.BufferHelper.bufferInfo(m,X,y.maxBufferHole).end-X)/E;if(W>=2*T/E||F<=W)return;var N=Number.POSITIVE_INFINITY,G;for(G=i.level-1;G>A;G--){var U=w[G].maxBitrate;if(N=T*U/(8*.8*O),N<W)break}if(N>=F)return;var H=this.bwEstimator.getEstimate();c.logger.warn("Fragment "+i.sn+(r?" part "+r.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+G+`
Current BW estimate: `+(Object(k.isFiniteNumber)(H)?(H/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+F.toFixed(3)+` s
Estimated load time for the next fragment: `+N.toFixed(3)+` s
Time to underbuffer: `+W.toFixed(3)+" s"),h.nextLoadLevel=G,this.bwEstimator.sample(x,C.loaded),this.clearTimer(),i.loader&&(this.fragCurrent=this.partCurrent=null,i.loader.abort()),h.trigger(f.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:r,stats:C})},t.onFragLoaded=function(i,r){var h=r.frag,d=r.part;if(h.type===p.PlaylistLevelType.MAIN&&Object(k.isFiniteNumber)(h.sn)){var y=d?d.stats:h.stats,m=d?d.duration:h.duration;if(this.clearTimer(),this.lastLoadedFragLevel=h.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var C=this.hls.levels[h.level],T=(C.loaded?C.loaded.bytes:0)+y.loaded,x=(C.loaded?C.loaded.duration:0)+m;C.loaded={bytes:T,duration:x},C.realBitrate=Math.round(8*T/x)}if(h.bitrateTest){var E={stats:y,frag:h,part:d,id:h.type};this.onFragBuffered(f.Events.FRAG_BUFFERED,E),h.bitrateTest=!1}}},t.onFragBuffered=function(i,r){var h=r.frag,d=r.part,y=d?d.stats:h.stats;if(y.aborted)return;if(h.type!==p.PlaylistLevelType.MAIN||h.sn==="initSegment")return;var m=y.parsing.end-y.loading.start;this.bwEstimator.sample(m,y.loaded),y.bwEstimate=this.bwEstimator.getEstimate(),h.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},t.onError=function(i,r){switch(r.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},t.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},t.getNextABRAutoLevel=function(){var i=this.fragCurrent,r=this.partCurrent,h=this.hls,d=h.maxAutoLevel,y=h.config,m=h.minAutoLevel,C=h.media,T=r?r.duration:i?i.duration:0,x=C?C.currentTime:0,E=C&&C.playbackRate!==0?Math.abs(C.playbackRate):1,w=this.bwEstimator?this.bwEstimator.getEstimate():y.abrEwmaDefaultEstimate,A=(S.BufferHelper.bufferInfo(C,x,y.maxBufferHole).end-x)/E,g=this.findBestLevel(w,m,d,A,y.abrBandWidthFactor,y.abrBandWidthUpFactor);if(g>=0)return g;c.logger.trace((A?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var P=T?Math.min(T,y.maxStarvationDelay):y.maxStarvationDelay,O=y.abrBandWidthFactor,F=y.abrBandWidthUpFactor;if(!A){var X=this.bitrateTestDelay;if(X){var W=T?Math.min(T,y.maxLoadingDelay):y.maxLoadingDelay;P=W-X,c.logger.trace("bitrate test took "+Math.round(1e3*X)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*P)+" ms"),O=F=1}}return g=this.findBestLevel(w,m,d,A+P,O,F),Math.max(g,0)},t.findBestLevel=function(i,r,h,d,y,m){for(var C,T=this.fragCurrent,x=this.partCurrent,E=this.lastLoadedFragLevel,w=this.hls.levels,A=w[E],g=!!(A!=null&&(C=A.details)!==null&&C!==void 0&&C.live),P=A==null?void 0:A.codecSet,O=x?x.duration:T?T.duration:0,F=h;F>=r;F--){var X=w[F];if(!X||P&&X.codecSet!==P)continue;var W=X.details,N=(x?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||O,G=void 0;F<=E?G=y*i:G=m*i;var U=w[F].maxBitrate,H=U*N/G;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+F+"/"+Math.round(G)+"/"+U+"/"+N+"/"+d+"/"+H),G>U&&(!H||g&&!this.bitrateTestDelay||H<d))return F}return-1},u(l,[{key:"nextAutoLevel",get:function(){var i=this._nextAutoLevel,r=this.bwEstimator;if(i!==-1&&(!r||!r.canEstimate()))return i;var h=this.getNextABRAutoLevel();return i!==-1&&(h=Math.min(i,h)),h},set:function(i){this._nextAutoLevel=i}}]),l}();L.default=s},"./src/controller/audio-stream-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),f=D("./src/events.ts"),S=D("./src/utils/buffer-helper.ts"),_=D("./src/controller/fragment-tracker.ts"),p=D("./src/types/level.ts"),c=D("./src/types/loader.ts"),o=D("./src/loader/fragment.ts"),u=D("./src/demux/chunk-cache.ts"),s=D("./src/demux/transmuxer-interface.ts"),l=D("./src/types/transmuxer.ts"),t=D("./src/controller/fragment-finders.ts"),a=D("./src/utils/discontinuities.ts"),i=D("./src/errors.ts"),r=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(T){for(var x=1;x<arguments.length;x++){var E=arguments[x];for(var w in E)Object.prototype.hasOwnProperty.call(E,w)&&(T[w]=E[w])}return T},h.apply(this,arguments)}function d(T,x){T.prototype=Object.create(x.prototype),T.prototype.constructor=T,y(T,x)}function y(T,x){return y=Object.setPrototypeOf||function(w,A){return w.__proto__=A,w},y(T,x)}var m=100,C=function(T){d(x,T);function x(w,A){var g;return g=T.call(this,w,A,"[audio-stream-controller]")||this,g.videoBuffer=null,g.videoTrackCC=-1,g.waitingVideoCC=-1,g.audioSwitch=!1,g.trackId=-1,g.waitingData=null,g.mainDetails=null,g.bufferFlushed=!1,g._registerListeners(),g}var E=x.prototype;return E.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},E._registerListeners=function(){var A=this.hls;A.on(f.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(f.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(f.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(f.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),A.on(f.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.on(f.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),A.on(f.Events.ERROR,this.onError,this),A.on(f.Events.BUFFER_RESET,this.onBufferReset,this),A.on(f.Events.BUFFER_CREATED,this.onBufferCreated,this),A.on(f.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.on(f.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),A.on(f.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E._unregisterListeners=function(){var A=this.hls;A.off(f.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(f.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(f.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(f.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(f.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),A.off(f.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.off(f.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),A.off(f.Events.ERROR,this.onError,this),A.off(f.Events.BUFFER_RESET,this.onBufferReset,this),A.off(f.Events.BUFFER_CREATED,this.onBufferCreated,this),A.off(f.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.off(f.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),A.off(f.Events.FRAG_BUFFERED,this.onFragBuffered,this)},E.onInitPtsFound=function(A,g){var P=g.frag,O=g.id,F=g.initPTS;if(O==="main"){var X=P.cc;this.initPTS[P.cc]=F,this.log("InitPTS for cc: "+X+" found from main: "+F),this.videoTrackCC=X,this.state===M.State.WAITING_INIT_PTS&&this.tick()}},E.startLoad=function(A){if(!this.levels){this.startPosition=A,this.state=M.State.STOPPED;return}var g=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,g>0&&A===-1?(this.log("Override startPosition with lastCurrentTime @"+g.toFixed(3)),this.state=M.State.IDLE):(this.loadedmetadata=!1,this.state=M.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=A,this.tick()},E.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_TRACK:{var A,g=this.levels,P=this.trackId,O=g==null||((A=g[P])===null||A===void 0)?void 0:A.details;if(O){if(this.waitForCdnTuneIn(O))break;this.state=M.State.WAITING_INIT_PTS}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var F,X=performance.now(),W=this.retryDate;(!W||X>=W||(F=this.media)!==null&&F!==void 0&&F.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=M.State.IDLE);break}case M.State.WAITING_INIT_PTS:{var N=this.waitingData;if(N){var G=N.frag,U=N.part,H=N.cache,V=N.complete;if(this.initPTS[G.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.FRAG_LOADING;var ce=H.flush(),ye={frag:G,part:U,payload:ce,networkDetails:null};this._handleFragmentLoadProgress(ye),V&&T.prototype._handleFragmentLoadComplete.call(this,ye)}else if(this.videoTrackCC!==this.waitingVideoCC)r.logger.log("Waiting fragment cc ("+G.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var Le=this.getLoadPosition(),Ze=S.BufferHelper.bufferInfo(this.mediaBuffer,Le,this.config.maxBufferHole),Ye=Object(t.fragmentWithinToleranceTest)(Ze.end,this.config.maxFragLookUpTolerance,G);Ye<0&&(r.logger.log("Waiting fragment cc ("+G.cc+") @ "+G.start+" cancelled because another fragment at "+Ze.end+" is needed"),this.clearWaitingFragment())}}else this.state=M.State.IDLE}}this.onTickEnd()},E.clearWaitingFragment=function(){var A=this.waitingData;A&&(this.fragmentTracker.removeFragment(A.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=M.State.IDLE)},E.onTickEnd=function(){var A=this.media;if(!A||!A.readyState)return;var g=this.mediaBuffer?this.mediaBuffer:A,P=g.buffered;!this.loadedmetadata&&P.length&&(this.loadedmetadata=!0),this.lastCurrentTime=A.currentTime},E.doTickIdle=function(){var A,g,P=this.hls,O=this.levels,F=this.media,X=this.trackId,W=P.config;if(!O||!O[X])return;if(!F&&(this.startFragRequested||!W.startFragPrefetch))return;var N=O[X],G=N.details;if(!G||G.live&&this.levelLastLoaded!==X||this.waitForCdnTuneIn(G)){this.state=M.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,o.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,c.PlaylistLevelType.AUDIO);if(U===null)return;var H=U.len,V=this.getMaxBufferLength(),ce=this.audioSwitch;if(H>=V&&!ce)return;if(!ce&&this._streamEnded(U,G)){P.trigger(f.Events.BUFFER_EOS,{type:"audio"}),this.state=M.State.ENDED;return}var ye=G.fragments,Le=ye[0].start,Ze=U.end;if(ce){var Ye=this.getLoadPosition();Ze=Ye,G.PTSKnown&&Ye<Le&&((U.end>Le||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),F.currentTime=Le+.05))}var Oe=this.getNextFragment(Ze,G);if(!Oe){this.bufferFlushed=!0;return}((A=Oe.decryptdata)===null||A===void 0?void 0:A.keyFormat)==="identity"&&!((g=Oe.decryptdata)!==null&&g!==void 0&&g.key)?this.loadKey(Oe,G):this.loadFragment(Oe,G,Ze)},E.getMaxBufferLength=function(){var A=T.prototype.getMaxBufferLength.call(this),g=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN);return g===null?A:Math.max(A,g.len)},E.onMediaDetaching=function(){this.videoBuffer=null,T.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(A,g){var P=g.audioTracks;this.resetTransmuxer(),this.levels=P.map(function(O){return new p.Level(O)})},E.onAudioTrackSwitching=function(A,g){var P=!!g.url;this.trackId=g.id;var O=this.fragCurrent;O!=null&&O.loader&&O.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),P?this.setInterval(m):this.resetTransmuxer(),P?(this.audioSwitch=!0,this.state=M.State.IDLE):this.state=M.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(A,g){this.mainDetails=g.details},E.onAudioTrackLoaded=function(A,g){var P,O=this.levels,F=g.details,X=g.id;if(!O){this.warn("Audio tracks were reset while loading level "+X);return}this.log("Track "+X+" loaded ["+F.startSN+","+F.endSN+"],duration:"+F.totalduration);var W=O[X],N=0;if(F.live||(P=W.details)!==null&&P!==void 0&&P.live){var G=this.mainDetails;if(F.fragments[0]||(F.deltaUpdateFailed=!0),F.deltaUpdateFailed||!G)return;!W.details&&F.hasProgramDateTime&&G.hasProgramDateTime?(Object(a.alignMediaPlaylistByPDT)(F,G),N=F.fragments[0].start):N=this.alignPlaylists(F,W.details)}W.details=F,this.levelLastLoaded=X,!this.startFragRequested&&(this.mainDetails||!F.live)&&this.setStartPosition(W.details,N),this.state===M.State.WAITING_TRACK&&!this.waitForCdnTuneIn(F)&&(this.state=M.State.IDLE),this.tick()},E._handleFragmentLoadProgress=function(A){var g,P=A.frag,O=A.part,F=A.payload,X=this.config,W=this.trackId,N=this.levels;if(!N){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+P.sn+" of level "+P.level+" will not be buffered");return}var G=N[W];console.assert(G,"Audio track is defined on fragment load progress");var U=G.details;console.assert(U,"Audio track details are defined on fragment load progress");var H=X.defaultAudioCodec||G.audioCodec||"mp4a.40.2",V=this.transmuxer;V||(V=this.transmuxer=new s.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ce=this.initPTS[P.cc],ye=(g=P.initSegment)===null||g===void 0?void 0:g.data;if(ce!==void 0){var Le=!1,Ze=O?O.index:-1,Ye=Ze!==-1,Oe=new l.ChunkMetadata(P.level,P.sn,P.stats.chunkCount,F.byteLength,Ze,Ye);V.push(F,ye,H,"",P,O,U.totalduration,Le,Oe,ce)}else{r.logger.log("Unknown video PTS for cc "+P.cc+", waiting for video PTS before demuxing audio frag "+P.sn+" of ["+U.startSN+" ,"+U.endSN+"],track "+W);var We=this.waitingData=this.waitingData||{frag:P,part:O,cache:new u.default,complete:!1},ze=We.cache;ze.push(new Uint8Array(F)),this.waitingVideoCC=this.videoTrackCC,this.state=M.State.WAITING_INIT_PTS}},E._handleFragmentLoadComplete=function(A){if(this.waitingData){this.waitingData.complete=!0;return}T.prototype._handleFragmentLoadComplete.call(this,A)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(A,g){var P=g.tracks.audio;P&&(this.mediaBuffer=P.buffer),g.tracks.video&&(this.videoBuffer=g.tracks.video.buffer)},E.onFragBuffered=function(A,g){var P=g.frag,O=g.part;if(P.type!==c.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(P)){this.warn("Fragment "+P.sn+(O?" p: "+O.index:"")+" of level "+P.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}P.sn!=="initSegment"&&(this.fragPrevious=P,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(f.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(P,O)},E.onError=function(A,g){switch(g.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,g);break;case i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==M.State.ERROR&&this.state!==M.State.STOPPED&&(this.state=g.fatal?M.State.ERROR:M.State.IDLE,this.warn(g.details+" while loading frag, switching to "+this.state+" state"));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(g.parent==="audio"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var P=!0,O=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);O&&O.len>.5&&(P=!this.reduceMaxBufferLength(O.len)),P&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,T.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},E.onBufferFlushed=function(A,g){var P=g.type;P===o.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},E._handleTransmuxComplete=function(A){var g,P="audio",O=this.hls,F=A.remuxResult,X=A.chunkMeta,W=this.getCurrentContext(X);if(!W){this.warn("The loading context changed while buffering fragment "+X.sn+" of level "+X.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(X.level);return}var N=W.frag,G=W.part,U=F.audio,H=F.text,V=F.id3,ce=F.initSegment;if(this.fragContextChanged(N))return;if(this.state=M.State.PARSING,this.audioSwitch&&U&&this.completeAudioSwitch(),ce!=null&&ce.tracks&&(this._bufferInitSegment(ce.tracks,N,X),O.trigger(f.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:P,tracks:ce.tracks})),U){var ye=U.startPTS,Le=U.endPTS,Ze=U.startDTS,Ye=U.endDTS;G&&(G.elementaryStreams[o.ElementaryStreamTypes.AUDIO]={startPTS:ye,endPTS:Le,startDTS:Ze,endDTS:Ye}),N.setElementaryStreamInfo(o.ElementaryStreamTypes.AUDIO,ye,Le,Ze,Ye),this.bufferFragmentData(U,N,G,X)}if(V!=null&&(g=V.samples)!==null&&g!==void 0&&g.length){var Oe=h({frag:N,id:P},V);O.trigger(f.Events.FRAG_PARSING_METADATA,Oe)}if(H){var We=h({frag:N,id:P},H);O.trigger(f.Events.FRAG_PARSING_USERDATA,We)}},E._bufferInitSegment=function(A,g,P){if(this.state!==M.State.PARSING)return;A.video&&delete A.video;var O=A.audio;if(!O)return;O.levelCodec=O.codec,O.id="audio",this.log("Init audio buffer, container:"+O.container+", codecs[parsed]=["+O.codec+"]"),this.hls.trigger(f.Events.BUFFER_CODECS,A);var F=O.initSegment;if(F!=null&&F.byteLength){var X={type:"audio",frag:g,part:null,chunkMeta:P,parent:g.type,data:F};this.hls.trigger(f.Events.BUFFER_APPENDING,X)}this.tick()},E.loadFragment=function(A,g,P){var O=this.fragmentTracker.getState(A);this.fragCurrent=A,(this.audioSwitch||O===_.FragmentState.NOT_LOADED||O===_.FragmentState.PARTIAL)&&(A.sn==="initSegment"?this._loadInitSegment(A):g.live&&!Object(k.isFiniteNumber)(this.initPTS[A.cc])?(this.log("Waiting for video PTS in continuity counter "+A.cc+" of live stream before loading audio fragment "+A.sn+" of level "+this.trackId),this.state=M.State.WAITING_INIT_PTS):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,A,g,P)))},E.completeAudioSwitch=function(){var A=this.hls,g=this.media,P=this.trackId;g&&(this.log("Switching audio track : flushing all audio"),T.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,A.trigger(f.Events.AUDIO_TRACK_SWITCHED,{id:P})},x}(M.default);L.default=C},"./src/controller/audio-track-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts"),M=D("./src/errors.ts"),f=D("./src/controller/base-playlist-controller.ts"),S=D("./src/types/loader.ts");function _(s,l){for(var t=0;t<l.length;t++){var a=l[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(s,a.key,a)}}function p(s,l,t){return l&&_(s.prototype,l),t&&_(s,t),s}function c(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,o(s,l)}function o(s,l){return o=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},o(s,l)}var u=function(s){c(l,s);function l(a){var i;return i=s.call(this,a,"[audio-track-controller]")||this,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.trackName="",i.selectDefaultTrack=!0,i.registerListeners(),i}var t=l.prototype;return t.registerListeners=function(){var i=this.hls;i.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.on(k.Events.ERROR,this.onError,this)},t.unregisterListeners=function(){var i=this.hls;i.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(k.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),i.off(k.Events.ERROR,this.onError,this)},t.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,s.prototype.destroy.call(this)},t.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},t.onManifestParsed=function(i,r){this.tracks=r.audioTracks||[]},t.onAudioTrackLoaded=function(i,r){var h=r.id,d=r.details,y=this.tracksInGroup[h];if(!y){this.warn("Invalid audio track id "+h);return}var m=y.details;y.details=r.details,this.log("audioTrack "+h+" loaded ["+d.startSN+"-"+d.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,r,m))},t.onLevelLoading=function(i,r){this.switchLevel(r.level)},t.onLevelSwitching=function(i,r){this.switchLevel(r.level)},t.switchLevel=function(i){var r=this.hls.levels[i];if(!(r!=null&&r.audioGroupIds))return;var h=r.audioGroupIds[r.urlId];if(this.groupId!==h){this.groupId=h;var d=this.tracks.filter(function(m){return!h||m.groupId===h});this.selectDefaultTrack&&!d.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var y={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(k.Events.AUDIO_TRACKS_UPDATED,y),this.selectInitialTrack()}},t.onError=function(i,r){if(s.prototype.onError.call(this,i,r),r.fatal||!r.context)return;r.context.type===S.PlaylistContextType.AUDIO_TRACK&&r.context.id===this.trackId&&r.context.groupId===this.groupId&&this.retryLoadingOrFail(r)},t.setAudioTrack=function(i){var r=this.tracksInGroup;if(i<0||i>=r.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var h=r[this.trackId];this.log("Now switching to audio-track index "+i);var d=r[i],y=d.id,m=d.groupId,C=m===void 0?"":m,T=d.name,x=d.type,E=d.url;if(this.trackId=i,this.trackName=T,this.selectDefaultTrack=!1,this.hls.trigger(k.Events.AUDIO_TRACK_SWITCHING,{id:y,groupId:C,name:T,type:x,url:E}),d.details&&!d.details.live)return;var w=this.switchParams(d.url,h==null?void 0:h.details);this.loadPlaylist(w)},t.selectInitialTrack=function(){var i=this.tracksInGroup;console.assert(i.length,"Initial audio track should be selected when tracks are known");var r=this.trackName,h=this.findTrackId(r)||this.findTrackId();h!==-1?this.setAudioTrack(h):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},t.findTrackId=function(i){for(var r=this.tracksInGroup,h=0;h<r.length;h++){var d=r[h];if((!this.selectDefaultTrack||d.default)&&(!i||i===d.name))return d.id}return-1},t.loadPlaylist=function(i){var r=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(r)){var h=r.id,d=r.groupId,y=r.url;if(i)try{y=i.addDirectives(y)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("loading audio-track playlist for id: "+h),this.clearTimer(),this.hls.trigger(k.Events.AUDIO_TRACK_LOADING,{url:y,id:h,groupId:d,deliveryDirectives:i||null})}},p(l,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1,this.setAudioTrack(i)}}]),l}(f.default);L.default=u},"./src/controller/base-playlist-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return p});var k=D("./src/polyfills/number.ts"),M=D("./src/types/level.ts"),f=D("./src/controller/level-helper.ts"),S=D("./src/utils/logger.ts"),_=D("./src/errors.ts"),p=function(){function c(u,s){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=S.logger.log.bind(S.logger,s+":"),this.warn=S.logger.warn.bind(S.logger,s+":"),this.hls=u}var o=c.prototype;return o.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},o.onError=function(s,l){l.fatal&&l.type===_.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},o.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},o.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},o.stopLoad=function(){this.canLoad=!1,this.clearTimer()},o.switchParams=function(s,l){var t=l==null?void 0:l.renditionReports;if(t)for(var a=0;a<t.length;a++){var i=t[a],r=""+i.URI;if(r===s.substr(-r.length)){var h=parseInt(i["LAST-MSN"]),d=parseInt(i["LAST-PART"]);if(l&&this.hls.config.lowLatencyMode){var y=Math.min(l.age-l.partTarget,l.targetduration);d!==void 0&&y>l.partTarget&&(d+=1)}if(Object(k.isFiniteNumber)(h))return new M.HlsUrlParameters(h,Object(k.isFiniteNumber)(d)?d:void 0,M.HlsSkip.No)}}},o.loadPlaylist=function(s){},o.shouldLoadTrack=function(s){return this.canLoad&&s&&!!s.url&&(!s.details||s.details.live)},o.playlistLoaded=function(s,l,t){var a=this,i=l.details,r=l.stats,h=r.loading.end?Math.max(0,self.performance.now()-r.loading.end):0;if(i.advancedDateTime=Date.now()-h,i.live||t!=null&&t.live){if(i.reloaded(t),t&&this.log("live playlist "+s+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),t&&i.fragments.length>0&&Object(f.mergeDetails)(t,i),!this.canLoad||!i.live)return;var d,y=void 0,m=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var C=this.hls.config.lowLatencyMode,T=i.lastPartSn,x=i.endSN,E=i.lastPartIndex,w=E!==-1,A=T===x,g=C?0:E;w?(y=A?x+1:T,m=A?g:E+1):y=x+1;var P=i.age,O=P+i.ageHeader,F=Math.min(O-i.partTarget,i.targetduration*1.5);if(F>0){if(t&&F>t.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+t.tuneInGoal+" to: "+F+" with playlist age: "+i.age),F=0;else{var X=Math.floor(F/i.targetduration);if(y+=X,m!==void 0){var W=Math.round(F%i.targetduration/i.partTarget);m+=W}this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+P.toFixed(2)+"s goal: "+F+" skip sn "+X+" to part "+m)}i.tuneInGoal=F}if(d=this.getDeliveryDirectives(i,l.deliveryDirectives,y,m),C||!A){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(i,l.deliveryDirectives,y,m);var N=Object(f.computeReloadInterval)(i,r);y!==void 0&&i.canBlockReload&&(N-=i.partTarget||1),this.log("reload live playlist "+s+" in "+Math.round(N)+" ms"),this.timer=self.setTimeout(function(){return a.loadPlaylist(d)},N)}else this.clearTimer()},o.getDeliveryDirectives=function(s,l,t,a){var i=Object(M.getSkipValue)(s,t);return l!=null&&l.skip&&s.deltaUpdateFailed&&(t=l.msn,a=l.part,i=M.HlsSkip.No),new M.HlsUrlParameters(t,a,i)},o.retryLoadingOrFail=function(s){var l=this,t=this.hls.config,a=this.retryCount<t.levelLoadingMaxRetry;if(a){var i;if(this.retryCount++,s.details.indexOf("LoadTimeOut")>-1&&(i=s.context)!==null&&i!==void 0&&i.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+s.details+'"'),this.loadPlaylist();else{var r=Math.min(Math.pow(2,this.retryCount)*t.levelLoadingRetryDelay,t.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return l.loadPlaylist()},r),this.warn("retry playlist loading #"+this.retryCount+" in "+r+' ms after "'+s.details+'"')}}else this.warn('cannot recover from error "'+s.details+'"'),this.clearTimer(),s.fatal=!0;return a},c}()},"./src/controller/base-stream-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"State",function(){return x}),D.d(L,"default",function(){return E});var k=D("./src/polyfills/number.ts"),M=D("./src/task-loop.ts"),f=D("./src/controller/fragment-tracker.ts"),S=D("./src/utils/buffer-helper.ts"),_=D("./src/utils/logger.ts"),p=D("./src/events.ts"),c=D("./src/errors.ts"),o=D("./src/types/transmuxer.ts"),u=D("./src/utils/mp4-tools.ts"),s=D("./src/utils/discontinuities.ts"),l=D("./src/controller/fragment-finders.ts"),t=D("./src/controller/level-helper.ts"),a=D("./src/loader/fragment-loader.ts"),i=D("./src/crypt/decrypter.ts"),r=D("./src/utils/time-ranges.ts"),h=D("./src/types/loader.ts");function d(w,A){for(var g=0;g<A.length;g++){var P=A[g];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(w,P.key,P)}}function y(w,A,g){return A&&d(w.prototype,A),g&&d(w,g),w}function m(w){if(w===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return w}function C(w,A){w.prototype=Object.create(A.prototype),w.prototype.constructor=w,T(w,A)}function T(w,A){return T=Object.setPrototypeOf||function(P,O){return P.__proto__=O,P},T(w,A)}var x={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"},E=function(w){C(A,w);function A(P,O,F){var X;return X=w.call(this)||this,X.hls=void 0,X.fragPrevious=null,X.fragCurrent=null,X.fragmentTracker=void 0,X.transmuxer=null,X._state=x.STOPPED,X.media=void 0,X.mediaBuffer=void 0,X.config=void 0,X.bitrateTest=!1,X.lastCurrentTime=0,X.nextLoadPosition=0,X.startPosition=0,X.loadedmetadata=!1,X.fragLoadError=0,X.retryDate=0,X.levels=null,X.fragmentLoader=void 0,X.levelLastLoaded=null,X.startFragRequested=!1,X.decrypter=void 0,X.initPTS=[],X.onvseeking=null,X.onvended=null,X.logPrefix="",X.log=void 0,X.warn=void 0,X.logPrefix=F,X.log=_.logger.log.bind(_.logger,F+":"),X.warn=_.logger.warn.bind(_.logger,F+":"),X.hls=P,X.fragmentLoader=new a.default(P.config),X.fragmentTracker=O,X.config=P.config,X.decrypter=new i.default(P,P.config),P.on(p.Events.KEY_LOADED,X.onKeyLoaded,m(X)),X}var g=A.prototype;return g.doTick=function(){this.onTickEnd()},g.onTickEnd=function(){},g.startLoad=function(O){},g.stopLoad=function(){this.fragmentLoader.abort();var O=this.fragCurrent;O&&this.fragmentTracker.removeFragment(O),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},g._streamEnded=function(O,F){var X=this.fragCurrent,W=this.fragmentTracker;if(!F.live&&X&&X.sn===F.endSN&&!O.nextStart){var N=W.getState(X);return N===f.FragmentState.PARTIAL||N===f.FragmentState.OK}return!1},g.onMediaAttached=function(O,F){var X=this.media=this.mediaBuffer=F.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),X.addEventListener("seeking",this.onvseeking),X.addEventListener("ended",this.onvended);var W=this.config;this.levels&&W.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(W.startPosition)},g.onMediaDetaching=function(){var O=this.media;O!=null&&O.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),O&&(O.removeEventListener("seeking",this.onvseeking),O.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},g.onMediaSeeking=function(){var O=this.config,F=this.fragCurrent,X=this.media,W=this.mediaBuffer,N=this.state,G=X?X.currentTime:0,U=S.BufferHelper.bufferInfo(W||X,G,O.maxBufferHole);if(this.log("media seeking to "+(Object(k.isFiniteNumber)(G)?G.toFixed(3):G)+", state: "+N),N===x.ENDED)this.resetLoadingState();else if(F&&!U.len){var H=O.maxFragLookUpTolerance,V=F.start-H,ce=F.start+F.duration+H,ye=G>ce;(G<V||ye)&&(ye&&F.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),F.loader.abort()),this.resetLoadingState())}X&&(this.lastCurrentTime=G),!this.loadedmetadata&&!U.len&&(this.nextLoadPosition=this.startPosition=G),this.tickImmediate()},g.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},g.onKeyLoaded=function(O,F){if(this.state!==x.KEY_LOADING||F.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var X=this.levels[F.frag.level].details;X&&this.loadFragment(F.frag,X,F.frag.start)},g.onHandlerDestroying=function(){this.stopLoad(),w.prototype.onHandlerDestroying.call(this)},g.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(p.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,w.prototype.onHandlerDestroyed.call(this)},g.loadKey=function(O,F){this.log("Loading key for "+O.sn+" of ["+F.startSN+"-"+F.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+O.level),this.state=x.KEY_LOADING,this.fragCurrent=O,this.hls.trigger(p.Events.KEY_LOADING,{frag:O})},g.loadFragment=function(O,F,X){this._loadFragForPlayback(O,F,X)},g._loadFragForPlayback=function(O,F,X){var W=this,N=function(U){if(W.fragContextChanged(O)){W.warn("Fragment "+O.sn+(U.part?" p: "+U.part.index:"")+" of level "+O.level+" was dropped during download."),W.fragmentTracker.removeFragment(O);return}O.stats.chunkCount++,W._handleFragmentLoadProgress(U)};this._doFragLoad(O,F,X,N).then(function(G){if(!G)return;W.fragLoadError=0;var U=W.state;if(W.fragContextChanged(O)){(U===x.FRAG_LOADING||U===x.BACKTRACKING||!W.fragCurrent&&U===x.PARSING)&&(W.fragmentTracker.removeFragment(O),W.state=x.IDLE);return}if("payload"in G&&(W.log("Loaded fragment "+O.sn+" of level "+O.level),W.hls.trigger(p.Events.FRAG_LOADED,G),W.state===x.BACKTRACKING)){W.fragmentTracker.backtrack(O,G),W.resetFragmentLoading(O);return}W._handleFragmentLoadComplete(G)}).catch(function(G){W.warn(G),W.resetFragmentLoading(O)})},g.flushMainBuffer=function(O,F,X){if(X===void 0&&(X=null),!(O-F))return;var W={startOffset:O,endOffset:F,type:X};this.fragLoadError=0,this.hls.trigger(p.Events.BUFFER_FLUSHING,W)},g._loadInitSegment=function(O){var F=this;this._doFragLoad(O).then(function(X){if(!X||F.fragContextChanged(O)||!F.levels)throw new Error("init load aborted");return X}).then(function(X){var W=F.hls,N=X.payload,G=O.decryptdata;if(N&&N.byteLength>0&&G&&G.key&&G.iv&&G.method==="AES-128"){var U=self.performance.now();return F.decrypter.webCryptoDecrypt(new Uint8Array(N),G.key.buffer,G.iv.buffer).then(function(H){var V=self.performance.now();return W.trigger(p.Events.FRAG_DECRYPTED,{frag:O,payload:H,stats:{tstart:U,tdecrypt:V}}),X.payload=H,X})}return X}).then(function(X){var W=F.fragCurrent,N=F.hls,G=F.levels;if(!G)throw new Error("init load aborted, missing levels");var U=G[O.level].details;console.assert(U,"Level details are defined when init segment is loaded");var H=O.stats;F.state=x.IDLE,F.fragLoadError=0,O.data=new Uint8Array(X.payload),H.parsing.start=H.buffering.start=self.performance.now(),H.parsing.end=H.buffering.end=self.performance.now(),X.frag===W&&N.trigger(p.Events.FRAG_BUFFERED,{stats:H,frag:W,part:null,id:O.type}),F.tick()}).catch(function(X){F.warn(X),F.resetFragmentLoading(O)})},g.fragContextChanged=function(O){var F=this.fragCurrent;return!O||!F||O.level!==F.level||O.sn!==F.sn||O.urlId!==F.urlId},g.fragBufferedComplete=function(O,F){var X=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+O.type+" sn: "+O.sn+(F?" part: "+F.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+O.level+" "+r.default.toString(S.BufferHelper.getBuffered(X))),this.state=x.IDLE,this.tick()},g._handleFragmentLoadComplete=function(O){var F=this.transmuxer;if(!F)return;var X=O.frag,W=O.part,N=O.partsLoaded,G=!N||N.length===0||N.some(function(H){return!H}),U=new o.ChunkMetadata(X.level,X.sn,X.stats.chunkCount+1,0,W?W.index:-1,!G);F.flush(U)},g._handleFragmentLoadProgress=function(O){},g._doFragLoad=function(O,F,X,W){var N=this;if(X===void 0&&(X=null),!this.levels)throw new Error("frag load aborted, missing levels");if(X=Math.max(O.start,X||0),this.config.lowLatencyMode&&F){var G=F.partList;if(G&&W){X>O.end&&F.fragmentHint&&(O=F.fragmentHint);var U=this.getNextPart(G,O,X);if(U>-1){var H=G[U];return this.log("Loading part sn: "+O.sn+" p: "+H.index+" cc: "+O.cc+" of playlist ["+F.startSN+"-"+F.endSN+"] parts [0-"+U+"-"+(G.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+O.level+", target: "+parseFloat(X.toFixed(3))),this.nextLoadPosition=H.start+H.duration,this.state=x.FRAG_LOADING,this.hls.trigger(p.Events.FRAG_LOADING,{frag:O,part:G[U],targetBufferTime:X}),this.doFragPartsLoad(O,G,U,W).catch(function(V){return N.handleFragLoadError(V)})}else if(!O.url||this.loadedEndOfParts(G,X))return Promise.resolve(null)}}return this.log("Loading fragment "+O.sn+" cc: "+O.cc+" "+(F?"of ["+F.startSN+"-"+F.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+O.level+", target: "+parseFloat(X.toFixed(3))),Object(k.isFiniteNumber)(O.sn)&&!this.bitrateTest&&(this.nextLoadPosition=O.start+O.duration),this.state=x.FRAG_LOADING,this.hls.trigger(p.Events.FRAG_LOADING,{frag:O,targetBufferTime:X}),this.fragmentLoader.load(O,W).catch(function(V){return N.handleFragLoadError(V)})},g.doFragPartsLoad=function(O,F,X,W){var N=this;return new Promise(function(G,U){var H=[],V=function ce(ye){var Le=F[ye];N.fragmentLoader.loadPart(O,Le,W).then(function(Ze){H[Le.index]=Ze;var Ye=Ze.part;N.hls.trigger(p.Events.FRAG_LOADED,Ze);var Oe=F[ye+1];if(Oe&&Oe.fragment===O)ce(ye+1);else return G({frag:O,part:Ye,partsLoaded:H})}).catch(U)};V(X)})},g.handleFragLoadError=function(O){var F=O.data;return F&&F.details===c.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(F.frag,F.part):this.hls.trigger(p.Events.ERROR,F),null},g._handleTransmuxerFlush=function(O){var F=this.getCurrentContext(O);if(!F||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var X=F.frag,W=F.part,N=F.level,G=self.performance.now();X.stats.parsing.end=G,W&&(W.stats.parsing.end=G),this.updateLevelTiming(X,W,N,O.partial)},g.getCurrentContext=function(O){var F=this.levels,X=O.level,W=O.sn,N=O.part;if(!F||!F[X])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+X+". The current chunk will not be buffered."),null;var G=F[X],U=N>-1?Object(t.getPartWith)(G,W,N):null,H=U?U.fragment:Object(t.getFragmentWithSN)(G,W,this.fragCurrent);return H?{frag:H,part:U,level:G}:null},g.bufferFragmentData=function(O,F,X,W){if(!O||this.state!==x.PARSING)return;var N=O.data1,G=O.data2,U=N;if(N&&G&&(U=Object(u.appendUint8Array)(N,G)),!U||!U.length)return;var H={type:O.type,frag:F,part:X,chunkMeta:W,parent:F.type,data:U};this.hls.trigger(p.Events.BUFFER_APPENDING,H),O.dropped&&O.independent&&!X&&this.flushBufferGap(F)},g.flushBufferGap=function(O){var F=this.media;if(!F)return;if(!S.BufferHelper.isBuffered(F,F.currentTime)){this.flushMainBuffer(0,O.start);return}var X=F.currentTime,W=S.BufferHelper.bufferInfo(F,X,0),N=O.duration,G=Math.min(this.config.maxFragLookUpTolerance*2,N*.25),U=Math.max(Math.min(O.start-G,W.end-G),X+G);O.start-U>G&&this.flushMainBuffer(U,O.start)},g.getFwdBufferInfo=function(O,F){var X=this.config,W=this.getLoadPosition();if(!Object(k.isFiniteNumber)(W))return null;var N=S.BufferHelper.bufferInfo(O,W,X.maxBufferHole);if(N.len===0&&N.nextStart!==void 0){var G=this.fragmentTracker.getBufferedFrag(W,F);if(G&&N.nextStart<G.end)return S.BufferHelper.bufferInfo(O,W,Math.max(N.nextStart,X.maxBufferHole))}return N},g.getMaxBufferLength=function(O){var F=this.config,X;return O?X=Math.max(8*F.maxBufferSize/O,F.maxBufferLength):X=F.maxBufferLength,Math.min(X,F.maxMaxBufferLength)},g.reduceMaxBufferLength=function(O){var F=this.config,X=O||F.maxBufferLength;return F.maxMaxBufferLength>=X?(F.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+F.maxMaxBufferLength+"s"),!0):!1},g.getNextFragment=function(O,F){var X,W,N=F.fragments,G=N.length;if(!G)return null;var U=this.config,H=N[0].start,V;if(F.live){var ce=U.initialLiveManifestSize;if(G<ce)return this.warn("Not enough fragments to start playback (have: "+G+", need: "+ce+")"),null;!F.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(V=this.getInitialLiveFragment(F,N),this.startPosition=V?this.hls.liveSyncPosition||V.start:O)}else O<=H&&(V=N[0]);if(!V){var ye=U.lowLatencyMode?F.partEnd:F.fragmentEnd;V=this.getFragmentAtPosition(O,ye,F)}return(X=V)!==null&&X!==void 0&&X.initSegment&&!((W=V)!==null&&W!==void 0&&W.initSegment.data)&&!this.bitrateTest&&(V=V.initSegment),V},g.getNextPart=function(O,F,X){for(var W=-1,N=!1,G=!0,U=0,H=O.length;U<H;U++){var V=O[U];if(G=G&&!V.independent,W>-1&&X<V.start)break;var ce=V.loaded;!ce&&(N||V.independent||G)&&V.fragment===F&&(W=U),N=ce}return W},g.loadedEndOfParts=function(O,F){var X=O[O.length-1];return X&&F>X.start&&X.loaded},g.getInitialLiveFragment=function(O,F){var X=this.fragPrevious,W=null;if(X){if(O.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+X.programDateTime),W=Object(l.findFragmentByPDT)(F,X.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var N=X.sn+1;if(N>=O.startSN&&N<=O.endSN){var G=F[N-O.startSN];X.cc===G.cc&&(W=G,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(l.findFragWithCC)(F,X.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var U=this.hls.liveSyncPosition;U!==null&&(W=this.getFragmentAtPosition(U,this.bitrateTest?O.fragmentEnd:O.edge,O))}return W},g.getFragmentAtPosition=function(O,F,X){var W=this.config,N=this.fragPrevious,G=X.fragments,U=X.endSN,H=X.fragmentHint,V=W.maxFragLookUpTolerance,ce=!!(W.lowLatencyMode&&X.partList&&H);ce&&H&&!this.bitrateTest&&(G=G.concat(H),U=H.sn);var ye;if(O<F){var Le=O>F-V?0:V;ye=Object(l.findFragmentByPTS)(N,G,O,Le)}else ye=G[G.length-1];if(ye){var Ze=ye.sn-X.startSN,Ye=N&&ye.level===N.level,Oe=G[Ze+1],We=this.fragmentTracker.getState(ye);if(We===f.FragmentState.BACKTRACKED){ye=null;for(var ze=Ze;G[ze]&&this.fragmentTracker.getState(G[ze])===f.FragmentState.BACKTRACKED;)N?ye=G[ze--]:ye=G[--ze];ye||(ye=Oe)}else N&&ye.sn===N.sn&&!ce&&(Ye&&(ye.sn<U&&this.fragmentTracker.getState(Oe)!==f.FragmentState.OK?(this.log("SN "+ye.sn+" just loaded, load next one: "+Oe.sn),ye=Oe):ye=null))}return ye},g.synchronizeToLiveEdge=function(O){var F=this.config,X=this.media;if(!X)return;var W=this.hls.liveSyncPosition,N=X.currentTime,G=O.fragments[0].start,U=O.edge,H=N>=G-F.maxFragLookUpTolerance&&N<=U;if(W!==null&&X.duration>W&&(N<W||!H)){var V=F.liveMaxLatencyDuration!==void 0?F.liveMaxLatencyDuration:F.liveMaxLatencyDurationCount*O.targetduration;(!H&&X.readyState<4||N<U-V)&&(this.loadedmetadata||(this.nextLoadPosition=W),X.readyState&&(this.warn("Playback: "+N.toFixed(3)+" is located too far from the end of live sliding playlist: "+U+", reset currentTime to : "+W.toFixed(3)),X.currentTime=W))}},g.alignPlaylists=function(O,F){var X=this.levels,W=this.levelLastLoaded,N=this.fragPrevious,G=W!==null?X[W]:null,U=O.fragments.length;if(!U)return this.warn("No fragments in live playlist"),0;var H=O.fragments[0].start,V=!F,ce=O.alignedSliding&&Object(k.isFiniteNumber)(H);if(V||!ce&&!H){Object(s.alignStream)(N,G,O);var ye=O.fragments[0].start;return this.log("Live playlist sliding: "+ye.toFixed(2)+" start-sn: "+(F?F.startSN:"na")+"->"+O.startSN+" prev-sn: "+(N?N.sn:"na")+" fragments: "+U),ye}return H},g.waitForCdnTuneIn=function(O){var F=3;return O.live&&O.canBlockReload&&O.tuneInGoal>Math.max(O.partHoldBack,O.partTarget*F)},g.setStartPosition=function(O,F){var X=this.startPosition;if(X<F&&(X=-1),X===-1||this.lastCurrentTime===-1){var W=O.startTimeOffset;Object(k.isFiniteNumber)(W)?(X=F+W,W<0&&(X+=O.totalduration),X=Math.min(Math.max(F,X),F+O.totalduration),this.log("Start time offset "+W+" found in playlist, adjust startPosition to "+X),this.startPosition=X):O.live?X=this.hls.liveSyncPosition||F:this.startPosition=X=0,this.lastCurrentTime=X}this.nextLoadPosition=X},g.getLoadPosition=function(){var O=this.media,F=0;return this.loadedmetadata&&O?F=O.currentTime:this.nextLoadPosition&&(F=this.nextLoadPosition),F},g.handleFragLoadAborted=function(O,F){this.transmuxer&&O.sn!=="initSegment"&&O.stats.aborted&&(this.warn("Fragment "+O.sn+(F?" part"+F.index:"")+" of level "+O.level+" was aborted"),this.resetFragmentLoading(O))},g.resetFragmentLoading=function(O){(!this.fragCurrent||!this.fragContextChanged(O))&&(this.state=x.IDLE)},g.onFragmentOrKeyLoadError=function(O,F){if(F.fatal)return;var X=F.frag;if(!X||X.type!==O)return;var W=this.fragCurrent;console.assert(W&&X.sn===W.sn&&X.level===W.level&&X.urlId===W.urlId,"Frag load error must match current frag to retry");var N=this.config;if(this.fragLoadError+1<=N.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(X.level))return;var G=Math.min(Math.pow(2,this.fragLoadError)*N.fragLoadingRetryDelay,N.fragLoadingMaxRetryTimeout);this.warn("Fragment "+X.sn+" of "+O+" "+X.level+" failed to load, retrying in "+G+"ms"),this.retryDate=self.performance.now()+G,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else F.levelRetry?(O===h.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(_.logger.error(F.details+" reaches max retry, redispatch as fatal ..."),F.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},g.afterBufferFlushed=function(O,F,X){if(!O)return;var W=S.BufferHelper.getBuffered(O);this.fragmentTracker.detectEvictedFragments(F,W,X),this.state===x.ENDED&&this.resetLoadingState()},g.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},g.resetLiveStartWhenNotLoaded=function(O){if(!this.loadedmetadata){this.startFragRequested=!1;var F=this.levels?this.levels[O].details:null;if(F!=null&&F.live)return this.startPosition=-1,this.setStartPosition(F,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},g.updateLevelTiming=function(O,F,X,W){var N=this,G=X.details;console.assert(!!G,"level.details must be defined");var U=Object.keys(O.elementaryStreams).reduce(function(H,V){var ce=O.elementaryStreams[V];if(ce){var ye=ce.endPTS-ce.startPTS;if(ye<=0)return N.warn("Could not parse fragment "+O.sn+" "+V+" duration reliably ("+ye+") resetting transmuxer to fallback to playlist timing"),N.resetTransmuxer(),H||!1;var Le=W?0:Object(t.updateFragPTSDTS)(G,O,ce.startPTS,ce.endPTS,ce.startDTS,ce.endDTS);return N.hls.trigger(p.Events.LEVEL_PTS_UPDATED,{details:G,level:X,drift:Le,type:V,frag:O,start:ce.startPTS,end:ce.endPTS}),!0}return H},!1);U?(this.state=x.PARSED,this.hls.trigger(p.Events.FRAG_PARSED,{frag:O,part:F})):this.resetLoadingState()},g.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},y(A,[{key:"state",get:function(){return this._state},set:function(O){var F=this._state;F!==O&&(this._state=O,this.log(F+"->"+O))}}]),A}(M.default)},"./src/controller/buffer-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return l});var k=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),f=D("./src/utils/logger.ts"),S=D("./src/errors.ts"),_=D("./src/utils/buffer-helper.ts"),p=D("./src/utils/mediasource-helper.ts"),c=D("./src/loader/fragment.ts"),o=D("./src/controller/buffer-operation-queue.ts"),u=Object(p.getMediaSource)(),s=/([ha]vc.)(?:\.[^.,]+)+/,l=function(){function t(i){var r=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 h=r.hls,d=r.media,y=r.mediaSource;f.logger.log("[buffer-controller]: Media source opened"),d&&(r.updateMediaElementDuration(),h.trigger(M.Events.MEDIA_ATTACHED,{media:d})),y&&y.removeEventListener("sourceopen",r._onMediaSourceOpen),r.checkPendingTracks()},this._onMediaSourceClose=function(){f.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){f.logger.log("[buffer-controller]: Media source ended")},this.hls=i,this._initSourceBuffer(),this.registerListeners()}var a=t.prototype;return a.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},a.destroy=function(){this.unregisterListeners(),this.details=null},a.registerListeners=function(){var r=this.hls;r.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(M.Events.BUFFER_RESET,this.onBufferReset,this),r.on(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.on(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.on(M.Events.BUFFER_EOS,this.onBufferEos,this),r.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.on(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.on(M.Events.FRAG_PARSED,this.onFragParsed,this),r.on(M.Events.FRAG_CHANGED,this.onFragChanged,this)},a.unregisterListeners=function(){var r=this.hls;r.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),r.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(M.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(M.Events.BUFFER_RESET,this.onBufferReset,this),r.off(M.Events.BUFFER_APPENDING,this.onBufferAppending,this),r.off(M.Events.BUFFER_CODECS,this.onBufferCodecs,this),r.off(M.Events.BUFFER_EOS,this.onBufferEos,this),r.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),r.off(M.Events.LEVEL_UPDATED,this.onLevelUpdated,this),r.off(M.Events.FRAG_PARSED,this.onFragParsed,this),r.off(M.Events.FRAG_CHANGED,this.onFragChanged,this)},a._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new o.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},a.onManifestParsed=function(r,h){var d=2;(h.audio&&!h.video||!h.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,f.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},a.onMediaAttaching=function(r,h){var d=this.media=h.media;if(d&&u){var y=this.mediaSource=new u;y.addEventListener("sourceopen",this._onMediaSourceOpen),y.addEventListener("sourceended",this._onMediaSourceEnded),y.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(y),this._objectUrl=d.src}},a.onMediaDetaching=function(){var r=this.media,h=this.mediaSource,d=this._objectUrl;if(h){if(f.logger.log("[buffer-controller]: media source detaching"),h.readyState==="open")try{h.endOfStream()}catch(y){f.logger.warn("[buffer-controller]: onMediaDetaching: "+y.message+" while calling endOfStream")}this.onBufferReset(),h.removeEventListener("sourceopen",this._onMediaSourceOpen),h.removeEventListener("sourceended",this._onMediaSourceEnded),h.removeEventListener("sourceclose",this._onMediaSourceClose),r&&(d&&self.URL.revokeObjectURL(d),r.src===d?(r.removeAttribute("src"),r.load()):f.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)},a.onBufferReset=function(){var r=this;this.getSourceBufferTypes().forEach(function(h){var d=r.sourceBuffer[h];try{d&&(r.removeBufferListeners(h),r.mediaSource&&r.mediaSource.removeSourceBuffer(d),r.sourceBuffer[h]=void 0)}catch(y){f.logger.warn("[buffer-controller]: Failed to reset the "+h+" buffer",y)}}),this._initSourceBuffer()},a.onBufferCodecs=function(r,h){var d=this,y=this.getSourceBufferTypes().length;if(Object.keys(h).forEach(function(m){if(y){var C=d.tracks[m];if(C&&typeof C.buffer.changeType=="function"){var T=h[m],x=T.codec,E=T.levelCodec,w=T.container,A=(C.levelCodec||C.codec).replace(s,"$1"),g=(E||x).replace(s,"$1");if(A!==g){var P=w+";codecs="+(E||x);d.appendChangeType(m,P)}}}else d.pendingTracks[m]=h[m]}),y)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},a.appendChangeType=function(r,h){var d=this,y=this.operationQueue,m={execute:function(){var T=d.sourceBuffer[r];T&&(f.logger.log("[buffer-controller]: changing "+r+" sourceBuffer type to "+h),T.changeType(h)),y.shiftAndExecuteNext(r)},onStart:function(){},onComplete:function(){},onError:function(T){f.logger.warn("[buffer-controller]: Failed to change "+r+" SourceBuffer type",T)}};y.append(m,r)},a.onBufferAppending=function(r,h){var d=this,y=this.hls,m=this.operationQueue,C=this.tracks,T=h.data,x=h.type,E=h.frag,w=h.part,A=h.chunkMeta,g=A.buffering[x],P=self.performance.now();g.start=P;var O=E.stats.buffering,F=w?w.stats.buffering:null;O.start===0&&(O.start=P),F&&F.start===0&&(F.start=P);var X=C.audio,W=x==="audio"&&A.id===1&&(X==null?void 0:X.container)==="audio/mpeg",N={execute:function(){if(g.executeStart=self.performance.now(),W){var U=d.sourceBuffer[x];if(U){var H=E.start-U.timestampOffset;Math.abs(H)>=.1&&(f.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+E.start+" (delta: "+H+") sn: "+E.sn+")"),U.timestampOffset=E.start)}}d.appendExecutor(T,x)},onStart:function(){},onComplete:function(){var U=self.performance.now();g.executeEnd=g.end=U,O.first===0&&(O.first=U),F&&F.first===0&&(F.first=U);var H=d.sourceBuffer,V={};for(var ce in H)V[ce]=_.BufferHelper.getBuffered(H[ce]);d.appendError=0,d.hls.trigger(M.Events.BUFFER_APPENDED,{type:x,frag:E,part:w,chunkMeta:A,parent:E.type,timeRanges:V})},onError:function(U){f.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",U);var H={type:S.ErrorTypes.MEDIA_ERROR,parent:E.type,details:S.ErrorDetails.BUFFER_APPEND_ERROR,err:U,fatal:!1};U.code===DOMException.QUOTA_EXCEEDED_ERR?H.details=S.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,H.details=S.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>y.config.appendErrorMaxRetry&&(f.logger.error("[buffer-controller]: Failed "+y.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),H.fatal=!0)),y.trigger(M.Events.ERROR,H)}};m.append(N,x)},a.onBufferFlushing=function(r,h){var d=this,y=this.operationQueue,m=function(T){return{execute:d.removeExecutor.bind(d,T,h.startOffset,h.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(M.Events.BUFFER_FLUSHED,{type:T})},onError:function(E){f.logger.warn("[buffer-controller]: Failed to remove from "+T+" SourceBuffer",E)}}};h.type?y.append(m(h.type),h.type):this.getSourceBufferTypes().forEach(function(C){y.append(m(C),C)})},a.onFragParsed=function(r,h){var d=this,y=h.frag,m=h.part,C=[],T=m?m.elementaryStreams:y.elementaryStreams;T[c.ElementaryStreamTypes.AUDIOVIDEO]?C.push("audiovideo"):(T[c.ElementaryStreamTypes.AUDIO]&&C.push("audio"),T[c.ElementaryStreamTypes.VIDEO]&&C.push("video"));var x=function(){var w=self.performance.now();y.stats.buffering.end=w,m&&(m.stats.buffering.end=w);var A=m?m.stats:y.stats;d.hls.trigger(M.Events.FRAG_BUFFERED,{frag:y,part:m,stats:A,id:y.type})};C.length===0&&f.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+y.type+" level: "+y.level+" sn: "+y.sn),this.blockBuffers(x,C)},a.onFragChanged=function(r,h){this.flushBackBuffer()},a.onBufferEos=function(r,h){var d=this,y=this.getSourceBufferTypes().reduce(function(m,C){var T=d.sourceBuffer[C];return(!h.type||h.type===C)&&(T&&!T.ended&&(T.ended=!0,f.logger.log("[buffer-controller]: "+C+" sourceBuffer now EOS"))),m&&!!(!T||T.ended)},!0);y&&this.blockBuffers(function(){var m=d.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},a.onLevelUpdated=function(r,h){var d=h.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},a.flushBackBuffer=function(){var r=this.hls,h=this.details,d=this.media,y=this.sourceBuffer;if(!d||h===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var C=h.live&&r.config.liveBackBufferLength!==null?r.config.liveBackBufferLength:r.config.backBufferLength;if(!Object(k.isFiniteNumber)(C)||C<0)return;var T=d.currentTime,x=h.levelTargetDuration,E=Math.max(C,x),w=Math.floor(T/x)*x-E;m.forEach(function(A){var g=y[A];if(g){var P=_.BufferHelper.getBuffered(g);P.length>0&&w>P.start(0)&&(r.trigger(M.Events.BACK_BUFFER_REACHED,{bufferEnd:w}),h.live&&r.trigger(M.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:w}),r.trigger(M.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:w,type:A}))}})},a.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var r=this.details,h=this.hls,d=this.media,y=this.mediaSource,m=r.fragments[0].start+r.totalduration,C=d.duration,T=Object(k.isFiniteNumber)(y.duration)?y.duration:0;r.live&&h.config.liveDurationInfinity?(f.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),y.duration=Infinity,this.updateSeekableRange(r)):(m>T&&m>C||!Object(k.isFiniteNumber)(C))&&(f.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),y.duration=m)},a.updateSeekableRange=function(r){var h=this.mediaSource,d=r.fragments,y=d.length;if(y&&r.live&&h!==null&&h!==void 0&&h.setLiveSeekableRange){var m=Math.max(0,d[0].start),C=Math.max(m,m+r.totalduration);h.setLiveSeekableRange(m,C)}},a.checkPendingTracks=function(){var r=this.bufferCodecEventsExpected,h=this.operationQueue,d=this.pendingTracks,y=Object.keys(d).length;if(y&&!r||y===2){this.createSourceBuffers(d),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(M.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}m.forEach(function(C){h.executeNext(C)})}},a.createSourceBuffers=function(r){var h=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var y=0;for(var m in r)if(!h[m]){var C=r[m];if(!C)throw Error("source buffer exists for track "+m+", however track does not");var T=C.levelCodec||C.codec,x=C.container+";codecs="+T;f.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var E=h[m]=d.addSourceBuffer(x),w=m;this.addBufferListener(w,"updatestart",this._onSBUpdateStart),this.addBufferListener(w,"updateend",this._onSBUpdateEnd),this.addBufferListener(w,"error",this._onSBUpdateError),this.tracks[m]={buffer:E,codec:T,container:C.container,levelCodec:C.levelCodec,id:C.id},y++}catch(A){f.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+A.message),this.hls.trigger(M.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,mimeType:x})}}y&&this.hls.trigger(M.Events.BUFFER_CREATED,{tracks:this.tracks})},a._onSBUpdateStart=function(r){var h=this.operationQueue,d=h.current(r);d.onStart()},a._onSBUpdateEnd=function(r){var h=this.operationQueue,d=h.current(r);d.onComplete(),h.shiftAndExecuteNext(r)},a._onSBUpdateError=function(r,h){f.logger.error("[buffer-controller]: "+r+" SourceBuffer error",h),this.hls.trigger(M.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(r);d&&d.onError(h)},a.removeExecutor=function(r,h,d){var y=this.media,m=this.mediaSource,C=this.operationQueue,T=this.sourceBuffer,x=T[r];if(!y||!m||!x){f.logger.warn("[buffer-controller]: Attempting to remove from the "+r+" SourceBuffer, but it does not exist"),C.shiftAndExecuteNext(r);return}var E=Object(k.isFiniteNumber)(y.duration)?y.duration:Infinity,w=Object(k.isFiniteNumber)(m.duration)?m.duration:Infinity,A=Math.max(0,h),g=Math.min(d,E,w);g>A?(f.logger.log("[buffer-controller]: Removing ["+A+","+g+"] from the "+r+" SourceBuffer"),console.assert(!x.updating,r+" sourceBuffer must not be updating"),x.remove(A,g)):C.shiftAndExecuteNext(r)},a.appendExecutor=function(r,h){var d=this.operationQueue,y=this.sourceBuffer,m=y[h];if(!m){f.logger.warn("[buffer-controller]: Attempting to append to the "+h+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(h);return}m.ended=!1,console.assert(!m.updating,h+" sourceBuffer must not be updating"),m.appendBuffer(r)},a.blockBuffers=function(r,h){var d=this;if(h===void 0&&(h=this.getSourceBufferTypes()),!h.length){f.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(r);return}var y=this.operationQueue,m=h.map(function(C){return y.appendBlocker(C)});Promise.all(m).then(function(){r(),h.forEach(function(C){var T=d.sourceBuffer[C];(!T||!T.updating)&&y.shiftAndExecuteNext(C)})})},a.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},a.addBufferListener=function(r,h,d){var y=this.sourceBuffer[r];if(!y)return;var m=d.bind(this,r);this.listeners[r].push({event:h,listener:m}),y.addEventListener(h,m)},a.removeBufferListeners=function(r){var h=this.sourceBuffer[r];if(!h)return;this.listeners[r].forEach(function(d){h.removeEventListener(d.event,d.listener)})},t}()},"./src/controller/buffer-operation-queue.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return M});var k=D("./src/utils/logger.ts"),M=function(){function f(_){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=_}var S=f.prototype;return S.append=function(p,c){var o=this.queues[c];o.push(p),o.length===1&&this.buffers[c]&&this.executeNext(c)},S.insertAbort=function(p,c){var o=this.queues[c];o.unshift(p),this.executeNext(c)},S.appendBlocker=function(p){var c,o=new Promise(function(s){c=s}),u={execute:c,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(u,p),o},S.executeNext=function(p){var c=this.buffers,o=this.queues,u=c[p],s=o[p];if(s.length){var l=s[0];try{l.execute()}catch(t){k.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),l.onError(t),(!u||!u.updating)&&(s.shift(),this.executeNext(p))}}},S.shiftAndExecuteNext=function(p){this.queues[p].shift(),this.executeNext(p)},S.current=function(p){return this.queues[p][0]},f}()},"./src/controller/cap-level-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts");function M(_,p){for(var c=0;c<p.length;c++){var o=p[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(_,o.key,o)}}function f(_,p,c){return p&&M(_.prototype,p),c&&M(_,c),_}var S=function(){function _(c){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=c,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var p=_.prototype;return p.setStreamController=function(o){this.streamController=o},p.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},p.registerListeners=function(){var o=this.hls;o.on(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),o.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},p.unregisterListener=function(){var o=this.hls;o.off(k.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),o.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},p.onFpsDropLevelCapping=function(o,u){_.isLevelAllowed(u.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(u.droppedLevel)},p.onMediaAttaching=function(o,u){this.media=u.media instanceof HTMLVideoElement?u.media:null},p.onManifestParsed=function(o,u){var s=this.hls;this.restrictedLevels=[],this.firstLevel=u.firstLevel,s.config.capLevelToPlayerSize&&u.video&&this.startCapping()},p.onBufferCodecs=function(o,u){var s=this.hls;s.config.capLevelToPlayerSize&&u.video&&this.startCapping()},p.onMediaDetaching=function(){this.stopCapping()},p.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var o=this.hls.levels;if(o.length){var u=this.hls;u.autoLevelCapping=this.getMaxLevel(o.length-1),u.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=u.autoLevelCapping}}},p.getMaxLevel=function(o){var u=this,s=this.hls.levels;if(!s.length)return-1;var l=s.filter(function(t,a){return _.isLevelAllowed(a,u.restrictedLevels)&&a<=o});return this.clientRect=null,_.getMaxLevelByMediaSize(l,this.mediaWidth,this.mediaHeight)},p.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()},p.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},p.getDimensions=function(){if(this.clientRect)return this.clientRect;var o=this.media,u={width:0,height:0};if(o){var s=o.getBoundingClientRect();u.width=s.width,u.height=s.height,!u.width&&!u.height&&(u.width=s.right-s.left||o.width||0,u.height=s.bottom-s.top||o.height||0)}return this.clientRect=u,u},_.isLevelAllowed=function(o,u){return u===void 0&&(u=[]),u.indexOf(o)===-1},_.getMaxLevelByMediaSize=function(o,u,s){if(!o||!o.length)return-1;for(var l=function(h,d){return d?h.width!==d.width||h.height!==d.height:!0},t=o.length-1,a=0;a<o.length;a+=1){var i=o[a];if((i.width>=u||i.height>=s)&&l(i,o[a+1])){t=a;break}}return t},f(_,[{key:"mediaWidth",get:function(){return this.getDimensions().width*_.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*_.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var o=1;try{o=self.devicePixelRatio}catch(u){}return o}}]),_}();L.default=S},"./src/controller/cmcd-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return l});var k=D("./src/events.ts"),M=D("./src/types/cmcd.ts"),f=D("./src/utils/buffer-helper.ts"),S=D("./src/utils/logger.ts");function _(t,a){for(var i=0;i<a.length;i++){var r=a[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function p(t,a,i){return a&&_(t.prototype,a),i&&_(t,i),t}function c(t,a){var i=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=o(t))||a&&t&&typeof t.length=="number"){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}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 o(t,a){if(!t)return;if(typeof t=="string")return u(t,a);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return u(t,a)}function u(t,a){(a==null||a>t.length)&&(a=t.length);for(var i=0,r=new Array(a);i<a;i++)r[i]=t[i];return r}function s(){return s=Object.assign||function(t){for(var a=1;a<arguments.length;a++){var i=arguments[a];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},s.apply(this,arguments)}var l=function(){function t(i){var r=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(){r.initialized&&(r.starved=!0),r.buffering=!0},this.onPlaying=function(){r.initialized||(r.initialized=!0),r.buffering=!1},this.applyPlaylistData=function(y){try{r.apply(y,{ot:M.CMCDObjectType.MANIFEST,su:!r.initialized})}catch(m){S.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(y){try{var m=y.frag,C=r.hls.levels[m.level],T=r.getObjectType(m),x={d:m.duration*1e3,ot:T};(T===M.CMCDObjectType.VIDEO||T===M.CMCDObjectType.AUDIO||T==M.CMCDObjectType.MUXED)&&(x.br=C.bitrate/1e3,x.tb=r.getTopBandwidth(T),x.bl=r.getBufferLength(T)),r.apply(y,x)}catch(E){S.logger.warn("Could not generate segment CMCD data.",E)}},this.hls=i;var h=this.config=i.config,d=h.cmcd;d!=null&&(h.pLoader=this.createPlaylistLoader(),h.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||t.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var a=t.prototype;return a.registerListeners=function(){var r=this.hls;r.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.on(k.Events.BUFFER_CREATED,this.onBufferCreated,this)},a.unregisterListeners=function(){var r=this.hls;r.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),r.off(k.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},a.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},a.onMediaAttached=function(r,h){this.media=h.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},a.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},a.onBufferCreated=function(r,h){var d,y;this.audioBuffer=(d=h.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(y=h.tracks.video)===null||y===void 0?void 0:y.buffer},a.createData=function(){var r;return{v:M.CMCDVersion,sf:M.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(r=this.media)===null||r===void 0?void 0:r.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},a.apply=function(r,h){h===void 0&&(h={}),s(h,this.createData());var d=h.ot===M.CMCDObjectType.INIT||h.ot===M.CMCDObjectType.VIDEO||h.ot===M.CMCDObjectType.MUXED;if(this.starved&&d&&(h.bs=!0,h.su=!0,this.starved=!1),h.su==null&&(h.su=this.buffering),this.useHeaders){var y=t.toHeaders(h);if(!Object.keys(y).length)return;r.headers||(r.headers={}),s(r.headers,y)}else{var m=t.toQuery(h);if(!m)return;r.url=t.appendQueryToUri(r.url,m)}},a.getObjectType=function(r){var h=r.type;return h==="subtitle"?M.CMCDObjectType.TIMED_TEXT:r.sn==="initSegment"?M.CMCDObjectType.INIT:h==="audio"?M.CMCDObjectType.AUDIO:h==="main"?this.hls.audioTracks.length?M.CMCDObjectType.VIDEO:M.CMCDObjectType.MUXED:void 0},a.getTopBandwidth=function(r){for(var h=0,d=r===M.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,y=c(d),m;!(m=y()).done;){var C=m.value;C.bitrate>h&&(h=C.bitrate)}return h>0?h:NaN},a.getBufferLength=function(r){var h=this.hls.media,d=r===M.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!h)return NaN;var y=f.BufferHelper.bufferInfo(d,h.currentTime,this.config.maxBufferHole);return y.len*1e3},a.createPlaylistLoader=function(){var r=this.config.pLoader,h=this.applyPlaylistData,d=r||this.config.loader;return function(){function y(C){this.loader=void 0,this.loader=new d(C)}var m=y.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(T,x,E){h(T),this.loader.load(T,x,E)},p(y,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),y}()},a.createFragmentLoader=function(){var r=this.config.fLoader,h=this.applyFragmentData,d=r||this.config.loader;return function(){function y(C){this.loader=void 0,this.loader=new d(C)}var m=y.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(T,x,E){h(T),this.loader.load(T,x,E)},p(y,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),y}()},t.uuid=function(){var r=URL.createObjectURL(new Blob),h=r.toString();return URL.revokeObjectURL(r),h.substr(h.lastIndexOf("/")+1)},t.serialize=function(r){for(var h=[],d=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},y=function(W){return Math.round(W)},m=function(W){return y(W/100)*100},C=function(W){return encodeURIComponent(W)},T={br:y,d:y,bl:m,dl:m,mtp:m,nor:C,rtp:m,tb:y},x=Object.keys(r||{}).sort(),E=c(x),w;!(w=E()).done;){var A=w.value,g=r[A];if(!d(g))continue;if(A==="v"&&g===1)continue;if(A=="pr"&&g===1)continue;var P=T[A];P&&(g=P(g));var O=typeof g,F=void 0;A==="ot"||A==="sf"||A==="st"?F=A+"="+g:O==="boolean"?F=A:O==="number"?F=A+"="+g:F=A+"="+JSON.stringify(g),h.push(F)}return h.join(",")},t.toHeaders=function(r){for(var h=Object.keys(r),d={},y=["Object","Request","Session","Status"],m=[{},{},{},{}],C={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},T=0,x=h;T<x.length;T++){var E=x[T],w=C[E]!=null?C[E]:1;m[w][E]=r[E]}for(var A=0;A<m.length;A++){var g=t.serialize(m[A]);g&&(d["CMCD-"+y[A]]=g)}return d},t.toQuery=function(r){return"CMCD="+encodeURIComponent(t.serialize(r))},t.appendQueryToUri=function(r,h){if(!h)return r;var d=r.includes("?")?"&":"?";return""+r+d+h},t}()},"./src/controller/eme-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts"),M=D("./src/errors.ts"),f=D("./src/utils/logger.ts"),S=D("./src/utils/mediakeys-helper.ts");function _(l,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function p(l,t,a){return t&&_(l.prototype,t),a&&_(l,a),l}var c=3,o=function(t,a,i){var r={audioCapabilities:[],videoCapabilities:[]};return t.forEach(function(h){r.audioCapabilities.push({contentType:'audio/mp4; codecs="'+h+'"',robustness:i.audioRobustness||""})}),a.forEach(function(h){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+h+'"',robustness:i.videoRobustness||""})}),[r]},u=function(t,a,i,r){switch(t){case S.KeySystems.WIDEVINE:return o(a,i,r);default:throw new Error("Unknown key-system: "+t)}},s=function(){function l(a){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=a,this._config=a.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 t=l.prototype;return t.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},t._registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},t._unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(k.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this)},t.getLicenseServerUrl=function(i){switch(i){case S.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+i+'"')},t._attemptKeySystemAccess=function(i,r,h){var d=this,y=u(i,r,h,this._drmSystemOptions);f.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(i,y);this.mediaKeysPromise=m.then(function(C){return d._onMediaKeySystemAccessObtained(i,C)}),m.catch(function(C){f.logger.error('Failed to obtain key-system "'+i+'" access:',C)})},t._onMediaKeySystemAccessObtained=function(i,r){var h=this;f.logger.log('Access for key-system "'+i+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:r,mediaKeySystemDomain:i};this._mediaKeysList.push(d);var y=Promise.resolve().then(function(){return r.createMediaKeys()}).then(function(m){return d.mediaKeys=m,f.logger.log('Media-keys created for key-system "'+i+'"'),h._onMediaKeysCreated(),m});return y.catch(function(m){f.logger.error("Failed to create media-keys:",m)}),y},t._onMediaKeysCreated=function(){var i=this;this._mediaKeysList.forEach(function(r){r.mediaKeysSession||(r.mediaKeysSession=r.mediaKeys.createSession(),i._onNewMediaKeySession(r.mediaKeysSession))})},t._onNewMediaKeySession=function(i){var r=this;f.logger.log("New key-system session "+i.sessionId),i.addEventListener("message",function(h){r._onKeySessionMessage(i,h.message)},!1)},t._onKeySessionMessage=function(i,r){f.logger.log("Got EME message event, creating license request"),this._requestLicense(r,function(h){f.logger.log("Received license data (length: "+(h&&h.byteLength)+"), updating key-session"),i.update(h)})},t.onMediaEncrypted=function(i){var r=this;if(f.logger.log('Media is encrypted using "'+i.initDataType+'" init data type'),!this.mediaKeysPromise){f.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var h=function(y){if(!r._media)return;r._attemptSetMediaKeys(y),r._generateRequestWithPreferredKeySession(i.initDataType,i.initData)};this.mediaKeysPromise.then(h).catch(h)},t._attemptSetMediaKeys=function(i){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var r=this._mediaKeysList[0];if(!r||!r.mediaKeys){f.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}f.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(r.mediaKeys),this._hasSetMediaKeys=!0}},t._generateRequestWithPreferredKeySession=function(i,r){var h=this,d=this._mediaKeysList[0];if(!d){f.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){f.logger.warn("Key-Session already initialized but requested again");return}var y=d.mediaKeysSession;if(!y){f.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!r){f.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}f.logger.log('Generating key-session request for "'+i+'" init data type'),d.mediaKeysSessionInitialized=!0,y.generateRequest(i,r).then(function(){f.logger.debug("Key-session generation succeeded")}).catch(function(m){f.logger.error("Error generating key-session request:",m),h.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},t._createLicenseXhr=function(i,r,h){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,i,r,h);var y=this._licenseXhrSetup;if(y)try{y.call(this.hls,d,i),y=void 0}catch(m){f.logger.error(m)}try{d.readyState||d.open("POST",i,!0),y&&y.call(this.hls,d,i)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return d},t._onLicenseRequestReadyStageChange=function(i,r,h,d){switch(i.readyState){case 4:if(i.status===200){this._requestLicenseFailureCount=0,f.logger.log("License request succeeded");var y=i.response,m=this._licenseResponseCallback;if(m)try{y=m.call(this.hls,i,r)}catch(T){f.logger.error(T)}d(y)}else{if(f.logger.error("License Request XHR failed ("+r+"). Status: "+i.status+" ("+i.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c){this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var C=c-this._requestLicenseFailureCount+1;f.logger.warn("Retrying license request, "+C+" attempts left"),this._requestLicense(h,d)}break}},t._generateLicenseRequestChallenge=function(i,r){switch(i.mediaKeySystemDomain){case S.KeySystems.WIDEVINE:return r}throw new Error("unsupported key-system: "+i.mediaKeySystemDomain)},t._requestLicense=function(i,r){f.logger.log("Requesting content license for key-system");var h=this._mediaKeysList[0];if(!h){f.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(h.mediaKeySystemDomain),y=this._createLicenseXhr(d,i,r);f.logger.log("Sending license request to URL: "+d);var m=this._generateLicenseRequestChallenge(h,i);y.send(m)}catch(C){f.logger.error("Failure requesting DRM license: "+C),this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.KEY_SYSTEM_ERROR,details:M.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},t.onMediaAttached=function(i,r){if(!this._emeEnabled)return;var h=r.media;this._media=h,h.addEventListener("encrypted",this._onMediaEncrypted)},t.onMediaDetached=function(){var i=this._media,r=this._mediaKeysList;if(!i)return;i.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(r.map(function(h){if(h.mediaKeysSession)return h.mediaKeysSession.close().catch(function(){})})).then(function(){return i.setMediaKeys(null)}).catch(function(){})},t.onManifestParsed=function(i,r){if(!this._emeEnabled)return;var h=r.levels.map(function(y){return y.audioCodec}).filter(function(y){return!!y}),d=r.levels.map(function(y){return y.videoCodec}).filter(function(y){return!!y});this._attemptKeySystemAccess(S.KeySystems.WIDEVINE,h,d)},p(l,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),l}();L.default=s},"./src/controller/fps-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts"),M=D("./src/utils/logger.ts"),f=function(){function S(p){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=p,this.registerListeners()}var _=S.prototype;return _.setStreamController=function(c){this.streamController=c},_.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},_.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching)},_.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},_.onMediaAttaching=function(c,o){var u=this.hls.config;if(u.capLevelOnFPSDrop){var s=o.media instanceof self.HTMLVideoElement?o.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),u.fpsDroppedMonitoringPeriod)}},_.checkFPS=function(c,o,u){var s=performance.now();if(o){if(this.lastTime){var l=s-this.lastTime,t=u-this.lastDroppedFrames,a=o-this.lastDecodedFrames,i=1e3*t/l,r=this.hls;if(r.trigger(k.Events.FPS_DROP,{currentDropped:t,currentDecoded:a,totalDroppedFrames:u}),i>0&&t>r.config.fpsDroppedMonitoringThreshold*a){var h=r.currentLevel;M.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(r.autoLevelCapping===-1||r.autoLevelCapping>=h)&&(h=h-1,r.trigger(k.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:r.currentLevel}),r.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=u,this.lastDecodedFrames=o}},_.checkFPSInterval=function(){var c=this.media;if(c)if(this.isVideoPlaybackQualityAvailable){var o=c.getVideoPlaybackQuality();this.checkFPS(c,o.totalVideoFrames,o.droppedVideoFrames)}else this.checkFPS(c,c.webkitDecodedFrameCount,c.webkitDroppedFrameCount)},S}();L.default=f},"./src/controller/fragment-finders.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"findFragmentByPDT",function(){return f}),D.d(L,"findFragmentByPTS",function(){return S}),D.d(L,"fragmentWithinToleranceTest",function(){return _}),D.d(L,"pdtWithinToleranceTest",function(){return p}),D.d(L,"findFragWithCC",function(){return c});var k=D("./src/polyfills/number.ts"),M=D("./src/utils/binary-search.ts");function f(o,u,s){if(u===null||!Array.isArray(o)||!o.length||!Object(k.isFiniteNumber)(u))return null;var l=o[0].programDateTime;if(u<(l||0))return null;var t=o[o.length-1].endProgramDateTime;if(u>=(t||0))return null;s=s||0;for(var a=0;a<o.length;++a){var i=o[a];if(p(u,s,i))return i}return null}function S(o,u,s,l){s===void 0&&(s=0),l===void 0&&(l=0);var t=null;if(o?t=u[o.sn-u[0].sn+1]||null:s===0&&u[0].start===0&&(t=u[0]),t&&_(s,l,t)===0)return t;var a=M.default.search(u,_.bind(null,s,l));return a||t}function _(o,u,s){o===void 0&&(o=0),u===void 0&&(u=0);var l=Math.min(u,s.duration+(s.deltaPTS?s.deltaPTS:0));return s.start+s.duration-l<=o?1:s.start-l>o&&s.start?-1:0}function p(o,u,s){var l=Math.min(u,s.duration+(s.deltaPTS?s.deltaPTS:0))*1e3,t=s.endProgramDateTime||0;return t-l>o}function c(o,u){return M.default.search(o,function(s){return s.cc<u?1:s.cc>u?-1:0})}},"./src/controller/fragment-tracker.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"FragmentState",function(){return f}),D.d(L,"FragmentTracker",function(){return S});var k=D("./src/events.ts"),M=D("./src/types/loader.ts"),f;(function(c){c.NOT_LOADED="NOT_LOADED",c.BACKTRACKED="BACKTRACKED",c.APPENDING="APPENDING",c.PARTIAL="PARTIAL",c.OK="OK"})(f||(f={}));var S=function(){function c(u){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=u,this._registerListeners()}var o=c.prototype;return o._registerListeners=function(){var s=this.hls;s.on(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.on(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(k.Events.FRAG_LOADED,this.onFragLoaded,this)},o._unregisterListeners=function(){var s=this.hls;s.off(k.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.off(k.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(k.Events.FRAG_LOADED,this.onFragLoaded,this)},o.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},o.getAppendedFrag=function(s,l){if(l===M.PlaylistLevelType.MAIN){var t=this.activeFragment,a=this.activeParts;if(!t)return null;if(a)for(var i=a.length;i--;){var r=a[i],h=r?r.end:t.appendedPTS;if(r.start<=s&&h!==void 0&&s<=h)return i>9&&(this.activeParts=a.slice(i-9)),r}else if(t.start<=s&&t.appendedPTS!==void 0&&s<=t.appendedPTS)return t}return this.getBufferedFrag(s,l)},o.getBufferedFrag=function(s,l){for(var t=this.fragments,a=Object.keys(t),i=a.length;i--;){var r=t[a[i]];if((r==null?void 0:r.body.type)===l&&r.buffered){var h=r.body;if(h.start<=s&&s<=h.end)return h}}return null},o.detectEvictedFragments=function(s,l,t){var a=this;Object.keys(this.fragments).forEach(function(i){var r=a.fragments[i];if(!r)return;if(!r.buffered){r.body.type===t&&a.removeFragment(r.body);return}var h=r.range[s];if(!h)return;h.time.some(function(d){var y=!a.isTimeBuffered(d.startPTS,d.endPTS,l);return y&&a.removeFragment(r.body),y})})},o.detectPartialFragments=function(s){var l=this,t=this.timeRanges,a=s.frag,i=s.part;if(!t||a.sn==="initSegment")return;var r=p(a),h=this.fragments[r];if(!h)return;Object.keys(t).forEach(function(d){var y=a.elementaryStreams[d];if(!y)return;var m=t[d],C=i!==null||y.partial===!0;h.range[d]=l.getBufferedTimes(a,i,C,m)}),h.backtrack=h.loaded=null,Object.keys(h.range).length?h.buffered=!0:this.removeFragment(h.body)},o.fragBuffered=function(s){var l=p(s),t=this.fragments[l];t&&(t.backtrack=t.loaded=null,t.buffered=!0)},o.getBufferedTimes=function(s,l,t,a){for(var i={time:[],partial:t},r=l?l.start:s.start,h=l?l.end:s.end,d=s.minEndPTS||h,y=s.maxStartPTS||r,m=0;m<a.length;m++){var C=a.start(m)-this.bufferPadding,T=a.end(m)+this.bufferPadding;if(y>=C&&d<=T){i.time.push({startPTS:Math.max(r,a.start(m)),endPTS:Math.min(h,a.end(m))});break}else if(r<T&&h>C)i.partial=!0,i.time.push({startPTS:Math.max(r,a.start(m)),endPTS:Math.min(h,a.end(m))});else if(h<=C)break}return i},o.getPartialFragment=function(s){var l=null,t,a,i,r=0,h=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(y){var m=d[y];if(!m)return;_(m)&&(a=m.body.start-h,i=m.body.end+h,s>=a&&s<=i&&(t=Math.min(s-a,i-s),r<=t&&(l=m.body,r=t)))}),l},o.getState=function(s){var l=p(s),t=this.fragments[l];return t?t.buffered?_(t)?f.PARTIAL:f.OK:t.backtrack?f.BACKTRACKED:f.APPENDING:f.NOT_LOADED},o.backtrack=function(s,l){var t=p(s),a=this.fragments[t];if(!a||a.backtrack)return null;var i=a.backtrack=l||a.loaded;return a.loaded=null,i},o.getBacktrackData=function(s){var l=p(s),t=this.fragments[l];if(t){var a,i=t.backtrack;if(i!=null&&(a=i.payload)!==null&&a!==void 0&&a.byteLength)return i;this.removeFragment(s)}return null},o.isTimeBuffered=function(s,l,t){for(var a,i,r=0;r<t.length;r++){if(a=t.start(r)-this.bufferPadding,i=t.end(r)+this.bufferPadding,s>=a&&l<=i)return!0;if(l<=a)return!1}return!1},o.onFragLoaded=function(s,l){var t=l.frag,a=l.part;if(t.sn==="initSegment"||t.bitrateTest||a)return;var i=p(t);this.fragments[i]={body:t,loaded:l,backtrack:null,buffered:!1,range:Object.create(null)}},o.onBufferAppended=function(s,l){var t=this,a=l.frag,i=l.part,r=l.timeRanges;if(a.type===M.PlaylistLevelType.MAIN)if(this.activeFragment=a,i){var h=this.activeParts;h||(this.activeParts=h=[]),h.push(i)}else this.activeParts=null;this.timeRanges=r,Object.keys(r).forEach(function(d){var y=r[d];if(t.detectEvictedFragments(d,y),!i)for(var m=0;m<y.length;m++)a.appendedPTS=Math.max(y.end(m),a.appendedPTS||0)})},o.onFragBuffered=function(s,l){this.detectPartialFragments(l)},o.hasFragment=function(s){var l=p(s);return!!this.fragments[l]},o.removeFragmentsInRange=function(s,l,t){var a=this;Object.keys(this.fragments).forEach(function(i){var r=a.fragments[i];if(!r)return;if(r.buffered){var h=r.body;h.type===t&&h.start<l&&h.end>s&&a.removeFragment(h)}})},o.removeFragment=function(s){var l=p(s);s.stats.loaded=0,s.clearElementaryStreamInfo(),delete this.fragments[l]},o.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},c}();function _(c){var o,u;return c.buffered&&(((o=c.range.video)===null||o===void 0?void 0:o.partial)||((u=c.range.audio)===null||u===void 0?void 0:u.partial))}function p(c){return c.type+"_"+c.level+"_"+c.urlId+"_"+c.sn}},"./src/controller/gap-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"STALL_MINIMUM_DURATION_MS",function(){return _}),D.d(L,"MAX_START_GAP_JUMP",function(){return p}),D.d(L,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return c}),D.d(L,"SKIP_BUFFER_RANGE_START",function(){return o}),D.d(L,"default",function(){return u});var k=D("./src/utils/buffer-helper.ts"),M=D("./src/errors.ts"),f=D("./src/events.ts"),S=D("./src/utils/logger.ts"),_=250,p=2,c=.1,o=.05,u=function(){function s(t,a,i,r){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=t,this.media=a,this.fragmentTracker=i,this.hls=r}var l=s.prototype;return l.destroy=function(){this.hls=this.fragmentTracker=this.media=null},l.poll=function(a){var i=this.config,r=this.media,h=this.stalled,d=r.currentTime,y=r.seeking,m=this.seeking&&!y,C=!this.seeking&&y;if(this.seeking=y,d!==a){if(this.moved=!0,h!==null){if(this.stallReported){var T=self.performance.now()-h;S.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(T)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((C||m)&&(this.stalled=null),r.paused||r.ended||r.playbackRate===0||!k.BufferHelper.getBuffered(r).length)return;var x=k.BufferHelper.bufferInfo(r,d,0),E=x.len>0,w=x.nextStart||0;if(!E&&!w)return;if(y){var A=x.len>p,g=!w||w-d>p&&!this.fragmentTracker.getPartialFragment(d);if(A||g)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var P,O=Math.max(w,x.start||0)-d,F=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,X=F==null||((P=F.details)===null||P===void 0)?void 0:P.live,W=X?F.details.targetduration*2:p;if(O>0&&O<=W){this._trySkipBufferHole(null);return}}var N=self.performance.now();if(h===null){this.stalled=N;return}var G=N-h;!y&&G>=_&&this._reportStall(x.len);var U=k.BufferHelper.bufferInfo(r,d,i.maxBufferHole);this._tryFixBufferStall(U,G)},l._tryFixBufferStall=function(a,i){var r=this.config,h=this.fragmentTracker,d=this.media,y=d.currentTime,m=h.getPartialFragment(y);if(m){var C=this._trySkipBufferHole(m);if(C)return}a.len>r.maxBufferHole&&i>r.highBufferWatchdogPeriod*1e3&&(S.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},l._reportStall=function(a){var i=this.hls,r=this.media,h=this.stallReported;h||(this.stallReported=!0,S.logger.warn("Playback stalling at @"+r.currentTime+" due to low buffer (buffer="+a+")"),i.trigger(f.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:a}))},l._trySkipBufferHole=function(a){for(var i=this.config,r=this.hls,h=this.media,d=h.currentTime,y=0,m=k.BufferHelper.getBuffered(h),C=0;C<m.length;C++){var T=m.start(C);if(d+i.maxBufferHole>=y&&d<T){var x=Math.max(T+o,h.currentTime+c);return S.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+x),this.moved=!0,this.stalled=null,h.currentTime=x,a&&r.trigger(f.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+x,frag:a}),x}y=m.end(C)}return 0},l._tryNudgeBuffer=function(){var a=this.config,i=this.hls,r=this.media,h=r.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<a.nudgeMaxRetry){var y=h+d*a.nudgeOffset;S.logger.warn("Nudging 'currentTime' from "+h+" to "+y),r.currentTime=y,i.trigger(f.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else S.logger.error("Playhead still not moving while enough data buffered @"+h+" after "+a.nudgeMaxRetry+" nudges"),i.trigger(f.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},s}()},"./src/controller/id3-track-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),f=D("./src/demux/id3.ts"),S=.25,_=function(){function p(o){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=o,this._registerListeners()}var c=p.prototype;return c.destroy=function(){this._unregisterListeners()},c._registerListeners=function(){var u=this.hls;u.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),u.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c._unregisterListeners=function(){var u=this.hls;u.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(k.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),u.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c.onMediaAttached=function(u,s){this.media=s.media},c.onMediaDetaching=function(){if(!this.id3Track)return;Object(M.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},c.getID3Track=function(u){if(!this.media)return;for(var s=0;s<u.length;s++){var l=u[s];if(l.kind==="metadata"&&l.label==="id3")return Object(M.sendAddTrackEvent)(l,this.media),l}return this.media.addTextTrack("metadata","id3")},c.onFragParsingMetadata=function(u,s){if(!this.media)return;var l=s.frag,t=s.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var a=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,i=0;i<t.length;i++){var r=f.getID3Frames(t[i].data);if(r){var h=t[i].pts,d=i<t.length-1?t[i+1].pts:l.end,y=d-h;y<=0&&(d=h+S);for(var m=0;m<r.length;m++){var C=r[m];if(!f.isTimeStampFrame(C)){var T=new a(h,d,"");T.value=C,this.id3Track.addCue(T)}}}}},c.onBufferFlushing=function(u,s){var l=s.startOffset,t=s.endOffset,a=s.type;if(!a||a==="audio"){var i=this.id3Track;i&&Object(M.removeCuesInRange)(i,l,t)}},p}();L.default=_},"./src/controller/latency-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return p});var k=D("./src/errors.ts"),M=D("./src/events.ts"),f=D("./src/utils/logger.ts");function S(c,o){for(var u=0;u<o.length;u++){var s=o[u];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(c,s.key,s)}}function _(c,o,u){return o&&S(c.prototype,o),u&&S(c,u),c}var p=function(){function c(u){var s=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 s.timeupdate()},this.hls=u,this.config=u.config,this.registerListeners()}var o=c.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},o.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)},o.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)},o.onMediaAttached=function(s,l){this.media=l.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},o.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},o.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},o.onLevelUpdated=function(s,l){var t=l.details;this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},o.onError=function(s,l){if(l.details!==k.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,f.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},o.timeupdate=function(){var s=this.media,l=this.levelDetails;if(!s||!l)return;this.currentTime=s.currentTime;var t=this.computeLatency();if(t===null)return;this._latency=t;var a=this.config,i=a.lowLatencyMode,r=a.maxLiveSyncPlaybackRate;if(!i||r===1)return;var h=this.targetLatency;if(h===null)return;var d=t-h,y=Math.min(this.maxLatency,h+l.targetduration),m=d<y;if(l.live&&m&&d>.05&&this.forwardBufferLength>1){var C=Math.min(2,Math.max(1,r)),T=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;s.playbackRate=Math.min(C,Math.max(1,T))}else s.playbackRate!==1&&s.playbackRate!==0&&(s.playbackRate=1)},o.estimateLiveEdge=function(){var s=this.levelDetails;return s===null?null:s.edge+s.age},o.computeLatency=function(){var s=this.estimateLiveEdge();return s===null?null:s-this.currentTime},_(c,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var s=this.config,l=this.levelDetails;return s.liveMaxLatencyDuration!==void 0?s.liveMaxLatencyDuration:l?s.liveMaxLatencyDurationCount*l.targetduration:0}},{key:"targetLatency",get:function(){var s=this.levelDetails;if(s===null)return null;var l=s.holdBack,t=s.partHoldBack,a=s.targetduration,i=this.config,r=i.liveSyncDuration,h=i.liveSyncDurationCount,d=i.lowLatencyMode,y=this.hls.userConfig,m=d&&t||l;(y.liveSyncDuration||y.liveSyncDurationCount||m===0)&&(m=r!==void 0?r:h*a);var C=a,T=1;return m+Math.min(this.stallCount*T,C)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),l=this.targetLatency,t=this.levelDetails;if(s===null||l===null||t===null)return null;var a=t.edge,i=s-l-this.edgeStalled,r=a-t.totalduration,h=a-(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.min(Math.max(r,i),h)}},{key:"drift",get:function(){var s=this.levelDetails;return s===null?1:s.drift}},{key:"edgeStalled",get:function(){var s=this.levelDetails;if(s===null)return 0;var l=(this.config.lowLatencyMode&&s.partTarget||s.targetduration)*3;return Math.max(s.age-l,0)}},{key:"forwardBufferLength",get:function(){var s=this.media,l=this.levelDetails;if(!s||!l)return 0;var t=s.buffered.length;return t?s.buffered.end(t-1):l.edge-this.currentTime}}]),c}()},"./src/controller/level-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return i});var k=D("./src/types/level.ts"),M=D("./src/events.ts"),f=D("./src/errors.ts"),S=D("./src/utils/codecs.ts"),_=D("./src/controller/level-helper.ts"),p=D("./src/controller/base-playlist-controller.ts"),c=D("./src/types/loader.ts");function o(){return o=Object.assign||function(r){for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var y in d)Object.prototype.hasOwnProperty.call(d,y)&&(r[y]=d[y])}return r},o.apply(this,arguments)}function u(r,h){for(var d=0;d<h.length;d++){var y=h[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(r,y.key,y)}}function s(r,h,d){return h&&u(r.prototype,h),d&&u(r,d),r}function l(r,h){r.prototype=Object.create(h.prototype),r.prototype.constructor=r,t(r,h)}function t(r,h){return t=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},t(r,h)}var a=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),i=function(r){l(h,r);function h(y){var m;return m=r.call(this,y,"[level-controller]")||this,m._levels=[],m._firstLevel=-1,m._startLevel=void 0,m.currentLevelIndex=-1,m.manualLevelIndex=-1,m.onParsedComplete=void 0,m._registerListeners(),m}var d=h.prototype;return d._registerListeners=function(){var m=this.hls;m.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(M.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var m=this.hls;m.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(M.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(M.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,r.prototype.destroy.call(this)},d.startLoad=function(){var m=this._levels;m.forEach(function(C){C.loadError=0}),r.prototype.startLoad.call(this)},d.onManifestLoaded=function(m,C){var T=[],x=[],E=[],w,A={},g,P=!1,O=!1,F=!1;if(C.levels.forEach(function(G){var U=G.attrs;P=P||!!(G.width&&G.height),O=O||!!G.videoCodec,F=F||!!G.audioCodec,a&&G.audioCodec&&G.audioCodec.indexOf("mp4a.40.34")!==-1&&(G.audioCodec=void 0);var H=G.bitrate+"-"+G.attrs.RESOLUTION+"-"+G.attrs.CODECS;g=A[H],g?g.url.push(G.url):(g=new k.Level(G),A[H]=g,T.push(g)),U&&(U.AUDIO&&Object(_.addGroupId)(g,"audio",U.AUDIO),U.SUBTITLES&&Object(_.addGroupId)(g,"text",U.SUBTITLES))}),(P||O)&&F&&(T=T.filter(function(G){var U=G.videoCodec,H=G.width,V=G.height;return!!U||!!(H&&V)})),T=T.filter(function(G){var U=G.audioCodec,H=G.videoCodec;return(!U||Object(S.isCodecSupportedInMp4)(U,"audio"))&&(!H||Object(S.isCodecSupportedInMp4)(H,"video"))}),C.audioTracks&&(x=C.audioTracks.filter(function(G){return!G.audioCodec||Object(S.isCodecSupportedInMp4)(G.audioCodec,"audio")}),Object(_.assignTrackIdsByGroup)(x)),C.subtitles&&(E=C.subtitles,Object(_.assignTrackIdsByGroup)(E)),T.length>0){w=T[0].bitrate,T.sort(function(G,U){return G.bitrate-U.bitrate}),this._levels=T;for(var X=0;X<T.length;X++)if(T[X].bitrate===w){this._firstLevel=X,this.log("manifest loaded, "+T.length+" level(s) found, first bitrate: "+w);break}var W=F&&!O,N={levels:T,audioTracks:x,subtitleTracks:E,firstLevel:this._firstLevel,stats:C.stats,audio:F,video:O,altAudio:!W&&x.some(function(G){return!!G.url})};this.hls.trigger(M.Events.MANIFEST_PARSED,N),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(M.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:C.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(m,C){if(r.prototype.onError.call(this,m,C),C.fatal)return;var T=C.context,x=this._levels[this.currentLevelIndex];if(T&&(T.type===c.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&T.groupId===x.audioGroupIds[x.urlId]||T.type===c.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&T.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var E=!1,w=!0,A;switch(C.details){case f.ErrorDetails.FRAG_LOAD_ERROR:case f.ErrorDetails.FRAG_LOAD_TIMEOUT:case f.ErrorDetails.KEY_LOAD_ERROR:case f.ErrorDetails.KEY_LOAD_TIMEOUT:if(C.frag){var g=this._levels[C.frag.level];g?(g.fragmentError++,g.fragmentError>this.hls.config.fragLoadingMaxRetry&&(A=C.frag.level)):A=C.frag.level}break;case f.ErrorDetails.LEVEL_LOAD_ERROR:case f.ErrorDetails.LEVEL_LOAD_TIMEOUT:T&&(T.deliveryDirectives&&(w=!1),A=T.level),E=!0;break;case f.ErrorDetails.REMUX_ALLOC_ERROR:A=C.level,E=!0;break}A!==void 0&&this.recoverLevel(C,A,E,w)},d.recoverLevel=function(m,C,T,x){var E=m.details,w=this._levels[C];if(w.loadError++,T){var A=this.retryLoadingOrFail(m);if(A)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var g=w.url.length;if(g>1&&w.loadError<g)m.levelRetry=!0,this.redundantFailover(C);else if(this.manualLevelIndex===-1){var P=C===0?this._levels.length-1:C-1;this.currentLevelIndex!==P&&this._levels[P].loadError===0&&(this.warn(E+": switch to "+P),m.levelRetry=!0,this.hls.nextAutoLevel=P)}}},d.redundantFailover=function(m){var C=this._levels[m],T=C.url.length;if(T>1){var x=(C.urlId+1)%T;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(E){E.urlId=x}),this.level=m}},d.onFragLoaded=function(m,C){var T=C.frag;if(T!==void 0&&T.type===c.PlaylistLevelType.MAIN){var x=this._levels[T.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},d.onLevelLoaded=function(m,C){var T,x=C.level,E=C.details,w=this._levels[x];if(!w){var A;this.warn("Invalid level index "+x),(A=C.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(E.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(w.fragmentError===0&&(w.loadError=0,this.retryCount=0),this.playlistLoaded(x,C,w.details)):(T=C.deliveryDirectives)!==null&&T!==void 0&&T.skip&&(E.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(m,C){var T=this.hls.levels[this.currentLevelIndex];if(!T)return;if(T.audioGroupIds){for(var x=-1,E=this.hls.audioTracks[C.id].groupId,w=0;w<T.audioGroupIds.length;w++)if(T.audioGroupIds[w]===E){x=w;break}x!==T.urlId&&(T.urlId=x,this.startLoad())}},d.loadPlaylist=function(m){var C=this.currentLevelIndex,T=this._levels[C];if(this.canLoad&&T&&T.url.length>0){var x=T.urlId,E=T.url[x];if(m)try{E=m.addDirectives(E)}catch(w){this.warn("Could not construct new URL with HLS Delivery Directives: "+w)}this.log("Attempt loading level index "+C+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+x+" "+E),this.clearTimer(),this.hls.trigger(M.Events.LEVEL_LOADING,{url:E,level:C,id:x,deliveryDirectives:m||null})}},d.removeLevel=function(m,C){var T=function(w,A){return A!==C},x=this._levels.filter(function(E,w){return w!==m?!0:E.url.length>1&&C!==void 0?(E.url=E.url.filter(T),E.audioGroupIds&&(E.audioGroupIds=E.audioGroupIds.filter(T)),E.textGroupIds&&(E.textGroupIds=E.textGroupIds.filter(T)),E.urlId=0,!0):!1}).map(function(E,w){var A=E.details;return A!=null&&A.fragments&&A.fragments.forEach(function(g){g.level=w}),E});this._levels=x,this.hls.trigger(M.Events.LEVELS_UPDATED,{levels:x})},s(h,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(m){var C,T=this._levels;if(T.length===0)return;if(this.currentLevelIndex===m&&(C=T[m])!==null&&C!==void 0&&C.details)return;if(m<0||m>=T.length){var x=m<0;if(this.hls.trigger(M.Events.ERROR,{type:f.ErrorTypes.OTHER_ERROR,details:f.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:x,reason:"invalid level idx"}),x)return;m=Math.min(m,T.length-1)}this.clearTimer();var E=this.currentLevelIndex,w=T[E],A=T[m];this.log("switching to level "+m+" from "+E),this.currentLevelIndex=m;var g=o({},A,{level:m,maxBitrate:A.maxBitrate,uri:A.uri,urlId:A.urlId});delete g._urlId,this.hls.trigger(M.Events.LEVEL_SWITCHING,g);var P=A.details;if(!P||P.live){var O=this.switchParams(A.uri,w==null?void 0:w.details);this.loadPlaylist(O)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(m){this.manualLevelIndex=m,this._startLevel===void 0&&(this._startLevel=m),m!==-1&&(this.level=m)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(m){this._firstLevel=m}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var m=this.hls.config.startLevel;return m!==void 0?m:this._firstLevel}else return this._startLevel},set:function(m){this._startLevel=m}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(m){this.level=m,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=m)}}]),h}(p.default)},"./src/controller/level-helper.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"addGroupId",function(){return f}),D.d(L,"assignTrackIdsByGroup",function(){return S}),D.d(L,"updatePTS",function(){return _}),D.d(L,"updateFragPTSDTS",function(){return c}),D.d(L,"mergeDetails",function(){return o}),D.d(L,"mapPartIntersection",function(){return u}),D.d(L,"mapFragmentIntersection",function(){return s}),D.d(L,"adjustSliding",function(){return l}),D.d(L,"addSliding",function(){return t}),D.d(L,"computeReloadInterval",function(){return a}),D.d(L,"getFragmentWithSN",function(){return i}),D.d(L,"getPartWith",function(){return r});var k=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts");function f(h,d,y){switch(d){case"audio":h.audioGroupIds||(h.audioGroupIds=[]),h.audioGroupIds.push(y);break;case"text":h.textGroupIds||(h.textGroupIds=[]),h.textGroupIds.push(y);break}}function S(h){var d={};h.forEach(function(y){var m=y.groupId||"";y.id=d[m]=d[m]||0,d[m]++})}function _(h,d,y){var m=h[d],C=h[y];p(m,C)}function p(h,d){var y=d.startPTS;if(Object(k.isFiniteNumber)(y)){var m=0,C;d.sn>h.sn?(m=y-h.start,C=h):(m=h.start-y,C=d),C.duration!==m&&(C.duration=m)}else if(d.sn>h.sn){var T=h.cc===d.cc;T&&h.minEndPTS?d.start=h.start+(h.minEndPTS-h.start):d.start=h.start+h.duration}else d.start=Math.max(h.start-d.duration,0)}function c(h,d,y,m,C,T){var x=m-y;x<=0&&(M.logger.warn("Fragment should have a positive duration",d),m=y+d.duration,T=C+d.duration);var E=y,w=m,A=d.startPTS,g=d.endPTS;if(Object(k.isFiniteNumber)(A)){var P=Math.abs(A-y);Object(k.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(P,d.deltaPTS):d.deltaPTS=P,E=Math.max(y,A),y=Math.min(y,A),C=Math.min(C,d.startDTS),w=Math.min(m,g),m=Math.max(m,g),T=Math.max(T,d.endDTS)}d.duration=m-y;var O=y-d.start;d.appendedPTS=m,d.start=d.startPTS=y,d.maxStartPTS=E,d.startDTS=C,d.endPTS=m,d.minEndPTS=w,d.endDTS=T;var F=d.sn;if(!h||F<h.startSN||F>h.endSN)return 0;var X,W=F-h.startSN,N=h.fragments;for(N[W]=d,X=W;X>0;X--)p(N[X],N[X-1]);for(X=W;X<N.length-1;X++)p(N[X],N[X+1]);return h.fragmentHint&&p(N[N.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,O}function o(h,d){for(var y=null,m=h.fragments,C=m.length-1;C>=0;C--){var T=m[C].initSegment;if(T){y=T;break}}h.fragmentHint&&delete h.fragmentHint.endPTS;var x=0,E;if(s(h,d,function(X,W){X.relurl&&(x=X.cc-W.cc),Object(k.isFiniteNumber)(X.startPTS)&&Object(k.isFiniteNumber)(X.endPTS)&&(W.start=W.startPTS=X.startPTS,W.startDTS=X.startDTS,W.appendedPTS=X.appendedPTS,W.maxStartPTS=X.maxStartPTS,W.endPTS=X.endPTS,W.endDTS=X.endDTS,W.minEndPTS=X.minEndPTS,W.duration=X.endPTS-X.startPTS,W.duration&&(E=W),d.PTSKnown=d.alignedSliding=!0),W.elementaryStreams=X.elementaryStreams,W.loader=X.loader,W.stats=X.stats,W.urlId=X.urlId,X.initSegment&&(W.initSegment=X.initSegment,y=X.initSegment)}),y){var w=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;w.forEach(function(X){var W;(!X.initSegment||X.initSegment.relurl===((W=y)===null||W===void 0?void 0:W.relurl))&&(X.initSegment=y)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(X){return!X}),d.deltaUpdateFailed)){M.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var A=d.skippedSegments;A--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var g=d.fragments;if(x){M.logger.warn("discontinuity sliding from playlist, take drift into account");for(var P=0;P<g.length;P++)g[P].cc+=x}d.skippedSegments&&(d.startCC=d.fragments[0].cc),u(h.partList,d.partList,function(X,W){W.elementaryStreams=X.elementaryStreams,W.stats=X.stats}),E?c(d,E,E.startPTS,E.endPTS,E.startDTS,E.endDTS):l(h,d),g.length&&(d.totalduration=d.edge-g[0].start),d.driftStartTime=h.driftStartTime,d.driftStart=h.driftStart;var O=d.advancedDateTime;if(d.advanced&&O){var F=d.edge;d.driftStart||(d.driftStartTime=O,d.driftStart=F),d.driftEndTime=O,d.driftEnd=F}else d.driftEndTime=h.driftEndTime,d.driftEnd=h.driftEnd,d.advancedDateTime=h.advancedDateTime}function u(h,d,y){if(h&&d)for(var m=0,C=0,T=h.length;C<=T;C++){var x=h[C],E=d[C+m];x&&E&&x.index===E.index&&x.fragment.sn===E.fragment.sn?y(x,E):m--}}function s(h,d,y){for(var m=d.skippedSegments,C=Math.max(h.startSN,d.startSN)-d.startSN,T=(h.fragmentHint?1:0)+(m?d.endSN:Math.min(h.endSN,d.endSN))-d.startSN,x=d.startSN-h.startSN,E=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,w=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,A=C;A<=T;A++){var g=w[x+A],P=E[A];m&&!P&&A<m&&(P=d.fragments[A]=g),g&&P&&y(g,P)}}function l(h,d){var y=d.startSN+d.skippedSegments-h.startSN,m=h.fragments;if(y<0||y>=m.length)return;t(d,m[y].start)}function t(h,d){if(d){for(var y=h.fragments,m=h.skippedSegments;m<y.length;m++)y[m].start+=d;h.fragmentHint&&(h.fragmentHint.start+=d)}}function a(h,d){var y=1e3*h.levelTargetDuration,m=y/2,C=h.age,T=C>0&&C<y*3,x=d.loading.end-d.loading.start,E,w=h.availabilityDelay;if(h.updated===!1)if(T){var A=333*h.misses;E=Math.max(Math.min(m,x*2),A),h.availabilityDelay=(h.availabilityDelay||0)+E}else E=m;else T?(w=Math.min(w||y/2,C),h.availabilityDelay=w,E=w+y-C):E=y-x;return Math.round(E)}function i(h,d,y){if(!h||!h.details)return null;var m=h.details,C=m.fragments[d-m.startSN];return C||(C=m.fragmentHint,C&&C.sn===d?C:d<m.startSN&&y&&y.sn===d?y:null)}function r(h,d,y){if(!h||!h.details)return null;var m=h.details.partList;if(m)for(var C=m.length;C--;){var T=m[C];if(T.index===y&&T.fragment.sn===d)return T}return null}},"./src/controller/stream-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return m});var k=D("./src/polyfills/number.ts"),M=D("./src/controller/base-stream-controller.ts"),f=D("./src/is-supported.ts"),S=D("./src/events.ts"),_=D("./src/utils/buffer-helper.ts"),p=D("./src/controller/fragment-tracker.ts"),c=D("./src/types/loader.ts"),o=D("./src/loader/fragment.ts"),u=D("./src/demux/transmuxer-interface.ts"),s=D("./src/types/transmuxer.ts"),l=D("./src/controller/gap-controller.ts"),t=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function i(C,T){for(var x=0;x<T.length;x++){var E=T[x];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(C,E.key,E)}}function r(C,T,x){return T&&i(C.prototype,T),x&&i(C,x),C}function h(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,d(C,T)}function d(C,T){return d=Object.setPrototypeOf||function(E,w){return E.__proto__=w,E},d(C,T)}var y=100,m=function(C){h(T,C);function T(E,w){var A;return A=C.call(this,E,w,"[stream-controller]")||this,A.audioCodecSwap=!1,A.gapController=null,A.level=-1,A._forceStartLoad=!1,A.altAudio=!1,A.audioOnly=!1,A.fragPlaying=null,A.onvplaying=null,A.onvseeked=null,A.fragLastKbps=0,A.stalled=!1,A.couldBacktrack=!1,A.audioCodecSwitch=!1,A.videoBuffer=null,A._registerListeners(),A}var x=T.prototype;return x._registerListeners=function(){var w=this.hls;w.on(S.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.on(S.Events.LEVEL_LOADING,this.onLevelLoading,this),w.on(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(S.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.on(S.Events.ERROR,this.onError,this),w.on(S.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.on(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.on(S.Events.BUFFER_CREATED,this.onBufferCreated,this),w.on(S.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.on(S.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.on(S.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var w=this.hls;w.off(S.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),w.off(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(S.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),w.off(S.Events.ERROR,this.onError,this),w.off(S.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),w.off(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),w.off(S.Events.BUFFER_CREATED,this.onBufferCreated,this),w.off(S.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),w.off(S.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),w.off(S.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(w){if(this.levels){var A=this.lastCurrentTime,g=this.hls;if(this.stopLoad(),this.setInterval(y),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var P=g.startLevel;P===-1&&(g.config.testBandwidth?(P=0,this.bitrateTest=!0):P=g.nextAutoLevel),this.level=g.nextLoadLevel=P,this.loadedmetadata=!1}A>0&&w===-1&&(this.log("Override startPosition with lastCurrentTime @"+A.toFixed(3)),w=A),this.state=M.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=w,this.tick()}else this._forceStartLoad=!0,this.state=M.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,C.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case M.State.IDLE:this.doTickIdle();break;case M.State.WAITING_LEVEL:{var w,A=this.levels,g=this.level,P=A==null||((w=A[g])===null||w===void 0)?void 0:w.details;if(P&&(!P.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(P))break;this.state=M.State.IDLE;break}break}case M.State.FRAG_LOADING_WAITING_RETRY:{var O,F=self.performance.now(),X=this.retryDate;(!X||F>=X||(O=this.media)!==null&&O!==void 0&&O.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=M.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){C.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var w,A,g=this.hls,P=this.levelLastLoaded,O=this.levels,F=this.media,X=g.config,W=g.nextLoadLevel;if(P===null||!F&&(this.startFragRequested||!X.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!O||!O[W])return;var N=O[W];this.level=g.nextLoadLevel=W;var G=N.details;if(!G||this.state===M.State.WAITING_LEVEL||G.live&&this.levelLastLoaded!==W){this.state=M.State.WAITING_LEVEL;return}var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:F,c.PlaylistLevelType.MAIN);if(U===null)return;var H=U.len,V=this.getMaxBufferLength(N.maxBitrate);if(H>=V)return;if(this._streamEnded(U,G)){var ce={};this.altAudio&&(ce.type="video"),this.hls.trigger(S.Events.BUFFER_EOS,ce),this.state=M.State.ENDED;return}var ye=U.end,Le=this.getNextFragment(ye,G);if(this.couldBacktrack&&!this.fragPrevious&&Le&&Le.sn!=="initSegment"){var Ze=Le.sn-G.startSN;Ze>1&&(Le=G.fragments[Ze-1],this.fragmentTracker.removeFragment(Le))}if(Le&&this.fragmentTracker.getState(Le)===p.FragmentState.OK&&this.nextLoadPosition>ye){var Ye=this.audioOnly&&!this.altAudio?o.ElementaryStreamTypes.AUDIO:o.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(F,Ye,c.PlaylistLevelType.MAIN),Le=this.getNextFragment(this.nextLoadPosition,G)}if(!Le)return;Le.initSegment&&!Le.initSegment.data&&!this.bitrateTest&&(Le=Le.initSegment),((w=Le.decryptdata)===null||w===void 0?void 0:w.keyFormat)==="identity"&&!((A=Le.decryptdata)!==null&&A!==void 0&&A.key)?this.loadKey(Le,G):this.loadFragment(Le,G,ye)},x.loadFragment=function(w,A,g){var P,O=this.fragmentTracker.getState(w);if(this.fragCurrent=w,O===p.FragmentState.BACKTRACKED){var F=this.fragmentTracker.getBacktrackData(w);if(F){this._handleFragmentLoadProgress(F),this._handleFragmentLoadComplete(F);return}else O=p.FragmentState.NOT_LOADED}O===p.FragmentState.NOT_LOADED||O===p.FragmentState.PARTIAL?w.sn==="initSegment"?this._loadInitSegment(w):this.bitrateTest?(w.bitrateTest=!0,this.log("Fragment "+w.sn+" of level "+w.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(w)):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,w,A,g)):O===p.FragmentState.APPENDING?this.reduceMaxBufferLength(w.duration)&&this.fragmentTracker.removeFragment(w):((P=this.media)===null||P===void 0?void 0:P.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(w){var A=this.fragmentTracker.getAppendedFrag(w,c.PlaylistLevelType.MAIN);return A&&"fragment"in A?A.fragment:A},x.getBufferedFrag=function(w){return this.fragmentTracker.getBufferedFrag(w,c.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(w){return w?this.getBufferedFrag(w.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var w=this.levels,A=this.media;if(A!=null&&A.readyState){var g,P=this.getAppendedFrag(A.currentTime);if(P&&P.start>1&&this.flushMainBuffer(0,P.start-1),!A.paused&&w){var O=this.hls.nextLoadLevel,F=w[O],X=this.fragLastKbps;X&&this.fragCurrent?g=this.fragCurrent.duration*F.maxBitrate/(1e3*X)+1:g=0}else g=0;var W=this.getBufferedFrag(A.currentTime+g);if(W){var N=this.followingBufferedFrag(W);if(N){this.abortCurrentFrag();var G=N.maxStartPTS?N.maxStartPTS:N.start,U=N.duration,H=Math.max(W.end,G+Math.min(Math.max(U-this.config.maxFragLookUpTolerance,U*.5),U*.75));this.flushMainBuffer(H,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var w=this.fragCurrent;this.fragCurrent=null,w!=null&&w.loader&&w.loader.abort(),this.state===M.State.KEY_LOADING&&(this.state=M.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(w,A){C.prototype.flushMainBuffer.call(this,w,A,this.altAudio?"video":null)},x.onMediaAttached=function(w,A){C.prototype.onMediaAttached.call(this,w,A);var g=A.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),g.addEventListener("playing",this.onvplaying),g.addEventListener("seeked",this.onvseeked),this.gapController=new l.default(this.config,g,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var w=this.media;w&&(w.removeEventListener("playing",this.onvplaying),w.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),C.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var w=this.media,A=w?w.currentTime:null;Object(k.isFiniteNumber)(A)&&this.log("Media seeked to "+A.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(w,A){var g=!1,P=!1,O;A.levels.forEach(function(F){O=F.audioCodec,O&&(O.indexOf("mp4a.40.2")!==-1&&(g=!0),O.indexOf("mp4a.40.5")!==-1&&(P=!0))}),this.audioCodecSwitch=g&&P&&!Object(f.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=A.levels,this.startFragRequested=!1},x.onLevelLoading=function(w,A){var g=this.levels;if(!g||this.state!==M.State.IDLE)return;var P=g[A.level];(!P.details||P.details.live&&this.levelLastLoaded!==A.level||this.waitForCdnTuneIn(P.details))&&(this.state=M.State.WAITING_LEVEL)},x.onLevelLoaded=function(w,A){var g,P=this.levels,O=A.level,F=A.details,X=F.totalduration;if(!P){this.warn("Levels were reset while loading level "+O);return}this.log("Level "+O+" loaded ["+F.startSN+","+F.endSN+"], cc ["+F.startCC+", "+F.endCC+"] duration:"+X);var W=this.fragCurrent;W&&(this.state===M.State.FRAG_LOADING||this.state===M.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==A.level&&W.loader&&(this.state=M.State.IDLE,W.loader.abort()));var N=P[O],G=0;if(F.live||(g=N.details)!==null&&g!==void 0&&g.live){if(F.fragments[0]||(F.deltaUpdateFailed=!0),F.deltaUpdateFailed)return;G=this.alignPlaylists(F,N.details)}if(N.details=F,this.levelLastLoaded=O,this.hls.trigger(S.Events.LEVEL_UPDATED,{details:F,level:O}),this.state===M.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(F))return;this.state=M.State.IDLE}this.startFragRequested?F.live&&this.synchronizeToLiveEdge(F):this.setStartPosition(F,G),this.tick()},x._handleFragmentLoadProgress=function(w){var A,g=w.frag,P=w.part,O=w.payload,F=this.levels;if(!F){this.warn("Levels were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var X=F[g.level],W=X.details;if(!W){this.warn("Dropping fragment "+g.sn+" of level "+g.level+" after level details were reset");return}var N=X.videoCodec,G=W.PTSKnown||!W.live,U=(A=g.initSegment)===null||A===void 0?void 0:A.data,H=this._getAudioCodec(X),V=this.transmuxer=this.transmuxer||new u.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ce=P?P.index:-1,ye=ce!==-1,Le=new s.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,O.byteLength,ce,ye),Ze=this.initPTS[g.cc];V.push(O,U,H,N,g,P,W.totalduration,G,Le,Ze)},x.onAudioTrackSwitching=function(w,A){var g=this.altAudio,P=!!A.url,O=A.id;if(!P){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var F=this.fragCurrent;F!=null&&F.loader&&(this.log("Switching to main audio track, cancel main fragment load"),F.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var X=this.hls;g&&X.trigger(S.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),X.trigger(S.Events.AUDIO_TRACK_SWITCHED,{id:O})}},x.onAudioTrackSwitched=function(w,A){var g=A.id,P=!!this.hls.audioTracks[g].url;if(P){var O=this.videoBuffer;O&&this.mediaBuffer!==O&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=O)}this.altAudio=P,this.tick()},x.onBufferCreated=function(w,A){var g=A.tracks,P,O,F=!1;for(var X in g){var W=g[X];if(W.id==="main"){if(O=X,P=W,X==="video"){var N=g[X];N&&(this.videoBuffer=N.buffer)}}else F=!0}F&&P?(this.log("Alternate track found, use "+O+".buffered to schedule main fragment loading"),this.mediaBuffer=P.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(w,A){var g=A.frag,P=A.part;if(g&&g.type!==c.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(P?" p: "+P.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state),this.state===M.State.PARSED&&(this.state=M.State.IDLE);return}var O=P?P.stats:g.stats;this.fragLastKbps=Math.round(8*O.total/(O.buffering.end-O.loading.first)),g.sn!=="initSegment"&&(this.fragPrevious=g),this.fragBufferedComplete(g,P)},x.onError=function(w,A){switch(A.details){case t.ErrorDetails.FRAG_LOAD_ERROR:case t.ErrorDetails.FRAG_LOAD_TIMEOUT:case t.ErrorDetails.KEY_LOAD_ERROR:case t.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,A);break;case t.ErrorDetails.LEVEL_LOAD_ERROR:case t.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==M.State.ERROR&&(A.fatal?(this.warn(""+A.details),this.state=M.State.ERROR):!A.levelRetry&&this.state===M.State.WAITING_LEVEL&&(this.state=M.State.IDLE));break;case t.ErrorDetails.BUFFER_FULL_ERROR:if(A.parent==="main"&&(this.state===M.State.PARSING||this.state===M.State.PARSED)){var g=!0,P=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);P&&P.len>.5&&(g=!this.reduceMaxBufferLength(P.len)),g&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var w=this.media,A=this.gapController;if(!w||!A||!w.readyState)return;var g=_.BufferHelper.getBuffered(w);!this.loadedmetadata&&g.length?(this.loadedmetadata=!0,this.seekToStartPos()):A.poll(this.lastCurrentTime),this.lastCurrentTime=w.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=M.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(w,A){var g=A.type;if(g!==o.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var P=(g===o.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(P,g,c.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(w,A){this.levels=A.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var w=this.media,A=w.currentTime,g=this.startPosition;if(g>=0&&A<g){if(w.seeking){a.logger.log("could not seek to "+g+", already seeking at "+A);return}var P=_.BufferHelper.getBuffered(w),O=P.length?P.start(0):0,F=O-g;F>0&&(F<this.config.maxBufferHole||F<this.config.maxFragLookUpTolerance)&&(a.logger.log("adjusting start position by "+F+" to match buffer start"),g+=F,this.startPosition=g),this.log("seek to target start position "+g+" from current time "+A),w.currentTime=g}},x._getAudioCodec=function(w){var A=this.config.defaultAudioCodec||w.audioCodec;return this.audioCodecSwap&&A&&(this.log("Swapping audio codec"),A.indexOf("mp4a.40.5")!==-1?A="mp4a.40.2":A="mp4a.40.5"),A},x._loadBitrateTestFrag=function(w){var A=this;this._doFragLoad(w).then(function(g){var P=A.hls;if(!g||P.nextLoadLevel||A.fragContextChanged(w))return;A.fragLoadError=0,A.state=M.State.IDLE,A.startFragRequested=!1,A.bitrateTest=!1;var O=w.stats;O.parsing.start=O.parsing.end=O.buffering.start=O.buffering.end=self.performance.now(),P.trigger(S.Events.FRAG_LOADED,g)})},x._handleTransmuxComplete=function(w){var A,g="main",P=this.hls,O=w.remuxResult,F=w.chunkMeta,X=this.getCurrentContext(F);if(!X){this.warn("The loading context changed while buffering fragment "+F.sn+" of level "+F.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(F.level);return}var W=X.frag,N=X.part,G=X.level,U=O.video,H=O.text,V=O.id3,ce=O.initSegment,ye=this.altAudio?void 0:O.audio;if(this.fragContextChanged(W))return;if(this.state=M.State.PARSING,ce){ce.tracks&&(this._bufferInitSegment(G,ce.tracks,W,F),P.trigger(S.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:g,tracks:ce.tracks}));var Le=ce.initPTS,Ze=ce.timescale;Object(k.isFiniteNumber)(Le)&&(this.initPTS[W.cc]=Le,P.trigger(S.Events.INIT_PTS_FOUND,{frag:W,id:g,initPTS:Le,timescale:Ze}))}if(U&&O.independent!==!1){if(G.details){var Ye=U.startPTS,Oe=U.endPTS,We=U.startDTS,ze=U.endDTS;if(N)N.elementaryStreams[U.type]={startPTS:Ye,endPTS:Oe,startDTS:We,endDTS:ze};else if(U.firstKeyFrame&&U.independent&&(this.couldBacktrack=!0),U.dropped&&U.independent){var Ae=this.getLoadPosition()+this.config.maxBufferHole;if(Ae<Ye){this.backtrack(W);return}W.setElementaryStreamInfo(U.type,W.start,Oe,W.start,ze,!0)}W.setElementaryStreamInfo(U.type,Ye,Oe,We,ze),this.bufferFragmentData(U,W,N,F)}}else if(O.independent===!1){this.backtrack(W);return}if(ye){var xe=ye.startPTS,le=ye.endPTS,Se=ye.startDTS,pe=ye.endDTS;N&&(N.elementaryStreams[o.ElementaryStreamTypes.AUDIO]={startPTS:xe,endPTS:le,startDTS:Se,endDTS:pe}),W.setElementaryStreamInfo(o.ElementaryStreamTypes.AUDIO,xe,le,Se,pe),this.bufferFragmentData(ye,W,N,F)}if(V!=null&&(A=V.samples)!==null&&A!==void 0&&A.length){var Ge={frag:W,id:g,samples:V.samples};P.trigger(S.Events.FRAG_PARSING_METADATA,Ge)}if(H){var fe={frag:W,id:g,samples:H.samples};P.trigger(S.Events.FRAG_PARSING_USERDATA,fe)}},x._bufferInitSegment=function(w,A,g,P){var O=this;if(this.state!==M.State.PARSING)return;this.audioOnly=!!A.audio&&!A.video,this.altAudio&&!this.audioOnly&&delete A.audio;var F=A.audio,X=A.video,W=A.audiovideo;if(F){var N=w.audioCodec,G=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(N&&(N.indexOf("mp4a.40.5")!==-1?N="mp4a.40.2":N="mp4a.40.5"),F.metadata.channelCount!==1&&G.indexOf("firefox")===-1&&(N="mp4a.40.5")),G.indexOf("android")!==-1&&F.container!=="audio/mpeg"&&(N="mp4a.40.2",this.log("Android: force audio codec to "+N)),w.audioCodec&&w.audioCodec!==N&&this.log('Swapping manifest audio codec "'+w.audioCodec+'" for "'+N+'"'),F.levelCodec=N,F.id="main",this.log("Init audio buffer, container:"+F.container+", codecs[selected/level/parsed]=["+(N||"")+"/"+(w.audioCodec||"")+"/"+F.codec+"]")}X&&(X.levelCodec=w.videoCodec,X.id="main",this.log("Init video buffer, container:"+X.container+", codecs[level/parsed]=["+(w.videoCodec||"")+"/"+X.codec+"]")),W&&this.log("Init audiovideo buffer, container:"+W.container+", codecs[level/parsed]=["+(w.attrs.CODECS||"")+"/"+W.codec+"]"),this.hls.trigger(S.Events.BUFFER_CODECS,A),Object.keys(A).forEach(function(U){var H=A[U],V=H.initSegment;V!=null&&V.byteLength&&O.hls.trigger(S.Events.BUFFER_APPENDING,{type:U,data:V,frag:g,part:null,chunkMeta:P,parent:g.type})}),this.tick()},x.backtrack=function(w){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(w);var A=this.fragmentTracker.backtrack(w);this.fragPrevious=null,this.nextLoadPosition=w.start,A?this.resetFragmentLoading(w):this.state=M.State.BACKTRACKING},x.checkFragmentChanged=function(){var w=this.media,A=null;if(w&&w.readyState>1&&w.seeking===!1){var g=w.currentTime;if(_.BufferHelper.isBuffered(w,g)?A=this.getAppendedFrag(g):_.BufferHelper.isBuffered(w,g+.1)&&(A=this.getAppendedFrag(g+.1)),A){var P=this.fragPlaying,O=A.level;(!P||A.sn!==P.sn||P.level!==O||A.urlId!==P.urlId)&&(this.hls.trigger(S.Events.FRAG_CHANGED,{frag:A}),(!P||P.level!==O)&&this.hls.trigger(S.Events.LEVEL_SWITCHED,{level:O}),this.fragPlaying=A)}}},r(T,[{key:"nextLevel",get:function(){var w=this.nextBufferedFrag;return w?w.level:-1}},{key:"currentLevel",get:function(){var w=this.media;if(w){var A=this.getAppendedFrag(w.currentTime);if(A)return A.level}return-1}},{key:"nextBufferedFrag",get:function(){var w=this.media;if(w){var A=this.getAppendedFrag(w.currentTime);return this.followingBufferedFrag(A)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),T}(M.default)},"./src/controller/subtitle-stream-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"SubtitleStreamController",function(){return h});var k=D("./src/events.ts"),M=D("./src/utils/logger.ts"),f=D("./src/utils/buffer-helper.ts"),S=D("./src/controller/fragment-finders.ts"),_=D("./src/utils/discontinuities.ts"),p=D("./src/controller/level-helper.ts"),c=D("./src/controller/fragment-tracker.ts"),o=D("./src/controller/base-stream-controller.ts"),u=D("./src/types/loader.ts"),s=D("./src/types/level.ts");function l(d,y){for(var m=0;m<y.length;m++){var C=y[m];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(d,C.key,C)}}function t(d,y,m){return y&&l(d.prototype,y),m&&l(d,m),d}function a(d,y){d.prototype=Object.create(y.prototype),d.prototype.constructor=d,i(d,y)}function i(d,y){return i=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},i(d,y)}var r=500,h=function(d){a(y,d);function y(C,T){var x;return x=d.call(this,C,T,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var m=y.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var T=this.hls;T.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.on(k.Events.ERROR,this.onError,this),T.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),T.on(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),T.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),T.on(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),T.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var T=this.hls;T.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),T.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),T.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),T.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),T.off(k.Events.ERROR,this.onError,this),T.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),T.off(k.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),T.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),T.off(k.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),T.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=o.State.IDLE,this.setInterval(r),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(T,x){this.mainDetails=x.details},m.onSubtitleFragProcessed=function(T,x){var E=x.frag,w=x.success;if(this.fragPrevious=E,this.state=o.State.IDLE,!w)return;var A=this.tracksBuffered[this.currentTrackId];if(!A)return;for(var g,P=E.start,O=0;O<A.length;O++)if(P>=A[O].start&&P<=A[O].end){g=A[O];break}var F=E.start+E.duration;g?g.end=F:(g={start:P,end:F},A.push(g)),this.fragmentTracker.fragBuffered(E)},m.onBufferFlushing=function(T,x){var E=x.startOffset,w=x.endOffset;if(E===0&&w!==Number.POSITIVE_INFINITY){var A=this.currentTrackId,g=this.levels;if(!g.length||!g[A]||!g[A].details)return;var P=g[A].details,O=P.targetduration,F=w-O;if(F<=0)return;x.endOffsetSubtitles=Math.max(0,F),this.tracksBuffered.forEach(function(X){for(var W=0;W<X.length;){if(X[W].end<=F){X.shift();continue}else if(X[W].start<F)X[W].start=F;else break;W++}}),this.fragmentTracker.removeFragmentsInRange(E,F,u.PlaylistLevelType.SUBTITLE)}},m.onError=function(T,x){var E,w=x.frag;if(!w||w.type!==u.PlaylistLevelType.SUBTITLE)return;(E=this.fragCurrent)!==null&&E!==void 0&&E.loader&&this.fragCurrent.loader.abort(),this.state=o.State.IDLE},m.onSubtitleTracksUpdated=function(T,x){var E=this,w=x.subtitleTracks;this.tracksBuffered=[],this.levels=w.map(function(A){return new s.Level(A)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(A){E.tracksBuffered[A.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(T,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var E=this.levels[this.currentTrackId];E!=null&&E.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,E&&this.setInterval(r)},m.onSubtitleTrackLoaded=function(T,x){var E,w=x.details,A=x.id,g=this.currentTrackId,P=this.levels;if(!P.length)return;var O=P[g];if(A>=P.length||A!==g||!O)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,w.live||(E=O.details)!==null&&E!==void 0&&E.live){var F=this.mainDetails;if(w.deltaUpdateFailed||!F)return;var X=F.fragments[0];if(!O.details)w.hasProgramDateTime&&F.hasProgramDateTime?Object(_.alignMediaPlaylistByPDT)(w,F):X&&Object(p.addSliding)(w,X.start);else{var W=this.alignPlaylists(w,O.details);W===0&&X&&Object(p.addSliding)(w,X.start)}}if(O.details=w,this.levelLastLoaded=A,this.tick(),w.live&&!this.fragCurrent&&this.media&&this.state===o.State.IDLE){var N=Object(S.findFragmentByPTS)(null,w.fragments,this.media.currentTime,0);N||(this.warn("Subtitle playlist not aligned with playback"),O.details=void 0)}},m._handleFragmentLoadComplete=function(T){var x=T.frag,E=T.payload,w=x.decryptdata,A=this.hls;if(this.fragContextChanged(x))return;if(E&&E.byteLength>0&&w&&w.key&&w.iv&&w.method==="AES-128"){var g=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(E),w.key.buffer,w.iv.buffer).then(function(P){var O=performance.now();A.trigger(k.Events.FRAG_DECRYPTED,{frag:x,payload:P,stats:{tstart:g,tdecrypt:O}})})}},m.doTick=function(){if(!this.media){this.state=o.State.IDLE;return}if(this.state===o.State.IDLE){var T,x=this.currentTrackId,E=this.levels;if(!E.length||!E[x]||!E[x].details)return;var w=E[x].details,A=w.targetduration,g=this.config,P=this.media,O=f.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,P.currentTime-A,g.maxBufferHole),F=O.end,X=O.len,W=this.getMaxBufferLength()+A;if(X>W)return;console.assert(w,"Subtitle track details are defined on idle subtitle stream controller tick");var N=w.fragments,G=N.length,U=w.edge,H,V=this.fragPrevious;if(F<U){var ce=g.maxFragLookUpTolerance;V&&w.hasProgramDateTime&&(H=Object(S.findFragmentByPDT)(N,V.endProgramDateTime,ce)),H||(H=Object(S.findFragmentByPTS)(V,N,F,ce),!H&&V&&V.start<N[0].start&&(H=N[0]))}else H=N[G-1];(T=H)!==null&&T!==void 0&&T.encrypted?(M.logger.log("Loading key for "+H.sn),this.state=o.State.KEY_LOADING,this.hls.trigger(k.Events.KEY_LOADING,{frag:H})):H&&this.fragmentTracker.getState(H)===c.FragmentState.NOT_LOADED&&this.loadFragment(H,w,F)}},m.loadFragment=function(T,x,E){this.fragCurrent=T,d.prototype.loadFragment.call(this,T,x,E)},t(y,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),y}(o.default)},"./src/controller/subtitle-track-controller.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/events.ts"),M=D("./src/utils/texttrack-utils.ts"),f=D("./src/controller/base-playlist-controller.ts"),S=D("./src/types/loader.ts");function _(l,t){for(var a=0;a<t.length;a++){var i=t[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(l,i.key,i)}}function p(l,t,a){return t&&_(l.prototype,t),a&&_(l,a),l}function c(l,t){l.prototype=Object.create(t.prototype),l.prototype.constructor=l,o(l,t)}function o(l,t){return o=Object.setPrototypeOf||function(i,r){return i.__proto__=r,i},o(l,t)}var u=function(l){c(t,l);function t(i){var r;return r=l.call(this,i,"[subtitle-track-controller]")||this,r.media=null,r.tracks=[],r.groupId=null,r.tracksInGroup=[],r.trackId=-1,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.trackChangeListener=function(){return r.onTextTracksChanged()},r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r.subtitleDisplay=!0,r.registerListeners(),r}var a=t.prototype;return a.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,l.prototype.destroy.call(this)},a.registerListeners=function(){var r=this.hls;r.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.on(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.on(k.Events.ERROR,this.onError,this)},a.unregisterListeners=function(){var r=this.hls;r.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),r.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),r.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),r.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(k.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),r.off(k.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),r.off(k.Events.ERROR,this.onError,this)},a.onMediaAttached=function(r,h){if(this.media=h.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)},a.pollTrackChange=function(r){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,r)},a.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 r=s(this.media.textTracks);r.forEach(function(h){Object(M.clearCurrentCues)(h)}),this.subtitleTrack=-1,this.media=null},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(r,h){this.tracks=h.subtitleTracks},a.onSubtitleTrackLoaded=function(r,h){var d=h.id,y=h.details,m=this.trackId,C=this.tracksInGroup[m];if(!C){this.warn("Invalid subtitle track id "+d);return}var T=C.details;C.details=h.details,this.log("subtitle track "+d+" loaded ["+y.startSN+"-"+y.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,h,T))},a.onLevelLoading=function(r,h){this.switchLevel(h.level)},a.onLevelSwitching=function(r,h){this.switchLevel(h.level)},a.switchLevel=function(r){var h=this.hls.levels[r];if(!(h!=null&&h.textGroupIds))return;var d=h.textGroupIds[h.urlId];if(this.groupId!==d){var y=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(x){return!d||x.groupId===d});this.tracksInGroup=m;var C=this.findTrackId(y==null?void 0:y.name)||this.findTrackId();this.groupId=d;var T={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(k.Events.SUBTITLE_TRACKS_UPDATED,T),C!==-1&&this.setSubtitleTrack(C,y)}},a.findTrackId=function(r){for(var h=this.tracksInGroup,d=0;d<h.length;d++){var y=h[d];if((!this.selectDefaultTrack||y.default)&&(!r||r===y.name))return y.id}return-1},a.onError=function(r,h){if(l.prototype.onError.call(this,r,h),h.fatal||!h.context)return;h.context.type===S.PlaylistContextType.SUBTITLE_TRACK&&h.context.id===this.trackId&&h.context.groupId===this.groupId&&this.retryLoadingOrFail(h)},a.loadPlaylist=function(r){var h=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(h)){var d=h.id,y=h.groupId,m=h.url;if(r)try{m=r.addDirectives(m)}catch(C){this.warn("Could not construct new URL with HLS Delivery Directives: "+C)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADING,{url:m,id:d,groupId:y,deliveryDirectives:r||null})}},a.toggleTrackModes=function(r){var h=this,d=this.media,y=this.subtitleDisplay,m=this.trackId;if(!d)return;var C=s(d.textTracks),T=C.filter(function(w){return w.groupId===h.groupId});if(r===-1)[].slice.call(C).forEach(function(w){w.mode="disabled"});else{var x=T[m];x&&(x.mode="disabled")}var E=T[r];E&&(E.mode=y?"showing":"hidden")},a.setSubtitleTrack=function(r,h){var d,y=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=r;return}if(this.trackId!==r&&this.toggleTrackModes(r),this.trackId===r&&(r===-1||(d=y[r])!==null&&d!==void 0&&d.details)||r<-1||r>=y.length)return;this.clearTimer();var m=y[r];if(this.log("Switching to subtitle track "+r),this.trackId=r,m){var C=m.id,T=m.groupId,x=T===void 0?"":T,E=m.name,w=m.type,A=m.url;this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:C,groupId:x,name:E,type:w,url:A});var g=this.switchParams(m.url,h==null?void 0:h.details);this.loadPlaylist(g)}else this.hls.trigger(k.Events.SUBTITLE_TRACK_SWITCH,{id:r})},a.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var r=-1,h=s(this.media.textTracks),d=0;d<h.length;d++)if(h[d].mode==="hidden")r=d;else if(h[d].mode==="showing"){r=d;break}this.subtitleTrack!==r&&(this.subtitleTrack=r)},p(t,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(r){this.selectDefaultTrack=!1;var h=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(r,h)}}]),t}(f.default);function s(l){for(var t=[],a=0;a<l.length;a++){var i=l[a];i.kind==="subtitles"&&i.label&&t.push(l[a])}return t}L.default=u},"./src/controller/timeline-controller.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"TimelineController",function(){return s});var k=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),f=D("./src/utils/cea-608-parser.ts"),S=D("./src/utils/output-filter.ts"),_=D("./src/utils/webvtt-parser.ts"),p=D("./src/utils/texttrack-utils.ts"),c=D("./src/utils/imsc1-ttml-parser.ts"),o=D("./src/types/loader.ts"),u=D("./src/utils/logger.ts"),s=function(){function i(h){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=a(),this.captionsProperties=void 0,this.hls=h,this.config=h.config,this.Cues=h.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 d=new S.default(this,"textTrack1"),y=new S.default(this,"textTrack2"),m=new S.default(this,"textTrack3"),C=new S.default(this,"textTrack4");this.cea608Parser1=new f.default(1,d,y),this.cea608Parser2=new f.default(3,m,C)}h.on(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.on(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.on(M.Events.FRAG_LOADING,this.onFragLoading,this),h.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.on(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.on(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var r=i.prototype;return r.destroy=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(M.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(M.Events.FRAG_LOADING,this.onFragLoading,this),d.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(M.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(M.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(M.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},r.addCues=function(d,y,m,C,T){for(var x=!1,E=T.length;E--;){var w=T[E],A=t(w[0],w[1],y,m);if(A>=0&&(w[0]=Math.min(w[0],y),w[1]=Math.max(w[1],m),x=!0,A/(m-y)>.5))return}if(x||T.push([y,m]),this.config.renderTextTracksNatively){var g=this.captionsTracks[d];this.Cues.newCue(g,y,m,C)}else{var P=this.Cues.newCue(null,y,m,C);this.hls.trigger(M.Events.CUES_PARSED,{type:"captions",cues:P,track:d})}},r.onInitPtsFound=function(d,y){var m=this,C=y.frag,T=y.id,x=y.initPTS,E=y.timescale,w=this.unparsedVttFrags;T==="main"&&(this.initPTS[C.cc]=x,this.timescale[C.cc]=E),w.length&&(this.unparsedVttFrags=[],w.forEach(function(A){m.onFragLoaded(M.Events.FRAG_LOADED,A)}))},r.getExistingTrack=function(d){var y=this.media;if(y)for(var m=0;m<y.textTracks.length;m++){var C=y.textTracks[m];if(C[d])return C}return null},r.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},r.createNativeTrack=function(d){if(this.captionsTracks[d])return;var y=this.captionsProperties,m=this.captionsTracks,C=this.media,T=y[d],x=T.label,E=T.languageCode,w=this.getExistingTrack(d);if(w)m[d]=w,Object(p.clearCurrentCues)(m[d]),Object(p.sendAddTrackEvent)(m[d],C);else{var A=this.createTextTrack("captions",x,E);A&&(A[d]=!0,m[d]=A)}},r.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var y=this.captionsProperties[d];if(!y)return;var m=y.label,C={_id:d,label:m,kind:"captions",default:y.media?!!y.media.default:!1,closedCaptions:y.media};this.nonNativeCaptionsTracks[d]=C,this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[C]})},r.createTextTrack=function(d,y,m){var C=this.media;return C?C.addTextTrack(d,y,m):void 0},r.onMediaAttaching=function(d,y){this.media=y.media,this._cleanTracks()},r.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(y){Object(p.clearCurrentCues)(d[y]),delete d[y]}),this.nonNativeCaptionsTracks={}},r.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=a(),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())},r._cleanTracks=function(){var d=this.media;if(!d)return;var y=d.textTracks;if(y)for(var m=0;m<y.length;m++)Object(p.clearCurrentCues)(y[m])},r.onSubtitleTracksUpdated=function(d,y){var m=this;this.textTracks=[];var C=y.subtitleTracks||[],T=C.some(function(A){return A.textCodec===c.IMSC1_CODEC});if(this.config.enableWebVTT||T&&this.config.enableIMSC1){var x=this.tracks&&C&&this.tracks.length===C.length;if(this.tracks=C||[],this.config.renderTextTracksNatively){var E=this.media?this.media.textTracks:[];this.tracks.forEach(function(A,g){var P;if(g<E.length){for(var O=null,F=0;F<E.length;F++)if(l(E[F],A)){O=E[F];break}O&&(P=O)}P?Object(p.clearCurrentCues)(P):(P=m.createTextTrack("subtitles",A.name,A.lang),P&&(P.mode="disabled")),P&&(P.groupId=A.groupId,m.textTracks.push(P))})}else if(!x&&this.tracks&&this.tracks.length){var w=this.tracks.map(function(A){return{label:A.name,kind:A.type.toLowerCase(),default:A.default,subtitleTrack:A}});this.hls.trigger(M.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:w})}}},r.onManifestLoaded=function(d,y){var m=this;this.config.enableCEA708Captions&&y.captions&&y.captions.forEach(function(C){var T=/(?:CC|SERVICE)([1-4])/.exec(C.instreamId);if(!T)return;var x="textTrack"+T[1],E=m.captionsProperties[x];if(!E)return;E.label=C.name,C.lang&&(E.languageCode=C.lang),E.media=C})},r.onFragLoading=function(d,y){var m=this.cea608Parser1,C=this.cea608Parser2,T=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(m&&C))return;if(y.frag.type===o.PlaylistLevelType.MAIN){var E,w,A=y.frag.sn,g=(E=y==null||((w=y.part)===null||w===void 0)?void 0:w.index)!=null?E:-1;A===T+1||A===T&&g===x+1||(m.reset(),C.reset()),this.lastSn=A,this.lastPartIndex=g}},r.onFragLoaded=function(d,y){var m=y.frag,C=y.payload,T=this.initPTS,x=this.unparsedVttFrags;if(m.type===o.PlaylistLevelType.SUBTITLE)if(C.byteLength){if(!Object(k.isFiniteNumber)(T[m.cc])){x.push(y),T.length&&this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var E=m.decryptdata;if(E==null||E.key==null||E.method!=="AES-128"){var w=this.tracks[m.level],A=this.vttCCs;A[m.cc]||(A[m.cc]={start:m.start,prevCC:this.prevCC,new:!0},this.prevCC=m.cc),w&&w.textCodec===c.IMSC1_CODEC?this._parseIMSC1(m,C):this._parseVTTs(m,C,A)}}else this.hls.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},r._parseIMSC1=function(d,y){var m=this,C=this.hls;Object(c.parseIMSC1)(y,this.initPTS[d.cc],this.timescale[d.cc],function(T){m._appendCues(T,d.level),C.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(T){u.logger.log("Failed to parse IMSC1: "+T),C.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:T})})},r._parseVTTs=function(d,y,m){var C=this,T=this.hls;Object(_.parseWebVTT)(y,this.initPTS[d.cc],this.timescale[d.cc],m,d.cc,d.start,function(x){C._appendCues(x,d.level),T.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(x){C._fallbackToIMSC1(d,y),u.logger.log("Failed to parse VTT cue: "+x),T.trigger(M.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:x})})},r._fallbackToIMSC1=function(d,y){var m=this,C=this.tracks[d.level];C.textCodec||Object(c.parseIMSC1)(y,this.initPTS[d.cc],this.timescale[d.cc],function(){C.textCodec=c.IMSC1_CODEC,m._parseIMSC1(d,y)},function(){C.textCodec="wvtt"})},r._appendCues=function(d,y){var m=this.hls;if(this.config.renderTextTracksNatively){var C=this.textTracks[y];if(C.mode==="disabled")return;d.forEach(function(E){return Object(p.addCueToTrack)(C,E)})}else{var T=this.tracks[y],x=T.default?"default":"subtitles"+y;m.trigger(M.Events.CUES_PARSED,{type:"subtitles",cues:d,track:x})}},r.onFragDecrypted=function(d,y){var m=y.frag;if(m.type===o.PlaylistLevelType.SUBTITLE){if(!Object(k.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(y);return}this.onFragLoaded(M.Events.FRAG_LOADED,y)}},r.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},r.onFragParsingUserdata=function(d,y){var m=this.cea608Parser1,C=this.cea608Parser2;if(!this.enabled||!(m&&C))return;for(var T=0;T<y.samples.length;T++){var x=y.samples[T].bytes;if(x){var E=this.extractCea608Data(x);m.addData(y.samples[T].pts,E[0]),C.addData(y.samples[T].pts,E[1])}}},r.onBufferFlushing=function(d,y){var m=y.startOffset,C=y.endOffset,T=y.endOffsetSubtitles,x=y.type,E=this.media;if(!E||E.currentTime<C)return;if(!x||x==="video"){var w=this.captionsTracks;Object.keys(w).forEach(function(g){return Object(p.removeCuesInRange)(w[g],m,C)})}if(this.config.renderTextTracksNatively&&(m===0&&T!==void 0)){var A=this.textTracks;Object.keys(A).forEach(function(g){return Object(p.removeCuesInRange)(A[g],m,T)})}},r.extractCea608Data=function(d){for(var y=d[0]&31,m=2,C=[[],[]],T=0;T<y;T++){var x=d[m++],E=127&d[m++],w=127&d[m++],A=(4&x)!==0,g=3&x;if(E===0&&w===0)continue;A&&((g===0||g===1)&&(C[g].push(E),C[g].push(w)))}return C},i}();function l(i,r){return i&&i.label===r.name&&!(i.textTrack1||i.textTrack2)}function t(i,r,h,d){return Math.min(r,d)-Math.max(i,h)}function a(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return k});var k=function(){function M(S,_){this.subtle=void 0,this.aesIV=void 0,this.subtle=S,this.aesIV=_}var f=M.prototype;return f.decrypt=function(_,p){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},p,_)},M}()},"./src/crypt/aes-decryptor.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"removePadding",function(){return M}),D.d(L,"default",function(){return f});var k=D("./src/utils/typed-array.ts");function M(S){var _=S.byteLength,p=_&&new DataView(S.buffer).getUint8(_-1);return p?Object(k.sliceUint8)(S,0,_-p):S}var f=function(){function S(){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 _=S.prototype;return _.uint8ArrayToUint32Array_=function(c){for(var o=new DataView(c),u=new Uint32Array(4),s=0;s<4;s++)u[s]=o.getUint32(s*4);return u},_.initTable=function(){var c=this.sBox,o=this.invSBox,u=this.subMix,s=u[0],l=u[1],t=u[2],a=u[3],i=this.invSubMix,r=i[0],h=i[1],d=i[2],y=i[3],m=new Uint32Array(256),C=0,T=0,x=0;for(x=0;x<256;x++)x<128?m[x]=x<<1:m[x]=x<<1^283;for(x=0;x<256;x++){var E=T^T<<1^T<<2^T<<3^T<<4;E=E>>>8^E&255^99,c[C]=E,o[E]=C;var w=m[C],A=m[w],g=m[A],P=m[E]*257^E*16843008;s[C]=P<<24|P>>>8,l[C]=P<<16|P>>>16,t[C]=P<<8|P>>>24,a[C]=P,P=g*16843009^A*65537^w*257^C*16843008,r[E]=P<<24|P>>>8,h[E]=P<<16|P>>>16,d[E]=P<<8|P>>>24,y[E]=P,C?(C=w^m[m[m[g^w]]],T^=m[m[T]]):C=T=1}},_.expandKey=function(c){for(var o=this.uint8ArrayToUint32Array_(c),u=!0,s=0;s<o.length&&u;)u=o[s]===this.key[s],s++;if(u)return;this.key=o;var l=this.keySize=o.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);var t=this.ksRows=(l+6+1)*4,a,i,r=this.keySchedule=new Uint32Array(t),h=this.invKeySchedule=new Uint32Array(t),d=this.sBox,y=this.rcon,m=this.invSubMix,C=m[0],T=m[1],x=m[2],E=m[3],w,A;for(a=0;a<t;a++){if(a<l){w=r[a]=o[a];continue}A=w,a%l===0?(A=A<<8|A>>>24,A=d[A>>>24]<<24|d[A>>>16&255]<<16|d[A>>>8&255]<<8|d[A&255],A^=y[a/l|0]<<24):l>6&&a%l===4&&(A=d[A>>>24]<<24|d[A>>>16&255]<<16|d[A>>>8&255]<<8|d[A&255]),r[a]=w=(r[a-l]^A)>>>0}for(i=0;i<t;i++)a=t-i,i&3?A=r[a]:A=r[a-4],i<4||a<=4?h[i]=A:h[i]=C[d[A>>>24]]^T[d[A>>>16&255]]^x[d[A>>>8&255]]^E[d[A&255]],h[i]=h[i]>>>0},_.networkToHostOrderSwap=function(c){return c<<24|(c&65280)<<8|(c&16711680)>>8|c>>>24},_.decrypt=function(c,o,u){for(var s=this.keySize+6,l=this.invKeySchedule,t=this.invSBox,a=this.invSubMix,i=a[0],r=a[1],h=a[2],d=a[3],y=this.uint8ArrayToUint32Array_(u),m=y[0],C=y[1],T=y[2],x=y[3],E=new Int32Array(c),w=new Int32Array(E.length),A,g,P,O,F,X,W,N,G,U,H,V,ce,ye,Le=this.networkToHostOrderSwap;o<E.length;){for(G=Le(E[o]),U=Le(E[o+1]),H=Le(E[o+2]),V=Le(E[o+3]),F=G^l[0],X=V^l[1],W=H^l[2],N=U^l[3],ce=4,ye=1;ye<s;ye++)A=i[F>>>24]^r[X>>16&255]^h[W>>8&255]^d[N&255]^l[ce],g=i[X>>>24]^r[W>>16&255]^h[N>>8&255]^d[F&255]^l[ce+1],P=i[W>>>24]^r[N>>16&255]^h[F>>8&255]^d[X&255]^l[ce+2],O=i[N>>>24]^r[F>>16&255]^h[X>>8&255]^d[W&255]^l[ce+3],F=A,X=g,W=P,N=O,ce=ce+4;A=t[F>>>24]<<24^t[X>>16&255]<<16^t[W>>8&255]<<8^t[N&255]^l[ce],g=t[X>>>24]<<24^t[W>>16&255]<<16^t[N>>8&255]<<8^t[F&255]^l[ce+1],P=t[W>>>24]<<24^t[N>>16&255]<<16^t[F>>8&255]<<8^t[X&255]^l[ce+2],O=t[N>>>24]<<24^t[F>>16&255]<<16^t[X>>8&255]<<8^t[W&255]^l[ce+3],w[o]=Le(A^m),w[o+1]=Le(O^C),w[o+2]=Le(P^T),w[o+3]=Le(g^x),m=G,C=U,T=H,x=V,o=o+4}return w.buffer},S}()},"./src/crypt/decrypter.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return o});var k=D("./src/crypt/aes-crypto.ts"),M=D("./src/crypt/fast-aes-key.ts"),f=D("./src/crypt/aes-decryptor.ts"),S=D("./src/utils/logger.ts"),_=D("./src/utils/mp4-tools.ts"),p=D("./src/utils/typed-array.ts"),c=16,o=function(){function u(l,t,a){var i=a===void 0?{}:a,r=i.removePKCS7Padding,h=r===void 0?!0:r;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=l,this.config=t,this.removePKCS7Padding=h,h)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(y){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var s=u.prototype;return s.destroy=function(){this.observer=null},s.isSync=function(){return this.config.enableSoftwareAES},s.flush=function(){var t=this.currentResult;if(!t){this.reset();return}var a=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Object(f.removePadding)(a):a},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(t,a,i,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(t),a,i);var h=this.flush();h&&r(h.buffer)}else this.webCryptoDecrypt(new Uint8Array(t),a,i).then(r)},s.softwareDecrypt=function(t,a,i){var r=this.currentIV,h=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(t=Object(_.appendUint8Array)(d,t),this.remainderData=null);var y=this.getValidChunk(t);if(!y.length)return null;r&&(i=r);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new f.default),m.expandKey(a);var C=h;return this.currentResult=m.decrypt(y.buffer,0,i),this.currentIV=Object(p.sliceUint8)(y,-16).buffer,C||null},s.webCryptoDecrypt=function(t,a,i){var r=this,h=this.subtle;return(this.key!==a||!this.fastAesKey)&&(this.key=a,this.fastAesKey=new M.default(h,a)),this.fastAesKey.expandKey().then(function(d){if(!h)return Promise.reject(new Error("web crypto not initialized"));var y=new k.default(h,i);return y.decrypt(t.buffer,d)}).catch(function(d){return r.onWebCryptoError(d,t,a,i)})},s.onWebCryptoError=function(t,a,i,r){return S.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",t),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(a,i,r)},s.getValidChunk=function(t){var a=t,i=t.length-t.length%c;return i!==t.length&&(a=Object(p.sliceUint8)(t,0,i),this.remainderData=Object(p.sliceUint8)(t,i)),a},s.logOnce=function(t){if(!this.logEnabled)return;S.logger.log("[decrypter.ts]: "+t),this.logEnabled=!1},u}()},"./src/crypt/fast-aes-key.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return k});var k=function(){function M(S,_){this.subtle=void 0,this.key=void 0,this.subtle=S,this.key=_}var f=M.prototype;return f.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},M}()},"./src/demux/aacdemuxer.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/adts.ts"),f=D("./src/utils/logger.ts"),S=D("./src/demux/id3.ts");function _(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,p(o,u)}function p(o,u){return p=Object.setPrototypeOf||function(l,t){return l.__proto__=t,l},p(o,u)}var c=function(o){_(u,o);function u(l,t){var a;return a=o.call(this)||this,a.observer=void 0,a.config=void 0,a.observer=l,a.config=t,a}var s=u.prototype;return s.resetInitSegment=function(t,a,i){o.prototype.resetInitSegment.call(this,t,a,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}},u.probe=function(t){if(!t)return!1;for(var a=S.getID3Data(t,0)||[],i=a.length,r=t.length;i<r;i++)if(M.probe(t,i))return f.logger.log("ADTS sync word found !"),!0;return!1},s.canParse=function(t,a){return M.canParse(t,a)},s.appendFrame=function(t,a,i){M.initTrackConfig(t,this.observer,a,i,t.manifestCodec);var r=M.appendFrame(t,a,i,this.initPTS,this.frameIndex);if(r&&r.missing===0)return r},u}(k.default);c.minProbeByteLength=9,L.default=c},"./src/demux/adts.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"getAudioConfig",function(){return S}),D.d(L,"isHeaderPattern",function(){return _}),D.d(L,"getHeaderLength",function(){return p}),D.d(L,"getFullFrameLength",function(){return c}),D.d(L,"canGetFrameLength",function(){return o}),D.d(L,"isHeader",function(){return u}),D.d(L,"canParse",function(){return s}),D.d(L,"probe",function(){return l}),D.d(L,"initTrackConfig",function(){return t}),D.d(L,"getFrameDuration",function(){return a}),D.d(L,"parseFrameHeader",function(){return i}),D.d(L,"appendFrame",function(){return r});var k=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),f=D("./src/events.ts");function S(h,d,y,m){var C,T,x,E,w=navigator.userAgent.toLowerCase(),A=m,g=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];C=((d[y+2]&192)>>>6)+1;var P=(d[y+2]&60)>>>2;if(P>g.length-1){h.trigger(f.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+P});return}return x=(d[y+2]&1)<<2,x|=(d[y+3]&192)>>>6,k.logger.log("manifest codec:"+m+", ADTS type:"+C+", samplingIndex:"+P),/firefox/i.test(w)?P>=6?(C=5,E=new Array(4),T=P-3):(C=2,E=new Array(2),T=P):w.indexOf("android")!==-1?(C=2,E=new Array(2),T=P):(C=5,E=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&P>=6?T=P-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(P>=6&&x===1||/vivaldi/i.test(w))||!m&&x===1)&&(C=2,E=new Array(2)),T=P)),E[0]=C<<3,E[0]|=(P&14)>>1,E[1]|=(P&1)<<7,E[1]|=x<<3,C===5&&(E[1]|=(T&14)>>1,E[2]=(T&1)<<7,E[2]|=2<<2,E[3]=0),{config:E,samplerate:g[P],channelCount:x,codec:"mp4a.40."+C,manifestCodec:A}}function _(h,d){return h[d]===255&&(h[d+1]&246)===240}function p(h,d){return h[d+1]&1?7:9}function c(h,d){return(h[d+3]&3)<<11|h[d+4]<<3|(h[d+5]&224)>>>5}function o(h,d){return d+5<h.length}function u(h,d){return d+1<h.length&&_(h,d)}function s(h,d){return o(h,d)&&_(h,d)&&c(h,d)<=h.length-d}function l(h,d){if(u(h,d)){var y=p(h,d);if(d+y>=h.length)return!1;var m=c(h,d);if(m<=y)return!1;var C=d+m;return C===h.length||u(h,C)}return!1}function t(h,d,y,m,C){if(!h.samplerate){var T=S(d,y,m,C);if(!T)return;h.config=T.config,h.samplerate=T.samplerate,h.channelCount=T.channelCount,h.codec=T.codec,h.manifestCodec=T.manifestCodec,k.logger.log("parsed codec:"+h.codec+", rate:"+T.samplerate+", channels:"+T.channelCount)}}function a(h){return 1024*9e4/h}function i(h,d,y,m,C){var T=p(h,d),x=c(h,d);if(x-=T,x>0){var E=y+m*C;return{headerLength:T,frameLength:x,stamp:E}}}function r(h,d,y,m,C){var T=a(h.samplerate),x=i(d,y,m,C,T);if(x){var E=x.frameLength,w=x.headerLength,A=x.stamp,g=w+E,P=Math.max(0,y+g-d.length),O;P?(O=new Uint8Array(g-w),O.set(d.subarray(y+w,d.length),0)):O=d.subarray(y+w,y+g);var F={unit:O,pts:A};return P||h.samples.push(F),{sample:F,length:g,missing:P}}}},"./src/demux/base-audio-demuxer.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"initPTSFn",function(){return c});var k=D("./src/polyfills/number.ts"),M=D("./src/demux/id3.ts"),f=D("./src/demux/dummy-demuxed-track.ts"),S=D("./src/utils/mp4-tools.ts"),_=D("./src/utils/typed-array.ts"),p=function(){function o(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var u=o.prototype;return u.resetInitSegment=function(l,t,a){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},u.resetTimeStamp=function(){},u.resetContiguity=function(){},u.canParse=function(l,t){return!1},u.appendFrame=function(l,t,a){},u.demux=function(l,t){this.cachedData&&(l=Object(S.appendUint8Array)(this.cachedData,l),this.cachedData=null);var a=M.getID3Data(l,0),i=a?a.length:0,r,h,d=this._audioTrack,y=this._id3Track,m=a?M.getTimeStamp(a):void 0,C=l.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=c(m,t)),a&&a.length>0&&y.samples.push({pts:this.initPTS,dts:this.initPTS,data:a}),h=this.initPTS;i<C;){if(this.canParse(l,i)){var T=this.appendFrame(d,l,i);T?(this.frameIndex++,h=T.sample.pts,i+=T.length,r=i):i=C}else M.canParse(l,i)?(a=M.getID3Data(l,i),y.samples.push({pts:h,dts:h,data:a}),i+=a.length,r=i):i++;if(i===C&&r!==C){var x=Object(_.sliceUint8)(l,r);this.cachedData?this.cachedData=Object(S.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:d,avcTrack:Object(f.dummyTrack)(),id3Track:y,textTrack:Object(f.dummyTrack)()}},u.demuxSampleAes=function(l,t,a){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},u.flush=function(l){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(f.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(f.dummyTrack)()}},u.destroy=function(){},o}(),c=function(u,s){return Object(k.isFiniteNumber)(u)?u*90:s*9e4};L.default=p},"./src/demux/chunk-cache.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return k});var k=function(){function f(){this.chunks=[],this.dataLength=0}var S=f.prototype;return S.push=function(p){this.chunks.push(p),this.dataLength+=p.length},S.flush=function(){var p=this.chunks,c=this.dataLength,o;if(p.length)p.length===1?o=p[0]:o=M(p,c);else return new Uint8Array(0);return this.reset(),o},S.reset=function(){this.chunks.length=0,this.dataLength=0},f}();function M(f,S){for(var _=new Uint8Array(S),p=0,c=0;c<f.length;c++){var o=f[c];_.set(o,p),p+=o.length}return _}},"./src/demux/dummy-demuxed-track.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"dummyTrack",function(){return k});function k(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/utils/logger.ts"),M=function(){function f(_){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=_,this.bytesAvailable=_.byteLength,this.word=0,this.bitsAvailable=0}var S=f.prototype;return S.loadWord=function(){var p=this.data,c=this.bytesAvailable,o=p.byteLength-c,u=new Uint8Array(4),s=Math.min(4,c);if(s===0)throw new Error("no bytes available");u.set(p.subarray(o,o+s)),this.word=new DataView(u.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s},S.skipBits=function(p){var c;this.bitsAvailable>p?(this.word<<=p,this.bitsAvailable-=p):(p-=this.bitsAvailable,c=p>>3,p-=c>>3,this.bytesAvailable-=c,this.loadWord(),this.word<<=p,this.bitsAvailable-=p)},S.readBits=function(p){var c=Math.min(this.bitsAvailable,p),o=this.word>>>32-c;return p>32&&k.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=c,this.bitsAvailable>0?this.word<<=c:this.bytesAvailable>0&&this.loadWord(),c=p-c,c>0&&this.bitsAvailable?o<<c|this.readBits(c):o},S.skipLZ=function(){var p;for(p=0;p<this.bitsAvailable;++p)if((this.word&2147483648>>>p)!==0)return this.word<<=p,this.bitsAvailable-=p,p;return this.loadWord(),p+this.skipLZ()},S.skipUEG=function(){this.skipBits(1+this.skipLZ())},S.skipEG=function(){this.skipBits(1+this.skipLZ())},S.readUEG=function(){var p=this.skipLZ();return this.readBits(p+1)-1},S.readEG=function(){var p=this.readUEG();return 1&p?1+p>>>1:-1*(p>>>1)},S.readBoolean=function(){return this.readBits(1)===1},S.readUByte=function(){return this.readBits(8)},S.readUShort=function(){return this.readBits(16)},S.readUInt=function(){return this.readBits(32)},S.skipScalingList=function(p){for(var c=8,o=8,u,s=0;s<p;s++)o!==0&&(u=this.readEG(),o=(c+u+256)%256),c=o===0?c:o},S.readSPS=function(){var p=0,c=0,o=0,u=0,s,l,t,a=this.readUByte.bind(this),i=this.readBits.bind(this),r=this.readUEG.bind(this),h=this.readBoolean.bind(this),d=this.skipBits.bind(this),y=this.skipEG.bind(this),m=this.skipUEG.bind(this),C=this.skipScalingList.bind(this);a();var T=a();if(i(5),d(3),a(),m(),T===100||T===110||T===122||T===244||T===44||T===83||T===86||T===118||T===128){var x=r();if(x===3&&d(1),m(),m(),d(1),h())for(l=x!==3?8:12,t=0;t<l;t++)h()&&(t<6?C(16):C(64))}m();var E=r();if(E===0)r();else if(E===1)for(d(1),y(),y(),s=r(),t=0;t<s;t++)y();m(),d(1);var w=r(),A=r(),g=i(1);g===0&&d(1),d(1),h()&&(p=r(),c=r(),o=r(),u=r());var P=[1,1];if(h()&&h()){var O=a();switch(O){case 1:P=[1,1];break;case 2:P=[12,11];break;case 3:P=[10,11];break;case 4:P=[16,11];break;case 5:P=[40,33];break;case 6:P=[24,11];break;case 7:P=[20,11];break;case 8:P=[32,11];break;case 9:P=[80,33];break;case 10:P=[18,11];break;case 11:P=[15,11];break;case 12:P=[64,33];break;case 13:P=[160,99];break;case 14:P=[4,3];break;case 15:P=[3,2];break;case 16:P=[2,1];break;case 255:{P=[a()<<8|a(),a()<<8|a()];break}}}return{width:Math.ceil((w+1)*16-p*2-c*2),height:(2-g)*(A+1)*16-(g?2:4)*(o+u),pixelRatio:P}},S.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},f}();L.default=M},"./src/demux/id3.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"isHeader",function(){return k}),D.d(L,"isFooter",function(){return M}),D.d(L,"getID3Data",function(){return f}),D.d(L,"canParse",function(){return _}),D.d(L,"getTimeStamp",function(){return p}),D.d(L,"isTimeStampFrame",function(){return c}),D.d(L,"getID3Frames",function(){return u}),D.d(L,"decodeFrame",function(){return s}),D.d(L,"utf8ArrayToStr",function(){return r}),D.d(L,"testables",function(){return h});var k=function(C,T){return T+10<=C.length&&(C[T]===73&&C[T+1]===68&&C[T+2]===51&&(C[T+3]<255&&C[T+4]<255&&(C[T+6]<128&&C[T+7]<128&&C[T+8]<128&&C[T+9]<128)))},M=function(C,T){return T+10<=C.length&&(C[T]===51&&C[T+1]===68&&C[T+2]===73&&(C[T+3]<255&&C[T+4]<255&&(C[T+6]<128&&C[T+7]<128&&C[T+8]<128&&C[T+9]<128)))},f=function(C,T){for(var x=T,E=0;k(C,T);){E+=10;var w=S(C,T+6);E+=w,M(C,T+10)&&(E+=10),T+=E}return E>0?C.subarray(x,x+E):void 0},S=function(C,T){var x=0;return x=(C[T]&127)<<21,x|=(C[T+1]&127)<<14,x|=(C[T+2]&127)<<7,x|=C[T+3]&127,x},_=function(C,T){return k(C,T)&&S(C,T+6)+10<=C.length-T},p=function(C){for(var T=u(C),x=0;x<T.length;x++){var E=T[x];if(c(E))return i(E)}return},c=function(C){return C&&C.key==="PRIV"&&C.info==="com.apple.streaming.transportStreamTimestamp"},o=function(C){var T=String.fromCharCode(C[0],C[1],C[2],C[3]),x=S(C,4),E=10;return{type:T,size:x,data:C.subarray(E,E+x)}},u=function(C){for(var T=0,x=[];k(C,T);){var E=S(C,T+6);T+=10;for(var w=T+E;T+8<w;){var A=o(C.subarray(T)),g=s(A);g&&x.push(g),T+=A.size+10}M(C,T)&&(T+=10)}return x},s=function(C){return C.type==="PRIV"?l(C):C.type[0]==="W"?a(C):t(C)},l=function(C){if(C.size<2)return;var T=r(C.data,!0),x=new Uint8Array(C.data.subarray(T.length+1));return{key:C.type,info:T,data:x.buffer}},t=function(C){if(C.size<2)return;if(C.type==="TXXX"){var T=1,x=r(C.data.subarray(T),!0);T+=x.length+1;var E=r(C.data.subarray(T));return{key:C.type,info:x,data:E}}var w=r(C.data.subarray(1));return{key:C.type,data:w}},a=function(C){if(C.type==="WXXX"){if(C.size<2)return;var T=1,x=r(C.data.subarray(T),!0);T+=x.length+1;var E=r(C.data.subarray(T));return{key:C.type,info:x,data:E}}var w=r(C.data);return{key:C.type,data:w}},i=function(C){if(C.data.byteLength===8){var T=new Uint8Array(C.data),x=T[3]&1,E=(T[4]<<23)+(T[5]<<15)+(T[6]<<7)+T[7];return E/=45,x&&(E+=4772185884e-2),Math.round(E)}return},r=function(C,T){T===void 0&&(T=!1);var x=y();if(x){var E=x.decode(C);if(T){var w=E.indexOf("\0");return w!==-1?E.substring(0,w):E}return E.replace(/\0/g,"")}for(var A=C.length,g,P,O,F="",X=0;X<A;){if(g=C[X++],g===0&&T)return F;if(g===0||g===3)continue;switch(g>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:F+=String.fromCharCode(g);break;case 12:case 13:P=C[X++],F+=String.fromCharCode((g&31)<<6|P&63);break;case 14:P=C[X++],O=C[X++],F+=String.fromCharCode((g&15)<<12|(P&63)<<6|(O&63)<<0);break;default:}}return F},h={decodeTextFrame:t},d;function y(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/demux/base-audio-demuxer.ts"),M=D("./src/demux/id3.ts"),f=D("./src/utils/logger.ts"),S=D("./src/demux/mpegaudio.ts");function _(o,u){o.prototype=Object.create(u.prototype),o.prototype.constructor=o,p(o,u)}function p(o,u){return p=Object.setPrototypeOf||function(l,t){return l.__proto__=t,l},p(o,u)}var c=function(o){_(u,o);function u(){return o.apply(this,arguments)||this}var s=u.prototype;return s.resetInitSegment=function(t,a,i){o.prototype.resetInitSegment.call(this,t,a,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:t,duration:i,inputTimeScale:9e4,dropped:0}},u.probe=function(t){if(!t)return!1;for(var a=M.getID3Data(t,0)||[],i=a.length,r=t.length;i<r;i++)if(S.probe(t,i))return f.logger.log("MPEG Audio sync word found !"),!0;return!1},s.canParse=function(t,a){return S.canParse(t,a)},s.appendFrame=function(t,a,i){return this.initPTS===null?void 0:S.appendFrame(t,a,i,this.initPTS,this.frameIndex)},u}(k.default);c.minProbeByteLength=4,L.default=c},"./src/demux/mp4demuxer.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/utils/mp4-tools.ts"),M=D("./src/demux/dummy-demuxed-track.ts"),f=function(){function S(p,c){this.remainderData=null,this.config=void 0,this.config=c}var _=S.prototype;return _.resetTimeStamp=function(){},_.resetInitSegment=function(){},_.resetContiguity=function(){},S.probe=function(c){return Object(k.findBox)({data:c,start:0,end:Math.min(c.length,16384)},["moof"]).length>0},_.demux=function(c){var o=c,u=Object(M.dummyTrack)();if(this.config.progressive){this.remainderData&&(o=Object(k.appendUint8Array)(this.remainderData,c));var s=Object(k.segmentValidRange)(o);this.remainderData=s.remainder,u.samples=s.valid||new Uint8Array}else u.samples=o;return{audioTrack:Object(M.dummyTrack)(),avcTrack:u,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},_.flush=function(){var c=Object(M.dummyTrack)();return c.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(M.dummyTrack)(),avcTrack:c,id3Track:Object(M.dummyTrack)(),textTrack:Object(M.dummyTrack)()}},_.demuxSampleAes=function(c,o,u){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},_.destroy=function(){},S}();f.minProbeByteLength=1024,L.default=f},"./src/demux/mpegaudio.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"appendFrame",function(){return p}),D.d(L,"parseHeader",function(){return c}),D.d(L,"isHeaderPattern",function(){return o}),D.d(L,"isHeader",function(){return u}),D.d(L,"canParse",function(){return s}),D.d(L,"probe",function(){return l});var k=null,M=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],f=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],S=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],_=[0,1,1,4];function p(t,a,i,r,h){if(i+24>a.length)return;var d=c(a,i);if(d&&i+d.frameLength<=a.length){var y=d.samplesPerFrame*9e4/d.sampleRate,m=r+h*y,C={unit:a.subarray(i,i+d.frameLength),pts:m,dts:m};return t.config=[],t.channelCount=d.channelCount,t.samplerate=d.sampleRate,t.samples.push(C),{sample:C,length:d.frameLength,missing:0}}}function c(t,a){var i=t[a+1]>>3&3,r=t[a+1]>>1&3,h=t[a+2]>>4&15,d=t[a+2]>>2&3;if(i!==1&&h!==0&&h!==15&&d!==3){var y=t[a+2]>>1&1,m=t[a+3]>>6,C=i===3?3-r:r===3?3:4,T=M[C*14+h-1]*1e3,x=i===3?0:i===2?1:2,E=f[x*3+d],w=m===3?1:2,A=S[i][r],g=_[r],P=A*8*g,O=Math.floor(A*T/E+y)*g;if(k===null){var F=navigator.userAgent||"",X=F.match(/Chrome\/(\d+)/i);k=X?parseInt(X[1]):0}var W=!!k&&k<=87;return W&&r===2&&T>=224e3&&m===0&&(t[a+3]=t[a+3]|128),{sampleRate:E,channelCount:w,frameLength:O,samplesPerFrame:P}}}function o(t,a){return t[a]===255&&(t[a+1]&224)===224&&(t[a+1]&6)!==0}function u(t,a){return a+1<t.length&&o(t,a)}function s(t,a){var i=4;return o(t,a)&&i<=t.length-a}function l(t,a){if(a+1<t.length&&o(t,a)){var i=4,r=c(t,a),h=i;r!=null&&r.frameLength&&(h=r.frameLength);var d=a+h;return d===t.length||u(t,d)}return!1}},"./src/demux/sample-aes.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/crypt/decrypter.ts"),M=D("./src/demux/tsdemuxer.ts"),f=function(){function S(p,c,o){this.keyData=void 0,this.decrypter=void 0,this.keyData=o,this.decrypter=new k.default(p,c,{removePKCS7Padding:!1})}var _=S.prototype;return _.decryptBuffer=function(c,o){this.decrypter.decrypt(c,this.keyData.key.buffer,this.keyData.iv.buffer,o)},_.decryptAacSample=function(c,o,u,s){var l=c[o].unit,t=l.subarray(16,l.length-l.length%16),a=t.buffer.slice(t.byteOffset,t.byteOffset+t.length),i=this;this.decryptBuffer(a,function(r){var h=new Uint8Array(r);l.set(h,16),s||i.decryptAacSamples(c,o+1,u)})},_.decryptAacSamples=function(c,o,u){for(;;o++){if(o>=c.length){u();return}if(c[o].unit.length<32)continue;var s=this.decrypter.isSync();if(this.decryptAacSample(c,o,u,s),!s)return}},_.getAvcEncryptedData=function(c){for(var o=Math.floor((c.length-48)/160)*16+16,u=new Int8Array(o),s=0,l=32;l<=c.length-16;l+=160,s+=16)u.set(c.subarray(l,l+16),s);return u},_.getAvcDecryptedUnit=function(c,o){for(var u=new Uint8Array(o),s=0,l=32;l<=c.length-16;l+=160,s+=16)c.set(u.subarray(s,s+16),l);return c},_.decryptAvcSample=function(c,o,u,s,l,t){var a=Object(M.discardEPB)(l.data),i=this.getAvcEncryptedData(a),r=this;this.decryptBuffer(i.buffer,function(h){l.data=r.getAvcDecryptedUnit(a,h),t||r.decryptAvcSamples(c,o,u+1,s)})},_.decryptAvcSamples=function(c,o,u,s){if(c instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;o++,u=0){if(o>=c.length){s();return}for(var l=c[o].units;!(u>=l.length);u++){var t=l[u];if(t.data.length<=48||t.type!==1&&t.type!==5)continue;var a=this.decrypter.isSync();if(this.decryptAvcSample(c,o,u,s,t,a),!a)return}}},S}();L.default=f},"./src/demux/transmuxer-interface.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return l});var k=D("./node_modules/webworkify-webpack/index.js"),M=D.n(k),f=D("./src/events.ts"),S=D("./src/demux/transmuxer.ts"),_=D("./src/utils/logger.ts"),p=D("./src/errors.ts"),c=D("./src/utils/mediasource-helper.ts"),o=D("./node_modules/eventemitter3/index.js"),u=D.n(o),s=Object(c.getMediaSource)()||{isTypeSupported:function(){return!1}},l=function(){function t(i,r,h,d){var y=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=i,this.id=r,this.onTransmuxComplete=h,this.onFlush=d;var m=i.config,C=function(A,g){g=g||{},g.frag=y.frag,g.id=y.id,i.trigger(A,g)};this.observer=new o.EventEmitter,this.observer.on(f.Events.FRAG_DECRYPTED,C),this.observer.on(f.Events.ERROR,C);var T={mp4:s.isTypeSupported("video/mp4"),mpeg:s.isTypeSupported("audio/mpeg"),mp3:s.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(m.enableWorker&&typeof Worker!="undefined"){_.logger.log("demuxing in webworker");var E;try{E=this.worker=k("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),E.addEventListener("message",this.onwmsg),E.onerror=function(w){i.trigger(f.Events.ERROR,{type:p.ErrorTypes.OTHER_ERROR,details:p.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(w.message+" ("+w.filename+":"+w.lineno+")")})},E.postMessage({cmd:"init",typeSupported:T,vendor:x,id:r,config:JSON.stringify(m)})}catch(w){_.logger.warn("Error in worker:",w),_.logger.error("Error while initializing DemuxerWorker, fallback to inline"),E&&self.URL.revokeObjectURL(E.objectURL),this.transmuxer=new S.default(this.observer,T,m,x,r),this.worker=null}}else this.transmuxer=new S.default(this.observer,T,m,x,r)}var a=t.prototype;return a.destroy=function(){var r=this.worker;if(r)r.removeEventListener("message",this.onwmsg),r.terminate(),this.worker=null;else{var h=this.transmuxer;h&&(h.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},a.push=function(r,h,d,y,m,C,T,x,E,w){var A=this;E.transmuxing.start=self.performance.now();var g=this.transmuxer,P=this.worker,O=C?C.start:m.start,F=m.decryptdata,X=this.frag,W=!(X&&m.cc===X.cc),N=!(X&&E.level===X.level),G=X?E.sn-X.sn:-1,U=this.part?E.part-this.part.index:1,H=!N&&(G===1||G===0&&U===1),V=self.performance.now();(N||G||m.stats.parsing.start===0)&&(m.stats.parsing.start=V),C&&(U||!H)&&(C.stats.parsing.start=V);var ce=new S.TransmuxState(W,H,x,N,O);if(!H||W){_.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+E.sn+" p: "+E.part+" level: "+E.level+" id: "+E.id+`
discontinuity: `+W+`
trackSwitch: `+N+`
contiguous: `+H+`
accurateTimeOffset: `+x+`
timeOffset: `+O);var ye=new S.TransmuxConfig(d,y,h,T,w);this.configureTransmuxer(ye)}if(this.frag=m,this.part=C,P)P.postMessage({cmd:"demux",data:r,decryptdata:F,chunkMeta:E,state:ce},r instanceof ArrayBuffer?[r]:[]);else if(g){var Le=g.push(r,F,E,ce);Object(S.isPromise)(Le)?Le.then(function(Ze){A.handleTransmuxComplete(Ze)}):this.handleTransmuxComplete(Le)}},a.flush=function(r){var h=this;r.transmuxing.start=self.performance.now();var d=this.transmuxer,y=this.worker;if(y)y.postMessage({cmd:"flush",chunkMeta:r});else if(d){var m=d.flush(r);Object(S.isPromise)(m)?m.then(function(C){h.handleFlushResult(C,r)}):this.handleFlushResult(m,r)}},a.handleFlushResult=function(r,h){var d=this;r.forEach(function(y){d.handleTransmuxComplete(y)}),this.onFlush(h)},a.onWorkerMessage=function(r){var h=r.data,d=this.hls;switch(h.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(h.data);break}case"flush":{this.onFlush(h.data);break}default:{h.data=h.data||{},h.data.frag=this.frag,h.data.id=this.id,d.trigger(h.event,h.data);break}}},a.configureTransmuxer=function(r){var h=this.worker,d=this.transmuxer;h?h.postMessage({cmd:"configure",config:r}):d&&d.configure(r)},a.handleTransmuxComplete=function(r){r.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(r)},t}()},"./src/demux/transmuxer-worker.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return p});var k=D("./src/demux/transmuxer.ts"),M=D("./src/events.ts"),f=D("./src/utils/logger.ts"),S=D("./node_modules/eventemitter3/index.js"),_=D.n(S);function p(l){var t=new S.EventEmitter,a=function(r,h){l.postMessage({event:r,data:h})};t.on(M.Events.FRAG_DECRYPTED,a),t.on(M.Events.ERROR,a),l.addEventListener("message",function(i){var r=i.data;switch(r.cmd){case"init":{var h=JSON.parse(r.config);l.transmuxer=new k.default(t,r.typeSupported,h,r.vendor,r.id),Object(f.enableLogs)(h.debug),a("init",null);break}case"configure":{l.transmuxer.configure(r.config);break}case"demux":{var d=l.transmuxer.push(r.data,r.decryptdata,r.chunkMeta,r.state);Object(k.isPromise)(d)?d.then(function(C){c(l,C)}):c(l,d);break}case"flush":{var y=r.chunkMeta,m=l.transmuxer.flush(y);Object(k.isPromise)(m)?m.then(function(C){u(l,C,y)}):u(l,m,y);break}default:break}})}function c(l,t){if(s(t.remuxResult))return;var a=[],i=t.remuxResult,r=i.audio,h=i.video;r&&o(a,r),h&&o(a,h),l.postMessage({event:"transmuxComplete",data:t},a)}function o(l,t){t.data1&&l.push(t.data1.buffer),t.data2&&l.push(t.data2.buffer)}function u(l,t,a){t.forEach(function(i){c(l,i)}),l.postMessage({event:"flush",data:a})}function s(l){return!l.audio&&!l.video&&!l.text&&!l.id3&&!l.initSegment}},"./src/demux/transmuxer.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return h}),D.d(L,"isPromise",function(){return m}),D.d(L,"TransmuxConfig",function(){return C}),D.d(L,"TransmuxState",function(){return T});var k=D("./src/events.ts"),M=D("./src/errors.ts"),f=D("./src/crypt/decrypter.ts"),S=D("./src/demux/aacdemuxer.ts"),_=D("./src/demux/mp4demuxer.ts"),p=D("./src/demux/tsdemuxer.ts"),c=D("./src/demux/mp3demuxer.ts"),o=D("./src/remux/mp4-remuxer.ts"),u=D("./src/remux/passthrough-remuxer.ts"),s=D("./src/demux/chunk-cache.ts"),l=D("./src/utils/mp4-tools.ts"),t=D("./src/utils/logger.ts"),a;try{a=self.performance.now.bind(self.performance)}catch(x){t.logger.debug("Unable to use Performance API on this environment"),a=self.Date.now}var i=[{demux:p.default,remux:o.default},{demux:_.default,remux:u.default},{demux:S.default,remux:o.default},{demux:c.default,remux:o.default}],r=1024;i.forEach(function(x){var E=x.demux;r=Math.max(r,E.minProbeByteLength)});var h=function(){function x(w,A,g,P,O){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new s.default,this.observer=w,this.typeSupported=A,this.config=g,this.vendor=P,this.id=O}var E=x.prototype;return E.configure=function(A){this.transmuxConfig=A,this.decrypter&&this.decrypter.reset()},E.push=function(A,g,P,O){var F=this,X=P.transmuxing;X.executeStart=a();var W=new Uint8Array(A),N=this.cache,G=this.config,U=this.currentTransmuxState,H=this.transmuxConfig;O&&(this.currentTransmuxState=O);var V=d(W,g);if(V&&V.method==="AES-128"){var ce=this.getDecrypter();if(G.enableSoftwareAES){var ye=ce.softwareDecrypt(W,V.key.buffer,V.iv.buffer);if(!ye)return X.executeEnd=a(),y(P);W=new Uint8Array(ye)}else return this.decryptionPromise=ce.webCryptoDecrypt(W,V.key.buffer,V.iv.buffer).then(function(De){var Ve=F.push(De,null,P);return F.decryptionPromise=null,Ve}),this.decryptionPromise}var Le=O||U,Ze=Le.contiguous,Ye=Le.discontinuity,Oe=Le.trackSwitch,We=Le.accurateTimeOffset,ze=Le.timeOffset,Ae=H.audioCodec,xe=H.videoCodec,le=H.defaultInitPts,Se=H.duration,pe=H.initSegmentData;if((Ye||Oe)&&this.resetInitSegment(pe,Ae,xe,Se),Ye&&this.resetInitialTimestamp(le),Ze||this.resetContiguity(),this.needsProbing(W,Ye,Oe)){if(N.dataLength){var Ge=N.flush();W=Object(l.appendUint8Array)(Ge,W)}this.configureTransmuxer(W,H)}var fe=this.transmux(W,V,ze,We,P),ge=this.currentTransmuxState;return ge.contiguous=!0,ge.discontinuity=!1,ge.trackSwitch=!1,X.executeEnd=a(),fe},E.flush=function(A){var g=this,P=A.transmuxing;P.executeStart=a();var O=this.decrypter,F=this.cache,X=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return g.flush(A)});var N=[],G=X.timeOffset;if(O){var U=O.flush();U&&N.push(this.push(U,null,A))}var H=F.dataLength;F.reset();var V=this.demuxer,ce=this.remuxer;if(!V||!ce)return H>=r&&this.observer.emit(k.Events.ERROR,k.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),P.executeEnd=a(),[y(A)];var ye=V.flush(G);return m(ye)?ye.then(function(Le){return g.flushRemux(N,Le,A),N}):(this.flushRemux(N,ye,A),N)},E.flushRemux=function(A,g,P){var O=g.audioTrack,F=g.avcTrack,X=g.id3Track,W=g.textTrack,N=this.currentTransmuxState,G=N.accurateTimeOffset,U=N.timeOffset;t.logger.log("[transmuxer.ts]: Flushed fragment "+P.sn+(P.part>-1?" p: "+P.part:"")+" of level "+P.level);var H=this.remuxer.remux(O,F,X,W,U,G,!0,this.id);A.push({remuxResult:H,chunkMeta:P}),P.transmuxing.executeEnd=a()},E.resetInitialTimestamp=function(A){var g=this.demuxer,P=this.remuxer;if(!g||!P)return;g.resetTimeStamp(A),P.resetTimeStamp(A)},E.resetContiguity=function(){var A=this.demuxer,g=this.remuxer;if(!A||!g)return;A.resetContiguity(),g.resetNextTimestamp()},E.resetInitSegment=function(A,g,P,O){var F=this.demuxer,X=this.remuxer;if(!F||!X)return;F.resetInitSegment(g,P,O),X.resetInitSegment(A,g,P)},E.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},E.transmux=function(A,g,P,O,F){var X;return g&&g.method==="SAMPLE-AES"?X=this.transmuxSampleAes(A,g,P,O,F):X=this.transmuxUnencrypted(A,P,O,F),X},E.transmuxUnencrypted=function(A,g,P,O){var F=this.demuxer.demux(A,g,!1,!this.config.progressive),X=F.audioTrack,W=F.avcTrack,N=F.id3Track,G=F.textTrack,U=this.remuxer.remux(X,W,N,G,g,P,!1,this.id);return{remuxResult:U,chunkMeta:O}},E.transmuxSampleAes=function(A,g,P,O,F){var X=this;return this.demuxer.demuxSampleAes(A,g,P).then(function(W){var N=X.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,P,O,!1,X.id);return{remuxResult:N,chunkMeta:F}})},E.configureTransmuxer=function(A,g){for(var P=this.config,O=this.observer,F=this.typeSupported,X=this.vendor,W=g.audioCodec,N=g.defaultInitPts,G=g.duration,U=g.initSegmentData,H=g.videoCodec,V,ce=0,ye=i.length;ce<ye;ce++)if(i[ce].demux.probe(A)){V=i[ce];break}V||(t.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),V={demux:_.default,remux:u.default});var Le=this.demuxer,Ze=this.remuxer,Ye=V.remux,Oe=V.demux;(!Ze||!(Ze instanceof Ye))&&(this.remuxer=new Ye(O,P,F,X)),(!Le||!(Le instanceof Oe))&&(this.demuxer=new Oe(O,P,F),this.probe=Oe.probe),this.resetInitSegment(U,W,H,G),this.resetInitialTimestamp(N)},E.needsProbing=function(A,g,P){return!this.demuxer||!this.remuxer||g||P},E.getDecrypter=function(){var A=this.decrypter;return A||(A=this.decrypter=new f.default(this.observer,this.config)),A},x}();function d(x,E){var w=null;return x.byteLength>0&&E!=null&&E.key!=null&&E.iv!==null&&E.method!=null&&(w=E),w}var y=function(E){return{remuxResult:{},chunkMeta:E}};function m(x){return"then"in x&&x.then instanceof Function}var C=function(E,w,A,g,P){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=E,this.videoCodec=w,this.initSegmentData=A,this.duration=g,this.defaultInitPts=P},T=function(E,w,A,g,P){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=E,this.contiguous=w,this.accurateTimeOffset=A,this.trackSwitch=g,this.timeOffset=P}},"./src/demux/tsdemuxer.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"discardEPB",function(){return y});var k=D("./src/demux/adts.ts"),M=D("./src/demux/mpegaudio.ts"),f=D("./src/demux/exp-golomb.ts"),S=D("./src/demux/id3.ts"),_=D("./src/demux/sample-aes.ts"),p=D("./src/events.ts"),c=D("./src/utils/mp4-tools.ts"),o=D("./src/utils/logger.ts"),u=D("./src/errors.ts"),s={video:1,audio:2,id3:3,text:4},l=function(){function m(T,x,E){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=T,this.config=x,this.typeSupported=E}m.probe=function(x){var E=m.syncOffset(x);return E<0?!1:(E&&o.logger.warn("MPEG2-TS detected but first sync word found @ offset "+E+", junk ahead ?"),!0)},m.syncOffset=function(x){for(var E=Math.min(1e3,x.length-3*188),w=0;w<E;){if(x[w]===71&&x[w+188]===71&&x[w+2*188]===71)return w;w++}return-1},m.createTrack=function(x,E){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:s[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?E:void 0}};var C=m.prototype;return C.resetInitSegment=function(x,E,w){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",w),this._audioTrack=m.createTrack("audio",w),this._id3Track=m.createTrack("id3",w),this._txtTrack=m.createTrack("text",w),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=E,this._duration=w},C.resetTimeStamp=function(){},C.resetContiguity=function(){var x=this._audioTrack,E=this._avcTrack,w=this._id3Track;x&&(x.pesData=null),E&&(E.pesData=null),w&&(w.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},C.demux=function(x,E,w,A){w===void 0&&(w=!1),A===void 0&&(A=!1),w||(this.sampleAes=null);var g,P=this._avcTrack,O=this._audioTrack,F=this._id3Track,X=P.pid,W=P.pesData,N=O.pid,G=F.pid,U=O.pesData,H=F.pesData,V=!1,ce=this.pmtParsed,ye=this._pmtId,Le=x.length;if(this.remainderData&&(x=Object(c.appendUint8Array)(this.remainderData,x),Le=x.length,this.remainderData=null),Le<188&&!A)return this.remainderData=x,{audioTrack:O,avcTrack:P,id3Track:F,textTrack:this._txtTrack};var Ze=Math.max(0,m.syncOffset(x));Le-=(Le+Ze)%188,Le<x.byteLength&&!A&&(this.remainderData=new Uint8Array(x.buffer,Le,x.buffer.byteLength-Le));for(var Ye=Ze;Ye<Le;Ye+=188)if(x[Ye]===71){var Oe=!!(x[Ye+1]&64),We=((x[Ye+1]&31)<<8)+x[Ye+2],ze=(x[Ye+3]&48)>>4,Ae=void 0;if(ze>1){if(Ae=Ye+5+x[Ye+4],Ae===Ye+188)continue}else Ae=Ye+4;switch(We){case X:Oe&&(W&&(g=r(W))&&this.parseAVCPES(g,!1),W={data:[],size:0}),W&&(W.data.push(x.subarray(Ae,Ye+188)),W.size+=Ye+188-Ae);break;case N:Oe&&(U&&(g=r(U))&&(O.isAAC?this.parseAACPES(g):this.parseMPEGPES(g)),U={data:[],size:0}),U&&(U.data.push(x.subarray(Ae,Ye+188)),U.size+=Ye+188-Ae);break;case G:Oe&&(H&&(g=r(H))&&this.parseID3PES(g),H={data:[],size:0}),H&&(H.data.push(x.subarray(Ae,Ye+188)),H.size+=Ye+188-Ae);break;case 0:Oe&&(Ae+=x[Ae]+1),ye=this._pmtId=a(x,Ae);break;case ye:{Oe&&(Ae+=x[Ae]+1);var xe=i(x,Ae,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,w);X=xe.avc,X>0&&(P.pid=X),N=xe.audio,N>0&&(O.pid=N,O.isAAC=xe.isAAC),G=xe.id3,G>0&&(F.pid=G),V&&!ce&&(o.logger.log("reparse from beginning"),V=!1,Ye=Ze-188),ce=this.pmtParsed=!0;break}case 17:case 8191:break;default:V=!0;break}}else this.observer.emit(p.Events.ERROR,p.Events.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});P.pesData=W,O.pesData=U,F.pesData=H;var le={audioTrack:O,avcTrack:P,id3Track:F,textTrack:this._txtTrack};return A&&this.extractRemainingSamples(le),le},C.flush=function(){var x=this.remainderData;this.remainderData=null;var E;return x?E=this.demux(x,-1,!1,!0):E={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(E),this.sampleAes?this.decrypt(E,this.sampleAes):E},C.extractRemainingSamples=function(x){var E=x.audioTrack,w=x.avcTrack,A=x.id3Track,g=w.pesData,P=E.pesData,O=A.pesData,F;g&&(F=r(g))?(this.parseAVCPES(F,!0),w.pesData=null):w.pesData=g,P&&(F=r(P))?(E.isAAC?this.parseAACPES(F):this.parseMPEGPES(F),E.pesData=null):(P!=null&&P.size&&o.logger.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=P),O&&(F=r(O))?(this.parseID3PES(F),A.pesData=null):A.pesData=O},C.demuxSampleAes=function(x,E,w){var A=this.demux(x,w,!0,!this.config.progressive),g=this.sampleAes=new _.default(this.observer,this.config,E);return this.decrypt(A,g)},C.decrypt=function(x,E){return new Promise(function(w){var A=x.audioTrack,g=x.avcTrack;A.samples&&A.isAAC?E.decryptAacSamples(A.samples,0,function(){g.samples?E.decryptAvcSamples(g.samples,0,0,function(){w(x)}):w(x)}):g.samples&&E.decryptAvcSamples(g.samples,0,0,function(){w(x)})})},C.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},C.parseAVCPES=function(x,E){var w=this,A=this._avcTrack,g=this.parseAVCNALu(x.data),P=!1,O=this.avcSample,F,X=!1;x.data=null,O&&g.length&&!A.audFound&&(h(O,A),O=this.avcSample=t(!1,x.pts,x.dts,"")),g.forEach(function(W){switch(W.type){case 1:{F=!0,O||(O=w.avcSample=t(!0,x.pts,x.dts,"")),P&&(O.debug+="NDR "),O.frame=!0;var N=W.data;if(X&&N.length>4){var G=new f.default(N).readSliceType();(G===2||G===4||G===7||G===9)&&(O.key=!0)}break}case 5:F=!0,O||(O=w.avcSample=t(!0,x.pts,x.dts,"")),P&&(O.debug+="IDR "),O.key=!0,O.frame=!0;break;case 6:{F=!0,P&&O&&(O.debug+="SEI ");var U=new f.default(y(W.data));U.readUByte();for(var H=0,V=0,ce=!1,ye=0;!ce&&U.bytesAvailable>1;){H=0;do ye=U.readUByte(),H+=ye;while(ye===255);V=0;do ye=U.readUByte(),V+=ye;while(ye===255);if(H===4&&U.bytesAvailable!==0){ce=!0;var Le=U.readUByte();if(Le===181){var Ze=U.readUShort();if(Ze===49){var Ye=U.readUInt();if(Ye===1195456820){var Oe=U.readUByte();if(Oe===3){for(var We=U.readUByte(),ze=U.readUByte(),Ae=31&We,xe=[We,ze],le=0;le<Ae;le++)xe.push(U.readUByte()),xe.push(U.readUByte()),xe.push(U.readUByte());d(w._txtTrack.samples,{type:3,pts:x.pts,bytes:xe})}}}}}else if(H===5&&U.bytesAvailable!==0){if(ce=!0,V>16){for(var Se=[],pe=0;pe<16;pe++)Se.push(U.readUByte().toString(16)),(pe===3||pe===5||pe===7||pe===9)&&Se.push("-");for(var Ge=V-16,fe=new Uint8Array(Ge),ge=0;ge<Ge;ge++)fe[ge]=U.readUByte();d(w._txtTrack.samples,{pts:x.pts,payloadType:H,uuid:Se.join(""),userData:Object(S.utf8ArrayToStr)(fe),userDataBytes:fe})}}else if(V<U.bytesAvailable)for(var De=0;De<V;De++)U.readUByte()}break}case 7:if(F=!0,X=!0,P&&O&&(O.debug+="SPS "),!A.sps){var Ve=new f.default(W.data),Qe=Ve.readSPS();A.width=Qe.width,A.height=Qe.height,A.pixelRatio=Qe.pixelRatio,A.sps=[W.data],A.duration=w._duration;for(var ke=W.data.subarray(1,4),Fe="avc1.",Ne=0;Ne<3;Ne++){var Me=ke[Ne].toString(16);Me.length<2&&(Me="0"+Me),Fe+=Me}A.codec=Fe}break;case 8:F=!0,P&&O&&(O.debug+="PPS "),A.pps||(A.pps=[W.data]);break;case 9:F=!1,A.audFound=!0,O&&h(O,A),O=w.avcSample=t(!1,x.pts,x.dts,P?"AUD ":"");break;case 12:F=!1;break;default:F=!1,O&&(O.debug+="unknown NAL "+W.type+" ");break}if(O&&F){var ne=O.units;ne.push(W)}}),E&&O&&(h(O,A),this.avcSample=null)},C.getLastNalUnit=function(){var x,E=this.avcSample,w;if(!E||E.units.length===0){var A=this._avcTrack.samples;E=A[A.length-1]}if((x=E)!==null&&x!==void 0&&x.units){var g=E.units;w=g[g.length-1]}return w},C.parseAVCNALu=function(x){var E=x.byteLength,w=this._avcTrack,A=w.naluState||0,g=A,P=[],O=0,F,X,W,N=-1,G=0;for(A===-1&&(N=0,G=x[0]&31,A=0,O=1);O<E;){if(F=x[O++],!A){A=F?0:1;continue}if(A===1){A=F?0:2;continue}if(!F)A=3;else if(F===1){if(N>=0){var U={data:x.subarray(N,O-A-1),type:G};P.push(U)}else{var H=this.getLastNalUnit();if(H&&(g&&O<=4-g&&(H.state&&(H.data=H.data.subarray(0,H.data.byteLength-g))),X=O-A-1,X>0)){var V=new Uint8Array(H.data.byteLength+X);V.set(H.data,0),V.set(x.subarray(0,X),H.data.byteLength),H.data=V,H.state=0}}O<E?(W=x[O]&31,N=O,G=W,A=0):A=-1}else A=0}if(N>=0&&A>=0){var ce={data:x.subarray(N,E),type:G,state:A};P.push(ce)}if(P.length===0){var ye=this.getLastNalUnit();if(ye){var Le=new Uint8Array(ye.data.byteLength+x.byteLength);Le.set(ye.data,0),Le.set(x,ye.data.byteLength),ye.data=Le}}return w.naluState=A,P},C.parseAACPES=function(x){var E=0,w=this._audioTrack,A=this.aacOverFlow,g=x.data;if(A){this.aacOverFlow=null;var P=A.sample.unit.byteLength,O=Math.min(A.missing,P),F=P-O;A.sample.unit.set(g.subarray(0,O),F),w.samples.push(A.sample),E=A.missing}var X,W;for(X=E,W=g.length;X<W-1&&!k.isHeader(g,X);X++);if(X!==E){var N,G;if(X<W-1?(N="AAC PES did not start with ADTS header,offset:"+X,G=!1):(N="no ADTS header found in AAC PES",G=!0),o.logger.warn("parsing error:"+N),this.observer.emit(p.Events.ERROR,p.Events.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.FRAG_PARSING_ERROR,fatal:G,reason:N}),G)return}k.initTrackConfig(w,this.observer,g,X,this.audioCodec);var U;if(x.pts!==void 0)U=x.pts;else if(A){var H=k.getFrameDuration(w.samplerate);U=A.sample.pts+H}else{o.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var V=0;X<W;)if(k.isHeader(g,X)){if(X+5<W){var ce=k.appendFrame(w,g,X,U,V);if(ce)if(ce.missing)this.aacOverFlow=ce;else{X+=ce.length,V++;continue}}break}else X++},C.parseMPEGPES=function(x){var E=x.data,w=E.length,A=0,g=0,P=x.pts;if(P===void 0){o.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;g<w;)if(M.isHeader(E,g)){var O=M.appendFrame(this._audioTrack,E,g,P,A);if(O)g+=O.length,A++;else break}else g++},C.parseID3PES=function(x){if(x.pts===void 0){o.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},m}();l.minProbeByteLength=188;function t(m,C,T,x){return{key:m,frame:!1,pts:C,dts:T,units:[],debug:x,length:0}}function a(m,C){return(m[C+10]&31)<<8|m[C+11]}function i(m,C,T,x){var E={audio:-1,avc:-1,id3:-1,isAAC:!0},w=(m[C+1]&15)<<8|m[C+2],A=C+3+w-4,g=(m[C+10]&15)<<8|m[C+11];for(C+=12+g;C<A;){var P=(m[C+1]&31)<<8|m[C+2];switch(m[C]){case 207:if(!x){o.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:E.audio===-1&&(E.audio=P);break;case 21:E.id3===-1&&(E.id3=P);break;case 219:if(!x){o.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:E.avc===-1&&(E.avc=P);break;case 3:case 4:T?E.audio===-1&&(E.audio=P,E.isAAC=!1):o.logger.log("MPEG audio found, not supported in this browser");break;case 36:o.logger.warn("Unsupported HEVC stream type found");break;default:break}C+=((m[C+3]&15)<<8|m[C+4])+5}return E}function r(m){var C=0,T,x,E,w,A,g=m.data;if(!m||m.size===0)return null;for(;g[0].length<19&&g.length>1;){var P=new Uint8Array(g[0].length+g[1].length);P.set(g[0]),P.set(g[1],g[0].length),g[0]=P,g.splice(1,1)}T=g[0];var O=(T[0]<<16)+(T[1]<<8)+T[2];if(O===1){if(x=(T[4]<<8)+T[5],x&&x>m.size-6)return null;var F=T[7];F&192&&(w=(T[9]&14)*536870912+(T[10]&255)*4194304+(T[11]&254)*16384+(T[12]&255)*128+(T[13]&254)/2,F&64?(A=(T[14]&14)*536870912+(T[15]&255)*4194304+(T[16]&254)*16384+(T[17]&255)*128+(T[18]&254)/2,w-A>60*9e4&&(o.logger.warn(Math.round((w-A)/9e4)+"s delta between PTS and DTS, align them"),w=A)):A=w),E=T[8];var X=E+9;if(m.size<=X)return null;m.size-=X;for(var W=new Uint8Array(m.size),N=0,G=g.length;N<G;N++){T=g[N];var U=T.byteLength;if(X)if(X>U){X-=U;continue}else T=T.subarray(X),U-=X,X=0;W.set(T,C),C+=U}return x&&(x-=E+3),{data:W,pts:w,dts:A,len:x}}return null}function h(m,C){if(m.units.length&&m.frame){if(m.pts===void 0){var T=C.samples,x=T.length;if(x){var E=T[x-1];m.pts=E.pts,m.dts=E.dts}else{C.dropped++;return}}C.samples.push(m)}m.debug.length&&o.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function d(m,C){var T=m.length;if(T>0){if(C.pts>=m[T-1].pts)m.push(C);else for(var x=T-1;x>=0;x--)if(C.pts<m[x].pts){m.splice(x,0,C);break}}else m.push(C)}function y(m){for(var C=m.byteLength,T=[],x=1;x<C-2;)m[x]===0&&m[x+1]===0&&m[x+2]===3?(T.push(x+2),x+=2):x++;if(T.length===0)return m;var E=C-T.length,w=new Uint8Array(E),A=0;for(x=0;x<E;A++,x++)A===T[0]&&(A++,T.shift()),w[x]=m[A];return w}L.default=l},"./src/errors.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"ErrorTypes",function(){return k}),D.d(L,"ErrorDetails",function(){return M});var k;(function(f){f.NETWORK_ERROR="networkError",f.MEDIA_ERROR="mediaError",f.KEY_SYSTEM_ERROR="keySystemError",f.MUX_ERROR="muxError",f.OTHER_ERROR="otherError"})(k||(k={}));var M;(function(f){f.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",f.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",f.KEY_SYSTEM_NO_SESSION="keySystemNoSession",f.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",f.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",f.MANIFEST_LOAD_ERROR="manifestLoadError",f.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",f.MANIFEST_PARSING_ERROR="manifestParsingError",f.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",f.LEVEL_EMPTY_ERROR="levelEmptyError",f.LEVEL_LOAD_ERROR="levelLoadError",f.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",f.LEVEL_SWITCH_ERROR="levelSwitchError",f.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",f.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",f.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",f.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",f.FRAG_LOAD_ERROR="fragLoadError",f.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",f.FRAG_DECRYPT_ERROR="fragDecryptError",f.FRAG_PARSING_ERROR="fragParsingError",f.REMUX_ALLOC_ERROR="remuxAllocError",f.KEY_LOAD_ERROR="keyLoadError",f.KEY_LOAD_TIMEOUT="keyLoadTimeOut",f.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",f.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",f.BUFFER_APPEND_ERROR="bufferAppendError",f.BUFFER_APPENDING_ERROR="bufferAppendingError",f.BUFFER_STALLED_ERROR="bufferStalledError",f.BUFFER_FULL_ERROR="bufferFullError",f.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",f.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",f.INTERNAL_EXCEPTION="internalException",f.INTERNAL_ABORTED="aborted",f.UNKNOWN="unknown"})(M||(M={}))},"./src/events.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"Events",function(){return k});var k;(function(M){M.MEDIA_ATTACHING="hlsMediaAttaching",M.MEDIA_ATTACHED="hlsMediaAttached",M.MEDIA_DETACHING="hlsMediaDetaching",M.MEDIA_DETACHED="hlsMediaDetached",M.BUFFER_RESET="hlsBufferReset",M.BUFFER_CODECS="hlsBufferCodecs",M.BUFFER_CREATED="hlsBufferCreated",M.BUFFER_APPENDING="hlsBufferAppending",M.BUFFER_APPENDED="hlsBufferAppended",M.BUFFER_EOS="hlsBufferEos",M.BUFFER_FLUSHING="hlsBufferFlushing",M.BUFFER_FLUSHED="hlsBufferFlushed",M.MANIFEST_LOADING="hlsManifestLoading",M.MANIFEST_LOADED="hlsManifestLoaded",M.MANIFEST_PARSED="hlsManifestParsed",M.LEVEL_SWITCHING="hlsLevelSwitching",M.LEVEL_SWITCHED="hlsLevelSwitched",M.LEVEL_LOADING="hlsLevelLoading",M.LEVEL_LOADED="hlsLevelLoaded",M.LEVEL_UPDATED="hlsLevelUpdated",M.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",M.LEVELS_UPDATED="hlsLevelsUpdated",M.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",M.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",M.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",M.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",M.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",M.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",M.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",M.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",M.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",M.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",M.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",M.CUES_PARSED="hlsCuesParsed",M.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",M.INIT_PTS_FOUND="hlsInitPtsFound",M.FRAG_LOADING="hlsFragLoading",M.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",M.FRAG_LOADED="hlsFragLoaded",M.FRAG_DECRYPTED="hlsFragDecrypted",M.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",M.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",M.FRAG_PARSING_METADATA="hlsFragParsingMetadata",M.FRAG_PARSED="hlsFragParsed",M.FRAG_BUFFERED="hlsFragBuffered",M.FRAG_CHANGED="hlsFragChanged",M.FPS_DROP="hlsFpsDrop",M.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",M.ERROR="hlsError",M.DESTROYING="hlsDestroying",M.KEY_LOADING="hlsKeyLoading",M.KEY_LOADED="hlsKeyLoaded",M.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",M.BACK_BUFFER_REACHED="hlsBackBufferReached"})(k||(k={}))},"./src/hls.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return m});var k=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(k),f=D("./src/loader/playlist-loader.ts"),S=D("./src/loader/key-loader.ts"),_=D("./src/controller/id3-track-controller.ts"),p=D("./src/controller/latency-controller.ts"),c=D("./src/controller/level-controller.ts"),o=D("./src/controller/fragment-tracker.ts"),u=D("./src/controller/stream-controller.ts"),s=D("./src/is-supported.ts"),l=D("./src/utils/logger.ts"),t=D("./src/config.ts"),a=D("./node_modules/eventemitter3/index.js"),i=D.n(a),r=D("./src/events.ts"),h=D("./src/errors.ts");function d(C,T){for(var x=0;x<T.length;x++){var E=T[x];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(C,E.key,E)}}function y(C,T,x){return T&&d(C.prototype,T),x&&d(C,x),C}var m=function(){C.isSupported=function(){return Object(s.isSupported)()};function C(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new a.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 E=this.config=Object(t.mergeConfig)(C.DefaultConfig,x);this.userConfig=x,Object(l.enableLogs)(E.debug),this._autoLevelCapping=-1,E.progressive&&Object(t.enableStreamingMode)(E);var w=E.abrController,A=E.bufferController,g=E.capLevelController,P=E.fpsController,O=this.abrController=new w(this),F=this.bufferController=new A(this),X=this.capLevelController=new g(this),W=new P(this),N=new f.default(this),G=new S.default(this),U=new _.default(this),H=this.levelController=new c.default(this),V=new o.FragmentTracker(this),ce=this.streamController=new u.default(this,V);X.setStreamController(ce),W.setStreamController(ce);var ye=[H,ce];this.networkControllers=ye;var Le=[N,G,O,F,X,W,U,V];this.audioTrackController=this.createController(E.audioTrackController,null,ye),this.createController(E.audioStreamController,V,ye),this.subtitleTrackController=this.createController(E.subtitleTrackController,null,ye),this.createController(E.subtitleStreamController,V,ye),this.createController(E.timelineController,null,Le),this.emeController=this.createController(E.emeController,null,Le),this.cmcdController=this.createController(E.cmcdController,null,Le),this.latencyController=this.createController(p.default,null,Le),this.coreComponents=Le}var T=C.prototype;return T.createController=function(E,w,A){if(E){var g=w?new E(this,w):new E(this);return A&&A.push(g),g}return null},T.on=function(E,w,A){A===void 0&&(A=this),this._emitter.on(E,w,A)},T.once=function(E,w,A){A===void 0&&(A=this),this._emitter.once(E,w,A)},T.removeAllListeners=function(E){this._emitter.removeAllListeners(E)},T.off=function(E,w,A,g){A===void 0&&(A=this),this._emitter.off(E,w,A,g)},T.listeners=function(E){return this._emitter.listeners(E)},T.emit=function(E,w,A){return this._emitter.emit(E,w,A)},T.trigger=function(E,w){if(this.config.debug)return this.emit(E,E,w);try{return this.emit(E,E,w)}catch(A){l.logger.error("An internal error happened while handling event "+E+'. Error message: "'+A.message+'". Here is a stacktrace:',A),this.trigger(r.Events.ERROR,{type:h.ErrorTypes.OTHER_ERROR,details:h.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:E,error:A})}return!1},T.listenerCount=function(E){return this._emitter.listenerCount(E)},T.destroy=function(){l.logger.log("destroy"),this.trigger(r.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(E){return E.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(E){return E.destroy()}),this.coreComponents.length=0},T.attachMedia=function(E){l.logger.log("attachMedia"),this._media=E,this.trigger(r.Events.MEDIA_ATTACHING,{media:E})},T.detachMedia=function(){l.logger.log("detachMedia"),this.trigger(r.Events.MEDIA_DETACHING,void 0),this._media=null},T.loadSource=function(E){this.stopLoad();var w=this.media,A=this.url,g=this.url=k.buildAbsoluteURL(self.location.href,E,{alwaysNormalize:!0});l.logger.log("loadSource:"+g),w&&A&&A!==g&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(w)),this.trigger(r.Events.MANIFEST_LOADING,{url:E})},T.startLoad=function(E){E===void 0&&(E=-1),l.logger.log("startLoad("+E+")"),this.networkControllers.forEach(function(w){w.startLoad(E)})},T.stopLoad=function(){l.logger.log("stopLoad"),this.networkControllers.forEach(function(E){E.stopLoad()})},T.swapAudioCodec=function(){l.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},T.recoverMediaError=function(){l.logger.log("recoverMediaError");var E=this._media;this.detachMedia(),E&&this.attachMedia(E)},T.removeLevel=function(E,w){w===void 0&&(w=0),this.levelController.removeLevel(E,w)},y(C,[{key:"levels",get:function(){var E=this.levelController.levels;return E||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(E){l.logger.log("set currentLevel:"+E),this.loadLevel=E,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(E){l.logger.log("set nextLevel:"+E),this.levelController.manualLevel=E,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(E){l.logger.log("set loadLevel:"+E),this.levelController.manualLevel=E}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(E){this.levelController.nextLoadLevel=E}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(E){l.logger.log("set firstLevel:"+E),this.levelController.firstLevel=E}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(E){l.logger.log("set startLevel:"+E),E!==-1&&(E=Math.max(E,this.minAutoLevel)),this.levelController.startLevel=E}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(E){var w=!!E;w!==this.config.capLevelToPlayerSize&&(w?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=w)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(E){this._autoLevelCapping!==E&&(l.logger.log("set autoLevelCapping:"+E),this._autoLevelCapping=E)}},{key:"bandwidthEstimate",get:function(){var E=this.abrController.bwEstimator;return E?E.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var E=this.levels,w=this.config.minAutoBitrate;if(!E)return 0;for(var A=E.length,g=0;g<A;g++)if(E[g].maxBitrate>w)return g;return 0}},{key:"maxAutoLevel",get:function(){var E=this.levels,w=this.autoLevelCapping,A;return w===-1&&E&&E.length?A=E.length-1:A=w,A}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(E){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,E)}},{key:"audioTracks",get:function(){var E=this.audioTrackController;return E?E.audioTracks:[]}},{key:"audioTrack",get:function(){var E=this.audioTrackController;return E?E.audioTrack:-1},set:function(E){var w=this.audioTrackController;w&&(w.audioTrack=E)}},{key:"subtitleTracks",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var E=this.subtitleTrackController;return E?E.subtitleTrack:-1},set:function(E){var w=this.subtitleTrackController;w&&(w.subtitleTrack=E)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var E=this.subtitleTrackController;return E?E.subtitleDisplay:!1},set:function(E){var w=this.subtitleTrackController;w&&(w.subtitleDisplay=E)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(E){this.config.lowLatencyMode=E}},{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 r.Events}},{key:"ErrorTypes",get:function(){return h.ErrorTypes}},{key:"ErrorDetails",get:function(){return h.ErrorDetails}},{key:"DefaultConfig",get:function(){return C.defaultConfig?C.defaultConfig:t.hlsDefaultConfig},set:function(E){C.defaultConfig=E}}]),C}();m.defaultConfig=void 0},"./src/is-supported.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"isSupported",function(){return f}),D.d(L,"changeTypeSupported",function(){return S});var k=D("./src/utils/mediasource-helper.ts");function M(){return self.SourceBuffer||self.WebKitSourceBuffer}function f(){var _=Object(k.getMediaSource)();if(!_)return!1;var p=M(),c=_&&typeof _.isTypeSupported=="function"&&_.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),o=!p||p.prototype&&typeof p.prototype.appendBuffer=="function"&&typeof p.prototype.remove=="function";return!!c&&!!o}function S(){var _,p=M();return typeof(p==null||((_=p.prototype)===null||_===void 0)?void 0:_.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return l}),D.d(L,"LoadError",function(){return a});var k=D("./src/polyfills/number.ts"),M=D("./src/errors.ts");function f(i,r){i.prototype=Object.create(r.prototype),i.prototype.constructor=i,o(i,r)}function S(i){var r=typeof Map=="function"?new Map:void 0;return S=function(d){if(d===null||!c(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r!="undefined"){if(r.has(d))return r.get(d);r.set(d,y)}function y(){return _(d,arguments,u(this).constructor)}return y.prototype=Object.create(d.prototype,{constructor:{value:y,enumerable:!1,writable:!0,configurable:!0}}),o(y,d)},S(i)}function _(i,r,h){return p()?_=Reflect.construct:_=function(y,m,C){var T=[null];T.push.apply(T,m);var x=Function.bind.apply(y,T),E=new x;return C&&o(E,C.prototype),E},_.apply(null,arguments)}function p(){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(i){return!1}}function c(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function o(i,r){return o=Object.setPrototypeOf||function(d,y){return d.__proto__=y,d},o(i,r)}function u(i){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(h){return h.__proto__||Object.getPrototypeOf(h)},u(i)}var s=Math.pow(2,17),l=function(){function i(h){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=h}var r=i.prototype;return r.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},r.abort=function(){this.loader&&this.loader.abort()},r.load=function(d,y){var m=this,C=d.url;if(!C)return Promise.reject(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(C?"part list":"url")));this.abort();var T=this.config,x=T.fLoader,E=T.loader;return new Promise(function(w,A){m.loader&&m.loader.destroy();var g=m.loader=d.loader=x?new x(T):new E(T),P=t(d),O={timeout:T.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:T.fragLoadingMaxRetryTimeout,highWaterMark:s};d.stats=g.stats,g.load(P,O,{onSuccess:function(X,W,N,G){m.resetLoader(d,g),w({frag:d,part:null,payload:X.data,networkDetails:G})},onError:function(X,W,N){m.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:X,networkDetails:N}))},onAbort:function(X,W,N){m.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:N}))},onTimeout:function(X,W,N){m.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:N}))},onProgress:function(X,W,N,G){y&&y({frag:d,part:null,payload:N,networkDetails:G})}})})},r.loadPart=function(d,y,m){var C=this;this.abort();var T=this.config,x=T.fLoader,E=T.loader;return new Promise(function(w,A){C.loader&&C.loader.destroy();var g=C.loader=d.loader=x?new x(T):new E(T),P=t(d,y),O={timeout:T.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:T.fragLoadingMaxRetryTimeout,highWaterMark:s};y.stats=g.stats,g.load(P,O,{onSuccess:function(X,W,N,G){C.resetLoader(d,g),C.updateStatsFromPart(d,y);var U={frag:d,part:y,payload:X.data,networkDetails:G};m(U),w(U)},onError:function(X,W,N){C.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:y,response:X,networkDetails:N}))},onAbort:function(X,W,N){d.stats.aborted=y.stats.aborted,C.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:y,networkDetails:N}))},onTimeout:function(X,W,N){C.resetLoader(d,g),A(new a({type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:y,networkDetails:N}))}})})},r.updateStatsFromPart=function(d,y){var m=d.stats,C=y.stats,T=C.total;if(m.loaded+=C.loaded,T){var x=Math.round(d.duration/y.duration),E=Math.min(Math.round(m.loaded/T),x),w=x-E,A=w*Math.round(m.loaded/E);m.total=m.loaded+A}else m.total=Math.max(m.loaded,m.total);var g=m.loading,P=C.loading;g.start?g.first+=P.first-P.start:(g.start=P.start,g.first=P.first),g.end=P.end},r.resetLoader=function(d,y){d.loader=null,this.loader===y&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),y.destroy()},i}();function t(i,r){r===void 0&&(r=null);var h=r||i,d={frag:i,part:r,responseType:"arraybuffer",url:h.url,headers:{},rangeStart:0,rangeEnd:0},y=h.byteRangeStartOffset,m=h.byteRangeEndOffset;return Object(k.isFiniteNumber)(y)&&Object(k.isFiniteNumber)(m)&&(d.rangeStart=y,d.rangeEnd=m),d}var a=function(i){f(r,i);function r(h){for(var d,y=arguments.length,m=new Array(y>1?y-1:0),C=1;C<y;C++)m[C-1]=arguments[C];return d=i.call.apply(i,[this].concat(m))||this,d.data=void 0,d.data=h,d}return r}(S(Error))},"./src/loader/fragment.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"ElementaryStreamTypes",function(){return l}),D.d(L,"BaseSegment",function(){return t}),D.d(L,"Fragment",function(){return a}),D.d(L,"Part",function(){return i});var k=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),f=D.n(M),S=D("./src/utils/logger.ts"),_=D("./src/loader/level-key.ts"),p=D("./src/loader/load-stats.ts");function c(r,h){r.prototype=Object.create(h.prototype),r.prototype.constructor=r,o(r,h)}function o(r,h){return o=Object.setPrototypeOf||function(y,m){return y.__proto__=m,y},o(r,h)}function u(r,h){for(var d=0;d<h.length;d++){var y=h[d];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(r,y.key,y)}}function s(r,h,d){return h&&u(r.prototype,h),d&&u(r,d),r}var l;(function(r){r.AUDIO="audio",r.VIDEO="video",r.AUDIOVIDEO="audiovideo"})(l||(l={}));var t=function(){function r(d){var y;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(y={},y[l.AUDIO]=null,y[l.VIDEO]=null,y[l.AUDIOVIDEO]=null,y),this.baseurl=d}var h=r.prototype;return h.setByteRange=function(y,m){var C=y.split("@",2),T=[];C.length===1?T[0]=m?m.byteRangeEndOffset:0:T[0]=parseInt(C[1]),T[1]=parseInt(C[0])+T[0],this._byteRange=T},s(r,[{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(y){this._url=y}}]),r}(),a=function(r){c(h,r);function h(y,m){var C;return C=r.call(this,m)||this,C._decryptdata=null,C.rawProgramDateTime=null,C.programDateTime=null,C.tagList=[],C.duration=0,C.sn=0,C.levelkey=void 0,C.type=void 0,C.loader=null,C.level=-1,C.cc=0,C.startPTS=void 0,C.endPTS=void 0,C.appendedPTS=void 0,C.startDTS=void 0,C.endDTS=void 0,C.start=0,C.deltaPTS=void 0,C.maxStartPTS=void 0,C.minEndPTS=void 0,C.stats=new p.LoadStats,C.urlId=0,C.data=void 0,C.bitrateTest=!1,C.title=null,C.initSegment=null,C.type=y,C}var d=h.prototype;return d.createInitializationVector=function(m){for(var C=new Uint8Array(16),T=12;T<16;T++)C[T]=m>>8*(15-T)&255;return C},d.setDecryptDataFromLevelKey=function(m,C){var T=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(T=_.LevelKey.fromURI(m.uri),T.method=m.method,T.iv=this.createInitializationVector(C),T.keyFormat="identity"),T},d.setElementaryStreamInfo=function(m,C,T,x,E,w){w===void 0&&(w=!1);var A=this.elementaryStreams,g=A[m];if(!g){A[m]={startPTS:C,endPTS:T,startDTS:x,endDTS:E,partial:w};return}g.startPTS=Math.min(g.startPTS,C),g.endPTS=Math.max(g.endPTS,T),g.startDTS=Math.min(g.startDTS,x),g.endDTS=Math.max(g.endDTS,E)},d.clearElementaryStreamInfo=function(){var m=this.elementaryStreams;m[l.AUDIO]=null,m[l.VIDEO]=null,m[l.AUDIOVIDEO]=null},s(h,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var m=this.sn;typeof m!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&S.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),m=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,m)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(k.isFiniteNumber)(this.programDateTime))return null;var m=Object(k.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+m*1e3}},{key:"encrypted",get:function(){var m;return!!((m=this.decryptdata)!==null&&m!==void 0&&m.keyFormat&&this.decryptdata.uri)}}]),h}(t),i=function(r){c(h,r);function h(d,y,m,C,T){var x;x=r.call(this,m)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new p.LoadStats,x.duration=d.decimalFloatingPoint("DURATION"),x.gap=d.bool("GAP"),x.independent=d.bool("INDEPENDENT"),x.relurl=d.enumeratedString("URI"),x.fragment=y,x.index=C;var E=d.enumeratedString("BYTERANGE");return E&&x.setByteRange(E,T),T&&(x.fragOffset=T.fragOffset+T.duration),x}return s(h,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var y=this.elementaryStreams;return!!(y.audio||y.video||y.audiovideo)}}]),h}(t)},"./src/loader/key-loader.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return S});var k=D("./src/events.ts"),M=D("./src/errors.ts"),f=D("./src/utils/logger.ts"),S=function(){function _(c){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=c,this._registerListeners()}var p=_.prototype;return p._registerListeners=function(){this.hls.on(k.Events.KEY_LOADING,this.onKeyLoading,this)},p._unregisterListeners=function(){this.hls.off(k.Events.KEY_LOADING,this.onKeyLoading)},p.destroy=function(){this._unregisterListeners();for(var o in this.loaders){var u=this.loaders[o];u&&u.destroy()}this.loaders={}},p.onKeyLoading=function(o,u){var s=u.frag,l=s.type,t=this.loaders[l];if(!s.decryptdata){f.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var a=s.decryptdata.uri;if(a!==this.decrypturl||this.decryptkey===null){var i=this.hls.config;if(t&&(f.logger.warn("abort previous key loader for type:"+l),t.abort()),!a){f.logger.warn("key uri is falsy");return}var r=i.loader,h=s.loader=this.loaders[l]=new r(i);this.decrypturl=a,this.decryptkey=null;var d={url:a,frag:s,responseType:"arraybuffer"},y={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:i.fragLoadingRetryDelay,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};h.load(d,y,m)}else this.decryptkey&&(s.decryptdata.key=this.decryptkey,this.hls.trigger(k.Events.KEY_LOADED,{frag:s}))},p.loadsuccess=function(o,u,s){var l=s.frag;if(!l.decryptdata){f.logger.error("after key load, decryptdata unset");return}this.decryptkey=l.decryptdata.key=new Uint8Array(o.data),l.loader=null,delete this.loaders[l.type],this.hls.trigger(k.Events.KEY_LOADED,{frag:l})},p.loaderror=function(o,u){var s=u.frag,l=s.loader;l&&l.abort(),delete this.loaders[s.type],this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:s,response:o})},p.loadtimeout=function(o,u){var s=u.frag,l=s.loader;l&&l.abort(),delete this.loaders[s.type],this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:s})},_}()},"./src/loader/level-details.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"LevelDetails",function(){return _});var k=D("./src/polyfills/number.ts");function M(p,c){for(var o=0;o<c.length;o++){var u=c[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function f(p,c,o){return c&&M(p.prototype,c),o&&M(p,o),p}var S=10,_=function(){function p(o){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=o}var c=p.prototype;return c.reloaded=function(u){if(!u){this.advanced=!0,this.updated=!0;return}var s=this.lastPartSn-u.lastPartSn,l=this.lastPartIndex-u.lastPartIndex;this.updated=this.endSN!==u.endSN||!!l||!!s,this.advanced=this.endSN>u.endSN||s>0||s===0&&l>0,this.updated||this.advanced?this.misses=Math.floor(u.misses*.6):this.misses=u.misses+1,this.availabilityDelay=u.availabilityDelay},f(p,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(k.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||S}},{key:"drift",get:function(){var u=this.driftEndTime-this.driftStartTime;if(u>0){var s=this.driftEnd-this.driftStart;return s*1e3/u}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var u;return(u=this.partList)!==null&&u!==void 0&&u.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var u;return(u=this.fragments)!==null&&u!==void 0&&u.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 u;return(u=this.partList)!==null&&u!==void 0&&u.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var u;return(u=this.partList)!==null&&u!==void 0&&u.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),p}()},"./src/loader/level-key.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"LevelKey",function(){return _});var k=D("./node_modules/url-toolkit/src/url-toolkit.js"),M=D.n(k);function f(p,c){for(var o=0;o<c.length;o++){var u=c[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(p,u.key,u)}}function S(p,c,o){return c&&f(p.prototype,c),o&&f(p,o),p}var _=function(){p.fromURL=function(o,u){return new p(o,u)},p.fromURI=function(o){return new p(o)};function p(c,o){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,o?this._uri=Object(k.buildAbsoluteURL)(c,o,{alwaysNormalize:!0}):this._uri=c}return S(p,[{key:"uri",get:function(){return this._uri}}]),p}()},"./src/loader/load-stats.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"LoadStats",function(){return k});var k=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return h});var k=D("./src/polyfills/number.ts"),M=D("./node_modules/url-toolkit/src/url-toolkit.js"),f=D.n(M),S=D("./src/loader/fragment.ts"),_=D("./src/loader/level-details.ts"),p=D("./src/loader/level-key.ts"),c=D("./src/utils/attr-list.ts"),o=D("./src/utils/logger.ts"),u=D("./src/utils/codecs.ts"),s=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,l=/#EXT-X-MEDIA:(.*)/g,t=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),a=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("|")),i=/\.(mp4|m4s|m4v|m4a)$/i;function r(T){var x,E;return i.test((x=(E=M.parseURL(T))===null||E===void 0?void 0:E.path)!=null?x:"")}var h=function(){function T(){}return T.findGroup=function(E,w){for(var A=0;A<E.length;A++){var g=E[A];if(g.id===w)return g}},T.convertAVC1ToAVCOTI=function(E){var w=E.split(".");if(w.length>2){var A=w.shift()+".";return A+=parseInt(w.shift()).toString(16),A+=("000"+parseInt(w.shift()).toString(16)).substr(-4),A}return E},T.resolve=function(E,w){return M.buildAbsoluteURL(w,E,{alwaysNormalize:!0})},T.parseMasterPlaylist=function(E,w){var A=[],g={},P=!1;s.lastIndex=0;for(var O;(O=s.exec(E))!=null;)if(O[1]){var F=new c.AttrList(O[1]),X={attrs:F,bitrate:F.decimalInteger("AVERAGE-BANDWIDTH")||F.decimalInteger("BANDWIDTH"),name:F.NAME,url:T.resolve(O[2],w)},W=F.decimalResolution("RESOLUTION");W&&(X.width=W.width,X.height=W.height),d((F.CODECS||"").split(/[ ,]+/).filter(function(G){return G}),X),X.videoCodec&&X.videoCodec.indexOf("avc1")!==-1&&(X.videoCodec=T.convertAVC1ToAVCOTI(X.videoCodec)),A.push(X)}else if(O[3]){var N=new c.AttrList(O[3]);N["DATA-ID"]&&(P=!0,g[N["DATA-ID"]]=N)}return{levels:A,sessionData:P?g:null}},T.parseMasterPlaylistMedia=function(E,w,A,g){g===void 0&&(g=[]);var P,O=[],F=0;for(l.lastIndex=0;(P=l.exec(E))!==null;){var X=new c.AttrList(P[1]);if(X.TYPE===A){var W={attrs:X,bitrate:0,id:F++,groupId:X["GROUP-ID"],instreamId:X["INSTREAM-ID"],name:X.NAME||X.LANGUAGE||"",type:A,default:X.bool("DEFAULT"),autoselect:X.bool("AUTOSELECT"),forced:X.bool("FORCED"),lang:X.LANGUAGE,url:X.URI?T.resolve(X.URI,w):""};if(g.length){var N=T.findGroup(g,W.groupId)||g[0];y(W,N,"audioCodec"),y(W,N,"textCodec")}O.push(W)}}return O},T.parseLevelPlaylist=function(E,w,A,g,P){var O=new _.LevelDetails(w),F=O.fragments,X=null,W=0,N=0,G=0,U=0,H=null,V=new S.Fragment(g,w),ce,ye,Le,Ze=-1,Ye=!1;for(t.lastIndex=0,O.m3u8=E;(ce=t.exec(E))!==null;){Ye&&(Ye=!1,V=new S.Fragment(g,w),V.start=G,V.sn=W,V.cc=U,V.level=A,X&&(V.initSegment=X,V.rawProgramDateTime=X.rawProgramDateTime));var Oe=ce[1];if(Oe){V.duration=parseFloat(Oe);var We=(" "+ce[2]).slice(1);V.title=We||null,V.tagList.push(We?["INF",Oe,We]:["INF",Oe])}else if(ce[3])Object(k.isFiniteNumber)(V.duration)&&(V.start=G,Le&&(V.levelkey=Le),V.sn=W,V.level=A,V.cc=U,V.urlId=P,F.push(V),V.relurl=(" "+ce[3]).slice(1),C(V,H),H=V,G+=V.duration,W++,N=0,Ye=!0);else if(ce[4]){var ze=(" "+ce[4]).slice(1);H?V.setByteRange(ze,H):V.setByteRange(ze)}else if(ce[5])V.rawProgramDateTime=(" "+ce[5]).slice(1),V.tagList.push(["PROGRAM-DATE-TIME",V.rawProgramDateTime]),Ze===-1&&(Ze=F.length);else{if(ce=ce[0].match(a),!ce){o.logger.warn("No matches on slow regex match for level playlist!");continue}for(ye=1;ye<ce.length&&!(typeof ce[ye]!="undefined");ye++);var Ae=(" "+ce[ye]).slice(1),xe=(" "+ce[ye+1]).slice(1),le=ce[ye+2]?(" "+ce[ye+2]).slice(1):"";switch(Ae){case"PLAYLIST-TYPE":O.type=xe.toUpperCase();break;case"MEDIA-SEQUENCE":W=O.startSN=parseInt(xe);break;case"SKIP":{var Se=new c.AttrList(xe),pe=Se.decimalInteger("SKIPPED-SEGMENTS");if(Object(k.isFiniteNumber)(pe)){O.skippedSegments=pe;for(var Ge=pe;Ge--;)F.unshift(null);W+=pe}var fe=Se.enumeratedString("RECENTLY-REMOVED-DATERANGES");fe&&(O.recentlyRemovedDateranges=fe.split(" "));break}case"TARGETDURATION":O.targetduration=parseFloat(xe);break;case"VERSION":O.version=parseInt(xe);break;case"EXTM3U":break;case"ENDLIST":O.live=!1;break;case"#":(xe||le)&&V.tagList.push(le?[xe,le]:[xe]);break;case"DIS":U++;case"GAP":V.tagList.push([Ae]);break;case"BITRATE":V.tagList.push([Ae,xe]);break;case"DISCONTINUITY-SEQ":U=parseInt(xe);break;case"KEY":{var ge,De=new c.AttrList(xe),Ve=De.enumeratedString("METHOD"),Qe=De.URI,ke=De.hexadecimalInteger("IV"),Fe=De.enumeratedString("KEYFORMATVERSIONS"),Ne=De.enumeratedString("KEYID"),Me=(ge=De.enumeratedString("KEYFORMAT"))!=null?ge:"identity",ne=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ne.indexOf(Me)>-1){o.logger.warn("Keyformat "+Me+" is not supported from the manifest");continue}else if(Me!=="identity")continue;Ve&&(Le=p.LevelKey.fromURL(w,Qe),Qe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ve)>=0&&(Le.method=Ve,Le.keyFormat=Me,Ne&&(Le.keyID=Ne),Fe&&(Le.keyFormatVersions=Fe),Le.iv=ke));break}case"START":{var _e=new c.AttrList(xe),ae=_e.decimalFloatingPoint("TIME-OFFSET");Object(k.isFiniteNumber)(ae)&&(O.startTimeOffset=ae);break}case"MAP":{var Ie=new c.AttrList(xe);V.relurl=Ie.URI,Ie.BYTERANGE&&V.setByteRange(Ie.BYTERANGE),V.level=A,V.sn="initSegment",Le&&(V.levelkey=Le),V.initSegment=null,X=V,Ye=!0;break}case"SERVER-CONTROL":{var Je=new c.AttrList(xe);O.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),O.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),O.canSkipDateRanges=O.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),O.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),O.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var et=new c.AttrList(xe);O.partTarget=et.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ke=O.partList;Ke||(Ke=O.partList=[]);var it=N>0?Ke[Ke.length-1]:void 0,he=N++,Re=new S.Part(new c.AttrList(xe),V,w,he,it);Ke.push(Re),V.duration+=Re.duration;break}case"PRELOAD-HINT":{var He=new c.AttrList(xe);O.preloadHint=He;break}case"RENDITION-REPORT":{var Ee=new c.AttrList(xe);O.renditionReports=O.renditionReports||[],O.renditionReports.push(Ee);break}default:o.logger.warn("line parsed but not handled: "+ce);break}}}H&&!H.relurl?(F.pop(),G-=H.duration,O.partList&&(O.fragmentHint=H)):O.partList&&(C(V,H),V.cc=U,O.fragmentHint=V);var ve=F.length,be=F[0],J=F[ve-1];if(G+=O.skippedSegments*O.targetduration,G>0&&ve&&J){O.averagetargetduration=G/ve;var oe=J.sn;O.endSN=oe!=="initSegment"?oe:0,be&&(O.startCC=be.cc,be.initSegment||O.fragments.every(function(Z){return Z.relurl&&r(Z.relurl)})&&(o.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),V=new S.Fragment(g,w),V.relurl=J.relurl,V.level=A,V.sn="initSegment",be.initSegment=V,O.needSidxRanges=!0))}else O.endSN=0,O.startCC=0;return O.fragmentHint&&(G+=O.fragmentHint.duration),O.totalduration=G,O.endCC=U,Ze>0&&m(F,Ze),O},T}();function d(T,x){["video","audio","text"].forEach(function(E){var w=T.filter(function(g){return Object(u.isCodecType)(g,E)});if(w.length){var A=w.filter(function(g){return g.lastIndexOf("avc1",0)===0||g.lastIndexOf("mp4a",0)===0});x[E+"Codec"]=A.length>0?A[0]:w[0],T=T.filter(function(g){return w.indexOf(g)===-1})}}),x.unknownCodecs=T}function y(T,x,E){var w=x[E];w&&(T[E]=w)}function m(T,x){for(var E=T[x],w=x;w--;){var A=T[w];if(!A)return;A.programDateTime=E.programDateTime-A.duration*1e3,E=A}}function C(T,x){T.rawProgramDateTime?T.programDateTime=Date.parse(T.rawProgramDateTime):x!=null&&x.programDateTime&&(T.programDateTime=x.endProgramDateTime),Object(k.isFiniteNumber)(T.programDateTime)||(T.programDateTime=null,T.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/polyfills/number.ts"),M=D("./src/events.ts"),f=D("./src/errors.ts"),S=D("./src/utils/logger.ts"),_=D("./src/utils/mp4-tools.ts"),p=D("./src/loader/m3u8-parser.ts"),c=D("./src/types/loader.ts"),o=D("./src/utils/attr-list.ts");function u(t){var a=t.type;switch(a){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}function s(t,a){var i=t.url;return(i===void 0||i.indexOf("data:")===0)&&(i=a.url),i}var l=function(){function t(i){this.hls=void 0,this.loaders=Object.create(null),this.hls=i,this.registerListeners()}var a=t.prototype;return a.registerListeners=function(){var r=this.hls;r.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.on(M.Events.LEVEL_LOADING,this.onLevelLoading,this),r.on(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.on(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},a.unregisterListeners=function(){var r=this.hls;r.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),r.off(M.Events.LEVEL_LOADING,this.onLevelLoading,this),r.off(M.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),r.off(M.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},a.createInternalLoader=function(r){var h=this.hls.config,d=h.pLoader,y=h.loader,m=d||y,C=new m(h);return r.loader=C,this.loaders[r.type]=C,C},a.getInternalLoader=function(r){return this.loaders[r.type]},a.resetInternalLoader=function(r){this.loaders[r]&&delete this.loaders[r]},a.destroyInternalLoaders=function(){for(var r in this.loaders){var h=this.loaders[r];h&&h.destroy(),this.resetInternalLoader(r)}},a.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},a.onManifestLoading=function(r,h){var d=h.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},a.onLevelLoading=function(r,h){var d=h.id,y=h.level,m=h.url,C=h.deliveryDirectives;this.load({id:d,groupId:null,level:y,responseType:"text",type:c.PlaylistContextType.LEVEL,url:m,deliveryDirectives:C})},a.onAudioTrackLoading=function(r,h){var d=h.id,y=h.groupId,m=h.url,C=h.deliveryDirectives;this.load({id:d,groupId:y,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:C})},a.onSubtitleTrackLoading=function(r,h){var d=h.id,y=h.groupId,m=h.url,C=h.deliveryDirectives;this.load({id:d,groupId:y,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:C})},a.load=function(r){var h,d=this.hls.config,y=this.getInternalLoader(r);if(y){var m=y.context;if(m&&m.url===r.url){S.logger.trace("[playlist-loader]: playlist request ongoing");return}S.logger.log("[playlist-loader]: aborting previous loader for type: "+r.type),y.abort()}var C,T,x,E;switch(r.type){case c.PlaylistContextType.MANIFEST:C=d.manifestLoadingMaxRetry,T=d.manifestLoadingTimeOut,x=d.manifestLoadingRetryDelay,E=d.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:C=0,T=d.levelLoadingTimeOut;break;default:C=d.levelLoadingMaxRetry,T=d.levelLoadingTimeOut,x=d.levelLoadingRetryDelay,E=d.levelLoadingMaxRetryTimeout;break}if(y=this.createInternalLoader(r),(h=r.deliveryDirectives)!==null&&h!==void 0&&h.part){var w;if(r.type===c.PlaylistContextType.LEVEL&&r.level!==null?w=this.hls.levels[r.level].details:r.type===c.PlaylistContextType.AUDIO_TRACK&&r.id!==null?w=this.hls.audioTracks[r.id].details:r.type===c.PlaylistContextType.SUBTITLE_TRACK&&r.id!==null&&(w=this.hls.subtitleTracks[r.id].details),w){var A=w.partTarget,g=w.targetduration;A&&g&&(T=Math.min(Math.max(A*3,g*.8)*1e3,T))}}var P={timeout:T,maxRetry:C,retryDelay:x,maxRetryDelay:E,highWaterMark:0},O={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};y.load(r,P,O)},a.loadsuccess=function(r,h,d,y){if(y===void 0&&(y=null),d.isSidxRequest){this.handleSidxRequest(r,d),this.handlePlaylistLoaded(r,h,d,y);return}this.resetInternalLoader(d.type);var m=r.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(r,d,"no EXTM3U delimiter",y);return}h.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(r,h,d,y):this.handleMasterPlaylist(r,h,d,y)},a.loaderror=function(r,h,d){d===void 0&&(d=null),this.handleNetworkError(h,d,!1,r)},a.loadtimeout=function(r,h,d){d===void 0&&(d=null),this.handleNetworkError(h,d,!0)},a.handleMasterPlaylist=function(r,h,d,y){var m=this.hls,C=r.data,T=s(r,d),x=p.default.parseMasterPlaylist(C,T),E=x.levels,w=x.sessionData;if(!E.length){this.handleManifestParsingError(r,d,"no level found in manifest",y);return}var A=E.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),g=E.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),P=p.default.parseMasterPlaylistMedia(C,T,"AUDIO",A),O=p.default.parseMasterPlaylistMedia(C,T,"SUBTITLES",g),F=p.default.parseMasterPlaylistMedia(C,T,"CLOSED-CAPTIONS");if(P.length){var X=P.some(function(W){return!W.url});!X&&E[0].audioCodec&&!E[0].attrs.AUDIO&&(S.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),P.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new o.AttrList({}),bitrate:0,url:""}))}m.trigger(M.Events.MANIFEST_LOADED,{levels:E,audioTracks:P,subtitles:O,captions:F,url:T,stats:h,networkDetails:y,sessionData:w})},a.handleTrackOrLevelPlaylist=function(r,h,d,y){var m=this.hls,C=d.id,T=d.level,x=d.type,E=s(r,d),w=Object(k.isFiniteNumber)(C)?C:0,A=Object(k.isFiniteNumber)(T)?T:w,g=u(d),P=p.default.parseLevelPlaylist(r.data,E,A,g,w);if(!P.fragments.length){m.trigger(M.Events.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:E,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(x===c.PlaylistContextType.MANIFEST){var O={attrs:new o.AttrList({}),bitrate:0,details:P,name:"",url:E};m.trigger(M.Events.MANIFEST_LOADED,{levels:[O],audioTracks:[],url:E,stats:h,networkDetails:y,sessionData:null})}if(h.parsing.end=performance.now(),P.needSidxRanges){var F,X=(F=P.fragments[0].initSegment)===null||F===void 0?void 0:F.url;this.load({url:X,isSidxRequest:!0,type:x,level:T,levelDetails:P,id:C,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=P,this.handlePlaylistLoaded(r,h,d,y)},a.handleSidxRequest=function(r,h){var d=Object(_.parseSegmentIndex)(new Uint8Array(r.data));if(!d)return;var y=d.references,m=h.levelDetails;y.forEach(function(C,T){var x=C.info,E=m.fragments[T];E.byteRange.length===0&&E.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),E.initSegment&&E.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},a.handleManifestParsingError=function(r,h,d,y){this.hls.trigger(M.Events.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:h.type===c.PlaylistContextType.MANIFEST,url:r.url,reason:d,response:r,context:h,networkDetails:y})},a.handleNetworkError=function(r,h,d,y){d===void 0&&(d=!1),S.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+r.type+" level: "+r.level+" id: "+r.id+' group-id: "'+r.groupId+'"');var m=f.ErrorDetails.UNKNOWN,C=!1,T=this.getInternalLoader(r);switch(r.type){case c.PlaylistContextType.MANIFEST:m=d?f.ErrorDetails.MANIFEST_LOAD_TIMEOUT:f.ErrorDetails.MANIFEST_LOAD_ERROR,C=!0;break;case c.PlaylistContextType.LEVEL:m=d?f.ErrorDetails.LEVEL_LOAD_TIMEOUT:f.ErrorDetails.LEVEL_LOAD_ERROR,C=!1;break;case c.PlaylistContextType.AUDIO_TRACK:m=d?f.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:f.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,C=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:m=d?f.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:f.ErrorDetails.SUBTITLE_LOAD_ERROR,C=!1;break}T&&this.resetInternalLoader(r.type);var x={type:f.ErrorTypes.NETWORK_ERROR,details:m,fatal:C,url:r.url,loader:T,context:r,networkDetails:h};y&&(x.response=y),this.hls.trigger(M.Events.ERROR,x)},a.handlePlaylistLoaded=function(r,h,d,y){var m=d.type,C=d.level,T=d.id,x=d.groupId,E=d.loader,w=d.levelDetails,A=d.deliveryDirectives;if(!(w!=null&&w.targetduration)){this.handleManifestParsingError(r,d,"invalid target duration",y);return}if(!E)return;w.live&&(E.getCacheAge&&(w.ageHeader=E.getCacheAge()||0),(!E.getCacheAge||isNaN(w.ageHeader))&&(w.ageHeader=0));switch(m){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(M.Events.LEVEL_LOADED,{details:w,level:C||0,id:T||0,stats:h,networkDetails:y,deliveryDirectives:A});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(M.Events.AUDIO_TRACK_LOADED,{details:w,id:T||0,groupId:x||"",stats:h,networkDetails:y,deliveryDirectives:A});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(M.Events.SUBTITLE_TRACK_LOADED,{details:w,id:T||0,groupId:x||"",stats:h,networkDetails:y,deliveryDirectives:A});break}},t}();L.default=l},"./src/polyfills/number.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"isFiniteNumber",function(){return k}),D.d(L,"MAX_SAFE_INTEGER",function(){return M});var k=Number.isFinite||function(f){return typeof f=="number"&&isFinite(f)},M=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(z,L,D){"use strict";D.r(L);var k=function(){function M(){}return M.getSilentFrame=function(S,_){switch(S){case"mp4a.40.2":if(_===1)return new Uint8Array([0,200,0,128,35,128]);if(_===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(_===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(_===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(_===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(_===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(_===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(_===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(_===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}();L.default=k},"./src/remux/mp4-generator.ts":function(z,L,D){"use strict";D.r(L);var k=Math.pow(2,32)-1,M=function(){function f(){}return f.init=function(){f.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 _;for(_ in f.types)f.types.hasOwnProperty(_)&&(f.types[_]=[_.charCodeAt(0),_.charCodeAt(1),_.charCodeAt(2),_.charCodeAt(3)]);var p=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]),c=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]);f.HDLR_TYPES={video:p,audio:c};var o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),u=new Uint8Array([0,0,0,0,0,0,0,0]);f.STTS=f.STSC=f.STCO=u,f.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),f.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),f.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),f.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),t=new Uint8Array([0,0,0,1]);f.FTYP=f.box(f.types.ftyp,s,t,s,l),f.DINF=f.box(f.types.dinf,f.box(f.types.dref,o))},f.box=function(_){for(var p=8,c=arguments.length,o=new Array(c>1?c-1:0),u=1;u<c;u++)o[u-1]=arguments[u];for(var s=o.length,l=s;s--;)p+=o[s].byteLength;var t=new Uint8Array(p);for(t[0]=p>>24&255,t[1]=p>>16&255,t[2]=p>>8&255,t[3]=p&255,t.set(_,4),s=0,p=8;s<l;s++)t.set(o[s],p),p+=o[s].byteLength;return t},f.hdlr=function(_){return f.box(f.types.hdlr,f.HDLR_TYPES[_])},f.mdat=function(_){return f.box(f.types.mdat,_)},f.mdhd=function(_,p){p*=_;var c=Math.floor(p/(k+1)),o=Math.floor(p%(k+1));return f.box(f.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&255,85,196,0,0]))},f.mdia=function(_){return f.box(f.types.mdia,f.mdhd(_.timescale,_.duration),f.hdlr(_.type),f.minf(_))},f.mfhd=function(_){return f.box(f.types.mfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255]))},f.minf=function(_){return _.type==="audio"?f.box(f.types.minf,f.box(f.types.smhd,f.SMHD),f.DINF,f.stbl(_)):f.box(f.types.minf,f.box(f.types.vmhd,f.VMHD),f.DINF,f.stbl(_))},f.moof=function(_,p,c){return f.box(f.types.moof,f.mfhd(_),f.traf(c,p))},f.moov=function(_){for(var p=_.length,c=[];p--;)c[p]=f.trak(_[p]);return f.box.apply(null,[f.types.moov,f.mvhd(_[0].timescale,_[0].duration)].concat(c).concat(f.mvex(_)))},f.mvex=function(_){for(var p=_.length,c=[];p--;)c[p]=f.trex(_[p]);return f.box.apply(null,[f.types.mvex].concat(c))},f.mvhd=function(_,p){p*=_;var c=Math.floor(p/(k+1)),o=Math.floor(p%(k+1)),u=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,c>>24,c>>16&255,c>>8&255,c&255,o>>24,o>>16&255,o>>8&255,o&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 f.box(f.types.mvhd,u)},f.sdtp=function(_){var p=_.samples||[],c=new Uint8Array(4+p.length),o,u;for(o=0;o<p.length;o++)u=p[o].flags,c[o+4]=u.dependsOn<<4|u.isDependedOn<<2|u.hasRedundancy;return f.box(f.types.sdtp,c)},f.stbl=function(_){return f.box(f.types.stbl,f.stsd(_),f.box(f.types.stts,f.STTS),f.box(f.types.stsc,f.STSC),f.box(f.types.stsz,f.STSZ),f.box(f.types.stco,f.STCO))},f.avc1=function(_){var p=[],c=[],o,u,s;for(o=0;o<_.sps.length;o++)u=_.sps[o],s=u.byteLength,p.push(s>>>8&255),p.push(s&255),p=p.concat(Array.prototype.slice.call(u));for(o=0;o<_.pps.length;o++)u=_.pps[o],s=u.byteLength,c.push(s>>>8&255),c.push(s&255),c=c.concat(Array.prototype.slice.call(u));var l=f.box(f.types.avcC,new Uint8Array([1,p[3],p[4],p[5],252|3,224|_.sps.length].concat(p).concat([_.pps.length]).concat(c))),t=_.width,a=_.height,i=_.pixelRatio[0],r=_.pixelRatio[1];return f.box(f.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,t>>8&255,t&255,a>>8&255,a&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]),l,f.box(f.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),f.box(f.types.pasp,new Uint8Array([i>>24,i>>16&255,i>>8&255,i&255,r>>24,r>>16&255,r>>8&255,r&255])))},f.esds=function(_){var p=_.config.length;return new Uint8Array([0,0,0,0,3,23+p,0,1,0,4,15+p,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([p]).concat(_.config).concat([6,1,2]))},f.mp4a=function(_){var p=_.samplerate;return f.box(f.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]),f.box(f.types.esds,f.esds(_)))},f.mp3=function(_){var p=_.samplerate;return f.box(f.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]))},f.stsd=function(_){return _.type==="audio"?!_.isAAC&&_.codec==="mp3"?f.box(f.types.stsd,f.STSD,f.mp3(_)):f.box(f.types.stsd,f.STSD,f.mp4a(_)):f.box(f.types.stsd,f.STSD,f.avc1(_))},f.tkhd=function(_){var p=_.id,c=_.duration*_.timescale,o=_.width,u=_.height,s=Math.floor(c/(k+1)),l=Math.floor(c%(k+1));return f.box(f.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,p>>24&255,p>>16&255,p>>8&255,p&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,l>>24,l>>16&255,l>>8&255,l&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,o>>8&255,o&255,0,0,u>>8&255,u&255,0,0]))},f.traf=function(_,p){var c=f.sdtp(_),o=_.id,u=Math.floor(p/(k+1)),s=Math.floor(p%(k+1));return f.box(f.types.traf,f.box(f.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255])),f.box(f.types.tfdt,new Uint8Array([1,0,0,0,u>>24,u>>16&255,u>>8&255,u&255,s>>24,s>>16&255,s>>8&255,s&255])),f.trun(_,c.length+16+20+8+16+8+8),c)},f.trak=function(_){return _.duration=_.duration||4294967295,f.box(f.types.trak,f.tkhd(_),f.mdia(_))},f.trex=function(_){var p=_.id;return f.box(f.types.trex,new Uint8Array([0,0,0,0,p>>24,p>>16&255,p>>8&255,p&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},f.trun=function(_,p){var c=_.samples||[],o=c.length,u=12+16*o,s=new Uint8Array(u),l,t,a,i,r,h;for(p+=8+u,s.set([0,0,15,1,o>>>24&255,o>>>16&255,o>>>8&255,o&255,p>>>24&255,p>>>16&255,p>>>8&255,p&255],0),l=0;l<o;l++)t=c[l],a=t.duration,i=t.size,r=t.flags,h=t.cts,s.set([a>>>24&255,a>>>16&255,a>>>8&255,a&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.paddingValue<<1|r.isNonSync,r.degradPrio&240<<8,r.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*l);return f.box(f.types.trun,s)},f.initSegment=function(_){f.types||f.init();var p=f.moov(_),c=new Uint8Array(f.FTYP.byteLength+p.byteLength);return c.set(f.FTYP),c.set(p,f.FTYP.byteLength),c},f}();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,L.default=M},"./src/remux/mp4-remuxer.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return h}),D.d(L,"normalizePts",function(){return d});var k=D("./src/polyfills/number.ts"),M=D("./src/remux/aac-helper.ts"),f=D("./src/remux/mp4-generator.ts"),S=D("./src/events.ts"),_=D("./src/errors.ts"),p=D("./src/utils/logger.ts"),c=D("./src/types/loader.ts"),o=D("./src/utils/timescale-conversion.ts");function u(){return u=Object.assign||function(T){for(var x=1;x<arguments.length;x++){var E=arguments[x];for(var w in E)Object.prototype.hasOwnProperty.call(E,w)&&(T[w]=E[w])}return T},u.apply(this,arguments)}var s=10*1e3,l=1024,t=1152,a=null,i=null,r=!1,h=function(){function T(E,w,A,g){if(g===void 0&&(g=""),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=E,this.config=w,this.typeSupported=A,this.ISGenerated=!1,a===null){var P=navigator.userAgent||"",O=P.match(/Chrome\/(\d+)/i);a=O?parseInt(O[1]):0}if(i===null){var F=navigator.userAgent.match(/Safari\/(\d+)/i);i=F?parseInt(F[1]):0}r=!!a&&a<75||!!i&&i<600}var x=T.prototype;return x.destroy=function(){},x.resetTimeStamp=function(w){p.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=w},x.resetNextTimestamp=function(){p.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){p.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(w){var A=!1,g=w.reduce(function(P,O){var F=O.pts-P;return F<-4294967296?(A=!0,d(P,O.pts)):F>0?P:O.pts},w[0].pts);return A&&p.logger.debug("PTS rollover detected"),g},x.remux=function(w,A,g,P,O,F,X,W){var N,G,U,H,V,ce,ye=O,Le=O,Ze=w.pid>-1,Ye=A.pid>-1,Oe=A.samples.length,We=w.samples.length>0,ze=Oe>1,Ae=(!Ze||We)&&(!Ye||ze)||this.ISGenerated||X;if(Ae){this.ISGenerated||(U=this.generateIS(w,A,O));var xe=this.isVideoContiguous,le=-1;if(ze&&(le=y(A.samples),!xe&&this.config.forceKeyFrameOnDiscontinuity))if(ce=!0,le>0){p.logger.warn("[mp4-remuxer]: Dropped "+le+" out of "+Oe+" video samples due to a missing keyframe");var Se=this.getVideoStartPts(A.samples);A.samples=A.samples.slice(le),A.dropped+=le,Le+=(A.samples[0].pts-Se)/(A.timescale||9e4)}else le===-1&&(p.logger.warn("[mp4-remuxer]: No keyframe found out of "+Oe+" video samples"),ce=!1);if(this.ISGenerated){if(We&&ze){var pe=this.getVideoStartPts(A.samples),Ge=d(w.samples[0].pts,pe)-pe,fe=Ge/A.inputTimeScale;ye+=Math.max(0,fe),Le+=Math.max(0,-fe)}if(We){if(w.samplerate||(p.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),U=this.generateIS(w,A,O)),G=this.remuxAudio(w,ye,this.isAudioContiguous,F,Ye||ze||W===c.PlaylistLevelType.AUDIO?Le:void 0),ze){var ge=G?G.endPTS-G.startPTS:0;A.inputTimeScale||(p.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),U=this.generateIS(w,A,O)),N=this.remuxVideo(A,Le,xe,ge)}}else ze&&(N=this.remuxVideo(A,Le,xe,0));N&&(N.firstKeyFrame=le,N.independent=le!==-1)}}return this.ISGenerated&&(g.samples.length&&(V=this.remuxID3(g,O)),P.samples.length&&(H=this.remuxText(P,O))),{audio:G,video:N,initSegment:U,independent:ce,text:H,id3:V}},x.generateIS=function(w,A,g){var P=w.samples,O=A.samples,F=this.typeSupported,X={},W=!Object(k.isFiniteNumber)(this._initPTS),N="audio/mp4",G,U,H;if(W&&(G=U=Infinity),w.config&&P.length&&(w.timescale=w.samplerate,w.isAAC||(F.mpeg?(N="audio/mpeg",w.codec=""):F.mp3&&(w.codec="mp3")),X.audio={id:"audio",container:N,codec:w.codec,initSegment:!w.isAAC&&F.mpeg?new Uint8Array(0):f.default.initSegment([w]),metadata:{channelCount:w.channelCount}},W&&(H=w.inputTimeScale,G=U=P[0].pts-Math.round(H*g))),A.sps&&A.pps&&O.length&&(A.timescale=A.inputTimeScale,X.video={id:"main",container:"video/mp4",codec:A.codec,initSegment:f.default.initSegment([A]),metadata:{width:A.width,height:A.height}},W)){H=A.inputTimeScale;var V=this.getVideoStartPts(O),ce=Math.round(H*g);U=Math.min(U,d(O[0].dts,V)-ce),G=Math.min(G,V-ce)}if(Object.keys(X).length)return this.ISGenerated=!0,W&&(this._initPTS=G,this._initDTS=U),{tracks:X,initPTS:G,timescale:H}},x.remuxVideo=function(w,A,g,P){var O=w.inputTimeScale,F=w.samples,X=[],W=F.length,N=this._initPTS,G=this.nextAvcDts,U=8,H,V,ce,ye=Number.POSITIVE_INFINITY,Le=Number.NEGATIVE_INFINITY,Ze=0,Ye=!1;if(!g||G===null){var Oe=A*O,We=F[0].pts-d(F[0].dts,F[0].pts);G=Oe-We}for(var ze=0;ze<W;ze++){var Ae=F[ze];if(Ae.pts=d(Ae.pts-N,G),Ae.dts=d(Ae.dts-N,G),Ae.dts>Ae.pts){var xe=9e4*.2;Ze=Math.max(Math.min(Ze,Ae.pts-Ae.dts),-1*xe)}Ae.dts<F[ze>0?ze-1:ze].dts&&(Ye=!0)}Ye&&F.sort(function(je,ut){var tt=je.dts-ut.dts,st=je.pts-ut.pts;return tt||st}),V=F[0].dts,ce=F[F.length-1].dts;var le=Math.round((ce-V)/(W-1));if(Ze<0){if(Ze<le*-2){p.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(o.toMsFromMpegTsClock)(-le,!0)+" ms");for(var Se=Ze,pe=0;pe<W;pe++)F[pe].dts=Se=Math.max(Se,F[pe].pts-le),F[pe].pts=Math.max(Se,F[pe].pts)}else{p.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(o.toMsFromMpegTsClock)(Ze,!0)+" ms to overcome this issue");for(var Ge=0;Ge<W;Ge++)F[Ge].dts=F[Ge].dts+Ze}V=F[0].dts}if(g){var fe=V-G,ge=fe>le,De=fe<-1;if(ge||De){ge?p.logger.warn("AVC: "+Object(o.toMsFromMpegTsClock)(fe,!0)+" ms ("+fe+"dts) hole between fragments detected, filling it"):p.logger.warn("AVC: "+Object(o.toMsFromMpegTsClock)(-fe,!0)+" ms ("+fe+"dts) overlapping between fragments detected"),V=G;var Ve=F[0].pts-fe;F[0].dts=V,F[0].pts=Ve,p.logger.log("Video: First PTS/DTS adjusted: "+Object(o.toMsFromMpegTsClock)(Ve,!0)+"/"+Object(o.toMsFromMpegTsClock)(V,!0)+", delta: "+Object(o.toMsFromMpegTsClock)(fe,!0)+" ms")}}r&&(V=Math.max(0,V));for(var Qe=0,ke=0,Fe=0;Fe<W;Fe++){for(var Ne=F[Fe],Me=Ne.units,ne=Me.length,_e=0,ae=0;ae<ne;ae++)_e+=Me[ae].data.length;ke+=_e,Qe+=ne,Ne.length=_e,Ne.dts=Math.max(Ne.dts,V),Ne.pts=Math.max(Ne.pts,Ne.dts,0),ye=Math.min(Ne.pts,ye),Le=Math.max(Ne.pts,Le)}ce=F[W-1].dts;var Ie=ke+4*Qe+8,Je;try{Je=new Uint8Array(Ie)}catch(je){this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating video mdat "+Ie});return}var et=new DataView(Je.buffer);et.setUint32(0,Ie),Je.set(f.default.types.mdat,4);for(var Ke=0;Ke<W;Ke++){for(var it=F[Ke],he=it.units,Re=0,He=0,Ee=he.length;He<Ee;He++){var ve=he[He],be=ve.data,J=ve.data.byteLength;et.setUint32(U,J),U+=4,Je.set(be,U),U+=J,Re+=4+J}if(Ke<W-1)H=F[Ke+1].dts-it.dts;else{var oe=this.config,Z=it.dts-F[Ke>0?Ke-1:Ke].dts;if(oe.stretchShortVideoTrack&&this.nextAudioPts!==null){var me=Math.floor(oe.maxBufferHole*O),Xe=(P?ye+P*O:this.nextAudioPts)-it.pts;Xe>me?(H=Xe-Z,H<0&&(H=Z),p.logger.log("[mp4-remuxer]: It is approximately "+Xe/90+" ms to the next segment; using duration "+H/90+" ms for the last video frame.")):H=Z}else H=Z}var j=Math.round(it.pts-it.dts);X.push(new m(it.key,H,Re,j))}if(X.length&&a&&a<70){var we=X[0].flags;we.dependsOn=2,we.isNonSync=0}console.assert(H!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=G=ce+H,this.isVideoContiguous=!0;var Be=f.default.moof(w.sequenceNumber++,V,u({},w,{samples:X})),de="video",Ce={data1:Be,data2:Je,startPTS:ye/O,endPTS:(Le+H)/O,startDTS:V/O,endDTS:G/O,type:de,hasAudio:!1,hasVideo:!0,nb:X.length,dropped:w.dropped};return w.samples=[],w.dropped=0,console.assert(Je.length,"MDAT length must not be zero"),Ce},x.remuxAudio=function(w,A,g,P,O){var F=w.inputTimeScale,X=w.samplerate?w.samplerate:F,W=F/X,N=w.isAAC?l:t,G=N*W,U=this._initPTS,H=!w.isAAC&&this.typeSupported.mpeg,V=[],ce=w.samples,ye=H?0:8,Le=this.nextAudioPts||-1,Ze=A*F;if(this.isAudioContiguous=g=g||ce.length&&Le>0&&(P&&Math.abs(Ze-Le)<9e3||Math.abs(d(ce[0].pts-U,Ze)-Le)<20*G),ce.forEach(function(be){be.pts=d(be.pts-U,Ze)}),!g||Le<0){if(ce=ce.filter(function(be){return be.pts>=0}),!ce.length)return;O===0?Le=0:P?Le=Math.max(0,Ze):Le=ce[0].pts}if(w.isAAC)for(var Ye=O!==void 0,Oe=this.config.maxAudioFramesDrift,We=0,ze=Le;We<ce.length;We++){var Ae=ce[We],xe=Ae.pts,le=xe-ze,Se=Math.abs(1e3*le/F);if(le<=-Oe*G&&Ye)We===0&&(p.logger.warn("Audio frame @ "+(xe/F).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*le/F)+" ms."),this.nextAudioPts=Le=ze=xe);else if(le>=Oe*G&&Se<s&&Ye){var pe=Math.round(le/G);ze=xe-pe*G,ze<0&&(pe--,ze+=G),We===0&&(this.nextAudioPts=Le=ze),p.logger.warn("[mp4-remuxer]: Injecting "+pe+" audio frame @ "+(ze/F).toFixed(3)+"s due to "+Math.round(1e3*le/F)+" ms gap.");for(var Ge=0;Ge<pe;Ge++){var fe=Math.max(ze,0),ge=M.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);ge||(p.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ge=Ae.unit.subarray()),ce.splice(We,0,{unit:ge,pts:fe}),ze+=G,We++}}Ae.pts=ze,ze+=G}for(var De=null,Ve=null,Qe,ke=0,Fe=ce.length;Fe--;)ke+=ce[Fe].unit.byteLength;for(var Ne=0,Me=ce.length;Ne<Me;Ne++){var ne=ce[Ne],_e=ne.unit,ae=ne.pts;if(Ve!==null){var Ie=V[Ne-1];Ie.duration=Math.round((ae-Ve)/W)}else if(g&&w.isAAC&&(ae=Le),De=ae,ke>0){ke+=ye;try{Qe=new Uint8Array(ke)}catch(be){this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!H){var Je=new DataView(Qe.buffer);Je.setUint32(0,ke),Qe.set(f.default.types.mdat,4)}}else return;Qe.set(_e,ye);var et=_e.byteLength;ye+=et,V.push(new m(!0,N,et,0)),Ve=ae}var Ke=V.length;if(!Ke)return;var it=V[V.length-1];this.nextAudioPts=Le=Ve+W*it.duration;var he=H?new Uint8Array(0):f.default.moof(w.sequenceNumber++,De/W,u({},w,{samples:V}));w.samples=[];var Re=De/F,He=Le/F,Ee="audio",ve={data1:he,data2:Qe,startPTS:Re,endPTS:He,startDTS:Re,endDTS:He,type:Ee,hasAudio:!0,hasVideo:!1,nb:Ke};return this.isAudioContiguous=!0,console.assert(Qe.length,"MDAT length must not be zero"),ve},x.remuxEmptyAudio=function(w,A,g,P){var O=w.inputTimeScale,F=w.samplerate?w.samplerate:O,X=O/F,W=this.nextAudioPts,N=(W!==null?W:P.startDTS*O)+this._initDTS,G=P.endDTS*O+this._initDTS,U=X*l,H=Math.ceil((G-N)/U),V=M.default.getSilentFrame(w.manifestCodec||w.codec,w.channelCount);if(p.logger.warn("[mp4-remuxer]: remux empty Audio"),!V){p.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ce=[],ye=0;ye<H;ye++){var Le=N+ye*U;ce.push({unit:V,pts:Le,dts:Le})}return w.samples=ce,this.remuxAudio(w,A,g,!1)},x.remuxID3=function(w,A){var g=w.samples.length;if(!g)return;for(var P=w.inputTimeScale,O=this._initPTS,F=this._initDTS,X=0;X<g;X++){var W=w.samples[X];W.pts=d(W.pts-O,A*P)/P,W.dts=d(W.dts-F,A*P)/P}var N=w.samples;return w.samples=[],{samples:N}},x.remuxText=function(w,A){var g=w.samples.length;if(!g)return;for(var P=w.inputTimeScale,O=this._initPTS,F=0;F<g;F++){var X=w.samples[F];X.pts=d(X.pts-O,A*P)/P}w.samples.sort(function(N,G){return N.pts-G.pts});var W=w.samples;return w.samples=[],{samples:W}},T}();function d(T,x){var E;if(x===null)return T;for(x<T?E=-8589934592:E=8589934592;Math.abs(T-x)>4294967296;)T+=E;return T}function y(T){for(var x=0;x<T.length;x++)if(T[x].key)return x;return-1}var m=function(x,E,w,A){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=E,this.size=w,this.cts=A,this.flags=new C(x)},C=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/polyfills/number.ts"),M=D("./src/utils/mp4-tools.ts"),f=D("./src/loader/fragment.ts"),S=D("./src/utils/logger.ts"),_=function(){function o(){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 u=o.prototype;return u.destroy=function(){},u.resetTimeStamp=function(l){this.initPTS=l,this.lastEndDTS=null},u.resetNextTimestamp=function(){this.lastEndDTS=null},u.resetInitSegment=function(l,t,a){this.audioCodec=t,this.videoCodec=a,this.generateInitSegment(l),this.emitInitSegment=!0},u.generateInitSegment=function(l){var t=this.audioCodec,a=this.videoCodec;if(!l||!l.byteLength){this.initTracks=void 0,this.initData=void 0;return}var i=this.initData=Object(M.parseInitSegment)(l);t||(t=c(i.audio,f.ElementaryStreamTypes.AUDIO)),a||(a=c(i.video,f.ElementaryStreamTypes.VIDEO));var r={};i.audio&&i.video?r.audiovideo={container:"video/mp4",codec:t+","+a,initSegment:l,id:"main"}:i.audio?r.audio={container:"audio/mp4",codec:t,initSegment:l,id:"audio"}:i.video?r.video={container:"video/mp4",codec:a,initSegment:l,id:"main"}:S.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r},u.remux=function(l,t,a,i,r){var h=this.initPTS,d=this.lastEndDTS,y={audio:void 0,video:void 0,text:i,id3:a,initSegment:void 0};Object(k.isFiniteNumber)(d)||(d=this.lastEndDTS=r||0);var m=t.samples;if(!m||!m.length)return y;var C={initPTS:void 0,timescale:1},T=this.initData;if((!T||!T.length)&&(this.generateInitSegment(m),T=this.initData),!T||!T.length)return S.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),y;this.emitInitSegment&&(C.tracks=this.initTracks,this.emitInitSegment=!1),Object(k.isFiniteNumber)(h)||(this.initPTS=C.initPTS=h=p(T,m,d));var x=Object(M.getDuration)(m,T),E=d,w=x+E;Object(M.offsetStartDTS)(T,m,h),x>0?this.lastEndDTS=w:(S.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var A=!!T.audio,g=!!T.video,P="";A&&(P+="audio"),g&&(P+="video");var O={data1:m,startPTS:E,startDTS:E,endPTS:w,endDTS:w,type:P,hasAudio:A,hasVideo:g,nb:1,dropped:0};return y.audio=O.type==="audio"?O:void 0,y.video=O.type!=="audio"?O:void 0,y.text=i,y.id3=a,y.initSegment=C,y},o}(),p=function(u,s,l){return Object(M.getStartDTS)(u,s)-l};function c(o,u){var s=o==null?void 0:o.codec;return s&&s.length>4?s:s==="hvc1"?"hvc1.1.c.L120.90":s==="av01"?"av01.0.04M.08":s==="avc1"||u===f.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}L.default=_},"./src/task-loop.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return k});var k=function(){function M(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var f=M.prototype;return f.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},f.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},f.onHandlerDestroyed=function(){},f.hasInterval=function(){return!!this._tickInterval},f.hasNextTick=function(){return!!this._tickTimer},f.setInterval=function(_){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,_),!0)},f.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},f.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},f.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},f.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},f.doTick=function(){},M}()},"./src/types/cmcd.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"CMCDVersion",function(){return k}),D.d(L,"CMCDObjectType",function(){return M}),D.d(L,"CMCDStreamingFormat",function(){return f}),D.d(L,"CMCDStreamType",function(){return S});var k=1,M;(function(_){_.MANIFEST="m",_.AUDIO="a",_.VIDEO="v",_.MUXED="av",_.INIT="i",_.CAPTION="c",_.TIMED_TEXT="tt",_.KEY="k",_.OTHER="o"})(M||(M={}));var f;(function(_){_.DASH="d",_.HLS="h",_.SMOOTH="s",_.OTHER="o"})(f||(f={}));var S;(function(_){_.VOD="v",_.LIVE="l"})(S||(S={}))},"./src/types/level.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"HlsSkip",function(){return f}),D.d(L,"getSkipValue",function(){return S}),D.d(L,"HlsUrlParameters",function(){return _}),D.d(L,"Level",function(){return p});function k(c,o){for(var u=0;u<o.length;u++){var s=o[u];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(c,s.key,s)}}function M(c,o,u){return o&&k(c.prototype,o),u&&k(c,u),c}var f;(function(c){c.No="",c.Yes="YES",c.v2="v2"})(f||(f={}));function S(c,o){var u=c.canSkipUntil,s=c.canSkipDateRanges,l=c.endSN,t=o!==void 0?o-l:0;return u&&t<u?s?f.v2:f.Yes:f.No}var _=function(){function c(u,s,l){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=u,this.part=s,this.skip=l}var o=c.prototype;return o.addDirectives=function(s){var l=new self.URL(s);return this.msn!==void 0&&l.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&l.searchParams.set("_HLS_part",this.part.toString()),this.skip&&l.searchParams.set("_HLS_skip",this.skip),l.toString()},c}(),p=function(){function c(o){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=[o.url],this.attrs=o.attrs,this.bitrate=o.bitrate,o.details&&(this.details=o.details),this.id=o.id||0,this.name=o.name,this.width=o.width||0,this.height=o.height||0,this.audioCodec=o.audioCodec,this.videoCodec=o.videoCodec,this.unknownCodecs=o.unknownCodecs,this.codecSet=[o.videoCodec,o.audioCodec].filter(function(u){return u}).join(",").replace(/\.[^.,]+/g,"")}return M(c,[{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(u){var s=u%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}]),c}()},"./src/types/loader.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"PlaylistContextType",function(){return k}),D.d(L,"PlaylistLevelType",function(){return M});var k;(function(f){f.MANIFEST="manifest",f.LEVEL="level",f.AUDIO_TRACK="audioTrack",f.SUBTITLE_TRACK="subtitleTrack"})(k||(k={}));var M;(function(f){f.MAIN="main",f.AUDIO="audio",f.SUBTITLE="subtitle"})(M||(M={}))},"./src/types/transmuxer.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"ChunkMetadata",function(){return k});var k=function(S,_,p,c,o,u){c===void 0&&(c=0),o===void 0&&(o=-1),u===void 0&&(u=!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=S,this.sn=_,this.id=p,this.size=c,this.part=o,this.partial=u};function M(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"AttrList",function(){return f});var k=/^(\d+)x(\d+)$/,M=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,f=function(){function S(p){typeof p=="string"&&(p=S.parseAttrList(p));for(var c in p)p.hasOwnProperty(c)&&(this[c]=p[c])}var _=S.prototype;return _.decimalInteger=function(c){var o=parseInt(this[c],10);return o>Number.MAX_SAFE_INTEGER?Infinity:o},_.hexadecimalInteger=function(c){if(this[c]){var o=(this[c]||"0x").slice(2);o=(o.length&1?"0":"")+o;for(var u=new Uint8Array(o.length/2),s=0;s<o.length/2;s++)u[s]=parseInt(o.slice(s*2,s*2+2),16);return u}else return null},_.hexadecimalIntegerAsNumber=function(c){var o=parseInt(this[c],16);return o>Number.MAX_SAFE_INTEGER?Infinity:o},_.decimalFloatingPoint=function(c){return parseFloat(this[c])},_.optionalFloat=function(c,o){var u=this[c];return u?parseFloat(u):o},_.enumeratedString=function(c){return this[c]},_.bool=function(c){return this[c]==="YES"},_.decimalResolution=function(c){var o=k.exec(this[c]);return o===null?void 0:{width:parseInt(o[1],10),height:parseInt(o[2],10)}},S.parseAttrList=function(c){var o,u={},s='"';for(M.lastIndex=0;(o=M.exec(c))!==null;){var l=o[2];l.indexOf(s)===0&&l.lastIndexOf(s)===l.length-1&&(l=l.slice(1,-1)),u[o[1]]=l}return u},S}()},"./src/utils/binary-search.ts":function(z,L,D){"use strict";D.r(L);var k={search:function(f,S){for(var _=0,p=f.length-1,c=null,o=null;_<=p;){c=(_+p)/2|0,o=f[c];var u=S(o);if(u>0)_=c+1;else if(u<0)p=c-1;else return o}return null}};L.default=k},"./src/utils/buffer-helper.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"BufferHelper",function(){return f});var k=D("./src/utils/logger.ts"),M={length:0,start:function(){return 0},end:function(){return 0}},f=function(){function S(){}return S.isBuffered=function(p,c){try{if(p){for(var o=S.getBuffered(p),u=0;u<o.length;u++)if(c>=o.start(u)&&c<=o.end(u))return!0}}catch(s){}return!1},S.bufferInfo=function(p,c,o){try{if(p){var u=S.getBuffered(p),s=[],l;for(l=0;l<u.length;l++)s.push({start:u.start(l),end:u.end(l)});return this.bufferedInfo(s,c,o)}}catch(t){}return{len:0,start:c,end:c,nextStart:void 0}},S.bufferedInfo=function(p,c,o){c=Math.max(0,c),p.sort(function(C,T){var x=C.start-T.start;return x||T.end-C.end});var u=[];if(o)for(var s=0;s<p.length;s++){var l=u.length;if(l){var t=u[l-1].end;p[s].start-t<o?p[s].end>t&&(u[l-1].end=p[s].end):u.push(p[s])}else u.push(p[s])}else u=p;for(var a=0,i,r=c,h=c,d=0;d<u.length;d++){var y=u[d].start,m=u[d].end;if(c+o>=y&&c<m)r=y,h=m,a=h-c;else if(c+o<y){i=y;break}}return{len:a,start:r||0,end:h||0,nextStart:i}},S.getBuffered=function(p){try{return p.buffered}catch(c){return k.logger.log("failed to get media.buffered",c),M}},S}()},"./src/utils/cea-608-parser.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"Row",function(){return h}),D.d(L,"CaptionScreen",function(){return d});var k=D("./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},f=function(w){var A=w;return M.hasOwnProperty(w)&&(A=M[w]),String.fromCharCode(A)},S=15,_=100,p={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},c={17:2,18:4,21:6,22:8,23:10,19:13,20:15},o={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},s=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],l;(function(E){E[E.ERROR=0]="ERROR",E[E.TEXT=1]="TEXT",E[E.WARNING=2]="WARNING",E[E.INFO=2]="INFO",E[E.DEBUG=3]="DEBUG",E[E.DATA=3]="DATA"})(l||(l={}));var t=function(){function E(){this.time=null,this.verboseLevel=l.ERROR}var w=E.prototype;return w.log=function(g,P){this.verboseLevel>=g&&k.logger.log(this.time+" ["+g+"] "+P)},E}(),a=function(w){for(var A=[],g=0;g<w.length;g++)A.push(w[g].toString(16));return A},i=function(){function E(A,g,P,O,F){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=A||"white",this.underline=g||!1,this.italics=P||!1,this.background=O||"black",this.flash=F||!1}var w=E.prototype;return w.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},w.setStyles=function(g){for(var P=["foreground","underline","italics","background","flash"],O=0;O<P.length;O++){var F=P[O];g.hasOwnProperty(F)&&(this[F]=g[F])}},w.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},w.equals=function(g){return this.foreground===g.foreground&&this.underline===g.underline&&this.italics===g.italics&&this.background===g.background&&this.flash===g.flash},w.copy=function(g){this.foreground=g.foreground,this.underline=g.underline,this.italics=g.italics,this.background=g.background,this.flash=g.flash},w.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},E}(),r=function(){function E(A,g,P,O,F,X){this.uchar=void 0,this.penState=void 0,this.uchar=A||" ",this.penState=new i(g,P,O,F,X)}var w=E.prototype;return w.reset=function(){this.uchar=" ",this.penState.reset()},w.setChar=function(g,P){this.uchar=g,this.penState.copy(P)},w.setPenState=function(g){this.penState.copy(g)},w.equals=function(g){return this.uchar===g.uchar&&this.penState.equals(g.penState)},w.copy=function(g){this.uchar=g.uchar,this.penState.copy(g.penState)},w.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},E}(),h=function(){function E(A){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var g=0;g<_;g++)this.chars.push(new r);this.logger=A,this.pos=0,this.currPenState=new i}var w=E.prototype;return w.equals=function(g){for(var P=!0,O=0;O<_;O++)if(!this.chars[O].equals(g.chars[O])){P=!1;break}return P},w.copy=function(g){for(var P=0;P<_;P++)this.chars[P].copy(g.chars[P])},w.isEmpty=function(){for(var g=!0,P=0;P<_;P++)if(!this.chars[P].isEmpty()){g=!1;break}return g},w.setCursor=function(g){this.pos!==g&&(this.pos=g),this.pos<0?(this.logger.log(l.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>_&&(this.logger.log(l.DEBUG,"Too large cursor position "+this.pos),this.pos=_)},w.moveCursor=function(g){var P=this.pos+g;if(g>1)for(var O=this.pos+1;O<P+1;O++)this.chars[O].setPenState(this.currPenState);this.setCursor(P)},w.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},w.insertChar=function(g){g>=144&&this.backSpace();var P=f(g);if(this.pos>=_){this.logger.log(l.ERROR,"Cannot insert "+g.toString(16)+" ("+P+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(P,this.currPenState),this.moveCursor(1)},w.clearFromPos=function(g){var P;for(P=g;P<_;P++)this.chars[P].reset()},w.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},w.clearToEndOfRow=function(){this.clearFromPos(this.pos)},w.getTextString=function(){for(var g=[],P=!0,O=0;O<_;O++){var F=this.chars[O].uchar;F!==" "&&(P=!1),g.push(F)}return P?"":g.join("")},w.setPenStyles=function(g){this.currPenState.setStyles(g);var P=this.chars[this.pos];P.setPenState(this.currPenState)},E}(),d=function(){function E(A){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var g=0;g<S;g++)this.rows.push(new h(A));this.logger=A,this.currRow=S-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var w=E.prototype;return w.reset=function(){for(var g=0;g<S;g++)this.rows[g].clear();this.currRow=S-1},w.equals=function(g){for(var P=!0,O=0;O<S;O++)if(!this.rows[O].equals(g.rows[O])){P=!1;break}return P},w.copy=function(g){for(var P=0;P<S;P++)this.rows[P].copy(g.rows[P])},w.isEmpty=function(){for(var g=!0,P=0;P<S;P++)if(!this.rows[P].isEmpty()){g=!1;break}return g},w.backSpace=function(){var g=this.rows[this.currRow];g.backSpace()},w.clearToEndOfRow=function(){var g=this.rows[this.currRow];g.clearToEndOfRow()},w.insertChar=function(g){var P=this.rows[this.currRow];P.insertChar(g)},w.setPen=function(g){var P=this.rows[this.currRow];P.setPenStyles(g)},w.moveCursor=function(g){var P=this.rows[this.currRow];P.moveCursor(g)},w.setCursor=function(g){this.logger.log(l.INFO,"setCursor: "+g);var P=this.rows[this.currRow];P.setCursor(g)},w.setPAC=function(g){this.logger.log(l.INFO,"pacData = "+JSON.stringify(g));var P=g.row-1;if(this.nrRollUpRows&&P<this.nrRollUpRows-1&&(P=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==P){for(var O=0;O<S;O++)this.rows[O].clear();var F=this.currRow+1-this.nrRollUpRows,X=this.lastOutputScreen;if(X){var W=X.rows[F].cueStartTime,N=this.logger.time;if(W&&N!==null&&W<N)for(var G=0;G<this.nrRollUpRows;G++)this.rows[P-this.nrRollUpRows+G+1].copy(X.rows[F+G])}}this.currRow=P;var U=this.rows[this.currRow];if(g.indent!==null){var H=g.indent,V=Math.max(H-1,0);U.setCursor(g.indent),g.color=U.chars[V].penState.foreground}var ce={foreground:g.color,underline:g.underline,italics:g.italics,background:"black",flash:!1};this.setPen(ce)},w.setBkgData=function(g){this.logger.log(l.INFO,"bkgData = "+JSON.stringify(g)),this.backSpace(),this.setPen(g),this.insertChar(32)},w.setRollUpRows=function(g){this.nrRollUpRows=g},w.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(l.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(l.TEXT,this.getDisplayText());var g=this.currRow+1-this.nrRollUpRows,P=this.rows.splice(g,1)[0];P.clear(),this.rows.splice(this.currRow,0,P),this.logger.log(l.INFO,"Rolling up")},w.getDisplayText=function(g){g=g||!1;for(var P=[],O="",F=-1,X=0;X<S;X++){var W=this.rows[X].getTextString();W&&(F=X+1,g?P.push("Row "+F+": '"+W+"'"):P.push(W.trim()))}return P.length>0&&(g?O="["+P.join(" | ")+"]":O=P.join(`
`)),O},w.getTextAndFormat=function(){return this.rows},E}(),y=function(){function E(A,g,P){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=A,this.outputFilter=g,this.mode=null,this.verbose=0,this.displayedMemory=new d(P),this.nonDisplayedMemory=new d(P),this.lastOutputScreen=new d(P),this.currRollUpRow=this.displayedMemory.rows[S-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=P}var w=E.prototype;return w.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[S-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},w.getHandler=function(){return this.outputFilter},w.setHandler=function(g){this.outputFilter=g},w.setPAC=function(g){this.writeScreen.setPAC(g)},w.setBkgData=function(g){this.writeScreen.setBkgData(g)},w.setMode=function(g){if(g===this.mode)return;this.mode=g,this.logger.log(l.INFO,"MODE="+g),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=g},w.insertChars=function(g){for(var P=0;P<g.length;P++)this.writeScreen.insertChar(g[P]);var O=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(l.INFO,O+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(l.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},w.ccRCL=function(){this.logger.log(l.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},w.ccBS=function(){if(this.logger.log(l.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},w.ccAOF=function(){},w.ccAON=function(){},w.ccDER=function(){this.logger.log(l.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},w.ccRU=function(g){this.logger.log(l.INFO,"RU("+g+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(g)},w.ccFON=function(){this.logger.log(l.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},w.ccRDC=function(){this.logger.log(l.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},w.ccTR=function(){this.logger.log(l.INFO,"TR"),this.setMode("MODE_TEXT")},w.ccRTD=function(){this.logger.log(l.INFO,"RTD"),this.setMode("MODE_TEXT")},w.ccEDM=function(){this.logger.log(l.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},w.ccCR=function(){this.logger.log(l.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},w.ccENM=function(){this.logger.log(l.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},w.ccEOC=function(){if(this.logger.log(l.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var g=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=g,this.writeScreen=this.nonDisplayedMemory,this.logger.log(l.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},w.ccTO=function(g){this.logger.log(l.INFO,"TO("+g+") - Tab Offset"),this.writeScreen.moveCursor(g)},w.ccMIDROW=function(g){var P={flash:!1};if(P.underline=g%2===1,P.italics=g>=46,P.italics)P.foreground="white";else{var O=Math.floor(g/2)-16,F=["white","green","blue","cyan","red","yellow","magenta"];P.foreground=F[O]}this.logger.log(l.INFO,"MIDROW: "+JSON.stringify(P)),this.writeScreen.setPen(P)},w.outputDataUpdate=function(g){g===void 0&&(g=!1);var P=this.logger.time;if(P===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=P:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,P,this.lastOutputScreen),g&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:P),this.lastOutputScreen.copy(this.displayedMemory))},w.cueSplitAtTime=function(g){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,g,this.displayedMemory),this.cueStartTime=g))},E}(),m=function(){function E(A,g,P){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var O=new t;this.channels=[null,new y(A,g,O),new y(A+1,P,O)],this.cmdHistory=x(),this.logger=O}var w=E.prototype;return w.getHandler=function(g){return this.channels[g].getHandler()},w.setHandler=function(g,P){this.channels[g].setHandler(P)},w.addData=function(g,P){var O,F,X,W=!1;this.logger.time=g;for(var N=0;N<P.length;N+=2){if(F=P[N]&127,X=P[N+1]&127,F===0&&X===0)continue;if(this.logger.log(l.DATA,"["+a([P[N],P[N+1]])+"] -> ("+a([F,X])+")"),O=this.parseCmd(F,X),O||(O=this.parseMidrow(F,X)),O||(O=this.parsePAC(F,X)),O||(O=this.parseBackgroundAttributes(F,X)),!O&&(W=this.parseChars(F,X),W)){var G=this.currentChannel;if(G&&G>0){var U=this.channels[G];U.insertChars(W)}else this.logger.log(l.WARNING,"No channel found yet. TEXT-MODE?")}!O&&!W&&this.logger.log(l.WARNING,"Couldn't parse cleaned data "+a([F,X])+" orig: "+a([P[N],P[N+1]]))}},w.parseCmd=function(g,P){var O=this.cmdHistory,F=(g===20||g===28||g===21||g===29)&&P>=32&&P<=47,X=(g===23||g===31)&&P>=33&&P<=35;if(!(F||X))return!1;if(T(g,P,O))return C(null,null,O),this.logger.log(l.DEBUG,"Repeated command ("+a([g,P])+") is dropped"),!0;var W=g===20||g===21||g===23?1:2,N=this.channels[W];return g===20||g===21||g===28||g===29?P===32?N.ccRCL():P===33?N.ccBS():P===34?N.ccAOF():P===35?N.ccAON():P===36?N.ccDER():P===37?N.ccRU(2):P===38?N.ccRU(3):P===39?N.ccRU(4):P===40?N.ccFON():P===41?N.ccRDC():P===42?N.ccTR():P===43?N.ccRTD():P===44?N.ccEDM():P===45?N.ccCR():P===46?N.ccENM():P===47&&N.ccEOC():N.ccTO(P-32),C(g,P,O),this.currentChannel=W,!0},w.parseMidrow=function(g,P){var O=0;if((g===17||g===25)&&P>=32&&P<=47){if(g===17?O=1:O=2,O!==this.currentChannel)return this.logger.log(l.ERROR,"Mismatch channel in midrow parsing"),!1;var F=this.channels[O];return F?(F.ccMIDROW(P),this.logger.log(l.DEBUG,"MIDROW ("+a([g,P])+")"),!0):!1}return!1},w.parsePAC=function(g,P){var O,F=this.cmdHistory,X=(g>=17&&g<=23||g>=25&&g<=31)&&P>=64&&P<=127,W=(g===16||g===24)&&P>=64&&P<=95;if(!(X||W))return!1;if(T(g,P,F))return C(null,null,F),!0;var N=g<=23?1:2;P>=64&&P<=95?O=N===1?p[g]:o[g]:O=N===1?c[g]:u[g];var G=this.channels[N];return G?(G.setPAC(this.interpretPAC(O,P)),C(g,P,F),this.currentChannel=N,!0):!1},w.interpretPAC=function(g,P){var O,F={color:null,italics:!1,indent:null,underline:!1,row:g};return P>95?O=P-96:O=P-64,F.underline=(O&1)===1,O<=13?F.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(O/2)]:O<=15?(F.italics=!0,F.color="white"):F.indent=Math.floor((O-16)/2)*4,F},w.parseChars=function(g,P){var O,F=null,X=null;if(g>=25?(O=2,X=g-8):(O=1,X=g),X>=17&&X<=19){var W;X===17?W=P+80:X===18?W=P+112:W=P+144,this.logger.log(l.INFO,"Special char '"+f(W)+"' in channel "+O),F=[W]}else g>=32&&g<=127&&(F=P===0?[g]:[g,P]);if(F){var N=a(F);this.logger.log(l.DEBUG,"Char codes = "+N.join(",")),C(g,P,this.cmdHistory)}return F},w.parseBackgroundAttributes=function(g,P){var O=(g===16||g===24)&&P>=32&&P<=47,F=(g===23||g===31)&&P>=45&&P<=47;if(!(O||F))return!1;var X,W={};g===16||g===24?(X=Math.floor((P-32)/2),W.background=s[X],P%2===1&&(W.background=W.background+"_semi")):P===45?W.background="transparent":(W.foreground="black",P===47&&(W.underline=!0));var N=g<=23?1:2,G=this.channels[N];return G.setBkgData(W),C(g,P,this.cmdHistory),!0},w.reset=function(){for(var g=0;g<Object.keys(this.channels).length;g++){var P=this.channels[g];P&&P.reset()}this.cmdHistory=x()},w.cueSplitAtTime=function(g){for(var P=0;P<this.channels.length;P++){var O=this.channels[P];O&&O.cueSplitAtTime(g)}},E}();function C(E,w,A){A.a=E,A.b=w}function T(E,w,A){return A.a===E&&A.b===w}function x(){return{a:null,b:null}}L.default=m},"./src/utils/codecs.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"isCodecType",function(){return M}),D.d(L,"isCodecSupportedInMp4",function(){return f});var k={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function M(S,_){var p=k[_];return!!p&&p[S.slice(0,4)]===!0}function f(S,_){return MediaSource.isTypeSupported((_||"video")+'/mp4;codecs="'+S+'"')}},"./src/utils/cues.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/utils/vttparser.ts"),M=D("./src/utils/webvtt-parser.ts"),f=D("./src/utils/texttrack-utils.ts"),S=/\s/,_={newCue:function(c,o,u,s){for(var l=[],t,a,i,r,h,d=self.VTTCue||self.TextTrackCue,y=0;y<s.rows.length;y++)if(t=s.rows[y],i=!0,r=0,h="",!t.isEmpty()){for(var m=0;m<t.chars.length;m++)S.test(t.chars[m].uchar)&&i?r++:(h+=t.chars[m].uchar,i=!1);t.cueStartTime=o,o===u&&(u+=1e-4),r>=16?r--:r++;var C=Object(k.fixLineBreaks)(h.trim()),T=Object(M.generateCueId)(o,u,C);(!c||!c.cues||!c.cues.getCueById(T))&&(a=new d(o,u,C),a.id=T,a.line=y+1,a.align="left",a.position=10+Math.min(80,Math.floor(r*8/32)*10),l.push(a))}return c&&l.length&&(l.sort(function(x,E){return x.line==="auto"||E.line==="auto"?0:x.line>8&&E.line>8?E.line-x.line:x.line-E.line}),l.forEach(function(x){return Object(f.addCueToTrack)(c,x)})),l}};L.default=_},"./src/utils/discontinuities.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"findFirstFragWithCC",function(){return S}),D.d(L,"shouldAlignOnDiscontinuities",function(){return _}),D.d(L,"findDiscontinuousReferenceFrag",function(){return p}),D.d(L,"adjustSlidingStart",function(){return o}),D.d(L,"alignStream",function(){return u}),D.d(L,"alignPDT",function(){return l}),D.d(L,"alignFragmentByPDTDelta",function(){return t}),D.d(L,"alignMediaPlaylistByPDT",function(){return a});var k=D("./src/polyfills/number.ts"),M=D("./src/utils/logger.ts"),f=D("./src/controller/level-helper.ts");function S(i,r){for(var h=null,d=0,y=i.length;d<y;d++){var m=i[d];if(m&&m.cc===r){h=m;break}}return h}function _(i,r,h){return!!(r.details&&(h.endCC>h.startCC||i&&i.cc<h.startCC))}function p(i,r){var h=i.fragments,d=r.fragments;if(!d.length||!h.length){M.logger.log("No fragments to align");return}var y=S(h,d[0].cc);if(!y||y&&!y.startPTS){M.logger.log("No frag in previous level to align on");return}return y}function c(i,r){if(i){var h=i.start+r;i.start=i.startPTS=h,i.endPTS=h+i.duration}}function o(i,r){for(var h=r.fragments,d=0,y=h.length;d<y;d++)c(h[d],i);r.fragmentHint&&c(r.fragmentHint,i),r.alignedSliding=!0}function u(i,r,h){if(!r)return;s(i,h,r),!h.alignedSliding&&r.details&&l(h,r.details),!h.alignedSliding&&r.details&&!h.skippedSegments&&Object(f.adjustSliding)(r.details,h)}function s(i,r,h){if(_(i,h,r)){var d=p(h.details,r);d&&Object(k.isFiniteNumber)(d.start)&&(M.logger.log("Adjusting PTS using last level due to CC increase within current level "+r.url),o(d.start,r))}}function l(i,r){if(!r.fragments.length||!i.hasProgramDateTime||!r.hasProgramDateTime)return;var h=r.fragments[0].programDateTime,d=i.fragments[0].programDateTime,y=(d-h)/1e3+r.fragments[0].start;y&&Object(k.isFiniteNumber)(y)&&(M.logger.log("Adjusting PTS using programDateTime delta "+(d-h)+"ms, sliding:"+y.toFixed(3)+" "+i.url+" "),o(y,i))}function t(i,r){var h=i.programDateTime;if(!h)return;var d=(h-r)/1e3;i.start=i.startPTS=d,i.endPTS=d+i.duration}function a(i,r){if(!r.fragments.length||!i.hasProgramDateTime||!r.hasProgramDateTime)return;var h=r.fragments[0].programDateTime,d=r.fragments[0].start,y=h-d*1e3;i.fragments.forEach(function(m){t(m,y)}),i.fragmentHint&&t(i.fragmentHint,y),i.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/utils/ewma.ts"),M=function(){function f(_,p,c){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=c,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new k.default(_),this.fast_=new k.default(p)}var S=f.prototype;return S.update=function(p,c){var o=this.slow_,u=this.fast_;this.slow_.halfLife!==p&&(this.slow_=new k.default(p,o.getEstimate(),o.getTotalWeight())),this.fast_.halfLife!==c&&(this.fast_=new k.default(c,u.getEstimate(),u.getTotalWeight()))},S.sample=function(p,c){p=Math.max(p,this.minDelayMs_);var o=8*c,u=p/1e3,s=o/u;this.fast_.sample(u,s),this.slow_.sample(u,s)},S.canEstimate=function(){var p=this.fast_;return p&&p.getTotalWeight()>=this.minWeight_},S.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},S.destroy=function(){},f}();L.default=M},"./src/utils/ewma.ts":function(z,L,D){"use strict";D.r(L);var k=function(){function M(S,_,p){_===void 0&&(_=0),p===void 0&&(p=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=S,this.alpha_=S?Math.exp(Math.log(.5)/S):0,this.estimate_=_,this.totalWeight_=p}var f=M.prototype;return f.sample=function(_,p){var c=Math.pow(this.alpha_,_);this.estimate_=p*(1-c)+c*this.estimate_,this.totalWeight_+=_},f.getTotalWeight=function(){return this.totalWeight_},f.getEstimate=function(){if(this.alpha_){var _=1-Math.pow(this.alpha_,this.totalWeight_);if(_)return this.estimate_/_}return this.estimate_},M}();L.default=k},"./src/utils/fetch-loader.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"fetchSupported",function(){return t});var k=D("./src/polyfills/number.ts"),M=D("./src/loader/load-stats.ts"),f=D("./src/demux/chunk-cache.ts");function S(d,y){d.prototype=Object.create(y.prototype),d.prototype.constructor=d,u(d,y)}function _(d){var y=typeof Map=="function"?new Map:void 0;return _=function(C){if(C===null||!o(C))return C;if(typeof C!="function")throw new TypeError("Super expression must either be null or a function");if(typeof y!="undefined"){if(y.has(C))return y.get(C);y.set(C,T)}function T(){return p(C,arguments,s(this).constructor)}return T.prototype=Object.create(C.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),u(T,C)},_(d)}function p(d,y,m){return c()?p=Reflect.construct:p=function(T,x,E){var w=[null];w.push.apply(w,x);var A=Function.bind.apply(T,w),g=new A;return E&&u(g,E.prototype),g},p.apply(null,arguments)}function c(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function o(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function u(d,y){return u=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},u(d,y)}function s(d){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},s(d)}function l(){return l=Object.assign||function(d){for(var y=1;y<arguments.length;y++){var m=arguments[y];for(var C in m)Object.prototype.hasOwnProperty.call(m,C)&&(d[C]=m[C])}return d},l.apply(this,arguments)}function t(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var a=function(){function d(m){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=m.fetchSetup||r,this.controller=new self.AbortController,this.stats=new M.LoadStats}var y=d.prototype;return y.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},y.abortInternal=function(){var C=this.response;(!C||!C.ok)&&(this.stats.aborted=!0,this.controller.abort())},y.abort=function(){var C;this.abortInternal(),(C=this.callbacks)!==null&&C!==void 0&&C.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},y.load=function(C,T,x){var E=this,w=this.stats;if(w.loading.start)throw new Error("Loader can only be used once.");w.loading.start=self.performance.now();var A=i(C,this.controller.signal),g=x.onProgress,P=C.responseType==="arraybuffer",O=P?"byteLength":"length";this.context=C,this.config=T,this.callbacks=x,this.request=this.fetchSetup(C,A),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){E.abortInternal(),x.onTimeout(w,C,E.response)},T.timeout),self.fetch(this.request).then(function(F){if(E.response=E.loader=F,!F.ok){var X=F.status,W=F.statusText;throw new h(W||"fetch, bad network response",X,F)}return w.loading.first=Math.max(self.performance.now(),w.loading.start),w.total=parseInt(F.headers.get("Content-Length")||"0"),g&&Object(k.isFiniteNumber)(T.highWaterMark)?E.loadProgressively(F,w,C,T.highWaterMark,g):P?F.arrayBuffer():F.text()}).then(function(F){var X=E.response;self.clearTimeout(E.requestTimeout),w.loading.end=Math.max(self.performance.now(),w.loading.first),w.loaded=w.total=F[O];var W={url:X.url,data:F};g&&!Object(k.isFiniteNumber)(T.highWaterMark)&&g(w,C,F,X),x.onSuccess(W,w,C,X)}).catch(function(F){if(self.clearTimeout(E.requestTimeout),w.aborted)return;var X=F.code||0;x.onError({code:X,text:F.message},C,F.details)})},y.getCacheAge=function(){var C=null;if(this.response){var T=this.response.headers.get("age");C=T?parseFloat(T):null}return C},y.loadProgressively=function(C,T,x,E,w){E===void 0&&(E=0);var A=new f.default,g=C.body.getReader(),P=function O(){return g.read().then(function(F){if(F.done)return A.dataLength&&w(T,x,A.flush(),C),Promise.resolve(new ArrayBuffer(0));var X=F.value,W=X.length;return T.loaded+=W,W<E||A.dataLength?(A.push(X),A.dataLength>=E&&w(T,x,A.flush(),C)):w(T,x,X,C),O()}).catch(function(){return Promise.reject()})};return P()},d}();function i(d,y){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:y,headers:new self.Headers(l({},d.headers))};return d.rangeEnd&&m.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),m}function r(d,y){return new self.Request(d.url,y)}var h=function(d){S(y,d);function y(m,C,T){var x;return x=d.call(this,m)||this,x.code=void 0,x.details=void 0,x.code=C,x.details=T,x}return y}(_(Error));L.default=a},"./src/utils/imsc1-ttml-parser.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"IMSC1_CODEC",function(){return o}),D.d(L,"parseIMSC1",function(){return t});var k=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/vttparser.ts"),f=D("./src/utils/vttcue.ts"),S=D("./src/demux/id3.ts"),_=D("./src/utils/timescale-conversion.ts"),p=D("./src/utils/webvtt-parser.ts");function c(){return c=Object.assign||function(E){for(var w=1;w<arguments.length;w++){var A=arguments[w];for(var g in A)Object.prototype.hasOwnProperty.call(A,g)&&(E[g]=A[g])}return E},c.apply(this,arguments)}var o="stpp.ttml.im1t",u=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,s=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,l={left:"start",center:"center",right:"end",start:"start",end:"end"};function t(E,w,A,g,P){var O=Object(k.findBox)(new Uint8Array(E),["mdat"]);if(O.length===0){P(new Error("Could not parse IMSC1 mdat"));return}var F=O[0],X=Object(S.utf8ArrayToStr)(new Uint8Array(E,F.start,F.end-F.start)),W=Object(_.toTimescaleFromScale)(w,1,A);try{g(a(X,W))}catch(N){P(N)}}function a(E,w){var A=new DOMParser,g=A.parseFromString(E,"text/xml"),P=g.getElementsByTagName("tt")[0];if(!P)throw new Error("Invalid ttml");var O={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},F=Object.keys(O).reduce(function(U,H){return U[H]=P.getAttribute("ttp:"+H)||O[H],U},{}),X=P.getAttribute("xml:space")!=="preserve",W=r(i(P,"styling","style")),N=r(i(P,"layout","region")),G=i(P,"body","[begin]");return[].map.call(G,function(U){var H=h(U,X);if(!H||!U.hasAttribute("begin"))return null;var V=C(U.getAttribute("begin"),F),ce=C(U.getAttribute("dur"),F),ye=C(U.getAttribute("end"),F);if(V===null)throw m(U);if(ye===null){if(ce===null)throw m(U);ye=V+ce}var Le=new f.default(V-w,ye-w,H);Le.id=Object(p.generateCueId)(Le.startTime,Le.endTime,Le.text);var Ze=N[U.getAttribute("region")],Ye=W[U.getAttribute("style")];Le.position=10,Le.size=80;var Oe=d(Ze,Ye),We=Oe.textAlign;if(We){var ze=l[We];ze&&(Le.lineAlign=ze),Le.align=We}return c(Le,Oe),Le}).filter(function(U){return U!==null})}function i(E,w,A){var g=E.getElementsByTagName(w)[0];return g?[].slice.call(g.querySelectorAll(A)):[]}function r(E){return E.reduce(function(w,A){var g=A.getAttribute("xml:id");return g&&(w[g]=A),w},{})}function h(E,w){return[].slice.call(E.childNodes).reduce(function(A,g,P){var O;return g.nodeName==="br"&&P?A+`
`:(O=g.childNodes)!==null&&O!==void 0&&O.length?h(g,w):w?A+g.textContent.trim().replace(/\s+/g," "):A+g.textContent},"")}function d(E,w){var A="http://www.w3.org/ns/ttml#styling",g=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return g.reduce(function(P,O){var F=y(w,A,O)||y(E,A,O);return F&&(P[O]=F),P},{})}function y(E,w,A){return E.hasAttributeNS(w,A)?E.getAttributeNS(w,A):null}function m(E){return new Error("Could not parse ttml timestamp "+E)}function C(E,w){if(!E)return null;var A=Object(M.parseTimeStamp)(E);return A===null&&(u.test(E)?A=T(E,w):s.test(E)&&(A=x(E,w))),A}function T(E,w){var A=u.exec(E),g=(A[4]|0)+(A[5]|0)/w.subFrameRate;return(A[1]|0)*3600+(A[2]|0)*60+(A[3]|0)+g/w.frameRate}function x(E,w){var A=s.exec(E),g=Number(A[1]),P=A[2];switch(P){case"h":return g*3600;case"m":return g*60;case"ms":return g*1e3;case"f":return g/w.frameRate;case"t":return g/w.tickRate}return g}},"./src/utils/logger.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"enableLogs",function(){return p}),D.d(L,"logger",function(){return c});var k=function(){},M={trace:k,debug:k,log:k,warn:k,info:k,error:k},f=M;function S(o){var u=self.console[o];return u?u.bind(self.console,"["+o+"] >"):k}function _(o){for(var u=arguments.length,s=new Array(u>1?u-1:0),l=1;l<u;l++)s[l-1]=arguments[l];s.forEach(function(t){f[t]=o[t]?o[t].bind(o):S(t)})}function p(o){if(self.console&&o===!0||typeof o=="object"){_(o,"debug","log","info","warn","error");try{f.log()}catch(u){f=M}}else f=M}var c=f},"./src/utils/mediakeys-helper.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"KeySystems",function(){return k}),D.d(L,"requestMediaKeySystemAccess",function(){return M});var k;(function(f){f.WIDEVINE="com.widevine.alpha",f.PLAYREADY="com.microsoft.playready"})(k||(k={}));var M=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"getMediaSource",function(){return k});function k(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"bin2str",function(){return _}),D.d(L,"readUint16",function(){return p}),D.d(L,"readUint32",function(){return c}),D.d(L,"writeUint32",function(){return o}),D.d(L,"findBox",function(){return u}),D.d(L,"parseSegmentIndex",function(){return s}),D.d(L,"parseInitSegment",function(){return l}),D.d(L,"getStartDTS",function(){return t}),D.d(L,"getDuration",function(){return a}),D.d(L,"computeRawDurationFromSamples",function(){return i}),D.d(L,"offsetStartDTS",function(){return r}),D.d(L,"segmentValidRange",function(){return h}),D.d(L,"appendUint8Array",function(){return d});var k=D("./src/utils/typed-array.ts"),M=D("./src/loader/fragment.ts"),f=Math.pow(2,32)-1,S=[].push;function _(y){return String.fromCharCode.apply(null,y)}function p(y,m){"data"in y&&(m+=y.start,y=y.data);var C=y[m]<<8|y[m+1];return C<0?65536+C:C}function c(y,m){"data"in y&&(m+=y.start,y=y.data);var C=y[m]<<24|y[m+1]<<16|y[m+2]<<8|y[m+3];return C<0?4294967296+C:C}function o(y,m,C){"data"in y&&(m+=y.start,y=y.data),y[m]=C>>24,y[m+1]=C>>16&255,y[m+2]=C>>8&255,y[m+3]=C&255}function u(y,m){var C=[];if(!m.length)return C;var T,x,E;"data"in y?(T=y.data,x=y.start,E=y.end):(T=y,x=0,E=T.byteLength);for(var w=x;w<E;){var A=c(T,w),g=_(T.subarray(w+4,w+8)),P=A>1?w+A:E;if(g===m[0])if(m.length===1)C.push({data:T,start:w+8,end:P});else{var O=u({data:T,start:w+8,end:P},m.slice(1));O.length&&S.apply(C,O)}w=P}return C}function s(y){var m=u(y,["moov"]),C=m[0],T=C?C.end:null,x=u(y,["sidx"]);if(!x||!x[0])return null;var E=[],w=x[0],A=w.data[0],g=A===0?8:16,P=c(w,g);g+=4;var O=0,F=0;A===0?g+=8:g+=16,g+=2;var X=w.end+F,W=p(w,g);g+=2;for(var N=0;N<W;N++){var G=g,U=c(w,G);G+=4;var H=U&2147483647,V=(U&2147483648)>>>31;if(V===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ce=c(w,G);G+=4,E.push({referenceSize:H,subsegmentDuration:ce,info:{duration:ce/P,start:X,end:X+H-1}}),X+=H,G+=4,g=G}return{earliestPresentationTime:O,timescale:P,version:A,referencesCount:W,references:E,moovEndOffset:T}}function l(y){for(var m=[],C=u(y,["moov","trak"]),T=0;T<C.length;T++){var x=C[T],E=u(x,["tkhd"])[0];if(E){var w=E.data[E.start],A=w===0?12:20,g=c(E,A),P=u(x,["mdia","mdhd"])[0];if(P){w=P.data[P.start],A=w===0?12:20;var O=c(P,A),F=u(x,["mdia","hdlr"])[0];if(F){var X=_(F.data.subarray(F.start+8,F.start+12)),W={soun:M.ElementaryStreamTypes.AUDIO,vide:M.ElementaryStreamTypes.VIDEO}[X];if(W){var N=u(x,["mdia","minf","stbl","stsd"])[0],G=void 0;N&&(G=_(N.data.subarray(N.start+12,N.start+16))),m[g]={timescale:O,type:W},m[W]={timescale:O,id:g,codec:G}}}}}}var U=u(y,["moov","mvex","trex"]);return U.forEach(function(H){var V=c(H,4),ce=m[V];ce&&(ce.default={duration:c(H,12),flags:c(H,20)})}),m}function t(y,m){return u(m,["moof","traf"]).reduce(function(C,T){var x=u(T,["tfdt"])[0],E=x.data[x.start],w=u(T,["tfhd"]).reduce(function(A,g){var P=c(g,4),O=y[P];if(O){var F=c(x,4);E===1&&(F*=Math.pow(2,32),F+=c(x,8));var X=O.timescale||9e4,W=F/X;if(isFinite(W)&&(A===null||W<A))return W}return A},null);return w!==null&&isFinite(w)&&(C===null||w<C)?w:C},null)||0}function a(y,m){for(var C=0,T=0,x=0,E=u(y,["moof","traf"]),w=0;w<E.length;w++){var A=E[w],g=u(A,["tfhd"])[0],P=c(g,4),O=m[P];if(!O)continue;var F=O.default,X=c(g,0)|(F==null?void 0:F.flags),W=F==null?void 0:F.duration;X&8&&(X&2?W=c(g,12):W=c(g,8));for(var N=O.timescale||9e4,G=u(A,["trun"]),U=0;U<G.length;U++){if(W){var H=c(G[U],4);C=W*H}else C=i(G[U]);O.type===M.ElementaryStreamTypes.VIDEO?T+=C/N:O.type===M.ElementaryStreamTypes.AUDIO&&(x+=C/N)}}if(T===0&&x===0){var V=s(y);if(V!=null&&V.references)return V.references.reduce(function(ce,ye){return ce+ye.info.duration||0},0)}return T||x}function i(y){var m=c(y,0),C=8;m&1&&(C+=4),m&4&&(C+=4);for(var T=0,x=c(y,4),E=0;E<x;E++){if(m&256){var w=c(y,C);T+=w,C+=4}m&512&&(C+=4),m&1024&&(C+=4),m&2048&&(C+=4)}return T}function r(y,m,C){u(m,["moof","traf"]).forEach(function(T){u(T,["tfhd"]).forEach(function(x){var E=c(x,4),w=y[E];if(!w)return;var A=w.timescale||9e4;u(T,["tfdt"]).forEach(function(g){var P=g.data[g.start],O=c(g,4);if(P===0)o(g,4,O-C*A);else{O*=Math.pow(2,32),O+=c(g,8),O-=C*A,O=Math.max(O,0);var F=Math.floor(O/(f+1)),X=Math.floor(O%(f+1));o(g,4,F),o(g,8,X)}})})})}function h(y){var m={valid:null,remainder:null},C=u(y,["moof"]);if(C){if(C.length<2)return m.remainder=y,m}else return m;var T=C[C.length-1];return m.valid=Object(k.sliceUint8)(y,0,T.start-8),m.remainder=Object(k.sliceUint8)(y,T.start-8),m}function d(y,m){var C=new Uint8Array(y.length+m.length);return C.set(y),C.set(m,y.length),C}},"./src/utils/output-filter.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"default",function(){return k});var k=function(){function M(S,_){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=S,this.trackName=_}var f=M.prototype;return f.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},f.newCue=function(_,p,c){(this.startTime===null||this.startTime>_)&&(this.startTime=_),this.endTime=p,this.screen=c,this.timelineController.createCaptionsTrack(this.trackName)},f.reset=function(){this.cueRanges=[]},M}()},"./src/utils/texttrack-utils.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"sendAddTrackEvent",function(){return M}),D.d(L,"addCueToTrack",function(){return f}),D.d(L,"clearCurrentCues",function(){return S}),D.d(L,"removeCuesInRange",function(){return _}),D.d(L,"getCuesInRange",function(){return c});var k=D("./src/utils/logger.ts");function M(o,u){var s;try{s=new Event("addtrack")}catch(l){s=document.createEvent("Event"),s.initEvent("addtrack",!1,!1)}s.track=o,u.dispatchEvent(s)}function f(o,u){var s=o.mode;if(s==="disabled"&&(o.mode="hidden"),o.cues&&!o.cues.getCueById(u.id))try{if(o.addCue(u),!o.cues.getCueById(u.id))throw new Error("addCue is failed for: "+u)}catch(t){k.logger.debug("[texttrack-utils]: "+t);var l=new self.TextTrackCue(u.startTime,u.endTime,u.text);l.id=u.id,o.addCue(l)}s==="disabled"&&(o.mode=s)}function S(o){var u=o.mode;if(u==="disabled"&&(o.mode="hidden"),o.cues)for(var s=o.cues.length;s--;)o.removeCue(o.cues[s]);u==="disabled"&&(o.mode=u)}function _(o,u,s){var l=o.mode;if(l==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0)for(var t=c(o.cues,u,s),a=0;a<t.length;a++)o.removeCue(t[a]);l==="disabled"&&(o.mode=l)}function p(o,u){if(u<o[0].startTime)return 0;var s=o.length-1;if(u>o[s].endTime)return-1;for(var l=0,t=s;l<=t;){var a=Math.floor((t+l)/2);if(u<o[a].startTime)t=a-1;else if(u>o[a].startTime&&l<s)l=a+1;else return a}return o[l].startTime-u<u-o[t].startTime?l:t}function c(o,u,s){var l=[],t=p(o,u);if(t>-1)for(var a=t,i=o.length;a<i;a++){var r=o[a];if(r.startTime>=u&&r.endTime<=s)l.push(r);else if(r.startTime>s)return l}return l}},"./src/utils/time-ranges.ts":function(z,L,D){"use strict";D.r(L);var k={toString:function(f){for(var S="",_=f.length,p=0;p<_;p++)S+="["+f.start(p).toFixed(3)+","+f.end(p).toFixed(3)+"]";return S}};L.default=k},"./src/utils/timescale-conversion.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"toTimescaleFromBase",function(){return M}),D.d(L,"toTimescaleFromScale",function(){return f}),D.d(L,"toMsFromMpegTsClock",function(){return S}),D.d(L,"toMpegTsClockFromTimescale",function(){return _});var k=9e4;function M(p,c,o,u){o===void 0&&(o=1),u===void 0&&(u=!1);var s=p*c*o;return u?Math.round(s):s}function f(p,c,o,u){return o===void 0&&(o=1),u===void 0&&(u=!1),M(p,c,1/o,u)}function S(p,c){return c===void 0&&(c=!1),M(p,1e3,1/k,c)}function _(p,c){return c===void 0&&(c=1),M(p,k,1/c)}},"./src/utils/typed-array.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"sliceUint8",function(){return k});function k(M,f,S){return Uint8Array.prototype.slice?M.slice(f,S):new Uint8Array(Array.prototype.slice.call(M,f,S))}},"./src/utils/vttcue.ts":function(z,L,D){"use strict";D.r(L),L.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var k=["","lr","rl"],M=["start","middle","end","left","right"];function f(o,u){if(typeof u!="string")return!1;if(!Array.isArray(o))return!1;var s=u.toLowerCase();return~o.indexOf(s)?s:!1}function S(o){return f(k,o)}function _(o){return f(M,o)}function p(o){for(var u=arguments.length,s=new Array(u>1?u-1:0),l=1;l<u;l++)s[l-1]=arguments[l];for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var i in a)o[i]=a[i]}return o}function c(o,u,s){var l=this,t={enumerable:!0};l.hasBeenReset=!1;var a="",i=!1,r=o,h=u,d=s,y=null,m="",C=!0,T="auto",x="start",E=50,w="middle",A=50,g="middle";Object.defineProperty(l,"id",p({},t,{get:function(){return a},set:function(O){a=""+O}})),Object.defineProperty(l,"pauseOnExit",p({},t,{get:function(){return i},set:function(O){i=!!O}})),Object.defineProperty(l,"startTime",p({},t,{get:function(){return r},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");r=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"endTime",p({},t,{get:function(){return h},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");h=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"text",p({},t,{get:function(){return d},set:function(O){d=""+O,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",p({},t,{get:function(){return y},set:function(O){y=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",p({},t,{get:function(){return m},set:function(O){var F=S(O);if(F===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=F,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",p({},t,{get:function(){return C},set:function(O){C=!!O,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",p({},t,{get:function(){return T},set:function(O){if(typeof O!="number"&&O!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");T=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",p({},t,{get:function(){return x},set:function(O){var F=_(O);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");x=F,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",p({},t,{get:function(){return E},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");E=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",p({},t,{get:function(){return w},set:function(O){var F=_(O);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");w=F,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",p({},t,{get:function(){return A},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");A=O,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",p({},t,{get:function(){return g},set:function(O){var F=_(O);if(!F)throw new SyntaxError("An invalid or illegal string was specified.");g=F,this.hasBeenReset=!0}})),l.displayState=void 0}return c.prototype.getCueAsHTML=function(){var o=self.WebVTT;return o.convertCueToDOMTree(self,this.text)},c}()},"./src/utils/vttparser.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"parseTimeStamp",function(){return f}),D.d(L,"fixLineBreaks",function(){return u}),D.d(L,"VTTParser",function(){return s});var k=D("./src/utils/vttcue.ts"),M=function(){function l(){}var t=l.prototype;return t.decode=function(i,r){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))},l}();function f(l){function t(i,r,h,d){return(i|0)*3600+(r|0)*60+(h|0)+parseFloat(d||0)}var a=l.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return a?parseFloat(a[2])>59?t(a[2],a[3],0,a[4]):t(a[1],a[2],a[3],a[4]):null}var S=function(){function l(){this.values=Object.create(null)}var t=l.prototype;return t.set=function(i,r){!this.get(i)&&r!==""&&(this.values[i]=r)},t.get=function(i,r,h){return h?this.has(i)?this.values[i]:r[h]:this.has(i)?this.values[i]:r},t.has=function(i){return i in this.values},t.alt=function(i,r,h){for(var d=0;d<h.length;++d)if(r===h[d]){this.set(i,r);break}},t.integer=function(i,r){/^-?\d+$/.test(r)&&this.set(i,parseInt(r,10))},t.percent=function(i,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){var h=parseFloat(r);if(h>=0&&h<=100)return this.set(i,h),!0}return!1},l}();function _(l,t,a,i){var r=i?l.split(i):[l];for(var h in r){if(typeof r[h]!="string")continue;var d=r[h].split(a);if(d.length!==2)continue;var y=d[0],m=d[1];t(y,m)}}var p=new k.default(0,0,""),c=p.align==="middle"?"middle":"center";function o(l,t,a){var i=l;function r(){var y=f(l);if(y===null)throw new Error("Malformed timestamp: "+i);return l=l.replace(/^[^\sa-zA-Z-]+/,""),y}function h(y,m){var C=new S;_(y,function(E,w){var A;switch(E){case"region":for(var g=a.length-1;g>=0;g--)if(a[g].id===w){C.set(E,a[g].region);break}break;case"vertical":C.alt(E,w,["rl","lr"]);break;case"line":A=w.split(","),C.integer(E,A[0]),C.percent(E,A[0])&&C.set("snapToLines",!1),C.alt(E,A[0],["auto"]),A.length===2&&C.alt("lineAlign",A[1],["start",c,"end"]);break;case"position":A=w.split(","),C.percent(E,A[0]),A.length===2&&C.alt("positionAlign",A[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":C.percent(E,w);break;case"align":C.alt(E,w,["start",c,"end","left","right"]);break}},/:/,/\s/),m.region=C.get("region",null),m.vertical=C.get("vertical","");var T=C.get("line","auto");T==="auto"&&p.line===-1&&(T=-1),m.line=T,m.lineAlign=C.get("lineAlign","start"),m.snapToLines=C.get("snapToLines",!0),m.size=C.get("size",100),m.align=C.get("align",c);var x=C.get("position","auto");x==="auto"&&p.position===50&&(x=m.align==="start"||m.align==="left"?0:m.align==="end"||m.align==="right"?100:50),m.position=x}function d(){l=l.replace(/^\s+/,"")}if(d(),t.startTime=r(),d(),l.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);l=l.substr(3),d(),t.endTime=r(),d(),h(l,t)}function u(l){return l.replace(/<br(?: \/)?>/gi,`
`)}var s=function(){function l(){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 t=l.prototype;return t.parse=function(i){var r=this;i&&(r.buffer+=r.decoder.decode(i,{stream:!0}));function h(){var x=r.buffer,E=0;for(x=u(x);E<x.length&&x[E]!=="\r"&&x[E]!==`
`;)++E;var w=x.substr(0,E);return x[E]==="\r"&&++E,x[E]===`
`&&++E,r.buffer=x.substr(E),w}function d(x){_(x,function(E,w){},/:/)}try{var y="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;y=h();var m=y.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}for(var C=!1;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;C?C=!1:y=h();switch(r.state){case"HEADER":/:/.test(y)?d(y):y||(r.state="ID");continue;case"NOTE":y||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(y)){r.state="NOTE";break}if(!y)continue;if(r.cue=new k.default(0,0,""),r.state="CUE",y.indexOf("-->")===-1){r.cue.id=y;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{o(y,r.cue,r.regionList)}catch(x){r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{var T=y.indexOf("-->")!==-1;if(!y||T&&(C=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
`),r.cue.text+=y}continue;case"BADCUE":y||(r.state="ID")}}}catch(x){r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},t.flush=function(){var i=this;try{if((i.cue||i.state==="HEADER")&&(i.buffer+=`
`,i.parse()),i.state==="INITIAL"||i.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){i.onparsingerror&&i.onparsingerror(r)}return i.onflush&&i.onflush(),this},l}()},"./src/utils/webvtt-parser.ts":function(z,L,D){"use strict";D.r(L),D.d(L,"generateCueId",function(){return s}),D.d(L,"parseWebVTT",function(){return t});var k=D("./src/polyfills/number.ts"),M=D("./src/utils/vttparser.ts"),f=D("./src/demux/id3.ts"),S=D("./src/utils/timescale-conversion.ts"),_=D("./src/remux/mp4-remuxer.ts"),p=/\r\n|\n\r|\n|\r/g,c=function(i,r,h){return h===void 0&&(h=0),i.substr(h,r.length)===r},o=function(i){var r=parseInt(i.substr(-3)),h=parseInt(i.substr(-6,2)),d=parseInt(i.substr(-9,2)),y=i.length>9?parseInt(i.substr(0,i.indexOf(":"))):0;if(!Object(k.isFiniteNumber)(r)||!Object(k.isFiniteNumber)(h)||!Object(k.isFiniteNumber)(d)||!Object(k.isFiniteNumber)(y))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+i);return r+=1e3*h,r+=60*1e3*d,r+=60*60*1e3*y,r},u=function(i){for(var r=5381,h=i.length;h;)r=r*33^i.charCodeAt(--h);return(r>>>0).toString()};function s(a,i,r){return u(a.toString())+u(i.toString())+u(r)}var l=function(i,r,h){var d=i[r],y=i[d.prevCC];if(!y||!y.new&&d.new){i.ccOffset=i.presentationOffset=d.start,d.new=!1;return}for(;(m=y)!==null&&m!==void 0&&m.new;){var m;i.ccOffset+=d.start-y.start,d.new=!1,d=y,y=i[d.prevCC]}i.presentationOffset=h};function t(a,i,r,h,d,y,m,C){var T=new M.VTTParser,x=Object(f.utf8ArrayToStr)(new Uint8Array(a)).trim().replace(p,`
`).split(`
`),E=[],w=Object(S.toMpegTsClockFromTimescale)(i,r),A="00:00.000",g=0,P=0,O,F=!0,X=!1;T.oncue=function(W){var N=h[d],G=h.ccOffset,U=(g-w)/9e4;if(N!=null&&N.new&&(P!==void 0?G=h.ccOffset=N.start:l(h,d,U)),U&&(G=U-h.presentationOffset),X){var H=W.endTime-W.startTime,V=Object(_.normalizePts)((W.startTime+G-P)*9e4,y*9e4)/9e4;W.startTime=V,W.endTime=V+H}var ce=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ce)),W.id||(W.id=s(W.startTime,W.endTime,ce)),W.endTime>0&&E.push(W)},T.onparsingerror=function(W){O=W},T.onflush=function(){if(O){C(O);return}m(E)},x.forEach(function(W){if(F)if(c(W,"X-TIMESTAMP-MAP=")){F=!1,X=!0,W.substr(16).split(",").forEach(function(N){c(N,"LOCAL:")?A=N.substr(6):c(N,"MPEGTS:")&&(g=parseInt(N.substr(7)))});try{P=o(A)/1e3}catch(N){X=!1,O=N}return}else W===""&&(F=!1);T.parse(W+`
`)}),T.flush()}},"./src/utils/xhr-loader.ts":function(z,L,D){"use strict";D.r(L);var k=D("./src/utils/logger.ts"),M=D("./src/loader/load-stats.ts"),f=/^age:\s*[\d.]+\s*$/m,S=function(){function _(c){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=c?c.xhrSetup:null,this.stats=new M.LoadStats,this.retryDelay=0}var p=_.prototype;return p.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},p.abortInternal=function(){var o=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),o&&(o.onreadystatechange=null,o.onprogress=null,o.readyState!==4&&(this.stats.aborted=!0,o.abort()))},p.abort=function(){var o;this.abortInternal(),(o=this.callbacks)!==null&&o!==void 0&&o.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},p.load=function(o,u,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=o,this.config=u,this.callbacks=s,this.retryDelay=u.retryDelay,this.loadInternal()},p.loadInternal=function(){var o=this.config,u=this.context;if(!o)return;var s=this.loader=new self.XMLHttpRequest,l=this.stats;l.loading.first=0,l.loaded=0;var t=this.xhrSetup;try{if(t)try{t(s,u.url)}catch(r){s.open("GET",u.url,!0),t(s,u.url)}s.readyState||s.open("GET",u.url,!0);var a=this.context.headers;if(a)for(var i in a)s.setRequestHeader(i,a[i])}catch(r){this.callbacks.onError({code:s.status,text:r.message},u,s);return}u.rangeEnd&&s.setRequestHeader("Range","bytes="+u.rangeStart+"-"+(u.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=u.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout),s.send()},p.readystatechange=function(){var o=this.context,u=this.loader,s=this.stats;if(!o||!u)return;var l=u.readyState,t=this.config;if(s.aborted)return;if(l>=2)if(self.clearTimeout(this.requestTimeout),s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start)),l===4){u.onreadystatechange=null,u.onprogress=null;var a=u.status;if(a>=200&&a<300){s.loading.end=Math.max(self.performance.now(),s.loading.first);var i,r;if(o.responseType==="arraybuffer"?(i=u.response,r=i.byteLength):(i=u.responseText,r=i.length),s.loaded=s.total=r,!this.callbacks)return;var h=this.callbacks.onProgress;if(h&&h(s,o,i,u),!this.callbacks)return;var d={url:u.responseURL,data:i};this.callbacks.onSuccess(d,s,o,u)}else s.retry>=t.maxRetry||a>=400&&a<499?(k.logger.error(a+" while loading "+o.url),this.callbacks.onError({code:a,text:u.statusText},o,u)):(k.logger.warn(a+" while loading "+o.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,t.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout)},p.loadtimeout=function(){k.logger.warn("timeout while loading "+this.context.url);var o=this.callbacks;o&&(this.abortInternal(),o.onTimeout(this.stats,this.context,this.loader))},p.loadprogress=function(o){var u=this.stats;u.loaded=o.loaded,o.lengthComputable&&(u.total=o.total)},p.getCacheAge=function(){var o=null;if(this.loader&&f.test(this.loader.getAllResponseHeaders())){var u=this.loader.getResponseHeader("age");o=u?parseFloat(u):null}return o},_}();L.default=S}}).default})},vHTk:function(ot,se,ee){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},vewr:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.getPointerEvent=z,se.stopEvent=L,se.setCapture=_,se.releaseCapture=p;function z(c){return c.changedTouches?c.changedTouches[0]:c.touches?c.touches[0]:c}function L(c){c.stopPropagation(),c.preventDefault()}var D=!1,k=null;document.captureElement=null;function M(c){if(D)return;var o=new c.constructor(c.type,c);D=!0,document.captureElement?document.captureElement.dispatchEvent(o):k.dispatchEvent(o),D=!1,c.stopPropagation(),o.defaultPrevented&&c.preventDefault(),c.type==="mouseup"&&p()}function f(){var c=document.getElementById("noVNC_mouse_capture_elem");c.style.cursor=window.getComputedStyle(document.captureElement).cursor}var S=new MutationObserver(f);function _(c){if(c.setCapture)c.setCapture(),document.captureElement=c,c.addEventListener("mouseup",p);else{p();var o=document.getElementById("noVNC_mouse_capture_elem");o===null&&(o=document.createElement("div"),o.id="noVNC_mouse_capture_elem",o.style.position="fixed",o.style.top="0px",o.style.left="0px",o.style.width="100%",o.style.height="100%",o.style.zIndex=1e4,o.style.display="none",document.body.appendChild(o),o.addEventListener("contextmenu",M),o.addEventListener("mousemove",M),o.addEventListener("mouseup",M)),document.captureElement=c,S.observe(c,{attributes:!0}),f(),o.style.display="",window.addEventListener("mousemove",M),window.addEventListener("mouseup",M)}}function p(){if(document.releaseCapture)document.releaseCapture(),document.captureElement=null;else{if(!document.captureElement)return;k=document.captureElement,document.captureElement=null,S.disconnect();var c=document.getElementById("noVNC_mouse_capture_elem");c.style.display="none",window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",M)}}},whVF:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=ee("lNSK"),L=D(ee("1q3G"));function D(_){return _&&_.__esModule?_:{default:_}}function k(_,p){if(!(_ instanceof p))throw new TypeError("Cannot call a class as a function")}function M(_,p){for(var c=0;c<p.length;c++){var o=p[c];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(_,o.key,o)}}function f(_,p,c){return p&&M(_.prototype,p),c&&M(_,c),_}var S=function(){function _(){k(this,_),this.strm=new L.default,this.chunkSize=1024*10*10,this.outputBuffer=new Uint8Array(this.chunkSize),this.windowBits=5,(0,z.deflateInit)(this.strm,this.windowBits)}return f(_,[{key:"deflate",value:function(c){this.strm.input=c,this.strm.avail_in=this.strm.input.length,this.strm.next_in=0,this.strm.output=this.outputBuffer,this.strm.avail_out=this.chunkSize,this.strm.next_out=0;var o=(0,z.deflate)(this.strm,z.Z_FULL_FLUSH),u=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);if(o<0)throw new Error("zlib deflate failed");if(this.strm.avail_in>0){var s=[u],l=u.length;do{if(this.strm.output=new Uint8Array(this.chunkSize),this.strm.next_out=0,this.strm.avail_out=this.chunkSize,o=(0,z.deflate)(this.strm,z.Z_FULL_FLUSH),o<0)throw new Error("zlib deflate failed");var t=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);l+=t.length,s.push(t)}while(this.strm.avail_in>0);for(var a=new Uint8Array(l),i=0,r=0;r<s.length;r++)a.set(s[r],i),i+=s[r].length;u=a}return this.strm.input=null,this.strm.avail_in=0,this.strm.next_in=0,u}}]),_}();se.default=S},xO64:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z=L(ee("8K/p"));function L(t){return t&&t.__esModule?t:{default:t}}function D(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(i){return typeof i}:D=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},D(t)}function k(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function M(t,a){for(var i=0;i<a.length;i++){var r=a[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,a,i){return a&&M(t.prototype,a),i&&M(t,i),t}function S(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(a&&a.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),a&&_(t,a)}function _(t,a){return _=Object.setPrototypeOf||function(r,h){return r.__proto__=h,r},_(t,a)}function p(t){var a=u();return function(){var r=s(t),h;if(a){var d=s(this).constructor;h=Reflect.construct(r,arguments,d)}else h=r.apply(this,arguments);return c(this,h)}}function c(t,a){return a&&(D(a)==="object"||typeof a=="function")?a:o(t)}function o(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(){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(t){return!1}}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},s(t)}var l=function(t){S(i,t);var a=p(i);function i(){return k(this,i),a.apply(this,arguments)}return f(i,[{key:"_pngRect",value:function(h,d,y,m,C,T,x){var E=this._readData(C);return E===null?!1:(T.imageRect(h,d,y,m,"image/png",E),!0)}},{key:"_basicRect",value:function(h,d,y,m,C,T,x,E){throw new Error("BasicCompression received in TightPNG rect")}}]),i}(z.default);se.default=l},xSIq:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=void 0;var z={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};se.default=z},xlC8:function(ot,se,ee){"use strict";Object.defineProperty(se,"__esModule",{value:!0}),se.default=z;function z(L,D,k,M){for(var f=L&65535|0,S=L>>>16&65535|0,_=0;k!==0;){_=k>2e3?2e3:k,k-=_;do f=f+D[M++]|0,S=S+f|0;while(--_);f%=65521,S%=65521}return f|S<<16|0}}}]);