|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[223,5,6,7,17],{"+NIl":function(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){"use strict";j.defineMode("stex",function(k,D){"use strict";function R(l,r){l.cmdState.push(r)}function O(l){return l.cmdState.length>0?l.cmdState[l.cmdState.length-1]:null}function c(l){var r=l.cmdState.pop();r&&r.closeBracket()}function S(l){for(var r=l.cmdState,n=r.length-1;n>=0;n--){var a=r[n];if(a.name=="DEFAULT")continue;return a}return{styleIdentifier:function(){return null}}}function y(l,r,n){return function(){this.name=l,this.bracketNo=0,this.style=r,this.styles=n,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=y("importmodule","tag",["string","builtin"]),p.documentclass=y("documentclass","tag",["","atom"]),p.usepackage=y("usepackage","tag",["atom"]),p.begin=y("begin","tag",["atom"]),p.end=y("end","tag",["atom"]),p.label=y("label","tag",["atom"]),p.ref=y("ref","tag",["atom"]),p.eqref=y("eqref","tag",["atom"]),p.cite=y("cite","tag",["atom"]),p.bibitem=y("bibitem","tag",["atom"]),p.Bibitem=y("Bibitem","tag",["atom"]),p.RBibitem=y("RBibitem","tag",["atom"]),p.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function u(l,r){l.f=r}function o(l,r){var n;if(l.match(/^\\[a-zA-Z@]+/)){var a=l.current().slice(1);return n=p.hasOwnProperty(a)?p[a]:p.DEFAULT,n=new n,R(r,n),u(r,s),n.style}if(l.match(/^\\[$&%#{}_]/))return"tag";if(l.match(/^\\[,;!\/\\]/))return"tag";if(l.match("\\["))return u(r,function(h,f){return d(h,f,"\\]")}),"keyword";if(l.match("\\("))return u(r,function(h,f){return d(h,f,"\\)")}),"keyword";if(l.match("$$"))return u(r,function(h,f){return d(h,f,"$$")}),"keyword";if(l.match("$"))return u(r,function(h,f){return d(h,f,"$")}),"keyword";var i=l.next();if(i=="%")return l.skipToEnd(),"comment";if(i=="}"||i=="]"){if(n=O(r),n)n.closeBracket(i),u(r,s);else return"error";return"bracket"}else return i=="{"||i=="["?(n=p.DEFAULT,n=new n,R(r,n),"bracket"):/\d/.test(i)?(l.eatWhile(/[\w.%]/),"atom"):(l.eatWhile(/[\w\-_]/),n=S(r),n.name=="begin"&&(n.argument=l.current()),n.styleIdentifier())}function d(l,r,n){if(l.eatSpace())return null;if(n&&l.match(n))return u(r,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 a=l.next();return a=="{"||a=="}"||a=="["||a=="]"||a=="("||a==")"?"bracket":a=="%"?(l.skipToEnd(),"comment"):"error"}function s(l,r){var n=l.peek(),a;return n=="{"||n=="["?(a=O(r),a.openBracket(n),l.eat(n),u(r,o),"bracket"):/[ \t\r]/.test(n)?(l.eat(n),null):(u(r,o),c(r),o(l,r))}return{startState:function(){var l=D.inMathMode?function(r,n){return d(r,n)}:o;return{cmdState:[],f:l}},copyState:function(l){return{cmdState:l.cmdState.slice(),f:l.f}},token:function(l,r){return r.f(l,r)},blankLine:function(l){l.f=o,l.cmdState.length=0},lineComment:"%"}}),j.defineMIME("text/x-stex","stex"),j.defineMIME("text/x-latex","stex")})},"/POA":function(Ze,ce,ie){!function(j,k){if(!0)Ze.exports=k();else var D,R}(window,function(){return function(j){var k={};function D(R){if(k[R])return k[R].exports;var O=k[R]={i:R,l:!1,exports:{}};return j[R].call(O.exports,O,O.exports,D),O.l=!0,O.exports}return D.m=j,D.c=k,D.d=function(R,O,c){D.o(R,O)||Object.defineProperty(R,O,{enumerable:!0,get:c})},D.r=function(R){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(R,"__esModule",{value:!0})},D.t=function(R,O){if(1&O&&(R=D(R)),8&O)return R;if(4&O&&typeof R=="object"&&R&&R.__esModule)return R;var c=Object.create(null);if(D.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:R}),2&O&&typeof R!="string")for(var S in R)D.d(c,S,function(y){return R[y]}.bind(null,S));return c},D.n=function(R){var O=R&&R.__esModule?function(){return R.default}:function(){return R};return D.d(O,"a",O),O},D.o=function(R,O){return Object.prototype.hasOwnProperty.call(R,O)},D.p="",D(D.s=34)}([function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.forwardEvent=k.EventEmitter=void 0;var R=function(){function O(){this._listeners=[],this._disposed=!1}return Object.defineProperty(O.prototype,"event",{get:function(){var c=this;return this._event||(this._event=function(S){return c._listeners.push(S),{dispose:function(){if(!c._disposed){for(var y=0;y<c._listeners.length;y++)if(c._listeners[y]===S)return void c._listeners.splice(y,1)}}}}),this._event},enumerable:!1,configurable:!0}),O.prototype.fire=function(c,S){for(var y=[],p=0;p<this._listeners.length;p++)y.push(this._listeners[p]);for(p=0;p<y.length;p++)y[p].call(void 0,c,S)},O.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},O}();k.EventEmitter=R,k.forwardEvent=function(O,c){return O(function(S){return c.fire(S)})}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.IUnicodeService=k.IOptionsService=k.ILogService=k.IInstantiationService=k.IDirtyRowService=k.ICharsetService=k.ICoreService=k.ICoreMouseService=k.IBufferService=void 0;var R=D(14);k.IBufferService=R.createDecorator("BufferService"),k.ICoreMouseService=R.createDecorator("CoreMouseService"),k.ICoreService=R.createDecorator("CoreService"),k.ICharsetService=R.createDecorator("CharsetService"),k.IDirtyRowService=R.createDecorator("DirtyRowService"),k.IInstantiationService=R.createDecorator("InstantiationService"),k.ILogService=R.createDecorator("LogService"),k.IOptionsService=R.createDecorator("OptionsService"),k.IUnicodeService=R.createDecorator("UnicodeService")},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.getDisposeArrayDisposable=k.disposeArray=k.Disposable=void 0;var R=function(){function c(){this._disposables=[],this._isDisposed=!1}return c.prototype.dispose=function(){this._isDisposed=!0;for(var S=0,y=this._disposables;S<y.length;S++)y[S].dispose();this._disposables.length=0},c.prototype.register=function(S){return this._disposables.push(S),S},c.prototype.unregister=function(S){var y=this._disposables.indexOf(S);y!==-1&&this._disposables.splice(y,1)},c}();function O(c){for(var S=0,y=c;S<y.length;S++)y[S].dispose();c.length=0}k.Disposable=R,k.disposeArray=O,k.getDisposeArrayDisposable=function(c){return{dispose:function(){return O(c)}}}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.WHITESPACE_CELL_CODE=k.WHITESPACE_CELL_WIDTH=k.WHITESPACE_CELL_CHAR=k.NULL_CELL_CODE=k.NULL_CELL_WIDTH=k.NULL_CELL_CHAR=k.CHAR_DATA_CODE_INDEX=k.CHAR_DATA_WIDTH_INDEX=k.CHAR_DATA_CHAR_INDEX=k.CHAR_DATA_ATTR_INDEX=k.DEFAULT_ATTR=k.DEFAULT_COLOR=void 0,k.DEFAULT_COLOR=256,k.DEFAULT_ATTR=256|k.DEFAULT_COLOR<<9,k.CHAR_DATA_ATTR_INDEX=0,k.CHAR_DATA_CHAR_INDEX=1,k.CHAR_DATA_WIDTH_INDEX=2,k.CHAR_DATA_CODE_INDEX=3,k.NULL_CELL_CHAR="",k.NULL_CELL_WIDTH=1,k.NULL_CELL_CODE=0,k.WHITESPACE_CELL_CHAR=" ",k.WHITESPACE_CELL_WIDTH=1,k.WHITESPACE_CELL_CODE=32},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(u,o){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,s){d.__proto__=s}||function(d,s){for(var l in s)s.hasOwnProperty(l)&&(d[l]=s[l])})(u,o)},function(u,o){function d(){this.constructor=u}R(u,o),u.prototype=o===null?Object.create(o):(d.prototype=o.prototype,new d)});Object.defineProperty(k,"__esModule",{value:!0}),k.CellData=void 0;var c=D(8),S=D(3),y=D(6),p=function(u){function o(){var d=u!==null&&u.apply(this,arguments)||this;return d.content=0,d.fg=0,d.bg=0,d.extended=new y.ExtendedAttrs,d.combinedData="",d}return O(o,u),o.fromCharData=function(d){var s=new o;return s.setFromCharData(d),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?c.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(d){this.fg=d[S.CHAR_DATA_ATTR_INDEX],this.bg=0;var s=!1;if(d[S.CHAR_DATA_CHAR_INDEX].length>2)s=!0;else if(d[S.CHAR_DATA_CHAR_INDEX].length===2){var l=d[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=l&&l<=56319){var r=d[S.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(l-55296)+r-56320+65536|d[S.CHAR_DATA_WIDTH_INDEX]<<22:s=!0}else s=!0}else this.content=d[S.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|d[S.CHAR_DATA_WIDTH_INDEX]<<22;s&&(this.combinedData=d[S.CHAR_DATA_CHAR_INDEX],this.content=2097152|d[S.CHAR_DATA_WIDTH_INDEX]<<22)},o.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},o}(y.AttributeData);k.CellData=p},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.ISoundService=k.ISelectionService=k.IRenderService=k.IMouseService=k.ICoreBrowserService=k.ICharSizeService=void 0;var R=D(14);k.ICharSizeService=R.createDecorator("CharSizeService"),k.ICoreBrowserService=R.createDecorator("CoreBrowserService"),k.IMouseService=R.createDecorator("MouseService"),k.IRenderService=R.createDecorator("RenderService"),k.ISelectionService=R.createDecorator("SelectionService"),k.ISoundService=R.createDecorator("SoundService")},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.ExtendedAttrs=k.AttributeData=void 0;var R=function(){function c(){this.fg=0,this.bg=0,this.extended=new O}return c.toColorRGB=function(S){return[S>>>16&255,S>>>8&255,255&S]},c.fromColorRGB=function(S){return(255&S[0])<<16|(255&S[1])<<8|255&S[2]},c.prototype.clone=function(){var S=new c;return S.fg=this.fg,S.bg=this.bg,S.extended=this.extended.clone(),S},c.prototype.isInverse=function(){return 67108864&this.fg},c.prototype.isBold=function(){return 134217728&this.fg},c.prototype.isUnderline=function(){return 268435456&this.fg},c.prototype.isBlink=function(){return 536870912&this.fg},c.prototype.isInvisible=function(){return 1073741824&this.fg},c.prototype.isItalic=function(){return 67108864&this.bg},c.prototype.isDim=function(){return 134217728&this.bg},c.prototype.getFgColorMode=function(){return 50331648&this.fg},c.prototype.getBgColorMode=function(){return 50331648&this.bg},c.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},c.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},c.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},c.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},c.prototype.isFgDefault=function(){return(50331648&this.fg)==0},c.prototype.isBgDefault=function(){return(50331648&this.bg)==0},c.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},c.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},c.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},c.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},c.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},c.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()},c.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},c.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},c.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},c.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},c.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},c}();k.AttributeData=R;var O=function(){function c(S,y){S===void 0&&(S=0),y===void 0&&(y=-1),this.underlineStyle=S,this.underlineColor=y}return c.prototype.clone=function(){return new c(this.underlineStyle,this.underlineColor)},c.prototype.isEmpty=function(){return this.underlineStyle===0},c}();k.ExtendedAttrs=O},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.addDisposableDomListener=void 0,k.addDisposableDomListener=function(R,O,c,S){R.addEventListener(O,c,S);var y=!1;return{dispose:function(){y||(y=!0,R.removeEventListener(O,c,S))}}}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.Utf8ToUtf32=k.StringToUtf32=k.utf32ToString=k.stringFromCodePoint=void 0,k.stringFromCodePoint=function(c){return c>65535?(c-=65536,String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):String.fromCharCode(c)},k.utf32ToString=function(c,S,y){S===void 0&&(S=0),y===void 0&&(y=c.length);for(var p="",u=S;u<y;++u){var o=c[u];o>65535?(o-=65536,p+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):p+=String.fromCharCode(o)}return p};var R=function(){function c(){this._interim=0}return c.prototype.clear=function(){this._interim=0},c.prototype.decode=function(S,y){var p=S.length;if(!p)return 0;var u=0,o=0;this._interim&&(56320<=(l=S.charCodeAt(o++))&&l<=57343?y[u++]=1024*(this._interim-55296)+l-56320+65536:(y[u++]=this._interim,y[u++]=l),this._interim=0);for(var d=o;d<p;++d){var s=S.charCodeAt(d);if(55296<=s&&s<=56319){if(++d>=p)return this._interim=s,u;var l;56320<=(l=S.charCodeAt(d))&&l<=57343?y[u++]=1024*(s-55296)+l-56320+65536:(y[u++]=s,y[u++]=l)}else y[u++]=s}return u},c}();k.StringToUtf32=R;var O=function(){function c(){this.interim=new Uint8Array(3)}return c.prototype.clear=function(){this.interim.fill(0)},c.prototype.decode=function(S,y){var p=S.length;if(!p)return 0;var u,o,d,s,l=0,r=0,n=0;if(this.interim[0]){var a=!1,i=this.interim[0];i&=(224&i)==192?31:(240&i)==224?15:7;for(var h=0,f=void 0;(f=63&this.interim[++h])&&h<4;)i<<=6,i|=f;for(var w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=w-h;n<m;){if(n>=p)return 0;if((192&(f=S[n++]))!=128){n--,a=!0;break}this.interim[h++]=f,i<<=6,i|=63&f}a||(w===2?i<128?n--:y[l++]=i:w===3?i<2048||i>=55296&&i<=57343||(y[l++]=i):i<65536||i>1114111||(y[l++]=i)),this.interim.fill(0)}for(var T=p-4,C=n;C<p;){for(;!(!(C<T)||128&(u=S[C])||128&(o=S[C+1])||128&(d=S[C+2])||128&(s=S[C+3]));)y[l++]=u,y[l++]=o,y[l++]=d,y[l++]=s,C+=4;if((u=S[C++])<128)y[l++]=u;else if((224&u)==192){if(C>=p)return this.interim[0]=u,l;if((192&(o=S[C++]))!=128){C--;continue}if((r=(31&u)<<6|63&o)<128){C--;continue}y[l++]=r}else if((240&u)==224){if(C>=p)return this.interim[0]=u,l;if((192&(o=S[C++]))!=128){C--;continue}if(C>=p)return this.interim[0]=u,this.interim[1]=o,l;if((192&(d=S[C++]))!=128){C--;continue}if((r=(15&u)<<12|(63&o)<<6|63&d)<2048||r>=55296&&r<=57343)continue;y[l++]=r}else if((248&u)==240){if(C>=p)return this.interim[0]=u,l;if((192&(o=S[C++]))!=128){C--;continue}if(C>=p)return this.interim[0]=u,this.interim[1]=o,l;if((192&(d=S[C++]))!=128){C--;continue}if(C>=p)return this.interim[0]=u,this.interim[1]=o,this.interim[2]=d,l;if((192&(s=S[C++]))!=128){C--;continue}if((r=(7&u)<<18|(63&o)<<12|(63&d)<<6|63&s)<65536||r>1114111)continue;y[l++]=r}}return l},c}();k.Utf8ToUtf32=O},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.CHAR_ATLAS_CELL_SPACING=k.DIM_OPACITY=k.INVERTED_DEFAULT_COLOR=void 0,k.INVERTED_DEFAULT_COLOR=257,k.DIM_OPACITY=.5,k.CHAR_ATLAS_CELL_SPACING=1},function(j,k,D){"use strict";var R,O,c,S;function y(u){var o=u.toString(16);return o.length<2?"0"+o:o}function p(u,o){return u<o?(o+.05)/(u+.05):(u+.05)/(o+.05)}Object.defineProperty(k,"__esModule",{value:!0}),k.contrastRatio=k.toPaddedHex=k.rgba=k.rgb=k.css=k.color=k.channels=void 0,function(u){u.toCss=function(o,d,s,l){return l!==void 0?"#"+y(o)+y(d)+y(s)+y(l):"#"+y(o)+y(d)+y(s)},u.toRgba=function(o,d,s,l){return l===void 0&&(l=255),(o<<24|d<<16|s<<8|l)>>>0}}(R=k.channels||(k.channels={})),(O=k.color||(k.color={})).blend=function(u,o){var d=(255&o.rgba)/255;if(d===1)return{css:o.css,rgba:o.rgba};var s=o.rgba>>24&255,l=o.rgba>>16&255,r=o.rgba>>8&255,n=u.rgba>>24&255,a=u.rgba>>16&255,i=u.rgba>>8&255,h=n+Math.round((s-n)*d),f=a+Math.round((l-a)*d),w=i+Math.round((r-i)*d);return{css:R.toCss(h,f,w),rgba:R.toRgba(h,f,w)}},O.isOpaque=function(u){return(255&u.rgba)==255},O.ensureContrastRatio=function(u,o,d){var s=S.ensureContrastRatio(u.rgba,o.rgba,d);if(s)return S.toColor(s>>24&255,s>>16&255,s>>8&255)},O.opaque=function(u){var o=(255|u.rgba)>>>0,d=S.toChannels(o),s=d[0],l=d[1],r=d[2];return{css:R.toCss(s,l,r),rgba:o}},O.opacity=function(u,o){var d=Math.round(255*o),s=S.toChannels(u.rgba),l=s[0],r=s[1],n=s[2];return{css:R.toCss(l,r,n,d),rgba:R.toRgba(l,r,n,d)}},(k.css||(k.css={})).toColor=function(u){switch(u.length){case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(u){function o(d,s,l){var r=d/255,n=s/255,a=l/255;return .2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.0722*(a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))}u.relativeLuminance=function(d){return o(d>>16&255,d>>8&255,255&d)},u.relativeLuminance2=o}(c=k.rgb||(k.rgb={})),function(u){function o(s,l,r){for(var n=s>>24&255,a=s>>16&255,i=s>>8&255,h=l>>24&255,f=l>>16&255,w=l>>8&255,m=p(c.relativeLuminance2(h,w,f),c.relativeLuminance2(n,a,i));m<r&&(h>0||f>0||w>0);)h-=Math.max(0,Math.ceil(.1*h)),f-=Math.max(0,Math.ceil(.1*f)),w-=Math.max(0,Math.ceil(.1*w)),m=p(c.relativeLuminance2(h,w,f),c.relativeLuminance2(n,a,i));return(h<<24|f<<16|w<<8|255)>>>0}function d(s,l,r){for(var n=s>>24&255,a=s>>16&255,i=s>>8&255,h=l>>24&255,f=l>>16&255,w=l>>8&255,m=p(c.relativeLuminance2(h,w,f),c.relativeLuminance2(n,a,i));m<r&&(h<255||f<255||w<255);)h=Math.min(255,h+Math.ceil(.1*(255-h))),f=Math.min(255,f+Math.ceil(.1*(255-f))),w=Math.min(255,w+Math.ceil(.1*(255-w))),m=p(c.relativeLuminance2(h,w,f),c.relativeLuminance2(n,a,i));return(h<<24|f<<16|w<<8|255)>>>0}u.ensureContrastRatio=function(s,l,r){var n=c.relativeLuminance(s>>8),a=c.relativeLuminance(l>>8);if(p(n,a)<r)return a<n?o(s,l,r):d(s,l,r)},u.reduceLuminance=o,u.increaseLuminance=d,u.toChannels=function(s){return[s>>24&255,s>>16&255,s>>8&255,255&s]},u.toColor=function(s,l,r){return{css:R.toCss(s,l,r),rgba:R.toRgba(s,l,r)}}}(S=k.rgba||(k.rgba={})),k.toPaddedHex=y,k.contrastRatio=p},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.isLinux=k.isWindows=k.isIphone=k.isIpad=k.isMac=k.isSafari=k.isFirefox=void 0;var R=typeof navigator=="undefined",O=R?"node":navigator.userAgent,c=R?"node":navigator.platform;function S(y,p){return y.indexOf(p)>=0}k.isFirefox=!!~O.indexOf("Firefox"),k.isSafari=/^((?!chrome|android).)*safari/i.test(O),k.isMac=S(["Macintosh","MacIntel","MacPPC","Mac68K"],c),k.isIpad=c==="iPad",k.isIphone=c==="iPhone",k.isWindows=S(["Windows","Win16","Win32","WinCE"],c),k.isLinux=c.indexOf("Linux")>=0},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.C1=k.C0=void 0,function(R){R.NUL="\0",R.SOH="",R.STX="",R.ETX="",R.EOT="",R.ENQ="",R.ACK="",R.BEL="\x07",R.BS="\b",R.HT=" ",R.LF=`
|
|
|
`,R.VT="\v",R.FF="\f",R.CR="\r",R.SO="",R.SI="",R.DLE="",R.DC1="",R.DC2="",R.DC3="",R.DC4="",R.NAK="",R.SYN="",R.ETB="",R.CAN="",R.EM="",R.SUB="",R.ESC="",R.FS="",R.GS="",R.RS="",R.US="",R.SP=" ",R.DEL="\x7F"}(k.C0||(k.C0={})),function(R){R.PAD="\x80",R.HOP="\x81",R.BPH="\x82",R.NBH="\x83",R.IND="\x84",R.NEL="\x85",R.SSA="\x86",R.ESA="\x87",R.HTS="\x88",R.HTJ="\x89",R.VTS="\x8A",R.PLD="\x8B",R.PLU="\x8C",R.RI="\x8D",R.SS2="\x8E",R.SS3="\x8F",R.DCS="\x90",R.PU1="\x91",R.PU2="\x92",R.STS="\x93",R.CCH="\x94",R.MW="\x95",R.SPA="\x96",R.EPA="\x97",R.SOS="\x98",R.SGCI="\x99",R.SCI="\x9A",R.CSI="\x9B",R.ST="\x9C",R.OSC="\x9D",R.PM="\x9E",R.APC="\x9F"}(k.C1||(k.C1={}))},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.BaseRenderLayer=void 0;var R=D(3),O=D(9),c=D(25),S=D(6),y=D(28),p=D(10),u=D(17),o=function(){function d(s,l,r,n,a,i,h,f){this._container=s,this._alpha=n,this._colors=a,this._rendererId=i,this._bufferService=h,this._optionsService=f,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=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return d.prototype.dispose=function(){var s;u.removeElementFromParent(this._canvas),(s=this._charAtlas)===null||s===void 0||s.dispose()},d.prototype._initCanvas=function(){this._ctx=y.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},d.prototype.onOptionsChanged=function(){},d.prototype.onBlur=function(){},d.prototype.onFocus=function(){},d.prototype.onCursorMove=function(){},d.prototype.onGridChanged=function(s,l){},d.prototype.onSelectionChanged=function(s,l,r){r===void 0&&(r=!1)},d.prototype.setColors=function(s){this._refreshCharAtlas(s)},d.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)}},d.prototype._refreshCharAtlas=function(s){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=c.acquireCharAtlas(this._optionsService.options,this._rendererId,s,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},d.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)},d.prototype._fillCells=function(s,l,r,n){this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,r*this._scaledCellWidth,n*this._scaledCellHeight)},d.prototype._fillBottomLineAtCells=function(s,l,r){r===void 0&&(r=1),this._ctx.fillRect(s*this._scaledCellWidth,(l+1)*this._scaledCellHeight-window.devicePixelRatio-1,r*this._scaledCellWidth,window.devicePixelRatio)},d.prototype._fillLeftLineAtCell=function(s,l,r){this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,window.devicePixelRatio*r,this._scaledCellHeight)},d.prototype._strokeRectAtCell=function(s,l,r,n){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(s*this._scaledCellWidth+window.devicePixelRatio/2,l*this._scaledCellHeight+window.devicePixelRatio/2,r*this._scaledCellWidth-window.devicePixelRatio,n*this._scaledCellHeight-window.devicePixelRatio)},d.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))},d.prototype._clearCells=function(s,l,r,n){this._alpha?this._ctx.clearRect(s*this._scaledCellWidth,l*this._scaledCellHeight,r*this._scaledCellWidth,n*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(s*this._scaledCellWidth,l*this._scaledCellHeight,r*this._scaledCellWidth,n*this._scaledCellHeight))},d.prototype._fillCharTrueColor=function(s,l,r){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(r),this._ctx.fillText(s.getChars(),l*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},d.prototype._drawChars=function(s,l,r){var n,a,i=this._getContrastColor(s);i||s.isFgRGB()||s.isBgRGB()?this._drawUncachedChars(s,l,r,i):(s.isInverse()?(n=s.isBgDefault()?O.INVERTED_DEFAULT_COLOR:s.getBgColor(),a=s.isFgDefault()?O.INVERTED_DEFAULT_COLOR:s.getFgColor()):(a=s.isBgDefault()?R.DEFAULT_COLOR:s.getBgColor(),n=s.isFgDefault()?R.DEFAULT_COLOR:s.getFgColor()),n+=this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&n<8?8:0,this._currentGlyphIdentifier.chars=s.getChars()||R.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=s.getCode()||R.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=a,this._currentGlyphIdentifier.fg=n,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,r*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(s,l,r))},d.prototype._drawUncachedChars=function(s,l,r,n){if(this._ctx.save(),this._ctx.font=this._getFont(!!s.isBold(),!!s.isItalic()),this._ctx.textBaseline="middle",s.isInverse())if(n)this._ctx.fillStyle=n.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 a=s.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}else if(n)this._ctx.fillStyle=n.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 i=s.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&s.isBold()&&i<8&&(i+=8),this._ctx.fillStyle=this._colors.ansi[i].css}this._clipRow(r),s.isDim()&&(this._ctx.globalAlpha=O.DIM_OPACITY),this._ctx.fillText(s.getChars(),l*this._scaledCellWidth+this._scaledCharLeft,r*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},d.prototype._clipRow=function(s){this._ctx.beginPath(),this._ctx.rect(0,s*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},d.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},d.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 r=s.getFgColor(),n=s.getFgColorMode(),a=s.getBgColor(),i=s.getBgColorMode(),h=!!s.isInverse(),f=!!s.isInverse();if(h){var w=r;r=a,a=w;var m=n;n=i,i=m}var T=this._resolveBackgroundRgba(i,a,h),C=this._resolveForegroundRgba(n,r,h,f),x=p.rgba.ensureContrastRatio(T,C,this._optionsService.options.minimumContrastRatio);if(x){var b={css:p.channels.toCss(x>>24&255,x>>16&255,x>>8&255),rgba:x};return this._colors.contrastCache.setColor(s.bg,s.fg,b),b}this._colors.contrastCache.setColor(s.bg,s.fg,null)}},d.prototype._resolveBackgroundRgba=function(s,l,r){switch(s){case 16777216:case 33554432:return this._colors.ansi[l].rgba;case 50331648:return l<<8;case 0:default:return r?this._colors.foreground.rgba:this._colors.background.rgba}},d.prototype._resolveForegroundRgba=function(s,l,r,n){switch(s){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&n&&l<8&&(l+=8),this._colors.ansi[l].rgba;case 50331648:return l<<8;case 0:default:return r?this._colors.background.rgba:this._colors.foreground.rgba}},d}();k.BaseRenderLayer=o},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.createDecorator=k.getServiceDependencies=k.serviceRegistry=void 0;function R(O,c,S){c.di$target===c?c.di$dependencies.push({id:O,index:S}):(c.di$dependencies=[{id:O,index:S}],c.di$target=c)}k.serviceRegistry=new Map,k.getServiceDependencies=function(O){return O.di$dependencies||[]},k.createDecorator=function(O){if(k.serviceRegistry.has(O))return k.serviceRegistry.get(O);var c=function(S,y,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");R(c,S,p)};return c.toString=function(){return O},k.serviceRegistry.set(O,c),c}},function(j,k,D){"use strict";function R(O,c,S,y){if(S===void 0&&(S=0),y===void 0&&(y=O.length),S>=O.length)return O;S=(O.length+S)%O.length,y=y>=O.length?O.length:(O.length+y)%O.length;for(var p=S;p<y;++p)O[p]=c;return O}Object.defineProperty(k,"__esModule",{value:!0}),k.concat=k.fillFallback=k.fill=void 0,k.fill=function(O,c,S,y){return O.fill?O.fill(c,S,y):R(O,c,S,y)},k.fillFallback=R,k.concat=function(O,c){var S=new O.constructor(O.length+c.length);return S.set(O),S.set(c,O.length),S}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.BufferLine=k.DEFAULT_ATTR_DATA=void 0;var R=D(8),O=D(3),c=D(4),S=D(6);k.DEFAULT_ATTR_DATA=Object.freeze(new S.AttributeData);var y=function(){function p(u,o,d){d===void 0&&(d=!1),this.isWrapped=d,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*u);for(var s=o||c.CellData.fromCharData([0,O.NULL_CELL_CHAR,O.NULL_CELL_WIDTH,O.NULL_CELL_CODE]),l=0;l<u;++l)this.setCell(l,s);this.length=u}return p.prototype.get=function(u){var o=this._data[3*u+0],d=2097151&o;return[this._data[3*u+1],2097152&o?this._combined[u]:d?R.stringFromCodePoint(d):"",o>>22,2097152&o?this._combined[u].charCodeAt(this._combined[u].length-1):d]},p.prototype.set=function(u,o){this._data[3*u+1]=o[O.CHAR_DATA_ATTR_INDEX],o[O.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[u]=o[1],this._data[3*u+0]=2097152|u|o[O.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*u+0]=o[O.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[O.CHAR_DATA_WIDTH_INDEX]<<22},p.prototype.getWidth=function(u){return this._data[3*u+0]>>22},p.prototype.hasWidth=function(u){return 12582912&this._data[3*u+0]},p.prototype.getFg=function(u){return this._data[3*u+1]},p.prototype.getBg=function(u){return this._data[3*u+2]},p.prototype.hasContent=function(u){return 4194303&this._data[3*u+0]},p.prototype.getCodePoint=function(u){var o=this._data[3*u+0];return 2097152&o?this._combined[u].charCodeAt(this._combined[u].length-1):2097151&o},p.prototype.isCombined=function(u){return 2097152&this._data[3*u+0]},p.prototype.getString=function(u){var o=this._data[3*u+0];return 2097152&o?this._combined[u]:2097151&o?R.stringFromCodePoint(2097151&o):""},p.prototype.loadCell=function(u,o){var d=3*u;return o.content=this._data[d+0],o.fg=this._data[d+1],o.bg=this._data[d+2],2097152&o.content&&(o.combinedData=this._combined[u]),268435456&o.bg&&(o.extended=this._extendedAttrs[u]),o},p.prototype.setCell=function(u,o){2097152&o.content&&(this._combined[u]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[u]=o.extended),this._data[3*u+0]=o.content,this._data[3*u+1]=o.fg,this._data[3*u+2]=o.bg},p.prototype.setCellFromCodePoint=function(u,o,d,s,l,r){268435456&l&&(this._extendedAttrs[u]=r),this._data[3*u+0]=o|d<<22,this._data[3*u+1]=s,this._data[3*u+2]=l},p.prototype.addCodepointToCell=function(u,o){var d=this._data[3*u+0];2097152&d?this._combined[u]+=R.stringFromCodePoint(o):(2097151&d?(this._combined[u]=R.stringFromCodePoint(2097151&d)+R.stringFromCodePoint(o),d&=-2097152,d|=2097152):d=o|1<<22,this._data[3*u+0]=d)},p.prototype.insertCells=function(u,o,d,s){if((u%=this.length)&&this.getWidth(u-1)===2&&this.setCellFromCodePoint(u-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-u){for(var l=new c.CellData,r=this.length-u-o-1;r>=0;--r)this.setCell(u+o+r,this.loadCell(u+r,l));for(r=0;r<o;++r)this.setCell(u+r,d)}else for(r=u;r<this.length;++r)this.setCell(r,d);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(u,o,d,s){if(u%=this.length,o<this.length-u){for(var l=new c.CellData,r=0;r<this.length-u-o;++r)this.setCell(u+r,this.loadCell(u+o+r,l));for(r=this.length-o;r<this.length;++r)this.setCell(r,d)}else for(r=u;r<this.length;++r)this.setCell(r,d);u&&this.getWidth(u-1)===2&&this.setCellFromCodePoint(u-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(u)!==0||this.hasContent(u)||this.setCellFromCodePoint(u,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(u,o,d,s){for(u&&this.getWidth(u-1)===2&&this.setCellFromCodePoint(u-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);u<o&&u<this.length;)this.setCell(u++,d)},p.prototype.resize=function(u,o){if(u!==this.length){if(u>this.length){var d=new Uint32Array(3*u);this.length&&(3*u<this._data.length?d.set(this._data.subarray(0,3*u)):d.set(this._data)),this._data=d;for(var s=this.length;s<u;++s)this.setCell(s,o)}else if(u){(d=new Uint32Array(3*u)).set(this._data.subarray(0,3*u)),this._data=d;var l=Object.keys(this._combined);for(s=0;s<l.length;s++){var r=parseInt(l[s],10);r>=u&&delete this._combined[r]}}else this._data=new Uint32Array(0),this._combined={};this.length=u}},p.prototype.fill=function(u){this._combined={},this._extendedAttrs={};for(var o=0;o<this.length;++o)this.setCell(o,u)},p.prototype.copyFrom=function(u){for(var o in this.length!==u.length?this._data=new Uint32Array(u._data):this._data.set(u._data),this.length=u.length,this._combined={},u._combined)this._combined[o]=u._combined[o];for(var o in this._extendedAttrs={},u._extendedAttrs)this._extendedAttrs[o]=u._extendedAttrs[o];this.isWrapped=u.isWrapped},p.prototype.clone=function(){var u=new p(0);for(var o in u._data=new Uint32Array(this._data),u.length=this.length,this._combined)u._combined[o]=this._combined[o];for(var o in this._extendedAttrs)u._extendedAttrs[o]=this._extendedAttrs[o];return u.isWrapped=this.isWrapped,u},p.prototype.getTrimmedLength=function(){for(var u=this.length-1;u>=0;--u)if(4194303&this._data[3*u+0])return u+(this._data[3*u+0]>>22);return 0},p.prototype.copyCellsFrom=function(u,o,d,s,l){var r=u._data;if(l)for(var n=s-1;n>=0;n--)for(var a=0;a<3;a++)this._data[3*(d+n)+a]=r[3*(o+n)+a];else for(n=0;n<s;n++)for(a=0;a<3;a++)this._data[3*(d+n)+a]=r[3*(o+n)+a];var i=Object.keys(u._combined);for(a=0;a<i.length;a++){var h=parseInt(i[a],10);h>=o&&(this._combined[h-o+d]=u._combined[h])}},p.prototype.translateToString=function(u,o,d){u===void 0&&(u=!1),o===void 0&&(o=0),d===void 0&&(d=this.length),u&&(d=Math.min(d,this.getTrimmedLength()));for(var s="";o<d;){var l=this._data[3*o+0],r=2097151&l;s+=2097152&l?this._combined[o]:r?R.stringFromCodePoint(r):O.WHITESPACE_CELL_CHAR,o+=l>>22||1}return s},p}();k.BufferLine=y},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.removeElementFromParent=void 0,k.removeElementFromParent=function(){for(var R,O=[],c=0;c<arguments.length;c++)O[c]=arguments[c];for(var S=0,y=O;S<y.length;S++){var p=y[S];(R=p==null?void 0:p.parentElement)===null||R===void 0||R.removeChild(p)}}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.tooMuchOutput=k.promptLabel=void 0,k.promptLabel="Terminal input",k.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(C,x){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,E){b.__proto__=E}||function(b,E){for(var A in E)E.hasOwnProperty(A)&&(b[A]=E[A])})(C,x)},function(C,x){function b(){this.constructor=C}R(C,x),C.prototype=x===null?Object.create(x):(b.prototype=x.prototype,new b)});Object.defineProperty(k,"__esModule",{value:!0}),k.InputHandler=k.WindowsOptionsReportType=void 0;var c,S=D(12),y=D(20),p=D(39),u=D(2),o=D(15),d=D(8),s=D(16),l=D(0),r=D(3),n=D(4),a=D(6),i=D(22),h=D(24),f={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function w(C,x){if(C>24)return x.setWinLines||!1;switch(C){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(C){C[C.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",C[C.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(c=k.WindowsOptionsReportType||(k.WindowsOptionsReportType={}));var m=function(){function C(x,b,E,A){this._bufferService=x,this._coreService=b,this._logService=E,this._optionsService=A,this._data=new Uint32Array(0)}return C.prototype.hook=function(x){this._data=new Uint32Array(0)},C.prototype.put=function(x,b,E){this._data=o.concat(this._data,x.subarray(b,E))},C.prototype.unhook=function(x){if(x){var b=d.utf32ToString(this._data);switch(this._data=new Uint32Array(0),b){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 E=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(S.C0.ESC+"P1$r"+E+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",b),this._coreService.triggerDataEvent(S.C0.ESC+"P0$r"+S.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},C}(),T=function(C){function x(b,E,A,v,M,I,P,B,H){H===void 0&&(H=new p.EscapeSequenceParser);var F=C.call(this)||this;F._bufferService=b,F._charsetService=E,F._coreService=A,F._dirtyRowService=v,F._logService=M,F._optionsService=I,F._coreMouseService=P,F._unicodeService=B,F._parser=H,F._parseBuffer=new Uint32Array(4096),F._stringDecoder=new d.StringToUtf32,F._utf8Decoder=new d.Utf8ToUtf32,F._workCell=new n.CellData,F._windowTitle="",F._iconName="",F._windowTitleStack=[],F._iconNameStack=[],F._curAttrData=s.DEFAULT_ATTR_DATA.clone(),F._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone(),F._onRequestBell=new l.EventEmitter,F._onRequestRefreshRows=new l.EventEmitter,F._onRequestReset=new l.EventEmitter,F._onRequestScroll=new l.EventEmitter,F._onRequestSyncScrollBar=new l.EventEmitter,F._onRequestWindowsOptionsReport=new l.EventEmitter,F._onA11yChar=new l.EventEmitter,F._onA11yTab=new l.EventEmitter,F._onCursorMove=new l.EventEmitter,F._onLineFeed=new l.EventEmitter,F._onScroll=new l.EventEmitter,F._onTitleChange=new l.EventEmitter,F.register(F._parser),F._parser.setCsiHandlerFallback(function(z,te){F._logService.debug("Unknown CSI code: ",{identifier:F._parser.identToString(z),params:te.toArray()})}),F._parser.setEscHandlerFallback(function(z){F._logService.debug("Unknown ESC code: ",{identifier:F._parser.identToString(z)})}),F._parser.setExecuteHandlerFallback(function(z){F._logService.debug("Unknown EXECUTE code: ",{code:z})}),F._parser.setOscHandlerFallback(function(z,te,de){F._logService.debug("Unknown OSC code: ",{identifier:z,action:te,data:de})}),F._parser.setDcsHandlerFallback(function(z,te,de){te==="HOOK"&&(de=de.toArray()),F._logService.debug("Unknown DCS code: ",{identifier:F._parser.identToString(z),action:te,payload:de})}),F._parser.setPrintHandler(function(z,te,de){return F.print(z,te,de)}),F._parser.setCsiHandler({final:"@"},function(z){return F.insertChars(z)}),F._parser.setCsiHandler({intermediates:" ",final:"@"},function(z){return F.scrollLeft(z)}),F._parser.setCsiHandler({final:"A"},function(z){return F.cursorUp(z)}),F._parser.setCsiHandler({intermediates:" ",final:"A"},function(z){return F.scrollRight(z)}),F._parser.setCsiHandler({final:"B"},function(z){return F.cursorDown(z)}),F._parser.setCsiHandler({final:"C"},function(z){return F.cursorForward(z)}),F._parser.setCsiHandler({final:"D"},function(z){return F.cursorBackward(z)}),F._parser.setCsiHandler({final:"E"},function(z){return F.cursorNextLine(z)}),F._parser.setCsiHandler({final:"F"},function(z){return F.cursorPrecedingLine(z)}),F._parser.setCsiHandler({final:"G"},function(z){return F.cursorCharAbsolute(z)}),F._parser.setCsiHandler({final:"H"},function(z){return F.cursorPosition(z)}),F._parser.setCsiHandler({final:"I"},function(z){return F.cursorForwardTab(z)}),F._parser.setCsiHandler({final:"J"},function(z){return F.eraseInDisplay(z)}),F._parser.setCsiHandler({prefix:"?",final:"J"},function(z){return F.eraseInDisplay(z)}),F._parser.setCsiHandler({final:"K"},function(z){return F.eraseInLine(z)}),F._parser.setCsiHandler({prefix:"?",final:"K"},function(z){return F.eraseInLine(z)}),F._parser.setCsiHandler({final:"L"},function(z){return F.insertLines(z)}),F._parser.setCsiHandler({final:"M"},function(z){return F.deleteLines(z)}),F._parser.setCsiHandler({final:"P"},function(z){return F.deleteChars(z)}),F._parser.setCsiHandler({final:"S"},function(z){return F.scrollUp(z)}),F._parser.setCsiHandler({final:"T"},function(z){return F.scrollDown(z)}),F._parser.setCsiHandler({final:"X"},function(z){return F.eraseChars(z)}),F._parser.setCsiHandler({final:"Z"},function(z){return F.cursorBackwardTab(z)}),F._parser.setCsiHandler({final:"`"},function(z){return F.charPosAbsolute(z)}),F._parser.setCsiHandler({final:"a"},function(z){return F.hPositionRelative(z)}),F._parser.setCsiHandler({final:"b"},function(z){return F.repeatPrecedingCharacter(z)}),F._parser.setCsiHandler({final:"c"},function(z){return F.sendDeviceAttributesPrimary(z)}),F._parser.setCsiHandler({prefix:">",final:"c"},function(z){return F.sendDeviceAttributesSecondary(z)}),F._parser.setCsiHandler({final:"d"},function(z){return F.linePosAbsolute(z)}),F._parser.setCsiHandler({final:"e"},function(z){return F.vPositionRelative(z)}),F._parser.setCsiHandler({final:"f"},function(z){return F.hVPosition(z)}),F._parser.setCsiHandler({final:"g"},function(z){return F.tabClear(z)}),F._parser.setCsiHandler({final:"h"},function(z){return F.setMode(z)}),F._parser.setCsiHandler({prefix:"?",final:"h"},function(z){return F.setModePrivate(z)}),F._parser.setCsiHandler({final:"l"},function(z){return F.resetMode(z)}),F._parser.setCsiHandler({prefix:"?",final:"l"},function(z){return F.resetModePrivate(z)}),F._parser.setCsiHandler({final:"m"},function(z){return F.charAttributes(z)}),F._parser.setCsiHandler({final:"n"},function(z){return F.deviceStatus(z)}),F._parser.setCsiHandler({prefix:"?",final:"n"},function(z){return F.deviceStatusPrivate(z)}),F._parser.setCsiHandler({intermediates:"!",final:"p"},function(z){return F.softReset(z)}),F._parser.setCsiHandler({intermediates:" ",final:"q"},function(z){return F.setCursorStyle(z)}),F._parser.setCsiHandler({final:"r"},function(z){return F.setScrollRegion(z)}),F._parser.setCsiHandler({final:"s"},function(z){return F.saveCursor(z)}),F._parser.setCsiHandler({final:"t"},function(z){return F.windowOptions(z)}),F._parser.setCsiHandler({final:"u"},function(z){return F.restoreCursor(z)}),F._parser.setCsiHandler({intermediates:"'",final:"}"},function(z){return F.insertColumns(z)}),F._parser.setCsiHandler({intermediates:"'",final:"~"},function(z){return F.deleteColumns(z)}),F._parser.setExecuteHandler(S.C0.BEL,function(){return F.bell()}),F._parser.setExecuteHandler(S.C0.LF,function(){return F.lineFeed()}),F._parser.setExecuteHandler(S.C0.VT,function(){return F.lineFeed()}),F._parser.setExecuteHandler(S.C0.FF,function(){return F.lineFeed()}),F._parser.setExecuteHandler(S.C0.CR,function(){return F.carriageReturn()}),F._parser.setExecuteHandler(S.C0.BS,function(){return F.backspace()}),F._parser.setExecuteHandler(S.C0.HT,function(){return F.tab()}),F._parser.setExecuteHandler(S.C0.SO,function(){return F.shiftOut()}),F._parser.setExecuteHandler(S.C0.SI,function(){return F.shiftIn()}),F._parser.setExecuteHandler(S.C1.IND,function(){return F.index()}),F._parser.setExecuteHandler(S.C1.NEL,function(){return F.nextLine()}),F._parser.setExecuteHandler(S.C1.HTS,function(){return F.tabSet()}),F._parser.setOscHandler(0,new i.OscHandler(function(z){F.setTitle(z),F.setIconName(z)})),F._parser.setOscHandler(1,new i.OscHandler(function(z){return F.setIconName(z)})),F._parser.setOscHandler(2,new i.OscHandler(function(z){return F.setTitle(z)})),F._parser.setEscHandler({final:"7"},function(){return F.saveCursor()}),F._parser.setEscHandler({final:"8"},function(){return F.restoreCursor()}),F._parser.setEscHandler({final:"D"},function(){return F.index()}),F._parser.setEscHandler({final:"E"},function(){return F.nextLine()}),F._parser.setEscHandler({final:"H"},function(){return F.tabSet()}),F._parser.setEscHandler({final:"M"},function(){return F.reverseIndex()}),F._parser.setEscHandler({final:"="},function(){return F.keypadApplicationMode()}),F._parser.setEscHandler({final:">"},function(){return F.keypadNumericMode()}),F._parser.setEscHandler({final:"c"},function(){return F.fullReset()}),F._parser.setEscHandler({final:"n"},function(){return F.setgLevel(2)}),F._parser.setEscHandler({final:"o"},function(){return F.setgLevel(3)}),F._parser.setEscHandler({final:"|"},function(){return F.setgLevel(3)}),F._parser.setEscHandler({final:"}"},function(){return F.setgLevel(2)}),F._parser.setEscHandler({final:"~"},function(){return F.setgLevel(1)}),F._parser.setEscHandler({intermediates:"%",final:"@"},function(){return F.selectDefaultCharset()}),F._parser.setEscHandler({intermediates:"%",final:"G"},function(){return F.selectDefaultCharset()});var W=function(z){U._parser.setEscHandler({intermediates:"(",final:z},function(){return F.selectCharset("("+z)}),U._parser.setEscHandler({intermediates:")",final:z},function(){return F.selectCharset(")"+z)}),U._parser.setEscHandler({intermediates:"*",final:z},function(){return F.selectCharset("*"+z)}),U._parser.setEscHandler({intermediates:"+",final:z},function(){return F.selectCharset("+"+z)}),U._parser.setEscHandler({intermediates:"-",final:z},function(){return F.selectCharset("-"+z)}),U._parser.setEscHandler({intermediates:".",final:z},function(){return F.selectCharset("."+z)}),U._parser.setEscHandler({intermediates:"/",final:z},function(){return F.selectCharset("/"+z)})},U=this;for(var K in y.CHARSETS)W(K);return F._parser.setEscHandler({intermediates:"#",final:"8"},function(){return F.screenAlignmentPattern()}),F._parser.setErrorHandler(function(z){return F._logService.error("Parsing error: ",z),z}),F._parser.setDcsHandler({intermediates:"$",final:"q"},new m(F._bufferService,F._coreService,F._logService,F._optionsService)),F}return O(x,C),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(){C.prototype.dispose.call(this)},x.prototype.parse=function(b){var E=this._bufferService.buffer,A=E.x,v=E.y;if(this._logService.debug("parsing data",b),this._parseBuffer.length<b.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(b.length,131072))),this._dirtyRowService.clearRange(),b.length>131072)for(var M=0;M<b.length;M+=131072){var I=M+131072<b.length?M+131072:b.length,P=typeof b=="string"?this._stringDecoder.decode(b.substring(M,I),this._parseBuffer):this._utf8Decoder.decode(b.subarray(M,I),this._parseBuffer);this._parser.parse(this._parseBuffer,P)}else P=typeof b=="string"?this._stringDecoder.decode(b,this._parseBuffer):this._utf8Decoder.decode(b,this._parseBuffer),this._parser.parse(this._parseBuffer,P);(E=this._bufferService.buffer).x===A&&E.y===v||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},x.prototype.print=function(b,E,A){var v,M,I=this._bufferService.buffer,P=this._charsetService.charset,B=this._optionsService.options.screenReaderMode,H=this._bufferService.cols,F=this._coreService.decPrivateModes.wraparound,W=this._coreService.modes.insertMode,U=this._curAttrData,K=I.lines.get(I.ybase+I.y);this._dirtyRowService.markDirty(I.y),I.x&&A-E>0&&K.getWidth(I.x-1)===2&&K.setCellFromCodePoint(I.x-1,0,1,U.fg,U.bg,U.extended);for(var z=E;z<A;++z){if(v=b[z],M=this._unicodeService.wcwidth(v),v<127&&P){var te=P[String.fromCharCode(v)];te&&(v=te.charCodeAt(0))}if(B&&this._onA11yChar.fire(d.stringFromCodePoint(v)),M||!I.x){if(I.x+M-1>=H){if(F){for(;I.x<H;)K.setCellFromCodePoint(I.x++,0,1,U.fg,U.bg,U.extended);I.x=0,I.y++,I.y===I.scrollBottom+1?(I.y--,this._onRequestScroll.fire(this._eraseAttrData(),!0)):(I.y>=this._bufferService.rows&&(I.y=this._bufferService.rows-1),I.lines.get(I.ybase+I.y).isWrapped=!0),K=I.lines.get(I.ybase+I.y)}else if(I.x=H-1,M===2)continue}if(W&&(K.insertCells(I.x,M,I.getNullCell(U),U),K.getWidth(H-1)===2&&K.setCellFromCodePoint(H-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,U.fg,U.bg,U.extended)),K.setCellFromCodePoint(I.x++,v,M,U.fg,U.bg,U.extended),M>0)for(;--M;)K.setCellFromCodePoint(I.x++,0,0,U.fg,U.bg,U.extended)}else K.getWidth(I.x-1)?K.addCodepointToCell(I.x-1,v):K.addCodepointToCell(I.x-2,v)}A-E>0&&(K.loadCell(I.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),I.x<H&&A-E>0&&K.getWidth(I.x)===0&&!K.hasContent(I.x)&&K.setCellFromCodePoint(I.x,0,1,U.fg,U.bg,U.extended),this._dirtyRowService.markDirty(I.y)},x.prototype.addCsiHandler=function(b,E){var A=this;return b.final!=="t"||b.prefix||b.intermediates?this._parser.addCsiHandler(b,E):this._parser.addCsiHandler(b,function(v){return!w(v.params[0],A._optionsService.options.windowOptions)||E(v)})},x.prototype.addDcsHandler=function(b,E){return this._parser.addDcsHandler(b,new h.DcsHandler(E))},x.prototype.addEscHandler=function(b,E){return this._parser.addEscHandler(b,E)},x.prototype.addOscHandler=function(b,E){return this._parser.addOscHandler(b,new i.OscHandler(E))},x.prototype.bell=function(){this._onRequestBell.fire()},x.prototype.lineFeed=function(){var b=this._bufferService.buffer;this._dirtyRowService.markDirty(b.y),this._optionsService.options.convertEol&&(b.x=0),b.y++,b.y===b.scrollBottom+1?(b.y--,this._onRequestScroll.fire(this._eraseAttrData())):b.y>=this._bufferService.rows&&(b.y=this._bufferService.rows-1),b.x>=this._bufferService.cols&&b.x--,this._dirtyRowService.markDirty(b.y),this._onLineFeed.fire()},x.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},x.prototype.backspace=function(){var b,E=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(E.x>0&&E.x--);if(this._restrictCursor(this._bufferService.cols),E.x>0)E.x--;else if(E.x===0&&E.y>E.scrollTop&&E.y<=E.scrollBottom&&((b=E.lines.get(E.ybase+E.y))===null||b===void 0?void 0:b.isWrapped)){E.lines.get(E.ybase+E.y).isWrapped=!1,E.y--,E.x=this._bufferService.cols-1;var A=E.lines.get(E.ybase+E.y);A.hasWidth(E.x)&&!A.hasContent(E.x)&&E.x--}this._restrictCursor()},x.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var b=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-b)}},x.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},x.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},x.prototype._restrictCursor=function(b){b===void 0&&(b=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(b,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(b,E){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=b,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+E):(this._bufferService.buffer.x=b,this._bufferService.buffer.y=E),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},x.prototype._moveCursor=function(b,E){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+b,this._bufferService.buffer.y+E)},x.prototype.cursorUp=function(b){var E=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;E>=0?this._moveCursor(0,-Math.min(E,b.params[0]||1)):this._moveCursor(0,-(b.params[0]||1))},x.prototype.cursorDown=function(b){var E=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;E>=0?this._moveCursor(0,Math.min(E,b.params[0]||1)):this._moveCursor(0,b.params[0]||1)},x.prototype.cursorForward=function(b){this._moveCursor(b.params[0]||1,0)},x.prototype.cursorBackward=function(b){this._moveCursor(-(b.params[0]||1),0)},x.prototype.cursorNextLine=function(b){this.cursorDown(b),this._bufferService.buffer.x=0},x.prototype.cursorPrecedingLine=function(b){this.cursorUp(b),this._bufferService.buffer.x=0},x.prototype.cursorCharAbsolute=function(b){this._setCursor((b.params[0]||1)-1,this._bufferService.buffer.y)},x.prototype.cursorPosition=function(b){this._setCursor(b.length>=2?(b.params[1]||1)-1:0,(b.params[0]||1)-1)},x.prototype.charPosAbsolute=function(b){this._setCursor((b.params[0]||1)-1,this._bufferService.buffer.y)},x.prototype.hPositionRelative=function(b){this._moveCursor(b.params[0]||1,0)},x.prototype.linePosAbsolute=function(b){this._setCursor(this._bufferService.buffer.x,(b.params[0]||1)-1)},x.prototype.vPositionRelative=function(b){this._moveCursor(0,b.params[0]||1)},x.prototype.hVPosition=function(b){this.cursorPosition(b)},x.prototype.tabClear=function(b){var E=b.params[0];E===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:E===3&&(this._bufferService.buffer.tabs={})},x.prototype.cursorForwardTab=function(b){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var E=b.params[0]||1;E--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},x.prototype.cursorBackwardTab=function(b){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var E=b.params[0]||1,A=this._bufferService.buffer;E--;)A.x=A.prevStop()},x.prototype._eraseInBufferLine=function(b,E,A,v){v===void 0&&(v=!1);var M=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+b);M.replaceCells(E,A,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),v&&(M.isWrapped=!1)},x.prototype._resetBufferLine=function(b){var E=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+b);E.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),E.isWrapped=!1},x.prototype.eraseInDisplay=function(b){var E;switch(this._restrictCursor(),b.params[0]){case 0:for(E=this._bufferService.buffer.y,this._dirtyRowService.markDirty(E),this._eraseInBufferLine(E++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);E<this._bufferService.rows;E++)this._resetBufferLine(E);this._dirtyRowService.markDirty(E);break;case 1:for(E=this._bufferService.buffer.y,this._dirtyRowService.markDirty(E),this._eraseInBufferLine(E,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(E+1).isWrapped=!1);E--;)this._resetBufferLine(E);this._dirtyRowService.markDirty(0);break;case 2:for(E=this._bufferService.rows,this._dirtyRowService.markDirty(E-1);E--;)this._resetBufferLine(E);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(b){switch(this._restrictCursor(),b.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(b){this._restrictCursor();var E=b.params[0]||1,A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var v=A.ybase+A.y,M=this._bufferService.rows-1-A.scrollBottom,I=this._bufferService.rows-1+A.ybase-M+1;E--;)A.lines.splice(I-1,1),A.lines.splice(v,0,A.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(A.y,A.scrollBottom),A.x=0}},x.prototype.deleteLines=function(b){this._restrictCursor();var E=b.params[0]||1,A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){var v,M=A.ybase+A.y;for(v=this._bufferService.rows-1-A.scrollBottom,v=this._bufferService.rows-1+A.ybase-v;E--;)A.lines.splice(M,1),A.lines.splice(v,0,A.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(A.y,A.scrollBottom),A.x=0}},x.prototype.insertChars=function(b){this._restrictCursor();var E=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);E&&(E.insertCells(this._bufferService.buffer.x,b.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.deleteChars=function(b){this._restrictCursor();var E=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);E&&(E.deleteCells(this._bufferService.buffer.x,b.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.scrollUp=function(b){for(var E=b.params[0]||1,A=this._bufferService.buffer;E--;)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(b){for(var E=b.params[0]||1,A=this._bufferService.buffer;E--;)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(b){var E=this._bufferService.buffer;if(!(E.y>E.scrollBottom||E.y<E.scrollTop)){for(var A=b.params[0]||1,v=E.scrollTop;v<=E.scrollBottom;++v){var M=E.lines.get(E.ybase+v);M.deleteCells(0,A,E.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom)}},x.prototype.scrollRight=function(b){var E=this._bufferService.buffer;if(!(E.y>E.scrollBottom||E.y<E.scrollTop)){for(var A=b.params[0]||1,v=E.scrollTop;v<=E.scrollBottom;++v){var M=E.lines.get(E.ybase+v);M.insertCells(0,A,E.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom)}},x.prototype.insertColumns=function(b){var E=this._bufferService.buffer;if(!(E.y>E.scrollBottom||E.y<E.scrollTop)){for(var A=b.params[0]||1,v=E.scrollTop;v<=E.scrollBottom;++v){var M=this._bufferService.buffer.lines.get(E.ybase+v);M.insertCells(E.x,A,E.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom)}},x.prototype.deleteColumns=function(b){var E=this._bufferService.buffer;if(!(E.y>E.scrollBottom||E.y<E.scrollTop)){for(var A=b.params[0]||1,v=E.scrollTop;v<=E.scrollBottom;++v){var M=E.lines.get(E.ybase+v);M.deleteCells(E.x,A,E.getNullCell(this._eraseAttrData()),this._eraseAttrData()),M.isWrapped=!1}this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom)}},x.prototype.eraseChars=function(b){this._restrictCursor();var E=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+this._bufferService.buffer.y);E&&(E.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+(b.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},x.prototype.repeatPrecedingCharacter=function(b){if(this._parser.precedingCodepoint){for(var E=b.params[0]||1,A=new Uint32Array(E),v=0;v<E;++v)A[v]=this._parser.precedingCodepoint;this.print(A,0,A.length)}},x.prototype.sendDeviceAttributesPrimary=function(b){b.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(b){b.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(b.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(S.C0.ESC+"[>83;40003;0c"))},x.prototype._is=function(b){return(this._optionsService.options.termName+"").indexOf(b)===0},x.prototype.setMode=function(b){for(var E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!0}},x.prototype.setModePrivate=function(b){for(var E=0;E<b.length;E++)switch(b.params[E]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,y.DEFAULT_CHARSET),this._charsetService.setgCharset(1,y.DEFAULT_CHARSET),this._charsetService.setgCharset(2,y.DEFAULT_CHARSET),this._charsetService.setgCharset(3,y.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(b){for(var E=0;E<b.length;E++)switch(b.params[E]){case 4:this._coreService.modes.insertMode=!1}},x.prototype.resetModePrivate=function(b){for(var E=0;E<b.length;E++)switch(b.params[E]){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(),b.params[E]===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(b,E,A,v,M){return E===2?(b|=50331648,b&=-16777216,b|=a.AttributeData.fromColorRGB([A,v,M])):E===5&&(b&=-50331904,b|=33554432|255&A),b},x.prototype._extractColor=function(b,E,A){var v=[0,0,-1,0,0,0],M=0,I=0;do{if(v[I+M]=b.params[E+I],b.hasSubParams(E+I)){var P=b.getSubParams(E+I),B=0;do v[1]===5&&(M=1),v[I+B+1+M]=P[B];while(++B<P.length&&B+I+1+M<v.length);break}if(v[1]===5&&I+M>=2||v[1]===2&&I+M>=5)break;v[1]&&(M=1)}while(++I+E<b.length&&I+M<v.length);for(B=2;B<v.length;++B)v[B]===-1&&(v[B]=0);switch(v[0]){case 38:A.fg=this._updateAttrColor(A.fg,v[1],v[3],v[4],v[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,v[1],v[3],v[4],v[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,v[1],v[3],v[4],v[5])}return I},x.prototype._processUnderline=function(b,E){E.extended=E.extended.clone(),(!~b||b>5)&&(b=1),E.extended.underlineStyle=b,E.fg|=268435456,b===0&&(E.fg&=-268435457),E.updateExtended()},x.prototype.charAttributes=function(b){if(b.length===1&&b.params[0]===0)return this._curAttrData.fg=s.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=s.DEFAULT_ATTR_DATA.bg);for(var E,A=b.length,v=this._curAttrData,M=0;M<A;M++)(E=b.params[M])>=30&&E<=37?(v.fg&=-50331904,v.fg|=16777216|E-30):E>=40&&E<=47?(v.bg&=-50331904,v.bg|=16777216|E-40):E>=90&&E<=97?(v.fg&=-50331904,v.fg|=16777224|E-90):E>=100&&E<=107?(v.bg&=-50331904,v.bg|=16777224|E-100):E===0?(v.fg=s.DEFAULT_ATTR_DATA.fg,v.bg=s.DEFAULT_ATTR_DATA.bg):E===1?v.fg|=134217728:E===3?v.bg|=67108864:E===4?(v.fg|=268435456,this._processUnderline(b.hasSubParams(M)?b.getSubParams(M)[0]:1,v)):E===5?v.fg|=536870912:E===7?v.fg|=67108864:E===8?v.fg|=1073741824:E===2?v.bg|=134217728:E===21?this._processUnderline(2,v):E===22?(v.fg&=-134217729,v.bg&=-134217729):E===23?v.bg&=-67108865:E===24?v.fg&=-268435457:E===25?v.fg&=-536870913:E===27?v.fg&=-67108865:E===28?v.fg&=-1073741825:E===39?(v.fg&=-67108864,v.fg|=16777215&s.DEFAULT_ATTR_DATA.fg):E===49?(v.bg&=-67108864,v.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):E===38||E===48||E===58?M+=this._extractColor(b,M,v):E===59?(v.extended=v.extended.clone(),v.extended.underlineColor=-1,v.updateExtended()):E===100?(v.fg&=-67108864,v.fg|=16777215&s.DEFAULT_ATTR_DATA.fg,v.bg&=-67108864,v.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",E)},x.prototype.deviceStatus=function(b){switch(b.params[0]){case 5:this._coreService.triggerDataEvent(S.C0.ESC+"[0n");break;case 6:var E=this._bufferService.buffer.y+1,A=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(S.C0.ESC+"["+E+";"+A+"R")}},x.prototype.deviceStatusPrivate=function(b){switch(b.params[0]){case 6:var E=this._bufferService.buffer.y+1,A=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(S.C0.ESC+"[?"+E+";"+A+"R")}},x.prototype.softReset=function(b){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(b){var E=b.params[0]||1;switch(E){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=E%2==1;this._optionsService.options.cursorBlink=A},x.prototype.setScrollRegion=function(b){var E,A=b.params[0]||1;(b.length<2||(E=b.params[1])>this._bufferService.rows||E===0)&&(E=this._bufferService.rows),E>A&&(this._bufferService.buffer.scrollTop=A-1,this._bufferService.buffer.scrollBottom=E-1,this._setCursor(0,0))},x.prototype.windowOptions=function(b){if(w(b.params[0],this._optionsService.options.windowOptions)){var E=b.length>1?b.params[1]:0;switch(b.params[0]){case 14:E!==2&&this._onRequestWindowsOptionsReport.fire(c.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(c.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:E!==0&&E!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),E!==0&&E!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:E!==0&&E!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),E!==0&&E!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},x.prototype.saveCursor=function(b){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(b){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(b){this._windowTitle=b,this._onTitleChange.fire(b)},x.prototype.setIconName=function(b){this._iconName=b},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,y.DEFAULT_CHARSET)},x.prototype.selectCharset=function(b){b.length===2?b[0]!=="/"&&this._charsetService.setgCharset(f[b[0]],y.CHARSETS[b[1]]||y.DEFAULT_CHARSET):this.selectDefaultCharset()},x.prototype.index=function(){this._restrictCursor();var b=this._bufferService.buffer;this._bufferService.buffer.y++,b.y===b.scrollBottom+1?(b.y--,this._onRequestScroll.fire(this._eraseAttrData())):b.y>=this._bufferService.rows&&(b.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 b=this._bufferService.buffer;if(b.y===b.scrollTop){var E=b.scrollBottom-b.scrollTop;b.lines.shiftElements(b.ybase+b.y,E,1),b.lines.set(b.ybase+b.y,b.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(b.scrollTop,b.scrollBottom)}else b.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(b){this._charsetService.setgLevel(b)},x.prototype.screenAlignmentPattern=function(){var b=new n.CellData;b.content=1<<22|"E".charCodeAt(0),b.fg=this._curAttrData.fg,b.bg=this._curAttrData.bg;var E=this._bufferService.buffer;this._setCursor(0,0);for(var A=0;A<this._bufferService.rows;++A){var v=E.ybase+E.y+A,M=E.lines.get(v);M&&(M.fill(b),M.isWrapped=!1)}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},x}(u.Disposable);k.InputHandler=T},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.DEFAULT_CHARSET=k.CHARSETS=void 0,k.CHARSETS={},k.DEFAULT_CHARSET=k.CHARSETS.B,k.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"},k.CHARSETS.A={"#":"\xA3"},k.CHARSETS.B=void 0,k.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},k.CHARSETS.C=k.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},k.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},k.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},k.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},k.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},k.CHARSETS.E=k.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},k.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},k.CHARSETS.H=k.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},k.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.Params=void 0;var R=function(){function O(c,S){if(c===void 0&&(c=32),S===void 0&&(S=32),this.maxLength=c,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return O.fromArray=function(c){var S=new O;if(!c.length)return S;for(var y=c[0]instanceof Array?1:0;y<c.length;++y){var p=c[y];if(p instanceof Array)for(var u=0;u<p.length;++u)S.addSubParam(p[u]);else S.addParam(p)}return S},O.prototype.clone=function(){var c=new O(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c},O.prototype.toArray=function(){for(var c=[],S=0;S<this.length;++S){c.push(this.params[S]);var y=this._subParamsIdx[S]>>8,p=255&this._subParamsIdx[S];p-y>0&&c.push(Array.prototype.slice.call(this._subParams,y,p))}return c},O.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},O.prototype.addParam=function(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>2147483647?2147483647:c}},O.prototype.addSubParam=function(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>2147483647?2147483647:c,this._subParamsIdx[this.length-1]++}},O.prototype.hasSubParams=function(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0},O.prototype.getSubParams=function(c){var S=this._subParamsIdx[c]>>8,y=255&this._subParamsIdx[c];return y-S>0?this._subParams.subarray(S,y):null},O.prototype.getSubParamsAll=function(){for(var c={},S=0;S<this.length;++S){var y=this._subParamsIdx[S]>>8,p=255&this._subParamsIdx[S];p-y>0&&(c[S]=this._subParams.slice(y,p))}return c},O.prototype.addDigit=function(c){var S;if(!(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var y=this._digitIsSub?this._subParams:this.params,p=y[S-1];y[S-1]=~p?Math.min(10*p+c,2147483647):c}},O}();k.Params=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.OscHandler=k.OscParser=void 0;var R=D(23),O=D(8),c=function(){function y(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return y.prototype.addHandler=function(p,u){this._handlers[p]===void 0&&(this._handlers[p]=[]);var o=this._handlers[p];return o.push(u),{dispose:function(){var d=o.indexOf(u);d!==-1&&o.splice(d,1)}}},y.prototype.setHandler=function(p,u){this._handlers[p]=[u]},y.prototype.clearHandler=function(p){this._handlers[p]&&delete this._handlers[p]},y.prototype.setHandlerFallback=function(p){this._handlerFb=p},y.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},y.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},y.prototype._start=function(){var p=this._handlers[this._id];if(p)for(var u=p.length-1;u>=0;u--)p[u].start();else this._handlerFb(this._id,"START")},y.prototype._put=function(p,u,o){var d=this._handlers[this._id];if(d)for(var s=d.length-1;s>=0;s--)d[s].put(p,u,o);else this._handlerFb(this._id,"PUT",O.utf32ToString(p,u,o))},y.prototype._end=function(p){var u=this._handlers[this._id];if(u){for(var o=u.length-1;o>=0&&u[o].end(p)===!1;o--);for(o--;o>=0;o--)u[o].end(!1)}else this._handlerFb(this._id,"END",p)},y.prototype.start=function(){this.reset(),this._id=-1,this._state=1},y.prototype.put=function(p,u,o){if(this._state!==3){if(this._state===1)for(;u<o;){var d=p[u++];if(d===59){this._state=2,this._start();break}if(d<48||57<d)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+d-48}this._state===2&&o-u>0&&this._put(p,u,o)}},y.prototype.end=function(p){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(p)),this._id=-1,this._state=0)},y}();k.OscParser=c;var S=function(){function y(p){this._handler=p,this._data="",this._hitLimit=!1}return y.prototype.start=function(){this._data="",this._hitLimit=!1},y.prototype.put=function(p,u,o){this._hitLimit||(this._data+=O.utf32ToString(p,u,o),this._data.length>R.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},y.prototype.end=function(p){var u;return this._hitLimit?u=!1:p&&(u=this._handler(this._data)),this._data="",this._hitLimit=!1,u},y}();k.OscHandler=S},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.PAYLOAD_LIMIT=void 0,k.PAYLOAD_LIMIT=1e7},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.DcsHandler=k.DcsParser=void 0;var R=D(8),O=D(21),c=D(23),S=[],y=function(){function u(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=function(){}}return u.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},u.prototype.addHandler=function(o,d){this._handlers[o]===void 0&&(this._handlers[o]=[]);var s=this._handlers[o];return s.push(d),{dispose:function(){var l=s.indexOf(d);l!==-1&&s.splice(l,1)}}},u.prototype.setHandler=function(o,d){this._handlers[o]=[d]},u.prototype.clearHandler=function(o){this._handlers[o]&&delete this._handlers[o]},u.prototype.setHandlerFallback=function(o){this._handlerFb=o},u.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=S,this._ident=0},u.prototype.hook=function(o,d){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(d);else this._handlerFb(this._ident,"HOOK",d)},u.prototype.put=function(o,d,s){if(this._active.length)for(var l=this._active.length-1;l>=0;l--)this._active[l].put(o,d,s);else this._handlerFb(this._ident,"PUT",R.utf32ToString(o,d,s))},u.prototype.unhook=function(o){if(this._active.length){for(var d=this._active.length-1;d>=0&&this._active[d].unhook(o)===!1;d--);for(d--;d>=0;d--)this._active[d].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",o);this._active=S,this._ident=0},u}();k.DcsParser=y;var p=function(){function u(o){this._handler=o,this._data="",this._hitLimit=!1}return u.prototype.hook=function(o){this._params=o.clone(),this._data="",this._hitLimit=!1},u.prototype.put=function(o,d,s){this._hitLimit||(this._data+=R.utf32ToString(o,d,s),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},u.prototype.unhook=function(o){var d;return this._hitLimit?d=!1:o&&(d=this._handler(this._data,this._params||new O.Params)),this._params=void 0,this._data="",this._hitLimit=!1,d},u}();k.DcsHandler=p},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.removeTerminalFromCache=k.acquireCharAtlas=void 0;var R=D(26),O=D(43),c=[];k.acquireCharAtlas=function(S,y,p,u,o){for(var d=R.generateConfig(u,o,S,p),s=0;s<c.length;s++){var l=(r=c[s]).ownedBy.indexOf(y);if(l>=0){if(R.configEquals(r.config,d))return r.atlas;r.ownedBy.length===1?(r.atlas.dispose(),c.splice(s,1)):r.ownedBy.splice(l,1);break}}for(s=0;s<c.length;s++){var r=c[s];if(R.configEquals(r.config,d))return r.ownedBy.push(y),r.atlas}var n={atlas:new O.DynamicCharAtlas(document,d),config:d,ownedBy:[y]};return c.push(n),n.atlas},k.removeTerminalFromCache=function(S){for(var y=0;y<c.length;y++){var p=c[y].ownedBy.indexOf(S);if(p!==-1){c[y].ownedBy.length===1?(c[y].atlas.dispose(),c.splice(y,1)):c[y].ownedBy.splice(p,1);break}}}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.is256Color=k.configEquals=k.generateConfig=void 0;var R=D(3);k.generateConfig=function(O,c,S,y){var p={foreground:y.foreground,background:y.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:y.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:O,scaledCharHeight:c,fontFamily:S.fontFamily,fontSize:S.fontSize,fontWeight:S.fontWeight,fontWeightBold:S.fontWeightBold,allowTransparency:S.allowTransparency,colors:p}},k.configEquals=function(O,c){for(var S=0;S<O.colors.ansi.length;S++)if(O.colors.ansi[S].rgba!==c.colors.ansi[S].rgba)return!1;return O.devicePixelRatio===c.devicePixelRatio&&O.fontFamily===c.fontFamily&&O.fontSize===c.fontSize&&O.fontWeight===c.fontWeight&&O.fontWeightBold===c.fontWeightBold&&O.allowTransparency===c.allowTransparency&&O.scaledCharWidth===c.scaledCharWidth&&O.scaledCharHeight===c.scaledCharHeight&&O.colors.foreground===c.colors.foreground&&O.colors.background===c.colors.background},k.is256Color=function(O){return O<R.DEFAULT_COLOR}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.ColorManager=k.DEFAULT_ANSI_COLORS=void 0;var R=D(10),O=D(45),c=R.css.toColor("#ffffff"),S=R.css.toColor("#000000"),y=R.css.toColor("#ffffff"),p=R.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};k.DEFAULT_ANSI_COLORS=function(){for(var d=[R.css.toColor("#2e3436"),R.css.toColor("#cc0000"),R.css.toColor("#4e9a06"),R.css.toColor("#c4a000"),R.css.toColor("#3465a4"),R.css.toColor("#75507b"),R.css.toColor("#06989a"),R.css.toColor("#d3d7cf"),R.css.toColor("#555753"),R.css.toColor("#ef2929"),R.css.toColor("#8ae234"),R.css.toColor("#fce94f"),R.css.toColor("#729fcf"),R.css.toColor("#ad7fa8"),R.css.toColor("#34e2e2"),R.css.toColor("#eeeeec")],s=[0,95,135,175,215,255],l=0;l<216;l++){var r=s[l/36%6|0],n=s[l/6%6|0],a=s[l%6];d.push({css:R.channels.toCss(r,n,a),rgba:R.channels.toRgba(r,n,a)})}for(l=0;l<24;l++){var i=8+10*l;d.push({css:R.channels.toCss(i,i,i),rgba:R.channels.toRgba(i,i,i)})}return d}();var o=function(){function d(s,l){this.allowTransparency=l;var r=s.createElement("canvas");r.width=1,r.height=1;var n=r.getContext("2d");if(!n)throw new Error("Could not get rendering context");this._ctx=n,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new O.ColorContrastCache,this.colors={foreground:c,background:S,cursor:y,cursorAccent:p,selectionTransparent:u,selectionOpaque:R.color.blend(S,u),ansi:k.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return d.prototype.onOptionsChange=function(s){s==="minimumContrastRatio"&&this._contrastCache.clear()},d.prototype.setTheme=function(s){(s===void 0&&(s={}),this.colors.foreground=this._parseColor(s.foreground,c),this.colors.background=this._parseColor(s.background,S),this.colors.cursor=this._parseColor(s.cursor,y,!0),this.colors.cursorAccent=this._parseColor(s.cursorAccent,p,!0),this.colors.selectionTransparent=this._parseColor(s.selection,u,!0),this.colors.selectionOpaque=R.color.blend(this.colors.background,this.colors.selectionTransparent),R.color.isOpaque(this.colors.selectionTransparent))&&(this.colors.selectionTransparent=R.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(s.black,k.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(s.red,k.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(s.green,k.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(s.yellow,k.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(s.blue,k.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(s.magenta,k.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(s.cyan,k.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(s.white,k.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(s.brightBlack,k.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(s.brightRed,k.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(s.brightGreen,k.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(s.brightYellow,k.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(s.brightBlue,k.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(s.brightMagenta,k.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(s.brightCyan,k.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(s.brightWhite,k.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},d.prototype._parseColor=function(s,l,r){if(r===void 0&&(r=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 n=this._ctx.getImageData(0,0,1,1).data;if(n[3]!==255){if(!r)return console.warn("Color: "+s+" is using transparency, but allowTransparency is false. Using fallback "+l.css+"."),l;var a=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(T){return Number(T)}),i=a[0],h=a[1],f=a[2],w=a[3],m=Math.round(255*w);return{rgba:R.channels.toRgba(i,h,f,m),css:s}}return{css:this._ctx.fillStyle,rgba:R.channels.toRgba(n[0],n[1],n[2],n[3])}},d}();k.ColorManager=o},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.throwIfFalsy=void 0,k.throwIfFalsy=function(R){if(!R)throw new Error("value must not be falsy");return R}},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(o,d){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,l){s.__proto__=l}||function(s,l){for(var r in l)l.hasOwnProperty(r)&&(s[r]=l[r])})(o,d)},function(o,d){function s(){this.constructor=o}R(o,d),o.prototype=d===null?Object.create(d):(s.prototype=d.prototype,new s)});Object.defineProperty(k,"__esModule",{value:!0}),k.CharacterJoinerRegistry=k.JoinedCellData=void 0;var c=D(6),S=D(3),y=D(4),p=function(o){function d(s,l,r){var n=o.call(this)||this;return n.content=0,n.combinedData="",n.fg=s.fg,n.bg=s.bg,n.combinedData=l,n._width=r,n}return O(d,o),d.prototype.isCombined=function(){return 2097152},d.prototype.getWidth=function(){return this._width},d.prototype.getChars=function(){return this.combinedData},d.prototype.getCode=function(){return 2097151},d.prototype.setFromCharData=function(s){throw new Error("not implemented")},d.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},d}(c.AttributeData);k.JoinedCellData=p;var u=function(){function o(d){this._bufferService=d,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new y.CellData}return o.prototype.registerCharacterJoiner=function(d){var s={id:this._nextCharacterJoinerId++,handler:d};return this._characterJoiners.push(s),s.id},o.prototype.deregisterCharacterJoiner=function(d){for(var s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===d)return this._characterJoiners.splice(s,1),!0;return!1},o.prototype.getJoinedCharacters=function(d){if(this._characterJoiners.length===0)return[];var s=this._bufferService.buffer.lines.get(d);if(!s||s.length===0)return[];for(var l=[],r=s.translateToString(!0),n=0,a=0,i=0,h=s.getFg(0),f=s.getBg(0),w=0;w<s.getTrimmedLength();w++)if(s.loadCell(w,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(w-n>1)for(var m=this._getJoinedRanges(r,i,a,s,n),T=0;T<m.length;T++)l.push(m[T]);n=w,i=a,h=this._workCell.fg,f=this._workCell.bg}a+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-n>1)for(m=this._getJoinedRanges(r,i,a,s,n),T=0;T<m.length;T++)l.push(m[T]);return l},o.prototype._getJoinedRanges=function(d,s,l,r,n){for(var a=d.substring(s,l),i=this._characterJoiners[0].handler(a),h=1;h<this._characterJoiners.length;h++)for(var f=this._characterJoiners[h].handler(a),w=0;w<f.length;w++)o._mergeRanges(i,f[w]);return this._stringRangesToCellRanges(i,r,n),i},o.prototype._stringRangesToCellRanges=function(d,s,l){var r=0,n=!1,a=0,i=d[r];if(i){for(var h=l;h<this._bufferService.cols;h++){var f=s.getWidth(h),w=s.getString(h).length||S.WHITESPACE_CELL_CHAR.length;if(f!==0){if(!n&&i[0]<=a&&(i[0]=h,n=!0),i[1]<=a){if(i[1]=h,!(i=d[++r]))break;i[0]<=a?(i[0]=h,n=!0):n=!1}a+=w}}i&&(i[1]=this._bufferService.cols)}},o._mergeRanges=function(d,s){for(var l=!1,r=0;r<d.length;r++){var n=d[r];if(l){if(s[1]<=n[0])return d[r-1][1]=s[1],d;if(s[1]<=n[1])return d[r-1][1]=Math.max(s[1],n[1]),d.splice(r,1),d;d.splice(r,1),r--}else{if(s[1]<=n[0])return d.splice(r,0,s),d;if(s[1]<=n[1])return n[0]=Math.min(s[0],n[0]),d;s[0]<n[1]&&(n[0]=Math.min(s[0],n[0]),l=!0)}}return l?d[d.length-1][1]=s[1]:d.push(s),d},o}();k.CharacterJoinerRegistry=u},function(j,k,D){"use strict";function R(O,c){var S=c.getBoundingClientRect();return[O.clientX-S.left,O.clientY-S.top]}Object.defineProperty(k,"__esModule",{value:!0}),k.getRawByteCoords=k.getCoords=k.getCoordsRelativeToElement=void 0,k.getCoordsRelativeToElement=R,k.getCoords=function(O,c,S,y,p,u,o,d){if(p){var s=R(O,c);if(s)return s[0]=Math.ceil((s[0]+(d?u/2:0))/u),s[1]=Math.ceil(s[1]/o),s[0]=Math.min(Math.max(s[0],1),S+(d?1:0)),s[1]=Math.min(Math.max(s[1],1),y),s}},k.getRawByteCoords=function(O){if(O)return{x:O[0]+32,y:O[1]+32}}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.RenderDebouncer=void 0;var R=function(){function O(c){this._renderCallback=c}return O.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},O.prototype.refresh=function(c,S,y){var p=this;this._rowCount=y,c=c!==void 0?c:0,S=S!==void 0?S:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,c):c,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,S):S,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return p._innerRefresh()}))},O.prototype._innerRefresh=function(){if(this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0){var c=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(c,S)}},O}();k.RenderDebouncer=R},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(S,y){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,u){p.__proto__=u}||function(p,u){for(var o in u)u.hasOwnProperty(o)&&(p[o]=u[o])})(S,y)},function(S,y){function p(){this.constructor=S}R(S,y),S.prototype=y===null?Object.create(y):(p.prototype=y.prototype,new p)});Object.defineProperty(k,"__esModule",{value:!0}),k.ScreenDprMonitor=void 0;var c=function(S){function y(){var p=S!==null&&S.apply(this,arguments)||this;return p._currentDevicePixelRatio=window.devicePixelRatio,p}return O(y,S),y.prototype.setListener=function(p){var u=this;this._listener&&this.clearListener(),this._listener=p,this._outerListener=function(){u._listener&&(u._listener(window.devicePixelRatio,u._currentDevicePixelRatio),u._updateDpr())},this._updateDpr()},y.prototype.dispose=function(){S.prototype.dispose.call(this),this.clearListener()},y.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))},y.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)},y}(D(2).Disposable);k.ScreenDprMonitor=c},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.clone=void 0,k.clone=function R(O,c){if(c===void 0&&(c=5),typeof O!="object")return O;var S=Array.isArray(O)?[]:{};for(var y in O)S[y]=c<=1?O[y]:O[y]?R(O[y],c-1):O[y];return S}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;var R=D(4),O=D(35),c=D(18),S=D(0),y=D(83),p=function(){function r(n){this._core=new O.Terminal(n),this._addonManager=new y.AddonManager}return r.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(r.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onData",{get:function(){return this._core.onData},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"element",{get:function(){return this._core.element},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"parser",{get:function(){return this._checkProposedApi(),this._parser||(this._parser=new s(this._core)),this._parser},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"unicode",{get:function(){return this._checkProposedApi(),new l(this._core)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rows",{get:function(){return this._core.rows},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cols",{get:function(){return this._core.cols},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"buffer",{get:function(){return this._checkProposedApi(),new o(this._core.buffers)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"markers",{get:function(){return this._checkProposedApi(),this._core.markers},enumerable:!1,configurable:!0}),r.prototype.blur=function(){this._core.blur()},r.prototype.focus=function(){this._core.focus()},r.prototype.resize=function(n,a){this._verifyIntegers(n,a),this._core.resize(n,a)},r.prototype.open=function(n){this._core.open(n)},r.prototype.attachCustomKeyEventHandler=function(n){this._core.attachCustomKeyEventHandler(n)},r.prototype.registerLinkMatcher=function(n,a,i){return this._checkProposedApi(),this._core.registerLinkMatcher(n,a,i)},r.prototype.deregisterLinkMatcher=function(n){this._checkProposedApi(),this._core.deregisterLinkMatcher(n)},r.prototype.registerLinkProvider=function(n){return this._checkProposedApi(),this._core.registerLinkProvider(n)},r.prototype.registerCharacterJoiner=function(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)},r.prototype.deregisterCharacterJoiner=function(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)},r.prototype.registerMarker=function(n){return this._checkProposedApi(),this._verifyIntegers(n),this._core.addMarker(n)},r.prototype.addMarker=function(n){return this.registerMarker(n)},r.prototype.hasSelection=function(){return this._core.hasSelection()},r.prototype.select=function(n,a,i){this._verifyIntegers(n,a,i),this._core.select(n,a,i)},r.prototype.getSelection=function(){return this._core.getSelection()},r.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},r.prototype.clearSelection=function(){this._core.clearSelection()},r.prototype.selectAll=function(){this._core.selectAll()},r.prototype.selectLines=function(n,a){this._verifyIntegers(n,a),this._core.selectLines(n,a)},r.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},r.prototype.scrollLines=function(n){this._verifyIntegers(n),this._core.scrollLines(n)},r.prototype.scrollPages=function(n){this._verifyIntegers(n),this._core.scrollPages(n)},r.prototype.scrollToTop=function(){this._core.scrollToTop()},r.prototype.scrollToBottom=function(){this._core.scrollToBottom()},r.prototype.scrollToLine=function(n){this._verifyIntegers(n),this._core.scrollToLine(n)},r.prototype.clear=function(){this._core.clear()},r.prototype.write=function(n,a){this._core.write(n,a)},r.prototype.writeUtf8=function(n,a){this._core.write(n,a)},r.prototype.writeln=function(n,a){this._core.write(n),this._core.write(`\r
|
|
|
`,a)},r.prototype.paste=function(n){this._core.paste(n)},r.prototype.getOption=function(n){return this._core.optionsService.getOption(n)},r.prototype.setOption=function(n,a){this._core.optionsService.setOption(n,a)},r.prototype.refresh=function(n,a){this._verifyIntegers(n,a),this._core.refresh(n,a)},r.prototype.reset=function(){this._core.reset()},r.prototype.loadAddon=function(n){return this._addonManager.loadAddon(this,n)},Object.defineProperty(r,"strings",{get:function(){return c},enumerable:!1,configurable:!0}),r.prototype._verifyIntegers=function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];for(var i=0,h=n;i<h.length;i++){var f=h[i];if(f===1/0||isNaN(f)||f%1!=0)throw new Error("This API only accepts integers")}},r}();k.Terminal=p;var u=function(){function r(n,a){this._buffer=n,this.type=a}return r.prototype.init=function(n){return this._buffer=n,this},Object.defineProperty(r.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!1,configurable:!0}),r.prototype.getLine=function(n){var a=this._buffer.lines.get(n);if(a)return new d(a)},r.prototype.getNullCell=function(){return new R.CellData},r}(),o=function(){function r(n){var a=this;this._buffers=n,this._onBufferChange=new S.EventEmitter,this._normal=new u(this._buffers.normal,"normal"),this._alternate=new u(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return a._onBufferChange.fire(a.active)})}return Object.defineProperty(r.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(r.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(r.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!1,configurable:!0}),r}(),d=function(){function r(n){this._line=n}return Object.defineProperty(r.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"length",{get:function(){return this._line.length},enumerable:!1,configurable:!0}),r.prototype.getCell=function(n,a){if(!(n<0||n>=this._line.length))return a?(this._line.loadCell(n,a),a):this._line.loadCell(n,new R.CellData)},r.prototype.translateToString=function(n,a,i){return this._line.translateToString(n,a,i)},r}(),s=function(){function r(n){this._core=n}return r.prototype.registerCsiHandler=function(n,a){return this._core.addCsiHandler(n,function(i){return a(i.toArray())})},r.prototype.addCsiHandler=function(n,a){return this.registerCsiHandler(n,a)},r.prototype.registerDcsHandler=function(n,a){return this._core.addDcsHandler(n,function(i,h){return a(i,h.toArray())})},r.prototype.addDcsHandler=function(n,a){return this.registerDcsHandler(n,a)},r.prototype.registerEscHandler=function(n,a){return this._core.addEscHandler(n,a)},r.prototype.addEscHandler=function(n,a){return this.registerEscHandler(n,a)},r.prototype.registerOscHandler=function(n,a){return this._core.addOscHandler(n,a)},r.prototype.addOscHandler=function(n,a){return this.registerOscHandler(n,a)},r}(),l=function(){function r(n){this._core=n}return r.prototype.register=function(n){this._core.unicodeService.register(n)},Object.defineProperty(r.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(n){this._core.unicodeService.activeVersion=n},enumerable:!1,configurable:!0}),r}()},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(H,F){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(W,U){W.__proto__=U}||function(W,U){for(var K in U)U.hasOwnProperty(K)&&(W[K]=U[K])})(H,F)},function(H,F){function W(){this.constructor=H}R(H,F),H.prototype=F===null?Object.create(F):(W.prototype=F.prototype,new W)});Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;var c=D(36),S=D(37),y=D(38),p=D(12),u=D(19),o=D(40),d=D(50),s=D(51),l=D(11),r=D(7),n=D(18),a=D(54),i=D(55),h=D(56),f=D(57),w=D(59),m=D(0),T=D(16),C=D(27),x=D(60),b=D(5),E=D(61),A=D(62),v=D(63),M=D(64),I=D(65),P=typeof window!="undefined"?window.document:null,B=function(H){function F(W){W===void 0&&(W={});var U=H.call(this,W)||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(d.Linkifier),U.linkifier2=U.register(U._instantiationService.createInstance(v.Linkifier2)),U.register(U._inputHandler.onRequestBell(function(){return U.bell()})),U.register(U._inputHandler.onRequestRefreshRows(function(K,z){return U.refresh(K,z)})),U.register(U._inputHandler.onRequestReset(function(){return U.reset()})),U.register(U._inputHandler.onRequestScroll(function(K,z){return U.scroll(K,z||void 0)})),U.register(U._inputHandler.onRequestWindowsOptionsReport(function(K){return U._reportWindowsOptions(K)})),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(K){return U._afterResize(K.cols,K.rows)})),U}return O(F,H),Object.defineProperty(F.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(F.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),F.prototype.dispose=function(){var W,U,K;this._isDisposed||(H.prototype.dispose.call(this),(W=this._renderService)===null||W===void 0||W.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(K=(U=this.element)===null||U===void 0?void 0:U.parentNode)===null||K===void 0||K.removeChild(this.element))},F.prototype._setup=function(){H.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(F.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),F.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},F.prototype._updateOptions=function(W){var U,K,z,te;switch(H.prototype._updateOptions.call(this,W),W){case"fontFamily":case"fontSize":(U=this._renderService)===null||U===void 0||U.clear(),(K=this._charSizeService)===null||K===void 0||K.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":(z=this.viewport)===null||z===void 0||z.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new h.AccessibilityManager(this,this._renderService)):((te=this._accessibilityManager)===null||te===void 0||te.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},F.prototype._onTextAreaFocus=function(W){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(p.C0.ESC+"[I"),this.updateCursorStyle(W),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},F.prototype.blur=function(){var W;return(W=this.textarea)===null||W===void 0?void 0:W.blur()},F.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()},F.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var W=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),U=this._bufferService.buffer.y*W,K=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=K+"px",this.textarea.style.top=U+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=W+"px",this.textarea.style.lineHeight=W+"px",this.textarea.style.zIndex="-5"}},F.prototype._initGlobal=function(){var W=this;this._bindKeys(),this.register(r.addDisposableDomListener(this.element,"copy",function(K){W.hasSelection()&&y.copyHandler(K,W._selectionService)}));var U=function(K){return y.handlePasteEvent(K,W.textarea,W._coreService)};this.register(r.addDisposableDomListener(this.textarea,"paste",U)),this.register(r.addDisposableDomListener(this.element,"paste",U)),l.isFirefox?this.register(r.addDisposableDomListener(this.element,"mousedown",function(K){K.button===2&&y.rightClickHandler(K,W.textarea,W.screenElement,W._selectionService,W.options.rightClickSelectsWord)})):this.register(r.addDisposableDomListener(this.element,"contextmenu",function(K){y.rightClickHandler(K,W.textarea,W.screenElement,W._selectionService,W.options.rightClickSelectsWord)})),l.isLinux&&this.register(r.addDisposableDomListener(this.element,"auxclick",function(K){K.button===1&&y.moveTextAreaUnderMouseCursor(K,W.textarea,W.screenElement)}))},F.prototype._bindKeys=function(){var W=this;this.register(r.addDisposableDomListener(this.textarea,"keyup",function(U){return W._keyUp(U)},!0)),this.register(r.addDisposableDomListener(this.textarea,"keydown",function(U){return W._keyDown(U)},!0)),this.register(r.addDisposableDomListener(this.textarea,"keypress",function(U){return W._keyPress(U)},!0)),this.register(r.addDisposableDomListener(this.textarea,"compositionstart",function(){return W._compositionHelper.compositionstart()})),this.register(r.addDisposableDomListener(this.textarea,"compositionupdate",function(U){return W._compositionHelper.compositionupdate(U)})),this.register(r.addDisposableDomListener(this.textarea,"compositionend",function(){return W._compositionHelper.compositionend()})),this.register(this.onRender(function(){return W._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(U){return W._queueLinkification(U.start,U.end)}))},F.prototype.open=function(W){var U=this;if(!W)throw new Error("Terminal requires a parent element.");P.body.contains(W)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=W.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"),W.appendChild(this.element);var K=P.createDocumentFragment();this._viewportElement=P.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),K.appendChild(this._viewportElement),this._viewportScrollArea=P.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=P.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=P.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),K.appendChild(this.screenElement),this.textarea=P.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",n.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(r.addDisposableDomListener(this.textarea,"focus",function(de){return U._onTextAreaFocus(de)})),this.register(r.addDisposableDomListener(this.textarea,"blur",function(){return U._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var z=this._instantiationService.createInstance(M.CoreBrowserService,this.textarea);this._instantiationService.setService(b.ICoreBrowserService,z),this._charSizeService=this._instantiationService.createInstance(E.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._compositionView=P.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(c.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(K),this._theme=this.options.theme||this._theme,this._colorManager=new C.ColorManager(P,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(de){return U._colorManager.onOptionsChange(de)})),this._colorManager.setTheme(this._theme);var te=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(x.RenderService,te,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(de){return U._onRender.fire(de)})),this.onResize(function(de){return U._renderService.resize(de.cols,de.rows)}),this._soundService=this._instantiationService.createInstance(a.SoundService),this._instantiationService.setService(b.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(S.Viewport,function(de,ge){return U.scrollLines(de,ge)},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(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(de){return U.scrollLines(de.amount,de.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return U._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(de){return U._renderService.onSelectionChanged(de.start,de.end,de.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(de){U.textarea.value=de,U.textarea.focus(),U.textarea.select()})),this.register(this.onScroll(function(){U.viewport.syncScrollArea(),U._selectionService.refresh()})),this.register(r.addDisposableDomListener(this._viewportElement,"scroll",function(){return U._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(i.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(r.addDisposableDomListener(this.element,"mousedown",function(de){return U._selectionService.onMouseDown(de)})),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()},F.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(f.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},F.prototype._setTheme=function(W){var U,K,z;this._theme=W,(U=this._colorManager)===null||U===void 0||U.setTheme(W),(K=this._renderService)===null||K===void 0||K.setColors(this._colorManager.colors),(z=this.viewport)===null||z===void 0||z.onThemeChange(this._colorManager.colors)},F.prototype.bindMouse=function(){var W=this,U=this,K=this.element;function z(Le){var Oe,Fe,ye=U._mouseService.getRawByteCoords(Le,U.screenElement,U.cols,U.rows);if(!ye)return!1;switch(Le.overrideType||Le.type){case"mousemove":Fe=32,Le.buttons===void 0?(Oe=3,Le.button!==void 0&&(Oe=Le.button<3?Le.button:3)):Oe=1&Le.buttons?0:4&Le.buttons?1:2&Le.buttons?2:3;break;case"mouseup":Fe=0,Oe=Le.button<3?Le.button:3;break;case"mousedown":Fe=1,Oe=Le.button<3?Le.button:3;break;case"wheel":Le.deltaY!==0&&(Fe=Le.deltaY<0?0:1),Oe=4;break;default:return!1}return!(Fe===void 0||Oe===void 0||Oe>4)&&U._coreMouseService.triggerMouseEvent({col:ye.x-33,row:ye.y-33,button:Oe,action:Fe,ctrl:Le.ctrlKey,alt:Le.altKey,shift:Le.shiftKey})}var te={mouseup:null,wheel:null,mousedrag:null,mousemove:null},de=function(Le){return z(Le),Le.buttons||(W._document.removeEventListener("mouseup",te.mouseup),te.mousedrag&&W._document.removeEventListener("mousemove",te.mousedrag)),W.cancel(Le)},ge=function(Le){return z(Le),Le.preventDefault(),W.cancel(Le)},Ue=function(Le){Le.buttons&&z(Le)},Me=function(Le){Le.buttons||z(Le)};this.register(this._coreMouseService.onProtocolChange(function(Le){Le?(W.optionsService.options.logLevel==="debug"&&W._logService.debug("Binding to mouse events:",W._coreMouseService.explainEvents(Le)),W.element.classList.add("enable-mouse-events"),W._selectionService.disable()):(W._logService.debug("Unbinding from mouse events."),W.element.classList.remove("enable-mouse-events"),W._selectionService.enable()),8&Le?te.mousemove||(K.addEventListener("mousemove",Me),te.mousemove=Me):(K.removeEventListener("mousemove",te.mousemove),te.mousemove=null),16&Le?te.wheel||(K.addEventListener("wheel",ge,{passive:!1}),te.wheel=ge):(K.removeEventListener("wheel",te.wheel),te.wheel=null),2&Le?te.mouseup||(te.mouseup=de):(W._document.removeEventListener("mouseup",te.mouseup),te.mouseup=null),4&Le?te.mousedrag||(te.mousedrag=Ue):(W._document.removeEventListener("mousemove",te.mousedrag),te.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(r.addDisposableDomListener(K,"mousedown",function(Le){if(Le.preventDefault(),W.focus(),W._coreMouseService.areMouseEventsActive&&!W._selectionService.shouldForceSelection(Le))return z(Le),te.mouseup&&W._document.addEventListener("mouseup",te.mouseup),te.mousedrag&&W._document.addEventListener("mousemove",te.mousedrag),W.cancel(Le)})),this.register(r.addDisposableDomListener(K,"wheel",function(Le){if(!te.wheel){if(!W.buffer.hasScrollback){var Oe=W.viewport.getLinesScrolled(Le);if(Oe===0)return;for(var Fe=p.C0.ESC+(W._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Le.deltaY<0?"A":"B"),ye="",Ae=0;Ae<Math.abs(Oe);Ae++)ye+=Fe;W._coreService.triggerDataEvent(ye,!0)}}},{passive:!0})),this.register(r.addDisposableDomListener(K,"wheel",function(Le){if(!te.wheel)return W.viewport.onWheel(Le)?void 0:W.cancel(Le)},{passive:!1})),this.register(r.addDisposableDomListener(K,"touchstart",function(Le){if(!W._coreMouseService.areMouseEventsActive)return W.viewport.onTouchStart(Le),W.cancel(Le)},{passive:!0})),this.register(r.addDisposableDomListener(K,"touchmove",function(Le){if(!W._coreMouseService.areMouseEventsActive)return W.viewport.onTouchMove(Le)?void 0:W.cancel(Le)},{passive:!1}))},F.prototype.refresh=function(W,U){var K;(K=this._renderService)===null||K===void 0||K.refreshRows(W,U)},F.prototype._queueLinkification=function(W,U){var K;(K=this.linkifier)===null||K===void 0||K.linkifyRows(W,U)},F.prototype.updateCursorStyle=function(W){this._selectionService&&this._selectionService.shouldColumnSelect(W)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},F.prototype._showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},F.prototype.scrollLines=function(W,U){H.prototype.scrollLines.call(this,W,U),this.refresh(0,this.rows-1)},F.prototype.paste=function(W){y.paste(W,this.textarea,this._coreService)},F.prototype.attachCustomKeyEventHandler=function(W){this._customKeyEventHandler=W},F.prototype.registerLinkMatcher=function(W,U,K){var z=this.linkifier.registerLinkMatcher(W,U,K);return this.refresh(0,this.rows-1),z},F.prototype.deregisterLinkMatcher=function(W){this.linkifier.deregisterLinkMatcher(W)&&this.refresh(0,this.rows-1)},F.prototype.registerLinkProvider=function(W){return this.linkifier2.registerLinkProvider(W)},F.prototype.registerCharacterJoiner=function(W){var U=this._renderService.registerCharacterJoiner(W);return this.refresh(0,this.rows-1),U},F.prototype.deregisterCharacterJoiner=function(W){this._renderService.deregisterCharacterJoiner(W)&&this.refresh(0,this.rows-1)},Object.defineProperty(F.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!1,configurable:!0}),F.prototype.addMarker=function(W){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+W)},F.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},F.prototype.select=function(W,U,K){this._selectionService.setSelection(W,U,K)},F.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},F.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]}},F.prototype.clearSelection=function(){var W;(W=this._selectionService)===null||W===void 0||W.clearSelection()},F.prototype.selectAll=function(){var W;(W=this._selectionService)===null||W===void 0||W.selectAll()},F.prototype.selectLines=function(W,U){var K;(K=this._selectionService)===null||K===void 0||K.selectLines(W,U)},F.prototype._keyDown=function(W){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;if(!this._compositionHelper.keydown(W))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var U=w.evaluateKeyboardEvent(W,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(W),U.type===3||U.type===2){var K=this.rows-1;return this.scrollLines(U.type===2?-K:K),this.cancel(W,!0)}return U.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,W)||(U.cancel&&this.cancel(W,!0),!U.key||(U.key!==p.C0.ETX&&U.key!==p.C0.CR||(this.textarea.value=""),this._onKey.fire({key:U.key,domEvent:W}),this._showCursor(),this._coreService.triggerDataEvent(U.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(W,!0)))},F.prototype._isThirdLevelShift=function(W,U){var K=W.isMac&&!this.options.macOptionIsMeta&&U.altKey&&!U.ctrlKey&&!U.metaKey||W.isWindows&&U.altKey&&U.ctrlKey&&!U.metaKey;return U.type==="keypress"?K:K&&(!U.keyCode||U.keyCode>47)},F.prototype._keyUp=function(W){this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1||(function(U){return U.keyCode===16||U.keyCode===17||U.keyCode===18}(W)||this.focus(),this.updateCursorStyle(W))},F.prototype._keyPress=function(W){var U;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&this._customKeyEventHandler(W)===!1)return!1;if(this.cancel(W),W.charCode)U=W.charCode;else if(W.which===null||W.which===void 0)U=W.keyCode;else{if(W.which===0||W.charCode===0)return!1;U=W.which}return!(!U||(W.altKey||W.ctrlKey||W.metaKey)&&!this._isThirdLevelShift(this.browser,W))&&(U=String.fromCharCode(U),this._onKey.fire({key:U,domEvent:W}),this._showCursor(),this._coreService.triggerDataEvent(U,!0),!0)},F.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},F.prototype.resize=function(W,U){W!==this.cols||U!==this.rows?H.prototype.resize.call(this,W,U):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},F.prototype._afterResize=function(W,U){var K,z;(K=this._charSizeService)===null||K===void 0||K.measure(),(z=this.viewport)===null||z===void 0||z.syncScrollArea(!0)},F.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 W=1;W<this.rows;W++)this.buffer.lines.push(this.buffer.getBlankLine(T.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},F.prototype.reset=function(){var W,U;this.options.rows=this.rows,this.options.cols=this.cols;var K=this._customKeyEventHandler;this._setup(),H.prototype.reset.call(this),(W=this._selectionService)===null||W===void 0||W.reset(),this._customKeyEventHandler=K,this.refresh(0,this.rows-1),(U=this.viewport)===null||U===void 0||U.syncScrollArea()},F.prototype._reportWindowsOptions=function(W){if(this._renderService)switch(W){case u.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:var U=this._renderService.dimensions.scaledCanvasWidth.toFixed(0),K=this._renderService.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(p.C0.ESC+"[4;"+K+";"+U+"t");break;case u.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:var z=this._renderService.dimensions.scaledCellWidth.toFixed(0),te=this._renderService.dimensions.scaledCellHeight.toFixed(0);this._coreService.triggerDataEvent(p.C0.ESC+"[6;"+te+";"+z+"t")}},F.prototype.cancel=function(W,U){if(this.options.cancelEvents||U)return W.preventDefault(),W.stopPropagation(),!1},F.prototype._visualBell=function(){return!1},F.prototype._soundBell=function(){return this.options.bellStyle==="sound"},F}(I.CoreTerminal);k.Terminal=B},function(j,k,D){"use strict";var R=this&&this.__decorate||function(p,u,o,d){var s,l=arguments.length,r=l<3?u:d===null?d=Object.getOwnPropertyDescriptor(u,o):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(p,u,o,d);else for(var n=p.length-1;n>=0;n--)(s=p[n])&&(r=(l<3?s(r):l>3?s(u,o,r):s(u,o))||r);return l>3&&r&&Object.defineProperty(u,o,r),r},O=this&&this.__param||function(p,u){return function(o,d){u(o,d,p)}};Object.defineProperty(k,"__esModule",{value:!0}),k.CompositionHelper=void 0;var c=D(5),S=D(1),y=function(){function p(u,o,d,s,l,r){this._textarea=u,this._compositionView=o,this._bufferService=d,this._optionsService=s,this._charSizeService=l,this._coreService=r,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(u){var o=this;this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout(function(){o._compositionPosition.end=o._textarea.value.length},0)},p.prototype.compositionend=function(){this._finalizeComposition(!0)},p.prototype.keydown=function(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229)return!1;if(u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},p.prototype._finalizeComposition=function(u){var o=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){var d={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(d.start,d.end):o._textarea.value.substring(d.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 u=this,o=this._textarea.value;setTimeout(function(){if(!u._isComposing){var d=u._textarea.value.replace(o,"");d.length>0&&u._coreService.triggerDataEvent(d,!0)}},0)},p.prototype.updateCompositionElements=function(u){var o=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var d=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),s=this._bufferService.buffer.y*d,l=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=d+"px",this._compositionView.style.lineHeight=d+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var r=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=s+"px",this._textarea.style.width=r.width+"px",this._textarea.style.height=r.height+"px",this._textarea.style.lineHeight=r.height+"px"}u||setTimeout(function(){return o.updateCompositionElements(!0)},0)}},p=R([O(2,S.IBufferService),O(3,S.IOptionsService),O(4,c.ICharSizeService),O(5,S.ICoreService)],p)}();k.CompositionHelper=y},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)}),c=this&&this.__decorate||function(s,l,r,n){var a,i=arguments.length,h=i<3?l:n===null?n=Object.getOwnPropertyDescriptor(l,r):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,r,n);else for(var f=s.length-1;f>=0;f--)(a=s[f])&&(h=(i<3?a(h):i>3?a(l,r,h):a(l,r))||h);return i>3&&h&&Object.defineProperty(l,r,h),h},S=this&&this.__param||function(s,l){return function(r,n){l(r,n,s)}};Object.defineProperty(k,"__esModule",{value:!0}),k.Viewport=void 0;var y=D(2),p=D(7),u=D(5),o=D(1),d=function(s){function l(r,n,a,i,h,f,w){var m=s.call(this)||this;return m._scrollLines=r,m._viewportElement=n,m._scrollArea=a,m._bufferService=i,m._optionsService=h,m._charSizeService=f,m._renderService=w,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 O(l,s),l.prototype.onThemeChange=function(r){this._viewportElement.style.backgroundColor=r.background.css},l.prototype._refresh=function(r){var n=this;if(r)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return n._innerRefresh()}))},l.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var r=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==r&&(this._lastRecordedBufferHeight=r,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null},l.prototype.syncScrollArea=function(r){if(r===void 0&&(r=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(r);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===n&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(r)}else this._refresh(r)},l.prototype._onScroll=function(r){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var n=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(n,!0)}},l.prototype._bubbleScroll=function(r,n){var a=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(n<0&&this._viewportElement.scrollTop!==0||n>0&&a<this._lastRecordedBufferHeight)||(r.cancelable&&r.preventDefault(),!1)},l.prototype.onWheel=function(r){var n=this._getPixelsScrolled(r);return n!==0&&(this._viewportElement.scrollTop+=n,this._bubbleScroll(r,n))},l.prototype._getPixelsScrolled=function(r){if(r.deltaY===0)return 0;var n=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_LINE?n*=this._currentRowHeight:r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._currentRowHeight*this._bufferService.rows),n},l.prototype.getLinesScrolled=function(r){if(r.deltaY===0)return 0;var n=this._applyScrollModifier(r.deltaY,r);return r.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(n/=this._currentRowHeight+0,this._wheelPartialScroll+=n,n=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):r.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n},l.prototype._applyScrollModifier=function(r,n){var a=this._optionsService.options.fastScrollModifier;return a==="alt"&&n.altKey||a==="ctrl"&&n.ctrlKey||a==="shift"&&n.shiftKey?r*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:r*this._optionsService.options.scrollSensitivity},l.prototype.onTouchStart=function(r){this._lastTouchY=r.touches[0].pageY},l.prototype.onTouchMove=function(r){var n=this._lastTouchY-r.touches[0].pageY;return this._lastTouchY=r.touches[0].pageY,n!==0&&(this._viewportElement.scrollTop+=n,this._bubbleScroll(r,n))},l=c([S(3,o.IBufferService),S(4,o.IOptionsService),S(5,u.ICharSizeService),S(6,u.IRenderService)],l)}(y.Disposable);k.Viewport=d},function(j,k,D){"use strict";function R(y){return y.replace(/\r?\n/g,"\r")}function O(y,p){return p?"[200~"+y+"[201~":y}function c(y,p,u){y=O(y=R(y),u.decPrivateModes.bracketedPasteMode),u.triggerDataEvent(y,!0),p.value=""}function S(y,p,u){var o=u.getBoundingClientRect(),d=y.clientX-o.left-10,s=y.clientY-o.top-10;p.style.width="20px",p.style.height="20px",p.style.left=d+"px",p.style.top=s+"px",p.style.zIndex="1000",p.focus()}Object.defineProperty(k,"__esModule",{value:!0}),k.rightClickHandler=k.moveTextAreaUnderMouseCursor=k.paste=k.handlePasteEvent=k.copyHandler=k.bracketTextForPaste=k.prepareTextForTerminal=void 0,k.prepareTextForTerminal=R,k.bracketTextForPaste=O,k.copyHandler=function(y,p){y.clipboardData&&y.clipboardData.setData("text/plain",p.selectionText),y.preventDefault()},k.handlePasteEvent=function(y,p,u){y.stopPropagation(),y.clipboardData&&c(y.clipboardData.getData("text/plain"),p,u)},k.paste=c,k.moveTextAreaUnderMouseCursor=S,k.rightClickHandler=function(y,p,u,o,d){S(y,p,u),d&&!o.isClickInSelection(y)&&o.selectWordAtCursor(y),p.value=o.selectionText,p.select()}},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)});Object.defineProperty(k,"__esModule",{value:!0}),k.EscapeSequenceParser=k.VT500_TRANSITION_TABLE=k.TransitionTable=void 0;var c=D(2),S=D(15),y=D(21),p=D(22),u=D(24),o=function(){function s(l){this.table=new Uint8Array(l)}return s.prototype.setDefault=function(l,r){S.fill(this.table,l<<4|r)},s.prototype.add=function(l,r,n,a){this.table[r<<8|l]=n<<4|a},s.prototype.addMany=function(l,r,n,a){for(var i=0;i<l.length;i++)this.table[r<<8|l[i]]=n<<4|a},s}();k.TransitionTable=o,k.VT500_TRANSITION_TABLE=function(){var s=new o(4095),l=Array.apply(null,Array(256)).map(function(f,w){return w}),r=function(f,w){return l.slice(f,w)},n=r(32,127),a=r(0,24);a.push(25),a.push.apply(a,r(28,32));var i,h=r(0,14);for(i in s.setDefault(1,0),s.addMany(n,0,2,0),h)s.addMany([24,26,153,154],i,3,0),s.addMany(r(128,144),i,3,0),s.addMany(r(144,152),i,3,0),s.add(156,i,0,0),s.add(27,i,11,1),s.add(157,i,4,8),s.addMany([152,158,159],i,0,7),s.add(155,i,11,3),s.add(144,i,11,9);return s.addMany(a,0,3,0),s.addMany(a,1,3,1),s.add(127,1,0,1),s.addMany(a,8,0,8),s.addMany(a,3,3,3),s.add(127,3,0,3),s.addMany(a,4,3,4),s.add(127,4,0,4),s.addMany(a,6,3,6),s.addMany(a,5,3,5),s.add(127,5,0,5),s.addMany(a,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(n,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(r(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(n,7,0,7),s.addMany(a,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(r(64,127),3,7,0),s.addMany(r(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(r(48,60),4,8,4),s.addMany(r(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(r(32,64),6,0,6),s.add(127,6,0,6),s.addMany(r(64,127),6,0,0),s.addMany(r(32,48),3,9,5),s.addMany(r(32,48),5,9,5),s.addMany(r(48,64),5,0,6),s.addMany(r(64,127),5,7,0),s.addMany(r(32,48),4,9,5),s.addMany(r(32,48),1,9,2),s.addMany(r(32,48),2,9,2),s.addMany(r(48,127),2,10,0),s.addMany(r(48,80),1,10,0),s.addMany(r(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(r(96,127),1,10,0),s.add(80,1,11,9),s.addMany(a,9,0,9),s.add(127,9,0,9),s.addMany(r(28,32),9,0,9),s.addMany(r(32,48),9,9,12),s.addMany(r(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(a,11,0,11),s.addMany(r(32,128),11,0,11),s.addMany(r(28,32),11,0,11),s.addMany(a,10,0,10),s.add(127,10,0,10),s.addMany(r(28,32),10,0,10),s.addMany(r(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(r(32,48),10,9,12),s.addMany(a,12,0,12),s.add(127,12,0,12),s.addMany(r(28,32),12,0,12),s.addMany(r(32,48),12,9,12),s.addMany(r(48,64),12,0,11),s.addMany(r(64,127),12,12,13),s.addMany(r(64,127),10,12,13),s.addMany(r(64,127),9,12,13),s.addMany(a,13,13,13),s.addMany(n,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 d=function(s){function l(r){r===void 0&&(r=k.VT500_TRANSITION_TABLE);var n=s.call(this)||this;return n._transitions=r,n.initialState=0,n.currentState=n.initialState,n._params=new y.Params,n._params.addParam(0),n._collect=0,n.precedingCodepoint=0,n._printHandlerFb=function(a,i,h){},n._executeHandlerFb=function(a){},n._csiHandlerFb=function(a,i){},n._escHandlerFb=function(a){},n._errorHandlerFb=function(a){return a},n._printHandler=n._printHandlerFb,n._executeHandlers=Object.create(null),n._csiHandlers=Object.create(null),n._escHandlers=Object.create(null),n._oscParser=new p.OscParser,n._dcsParser=new u.DcsParser,n._errorHandler=n._errorHandlerFb,n.setEscHandler({final:"\\"},function(){}),n}return O(l,s),l.prototype._identifier=function(r,n){n===void 0&&(n=[64,126]);var a=0;if(r.prefix){if(r.prefix.length>1)throw new Error("only one byte as prefix supported");if((a=r.prefix.charCodeAt(0))&&60>a||a>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(r.intermediates){if(r.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var i=0;i<r.intermediates.length;++i){var h=r.intermediates.charCodeAt(i);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");a<<=8,a|=h}}if(r.final.length!==1)throw new Error("final must be a single byte");var f=r.final.charCodeAt(0);if(n[0]>f||f>n[1])throw new Error("final must be in range "+n[0]+" .. "+n[1]);return a<<=8,a|=f},l.prototype.identToString=function(r){for(var n=[];r;)n.push(String.fromCharCode(255&r)),r>>=8;return n.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(r){this._printHandler=r},l.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},l.prototype.addEscHandler=function(r,n){var a=this._identifier(r,[48,126]);this._escHandlers[a]===void 0&&(this._escHandlers[a]=[]);var i=this._escHandlers[a];return i.push(n),{dispose:function(){var h=i.indexOf(n);h!==-1&&i.splice(h,1)}}},l.prototype.setEscHandler=function(r,n){this._escHandlers[this._identifier(r,[48,126])]=[n]},l.prototype.clearEscHandler=function(r){this._escHandlers[this._identifier(r,[48,126])]&&delete this._escHandlers[this._identifier(r,[48,126])]},l.prototype.setEscHandlerFallback=function(r){this._escHandlerFb=r},l.prototype.setExecuteHandler=function(r,n){this._executeHandlers[r.charCodeAt(0)]=n},l.prototype.clearExecuteHandler=function(r){this._executeHandlers[r.charCodeAt(0)]&&delete this._executeHandlers[r.charCodeAt(0)]},l.prototype.setExecuteHandlerFallback=function(r){this._executeHandlerFb=r},l.prototype.addCsiHandler=function(r,n){var a=this._identifier(r);this._csiHandlers[a]===void 0&&(this._csiHandlers[a]=[]);var i=this._csiHandlers[a];return i.push(n),{dispose:function(){var h=i.indexOf(n);h!==-1&&i.splice(h,1)}}},l.prototype.setCsiHandler=function(r,n){this._csiHandlers[this._identifier(r)]=[n]},l.prototype.clearCsiHandler=function(r){this._csiHandlers[this._identifier(r)]&&delete this._csiHandlers[this._identifier(r)]},l.prototype.setCsiHandlerFallback=function(r){this._csiHandlerFb=r},l.prototype.addDcsHandler=function(r,n){return this._dcsParser.addHandler(this._identifier(r),n)},l.prototype.setDcsHandler=function(r,n){this._dcsParser.setHandler(this._identifier(r),n)},l.prototype.clearDcsHandler=function(r){this._dcsParser.clearHandler(this._identifier(r))},l.prototype.setDcsHandlerFallback=function(r){this._dcsParser.setHandlerFallback(r)},l.prototype.addOscHandler=function(r,n){return this._oscParser.addHandler(r,n)},l.prototype.setOscHandler=function(r,n){this._oscParser.setHandler(r,n)},l.prototype.clearOscHandler=function(r){this._oscParser.clearHandler(r)},l.prototype.setOscHandlerFallback=function(r){this._oscParser.setHandlerFallback(r)},l.prototype.setErrorHandler=function(r){this._errorHandler=r},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(r,n){for(var a=0,i=0,h=this.currentState,f=this._oscParser,w=this._dcsParser,m=this._collect,T=this._params,C=this._transitions.table,x=0;x<n;++x){switch((i=C[h<<8|((a=r[x])<160?a:160)])>>4){case 2:for(var b=x+1;;++b){if(b>=n||(a=r[b])<32||a>126&&a<160){this._printHandler(r,x,b),x=b-1;break}if(++b>=n||(a=r[b])<32||a>126&&a<160){this._printHandler(r,x,b),x=b-1;break}if(++b>=n||(a=r[b])<32||a>126&&a<160){this._printHandler(r,x,b),x=b-1;break}if(++b>=n||(a=r[b])<32||a>126&&a<160){this._printHandler(r,x,b),x=b-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:x,code:a,currentState:h,collect:m,params:T,abort:!1}).abort)return;break;case 7:for(var E=this._csiHandlers[m<<8|a],A=E?E.length-1:-1;A>=0&&E[A](T)===!1;A--);A<0&&this._csiHandlerFb(m<<8|a,T),this.precedingCodepoint=0;break;case 8:do switch(a){case 59:T.addParam(0);break;case 58:T.addSubParam(-1);break;default:T.addDigit(a-48)}while(++x<n&&(a=r[x])>47&&a<60);x--;break;case 9:m<<=8,m|=a;break;case 10:for(var v=this._escHandlers[m<<8|a],M=v?v.length-1:-1;M>=0&&v[M]()===!1;M--);M<0&&this._escHandlerFb(m<<8|a),this.precedingCodepoint=0;break;case 11:T.reset(),T.addParam(0),m=0;break;case 12:w.hook(m<<8|a,T);break;case 13:for(var I=x+1;;++I)if(I>=n||(a=r[I])===24||a===26||a===27||a>127&&a<160){w.put(r,x,I),x=I-1;break}break;case 14:w.unhook(a!==24&&a!==26),a===27&&(i|=1),T.reset(),T.addParam(0),m=0,this.precedingCodepoint=0;break;case 4:f.start();break;case 5:for(var P=x+1;;P++)if(P>=n||(a=r[P])<32||a>127&&a<=159){f.put(r,x,P),x=P-1;break}break;case 6:f.end(a!==24&&a!==26),a===27&&(i|=1),T.reset(),T.addParam(0),m=0,this.precedingCodepoint=0}h=15&i}this._collect=m,this.currentState=h},l}(c.Disposable);k.EscapeSequenceParser=d},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(f,w){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,T){m.__proto__=T}||function(m,T){for(var C in T)T.hasOwnProperty(C)&&(m[C]=T[C])})(f,w)},function(f,w){function m(){this.constructor=f}R(f,w),f.prototype=w===null?Object.create(w):(m.prototype=w.prototype,new m)}),c=this&&this.__decorate||function(f,w,m,T){var C,x=arguments.length,b=x<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,m):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(f,w,m,T);else for(var E=f.length-1;E>=0;E--)(C=f[E])&&(b=(x<3?C(b):x>3?C(w,m,b):C(w,m))||b);return x>3&&b&&Object.defineProperty(w,m,b),b},S=this&&this.__param||function(f,w){return function(m,T){w(m,T,f)}};Object.defineProperty(k,"__esModule",{value:!0}),k.Renderer=void 0;var y=D(41),p=D(47),u=D(48),o=D(49),d=D(29),s=D(2),l=D(5),r=D(1),n=D(25),a=D(0),i=1,h=function(f){function w(m,T,C,x,b,E,A,v,M){var I=f.call(this)||this;I._colors=m,I._screenElement=T,I._bufferService=b,I._charSizeService=E,I._optionsService=A,I._id=i++,I._onRequestRedraw=new a.EventEmitter;var P=I._optionsService.options.allowTransparency;return I._characterJoinerRegistry=new d.CharacterJoinerRegistry(I._bufferService),I._renderLayers=[new y.TextRenderLayer(I._screenElement,0,I._colors,I._characterJoinerRegistry,P,I._id,I._bufferService,A),new p.SelectionRenderLayer(I._screenElement,1,I._colors,I._id,I._bufferService,A),new o.LinkRenderLayer(I._screenElement,2,I._colors,I._id,C,x,I._bufferService,A),new u.CursorRenderLayer(I._screenElement,3,I._colors,I._id,I._onRequestRedraw,I._bufferService,A,v,M)],I.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},I._devicePixelRatio=window.devicePixelRatio,I._updateDimensions(),I.onOptionsChanged(),I}return O(w,f),Object.defineProperty(w.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),w.prototype.dispose=function(){for(var m=0,T=this._renderLayers;m<T.length;m++)T[m].dispose();f.prototype.dispose.call(this),n.removeTerminalFromCache(this._id)},w.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},w.prototype.setColors=function(m){this._colors=m;for(var T=0,C=this._renderLayers;T<C.length;T++){var x=C[T];x.setColors(this._colors),x.reset()}},w.prototype.onResize=function(m,T){this._updateDimensions();for(var C=0,x=this._renderLayers;C<x.length;C++)x[C].resize(this.dimensions);this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},w.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},w.prototype.onBlur=function(){this._runOperation(function(m){return m.onBlur()})},w.prototype.onFocus=function(){this._runOperation(function(m){return m.onFocus()})},w.prototype.onSelectionChanged=function(m,T,C){C===void 0&&(C=!1),this._runOperation(function(x){return x.onSelectionChanged(m,T,C)})},w.prototype.onCursorMove=function(){this._runOperation(function(m){return m.onCursorMove()})},w.prototype.onOptionsChanged=function(){this._runOperation(function(m){return m.onOptionsChanged()})},w.prototype.clear=function(){this._runOperation(function(m){return m.reset()})},w.prototype._runOperation=function(m){for(var T=0,C=this._renderLayers;T<C.length;T++)m(C[T])},w.prototype.renderRows=function(m,T){for(var C=0,x=this._renderLayers;C<x.length;C++)x[C].onGridChanged(m,T)},w.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)},w.prototype.registerCharacterJoiner=function(m){return this._characterJoinerRegistry.registerCharacterJoiner(m)},w.prototype.deregisterCharacterJoiner=function(m){return this._characterJoinerRegistry.deregisterCharacterJoiner(m)},w=c([S(4,r.IBufferService),S(5,l.ICharSizeService),S(6,r.IOptionsService),S(7,r.ICoreService),S(8,l.ICoreBrowserService)],w)}(s.Disposable);k.Renderer=h},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)});Object.defineProperty(k,"__esModule",{value:!0}),k.TextRenderLayer=void 0;var c=D(42),S=D(13),y=D(6),p=D(3),u=D(29),o=D(4),d=function(s){function l(r,n,a,i,h,f,w,m){var T=s.call(this,r,"text",n,h,a,f,w,m)||this;return T._characterWidth=0,T._characterFont="",T._characterOverlapCache={},T._workCell=new o.CellData,T._state=new c.GridCache,T._characterJoinerRegistry=i,T}return O(l,s),l.prototype.resize=function(r){s.prototype.resize.call(this,r);var n=this._getFont(!1,!1);this._characterWidth===r.scaledCharWidth&&this._characterFont===n||(this._characterWidth=r.scaledCharWidth,this._characterFont=n,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(r,n,a,i){for(var h=r;h<=n;h++)for(var f=h+this._bufferService.buffer.ydisp,w=this._bufferService.buffer.lines.get(f),m=a?a.getJoinedCharacters(f):[],T=0;T<this._bufferService.cols;T++){w.loadCell(T,this._workCell);var C=this._workCell,x=!1,b=T;if(C.getWidth()!==0){if(m.length>0&&T===m[0][0]){x=!0;var E=m.shift();C=new u.JoinedCellData(this._workCell,w.translateToString(!0,E[0],E[1]),E[1]-E[0]),b=E[1]-1}!x&&this._isOverlapping(C)&&b<w.length-1&&w.getCodePoint(b+1)===p.NULL_CELL_CODE&&(C.content&=-12582913,C.content|=2<<22),i(C,T,h),T=b}}},l.prototype._drawBackground=function(r,n){var a=this,i=this._ctx,h=this._bufferService.cols,f=0,w=0,m=null;i.save(),this._forEachCell(r,n,null,function(T,C,x){var b=null;T.isInverse()?b=T.isFgDefault()?a._colors.foreground.css:T.isFgRGB()?"rgb("+y.AttributeData.toColorRGB(T.getFgColor()).join(",")+")":a._colors.ansi[T.getFgColor()].css:T.isBgRGB()?b="rgb("+y.AttributeData.toColorRGB(T.getBgColor()).join(",")+")":T.isBgPalette()&&(b=a._colors.ansi[T.getBgColor()].css),m===null&&(f=C,w=x),x!==w?(i.fillStyle=m||"",a._fillCells(f,w,h-f,1),f=C,w=x):m!==b&&(i.fillStyle=m||"",a._fillCells(f,w,C-f,1),f=C,w=x),m=b}),m!==null&&(i.fillStyle=m,this._fillCells(f,w,h-f,1)),i.restore()},l.prototype._drawForeground=function(r,n){var a=this;this._forEachCell(r,n,this._characterJoinerRegistry,function(i,h,f){if(!i.isInvisible()&&(a._drawChars(i,h,f),i.isUnderline())){if(a._ctx.save(),i.isInverse())if(i.isBgDefault())a._ctx.fillStyle=a._colors.background.css;else if(i.isBgRGB())a._ctx.fillStyle="rgb("+y.AttributeData.toColorRGB(i.getBgColor()).join(",")+")";else{var w=i.getBgColor();a._optionsService.options.drawBoldTextInBrightColors&&i.isBold()&&w<8&&(w+=8),a._ctx.fillStyle=a._colors.ansi[w].css}else if(i.isFgDefault())a._ctx.fillStyle=a._colors.foreground.css;else if(i.isFgRGB())a._ctx.fillStyle="rgb("+y.AttributeData.toColorRGB(i.getFgColor()).join(",")+")";else{var m=i.getFgColor();a._optionsService.options.drawBoldTextInBrightColors&&i.isBold()&&m<8&&(m+=8),a._ctx.fillStyle=a._colors.ansi[m].css}a._fillBottomLineAtCells(h,f,i.getWidth()),a._ctx.restore()}})},l.prototype.onGridChanged=function(r,n){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,r,this._bufferService.cols,n-r+1),this._drawBackground(r,n),this._drawForeground(r,n))},l.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},l.prototype._isOverlapping=function(r){if(r.getWidth()!==1)return!1;if(r.getCode()<256)return!1;var n=r.getChars();if(this._characterOverlapCache.hasOwnProperty(n))return this._characterOverlapCache[n];this._ctx.save(),this._ctx.font=this._characterFont;var a=Math.floor(this._ctx.measureText(n).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[n]=a,a},l}(S.BaseRenderLayer);k.TextRenderLayer=d},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.GridCache=void 0;var R=function(){function O(){this.cache=[]}return O.prototype.resize=function(c,S){for(var y=0;y<c;y++){this.cache.length<=y&&this.cache.push([]);for(var p=this.cache[y].length;p<S;p++)this.cache[y].push(void 0);this.cache[y].length=S}this.cache.length=c},O.prototype.clear=function(){for(var c=0;c<this.cache.length;c++)for(var S=0;S<this.cache[c].length;S++)this.cache[c][S]=void 0},O}();k.GridCache=R},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(a,i){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var w in f)f.hasOwnProperty(w)&&(h[w]=f[w])})(a,i)},function(a,i){function h(){this.constructor=a}R(a,i),a.prototype=i===null?Object.create(i):(h.prototype=i.prototype,new h)});Object.defineProperty(k,"__esModule",{value:!0}),k.NoneCharAtlas=k.DynamicCharAtlas=k.getGlyphCacheKey=void 0;var c=D(9),S=D(44),y=D(27),p=D(46),u=D(11),o=D(28),d=D(10),s={css:"rgba(0, 0, 0, 0)",rgba:0};function l(a){return a.code<<21|a.bg<<12|a.fg<<3|(a.bold?0:4)+(a.dim?0:2)+(a.italic?0:1)}k.getGlyphCacheKey=l;var r=function(a){function i(h,f){var w=a.call(this)||this;w._config=f,w._drawToCacheCount=0,w._glyphsWaitingOnBitmap=[],w._bitmapCommitTimeout=null,w._bitmap=null,w._cacheCanvas=h.createElement("canvas"),w._cacheCanvas.width=1024,w._cacheCanvas.height=1024,w._cacheCtx=o.throwIfFalsy(w._cacheCanvas.getContext("2d",{alpha:!0}));var m=h.createElement("canvas");m.width=w._config.scaledCharWidth,m.height=w._config.scaledCharHeight,w._tmpCtx=o.throwIfFalsy(m.getContext("2d",{alpha:w._config.allowTransparency})),w._width=Math.floor(1024/w._config.scaledCharWidth),w._height=Math.floor(1024/w._config.scaledCharHeight);var T=w._width*w._height;return w._cacheMap=new p.LRUMap(T),w._cacheMap.prealloc(T),w}return O(i,a),i.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},i.prototype.beginFrame=function(){this._drawToCacheCount=0},i.prototype.draw=function(h,f,w,m){if(f.code===32)return!0;if(!this._canCache(f))return!1;var T=l(f),C=this._cacheMap.get(T);if(C!=null)return this._drawFromCache(h,C,w,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 b=this._drawToCache(f,x);return this._cacheMap.set(T,b),this._drawFromCache(h,b,w,m),!0}return!1},i.prototype._canCache=function(h){return h.code<256},i.prototype._toCoordinateX=function(h){return h%this._width*this._config.scaledCharWidth},i.prototype._toCoordinateY=function(h){return Math.floor(h/this._width)*this._config.scaledCharHeight},i.prototype._drawFromCache=function(h,f,w,m){if(!f.isEmpty){var T=this._toCoordinateX(f.index),C=this._toCoordinateY(f.index);h.drawImage(f.inBitmap?this._bitmap:this._cacheCanvas,T,C,this._config.scaledCharWidth,this._config.scaledCharHeight,w,m,this._config.scaledCharWidth,this._config.scaledCharHeight)}},i.prototype._getColorFromAnsiIndex=function(h){return h<this._config.colors.ansi.length?this._config.colors.ansi[h]:y.DEFAULT_ANSI_COLORS[h]},i.prototype._getBackgroundColor=function(h){return this._config.allowTransparency?s:h.bg===c.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:h.bg<256?this._getColorFromAnsiIndex(h.bg):this._config.colors.background},i.prototype._getForegroundColor=function(h){return h.fg===c.INVERTED_DEFAULT_COLOR?d.color.opaque(this._config.colors.background):h.fg<256?this._getColorFromAnsiIndex(h.fg):this._config.colors.foreground},i.prototype._drawToCache=function(h,f){this._drawToCacheCount++,this._tmpCtx.save();var w=this._getBackgroundColor(h);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=w.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,T=h.italic?"italic":"";this._tmpCtx.font=T+" "+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=c.DIM_OPACITY),this._tmpCtx.fillText(h.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var C=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),x=!1;this._config.allowTransparency||(x=function(v,M){for(var I=!0,P=M.rgba>>>24,B=M.rgba>>>16&255,H=M.rgba>>>8&255,F=0;F<v.data.length;F+=4)v.data[F]===P&&v.data[F+1]===B&&v.data[F+2]===H?v.data[F+3]=0:I=!1;return I}(C,w));var b=this._toCoordinateX(f),E=this._toCoordinateY(f);this._cacheCtx.putImageData(C,b,E);var A={index:f,isEmpty:x,inBitmap:!1};return this._addGlyphToBitmap(A),A},i.prototype._addGlyphToBitmap=function(h){var f=this;!("createImageBitmap"in window)||u.isFirefox||u.isSafari||(this._glyphsWaitingOnBitmap.push(h),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return f._generateBitmap()},100)))},i.prototype._generateBitmap=function(){var h=this,f=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(w){h._bitmap=w;for(var m=0;m<f.length;m++)f[m].inBitmap=!0}),this._bitmapCommitTimeout=null},i}(S.BaseCharAtlas);k.DynamicCharAtlas=r;var n=function(a){function i(h,f){return a.call(this)||this}return O(i,a),i.prototype.draw=function(h,f,w,m){return!1},i}(S.BaseCharAtlas);k.NoneCharAtlas=n},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.BaseCharAtlas=void 0;var R=function(){function O(){this._didWarmUp=!1}return O.prototype.dispose=function(){},O.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},O.prototype._doWarmUp=function(){},O.prototype.beginFrame=function(){},O}();k.BaseCharAtlas=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.ColorContrastCache=void 0;var R=function(){function O(){this._color={},this._rgba={}}return O.prototype.clear=function(){this._color={},this._rgba={}},O.prototype.setCss=function(c,S,y){this._rgba[c]||(this._rgba[c]={}),this._rgba[c][S]=y},O.prototype.getCss=function(c,S){return this._rgba[c]?this._rgba[c][S]:void 0},O.prototype.setColor=function(c,S,y){this._color[c]||(this._color[c]={}),this._color[c][S]=y},O.prototype.getColor=function(c,S){return this._color[c]?this._color[c][S]:void 0},O}();k.ColorContrastCache=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.LRUMap=void 0;var R=function(){function O(c){this.capacity=c,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return O.prototype._unlinkNode=function(c){var S=c.prev,y=c.next;c===this._head&&(this._head=y),c===this._tail&&(this._tail=S),S!==null&&(S.next=y),y!==null&&(y.prev=S)},O.prototype._appendNode=function(c){var S=this._tail;S!==null&&(S.next=c),c.prev=S,c.next=null,this._tail=c,this._head===null&&(this._head=c)},O.prototype.prealloc=function(c){for(var S=this._nodePool,y=0;y<c;y++)S.push({prev:null,next:null,key:null,value:null})},O.prototype.get=function(c){var S=this._map[c];return S!==void 0?(this._unlinkNode(S),this._appendNode(S),S.value):null},O.prototype.peekValue=function(c){var S=this._map[c];return S!==void 0?S.value:null},O.prototype.peek=function(){var c=this._head;return c===null?null:c.value},O.prototype.set=function(c,S){var y=this._map[c];if(y!==void 0)y=this._map[c],this._unlinkNode(y),y.value=S;else if(this.size>=this.capacity)y=this._head,this._unlinkNode(y),delete this._map[y.key],y.key=c,y.value=S,this._map[c]=y;else{var p=this._nodePool;p.length>0?((y=p.pop()).key=c,y.value=S):y={prev:null,next:null,key:c,value:S},this._map[c]=y,this.size++}this._appendNode(y)},O}();k.LRUMap=R},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(S,y){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,u){p.__proto__=u}||function(p,u){for(var o in u)u.hasOwnProperty(o)&&(p[o]=u[o])})(S,y)},function(S,y){function p(){this.constructor=S}R(S,y),S.prototype=y===null?Object.create(y):(p.prototype=y.prototype,new p)});Object.defineProperty(k,"__esModule",{value:!0}),k.SelectionRenderLayer=void 0;var c=function(S){function y(p,u,o,d,s,l){var r=S.call(this,p,"selection",u,!0,o,d,s,l)||this;return r._clearState(),r}return O(y,S),y.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},y.prototype.resize=function(p){S.prototype.resize.call(this,p),this._clearState()},y.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},y.prototype.onSelectionChanged=function(p,u,o){if(this._didStateChange(p,u,o,this._bufferService.buffer.ydisp))if(this._clearAll(),p&&u){var d=p[1]-this._bufferService.buffer.ydisp,s=u[1]-this._bufferService.buffer.ydisp,l=Math.max(d,0),r=Math.min(s,this._bufferService.rows-1);if(!(l>=this._bufferService.rows||r<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,o){var n=p[0],a=u[0]-n,i=r-l+1;this._fillCells(n,l,a,i)}else{n=d===l?p[0]:0;var h=l===r?u[0]:this._bufferService.cols;this._fillCells(n,l,h-n,1);var f=Math.max(r-l-1,0);if(this._fillCells(0,l+1,this._bufferService.cols,f),l!==r){var w=s===r?u[0]:this._bufferService.cols;this._fillCells(0,r,w,1)}}this._state.start=[p[0],p[1]],this._state.end=[u[0],u[1]],this._state.columnSelectMode=o,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},y.prototype._didStateChange=function(p,u,o,d){return!this._areCoordinatesEqual(p,this._state.start)||!this._areCoordinatesEqual(u,this._state.end)||o!==this._state.columnSelectMode||d!==this._state.ydisp},y.prototype._areCoordinatesEqual=function(p,u){return!(!p||!u)&&p[0]===u[0]&&p[1]===u[1]},y}(D(13).BaseRenderLayer);k.SelectionRenderLayer=c},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(u,o){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,s){d.__proto__=s}||function(d,s){for(var l in s)s.hasOwnProperty(l)&&(d[l]=s[l])})(u,o)},function(u,o){function d(){this.constructor=u}R(u,o),u.prototype=o===null?Object.create(o):(d.prototype=o.prototype,new d)});Object.defineProperty(k,"__esModule",{value:!0}),k.CursorRenderLayer=void 0;var c=D(13),S=D(4),y=function(u){function o(d,s,l,r,n,a,i,h,f){var w=u.call(this,d,"cursor",s,!0,l,r,a,i)||this;return w._onRequestRedraw=n,w._coreService=h,w._coreBrowserService=f,w._cell=new S.CellData,w._state={x:0,y:0,isFocused:!1,style:"",width:0},w._cursorRenderers={bar:w._renderBarCursor.bind(w),block:w._renderBlockCursor.bind(w),underline:w._renderUnderlineCursor.bind(w)},w}return O(o,u),o.prototype.resize=function(d){u.prototype.resize.call(this,d),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 d,s=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new p(this._coreBrowserService.isFocused,function(){s._render(!0)})):((d=this._cursorBlinkStateManager)===null||d===void 0||d.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(d,s){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},o.prototype._render=function(d){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 r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(s).loadCell(r,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&n!=="block"?this._cursorRenderers[n](r,l,this._cell):this._renderBlurCursor(r,l,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=l,this._state.isFocused=!1,this._state.style=n,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===r&&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"](r,l,this._cell),this._ctx.restore(),this._state.x=r,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(d,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(d,s,this._optionsService.options.cursorWidth),this._ctx.restore()},o.prototype._renderBlockCursor=function(d,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(d,s,l.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(l,d,s),this._ctx.restore()},o.prototype._renderUnderlineCursor=function(d,s,l){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(d,s),this._ctx.restore()},o.prototype._renderBlurCursor=function(d,s,l){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(d,s,l.getWidth(),1),this._ctx.restore()},o}(c.BaseRenderLayer);k.CursorRenderLayer=y;var p=function(){function u(o,d){this._renderCallback=d,this.isCursorVisible=!0,o&&this._restartInterval()}return Object.defineProperty(u.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),u.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)},u.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})))},u.prototype._restartInterval=function(o){var d=this;o===void 0&&(o=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(d._animationTimeRestarted){var s=600-(Date.now()-d._animationTimeRestarted);if(d._animationTimeRestarted=void 0,s>0)return void d._restartInterval(s)}d.isCursorVisible=!1,d._animationFrame=window.requestAnimationFrame(function(){d._renderCallback(),d._animationFrame=void 0}),d._blinkInterval=window.setInterval(function(){if(d._animationTimeRestarted){var l=600-(Date.now()-d._animationTimeRestarted);return d._animationTimeRestarted=void 0,void d._restartInterval(l)}d.isCursorVisible=!d.isCursorVisible,d._animationFrame=window.requestAnimationFrame(function(){d._renderCallback(),d._animationFrame=void 0})},600)},o)},u.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)},u.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},u}()},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(u,o){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,s){d.__proto__=s}||function(d,s){for(var l in s)s.hasOwnProperty(l)&&(d[l]=s[l])})(u,o)},function(u,o){function d(){this.constructor=u}R(u,o),u.prototype=o===null?Object.create(o):(d.prototype=o.prototype,new d)});Object.defineProperty(k,"__esModule",{value:!0}),k.LinkRenderLayer=void 0;var c=D(13),S=D(9),y=D(26),p=function(u){function o(d,s,l,r,n,a,i,h){var f=u.call(this,d,"link",s,!0,l,r,i,h)||this;return n.onShowLinkUnderline(function(w){return f._onShowLinkUnderline(w)}),n.onHideLinkUnderline(function(w){return f._onHideLinkUnderline(w)}),a.onShowLinkUnderline(function(w){return f._onShowLinkUnderline(w)}),a.onHideLinkUnderline(function(w){return f._onHideLinkUnderline(w)}),f}return O(o,u),o.prototype.resize=function(d){u.prototype.resize.call(this,d),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 d=this._state.y2-this._state.y1-1;d>0&&this._clearCells(0,this._state.y1+1,this._state.cols,d),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},o.prototype._onShowLinkUnderline=function(d){if(d.fg===S.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:d.fg&&y.is256Color(d.fg)?this._ctx.fillStyle=this._colors.ansi[d.fg].css:this._ctx.fillStyle=this._colors.foreground.css,d.y1===d.y2)this._fillBottomLineAtCells(d.x1,d.y1,d.x2-d.x1);else{this._fillBottomLineAtCells(d.x1,d.y1,d.cols-d.x1);for(var s=d.y1+1;s<d.y2;s++)this._fillBottomLineAtCells(0,s,d.cols);this._fillBottomLineAtCells(0,d.y2,d.x2)}this._state=d},o.prototype._onHideLinkUnderline=function(d){this._clearCurrentLink()},o}(c.BaseRenderLayer);k.LinkRenderLayer=p},function(j,k,D){"use strict";var R=this&&this.__decorate||function(u,o,d,s){var l,r=arguments.length,n=r<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,d):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(u,o,d,s);else for(var a=u.length-1;a>=0;a--)(l=u[a])&&(n=(r<3?l(n):r>3?l(o,d,n):l(o,d))||n);return r>3&&n&&Object.defineProperty(o,d,n),n},O=this&&this.__param||function(u,o){return function(d,s){o(d,s,u)}};Object.defineProperty(k,"__esModule",{value:!0}),k.MouseZone=k.Linkifier=void 0;var c=D(0),S=D(1),y=function(){function u(o,d,s){this._bufferService=o,this._logService=d,this._unicodeService=s,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new c.EventEmitter,this._onHideLinkUnderline=new c.EventEmitter,this._onLinkTooltip=new c.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(u.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),u.prototype.attachToDom=function(o,d){this._element=o,this._mouseZoneManager=d},u.prototype.linkifyRows=function(o,d){var s=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=o,this._rowsToLinkify.end=d):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,o),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,d)),this._mouseZoneManager.clearAll(o,d),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return s._linkifyRows()},u._timeBeforeLatency))},u.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var o=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var d=o.ydisp+this._rowsToLinkify.start;if(!(d>=o.lines.length)){for(var s=o.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,l=Math.ceil(2e3/this._bufferService.cols),r=this._bufferService.buffer.iterator(!1,d,s,l,l);r.hasNext();)for(var n=r.next(),a=0;a<this._linkMatchers.length;a++)this._doLinkifyRow(n.range.first,n.content,this._linkMatchers[a]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},u.prototype.registerLinkMatcher=function(o,d,s){if(s===void 0&&(s={}),!d)throw new Error("handler must be defined");var l={id:this._nextLinkMatcherId++,regex:o,handler:d,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},u.prototype._addLinkMatcherToList=function(o){if(this._linkMatchers.length!==0){for(var d=this._linkMatchers.length-1;d>=0;d--)if(o.priority<=this._linkMatchers[d].priority)return void this._linkMatchers.splice(d+1,0,o);this._linkMatchers.splice(0,0,o)}else this._linkMatchers.push(o)},u.prototype.deregisterLinkMatcher=function(o){for(var d=0;d<this._linkMatchers.length;d++)if(this._linkMatchers[d].id===o)return this._linkMatchers.splice(d,1),!0;return!1},u.prototype._doLinkifyRow=function(o,d,s){for(var l,r=this,n=new RegExp(s.regex.source,(s.regex.flags||"")+"g"),a=-1,i=function(){var f=l[typeof s.matchIndex!="number"?0:s.matchIndex];if(!f)return h._logService.debug("match found without corresponding matchIndex",l,s),"break";if(a=d.indexOf(f,a+1),n.lastIndex=a+f.length,a<0)return"break";var w=h._bufferService.buffer.stringIndexToBufferIndex(o,a);if(w[0]<0)return"break";var m=h._bufferService.buffer.lines.get(w[0]);if(!m)return"break";var T=m.getFg(w[1]),C=T?T>>9&511:void 0;s.validationCallback?s.validationCallback(f,function(x){r._rowsTimeoutId||x&&r._addLink(w[1],w[0]-r._bufferService.buffer.ydisp,f,s,C)}):h._addLink(w[1],w[0]-h._bufferService.buffer.ydisp,f,s,C)},h=this;(l=n.exec(d))!==null&&!(i()==="break"););},u.prototype._addLink=function(o,d,s,l,r){var n=this;if(this._mouseZoneManager&&this._element){var a=this._unicodeService.getStringCellWidth(s),i=o%this._bufferService.cols,h=d+Math.floor(o/this._bufferService.cols),f=(i+a)%this._bufferService.cols,w=h+Math.floor((i+a)/this._bufferService.cols);f===0&&(f=this._bufferService.cols,w--),this._mouseZoneManager.add(new p(i+1,h+1,f+1,w+1,function(m){if(l.handler)return l.handler(m,s);var T=window.open();T?(T.opener=null,T.location.href=s):console.warn("Opening link blocked as opener could not be cleared")},function(){n._onShowLinkUnderline.fire(n._createLinkHoverEvent(i,h,f,w,r)),n._element.classList.add("xterm-cursor-pointer")},function(m){n._onLinkTooltip.fire(n._createLinkHoverEvent(i,h,f,w,r)),l.hoverTooltipCallback&&l.hoverTooltipCallback(m,s,{start:{x:i,y:h},end:{x:f,y:w}})},function(){n._onHideLinkUnderline.fire(n._createLinkHoverEvent(i,h,f,w,r)),n._element.classList.remove("xterm-cursor-pointer"),l.hoverLeaveCallback&&l.hoverLeaveCallback()},function(m){return!l.willLinkActivate||l.willLinkActivate(m,s)}))}},u.prototype._createLinkHoverEvent=function(o,d,s,l,r){return{x1:o,y1:d,x2:s,y2:l,cols:this._bufferService.cols,fg:r}},u._timeBeforeLatency=200,u=R([O(0,S.IBufferService),O(1,S.ILogService),O(2,S.IUnicodeService)],u)}();k.Linkifier=y;var p=function(u,o,d,s,l,r,n,a,i){this.x1=u,this.y1=o,this.x2=d,this.y2=s,this.clickCallback=l,this.hoverCallback=r,this.tooltipCallback=n,this.leaveCallback=a,this.willLinkActivate=i};k.MouseZone=p},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(f,w){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,T){m.__proto__=T}||function(m,T){for(var C in T)T.hasOwnProperty(C)&&(m[C]=T[C])})(f,w)},function(f,w){function m(){this.constructor=f}R(f,w),f.prototype=w===null?Object.create(w):(m.prototype=w.prototype,new m)}),c=this&&this.__decorate||function(f,w,m,T){var C,x=arguments.length,b=x<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,m):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(f,w,m,T);else for(var E=f.length-1;E>=0;E--)(C=f[E])&&(b=(x<3?C(b):x>3?C(w,m,b):C(w,m))||b);return x>3&&b&&Object.defineProperty(w,m,b),b},S=this&&this.__param||function(f,w){return function(m,T){w(m,T,f)}};Object.defineProperty(k,"__esModule",{value:!0}),k.SelectionService=void 0;var y=D(11),p=D(52),u=D(4),o=D(0),d=D(5),s=D(1),l=D(30),r=D(53),n=D(2),a=String.fromCharCode(160),i=new RegExp(a,"g"),h=function(f){function w(m,T,C,x,b,E,A){var v=f.call(this)||this;return v._element=m,v._screenElement=T,v._bufferService=C,v._coreService=x,v._mouseService=b,v._optionsService=E,v._renderService=A,v._dragScrollAmount=0,v._enabled=!0,v._workCell=new u.CellData,v._mouseDownTimeStamp=0,v._onLinuxMouseSelection=v.register(new o.EventEmitter),v._onRedrawRequest=v.register(new o.EventEmitter),v._onSelectionChange=v.register(new o.EventEmitter),v._onRequestScrollLines=v.register(new o.EventEmitter),v._mouseMoveListener=function(M){return v._onMouseMove(M)},v._mouseUpListener=function(M){return v._onMouseUp(M)},v._coreService.onUserInput(function(){v.hasSelection&&v.clearSelection()}),v._trimListener=v._bufferService.buffer.lines.onTrim(function(M){return v._onTrim(M)}),v.register(v._bufferService.buffers.onBufferActivate(function(M){return v._onBufferActivate(M)})),v.enable(),v._model=new p.SelectionModel(v._bufferService),v._activeSelectionMode=0,v}return O(w,f),Object.defineProperty(w.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),w.prototype.dispose=function(){this._removeMouseDownListeners()},w.prototype.reset=function(){this.clearSelection()},w.prototype.disable=function(){this.clearSelection(),this._enabled=!1},w.prototype.enable=function(){this._enabled=!0},Object.defineProperty(w.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"hasSelection",{get:function(){var m=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!m||!T)&&(m[0]!==T[0]||m[1]!==T[1])},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"selectionText",{get:function(){var m=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!m||!T)return"";var C=this._bufferService.buffer,x=[];if(this._activeSelectionMode===3){if(m[0]===T[0])return"";for(var b=m[1];b<=T[1];b++){var E=C.translateBufferLineToString(b,!0,m[0],T[0]);x.push(E)}}else{var A=m[1]===T[1]?T[0]:void 0;for(x.push(C.translateBufferLineToString(m[1],!0,m[0],A)),b=m[1]+1;b<=T[1]-1;b++){var v=C.lines.get(b);E=C.translateBufferLineToString(b,!0),v&&v.isWrapped?x[x.length-1]+=E:x.push(E)}m[1]!==T[1]&&(v=C.lines.get(T[1]),E=C.translateBufferLineToString(T[1],!0,0,T[0]),v&&v.isWrapped?x[x.length-1]+=E:x.push(E))}return x.map(function(M){return M.replace(i," ")}).join(y.isWindows?`\r
|
|
|
`:`
|
|
|
`)},enumerable:!1,configurable:!0}),w.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},w.prototype.refresh=function(m){var T=this;(this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return T._refresh()})),y.isLinux&&m)&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},w.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},w.prototype.isClickInSelection=function(m){var T=this._getMouseBufferCoords(m),C=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!!(C&&x&&T)&&this._areCoordsInSelection(T,C,x)},w.prototype._areCoordsInSelection=function(m,T,C){return m[1]>T[1]&&m[1]<C[1]||T[1]===C[1]&&m[1]===T[1]&&m[0]>=T[0]&&m[0]<C[0]||T[1]<C[1]&&m[1]===C[1]&&m[0]<C[0]||T[1]<C[1]&&m[1]===T[1]&&m[0]>=T[0]},w.prototype.selectWordAtCursor=function(m){var T=this._getMouseBufferCoords(m);T&&(this._selectWordAt(T,!1),this._model.selectionEnd=void 0,this.refresh(!0))},w.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},w.prototype.selectLines=function(m,T){this._model.clearSelection(),m=Math.max(m,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,m],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()},w.prototype._onTrim=function(m){this._model.onTrim(m)&&this.refresh()},w.prototype._getMouseBufferCoords=function(m){var T=this._mouseService.getCoords(m,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T},w.prototype._getMouseEventScrollAmount=function(m){var T=l.getCoordsRelativeToElement(m,this._screenElement)[1],C=this._renderService.dimensions.canvasHeight;return T>=0&&T<=C?0:(T>C&&(T-=C),T=Math.min(Math.max(T,-50),50),(T/=50)/Math.abs(T)+Math.round(14*T))},w.prototype.shouldForceSelection=function(m){return y.isMac?m.altKey&&this._optionsService.options.macOptionClickForcesSelection:m.shiftKey},w.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)}},w.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)},w.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},w.prototype._onIncrementalClick=function(m){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(m))},w.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 T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},w.prototype._onDoubleClick=function(m){var T=this._getMouseBufferCoords(m);T&&(this._activeSelectionMode=1,this._selectWordAt(T,!0))},w.prototype._onTripleClick=function(m){var T=this._getMouseBufferCoords(m);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))},w.prototype.shouldColumnSelect=function(m){return m.altKey&&!(y.isMac&&this._optionsService.options.macOptionClickForcesSelection)},w.prototype._onMouseMove=function(m){if(m.stopImmediatePropagation(),this._model.selectionStart){var T=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 C=this._bufferService.buffer;if(this._model.selectionEnd[1]<C.lines.length){var x=C.lines.get(this._model.selectionEnd[1]);x&&x.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},w.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()}},w.prototype._onMouseUp=function(m){var T=m.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&m.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var C=this._mouseService.getCoords(m,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(C&&C[0]!==void 0&&C[1]!==void 0){var x=r.moveToCellSequence(C[0]-1,C[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(x,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},w.prototype._onBufferActivate=function(m){var T=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=m.activeBuffer.lines.onTrim(function(C){return T._onTrim(C)})},w.prototype._convertViewportColToCharacterIndex=function(m,T){for(var C=T[0],x=0;T[0]>=x;x++){var b=m.loadCell(x,this._workCell).getChars().length;this._workCell.getWidth()===0?C--:b>1&&T[0]!==x&&(C+=b-1)}return C},w.prototype.setSelection=function(m,T,C){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[m,T],this._model.selectionStartLength=C,this.refresh()},w.prototype._getWordAt=function(m,T,C,x){if(C===void 0&&(C=!0),x===void 0&&(x=!0),!(m[0]>=this._bufferService.cols)){var b=this._bufferService.buffer,E=b.lines.get(m[1]);if(E){var A=b.translateBufferLineToString(m[1],!1),v=this._convertViewportColToCharacterIndex(E,m),M=v,I=m[0]-v,P=0,B=0,H=0,F=0;if(A.charAt(v)===" "){for(;v>0&&A.charAt(v-1)===" ";)v--;for(;M<A.length&&A.charAt(M+1)===" ";)M++}else{var W=m[0],U=m[0];E.getWidth(W)===0&&(P++,W--),E.getWidth(U)===2&&(B++,U++);var K=E.getString(U).length;for(K>1&&(F+=K-1,M+=K-1);W>0&&v>0&&!this._isCharWordSeparator(E.loadCell(W-1,this._workCell));){E.loadCell(W-1,this._workCell);var z=this._workCell.getChars().length;this._workCell.getWidth()===0?(P++,W--):z>1&&(H+=z-1,v-=z-1),v--,W--}for(;U<E.length&&M+1<A.length&&!this._isCharWordSeparator(E.loadCell(U+1,this._workCell));){E.loadCell(U+1,this._workCell);var te=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,U++):te>1&&(F+=te-1,M+=te-1),M++,U++}}M++;var de=v+I-P+H,ge=Math.min(this._bufferService.cols,M-v+P+B-H-F);if(T||A.slice(v,M).trim()!==""){if(C&&de===0&&E.getCodePoint(0)!==32){var Ue=b.lines.get(m[1]-1);if(Ue&&E.isWrapped&&Ue.getCodePoint(this._bufferService.cols-1)!==32){var Me=this._getWordAt([this._bufferService.cols-1,m[1]-1],!1,!0,!1);if(Me){var Le=this._bufferService.cols-Me.start;de-=Le,ge+=Le}}}if(x&&de+ge===this._bufferService.cols&&E.getCodePoint(this._bufferService.cols-1)!==32){var Oe=b.lines.get(m[1]+1);if(Oe&&Oe.isWrapped&&Oe.getCodePoint(0)!==32){var Fe=this._getWordAt([0,m[1]+1],!1,!1,!0);Fe&&(ge+=Fe.length)}}return{start:de,length:ge}}}}},w.prototype._selectWordAt=function(m,T){var C=this._getWordAt(m,T);if(C){for(;C.start<0;)C.start+=this._bufferService.cols,m[1]--;this._model.selectionStart=[C.start,m[1]],this._model.selectionStartLength=C.length}},w.prototype._selectToWordAt=function(m){var T=this._getWordAt(m,!0);if(T){for(var C=m[1];T.start<0;)T.start+=this._bufferService.cols,C--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,C++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,C]}},w.prototype._isCharWordSeparator=function(m){return m.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(m.getChars())>=0},w.prototype._selectLineAt=function(m){var T=this._bufferService.buffer.getWrappedRangeForLine(m);this._model.selectionStart=[0,T.first],this._model.selectionEnd=[this._bufferService.cols,T.last],this._model.selectionStartLength=0},w=c([S(2,s.IBufferService),S(3,s.ICoreService),S(4,d.IMouseService),S(5,s.IOptionsService),S(6,d.IRenderService)],w)}(n.Disposable);k.SelectionService=h},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.SelectionModel=void 0;var R=function(){function O(c){this._bufferService=c,this.isSelectAllActive=!1,this.selectionStartLength=0}return O.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(O.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(O.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 c=this.selectionStart[0]+this.selectionStartLength;return c>this._bufferService.cols?[c%this._bufferService.cols,this.selectionStart[1]+Math.floor(c/this._bufferService.cols)]:[c,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}),O.prototype.areSelectionValuesReversed=function(){var c=this.selectionStart,S=this.selectionEnd;return!(!c||!S)&&(c[1]>S[1]||c[1]===S[1]&&c[0]>S[0])},O.prototype.onTrim=function(c){return this.selectionStart&&(this.selectionStart[1]-=c),this.selectionEnd&&(this.selectionEnd[1]-=c),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},O}();k.SelectionModel=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.moveToCellSequence=void 0;var R=D(12);function O(o,d,s,l){var r=o-c(s,o),n=d-c(s,d);return u(Math.abs(r-n)-function(a,i,h){for(var f=0,w=a-c(h,a),m=i-c(h,i),T=0;T<Math.abs(w-m);T++){var C=S(a,i)==="A"?-1:1,x=h.buffer.lines.get(w+C*T);x&&x.isWrapped&&f++}return f}(o,d,s),p(S(o,d),l))}function c(o,d){for(var s=0,l=o.buffer.lines.get(d),r=l&&l.isWrapped;r&&d>=0&&d<o.rows;)s++,r=(l=o.buffer.lines.get(--d))&&l.isWrapped;return s}function S(o,d){return o>d?"A":"B"}function y(o,d,s,l,r,n){for(var a=o,i=d,h="";a!==s||i!==l;)a+=r?1:-1,r&&a>n.cols-1?(h+=n.buffer.translateBufferLineToString(i,!1,o,a),a=0,o=0,i++):!r&&a<0&&(h+=n.buffer.translateBufferLineToString(i,!1,0,o+1),o=a=n.cols-1,i--);return h+n.buffer.translateBufferLineToString(i,!1,o,a)}function p(o,d){var s=d?"O":"[";return R.C0.ESC+s+o}function u(o,d){o=Math.floor(o);for(var s="",l=0;l<o;l++)s+=d;return s}k.moveToCellSequence=function(o,d,s,l){var r,n=s.buffer.x,a=s.buffer.y;if(!s.buffer.hasScrollback)return function(h,f,w,m,T,C){return O(f,m,T,C).length===0?"":u(y(h,f,h,f-c(T,f),!1,T).length,p("D",C))}(n,a,0,d,s,l)+O(a,d,s,l)+function(h,f,w,m,T,C){var x;x=O(f,m,T,C).length>0?m-c(T,m):f;var b=m,E=function(A,v,M,I,P,B){var H;return H=O(M,I,P,B).length>0?I-c(P,I):v,A<M&&H<=I||A>=M&&H<I?"C":"D"}(h,f,w,m,T,C);return u(y(h,x,w,b,E==="C",T).length,p(E,C))}(n,a,o,d,s,l);if(a===d)return r=n>o?"D":"C",u(Math.abs(n-o),p(r,l));r=a>d?"D":"C";var i=Math.abs(a-d);return u(function(h,f){return f.cols-h}(a>d?o:n,s)+(i-1)*s.cols+1+((a>d?n:o)-1),p(r,l))}},function(j,k,D){"use strict";var R=this&&this.__decorate||function(y,p,u,o){var d,s=arguments.length,l=s<3?p:o===null?o=Object.getOwnPropertyDescriptor(p,u):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(y,p,u,o);else for(var r=y.length-1;r>=0;r--)(d=y[r])&&(l=(s<3?d(l):s>3?d(p,u,l):d(p,u))||l);return s>3&&l&&Object.defineProperty(p,u,l),l},O=this&&this.__param||function(y,p){return function(u,o){p(u,o,y)}};Object.defineProperty(k,"__esModule",{value:!0}),k.SoundService=void 0;var c=D(1),S=function(){function y(p){this._optionsService=p}return Object.defineProperty(y,"audioContext",{get:function(){if(!y._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;y._audioContext=new p}return y._audioContext},enumerable:!1,configurable:!0}),y.prototype.playBellSound=function(){var p=y.audioContext;if(p){var u=p.createBufferSource();p.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(o){u.buffer=o,u.connect(p.destination),u.start(0)})}},y.prototype._base64ToArrayBuffer=function(p){for(var u=window.atob(p),o=u.length,d=new Uint8Array(o),s=0;s<o;s++)d[s]=u.charCodeAt(s);return d.buffer},y.prototype._removeMimeType=function(p){return p.split(",")[1]},y=R([O(0,c.IOptionsService)],y)}();k.SoundService=S},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)}),c=this&&this.__decorate||function(s,l,r,n){var a,i=arguments.length,h=i<3?l:n===null?n=Object.getOwnPropertyDescriptor(l,r):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,r,n);else for(var f=s.length-1;f>=0;f--)(a=s[f])&&(h=(i<3?a(h):i>3?a(l,r,h):a(l,r))||h);return i>3&&h&&Object.defineProperty(l,r,h),h},S=this&&this.__param||function(s,l){return function(r,n){l(r,n,s)}};Object.defineProperty(k,"__esModule",{value:!0}),k.MouseZoneManager=void 0;var y=D(2),p=D(7),u=D(5),o=D(1),d=function(s){function l(r,n,a,i,h,f){var w=s.call(this)||this;return w._element=r,w._screenElement=n,w._bufferService=a,w._mouseService=i,w._selectionService=h,w._optionsService=f,w._zones=[],w._areZonesActive=!1,w._lastHoverCoords=[void 0,void 0],w._initialSelectionLength=0,w.register(p.addDisposableDomListener(w._element,"mousedown",function(m){return w._onMouseDown(m)})),w._mouseMoveListener=function(m){return w._onMouseMove(m)},w._mouseLeaveListener=function(m){return w._onMouseLeave(m)},w._clickListener=function(m){return w._onClick(m)},w}return O(l,s),l.prototype.dispose=function(){s.prototype.dispose.call(this),this._deactivate()},l.prototype.add=function(r){this._zones.push(r),this._zones.length===1&&this._activate()},l.prototype.clearAll=function(r,n){if(this._zones.length!==0){r&&n||(r=0,n=this._bufferService.rows-1);for(var a=0;a<this._zones.length;a++){var i=this._zones[a];(i.y1>r&&i.y1<=n+1||i.y2>r&&i.y2<=n+1||i.y1<r&&i.y2>n+1)&&(this._currentZone&&this._currentZone===i&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(a--,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(r){this._lastHoverCoords[0]===r.pageX&&this._lastHoverCoords[1]===r.pageY||(this._onHover(r),this._lastHoverCoords=[r.pageX,r.pageY])},l.prototype._onHover=function(r){var n=this,a=this._findZoneEventAt(r);a!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),a&&(this._currentZone=a,a.hoverCallback&&a.hoverCallback(r),this._tooltipTimeout=window.setTimeout(function(){return n._onTooltip(r)},this._optionsService.options.linkTooltipHoverDuration)))},l.prototype._onTooltip=function(r){this._tooltipTimeout=void 0;var n=this._findZoneEventAt(r);n&&n.tooltipCallback&&n.tooltipCallback(r)},l.prototype._onMouseDown=function(r){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var n=this._findZoneEventAt(r);(n==null?void 0:n.willLinkActivate(r))&&(r.preventDefault(),r.stopImmediatePropagation())}},l.prototype._onMouseLeave=function(r){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},l.prototype._onClick=function(r){var n=this._findZoneEventAt(r),a=this._getSelectionLength();n&&a===this._initialSelectionLength&&(n.clickCallback(r),r.preventDefault(),r.stopImmediatePropagation())},l.prototype._getSelectionLength=function(){var r=this._selectionService.selectionText;return r?r.length:0},l.prototype._findZoneEventAt=function(r){var n=this._mouseService.getCoords(r,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(n)for(var a=n[0],i=n[1],h=0;h<this._zones.length;h++){var f=this._zones[h];if(f.y1===f.y2){if(i===f.y1&&a>=f.x1&&a<f.x2)return f}else if(i===f.y1&&a>=f.x1||i===f.y2&&a<f.x2||i>f.y1&&i<f.y2)return f}},l=c([S(2,o.IBufferService),S(3,u.IMouseService),S(4,u.ISelectionService),S(5,o.IOptionsService)],l)}(y.Disposable);k.MouseZoneManager=d},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(l,r){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)a.hasOwnProperty(i)&&(n[i]=a[i])})(l,r)},function(l,r){function n(){this.constructor=l}R(l,r),l.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)});Object.defineProperty(k,"__esModule",{value:!0}),k.AccessibilityManager=void 0;var c=D(18),S=D(11),y=D(31),p=D(7),u=D(2),o=D(32),d=D(17),s=function(l){function r(n,a){var i=l.call(this)||this;i._terminal=n,i._renderService=a,i._liveRegionLineCount=0,i._charsToConsume=[],i._charsToAnnounce="",i._accessibilityTreeRoot=document.createElement("div"),i._accessibilityTreeRoot.classList.add("xterm-accessibility"),i._rowContainer=document.createElement("div"),i._rowContainer.classList.add("xterm-accessibility-tree"),i._rowContainer.setAttribute("role","list"),i._rowElements=[];for(var h=0;h<i._terminal.rows;h++)i._rowElements[h]=i._createAccessibilityTreeNode(),i._rowContainer.appendChild(i._rowElements[h]);if(i._topBoundaryFocusListener=function(f){return i._onBoundaryFocus(f,0)},i._bottomBoundaryFocusListener=function(f){return i._onBoundaryFocus(f,1)},i._rowElements[0].addEventListener("focus",i._topBoundaryFocusListener),i._rowElements[i._rowElements.length-1].addEventListener("focus",i._bottomBoundaryFocusListener),i._refreshRowsDimensions(),i._accessibilityTreeRoot.appendChild(i._rowContainer),i._renderRowsDebouncer=new y.RenderDebouncer(i._renderRows.bind(i)),i._refreshRows(),i._liveRegion=document.createElement("div"),i._liveRegion.classList.add("live-region"),i._liveRegion.setAttribute("aria-live","assertive"),i._accessibilityTreeRoot.appendChild(i._liveRegion),!i._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");return i._terminal.element.insertAdjacentElement("afterbegin",i._accessibilityTreeRoot),i.register(i._renderRowsDebouncer),i.register(i._terminal.onResize(function(f){return i._onResize(f.rows)})),i.register(i._terminal.onRender(function(f){return i._refreshRows(f.start,f.end)})),i.register(i._terminal.onScroll(function(){return i._refreshRows()})),i.register(i._terminal.onA11yChar(function(f){return i._onChar(f)})),i.register(i._terminal.onLineFeed(function(){return i._onChar(`
|
|
|
`)})),i.register(i._terminal.onA11yTab(function(f){return i._onTab(f)})),i.register(i._terminal.onKey(function(f){return i._onKey(f.key)})),i.register(i._terminal.onBlur(function(){return i._clearLiveRegion()})),i.register(i._renderService.onDimensionsChange(function(){return i._refreshRowsDimensions()})),i._screenDprMonitor=new o.ScreenDprMonitor,i.register(i._screenDprMonitor),i._screenDprMonitor.setListener(function(){return i._refreshRowsDimensions()}),i.register(p.addDisposableDomListener(window,"resize",function(){return i._refreshRowsDimensions()})),i}return O(r,l),r.prototype.dispose=function(){l.prototype.dispose.call(this),d.removeElementFromParent(this._accessibilityTreeRoot),this._rowElements.length=0},r.prototype._onBoundaryFocus=function(n,a){var i=n.target,h=this._rowElements[a===0?1:this._rowElements.length-2];if(i.getAttribute("aria-posinset")!==(a===0?"1":""+this._terminal.buffer.lines.length)&&n.relatedTarget===h){var f,w;if(a===0?(f=i,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(f=this._rowElements.shift(),w=i,this._rowContainer.removeChild(f)),f.removeEventListener("focus",this._topBoundaryFocusListener),w.removeEventListener("focus",this._bottomBoundaryFocusListener),a===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(a===0?-1:1),this._rowElements[a===0?1:this._rowElements.length-2].focus(),n.preventDefault(),n.stopImmediatePropagation()}},r.prototype._onResize=function(n){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var a=this._rowContainer.children.length;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);for(;this._rowElements.length>n;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},r.prototype._createAccessibilityTreeNode=function(){var n=document.createElement("div");return n.setAttribute("role","listitem"),n.tabIndex=-1,this._refreshRowDimensions(n),n},r.prototype._onTab=function(n){for(var a=0;a<n;a++)this._onChar(" ")},r.prototype._onChar=function(n){var a=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==n&&(this._charsToAnnounce+=n):this._charsToAnnounce+=n,n===`
|
|
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)),S.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){a._accessibilityTreeRoot.appendChild(a._liveRegion)},0))},r.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,S.isMac&&d.removeElementFromParent(this._liveRegion)},r.prototype._onKey=function(n){this._clearLiveRegion(),this._charsToConsume.push(n)},r.prototype._refreshRows=function(n,a){this._renderRowsDebouncer.refresh(n,a,this._terminal.rows)},r.prototype._renderRows=function(n,a){for(var i=this._terminal.buffer,h=i.lines.length.toString(),f=n;f<=a;f++){var w=i.translateBufferLineToString(i.ydisp+f,!0),m=(i.ydisp+f+1).toString(),T=this._rowElements[f];T&&(w.length===0?T.innerHTML=" ":T.textContent=w,T.setAttribute("aria-posinset",m),T.setAttribute("aria-setsize",h))}this._announceCharacters()},r.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var n=0;n<this._terminal.rows;n++)this._refreshRowDimensions(this._rowElements[n])}},r.prototype._refreshRowDimensions=function(n){n.style.height=this._renderService.dimensions.actualCellHeight+"px"},r.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},r}(u.Disposable);k.AccessibilityManager=s},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(i,h){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,w){f.__proto__=w}||function(f,w){for(var m in w)w.hasOwnProperty(m)&&(f[m]=w[m])})(i,h)},function(i,h){function f(){this.constructor=i}R(i,h),i.prototype=h===null?Object.create(h):(f.prototype=h.prototype,new f)}),c=this&&this.__decorate||function(i,h,f,w){var m,T=arguments.length,C=T<3?h:w===null?w=Object.getOwnPropertyDescriptor(h,f):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,h,f,w);else for(var x=i.length-1;x>=0;x--)(m=i[x])&&(C=(T<3?m(C):T>3?m(h,f,C):m(h,f))||C);return T>3&&C&&Object.defineProperty(h,f,C),C},S=this&&this.__param||function(i,h){return function(f,w){h(f,w,i)}};Object.defineProperty(k,"__esModule",{value:!0}),k.DomRenderer=void 0;var y=D(58),p=D(9),u=D(2),o=D(5),d=D(1),s=D(0),l=D(10),r=D(17),n=1,a=function(i){function h(f,w,m,T,C,x,b,E,A){var v=i.call(this)||this;return v._colors=f,v._element=w,v._screenElement=m,v._viewportElement=T,v._linkifier=C,v._linkifier2=x,v._charSizeService=b,v._optionsService=E,v._bufferService=A,v._terminalClass=n++,v._rowElements=[],v._rowContainer=document.createElement("div"),v._rowContainer.classList.add("xterm-rows"),v._rowContainer.style.lineHeight="normal",v._rowContainer.setAttribute("aria-hidden","true"),v._refreshRowElements(v._bufferService.cols,v._bufferService.rows),v._selectionContainer=document.createElement("div"),v._selectionContainer.classList.add("xterm-selection"),v._selectionContainer.setAttribute("aria-hidden","true"),v.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},v._updateDimensions(),v._injectCss(),v._rowFactory=new y.DomRendererRowFactory(document,v._optionsService,v._colors),v._element.classList.add("xterm-dom-renderer-owner-"+v._terminalClass),v._screenElement.appendChild(v._rowContainer),v._screenElement.appendChild(v._selectionContainer),v._linkifier.onShowLinkUnderline(function(M){return v._onLinkHover(M)}),v._linkifier.onHideLinkUnderline(function(M){return v._onLinkLeave(M)}),v._linkifier2.onShowLinkUnderline(function(M){return v._onLinkHover(M)}),v._linkifier2.onHideLinkUnderline(function(M){return v._onLinkLeave(M)}),v}return O(h,i),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),r.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),i.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 f=0,w=this._rowElements;f<w.length;f++){var m=w[f];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 T=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=T,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(f){this._colors=f,this._injectCss()},h.prototype._injectCss=function(){var f=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var w=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";w+=this._terminalSelector+" span:not(."+y.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+y.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+y.ITALIC_CLASS+" { font-style: italic;}",w+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",w+="@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+"; }}",w+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+y.CURSOR_CLASS+"."+y.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+y.CURSOR_CLASS+"."+y.CURSOR_BLINK_CLASS+":not(."+y.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+y.CURSOR_CLASS+"."+y.CURSOR_BLINK_CLASS+"."+y.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+y.CURSOR_CLASS+"."+y.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+y.CURSOR_CLASS+"."+y.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+y.CURSOR_CLASS+"."+y.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",w+=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,T){w+=f._terminalSelector+" .xterm-fg-"+T+" { color: "+m.css+"; }"+f._terminalSelector+" .xterm-bg-"+T+" { background-color: "+m.css+"; }"}),w+=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=w},h.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},h.prototype._refreshRowElements=function(f,w){for(var m=this._rowElements.length;m<=w;m++){var T=document.createElement("div");this._rowContainer.appendChild(T),this._rowElements.push(T)}for(;this._rowElements.length>w;)this._rowContainer.removeChild(this._rowElements.pop())},h.prototype.onResize=function(f,w){this._refreshRowElements(f,w),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(f,w,m){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(f&&w){var T=f[1]-this._bufferService.buffer.ydisp,C=w[1]-this._bufferService.buffer.ydisp,x=Math.max(T,0),b=Math.min(C,this._bufferService.rows-1);if(!(x>=this._bufferService.rows||b<0)){var E=document.createDocumentFragment();if(m)E.appendChild(this._createSelectionElement(x,f[0],w[0],b-x+1));else{var A=T===x?f[0]:0,v=x===b?w[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(x,A,v));var M=b-x-1;if(E.appendChild(this._createSelectionElement(x+1,0,this._bufferService.cols,M)),x!==b){var I=C===b?w[0]:this._bufferService.cols;E.appendChild(this._createSelectionElement(b,0,I))}}this._selectionContainer.appendChild(E)}}},h.prototype._createSelectionElement=function(f,w,m,T){T===void 0&&(T=1);var C=document.createElement("div");return C.style.height=T*this.dimensions.actualCellHeight+"px",C.style.top=f*this.dimensions.actualCellHeight+"px",C.style.left=w*this.dimensions.actualCellWidth+"px",C.style.width=this.dimensions.actualCellWidth*(m-w)+"px",C},h.prototype.onCursorMove=function(){},h.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},h.prototype.clear=function(){for(var f=0,w=this._rowElements;f<w.length;f++)w[f].innerHTML=""},h.prototype.renderRows=function(f,w){for(var m=this._bufferService.buffer.ybase+this._bufferService.buffer.y,T=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),C=this._optionsService.options.cursorBlink,x=f;x<=w;x++){var b=this._rowElements[x];b.innerHTML="";var E=x+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.lines.get(E),v=this._optionsService.options.cursorStyle;b.appendChild(this._rowFactory.createRow(A,E===m,v,T,C,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(f){return-1},h.prototype.deregisterCharacterJoiner=function(f){return!1},h.prototype._onLinkHover=function(f){this._setCellUnderline(f.x1,f.x2,f.y1,f.y2,f.cols,!0)},h.prototype._onLinkLeave=function(f){this._setCellUnderline(f.x1,f.x2,f.y1,f.y2,f.cols,!1)},h.prototype._setCellUnderline=function(f,w,m,T,C,x){for(;f!==w||m!==T;){var b=this._rowElements[m];if(!b)return;var E=b.children[f];E&&(E.style.textDecoration=x?"underline":"none"),++f>=C&&(f=0,m++)}},h=c([S(6,o.ICharSizeService),S(7,d.IOptionsService),S(8,d.IBufferService)],h)}(u.Disposable);k.DomRenderer=a},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.DomRendererRowFactory=k.CURSOR_STYLE_UNDERLINE_CLASS=k.CURSOR_STYLE_BAR_CLASS=k.CURSOR_STYLE_BLOCK_CLASS=k.CURSOR_BLINK_CLASS=k.CURSOR_CLASS=k.UNDERLINE_CLASS=k.ITALIC_CLASS=k.DIM_CLASS=k.BOLD_CLASS=void 0;var R=D(9),O=D(3),c=D(4),S=D(10);k.BOLD_CLASS="xterm-bold",k.DIM_CLASS="xterm-dim",k.ITALIC_CLASS="xterm-italic",k.UNDERLINE_CLASS="xterm-underline",k.CURSOR_CLASS="xterm-cursor",k.CURSOR_BLINK_CLASS="xterm-cursor-blink",k.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",k.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",k.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var y=function(){function u(o,d,s){this._document=o,this._optionsService=d,this._colors=s,this._workCell=new c.CellData}return u.prototype.setColors=function(o){this._colors=o},u.prototype.createRow=function(o,d,s,l,r,n,a){for(var i=this._document.createDocumentFragment(),h=0,f=Math.min(o.length,a)-1;f>=0;f--)if(o.loadCell(f,this._workCell).getCode()!==O.NULL_CELL_CODE||d&&f===l){h=f+1;break}for(f=0;f<h;f++){o.loadCell(f,this._workCell);var w=this._workCell.getWidth();if(w!==0){var m=this._document.createElement("span");if(w>1&&(m.style.width=n*w+"px"),d&&f===l)switch(m.classList.add(k.CURSOR_CLASS),r&&m.classList.add(k.CURSOR_BLINK_CLASS),s){case"bar":m.classList.add(k.CURSOR_STYLE_BAR_CLASS);break;case"underline":m.classList.add(k.CURSOR_STYLE_UNDERLINE_CLASS);break;default:m.classList.add(k.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&m.classList.add(k.BOLD_CLASS),this._workCell.isItalic()&&m.classList.add(k.ITALIC_CLASS),this._workCell.isDim()&&m.classList.add(k.DIM_CLASS),this._workCell.isUnderline()&&m.classList.add(k.UNDERLINE_CLASS),this._workCell.isInvisible()?m.textContent=O.WHITESPACE_CELL_CHAR:m.textContent=this._workCell.getChars()||O.WHITESPACE_CELL_CHAR;var T=this._workCell.getFgColor(),C=this._workCell.getFgColorMode(),x=this._workCell.getBgColor(),b=this._workCell.getBgColorMode(),E=!!this._workCell.isInverse();if(E){var A=T;T=x,x=A;var v=C;C=b,b=v}switch(C){case 16777216:case 33554432:this._workCell.isBold()&&T<8&&this._optionsService.options.drawBoldTextInBrightColors&&(T+=8),this._applyMinimumContrast(m,this._colors.background,this._colors.ansi[T])||m.classList.add("xterm-fg-"+T);break;case 50331648:var M=S.rgba.toColor(T>>16&255,T>>8&255,255&T);this._applyMinimumContrast(m,this._colors.background,M)||this._addStyle(m,"color:#"+p(T.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(m,this._colors.background,this._colors.foreground)||E&&m.classList.add("xterm-fg-"+R.INVERTED_DEFAULT_COLOR)}switch(b){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:E&&m.classList.add("xterm-bg-"+R.INVERTED_DEFAULT_COLOR)}i.appendChild(m)}}return i},u.prototype._applyMinimumContrast=function(o,d,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(d,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)},u.prototype._addStyle=function(o,d){o.setAttribute("style",""+(o.getAttribute("style")||"")+d+";")},u}();function p(u,o,d){for(;u.length<d;)u=o+u;return u}k.DomRendererRowFactory=y},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.evaluateKeyboardEvent=void 0;var R=D(12),O={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:["'",'"']};k.evaluateKeyboardEvent=function(c,S,y,p){var u={type:0,cancel:!1,key:void 0},o=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?u.key=S?R.C0.ESC+"OA":R.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?u.key=S?R.C0.ESC+"OD":R.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?u.key=S?R.C0.ESC+"OC":R.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(u.key=S?R.C0.ESC+"OB":R.C0.ESC+"[B");break;case 8:if(c.shiftKey){u.key=R.C0.BS;break}if(c.altKey){u.key=R.C0.ESC+R.C0.DEL;break}u.key=R.C0.DEL;break;case 9:if(c.shiftKey){u.key=R.C0.ESC+"[Z";break}u.key=R.C0.HT,u.cancel=!0;break;case 13:u.key=c.altKey?R.C0.ESC+R.C0.CR:R.C0.CR,u.cancel=!0;break;case 27:u.key=R.C0.ESC,c.altKey&&(u.key=R.C0.ESC+R.C0.ESC),u.cancel=!0;break;case 37:if(c.metaKey)break;o?(u.key=R.C0.ESC+"[1;"+(o+1)+"D",u.key===R.C0.ESC+"[1;3D"&&(u.key=R.C0.ESC+(y?"b":"[1;5D"))):u.key=S?R.C0.ESC+"OD":R.C0.ESC+"[D";break;case 39:if(c.metaKey)break;o?(u.key=R.C0.ESC+"[1;"+(o+1)+"C",u.key===R.C0.ESC+"[1;3C"&&(u.key=R.C0.ESC+(y?"f":"[1;5C"))):u.key=S?R.C0.ESC+"OC":R.C0.ESC+"[C";break;case 38:if(c.metaKey)break;o?(u.key=R.C0.ESC+"[1;"+(o+1)+"A",y||u.key!==R.C0.ESC+"[1;3A"||(u.key=R.C0.ESC+"[1;5A")):u.key=S?R.C0.ESC+"OA":R.C0.ESC+"[A";break;case 40:if(c.metaKey)break;o?(u.key=R.C0.ESC+"[1;"+(o+1)+"B",y||u.key!==R.C0.ESC+"[1;3B"||(u.key=R.C0.ESC+"[1;5B")):u.key=S?R.C0.ESC+"OB":R.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(u.key=R.C0.ESC+"[2~");break;case 46:u.key=o?R.C0.ESC+"[3;"+(o+1)+"~":R.C0.ESC+"[3~";break;case 36:u.key=o?R.C0.ESC+"[1;"+(o+1)+"H":S?R.C0.ESC+"OH":R.C0.ESC+"[H";break;case 35:u.key=o?R.C0.ESC+"[1;"+(o+1)+"F":S?R.C0.ESC+"OF":R.C0.ESC+"[F";break;case 33:c.shiftKey?u.type=2:u.key=R.C0.ESC+"[5~";break;case 34:c.shiftKey?u.type=3:u.key=R.C0.ESC+"[6~";break;case 112:u.key=o?R.C0.ESC+"[1;"+(o+1)+"P":R.C0.ESC+"OP";break;case 113:u.key=o?R.C0.ESC+"[1;"+(o+1)+"Q":R.C0.ESC+"OQ";break;case 114:u.key=o?R.C0.ESC+"[1;"+(o+1)+"R":R.C0.ESC+"OR";break;case 115:u.key=o?R.C0.ESC+"[1;"+(o+1)+"S":R.C0.ESC+"OS";break;case 116:u.key=o?R.C0.ESC+"[15;"+(o+1)+"~":R.C0.ESC+"[15~";break;case 117:u.key=o?R.C0.ESC+"[17;"+(o+1)+"~":R.C0.ESC+"[17~";break;case 118:u.key=o?R.C0.ESC+"[18;"+(o+1)+"~":R.C0.ESC+"[18~";break;case 119:u.key=o?R.C0.ESC+"[19;"+(o+1)+"~":R.C0.ESC+"[19~";break;case 120:u.key=o?R.C0.ESC+"[20;"+(o+1)+"~":R.C0.ESC+"[20~";break;case 121:u.key=o?R.C0.ESC+"[21;"+(o+1)+"~":R.C0.ESC+"[21~";break;case 122:u.key=o?R.C0.ESC+"[23;"+(o+1)+"~":R.C0.ESC+"[23~";break;case 123:u.key=o?R.C0.ESC+"[24;"+(o+1)+"~":R.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(y&&!p||!c.altKey||c.metaKey)y&&!c.altKey&&!c.ctrlKey&&c.metaKey?c.keyCode===65&&(u.type=1):c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?u.key=c.key:c.key&&c.ctrlKey&&c.key==="_"&&(u.key=R.C0.US);else{var d=O[c.keyCode],s=d&&d[c.shiftKey?1:0];if(s)u.key=R.C0.ESC+s;else if(c.keyCode>=65&&c.keyCode<=90){var l=c.ctrlKey?c.keyCode-64:c.keyCode+32;u.key=R.C0.ESC+String.fromCharCode(l)}}else c.keyCode>=65&&c.keyCode<=90?u.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?u.key=R.C0.NUL:c.keyCode>=51&&c.keyCode<=55?u.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?u.key=R.C0.DEL:c.keyCode===219?u.key=R.C0.ESC:c.keyCode===220?u.key=R.C0.FS:c.keyCode===221&&(u.key=R.C0.GS)}return u}},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(n,a){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,h){i.__proto__=h}||function(i,h){for(var f in h)h.hasOwnProperty(f)&&(i[f]=h[f])})(n,a)},function(n,a){function i(){this.constructor=n}R(n,a),n.prototype=a===null?Object.create(a):(i.prototype=a.prototype,new i)}),c=this&&this.__decorate||function(n,a,i,h){var f,w=arguments.length,m=w<3?a:h===null?h=Object.getOwnPropertyDescriptor(a,i):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(n,a,i,h);else for(var T=n.length-1;T>=0;T--)(f=n[T])&&(m=(w<3?f(m):w>3?f(a,i,m):f(a,i))||m);return w>3&&m&&Object.defineProperty(a,i,m),m},S=this&&this.__param||function(n,a){return function(i,h){a(i,h,n)}};Object.defineProperty(k,"__esModule",{value:!0}),k.RenderService=void 0;var y=D(31),p=D(0),u=D(2),o=D(32),d=D(7),s=D(1),l=D(5),r=function(n){function a(i,h,f,w,m,T){var C=n.call(this)||this;if(C._renderer=i,C._rowCount=h,C._isPaused=!1,C._needsFullRefresh=!1,C._isNextRenderRedrawOnly=!0,C._needsSelectionRefresh=!1,C._canvasWidth=0,C._canvasHeight=0,C._selectionState={start:void 0,end:void 0,columnSelectMode:!1},C._onDimensionsChange=new p.EventEmitter,C._onRender=new p.EventEmitter,C._onRefreshRequest=new p.EventEmitter,C.register({dispose:function(){return C._renderer.dispose()}}),C._renderDebouncer=new y.RenderDebouncer(function(b,E){return C._renderRows(b,E)}),C.register(C._renderDebouncer),C._screenDprMonitor=new o.ScreenDprMonitor,C._screenDprMonitor.setListener(function(){return C.onDevicePixelRatioChange()}),C.register(C._screenDprMonitor),C.register(T.onResize(function(b){return C._fullRefresh()})),C.register(w.onOptionChange(function(){return C._renderer.onOptionsChanged()})),C.register(m.onCharSizeChange(function(){return C.onCharSizeChanged()})),C._renderer.onRequestRedraw(function(b){return C.refreshRows(b.start,b.end,!0)}),C.register(d.addDisposableDomListener(window,"resize",function(){return C.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var x=new IntersectionObserver(function(b){return C._onIntersectionChange(b[b.length-1])},{threshold:0});x.observe(f),C.register({dispose:function(){return x.disconnect()}})}return C}return O(a,n),Object.defineProperty(a.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),a.prototype._onIntersectionChange=function(i){this._isPaused=i.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},a.prototype.refreshRows=function(i,h,f){f===void 0&&(f=!1),this._isPaused?this._needsFullRefresh=!0:(f||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(i,h,this._rowCount))},a.prototype._renderRows=function(i,h){this._renderer.renderRows(i,h),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:i,end:h}),this._isNextRenderRedrawOnly=!0},a.prototype.resize=function(i,h){this._rowCount=h,this._fireOnCanvasResize()},a.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},a.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},a.prototype.dispose=function(){n.prototype.dispose.call(this)},a.prototype.setRenderer=function(i){var h=this;this._renderer.dispose(),this._renderer=i,this._renderer.onRequestRedraw(function(f){return h.refreshRows(f.start,f.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},a.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},a.prototype.setColors=function(i){this._renderer.setColors(i),this._fullRefresh()},a.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},a.prototype.onResize=function(i,h){this._renderer.onResize(i,h),this._fullRefresh()},a.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},a.prototype.onBlur=function(){this._renderer.onBlur()},a.prototype.onFocus=function(){this._renderer.onFocus()},a.prototype.onSelectionChanged=function(i,h,f){this._selectionState.start=i,this._selectionState.end=h,this._selectionState.columnSelectMode=f,this._renderer.onSelectionChanged(i,h,f)},a.prototype.onCursorMove=function(){this._renderer.onCursorMove()},a.prototype.clear=function(){this._renderer.clear()},a.prototype.registerCharacterJoiner=function(i){return this._renderer.registerCharacterJoiner(i)},a.prototype.deregisterCharacterJoiner=function(i){return this._renderer.deregisterCharacterJoiner(i)},a=c([S(3,s.IOptionsService),S(4,l.ICharSizeService),S(5,s.IBufferService)],a)}(u.Disposable);k.RenderService=r},function(j,k,D){"use strict";var R=this&&this.__decorate||function(u,o,d,s){var l,r=arguments.length,n=r<3?o:s===null?s=Object.getOwnPropertyDescriptor(o,d):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(u,o,d,s);else for(var a=u.length-1;a>=0;a--)(l=u[a])&&(n=(r<3?l(n):r>3?l(o,d,n):l(o,d))||n);return r>3&&n&&Object.defineProperty(o,d,n),n},O=this&&this.__param||function(u,o){return function(d,s){o(d,s,u)}};Object.defineProperty(k,"__esModule",{value:!0}),k.CharSizeService=void 0;var c=D(1),S=D(0),y=function(){function u(o,d,s){this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=new S.EventEmitter,this._measureStrategy=new p(o,d,this._optionsService)}return Object.defineProperty(u.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),u.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())},u=R([O(2,c.IOptionsService)],u)}();k.CharSizeService=y;var p=function(){function u(o,d,s){this._document=o,this._parentElement=d,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 u.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},u}()},function(j,k,D){"use strict";var R=this&&this.__decorate||function(p,u,o,d){var s,l=arguments.length,r=l<3?u:d===null?d=Object.getOwnPropertyDescriptor(u,o):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(p,u,o,d);else for(var n=p.length-1;n>=0;n--)(s=p[n])&&(r=(l<3?s(r):l>3?s(u,o,r):s(u,o))||r);return l>3&&r&&Object.defineProperty(u,o,r),r},O=this&&this.__param||function(p,u){return function(o,d){u(o,d,p)}};Object.defineProperty(k,"__esModule",{value:!0}),k.MouseService=void 0;var c=D(5),S=D(30),y=function(){function p(u,o){this._renderService=u,this._charSizeService=o}return p.prototype.getCoords=function(u,o,d,s,l){return S.getCoords(u,o,d,s,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,l)},p.prototype.getRawByteCoords=function(u,o,d,s){var l=this.getCoords(u,o,d,s);return S.getRawByteCoords(l)},p=R([O(0,c.IRenderService),O(1,c.ICharSizeService)],p)}();k.MouseService=y},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)}),c=this&&this.__decorate||function(s,l,r,n){var a,i=arguments.length,h=i<3?l:n===null?n=Object.getOwnPropertyDescriptor(l,r):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,r,n);else for(var f=s.length-1;f>=0;f--)(a=s[f])&&(h=(i<3?a(h):i>3?a(l,r,h):a(l,r))||h);return i>3&&h&&Object.defineProperty(l,r,h),h},S=this&&this.__param||function(s,l){return function(r,n){l(r,n,s)}};Object.defineProperty(k,"__esModule",{value:!0}),k.Linkifier2=void 0;var y=D(1),p=D(0),u=D(2),o=D(7),d=function(s){function l(r){var n=s.call(this)||this;return n._bufferService=r,n._linkProviders=[],n._linkCacheDisposables=[],n._isMouseOut=!0,n._activeLine=-1,n._onShowLinkUnderline=n.register(new p.EventEmitter),n._onHideLinkUnderline=n.register(new p.EventEmitter),n.register(u.getDisposeArrayDisposable(n._linkCacheDisposables)),n}return O(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(r){var n=this;return this._linkProviders.push(r),{dispose:function(){var a=n._linkProviders.indexOf(r);a!==-1&&n._linkProviders.splice(a,1)}}},l.prototype.attachToDom=function(r,n,a){var i=this;this._element=r,this._mouseService=n,this._renderService=a,this.register(o.addDisposableDomListener(this._element,"mouseleave",function(){i._isMouseOut=!0,i._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(r){if(this._lastMouseEvent=r,this._element&&this._mouseService){var n=this._positionFromMouseEvent(r,this._element,this._mouseService);if(n){this._isMouseOut=!1;for(var a=r.composedPath(),i=0;i<a.length;i++){var h=a[i];if(h.classList.contains("xterm"))break;if(h.classList.contains("xterm-hover"))return}this._lastBufferCell&&n.x===this._lastBufferCell.x&&n.y===this._lastBufferCell.y||(this._onHover(n),this._lastBufferCell=n)}}},l.prototype._onHover=function(r){if(this._activeLine!==r.y)return this._clearCurrentLink(),void this._askForLink(r,!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,r)||(this._clearCurrentLink(),this._askForLink(r,!0))},l.prototype._askForLink=function(r,n){var a=this;this._activeProviderReplies&&n||(this._activeProviderReplies=new Map,this._activeLine=r.y);var i=!1;this._linkProviders.forEach(function(h,f){var w;n?((w=a._activeProviderReplies)===null||w===void 0?void 0:w.get(f))&&(i=a._checkLinkProviderResult(f,r,i)):h.provideLinks(r.y,function(m){var T,C;if(!a._isMouseOut){var x=m==null?void 0:m.map(function(b){return{link:b}});(T=a._activeProviderReplies)===null||T===void 0||T.set(f,x),i=a._checkLinkProviderResult(f,r,i),((C=a._activeProviderReplies)===null||C===void 0?void 0:C.size)===a._linkProviders.length&&a._removeIntersectingLinks(r.y,a._activeProviderReplies)}})})},l.prototype._removeIntersectingLinks=function(r,n){for(var a=new Set,i=0;i<n.size;i++){var h=n.get(i);if(h)for(var f=0;f<h.length;f++)for(var w=h[f],m=w.link.range.start.y<r?0:w.link.range.start.x,T=w.link.range.end.y>r?this._bufferService.cols:w.link.range.end.x,C=m;C<=T;C++){if(a.has(C)){h.splice(f--,1);break}a.add(C)}}},l.prototype._checkLinkProviderResult=function(r,n,a){var i,h=this;if(!this._activeProviderReplies)return a;for(var f=this._activeProviderReplies.get(r),w=!1,m=0;m<r;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(w=!0);if(!w&&f){var T=f.find(function(x){return h._linkAtPosition(x.link,n)});T&&(a=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviders.length&&!a)for(m=0;m<this._activeProviderReplies.size;m++){var C=(i=this._activeProviderReplies.get(m))===null||i===void 0?void 0:i.find(function(x){return h._linkAtPosition(x.link,n)});if(C){a=!0,this._handleNewLink(C);break}}return a},l.prototype._onClick=function(r){if(this._element&&this._mouseService&&this._currentLink){var n=this._positionFromMouseEvent(r,this._element,this._mouseService);n&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(r,this._currentLink.link.text)}},l.prototype._clearCurrentLink=function(r,n){this._element&&this._currentLink&&this._lastMouseEvent&&(!r||!n||this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=n)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,u.disposeArray(this._linkCacheDisposables))},l.prototype._handleNewLink=function(r){var n=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._linkAtPosition(r.link,a)&&(this._currentLink=r,this._currentLink.state={decorations:{underline:r.link.decorations===void 0||r.link.decorations.underline,pointerCursor:r.link.decorations===void 0||r.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,r.link,this._lastMouseEvent),r.link.decorations={},Object.defineProperties(r.link.decorations,{pointerCursor:{get:function(){var i,h;return(h=(i=n._currentLink)===null||i===void 0?void 0:i.state)===null||h===void 0?void 0:h.decorations.pointerCursor},set:function(i){var h,f;((h=n._currentLink)===null||h===void 0?void 0:h.state)&&n._currentLink.state.decorations.pointerCursor!==i&&(n._currentLink.state.decorations.pointerCursor=i,n._currentLink.state.isHovered&&((f=n._element)===null||f===void 0||f.classList.toggle("xterm-cursor-pointer",i)))}},underline:{get:function(){var i,h;return(h=(i=n._currentLink)===null||i===void 0?void 0:i.state)===null||h===void 0?void 0:h.decorations.underline},set:function(i){var h,f,w;((h=n._currentLink)===null||h===void 0?void 0:h.state)&&((w=(f=n._currentLink)===null||f===void 0?void 0:f.state)===null||w===void 0?void 0:w.decorations.underline)!==i&&(n._currentLink.state.decorations.underline=i,n._currentLink.state.isHovered&&n._fireUnderlineEvent(r.link,i))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(i){var h=i.start===0?0:i.start+1+n._bufferService.buffer.ydisp;n._clearCurrentLink(h,i.end+1+n._bufferService.buffer.ydisp)})))}},l.prototype._linkHover=function(r,n,a){var i;((i=this._currentLink)===null||i===void 0?void 0:i.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!0),this._currentLink.state.decorations.pointerCursor&&r.classList.add("xterm-cursor-pointer")),n.hover&&n.hover(a,n.text)},l.prototype._fireUnderlineEvent=function(r,n){var a=r.range,i=this._bufferService.buffer.ydisp,h=this._createLinkUnderlineEvent(a.start.x-1,a.start.y-i-1,a.end.x,a.end.y-i-1,void 0);(n?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(h)},l.prototype._linkLeave=function(r,n,a){var i;((i=this._currentLink)===null||i===void 0?void 0:i.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!1),this._currentLink.state.decorations.pointerCursor&&r.classList.remove("xterm-cursor-pointer")),n.leave&&n.leave(a,n.text)},l.prototype._linkAtPosition=function(r,n){var a=r.range.start.y===r.range.end.y,i=r.range.start.y<n.y,h=r.range.end.y>n.y;return(a&&r.range.start.x<=n.x&&r.range.end.x>=n.x||i&&r.range.end.x>=n.x||h&&r.range.start.x<=n.x||i&&h)&&r.range.start.y<=n.y&&r.range.end.y>=n.y},l.prototype._positionFromMouseEvent=function(r,n,a){var i=a.getCoords(r,n,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}},l.prototype._createLinkUnderlineEvent=function(r,n,a,i,h){return{x1:r,y1:n,x2:a,y2:i,cols:this._bufferService.cols,fg:h}},l=c([S(0,y.IBufferService)],l)}(u.Disposable);k.Linkifier2=d},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.CoreBrowserService=void 0;var R=function(){function O(c){this._textarea=c}return Object.defineProperty(O.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),O}();k.CoreBrowserService=R},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(m,T){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var b in x)x.hasOwnProperty(b)&&(C[b]=x[b])})(m,T)},function(m,T){function C(){this.constructor=m}R(m,T),m.prototype=T===null?Object.create(T):(C.prototype=T.prototype,new C)});Object.defineProperty(k,"__esModule",{value:!0}),k.CoreTerminal=void 0;var c=D(2),S=D(1),y=D(66),p=D(67),u=D(68),o=D(74),d=D(75),s=D(0),l=D(76),r=D(77),n=D(78),a=D(80),i=D(81),h=D(19),f=D(82),w=function(m){function T(C){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 y.InstantiationService,x.optionsService=new o.OptionsService(C),x._instantiationService.setService(S.IOptionsService,x.optionsService),x._bufferService=x.register(x._instantiationService.createInstance(u.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(d.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(r.DirtyRowService),x._instantiationService.setService(S.IDirtyRowService,x._dirtyRowService),x.unicodeService=x._instantiationService.createInstance(n.UnicodeService),x._instantiationService.setService(S.IUnicodeService,x.unicodeService),x._charsetService=x._instantiationService.createInstance(a.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(b){return x._updateOptions(b)})),x._writeBuffer=new f.WriteBuffer(function(b){return x._inputHandler.parse(b)}),x}return O(T,m),Object.defineProperty(T.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!1,configurable:!0}),T.prototype.dispose=function(){var C;this._isDisposed||(m.prototype.dispose.call(this),(C=this._windowsMode)===null||C===void 0||C.dispose(),this._windowsMode=void 0)},T.prototype.write=function(C,x){this._writeBuffer.write(C,x)},T.prototype.writeSync=function(C){this._writeBuffer.writeSync(C)},T.prototype.resize=function(C,x){isNaN(C)||isNaN(x)||(C=Math.max(C,u.MINIMUM_COLS),x=Math.max(x,u.MINIMUM_ROWS),this._bufferService.resize(C,x))},T.prototype.scroll=function(C,x){x===void 0&&(x=!1);var b,E=this._bufferService.buffer;(b=this._cachedBlankLine)&&b.length===this.cols&&b.getFg(0)===C.fg&&b.getBg(0)===C.bg||(b=E.getBlankLine(C,x),this._cachedBlankLine=b),b.isWrapped=x;var A=E.ybase+E.scrollTop,v=E.ybase+E.scrollBottom;if(E.scrollTop===0){var M=E.lines.isFull;v===E.lines.length-1?M?E.lines.recycle().copyFrom(b):E.lines.push(b.clone()):E.lines.splice(v+1,0,b.clone()),M?this._bufferService.isUserScrolling&&(E.ydisp=Math.max(E.ydisp-1,0)):(E.ybase++,this._bufferService.isUserScrolling||E.ydisp++)}else{var I=v-A+1;E.lines.shiftElements(A+1,I-1,-1),E.lines.set(v,b.clone())}this._bufferService.isUserScrolling||(E.ydisp=E.ybase),this._dirtyRowService.markRangeDirty(E.scrollTop,E.scrollBottom),this._onScroll.fire(E.ydisp)},T.prototype.scrollLines=function(C,x){var b=this._bufferService.buffer;if(C<0){if(b.ydisp===0)return;this._bufferService.isUserScrolling=!0}else C+b.ydisp>=b.ybase&&(this._bufferService.isUserScrolling=!1);var E=b.ydisp;b.ydisp=Math.max(Math.min(b.ydisp+C,b.ybase),0),E!==b.ydisp&&(x||this._onScroll.fire(b.ydisp))},T.prototype.scrollPages=function(C){this.scrollLines(C*(this.rows-1))},T.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},T.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},T.prototype.scrollToLine=function(C){var x=C-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)},T.prototype.addEscHandler=function(C,x){return this._inputHandler.addEscHandler(C,x)},T.prototype.addDcsHandler=function(C,x){return this._inputHandler.addDcsHandler(C,x)},T.prototype.addCsiHandler=function(C,x){return this._inputHandler.addCsiHandler(C,x)},T.prototype.addOscHandler=function(C,x){return this._inputHandler.addOscHandler(C,x)},T.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},T.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},T.prototype._updateOptions=function(C){var x;switch(C){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)}},T.prototype._enableWindowsMode=function(){var C=this;if(!this._windowsMode){var x=[];x.push(this.onLineFeed(i.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.addCsiHandler({final:"H"},function(){return i.updateWindowsModeWrappedState(C._bufferService),!1})),this._windowsMode={dispose:function(){for(var b=0,E=x;b<E.length;b++)E[b].dispose()}}}},T}(c.Disposable);k.CoreTerminal=w},function(j,k,D){"use strict";var R=this&&this.__spreadArrays||function(){for(var p=0,u=0,o=arguments.length;u<o;u++)p+=arguments[u].length;var d=Array(p),s=0;for(u=0;u<o;u++)for(var l=arguments[u],r=0,n=l.length;r<n;r++,s++)d[s]=l[r];return d};Object.defineProperty(k,"__esModule",{value:!0}),k.InstantiationService=k.ServiceCollection=void 0;var O=D(1),c=D(14),S=function(){function p(){for(var u=[],o=0;o<arguments.length;o++)u[o]=arguments[o];this._entries=new Map;for(var d=0,s=u;d<s.length;d++){var l=s[d],r=l[0],n=l[1];this.set(r,n)}}return p.prototype.set=function(u,o){var d=this._entries.get(u);return this._entries.set(u,o),d},p.prototype.forEach=function(u){this._entries.forEach(function(o,d){return u(d,o)})},p.prototype.has=function(u){return this._entries.has(u)},p.prototype.get=function(u){return this._entries.get(u)},p}();k.ServiceCollection=S;var y=function(){function p(){this._services=new S,this._services.set(O.IInstantiationService,this)}return p.prototype.setService=function(u,o){this._services.set(u,o)},p.prototype.getService=function(u){return this._services.get(u)},p.prototype.createInstance=function(u){for(var o=[],d=1;d<arguments.length;d++)o[d-1]=arguments[d];for(var s=c.getServiceDependencies(u).sort(function(f,w){return f.index-w.index}),l=[],r=0,n=s;r<n.length;r++){var a=n[r],i=this._services.get(a.id);if(!i)throw new Error("[createInstance] "+u.name+" depends on UNKNOWN service "+a.id+".");l.push(i)}var h=s.length>0?s[0].index:o.length;if(o.length!==h)throw new Error("[createInstance] First service dependency of "+u.name+" at position "+(h+1)+" conflicts with "+o.length+" static arguments");return new(u.bind.apply(u,R([void 0],R(o,l))))},p}();k.InstantiationService=y},function(j,k,D){"use strict";var R=this&&this.__decorate||function(o,d,s,l){var r,n=arguments.length,a=n<3?d:l===null?l=Object.getOwnPropertyDescriptor(d,s):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,d,s,l);else for(var i=o.length-1;i>=0;i--)(r=o[i])&&(a=(n<3?r(a):n>3?r(d,s,a):r(d,s))||a);return n>3&&a&&Object.defineProperty(d,s,a),a},O=this&&this.__param||function(o,d){return function(s,l){d(s,l,o)}},c=this&&this.__spreadArrays||function(){for(var o=0,d=0,s=arguments.length;d<s;d++)o+=arguments[d].length;var l=Array(o),r=0;for(d=0;d<s;d++)for(var n=arguments[d],a=0,i=n.length;a<i;a++,r++)l[r]=n[a];return l};Object.defineProperty(k,"__esModule",{value:!0}),k.LogService=k.LogLevel=void 0;var S,y=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=k.LogLevel||(k.LogLevel={}));var p={debug:S.DEBUG,info:S.INFO,warn:S.WARN,error:S.ERROR,off:S.OFF},u=function(){function o(d){var s=this;this._optionsService=d,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(d){for(var s=0;s<d.length;s++)typeof d[s]=="function"&&(d[s]=d[s]())},o.prototype._log=function(d,s,l){this._evalLazyOptionalParams(l),d.call.apply(d,c([console,"xterm.js: "+s],l))},o.prototype.debug=function(d){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.DEBUG&&this._log(console.log,d,s)},o.prototype.info=function(d){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.INFO&&this._log(console.info,d,s)},o.prototype.warn=function(d){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.WARN&&this._log(console.warn,d,s)},o.prototype.error=function(d){for(var s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];this._logLevel<=S.ERROR&&this._log(console.error,d,s)},o=R([O(0,y.IOptionsService)],o)}();k.LogService=u},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(s,l){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)n.hasOwnProperty(a)&&(r[a]=n[a])})(s,l)},function(s,l){function r(){this.constructor=s}R(s,l),s.prototype=l===null?Object.create(l):(r.prototype=l.prototype,new r)}),c=this&&this.__decorate||function(s,l,r,n){var a,i=arguments.length,h=i<3?l:n===null?n=Object.getOwnPropertyDescriptor(l,r):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,r,n);else for(var f=s.length-1;f>=0;f--)(a=s[f])&&(h=(i<3?a(h):i>3?a(l,r,h):a(l,r))||h);return i>3&&h&&Object.defineProperty(l,r,h),h},S=this&&this.__param||function(s,l){return function(r,n){l(r,n,s)}};Object.defineProperty(k,"__esModule",{value:!0}),k.BufferService=k.MINIMUM_ROWS=k.MINIMUM_COLS=void 0;var y=D(1),p=D(69),u=D(0),o=D(2);k.MINIMUM_COLS=2,k.MINIMUM_ROWS=1;var d=function(s){function l(r){var n=s.call(this)||this;return n._optionsService=r,n.isUserScrolling=!1,n._onResize=new u.EventEmitter,n.cols=Math.max(r.options.cols,k.MINIMUM_COLS),n.rows=Math.max(r.options.rows,k.MINIMUM_ROWS),n.buffers=new p.BufferSet(r,n),n}return O(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(r,n){this.cols=r,this.rows=n,this.buffers.resize(r,n),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:r,rows:n})},l.prototype.reset=function(){this.buffers.dispose(),this.buffers=new p.BufferSet(this._optionsService,this),this.isUserScrolling=!1},l=c([S(0,y.IOptionsService)],l)}(o.Disposable);k.BufferService=d},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(p,u){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,d){o.__proto__=d}||function(o,d){for(var s in d)d.hasOwnProperty(s)&&(o[s]=d[s])})(p,u)},function(p,u){function o(){this.constructor=p}R(p,u),p.prototype=u===null?Object.create(u):(o.prototype=u.prototype,new o)});Object.defineProperty(k,"__esModule",{value:!0}),k.BufferSet=void 0;var c=D(70),S=D(0),y=function(p){function u(o,d){var s=p.call(this)||this;return s._onBufferActivate=s.register(new S.EventEmitter),s._normal=new c.Buffer(!0,o,d),s._normal.fillViewportRows(),s._alt=new c.Buffer(!1,o,d),s._activeBuffer=s._normal,s.setupTabStops(),s}return O(u,p),Object.defineProperty(u.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),u.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}))},u.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}))},u.prototype.resize=function(o,d){this._normal.resize(o,d),this._alt.resize(o,d)},u.prototype.setupTabStops=function(o){this._normal.setupTabStops(o),this._alt.setupTabStops(o)},u}(D(2).Disposable);k.BufferSet=y},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.BufferStringIterator=k.Buffer=k.MAX_BUFFER_SIZE=void 0;var R=D(71),O=D(16),c=D(4),S=D(3),y=D(72),p=D(73),u=D(20),o=D(6);k.MAX_BUFFER_SIZE=4294967295;var d=function(){function l(r,n,a){this._hasScrollback=r,this._optionsService=n,this._bufferService=a,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=O.DEFAULT_ATTR_DATA.clone(),this.savedCharset=u.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=c.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 R.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return l.prototype.getNullCell=function(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell},l.prototype.getWhitespaceCell=function(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell},l.prototype.getBlankLine=function(r,n){return new O.BufferLine(this._bufferService.cols,this.getNullCell(r),n)},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 r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows},enumerable:!1,configurable:!0}),l.prototype._getCorrectBufferLength=function(r){if(!this._hasScrollback)return r;var n=r+this._optionsService.options.scrollback;return n>k.MAX_BUFFER_SIZE?k.MAX_BUFFER_SIZE:n},l.prototype.fillViewportRows=function(r){if(this.lines.length===0){r===void 0&&(r=O.DEFAULT_ATTR_DATA);for(var n=this._rows;n--;)this.lines.push(this.getBlankLine(r))}},l.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new R.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},l.prototype.resize=function(r,n){var a=this.getNullCell(O.DEFAULT_ATTR_DATA),i=this._getCorrectBufferLength(n);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<r)for(var h=0;h<this.lines.length;h++)this.lines.get(h).resize(r,a);var f=0;if(this._rows<n)for(var w=this._rows;w<n;w++)this.lines.length<n+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new O.BufferLine(r,a)):this.ybase>0&&this.lines.length<=this.ybase+this.y+f+1?(this.ybase--,f++,this.ydisp>0&&this.ydisp--):this.lines.push(new O.BufferLine(r,a)));else for(w=this._rows;w>n;w--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){var m=this.lines.length-i;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=i}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,n-1),f&&(this.y+=f),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(r,n),this._cols>r))for(h=0;h<this.lines.length;h++)this.lines.get(h).resize(r,a);this._cols=r,this._rows=n},Object.defineProperty(l.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!1,configurable:!0}),l.prototype._reflow=function(r,n){this._cols!==r&&(r>this._cols?this._reflowLarger(r,n):this._reflowSmaller(r,n))},l.prototype._reflowLarger=function(r,n){var a=y.reflowLargerGetLinesToRemove(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(O.DEFAULT_ATTR_DATA));if(a.length>0){var i=y.reflowLargerCreateNewLayout(this.lines,a);y.reflowLargerApplyNewLayout(this.lines,i.layout),this._reflowLargerAdjustViewport(r,n,i.countRemoved)}},l.prototype._reflowLargerAdjustViewport=function(r,n,a){for(var i=this.getNullCell(O.DEFAULT_ATTR_DATA),h=a;h-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new O.BufferLine(r,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-a,0)},l.prototype._reflowSmaller=function(r,n){for(var a=this.getNullCell(O.DEFAULT_ATTR_DATA),i=[],h=0,f=this.lines.length-1;f>=0;f--){var w=this.lines.get(f);if(!(!w||!w.isWrapped&&w.getTrimmedLength()<=r)){for(var m=[w];w.isWrapped&&f>0;)w=this.lines.get(--f),m.unshift(w);var T=this.ybase+this.y;if(!(T>=f&&T<f+m.length)){var C=m[m.length-1].getTrimmedLength(),x=y.reflowSmallerGetNewLineLengths(m,this._cols,r),b=x.length-m.length,E=void 0;E=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+b):Math.max(0,this.lines.length-this.lines.maxLength+b);for(var A=[],v=0;v<b;v++){var M=this.getBlankLine(O.DEFAULT_ATTR_DATA,!0);A.push(M)}A.length>0&&(i.push({start:f+m.length+h,newLines:A}),h+=A.length),m.push.apply(m,A);var I=x.length-1,P=x[I];P===0&&(P=x[--I]);for(var B=m.length-b-1,H=C;B>=0;){var F=Math.min(H,P);if(m[I].copyCellsFrom(m[B],H-F,P-F,F,!0),(P-=F)===0&&(P=x[--I]),(H-=F)===0){B--;var W=Math.max(B,0);H=y.getWrappedLineTrimmedLength(m,W,this._cols)}}for(v=0;v<m.length;v++)x[v]<r&&m[v].setCell(x[v],a);for(var U=b-E;U-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+b,this.ybase+n-1)}}}if(i.length>0){var K=[],z=[];for(v=0;v<this.lines.length;v++)z.push(this.lines.get(v));var te=this.lines.length,de=te-1,ge=0,Ue=i[ge];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);var Me=0;for(v=Math.min(this.lines.maxLength-1,te+h-1);v>=0;v--)if(Ue&&Ue.start>de+Me){for(var Le=Ue.newLines.length-1;Le>=0;Le--)this.lines.set(v--,Ue.newLines[Le]);v++,K.push({index:de+1,amount:Ue.newLines.length}),Me+=Ue.newLines.length,Ue=i[++ge]}else this.lines.set(v,z[de--]);var Oe=0;for(v=K.length-1;v>=0;v--)K[v].index+=Oe,this.lines.onInsertEmitter.fire(K[v]),Oe+=K[v].amount;var Fe=Math.max(0,te+h-this.lines.maxLength);Fe>0&&this.lines.onTrimEmitter.fire(Fe)}},l.prototype.stringIndexToBufferIndex=function(r,n,a){for(a===void 0&&(a=!1);n;){var i=this.lines.get(r);if(!i)return[-1,-1];for(var h=a?i.getTrimmedLength():i.length,f=0;f<h;++f)if(i.get(f)[S.CHAR_DATA_WIDTH_INDEX]&&(n-=i.get(f)[S.CHAR_DATA_CHAR_INDEX].length||1),n<0)return[r,f];r++}return[r,0]},l.prototype.translateBufferLineToString=function(r,n,a,i){a===void 0&&(a=0);var h=this.lines.get(r);return h?h.translateToString(n,a,i):""},l.prototype.getWrappedRangeForLine=function(r){for(var n=r,a=r;n>0&&this.lines.get(n).isWrapped;)n--;for(;a+1<this.lines.length&&this.lines.get(a+1).isWrapped;)a++;return{first:n,last:a}},l.prototype.setupTabStops=function(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.options.tabStopWidth)this.tabs[r]=!0},l.prototype.prevStop=function(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r},l.prototype.nextStop=function(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r},l.prototype.addMarker=function(r){var n=this,a=new p.Marker(r);return this.markers.push(a),a.register(this.lines.onTrim(function(i){a.line-=i,a.line<0&&a.dispose()})),a.register(this.lines.onInsert(function(i){a.line>=i.index&&(a.line+=i.amount)})),a.register(this.lines.onDelete(function(i){a.line>=i.index&&a.line<i.index+i.amount&&a.dispose(),a.line>i.index&&(a.line-=i.amount)})),a.register(a.onDispose(function(){return n._removeMarker(a)})),a},l.prototype._removeMarker=function(r){this.markers.splice(this.markers.indexOf(r),1)},l.prototype.iterator=function(r,n,a,i,h){return new s(this,r,n,a,i,h)},l}();k.Buffer=d;var s=function(){function l(r,n,a,i,h,f){a===void 0&&(a=0),i===void 0&&(i=r.lines.length),h===void 0&&(h=0),f===void 0&&(f=0),this._buffer=r,this._trimRight=n,this._startIndex=a,this._endIndex=i,this._startOverscan=h,this._endOverscan=f,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 r=this._buffer.getWrappedRangeForLine(this._current);r.first<this._startIndex-this._startOverscan&&(r.first=this._startIndex-this._startOverscan),r.last>this._endIndex+this._endOverscan&&(r.last=this._endIndex+this._endOverscan),r.first=Math.max(r.first,0),r.last=Math.min(r.last,this._buffer.lines.length);for(var n="",a=r.first;a<=r.last;++a)n+=this._buffer.translateBufferLineToString(a,this._trimRight);return this._current=r.last+1,{range:r,content:n}},l}();k.BufferStringIterator=s},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.CircularList=void 0;var R=D(0),O=function(){function c(S){this._maxLength=S,this.onDeleteEmitter=new R.EventEmitter,this.onInsertEmitter=new R.EventEmitter,this.onTrimEmitter=new R.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(c.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"maxLength",{get:function(){return this._maxLength},set:function(S){if(this._maxLength!==S){for(var y=new Array(S),p=0;p<Math.min(S,this.length);p++)y[p]=this._array[this._getCyclicIndex(p)];this._array=y,this._maxLength=S,this._startIndex=0}},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"length",{get:function(){return this._length},set:function(S){if(S>this._length)for(var y=this._length;y<S;y++)this._array[y]=void 0;this._length=S},enumerable:!1,configurable:!0}),c.prototype.get=function(S){return this._array[this._getCyclicIndex(S)]},c.prototype.set=function(S,y){this._array[this._getCyclicIndex(S)]=y},c.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++},c.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(c.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!1,configurable:!0}),c.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},c.prototype.splice=function(S,y){for(var p=[],u=2;u<arguments.length;u++)p[u-2]=arguments[u];if(y){for(var o=S;o<this._length-y;o++)this._array[this._getCyclicIndex(o)]=this._array[this._getCyclicIndex(o+y)];this._length-=y}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 d=this._length+p.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=p.length},c.prototype.trimStart=function(S){S>this._length&&(S=this._length),this._startIndex+=S,this._length-=S,this.onTrimEmitter.fire(S)},c.prototype.shiftElements=function(S,y,p){if(!(y<=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 u=y-1;u>=0;u--)this.set(S+u+p,this.get(S+u));var o=S+y+p-this._length;if(o>0)for(this._length+=o;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(u=0;u<y;u++)this.set(S+u+p,this.get(S+u))}},c.prototype._getCyclicIndex=function(S){return(this._startIndex+S)%this._maxLength},c}();k.CircularList=O},function(j,k,D){"use strict";function R(O,c,S){if(c===O.length-1)return O[c].getTrimmedLength();var y=!O[c].hasContent(S-1)&&O[c].getWidth(S-1)===1,p=O[c+1].getWidth(0)===2;return y&&p?S-1:S}Object.defineProperty(k,"__esModule",{value:!0}),k.getWrappedLineTrimmedLength=k.reflowSmallerGetNewLineLengths=k.reflowLargerApplyNewLayout=k.reflowLargerCreateNewLayout=k.reflowLargerGetLinesToRemove=void 0,k.reflowLargerGetLinesToRemove=function(O,c,S,y,p){for(var u=[],o=0;o<O.length-1;o++){var d=o,s=O.get(++d);if(s.isWrapped){for(var l=[O.get(o)];d<O.length&&s.isWrapped;)l.push(s),s=O.get(++d);if(y>=o&&y<d)o+=l.length-1;else{for(var r=0,n=R(l,r,c),a=1,i=0;a<l.length;){var h=R(l,a,c),f=h-i,w=S-n,m=Math.min(f,w);l[r].copyCellsFrom(l[a],i,n,m,!1),(n+=m)===S&&(r++,n=0),(i+=m)===h&&(a++,i=0),n===0&&r!==0&&l[r-1].getWidth(S-1)===2&&(l[r].copyCellsFrom(l[r-1],S-1,n++,1,!1),l[r-1].setCell(S-1,p))}l[r].replaceCells(n,S,p);for(var T=0,C=l.length-1;C>0&&(C>r||l[C].getTrimmedLength()===0);C--)T++;T>0&&(u.push(o+l.length-T),u.push(T)),o+=l.length-1}}}return u},k.reflowLargerCreateNewLayout=function(O,c){for(var S=[],y=0,p=c[y],u=0,o=0;o<O.length;o++)if(p===o){var d=c[++y];O.onDeleteEmitter.fire({index:o-u,amount:d}),o+=d-1,u+=d,p=c[++y]}else S.push(o);return{layout:S,countRemoved:u}},k.reflowLargerApplyNewLayout=function(O,c){for(var S=[],y=0;y<c.length;y++)S.push(O.get(c[y]));for(y=0;y<S.length;y++)O.set(y,S[y]);O.length=c.length},k.reflowSmallerGetNewLineLengths=function(O,c,S){for(var y=[],p=O.map(function(n,a){return R(O,a,c)}).reduce(function(n,a){return n+a}),u=0,o=0,d=0;d<p;){if(p-d<S){y.push(p-d);break}u+=S;var s=R(O,o,c);u>s&&(u-=s,o++);var l=O[o].getWidth(u-1)===2;l&&u--;var r=l?S-1:S;y.push(r),d+=r}return y},k.getWrappedLineTrimmedLength=R},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(y,p){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,o){u.__proto__=o}||function(u,o){for(var d in o)o.hasOwnProperty(d)&&(u[d]=o[d])})(y,p)},function(y,p){function u(){this.constructor=y}R(y,p),y.prototype=p===null?Object.create(p):(u.prototype=p.prototype,new u)});Object.defineProperty(k,"__esModule",{value:!0}),k.Marker=void 0;var c=D(0),S=function(y){function p(u){var o=y.call(this)||this;return o.line=u,o._id=p._nextId++,o.isDisposed=!1,o._onDispose=new c.EventEmitter,o}return O(p,y),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);k.Marker=S},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.OptionsService=k.DEFAULT_OPTIONS=k.DEFAULT_BELL_SOUND=void 0;var R=D(0),O=D(11),c=D(33);k.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",k.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:k.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:O.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var S=["cols","rows"],y=function(){function p(u){this._onOptionChange=new R.EventEmitter,this.options=c.clone(k.DEFAULT_OPTIONS);for(var o=0,d=Object.keys(u);o<d.length;o++){var s=d[o];if(s in this.options){var l=u[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(u,o){if(!(u in k.DEFAULT_OPTIONS))throw new Error('No option with key "'+u+'"');if(S.indexOf(u)!==-1)throw new Error('Option "'+u+'" can only be set in the constructor');this.options[u]!==o&&(o=this._sanitizeAndValidateOption(u,o),this.options[u]!==o&&(this.options[u]=o,this._onOptionChange.fire(u)))},p.prototype._sanitizeAndValidateOption=function(u,o){switch(u){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":o||(o=k.DEFAULT_OPTIONS[u]);break;case"cursorWidth":o=Math.floor(o);case"lineHeight":case"tabStopWidth":if(o<1)throw new Error(u+" 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(u+" cannot be less than 0, value: "+o);break;case"fastScrollSensitivity":case"scrollSensitivity":if(o<=0)throw new Error(u+" cannot be less than or equal to 0, value: "+o)}return o},p.prototype.getOption=function(u){if(!(u in k.DEFAULT_OPTIONS))throw new Error('No option with key "'+u+'"');return this.options[u]},p}();k.OptionsService=y},function(j,k,D){"use strict";var R,O=this&&this.__extends||(R=function(r,n){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var h in i)i.hasOwnProperty(h)&&(a[h]=i[h])})(r,n)},function(r,n){function a(){this.constructor=r}R(r,n),r.prototype=n===null?Object.create(n):(a.prototype=n.prototype,new a)}),c=this&&this.__decorate||function(r,n,a,i){var h,f=arguments.length,w=f<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,a):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(r,n,a,i);else for(var m=r.length-1;m>=0;m--)(h=r[m])&&(w=(f<3?h(w):f>3?h(n,a,w):h(n,a))||w);return f>3&&w&&Object.defineProperty(n,a,w),w},S=this&&this.__param||function(r,n){return function(a,i){n(a,i,r)}};Object.defineProperty(k,"__esModule",{value:!0}),k.CoreService=void 0;var y=D(1),p=D(0),u=D(33),o=D(2),d=Object.freeze({insertMode:!1}),s=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),l=function(r){function n(a,i,h,f){var w=r.call(this)||this;return w._bufferService=i,w._logService=h,w._optionsService=f,w.isCursorInitialized=!1,w.isCursorHidden=!1,w._onData=w.register(new p.EventEmitter),w._onUserInput=w.register(new p.EventEmitter),w._onBinary=w.register(new p.EventEmitter),w._scrollToBottom=a,w.register({dispose:function(){return w._scrollToBottom=void 0}}),w.modes=u.clone(d),w.decPrivateModes=u.clone(s),w}return O(n,r),Object.defineProperty(n.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),n.prototype.reset=function(){this.modes=u.clone(d),this.decPrivateModes=u.clone(s)},n.prototype.triggerDataEvent=function(a,i){if(i===void 0&&(i=!1),!this._optionsService.options.disableStdin){var h=this._bufferService.buffer;h.ybase!==h.ydisp&&this._scrollToBottom(),i&&this._onUserInput.fire(),this._logService.debug('sending data "'+a+'"',function(){return a.split("").map(function(f){return f.charCodeAt(0)})}),this._onData.fire(a)}},n.prototype.triggerBinaryEvent=function(a){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+a+'"',function(){return a.split("").map(function(i){return i.charCodeAt(0)})}),this._onBinary.fire(a))},n=c([S(1,y.IBufferService),S(2,y.ILogService),S(3,y.IOptionsService)],n)}(o.Disposable);k.CoreService=l},function(j,k,D){"use strict";var R=this&&this.__decorate||function(s,l,r,n){var a,i=arguments.length,h=i<3?l:n===null?n=Object.getOwnPropertyDescriptor(l,r):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(s,l,r,n);else for(var f=s.length-1;f>=0;f--)(a=s[f])&&(h=(i<3?a(h):i>3?a(l,r,h):a(l,r))||h);return i>3&&h&&Object.defineProperty(l,r,h),h},O=this&&this.__param||function(s,l){return function(r,n){l(r,n,s)}};Object.defineProperty(k,"__esModule",{value:!0}),k.CoreMouseService=void 0;var c=D(1),S=D(0),y={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 r=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(r|=64,r|=s.action):(r|=3&s.button,4&s.button&&(r|=64),8&s.button&&(r|=128),s.action===32?r|=32:s.action!==0||l||(r|=3)),r}var u=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?"":"[M"+u(l[0])+u(l[1])+u(l[2])},SGR:function(s){var l=s.action===0&&s.button!==4?"m":"M";return"[<"+p(s,!0)+";"+s.col+";"+s.row+l}},d=function(){function s(l,r){this._bufferService=l,this._coreService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new S.EventEmitter,this._lastEvent=null;for(var n=0,a=Object.keys(y);n<a.length;n++){var i=a[n];this.addProtocol(i,y[i])}for(var h=0,f=Object.keys(o);h<f.length;h++){var w=f[h];this.addEncoding(w,o[w])}this.reset()}return s.prototype.addProtocol=function(l,r){this._protocols[l]=r},s.prototype.addEncoding=function(l,r){this._encodings[l]=r},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 r=this._encodings[this._activeEncoding](l);return r&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!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,r){return l.col===r.col&&(l.row===r.row&&(l.button===r.button&&(l.action===r.action&&(l.ctrl===r.ctrl&&l.alt===r.alt))))&&l.shift===r.shift},s=R([O(0,c.IBufferService),O(1,c.ICoreService)],s)}();k.CoreMouseService=d},function(j,k,D){"use strict";var R=this&&this.__decorate||function(y,p,u,o){var d,s=arguments.length,l=s<3?p:o===null?o=Object.getOwnPropertyDescriptor(p,u):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(y,p,u,o);else for(var r=y.length-1;r>=0;r--)(d=y[r])&&(l=(s<3?d(l):s>3?d(p,u,l):d(p,u))||l);return s>3&&l&&Object.defineProperty(p,u,l),l},O=this&&this.__param||function(y,p){return function(u,o){p(u,o,y)}};Object.defineProperty(k,"__esModule",{value:!0}),k.DirtyRowService=void 0;var c=D(1),S=function(){function y(p){this._bufferService=p,this.clearRange()}return Object.defineProperty(y.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),y.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},y.prototype.markDirty=function(p){p<this._start?this._start=p:p>this._end&&(this._end=p)},y.prototype.markRangeDirty=function(p,u){if(p>u){var o=p;p=u,u=o}p<this._start&&(this._start=p),u>this._end&&(this._end=u)},y.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},y=R([O(0,c.IBufferService)],y)}();k.DirtyRowService=S},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.UnicodeService=void 0;var R=D(0),O=D(79),c=function(){function S(){this._providers=Object.create(null),this._active="",this._onChange=new R.EventEmitter;var y=new O.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}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(y){if(!this._providers[y])throw new Error('unknown Unicode version "'+y+'"');this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)},enumerable:!1,configurable:!0}),S.prototype.register=function(y){this._providers[y.version]=y},S.prototype.wcwidth=function(y){return this._activeProvider.wcwidth(y)},S.prototype.getStringCellWidth=function(y){for(var p=0,u=y.length,o=0;o<u;++o){var d=y.charCodeAt(o);if(55296<=d&&d<=56319){if(++o>=u)return p+this.wcwidth(d);var s=y.charCodeAt(o);56320<=s&&s<=57343?d=1024*(d-55296)+s-56320+65536:p+=this.wcwidth(s)}p+=this.wcwidth(d)}return p},S}();k.UnicodeService=c},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.UnicodeV6=void 0;var R,O=D(15),c=[[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]],y=function(){function p(){if(this.version="6",!R){R=new Uint8Array(65536),O.fill(R,1),R[0]=0,O.fill(R,0,1,32),O.fill(R,0,127,160),O.fill(R,2,4352,4448),R[9001]=2,R[9002]=2,O.fill(R,2,11904,42192),R[12351]=1,O.fill(R,2,44032,55204),O.fill(R,2,63744,64256),O.fill(R,2,65040,65050),O.fill(R,2,65072,65136),O.fill(R,2,65280,65377),O.fill(R,2,65504,65511);for(var u=0;u<c.length;++u)O.fill(R,0,c[u][0],c[u][1]+1)}}return p.prototype.wcwidth=function(u){return u<32?0:u<127?1:u<65536?R[u]:function(o,d){var s,l=0,r=d.length-1;if(o<d[0][0]||o>d[r][1])return!1;for(;r>=l;)if(o>d[s=l+r>>1][1])l=s+1;else{if(!(o<d[s][0]))return!0;r=s-1}return!1}(u,S)?0:u>=131072&&u<=196605||u>=196608&&u<=262141?2:1},p}();k.UnicodeV6=y},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.CharsetService=void 0;var R=function(){function O(){this.glevel=0,this._charsets=[]}return O.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},O.prototype.setgLevel=function(c){this.glevel=c,this.charset=this._charsets[c]},O.prototype.setgCharset=function(c,S){this._charsets[c]=S,this.glevel===c&&(this.charset=S)},O}();k.CharsetService=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.updateWindowsModeWrappedState=void 0;var R=D(3);k.updateWindowsModeWrappedState=function(O){var c=O.buffer.lines.get(O.buffer.ybase+O.buffer.y-1),S=c==null?void 0:c.get(O.cols-1),y=O.buffer.lines.get(O.buffer.ybase+O.buffer.y);y&&S&&(y.isWrapped=S[R.CHAR_DATA_CODE_INDEX]!==R.NULL_CELL_CODE&&S[R.CHAR_DATA_CODE_INDEX]!==R.WHITESPACE_CELL_CODE)}},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.WriteBuffer=void 0;var R=function(){function O(c){this._action=c,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return O.prototype.writeSync=function(c){if(this._writeBuffer.length){for(var S=this._bufferOffset;S<this._writeBuffer.length;++S){var y=this._writeBuffer[S],p=this._callbacks[S];this._action(y),p&&p()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(c)},O.prototype.write=function(c,S){var y=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 y._innerWrite()})),this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(S)},O.prototype._innerWrite=function(){for(var c=this,S=Date.now();this._writeBuffer.length>this._bufferOffset;){var y=this._writeBuffer[this._bufferOffset],p=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(y),this._pendingData-=y.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 c._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},O}();k.WriteBuffer=R},function(j,k,D){"use strict";Object.defineProperty(k,"__esModule",{value:!0}),k.AddonManager=void 0;var R=function(){function O(){this._addons=[]}return O.prototype.dispose=function(){for(var c=this._addons.length-1;c>=0;c--)this._addons[c].instance.dispose()},O.prototype.loadAddon=function(c,S){var y=this,p={instance:S,dispose:S.dispose,isDisposed:!1};this._addons.push(p),S.dispose=function(){return y._wrappedAddonDispose(p)},S.activate(c)},O.prototype._wrappedAddonDispose=function(c){if(!c.isDisposed){for(var S=-1,y=0;y<this._addons.length;y++)if(this._addons[y]===c){S=y;break}if(S===-1)throw new Error("Could not dispose an addon that has not been loaded");c.isDisposed=!0,c.dispose.apply(c.instance),this._addons.splice(S,1)}},O}();k.AddonManager=R}])})},"07cG":function(Ze,ce,ie){Ze.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){j.defineOption("placeholder","",function(y,p,u){var o=u&&u!=j.Init;if(p&&!o)y.on("blur",O),y.on("change",c),y.on("swapDoc",c),j.on(y.getInputField(),"compositionupdate",y.state.placeholderCompose=function(){R(y)}),c(y);else if(!p&&o){y.off("blur",O),y.off("change",c),y.off("swapDoc",c),j.off(y.getInputField(),"compositionupdate",y.state.placeholderCompose),k(y);var d=y.getWrapperElement();d.className=d.className.replace(" CodeMirror-empty","")}p&&!y.hasFocus()&&O(y)});function k(y){y.state.placeholder&&(y.state.placeholder.parentNode.removeChild(y.state.placeholder),y.state.placeholder=null)}function D(y){k(y);var p=y.state.placeholder=document.createElement("pre");p.style.cssText="height: 0; overflow: visible",p.style.direction=y.getOption("direction"),p.className="CodeMirror-placeholder CodeMirror-line-like";var u=y.getOption("placeholder");typeof u=="string"&&(u=document.createTextNode(u)),p.appendChild(u),y.display.lineSpace.insertBefore(p,y.display.lineSpace.firstChild)}function R(y){setTimeout(function(){var p=!1,u=y.getInputField();u.nodeName=="TEXTAREA"?p=!u.value:y.lineCount()==1&&(p=!/[^\u200b]/.test(u.querySelector(".CodeMirror-line").textContent)),p?D(y):k(y)},20)}function O(y){S(y)&&D(y)}function c(y){var p=y.getWrapperElement(),u=S(y);p.className=p.className.replace(" CodeMirror-empty","")+(u?" CodeMirror-empty":""),u?D(y):k(y)}function S(y){return y.lineCount()===1&&y.getLine(0)===""}})},"1dTM":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=ie("GQ8N"),k=E(ie("Lo0S")),D=ie("VSMT"),R=ie("GdRQ"),O=ie("SZEN"),c=ie("vewr"),S=x(ie("YJ9k")),y=x(ie("MZdM")),p=x(ie("ItS6")),u=x(ie("whVF")),o=x(ie("Fv0C")),d=x(ie("LCi9")),s=x(ie("rwxt")),l=x(ie("Mmt2")),r=x(ie("iUHT")),n=x(ie("mHUz")),a=x(ie("P2ho")),i=ie("NBmB");ie("mdZa");var h=x(ie("34/K")),f=x(ie("hXwI")),w=x(ie("SgaC")),m=x(ie("3690")),T=x(ie("8K/p")),C=x(ie("xO64"));function x(ke){return ke&&ke.__esModule?ke:{default:ke}}function b(){if(typeof WeakMap!="function")return null;var ke=new WeakMap;return b=function(){return ke},ke}function E(ke){if(ke&&ke.__esModule)return ke;if(ke===null||A(ke)!=="object"&&typeof ke!="function")return{default:ke};var xe=b();if(xe&&xe.has(ke))return xe.get(ke);var Ee={},Se=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var $ in ke)if(Object.prototype.hasOwnProperty.call(ke,$)){var fe=Se?Object.getOwnPropertyDescriptor(ke,$):null;fe&&(fe.get||fe.set)?Object.defineProperty(Ee,$,fe):Ee[$]=ke[$]}return Ee.default=ke,xe&&xe.set(ke,Ee),Ee}function A(ke){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?A=function(Ee){return typeof Ee}:A=function(Ee){return Ee&&typeof Symbol=="function"&&Ee.constructor===Symbol&&Ee!==Symbol.prototype?"symbol":typeof Ee},A(ke)}function v(ke,xe){if(!(ke instanceof xe))throw new TypeError("Cannot call a class as a function")}function M(ke,xe){for(var Ee=0;Ee<xe.length;Ee++){var Se=xe[Ee];Se.enumerable=Se.enumerable||!1,Se.configurable=!0,"value"in Se&&(Se.writable=!0),Object.defineProperty(ke,Se.key,Se)}}function I(ke,xe,Ee){return xe&&M(ke.prototype,xe),Ee&&M(ke,Ee),ke}function P(ke,xe){if(typeof xe!="function"&&xe!==null)throw new TypeError("Super expression must either be null or a function");ke.prototype=Object.create(xe&&xe.prototype,{constructor:{value:ke,writable:!0,configurable:!0}}),xe&&B(ke,xe)}function B(ke,xe){return B=Object.setPrototypeOf||function(Se,$){return Se.__proto__=$,Se},B(ke,xe)}function H(ke){var xe=U();return function(){var Se=K(ke),$;if(xe){var fe=K(this).constructor;$=Reflect.construct(Se,arguments,fe)}else $=Se.apply(this,arguments);return F(this,$)}}function F(ke,xe){return xe&&(A(xe)==="object"||typeof xe=="function")?xe:W(ke)}function W(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 K(ke){return K=Object.setPrototypeOf?Object.getPrototypeOf:function(Ee){return Ee.__proto__||Object.getPrototypeOf(Ee)},K(ke)}var z=3,te="rgb(40, 40, 40)",de=17,ge=50,Ue=19,Me=75,Le=50,Oe=1e3,Fe=50,ye=1,Ae=1<<1,re=1<<2,pe=1<<3,ue=1<<4,Ie=1<<24,Ke=1<<25,Ne=1<<26,je=1<<27,Ge=1<<28,ze=function(ke){P(Ee,ke);var xe=H(Ee);function Ee(Se,$,fe){var J;if(v(this,Ee),!Se)throw new Error("Must specify target");if(!$)throw new Error("Must specify URL");J=xe.call(this),J._target=Se,J._url=$,fe=fe||{},J._rfbCredentials=fe.credentials||{},J._shared="shared"in fe?!!fe.shared:!0,J._repeaterID=fe.repeaterID||"",J._wsProtocols=fe.wsProtocols||[],J._rfbConnectionState="",J._rfbInitState="",J._rfbAuthScheme=-1,J._rfbCleanDisconnect=!0,J._rfbVersion=0,J._rfbMaxVersion=3.8,J._rfbTightVNC=!1,J._rfbVeNCryptState=0,J._rfbXvpVer=0,J._fbWidth=0,J._fbHeight=0,J._fbName="",J._capabilities={power:!1},J._supportsFence=!1,J._supportsContinuousUpdates=!1,J._enabledContinuousUpdates=!1,J._supportsSetDesktopSize=!1,J._screenID=0,J._screenFlags=0,J._qemuExtKeyEventSupported=!1,J._clipboardText=null,J._clipboardServerCapabilitiesActions={},J._clipboardServerCapabilitiesFormats={},J._sock=null,J._display=null,J._flushing=!1,J._keyboard=null,J._gestures=null,J._disconnTimer=null,J._resizeTimeout=null,J._mouseMoveTimer=null,J._decoders={},J._FBU={rects:0,x:0,y:0,width:0,height:0,encoding:null},J._mousePos={},J._mouseButtonMask=0,J._mouseLastMoveTime=0,J._viewportDragging=!1,J._viewportDragPos={},J._viewportHasMoved=!1,J._accumulatedWheelDeltaX=0,J._accumulatedWheelDeltaY=0,J._gestureLastTapTime=null,J._gestureFirstDoubleTapEv=null,J._gestureLastMagnitudeX=0,J._gestureLastMagnitudeY=0,J._eventHandlers={focusCanvas:J._focusCanvas.bind(W(J)),windowResize:J._windowResize.bind(W(J)),handleMouse:J._handleMouse.bind(W(J)),handleWheel:J._handleWheel.bind(W(J)),handleGesture:J._handleGesture.bind(W(J))},k.Debug(">> RFB.constructor"),J._screen=document.createElement("div"),J._screen.style.display="flex",J._screen.style.width="100%",J._screen.style.height="100%",J._screen.style.overflow="auto",J._screen.style.background=te,J._canvas=document.createElement("canvas"),J._canvas.style.margin="auto",J._canvas.style.outline="none",J._canvas.style.flexShrink="0",J._canvas.width=0,J._canvas.height=0,J._canvas.tabIndex=-1,J._screen.appendChild(J._canvas),J._cursor=new s.default,J._cursorImage=Ee.cursors.none,J._decoders[i.encodings.encodingRaw]=new h.default,J._decoders[i.encodings.encodingCopyRect]=new f.default,J._decoders[i.encodings.encodingRRE]=new w.default,J._decoders[i.encodings.encodingHextile]=new m.default,J._decoders[i.encodings.encodingTight]=new T.default,J._decoders[i.encodings.encodingTightPNG]=new C.default;try{J._display=new y.default(J._canvas)}catch(Ce){throw k.Error("Display exception: "+Ce),Ce}return J._display.onflush=J._onFlush.bind(W(J)),J._keyboard=new o.default(J._canvas),J._keyboard.onkeyevent=J._handleKeyEvent.bind(W(J)),J._gestures=new d.default,J._sock=new l.default,J._sock.on("message",function(){J._handleMessage()}),J._sock.on("open",function(){J._rfbConnectionState==="connecting"&&J._rfbInitState===""?(J._rfbInitState="ProtocolVersion",k.Debug("Starting VNC handshake")):J._fail("Unexpected server connection while "+J._rfbConnectionState)}),J._sock.on("close",function(Ce){k.Debug("WebSocket on-close event");var We="";Ce.code&&(We="(code: "+Ce.code,Ce.reason&&(We+=", reason: "+Ce.reason),We+=")");switch(J._rfbConnectionState){case"connecting":J._fail("Connection closed "+We);break;case"connected":J._updateConnectionState("disconnecting"),J._updateConnectionState("disconnected");break;case"disconnecting":J._updateConnectionState("disconnected");break;case"disconnected":J._fail("Unexpected server disconnect when already disconnected "+We);break;default:J._fail("Unexpected server disconnect before connecting "+We);break}J._sock.off("close")}),J._sock.on("error",function(Ce){return k.Warn("WebSocket on-error event")}),setTimeout(J._updateConnectionState.bind(W(J),"connecting")),k.Debug("<< RFB.constructor"),J.dragViewport=!1,J.focusOnClick=!0,J._viewOnly=!1,J._clipViewport=!1,J._scaleViewport=!1,J._resizeSession=!1,J._showDotCursor=!1,fe.showDotCursor!==void 0&&(k.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated"),J._showDotCursor=fe.showDotCursor),J._qualityLevel=6,J._compressionLevel=2,J}return I(Ee,[{key:"disconnect",value:function(){this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open")}},{key:"sendCredentials",value:function($){this._rfbCredentials=$,setTimeout(this._initMsg.bind(this),0)}},{key:"sendCtrlAltDel",value:function(){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;k.Info("Sending Ctrl-Alt-Del"),this.sendKey(n.default.XK_Control_L,"ControlLeft",!0),this.sendKey(n.default.XK_Alt_L,"AltLeft",!0),this.sendKey(n.default.XK_Delete,"Delete",!0),this.sendKey(n.default.XK_Delete,"Delete",!1),this.sendKey(n.default.XK_Alt_L,"AltLeft",!1),this.sendKey(n.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($,fe,J){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(J===void 0){this.sendKey($,fe,!0),this.sendKey($,fe,!1);return}var Ce=a.default[fe];if(this._qemuExtKeyEventSupported&&Ce)$=$||0,k.Info("Sending key ("+(J?"down":"up")+"): keysym "+$+", scancode "+Ce),Ee.messages.QEMUExtendedKeyEvent(this._sock,$,J,Ce);else{if(!$)return;k.Info("Sending keysym ("+(J?"down":"up")+"): "+$),Ee.messages.keyEvent(this._sock,$,J?1:0)}}},{key:"focus",value:function(){this._canvas.focus()}},{key:"blur",value:function(){this._canvas.blur()}},{key:"clipboardPasteFrom",value:function($){if(this._rfbConnectionState!=="connected"||this._viewOnly)return;if(this._clipboardServerCapabilitiesFormats[ye]&&this._clipboardServerCapabilitiesActions[je])this._clipboardText=$,Ee.messages.extendedClipboardNotify(this._sock,[ye]);else{for(var fe=new Uint8Array($.length),J=0;J<$.length;J++)fe[J]=$.charCodeAt(J);Ee.messages.clientCutText(this._sock,fe)}}},{key:"_connect",value:function(){k.Debug(">> RFB.connect"),k.Info("connecting to "+this._url);try{this._sock.open(this._url,this._wsProtocols)}catch($){$.name==="SyntaxError"?this._fail("Invalid host or port ("+$+")"):this._fail("Error when opening socket ("+$+")")}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),k.Debug("<< RFB.connect")}},{key:"_disconnect",value:function(){k.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($){if(!($.name==="NotFoundError"))throw $}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),k.Debug("<< RFB.disconnect")}},{key:"_focusCanvas",value:function($){if(!this.focusOnClick)return;this.focus()}},{key:"_setDesktopName",value:function($){this._fbName=$,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}},{key:"_windowResize",value:function($){var fe=this;window.requestAnimationFrame(function(){fe._updateClip(),fe._updateScale()}),this._resizeSession&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),500))}},{key:"_updateClip",value:function(){var $=this._display.clipViewport,fe=this._clipViewport;if(this._scaleViewport&&(fe=!1),$!==fe&&(this._display.clipViewport=fe),fe){var J=this._screenSize();this._display.viewportChangeSize(J.w,J.h),this._fixScrollbars()}}},{key:"_updateScale",value:function(){if(!this._scaleViewport)this._display.scale=1;else{var $=this._screenSize();this._display.autoscale($.w,$.h)}this._fixScrollbars()}},{key:"_requestRemoteResize",value:function(){if(clearTimeout(this._resizeTimeout),this._resizeTimeout=null,!this._resizeSession||this._viewOnly||!this._supportsSetDesktopSize)return;var $=this._screenSize();Ee.messages.setDesktopSize(this._sock,Math.floor($.w),Math.floor($.h),this._screenID,this._screenFlags),k.Debug("Requested new desktop size: "+$.w+"x"+$.h)}},{key:"_screenSize",value:function(){var $=this._screen.getBoundingClientRect();return{w:$.width,h:$.height}}},{key:"_fixScrollbars",value:function(){var $=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=$}},{key:"_updateConnectionState",value:function($){var fe=this,J=this._rfbConnectionState;if($===J){k.Debug("Already in state '"+$+"', ignoring");return}if(J==="disconnected"){k.Error("Tried changing state of a disconnected RFB object");return}switch($){case"connected":if(J!=="connecting"){k.Error("Bad transition to connected state, previous connection state: "+J);return}break;case"disconnected":if(J!=="disconnecting"){k.Error("Bad transition to disconnected state, previous connection state: "+J);return}break;case"connecting":if(J!==""){k.Error("Bad transition to connecting state, previous connection state: "+J);return}break;case"disconnecting":if(J!=="connected"&&J!=="connecting"){k.Error("Bad transition to disconnecting state, previous connection state: "+J);return}break;default:k.Error("Unknown connection state: "+$);return}this._rfbConnectionState=$,k.Debug("New state '"+$+"', was '"+J+"'."),this._disconnTimer&&$!=="disconnecting"&&(k.Debug("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close"));switch($){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout(function(){k.Error("Disconnection timed out."),fe._updateConnectionState("disconnected")},z*1e3);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}));break}}},{key:"_fail",value:function($){switch(this._rfbConnectionState){case"disconnecting":k.Error("Failed when disconnecting: "+$);break;case"connected":k.Error("Failed while connected: "+$);break;case"connecting":k.Error("Failed when connecting: "+$);break;default:k.Error("RFB failure: "+$);break}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}},{key:"_setCapability",value:function($,fe){this._capabilities[$]=fe,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}},{key:"_handleMessage",value:function(){if(this._sock.rQlen===0){k.Warn("handleMessage called on an empty receive queue");return}switch(this._rfbConnectionState){case"disconnected":k.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($,fe,J){this.sendKey($,fe,J)}},{key:"_handleMouse",value:function($){if($.type==="click"&&$.target!==this._canvas)return;if($.stopPropagation(),$.preventDefault(),$.type==="click"||$.type==="contextmenu")return;var fe=(0,O.clientToElement)($.clientX,$.clientY,this._canvas);switch($.type){case"mousedown":(0,c.setCapture)(this._canvas),this._handleMouseButton(fe.x,fe.y,!0,1<<$.button);break;case"mouseup":this._handleMouseButton(fe.x,fe.y,!1,1<<$.button);break;case"mousemove":this._handleMouseMove(fe.x,fe.y);break}}},{key:"_handleMouseButton",value:function($,fe,J,Ce){if(this.dragViewport)if(J&&!this._viewportDragging){this._viewportDragging=!0,this._viewportDragPos={x:$,y:fe},this._viewportHasMoved=!1;return}else{if(this._viewportDragging=!1,this._viewportHasMoved)return;this._sendMouse($,fe,Ce)}this._mouseMoveTimer!==null&&(clearTimeout(this._mouseMoveTimer),this._mouseMoveTimer=null,this._sendMouse($,fe,this._mouseButtonMask)),J?this._mouseButtonMask|=Ce:this._mouseButtonMask&=~Ce,this._sendMouse($,fe,this._mouseButtonMask)}},{key:"_handleMouseMove",value:function($,fe){var J=this;if(this._viewportDragging){var Ce=this._viewportDragPos.x-$,We=this._viewportDragPos.y-fe;(this._viewportHasMoved||Math.abs(Ce)>R.dragThreshold||Math.abs(We)>R.dragThreshold)&&(this._viewportHasMoved=!0,this._viewportDragPos={x:$,y:fe},this._display.viewportChangePos(Ce,We));return}if(this._mousePos={x:$,y:fe},this._mouseMoveTimer==null){var Ve=Date.now()-this._mouseLastMoveTime;Ve>de?(this._sendMouse($,fe,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()):this._mouseMoveTimer=setTimeout(function(){J._handleDelayedMouseMove()},de-Ve)}}},{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($,fe,J){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;Ee.messages.pointerEvent(this._sock,this._display.absX($),this._display.absY(fe),J)}},{key:"_handleWheel",value:function($){if(this._rfbConnectionState!=="connected")return;if(this._viewOnly)return;$.stopPropagation(),$.preventDefault();var fe=(0,O.clientToElement)($.clientX,$.clientY,this._canvas),J=$.deltaX,Ce=$.deltaY;$.deltaMode!==0&&(J*=Ue,Ce*=Ue),this._accumulatedWheelDeltaX+=J,this._accumulatedWheelDeltaY+=Ce,Math.abs(this._accumulatedWheelDeltaX)>=ge&&(this._accumulatedWheelDeltaX<0?(this._handleMouseButton(fe.x,fe.y,!0,1<<5),this._handleMouseButton(fe.x,fe.y,!1,1<<5)):this._accumulatedWheelDeltaX>0&&(this._handleMouseButton(fe.x,fe.y,!0,1<<6),this._handleMouseButton(fe.x,fe.y,!1,1<<6)),this._accumulatedWheelDeltaX=0),Math.abs(this._accumulatedWheelDeltaY)>=ge&&(this._accumulatedWheelDeltaY<0?(this._handleMouseButton(fe.x,fe.y,!0,1<<3),this._handleMouseButton(fe.x,fe.y,!1,1<<3)):this._accumulatedWheelDeltaY>0&&(this._handleMouseButton(fe.x,fe.y,!0,1<<4),this._handleMouseButton(fe.x,fe.y,!1,1<<4)),this._accumulatedWheelDeltaY=0)}},{key:"_fakeMouseMove",value:function($,fe,J){this._handleMouseMove(fe,J),this._cursor.move($.detail.clientX,$.detail.clientY)}},{key:"_handleTapEvent",value:function($,fe){var J=(0,O.clientToElement)($.detail.clientX,$.detail.clientY,this._canvas);if(this._gestureLastTapTime!==null&&Date.now()-this._gestureLastTapTime<Oe&&this._gestureFirstDoubleTapEv.detail.type===$.detail.type){var Ce=this._gestureFirstDoubleTapEv.detail.clientX-$.detail.clientX,We=this._gestureFirstDoubleTapEv.detail.clientY-$.detail.clientY,Ve=Math.hypot(Ce,We);Ve<Fe?J=(0,O.clientToElement)(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas):this._gestureFirstDoubleTapEv=$}else this._gestureFirstDoubleTapEv=$;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,J.x,J.y),this._handleMouseButton(J.x,J.y,!0,fe),this._handleMouseButton(J.x,J.y,!1,fe)}},{key:"_handleGesture",value:function($){var fe,J=(0,O.clientToElement)($.detail.clientX,$.detail.clientY,this._canvas);switch($.type){case"gesturestart":switch($.detail.type){case"onetap":this._handleTapEvent($,1);break;case"twotap":this._handleTapEvent($,4);break;case"threetap":this._handleTapEvent($,2);break;case"drag":this._fakeMouseMove($,J.x,J.y),this._handleMouseButton(J.x,J.y,!0,1);break;case"longpress":this._fakeMouseMove($,J.x,J.y),this._handleMouseButton(J.x,J.y,!0,4);break;case"twodrag":this._gestureLastMagnitudeX=$.detail.magnitudeX,this._gestureLastMagnitudeY=$.detail.magnitudeY,this._fakeMouseMove($,J.x,J.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot($.detail.magnitudeX,$.detail.magnitudeY),this._fakeMouseMove($,J.x,J.y);break}break;case"gesturemove":switch($.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":this._fakeMouseMove($,J.x,J.y);break;case"twodrag":for(this._fakeMouseMove($,J.x,J.y);$.detail.magnitudeY-this._gestureLastMagnitudeY>Le;)this._handleMouseButton(J.x,J.y,!0,8),this._handleMouseButton(J.x,J.y,!1,8),this._gestureLastMagnitudeY+=Le;for(;$.detail.magnitudeY-this._gestureLastMagnitudeY<-Le;)this._handleMouseButton(J.x,J.y,!0,16),this._handleMouseButton(J.x,J.y,!1,16),this._gestureLastMagnitudeY-=Le;for(;$.detail.magnitudeX-this._gestureLastMagnitudeX>Le;)this._handleMouseButton(J.x,J.y,!0,32),this._handleMouseButton(J.x,J.y,!1,32),this._gestureLastMagnitudeX+=Le;for(;$.detail.magnitudeX-this._gestureLastMagnitudeX<-Le;)this._handleMouseButton(J.x,J.y,!0,64),this._handleMouseButton(J.x,J.y,!1,64),this._gestureLastMagnitudeX-=Le;break;case"pinch":if(this._fakeMouseMove($,J.x,J.y),fe=Math.hypot($.detail.magnitudeX,$.detail.magnitudeY),Math.abs(fe-this._gestureLastMagnitudeX)>Me){for(this._handleKeyEvent(n.default.XK_Control_L,"ControlLeft",!0);fe-this._gestureLastMagnitudeX>Me;)this._handleMouseButton(J.x,J.y,!0,8),this._handleMouseButton(J.x,J.y,!1,8),this._gestureLastMagnitudeX+=Me;for(;fe-this._gestureLastMagnitudeX<-Me;)this._handleMouseButton(J.x,J.y,!0,16),this._handleMouseButton(J.x,J.y,!1,16),this._gestureLastMagnitudeX-=Me}this._handleKeyEvent(n.default.XK_Control_L,"ControlLeft",!1);break}break;case"gestureend":switch($.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":this._fakeMouseMove($,J.x,J.y),this._handleMouseButton(J.x,J.y,!1,1);break;case"longpress":this._fakeMouseMove($,J.x,J.y),this._handleMouseButton(J.x,J.y,!1,4);break}break}}},{key:"_negotiateProtocolVersion",value:function(){if(this._sock.rQwait("version",12))return!1;var $=this._sock.rQshiftStr(12).substr(4,7);k.Info("Server ProtocolVersion: "+$);var fe=0;switch($){case"000.000":fe=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 "+$)}if(fe){for(var J="ID:"+this._repeaterID;J.length<250;)J+="\0";return this._sock.sendString(J),!0}this._rfbVersion>this._rfbMaxVersion&&(this._rfbVersion=this._rfbMaxVersion);var Ce="00"+parseInt(this._rfbVersion,10)+".00"+this._rfbVersion*10%10;this._sock.sendString("RFB "+Ce+`
|
|
|
`),k.Debug("Sent ProtocolVersion: "+Ce),this._rfbInitState="Security"}},{key:"_negotiateSecurity",value:function(){function $(Ce,We){for(var Ve=0;Ve<We.length;Ve++)if(We[Ve]===Ce)return!0;return!1}if(this._rfbVersion>=3.7){var fe=this._sock.rQshift8();if(this._sock.rQwait("security type",fe,1))return!1;if(fe===0)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,this._initMsg();var J=this._sock.rQshiftBytes(fe);if(k.Debug("Server security types: "+J),$(1,J))this._rfbAuthScheme=1;else if($(22,J))this._rfbAuthScheme=22;else if($(16,J))this._rfbAuthScheme=16;else if($(2,J))this._rfbAuthScheme=2;else if($(19,J))this._rfbAuthScheme=19;else return this._fail("Unsupported security types (types: "+J+")");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",k.Debug("Authenticating using scheme: "+this._rfbAuthScheme),this._initMsg()}},{key:"_handleSecurityReason",value:function(){if(this._sock.rQwait("reason length",4))return!1;var $=this._sock.rQshift32(),fe="";if($>0){if(this._sock.rQwait("reason",$,4))return!1;fe=this._sock.rQshiftStr($)}return fe!==""?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:fe}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+fe+")")):(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 $=String.fromCharCode(this._rfbCredentials.username.length)+String.fromCharCode(this._rfbCredentials.target.length)+this._rfbCredentials.username+this._rfbCredentials.target;return this._sock.sendString($),this._rfbAuthScheme=2,this._negotiateAuthentication()}},{key:"_negotiateVeNCryptAuth",value:function(){if(this._rfbVeNCryptState==0){if(this._sock.rQwait("vencrypt version",2))return!1;var $=this._sock.rQshift8(),fe=this._sock.rQshift8();if(!($==0&&fe==2))return this._fail("Unsupported VeNCrypt version "+$+"."+fe);this._sock.send([0,2]),this._rfbVeNCryptState=1}if(this._rfbVeNCryptState==1){if(this._sock.rQwait("vencrypt ack",1))return!1;var J=this._sock.rQshift8();if(J!=0)return this._fail("VeNCrypt failure "+J);this._rfbVeNCryptState=2}if(this._rfbVeNCryptState==2){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;var Ce=this._sock.rQshift8();if(Ce<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=Ce,this._rfbVeNCryptState=3}if(this._rfbVeNCryptState==3){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;for(var We=[],Ve=0;Ve<this._rfbVeNCryptSubtypesLength;Ve++)We.push(this._sock.rQshift32());if(We.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 Pe=(0,D.encodeUTF8)(this._rfbCredentials.username),Je=(0,D.encodeUTF8)(this._rfbCredentials.password);return this._sock.send([0,0,0,Pe.length]),this._sock.send([0,0,0,Je.length]),this._sock.sendString(Pe),this._sock.sendString(Je),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 $=Array.prototype.slice.call(this._sock.rQshiftBytes(16)),fe=Ee.genDES(this._rfbCredentials.password,$);return this._sock.send(fe),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($){for(var fe={0:{vendor:"TGHT",signature:"NOTUNNEL"}},J={},Ce=0;Ce<$;Ce++){var We=this._sock.rQshift32(),Ve=this._sock.rQshiftStr(4),Pe=this._sock.rQshiftStr(8);J[We]={vendor:Ve,signature:Pe}}return k.Debug("Server Tight tunnel types: "+J),J[1]&&J[1].vendor==="SICR"&&J[1].signature==="SCHANNEL"&&(k.Debug("Detected Siemens server. Assuming NOTUNNEL support."),J[0]={vendor:"TGHT",signature:"NOTUNNEL"}),J[0]?J[0].vendor!=fe[0].vendor||J[0].signature!=fe[0].signature?this._fail("Client's tunnel type had the incorrect vendor or signature"):(k.Debug("Selected tunnel type: "+fe[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 $=this._sock.rQshift32();if($>0&&this._sock.rQwait("tunnel capabilities",16*$,4))return!1;if(this._rfbTightVNC=!0,$>0)return this._negotiateTightTunnels($),!1}if(this._sock.rQwait("sub auth count",4))return!1;var fe=this._sock.rQshift32();if(fe===0)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*fe,4))return!1;for(var J={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},Ce=[],We=0;We<fe;We++){this._sock.rQshift32();var Ve=this._sock.rQshiftStr(12);Ce.push(Ve)}k.Debug("Server Tight authentication types: "+Ce);for(var Pe in J)if(Ce.indexOf(Pe)!=-1){this._sock.send([0,0,0,J[Pe]]),k.Debug("Selected authentication type: "+Pe);switch(Pe){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: "+Pe+")")}}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 $=this._sock.rQshift32();return $===0?(this._rfbInitState="ClientInitialisation",k.Debug("Authentication OK"),this._initMsg()):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=$,this._initMsg()):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:$}})),this._fail("Security handshake failed"))}},{key:"_negotiateServerInit",value:function(){if(this._sock.rQwait("server initialization",24))return!1;var $=this._sock.rQshift16(),fe=this._sock.rQshift16(),J=this._sock.rQshift8(),Ce=this._sock.rQshift8(),We=this._sock.rQshift8(),Ve=this._sock.rQshift8(),Pe=this._sock.rQshift16(),Je=this._sock.rQshift16(),ne=this._sock.rQshift16(),be=this._sock.rQshift8(),Re=this._sock.rQshift8(),le=this._sock.rQshift8();this._sock.rQskipBytes(3);var se=this._sock.rQshift32();if(this._sock.rQwait("server init name",se,24))return!1;var he=this._sock.rQshiftStr(se);if(he=(0,D.decodeUTF8)(he,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+se))return!1;var Y=this._sock.rQshift16(),Z=this._sock.rQshift16(),G=this._sock.rQshift16();this._sock.rQskipBytes(2);var ae=(Y+Z+G)*16;if(this._sock.rQwait("TightVNC extended server init header",ae,32+se))return!1;this._sock.rQskipBytes(16*Y),this._sock.rQskipBytes(16*Z),this._sock.rQskipBytes(16*G)}return k.Info("Screen: "+$+"x"+fe+", bpp: "+J+", depth: "+Ce+", bigEndian: "+We+", trueColor: "+Ve+", redMax: "+Pe+", greenMax: "+Je+", blueMax: "+ne+", redShift: "+be+", greenShift: "+Re+", blueShift: "+le),this._setDesktopName(he),this._resize($,fe),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,this._fbName==="Intel(r) AMT KVM"&&(k.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),Ee.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),Ee.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}},{key:"_sendEncodings",value:function(){var $=[];$.push(i.encodings.encodingCopyRect),this._fbDepth==24&&($.push(i.encodings.encodingTight),$.push(i.encodings.encodingTightPNG),$.push(i.encodings.encodingHextile),$.push(i.encodings.encodingRRE)),$.push(i.encodings.encodingRaw),$.push(i.encodings.pseudoEncodingQualityLevel0+this._qualityLevel),$.push(i.encodings.pseudoEncodingCompressLevel0+this._compressionLevel),$.push(i.encodings.pseudoEncodingDesktopSize),$.push(i.encodings.pseudoEncodingLastRect),$.push(i.encodings.pseudoEncodingQEMUExtendedKeyEvent),$.push(i.encodings.pseudoEncodingExtendedDesktopSize),$.push(i.encodings.pseudoEncodingXvp),$.push(i.encodings.pseudoEncodingFence),$.push(i.encodings.pseudoEncodingContinuousUpdates),$.push(i.encodings.pseudoEncodingDesktopName),$.push(i.encodings.pseudoEncodingExtendedClipboard),this._fbDepth==24&&($.push(i.encodings.pseudoEncodingVMwareCursor),$.push(i.encodings.pseudoEncodingCursor)),Ee.messages.clientEncodings(this._sock,$)}},{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 k.Debug("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}},{key:"_handleServerCutText",value:function(){if(k.Debug("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);var $=this._sock.rQshift32();if($=(0,j.toSigned32bit)($),this._sock.rQwait("ServerCutText content",Math.abs($),8))return!1;if($>=0){var fe=this._sock.rQshiftStr($);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:fe}}))}else{$=Math.abs($);var J=this._sock.rQshift32(),Ce=J&65535,We=J&4278190080,Ve=!!(We&Ie);if(Ve){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(var Pe=0;Pe<=15;Pe++){var Je=1<<Pe;Ce&Je&&(this._clipboardServerCapabilitiesFormats[Je]=!0,this._sock.rQshift32())}for(var ne=24;ne<=31;ne++){var be=1<<ne;this._clipboardServerCapabilitiesActions[be]=!!(We&be)}var Re=[Ie,Ke,Ne,je,Ge];Ee.messages.extendedClipboardCaps(this._sock,Re,{extendedClipboardFormatText:0})}else if(We===Ke){if(this._viewOnly)return!0;this._clipboardText!=null&&this._clipboardServerCapabilitiesActions[Ge]&&(Ce&ye&&Ee.messages.extendedClipboardProvide(this._sock,[ye],[this._clipboardText]))}else if(We===Ne){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[je]&&(this._clipboardText!=null?Ee.messages.extendedClipboardNotify(this._sock,[ye]):Ee.messages.extendedClipboardNotify(this._sock,[]))}else if(We===je){if(this._viewOnly)return!0;this._clipboardServerCapabilitiesActions[Ke]&&(Ce&ye&&Ee.messages.extendedClipboardRequest(this._sock,[ye]))}else if(We===Ge){if(this._viewOnly)return!0;if(!(Ce&ye))return!0;this._clipboardText=null;var le=this._sock.rQshiftBytes($-4),se=new p.default,he=null;se.setInput(le);for(var Y=0;Y<=15;Y++){var Z=1<<Y;if(Ce&Z){var G=0,ae=se.inflate(4);G|=ae[0]<<24,G|=ae[1]<<16,G|=ae[2]<<8,G|=ae[3];var Te=se.inflate(G);Z===ye&&(he=Te)}}if(se.setInput(null),he!==null){for(var X="",me=0;me<he.length;me++)X+=String.fromCharCode(he[me]);he=X,he=(0,D.decodeUTF8)(he),he.length>0&&he.charAt(he.length-1)==="\0"&&(he=he.slice(0,-1)),he=he.replace(`\r
|
|
|
`,`
|
|
|
`),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:he}}))}}else return this._fail("Unexpected action in extended clipboard message: "+We)}return!0}},{key:"_handleServerFenceMsg",value:function(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);var $=this._sock.rQshift32(),fe=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",fe,9))return!1;fe>64&&(k.Warn("Bad payload length ("+fe+") in fence response"),fe=64);var J=this._sock.rQshiftStr(fe);return this._supportsFence=!0,$&1<<31?($&=1<<0|1<<1,Ee.messages.clientFence(this._sock,$,J),!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 $=this._sock.rQshift8(),fe=this._sock.rQshift8();switch(fe){case 0:k.Error("XVP Operation Failed");break;case 1:this._rfbXvpVer=$,k.Info("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+fe+")");break}return!0}},{key:"_normalMsg",value:function(){var $;this._FBU.rects>0?$=0:$=this._sock.rQshift8();var fe,J;switch($){case 0:return J=this._framebufferUpdate(),J&&!this._enabledContinuousUpdates&&Ee.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),J;case 1:return this._handleSetColourMapMsg();case 2:return k.Debug("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return fe=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,fe&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),k.Info("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+$+")"),k.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 $=this._sock.rQshiftBytes(12);this._FBU.x=($[0]<<8)+$[1],this._FBU.y=($[2]<<8)+$[3],this._FBU.width=($[4]<<8)+$[5],this._FBU.height=($[6]<<8)+$[7],this._FBU.encoding=parseInt(($[8]<<24)+($[9]<<16)+($[10]<<8)+$[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 i.encodings.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case i.encodings.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case i.encodings.pseudoEncodingCursor:return this._handleCursor();case i.encodings.pseudoEncodingQEMUExtendedKeyEvent:try{var $=document.createEvent("keyboardEvent");$.code!==void 0&&(this._qemuExtKeyEventSupported=!0)}catch(fe){}return!0;case i.encodings.pseudoEncodingDesktopName:return this._handleDesktopName();case i.encodings.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case i.encodings.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();default:return this._handleDataRect()}}},{key:"_handleVMwareCursor",value:function(){var $=this._FBU.x,fe=this._FBU.y,J=this._FBU.width,Ce=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;var We=this._sock.rQshift8();this._sock.rQshift8();var Ve,Pe=4;if(We==0){var Je=4294967040|0;if(Ve=new Array(J*Ce*Pe),this._sock.rQwait("VMware cursor classic encoding",J*Ce*Pe*2,2))return!1;for(var ne=new Array(J*Ce),be=0;be<J*Ce;be++)ne[be]=this._sock.rQshift32();for(var Re=new Array(J*Ce),le=0;le<J*Ce;le++)Re[le]=this._sock.rQshift32();for(var se=0;se<J*Ce;se++)if(ne[se]==0){var he=Re[se],Y=he>>8&255,Z=he>>16&255,G=he>>24&255;Ve[se*Pe]=Y,Ve[se*Pe+1]=Z,Ve[se*Pe+2]=G,Ve[se*Pe+3]=255}else(ne[se]&Je)==Je?Re[se]==0?(Ve[se*Pe]=0,Ve[se*Pe+1]=0,Ve[se*Pe+2]=0,Ve[se*Pe+3]=0):((Re[se]&Je)==Je,Ve[se*Pe]=0,Ve[se*Pe+1]=0,Ve[se*Pe+2]=0,Ve[se*Pe+3]=255):(Ve[se*Pe]=0,Ve[se*Pe+1]=0,Ve[se*Pe+2]=0,Ve[se*Pe+3]=255)}else if(We==1){if(this._sock.rQwait("VMware cursor alpha encoding",J*Ce*4,2))return!1;Ve=new Array(J*Ce*Pe);for(var ae=0;ae<J*Ce;ae++){var Te=this._sock.rQshift32();Ve[ae*4]=Te>>24&255,Ve[ae*4+1]=Te>>16&255,Ve[ae*4+2]=Te>>8&255,Ve[ae*4+3]=Te&255}}else return k.Warn("The given cursor type is not supported: "+We+" given."),!1;return this._updateCursor(Ve,$,fe,J,Ce),!0}},{key:"_handleCursor",value:function(){var $=this._FBU.x,fe=this._FBU.y,J=this._FBU.width,Ce=this._FBU.height,We=J*Ce*4,Ve=Math.ceil(J/8)*Ce,Pe=We+Ve;if(this._sock.rQwait("cursor encoding",Pe))return!1;for(var Je=this._sock.rQshiftBytes(We),ne=this._sock.rQshiftBytes(Ve),be=new Uint8Array(J*Ce*4),Re=0,le=0;le<Ce;le++)for(var se=0;se<J;se++){var he=le*Math.ceil(J/8)+Math.floor(se/8),Y=ne[he]<<se%8&128?255:0;be[Re]=Je[Re+2],be[Re+1]=Je[Re+1],be[Re+2]=Je[Re],be[Re+3]=Y,Re+=4}return this._updateCursor(be,$,fe,J,Ce),!0}},{key:"_handleDesktopName",value:function(){if(this._sock.rQwait("DesktopName",4))return!1;var $=this._sock.rQshift32();if(this._sock.rQwait("DesktopName",$,4))return!1;var fe=this._sock.rQshiftStr($);return fe=(0,D.decodeUTF8)(fe,!0),this._setDesktopName(fe),!0}},{key:"_handleExtendedDesktopSize",value:function(){if(this._sock.rQwait("ExtendedDesktopSize",4))return!1;var $=this._sock.rQpeek8(),fe=4+$*16;if(this._sock.rQwait("ExtendedDesktopSize",fe))return!1;var J=!this._supportsSetDesktopSize;this._supportsSetDesktopSize=!0,J&&this._requestRemoteResize(),this._sock.rQskipBytes(1),this._sock.rQskipBytes(3);for(var Ce=0;Ce<$;Ce+=1)Ce===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 We="";switch(this._FBU.y){case 1:We="Resize is administratively prohibited";break;case 2:We="Out of resources";break;case 3:We="Invalid screen layout";break;default:We="Unknown reason";break}k.Warn("Server did not accept the resize request: "+We)}else this._resize(this._FBU.width,this._FBU.height);return!0}},{key:"_handleDataRect",value:function(){var $=this._decoders[this._FBU.encoding];if(!$)return this._fail("Unsupported encoding (encoding: "+this._FBU.encoding+")"),!1;try{return $.decodeRect(this._FBU.x,this._FBU.y,this._FBU.width,this._FBU.height,this._sock,this._display,this._fbDepth)}catch(fe){return this._fail("Error decoding rect: "+fe),!1}}},{key:"_updateContinuousUpdates",value:function(){if(!this._enabledContinuousUpdates)return;Ee.messages.enableContinuousUpdates(this._sock,!0,0,0,this._fbWidth,this._fbHeight)}},{key:"_resize",value:function($,fe){this._fbWidth=$,this._fbHeight=fe,this._display.resize(this._fbWidth,this._fbHeight),this._updateClip(),this._updateScale(),this._updateContinuousUpdates()}},{key:"_xvpOp",value:function($,fe){if(this._rfbXvpVer<$)return;k.Info("Sending XVP operation "+fe+" (version "+$+")"),Ee.messages.xvpOp(this._sock,$,fe)}},{key:"_updateCursor",value:function($,fe,J,Ce,We){this._cursorImage={rgbaPixels:$,hotx:fe,hoty:J,w:Ce,h:We},this._refreshCursor()}},{key:"_shouldShowDotCursor",value:function(){if(!this._showDotCursor)return!1;for(var $=3;$<this._cursorImage.rgbaPixels.length;$+=4)if(this._cursorImage.rgbaPixels[$])return!1;return!0}},{key:"_refreshCursor",value:function(){if(this._rfbConnectionState!=="connecting"&&this._rfbConnectionState!=="connected")return;var $=this._shouldShowDotCursor()?Ee.cursors.dot:this._cursorImage;this._cursor.change($.rgbaPixels,$.hotx,$.hoty,$.w,$.h)}},{key:"viewOnly",get:function(){return this._viewOnly},set:function($){this._viewOnly=$,(this._rfbConnectionState==="connecting"||this._rfbConnectionState==="connected")&&($?this._keyboard.ungrab():this._keyboard.grab())}},{key:"capabilities",get:function(){return this._capabilities}},{key:"touchButton",get:function(){return 0},set:function($){k.Warn("Using old API!")}},{key:"clipViewport",get:function(){return this._clipViewport},set:function($){this._clipViewport=$,this._updateClip()}},{key:"scaleViewport",get:function(){return this._scaleViewport},set:function($){this._scaleViewport=$,$&&this._clipViewport&&this._updateClip(),this._updateScale(),!$&&this._clipViewport&&this._updateClip()}},{key:"resizeSession",get:function(){return this._resizeSession},set:function($){this._resizeSession=$,$&&this._requestRemoteResize()}},{key:"showDotCursor",get:function(){return this._showDotCursor},set:function($){this._showDotCursor=$,this._refreshCursor()}},{key:"background",get:function(){return this._screen.style.background},set:function($){this._screen.style.background=$}},{key:"qualityLevel",get:function(){return this._qualityLevel},set:function($){if(!Number.isInteger($)||$<0||$>9){k.Error("qualityLevel must be an integer between 0 and 9");return}if(this._qualityLevel===$)return;this._qualityLevel=$,this._rfbConnectionState==="connected"&&this._sendEncodings()}},{key:"compressionLevel",get:function(){return this._compressionLevel},set:function($){if(!Number.isInteger($)||$<0||$>9){k.Error("compressionLevel must be an integer between 0 and 9");return}if(this._compressionLevel===$)return;this._compressionLevel=$,this._rfbConnectionState==="connected"&&this._sendEncodings()}}],[{key:"genDES",value:function($,fe){var J=$.split("").map(function(Ce){return Ce.charCodeAt(0)});return new r.default(J).encrypt(fe)}}]),Ee}(S.default);ce.default=ze,ze.messages={keyEvent:function(xe,Ee,Se){var $=xe._sQ,fe=xe._sQlen;$[fe]=4,$[fe+1]=Se,$[fe+2]=0,$[fe+3]=0,$[fe+4]=Ee>>24,$[fe+5]=Ee>>16,$[fe+6]=Ee>>8,$[fe+7]=Ee,xe._sQlen+=8,xe.flush()},QEMUExtendedKeyEvent:function(xe,Ee,Se,$){function fe(Ve){var Pe=$>>8,Je=$&255;return Pe===224&&Je<127?Je|128:Ve}var J=xe._sQ,Ce=xe._sQlen;J[Ce]=255,J[Ce+1]=0,J[Ce+2]=Se>>8,J[Ce+3]=Se,J[Ce+4]=Ee>>24,J[Ce+5]=Ee>>16,J[Ce+6]=Ee>>8,J[Ce+7]=Ee;var We=fe($);J[Ce+8]=We>>24,J[Ce+9]=We>>16,J[Ce+10]=We>>8,J[Ce+11]=We,xe._sQlen+=12,xe.flush()},pointerEvent:function(xe,Ee,Se,$){var fe=xe._sQ,J=xe._sQlen;fe[J]=5,fe[J+1]=$,fe[J+2]=Ee>>8,fe[J+3]=Ee,fe[J+4]=Se>>8,fe[J+5]=Se,xe._sQlen+=6,xe.flush()},_buildExtendedClipboardFlags:function(xe,Ee){for(var Se=new Uint8Array(4),$=0,fe=0,J=0;J<xe.length;J++)fe|=xe[J];for(var Ce=0;Ce<Ee.length;Ce++)$|=Ee[Ce];return Se[0]=fe>>24,Se[1]=0,Se[2]=0,Se[3]=$,Se},extendedClipboardProvide:function(xe,Ee,Se){for(var $=new u.default,fe=[],J=0;J<Ee.length;J++){if(Ee[J]!=ye)throw new Error("Unsupported extended clipboard format for Provide message.");Se[J]=Se[J].replace(/\r\n|\r|\n/gm,`\r
|
|
|
`);var Ce=(0,D.encodeUTF8)(Se[J]+"\0");fe.push(Ce.length>>24&255,Ce.length>>16&255,Ce.length>>8&255,Ce.length&255);for(var We=0;We<Ce.length;We++)fe.push(Ce.charCodeAt(We))}var Ve=$.deflate(new Uint8Array(fe)),Pe=new Uint8Array(4+Ve.length);Pe.set(ze.messages._buildExtendedClipboardFlags([Ge],Ee)),Pe.set(Ve,4),ze.messages.clientCutText(xe,Pe,!0)},extendedClipboardNotify:function(xe,Ee){var Se=ze.messages._buildExtendedClipboardFlags([je],Ee);ze.messages.clientCutText(xe,Se,!0)},extendedClipboardRequest:function(xe,Ee){var Se=ze.messages._buildExtendedClipboardFlags([Ke],Ee);ze.messages.clientCutText(xe,Se,!0)},extendedClipboardCaps:function(xe,Ee,Se){var $=Object.keys(Se),fe=new Uint8Array(4+4*$.length);$.map(function(We){return parseInt(We)}),$.sort(function(We,Ve){return We-Ve}),fe.set(ze.messages._buildExtendedClipboardFlags(Ee,[]));for(var J=4,Ce=0;Ce<$.length;Ce++)fe[J]=Se[$[Ce]]>>24,fe[J+1]=Se[$[Ce]]>>16,fe[J+2]=Se[$[Ce]]>>8,fe[J+3]=Se[$[Ce]]>>0,J+=4,fe[3]|=1<<$[Ce];ze.messages.clientCutText(xe,fe,!0)},clientCutText:function(xe,Ee){var Se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,$=xe._sQ,fe=xe._sQlen;$[fe]=6,$[fe+1]=0,$[fe+2]=0,$[fe+3]=0;var J;Se?J=(0,j.toUnsigned32bit)(-Ee.length):J=Ee.length,$[fe+4]=J>>24,$[fe+5]=J>>16,$[fe+6]=J>>8,$[fe+7]=J,xe._sQlen+=8;for(var Ce=0,We=Ee.length;We>0;){for(var Ve=Math.min(We,xe._sQbufferSize-xe._sQlen),Pe=0;Pe<Ve;Pe++)$[xe._sQlen+Pe]=Ee[Ce+Pe];xe._sQlen+=Ve,xe.flush(),We-=Ve,Ce+=Ve}},setDesktopSize:function(xe,Ee,Se,$,fe){var J=xe._sQ,Ce=xe._sQlen;J[Ce]=251,J[Ce+1]=0,J[Ce+2]=Ee>>8,J[Ce+3]=Ee,J[Ce+4]=Se>>8,J[Ce+5]=Se,J[Ce+6]=1,J[Ce+7]=0,J[Ce+8]=$>>24,J[Ce+9]=$>>16,J[Ce+10]=$>>8,J[Ce+11]=$,J[Ce+12]=0,J[Ce+13]=0,J[Ce+14]=0,J[Ce+15]=0,J[Ce+16]=Ee>>8,J[Ce+17]=Ee,J[Ce+18]=Se>>8,J[Ce+19]=Se,J[Ce+20]=fe>>24,J[Ce+21]=fe>>16,J[Ce+22]=fe>>8,J[Ce+23]=fe,xe._sQlen+=24,xe.flush()},clientFence:function(xe,Ee,Se){var $=xe._sQ,fe=xe._sQlen;$[fe]=248,$[fe+1]=0,$[fe+2]=0,$[fe+3]=0,$[fe+4]=Ee>>24,$[fe+5]=Ee>>16,$[fe+6]=Ee>>8,$[fe+7]=Ee;var J=Se.length;$[fe+8]=J;for(var Ce=0;Ce<J;Ce++)$[fe+9+Ce]=Se.charCodeAt(Ce);xe._sQlen+=9+J,xe.flush()},enableContinuousUpdates:function(xe,Ee,Se,$,fe,J){var Ce=xe._sQ,We=xe._sQlen;Ce[We]=150,Ce[We+1]=Ee,Ce[We+2]=Se>>8,Ce[We+3]=Se,Ce[We+4]=$>>8,Ce[We+5]=$,Ce[We+6]=fe>>8,Ce[We+7]=fe,Ce[We+8]=J>>8,Ce[We+9]=J,xe._sQlen+=10,xe.flush()},pixelFormat:function(xe,Ee,Se){var $=xe._sQ,fe=xe._sQlen,J;Ee>16?J=32:Ee>8?J=16:J=8;var Ce=Math.floor(Ee/3);$[fe]=0,$[fe+1]=0,$[fe+2]=0,$[fe+3]=0,$[fe+4]=J,$[fe+5]=Ee,$[fe+6]=0,$[fe+7]=Se?1:0,$[fe+8]=0,$[fe+9]=(1<<Ce)-1,$[fe+10]=0,$[fe+11]=(1<<Ce)-1,$[fe+12]=0,$[fe+13]=(1<<Ce)-1,$[fe+14]=Ce*2,$[fe+15]=Ce*1,$[fe+16]=Ce*0,$[fe+17]=0,$[fe+18]=0,$[fe+19]=0,xe._sQlen+=20,xe.flush()},clientEncodings:function(xe,Ee){var Se=xe._sQ,$=xe._sQlen;Se[$]=2,Se[$+1]=0,Se[$+2]=Ee.length>>8,Se[$+3]=Ee.length;for(var fe=$+4,J=0;J<Ee.length;J++){var Ce=Ee[J];Se[fe]=Ce>>24,Se[fe+1]=Ce>>16,Se[fe+2]=Ce>>8,Se[fe+3]=Ce,fe+=4}xe._sQlen+=fe-$,xe.flush()},fbUpdateRequest:function(xe,Ee,Se,$,fe,J){var Ce=xe._sQ,We=xe._sQlen;typeof Se=="undefined"&&(Se=0),typeof $=="undefined"&&($=0),Ce[We]=3,Ce[We+1]=Ee?1:0,Ce[We+2]=Se>>8&255,Ce[We+3]=Se&255,Ce[We+4]=$>>8&255,Ce[We+5]=$&255,Ce[We+6]=fe>>8&255,Ce[We+7]=fe&255,Ce[We+8]=J>>8&255,Ce[We+9]=J&255,xe._sQlen+=10,xe.flush()},xvpOp:function(xe,Ee,Se){var $=xe._sQ,fe=xe._sQlen;$[fe]=250,$[fe+1]=0,$[fe+2]=Ee,$[fe+3]=Se,xe._sQlen+=4,xe.flush()}},ze.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(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){"use strict";var k={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};j.defineMode("xml",function(R,O){var c=R.indentUnit,S={},y=O.htmlMode?k:D;for(var p in y)S[p]=y[p];for(var p in O)S[p]=O[p];var u,o;function d(v,M){function I(H){return M.tokenize=H,H(v,M)}var P=v.next();if(P=="<")return v.eat("!")?v.eat("[")?v.match("CDATA[")?I(r("atom","]]>")):null:v.match("--")?I(r("comment","-->")):v.match("DOCTYPE",!0,!0)?(v.eatWhile(/[\w\._\-]/),I(n(1))):null:v.eat("?")?(v.eatWhile(/[\w\._\-]/),M.tokenize=r("meta","?>"),"meta"):(u=v.eat("/")?"closeTag":"openTag",M.tokenize=s,"tag bracket");if(P=="&"){var B;return v.eat("#")?v.eat("x")?B=v.eatWhile(/[a-fA-F\d]/)&&v.eat(";"):B=v.eatWhile(/[\d]/)&&v.eat(";"):B=v.eatWhile(/[\w\.\-:]/)&&v.eat(";"),B?"atom":"error"}else return v.eatWhile(/[^&<]/),null}d.isInText=!0;function s(v,M){var I=v.next();if(I==">"||I=="/"&&v.eat(">"))return M.tokenize=d,u=I==">"?"endTag":"selfcloseTag","tag bracket";if(I=="=")return u="equals",null;if(I=="<"){M.tokenize=d,M.state=f,M.tagName=M.tagStart=null;var P=M.tokenize(v,M);return P?P+" tag error":"tag error"}else return/[\'\"]/.test(I)?(M.tokenize=l(I),M.stringStartCol=v.column(),M.tokenize(v,M)):(v.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function l(v){var M=function(I,P){for(;!I.eol();)if(I.next()==v){P.tokenize=s;break}return"string"};return M.isInAttribute=!0,M}function r(v,M){return function(I,P){for(;!I.eol();){if(I.match(M)){P.tokenize=d;break}I.next()}return v}}function n(v){return function(M,I){for(var P;(P=M.next())!=null;){if(P=="<")return I.tokenize=n(v+1),I.tokenize(M,I);if(P==">")if(v==1){I.tokenize=d;break}else return I.tokenize=n(v-1),I.tokenize(M,I)}return"meta"}}function a(v,M,I){this.prev=v.context,this.tagName=M,this.indent=v.indented,this.startOfLine=I,(S.doNotIndent.hasOwnProperty(M)||v.context&&v.context.noIndent)&&(this.noIndent=!0)}function i(v){v.context&&(v.context=v.context.prev)}function h(v,M){for(var I;;){if(!v.context)return;if(I=v.context.tagName,!S.contextGrabbers.hasOwnProperty(I)||!S.contextGrabbers[I].hasOwnProperty(M))return;i(v)}}function f(v,M,I){return v=="openTag"?(I.tagStart=M.column(),w):v=="closeTag"?m:f}function w(v,M,I){return v=="word"?(I.tagName=M.current(),o="tag",x):S.allowMissingTagName&&v=="endTag"?(o="tag bracket",x(v,M,I)):(o="error",w)}function m(v,M,I){if(v=="word"){var P=M.current();return I.context&&I.context.tagName!=P&&S.implicitlyClosed.hasOwnProperty(I.context.tagName)&&i(I),I.context&&I.context.tagName==P||S.matchClosing===!1?(o="tag",T):(o="tag error",C)}else return S.allowMissingTagName&&v=="endTag"?(o="tag bracket",T(v,M,I)):(o="error",C)}function T(v,M,I){return v!="endTag"?(o="error",T):(i(I),f)}function C(v,M,I){return o="error",T(v,M,I)}function x(v,M,I){if(v=="word")return o="attribute",b;if(v=="endTag"||v=="selfcloseTag"){var P=I.tagName,B=I.tagStart;return I.tagName=I.tagStart=null,v=="selfcloseTag"||S.autoSelfClosers.hasOwnProperty(P)?h(I,P):(h(I,P),I.context=new a(I,P,B==I.indented)),f}return o="error",x}function b(v,M,I){return v=="equals"?E:(S.allowMissing||(o="error"),x(v,M,I))}function E(v,M,I){return v=="string"?A:v=="word"&&S.allowUnquoted?(o="string",x):(o="error",x(v,M,I))}function A(v,M,I){return v=="string"?A:x(v,M,I)}return{startState:function(v){var M={tokenize:d,state:f,indented:v||0,tagName:null,tagStart:null,context:null};return v!=null&&(M.baseIndent=v),M},token:function(v,M){if(!M.tagName&&v.sol()&&(M.indented=v.indentation()),v.eatSpace())return null;u=null;var I=M.tokenize(v,M);return(I||u)&&I!="comment"&&(o=null,M.state=M.state(u||I,v,M),o&&(I=o=="error"?I+" error":o)),I},indent:function(v,M,I){var P=v.context;if(v.tokenize.isInAttribute)return v.tagStart==v.indented?v.stringStartCol+1:v.indented+c;if(P&&P.noIndent)return j.Pass;if(v.tokenize!=s&&v.tokenize!=d)return I?I.match(/^(\s*)/)[0].length:0;if(v.tagName)return S.multilineTagIndentPastTag!==!1?v.tagStart+v.tagName.length+2:v.tagStart+c*(S.multilineTagIndentFactor||1);if(S.alignCDATA&&/<!\[CDATA\[/.test(M))return 0;var B=M&&/^<(\/)?([\w_:\.-]*)/.exec(M);if(B&&B[1])for(;P;)if(P.tagName==B[2]){P=P.prev;break}else if(S.implicitlyClosed.hasOwnProperty(P.tagName))P=P.prev;else break;else if(B)for(;P;){var H=S.contextGrabbers[P.tagName];if(H&&H.hasOwnProperty(B[2]))P=P.prev;else break}for(;P&&P.prev&&!P.startOfLine;)P=P.prev;return P?P.indent+c:v.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:S.htmlMode?"html":"xml",helperType:S.htmlMode?"html":"xml",skipAttribute:function(v){v.state==E&&(v.state=x)},xmlCurrentTag:function(v){return v.tagName?{name:v.tagName,close:v.type=="closeTag"}:null},xmlCurrentContext:function(v){for(var M=[],I=v.context;I;I=I.prev)I.tagName&&M.push(I.tagName);return M.reverse()}}}),j.defineMIME("text/xml","xml"),j.defineMIME("application/xml","xml"),j.mimeModes.hasOwnProperty("text/html")||j.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1q3G":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=j;function j(){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}},"34/K":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(O,c){if(!(O instanceof c))throw new TypeError("Cannot call a class as a function")}function k(O,c){for(var S=0;S<c.length;S++){var y=c[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function D(O,c,S){return c&&k(O.prototype,c),S&&k(O,S),O}var R=function(){function O(){j(this,O),this._lines=0}return D(O,[{key:"decodeRect",value:function(S,y,p,u,o,d,s){this._lines===0&&(this._lines=u);var l=s==8?1:4,r=p*l;if(o.rQwait("RAW",r))return!1;var n=y+(u-this._lines),a=Math.min(this._lines,Math.floor(o.rQlen/r)),i=o.rQ,h=o.rQi;if(s==8){for(var f=p*a,w=new Uint8Array(f*4),m=0;m<f;m++)w[m*4+0]=(i[h+m]>>0&3)*255/3,w[m*4+1]=(i[h+m]>>2&3)*255/3,w[m*4+2]=(i[h+m]>>4&3)*255/3,w[m*4+4]=0;i=w,h=0}return d.blitImage(S,n,p,a,i,h),o.rQskipBytes(a*r),this._lines-=a,!(this._lines>0)}}]),O}();ce.default=R},"3690":function(Ze,ce,ie){"use strict";function j(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(o){return typeof o}:j=function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},j(p)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=R(ie("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var p=new WeakMap;return D=function(){return p},p}function R(p){if(p&&p.__esModule)return p;if(p===null||j(p)!=="object"&&typeof p!="function")return{default:p};var u=D();if(u&&u.has(p))return u.get(p);var o={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in p)if(Object.prototype.hasOwnProperty.call(p,s)){var l=d?Object.getOwnPropertyDescriptor(p,s):null;l&&(l.get||l.set)?Object.defineProperty(o,s,l):o[s]=p[s]}return o.default=p,u&&u.set(p,o),o}function O(p,u){if(!(p instanceof u))throw new TypeError("Cannot call a class as a function")}function c(p,u){for(var o=0;o<u.length;o++){var d=u[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function S(p,u,o){return u&&c(p.prototype,u),o&&c(p,o),p}var y=function(){function p(){O(this,p),this._tiles=0,this._lastsubencoding=0}return S(p,[{key:"decodeRect",value:function(o,d,s,l,r,n,a){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 i=1;if(r.rQwait("HEXTILE",i))return!1;var h=r.rQ,f=r.rQi,w=h[f];if(w>30)throw new Error("Illegal hextile subencoding (subencoding: "+w+")");var m=this._totalTiles-this._tiles,T=m%this._tilesX,C=Math.floor(m/this._tilesX),x=o+T*16,b=d+C*16,E=Math.min(16,o+s-x),A=Math.min(16,d+l-b);if(w&1)i+=E*A*4;else if(w&2&&(i+=4),w&4&&(i+=4),w&8){if(i++,r.rQwait("HEXTILE",i))return!1;var v=h[f+i-1];w&16?i+=v*(4+2):i+=v*2}if(r.rQwait("HEXTILE",i))return!1;if(f++,w===0)this._lastsubencoding&1?k.Debug(" Ignoring blank after RAW"):n.fillRect(x,b,E,A,this._background);else if(w&1)n.blitImage(x,b,E,A,h,f),f+=i-1;else{if(w&2&&(this._background=[h[f],h[f+1],h[f+2],h[f+3]],f+=4),w&4&&(this._foreground=[h[f],h[f+1],h[f+2],h[f+3]],f+=4),n.startTile(x,b,E,A,this._background),w&8){var M=h[f];f++;for(var I=0;I<M;I++){var P=void 0;w&16?(P=[h[f],h[f+1],h[f+2],h[f+3]],f+=4):P=this._foreground;var B=h[f];f++;var H=B>>4,F=B&15,W=h[f];f++;var U=(W>>4)+1,K=(W&15)+1;n.subTile(H,F,U,K,P)}}n.finishTile()}r.rQi=f,this._lastsubencoding=w,this._tiles--}return!0}}]),p}();ce.default=y},"6BzB":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.shrinkBuf=j,ce.arraySet=k,ce.flattenChunks=D,ce.Buf32=ce.Buf16=ce.Buf8=void 0;function j(S,y){return S.length===y?S:S.subarray?S.subarray(0,y):(S.length=y,S)}function k(S,y,p,u,o){if(y.subarray&&S.subarray){S.set(y.subarray(p,p+u),o);return}for(var d=0;d<u;d++)S[o+d]=y[p+d]}function D(S){var y,p,u,o,d,s;for(u=0,y=0,p=S.length;y<p;y++)u+=S[y].length;for(s=new Uint8Array(u),o=0,y=0,p=S.length;y<p;y++)d=S[y],s.set(d,o),o+=d.length;return s}var R=Uint8Array;ce.Buf8=R;var O=Uint16Array;ce.Buf16=O;var c=Int32Array;ce.Buf32=c},"6Qwc":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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"};ce.default=j},"7ahc":function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return w});var j=ie("k1fw"),k=ie("0Owb"),D=ie("+L6B"),R=ie("2/Rp"),O=ie("y8nQ"),c=ie("Vl3Y"),S=ie("tJVT"),y=ie("OaEy"),p=ie("2fM7"),u=ie("q1tI"),o=ie.n(u),d=ie("VrN/"),s=ie.n(d),l=ie("p77/"),r=ie.n(l),n=ie("c5Ni"),a=ie.n(n),i=p.a.Option,h={labelCol:{span:4},wrapperCol:{span:20}},f={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"]};ce.b=function(m){var T=m.callback,C=m.onCancel,x=Object(u.useState)("python"),b=Object(S.a)(x,2),E=b[0],A=b[1];function v(I){A(f[I][1])}function M(I){T(I)}return o.a.createElement(c.a,Object(k.a)({},h,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:M}),o.a.createElement(c.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},o.a.createElement(p.a,{onChange:v},Object.keys(f).map(function(I){return o.a.createElement(i,{key:I,value:I},f[I][0])}))),o.a.createElement(c.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},o.a.createElement(w,{mode:E})),o.a.createElement("div",{className:"flex-container flex-end"},o.a.createElement(R.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),o.a.createElement(R.a,{type:"ghost",onClick:C},"\u53D6\u6D88")))};function w(m){var T=m.value,C=m.onChange,x=m.mode,b=m.options,E=b===void 0?{}:b,A=Object(u.useRef)(),v=Object(u.useState)(),M=Object(S.a)(v,2),I=M[0],P=M[1];return Object(u.useEffect)(function(){if(I){function B(H){var F=H.getValue();C&&C(F)}return I.on("change",B),function(){I.off("change",B)}}},[I,C]),Object(u.useEffect)(function(){I&&I.setOption("mode",x)},[I,x]),Object(u.useEffect)(function(){I&&((T!==I.getValue()||T==="")&&setTimeout(function(){I.setValue(T||" ")},300))},[I,T]),Object(u.useEffect)(function(){if(A.current&&!I){var B=s.a.fromTextArea(A.current,Object(j.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},E));P(B)}},[A.current,I]),o.a.createElement("div",{className:"my-codemirror-container"},o.a.createElement("textarea",{ref:A}))}},"7ixt":function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return D});var j={adjustX:1,adjustY:1},k=[0,0],D={left:{points:["cr","cl"],overflow:j,offset:[-4,0],targetOffset:k},right:{points:["cl","cr"],overflow:j,offset:[4,0],targetOffset:k},top:{points:["bc","tc"],overflow:j,offset:[0,-4],targetOffset:k},bottom:{points:["tc","bc"],overflow:j,offset:[0,4],targetOffset:k},topLeft:{points:["bl","tl"],overflow:j,offset:[0,-4],targetOffset:k},leftTop:{points:["tr","tl"],overflow:j,offset:[-4,0],targetOffset:k},topRight:{points:["br","tr"],overflow:j,offset:[0,-4],targetOffset:k},rightTop:{points:["tl","tr"],overflow:j,offset:[4,0],targetOffset:k},bottomRight:{points:["tr","br"],overflow:j,offset:[0,4],targetOffset:k},rightBottom:{points:["bl","br"],overflow:j,offset:[4,0],targetOffset:k},bottomLeft:{points:["tl","bl"],overflow:j,offset:[0,4],targetOffset:k},leftBottom:{points:["br","bl"],overflow:j,offset:[-4,0],targetOffset:k}},R=D},"8+yF":function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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},k={lookup:function(R){if(R>=32&&R<=255)return R;var O=j[R];return O!==void 0?O:16777216|R}};ce.default=k},"8CQX":function(Ze,ce,ie){"use strict";function j(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(n){return typeof n}:j=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},j(l)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.getKeycode=o,ce.getKey=d,ce.getKeysym=s;var k=u(ie("mHUz")),D=u(ie("8+yF")),R=u(ie("6Qwc")),O=u(ie("gIYZ")),c=u(ie("mTgk")),S=p(ie("GdRQ"));function y(){if(typeof WeakMap!="function")return null;var l=new WeakMap;return y=function(){return l},l}function p(l){if(l&&l.__esModule)return l;if(l===null||j(l)!=="object"&&typeof l!="function")return{default:l};var r=y();if(r&&r.has(l))return r.get(l);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in l)if(Object.prototype.hasOwnProperty.call(l,i)){var h=a?Object.getOwnPropertyDescriptor(l,i):null;h&&(h.get||h.set)?Object.defineProperty(n,i,h):n[i]=l[i]}return n.default=l,r&&r.set(l,n),n}function u(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 R.default){var r=R.default[l.keyCode];if(S.isMac()&&r==="ContextMenu"&&(r="MetaRight"),l.location===2)switch(r){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(l.location===3)switch(r){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 r}return"Unidentified"}function d(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 r=o(l);return r in O.default?O.default[r]:l.charCode?String.fromCharCode(l.charCode):"Unidentified"}function s(l){var r=d(l);if(r==="Unidentified")return null;if(r in c.default){var n=l.location;if(r==="Meta"&&n===0&&(n=2),r==="Clear"&&n===3){var a=o(l);a==="NumLock"&&(n=0)}if((n===void 0||n>3)&&(n=0),r==="Meta"){var i=o(l);if(i==="AltLeft")return k.default.XK_Meta_L;if(i==="AltRight")return k.default.XK_Meta_R}if(r==="Clear"){var h=o(l);if(h==="NumLock")return k.default.XK_Num_Lock}return c.default[r][n]}if(r.length!==1)return null;var f=r.charCodeAt();return f?D.default.lookup(f):null}},"8EBN":function(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){"use strict";j.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var k=0;k<j.modeInfo.length;k++){var D=j.modeInfo[k];D.mimes&&(D.mime=D.mimes[0])}j.findModeByMIME=function(R){R=R.toLowerCase();for(var O=0;O<j.modeInfo.length;O++){var c=j.modeInfo[O];if(c.mime==R)return c;if(c.mimes){for(var S=0;S<c.mimes.length;S++)if(c.mimes[S]==R)return c}}if(/\+xml$/.test(R))return j.findModeByMIME("application/xml");if(/\+json$/.test(R))return j.findModeByMIME("application/json")},j.findModeByExtension=function(R){R=R.toLowerCase();for(var O=0;O<j.modeInfo.length;O++){var c=j.modeInfo[O];if(c.ext){for(var S=0;S<c.ext.length;S++)if(c.ext[S]==R)return c}}},j.findModeByFileName=function(R){for(var O=0;O<j.modeInfo.length;O++){var c=j.modeInfo[O];if(c.file&&c.file.test(R))return c}var S=R.lastIndexOf("."),y=S>-1&&R.substring(S+1,R.length);if(y)return j.findModeByExtension(y)},j.findModeByName=function(R){R=R.toLowerCase();for(var O=0;O<j.modeInfo.length;O++){var c=j.modeInfo[O];if(c.name.toLowerCase()==R)return c;if(c.alias){for(var S=0;S<c.alias.length;S++)if(c.alias[S].toLowerCase()==R)return c}}}})},"8K/p":function(Ze,ce,ie){"use strict";function j(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(s){return typeof s}:j=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},j(o)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=c(ie("Lo0S")),D=R(ie("ItS6"));function R(o){return o&&o.__esModule?o:{default:o}}function O(){if(typeof WeakMap!="function")return null;var o=new WeakMap;return O=function(){return o},o}function c(o){if(o&&o.__esModule)return o;if(o===null||j(o)!=="object"&&typeof o!="function")return{default:o};var d=O();if(d&&d.has(o))return d.get(o);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in o)if(Object.prototype.hasOwnProperty.call(o,r)){var n=l?Object.getOwnPropertyDescriptor(o,r):null;n&&(n.get||n.set)?Object.defineProperty(s,r,n):s[r]=o[r]}return s.default=o,d&&d.set(o,s),s}function S(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")}function y(o,d){for(var s=0;s<d.length;s++){var l=d[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function p(o,d,s){return d&&y(o.prototype,d),s&&y(o,s),o}var u=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 d=0;d<4;d++)this._zlibs[d]=new D.default}return p(o,[{key:"decodeRect",value:function(s,l,r,n,a,i,h){if(this._ctl===null){if(a.rQwait("TIGHT compression-control",1))return!1;this._ctl=a.rQshift8();for(var f=0;f<4;f++)this._ctl>>f&1&&(this._zlibs[f].reset(),k.Info("Reset zlib stream "+f));this._ctl=this._ctl>>4}var w;if(this._ctl===8)w=this._fillRect(s,l,r,n,a,i,h);else if(this._ctl===9)w=this._jpegRect(s,l,r,n,a,i,h);else if(this._ctl===10)w=this._pngRect(s,l,r,n,a,i,h);else if((this._ctl&128)==0)w=this._basicRect(this._ctl,s,l,r,n,a,i,h);else throw new Error("Illegal tight compression received (ctl: "+this._ctl+")");return w&&(this._ctl=null),w}},{key:"_fillRect",value:function(s,l,r,n,a,i,h){if(a.rQwait("TIGHT",3))return!1;var f=a.rQi,w=a.rQ;return i.fillRect(s,l,r,n,[w[f+2],w[f+1],w[f]],!1),a.rQskipBytes(3),!0}},{key:"_jpegRect",value:function(s,l,r,n,a,i,h){var f=this._readData(a);return f===null?!1:(i.imageRect(s,l,r,n,"image/jpeg",f),!0)}},{key:"_pngRect",value:function(s,l,r,n,a,i,h){throw new Error("PNG received in standard Tight rect")}},{key:"_basicRect",value:function(s,l,r,n,a,i,h,f){if(this._filter===null)if(s&4){if(i.rQwait("TIGHT",1))return!1;this._filter=i.rQshift8()}else this._filter=0;var w=s&3,m;switch(this._filter){case 0:m=this._copyFilter(w,l,r,n,a,i,h,f);break;case 1:m=this._paletteFilter(w,l,r,n,a,i,h,f);break;case 2:m=this._gradientFilter(w,l,r,n,a,i,h,f);break;default:throw new Error("Illegal tight filter received (ctl: "+this._filter+")")}return m&&(this._filter=null),m}},{key:"_copyFilter",value:function(s,l,r,n,a,i,h,f){var w=n*a*3,m;if(w<12){if(i.rQwait("TIGHT",w))return!1;m=i.rQshiftBytes(w)}else{if(m=this._readData(i),m===null)return!1;this._zlibs[s].setInput(m),m=this._zlibs[s].inflate(w),this._zlibs[s].setInput(null)}return h.blitRgbImage(l,r,n,a,m,0,!1),!0}},{key:"_paletteFilter",value:function(s,l,r,n,a,i,h,f){if(this._numColors===0){if(i.rQwait("TIGHT palette",1))return!1;var w=i.rQpeek8()+1,m=w*3;if(i.rQwait("TIGHT palette",1+m))return!1;this._numColors=w,i.rQskipBytes(1),i.rQshiftTo(this._palette,m)}var T=this._numColors<=2?1:8,C=Math.floor((n*T+7)/8),x=C*a,b;if(x<12){if(i.rQwait("TIGHT",x))return!1;b=i.rQshiftBytes(x)}else{if(b=this._readData(i),b===null)return!1;this._zlibs[s].setInput(b),b=this._zlibs[s].inflate(x),this._zlibs[s].setInput(null)}return this._numColors==2?this._monoRect(l,r,n,a,b,this._palette,h):this._paletteRect(l,r,n,a,b,this._palette,h),this._numColors=0,!0}},{key:"_monoRect",value:function(s,l,r,n,a,i,h){for(var f=this._getScratchBuffer(r*n*4),w=Math.floor((r+7)/8),m=Math.floor(r/8),T=0;T<n;T++){var C=void 0,x=void 0,b=void 0;for(b=0;b<m;b++)for(var E=7;E>=0;E--)C=(T*r+b*8+7-E)*4,x=(a[T*w+b]>>E&1)*3,f[C]=i[x],f[C+1]=i[x+1],f[C+2]=i[x+2],f[C+3]=255;for(var A=7;A>=8-r%8;A--)C=(T*r+b*8+7-A)*4,x=(a[T*w+b]>>A&1)*3,f[C]=i[x],f[C+1]=i[x+1],f[C+2]=i[x+2],f[C+3]=255}h.blitRgbxImage(s,l,r,n,f,0,!1)}},{key:"_paletteRect",value:function(s,l,r,n,a,i,h){for(var f=this._getScratchBuffer(r*n*4),w=r*n*4,m=0,T=0;m<w;m+=4,T++){var C=a[T]*3;f[m]=i[C],f[m+1]=i[C+1],f[m+2]=i[C+2],f[m+3]=255}h.blitRgbxImage(s,l,r,n,f,0,!1)}},{key:"_gradientFilter",value:function(s,l,r,n,a,i,h,f){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 r=s.rQshiftBytes(this._len);return this._len=0,r}},{key:"_getScratchBuffer",value:function(s){return(!this._scratchBuffer||this._scratchBuffer.length<s)&&(this._scratchBuffer=new Uint8Array(s)),this._scratchBuffer}}]),o}();ce.default=u},"9Bee":function(Ze,ce,ie){"use strict";var j=ie("k1fw"),k=ie("tJVT"),D=ie("q1tI"),R=ie.n(D),O=ie("vg9a"),c=ie("DlQD"),S=ie.n(c),y=ie("rUJ1");function p(z,te){var de=z.match(/^(\s+)(?:```)/);if(de===null)return te;var ge=de[1];return te.split(`
|
|
|
`).map(function(Ue){var Me=Ue.match(/^\s+/);if(Me===null)return Ue;var Le=Object(k.a)(Me,1),Oe=Le[0];return Oe.length>=ge.length?Ue.slice(ge.length):Ue}).join(`
|
|
|
`)}var u=[],o=["<ul>"],d=new S.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function l(){u.length=0,o=["<ul>"]}var r={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function n(z,te,de,ge){if(te>=z.length||z[te].level<=de)return te;var Ue=z[te];ge.push("<li><a href='#"+Ue.anchor+"'>"+Ue.text+"</a>"),te++;var Me=[];return te=n(z,te,Ue.level,Me),Me.length>0&&(ge.push("<ul>"),Me.forEach(function(Le){ge.push(Le)}),ge.push("</ul>")),ge.push("</li>"),te=n(z,te,de,ge),te}function a(){return n(u,0,0,o),o.push("</ul>"),o.join("")}var i={heading:function(te){var de=s.exec(te);if(de)return{type:"heading",raw:de[0],depth:de[1].length,text:de[2]}},fences:function(te){var de=this.rules.block.fences.exec(te);if(de){var ge=de[0],Ue=p(ge,de[3]||""),Me=de[2]?de[2].trim():de[2];if(["latex","katex","math"].indexOf(Me)>=0){var Le=w(),Oe=Ue;Ue=Le,m[Le]={type:"block",expression:Oe}}return{type:"code",raw:ge,lang:Me,text:Ue}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,f=0,w=function(){return"__special_katext_id_".concat(f++,"__")},m={};function T(){return m}function C(){f=0,m={}}function x(z){return z=z.replace(h,function(te,de){var ge=w();return m[ge]={type:"inline",expression:de},ge}),z}var b=d.listitem;d.listitem=function(z){return b(x(z))};var E=d.paragraph;d.paragraph=function(z){return E(x(z))};var A=d.tablecell;d.tablecell=function(z,te){return A(x(z),te)},d.code=function(z,te,de){var ge=(te||"").match(/\S*/)[0];return ge?["latex","katex","math"].indexOf(ge)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(te,'">').concat(de?z:Object(y.escape)(z,!0),`</code></pre>
|
|
|
`):'<pre class="prettyprint linenums"><code>'+(de?z:Object(y.escape)(z,!0))+"</code></pre>"},d.heading=function(z,te,de){var ge=this.options.headerPrefix+de.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:ge,level:te,text:z}),"<h"+te+' id="'+ge+'">'+z+"</h"+te+">"},S.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),S.a.use({tokenizer:i,renderer:d});var v=S.a,M=ie("SJMd"),I=ie("ulZh"),P=ie.n(I),B=ie("m3rI"),H=ie("Oy/b"),F=ie("p5ED"),W=/<pre[^>]*>/g;function U(z){var te=document.createElement("div");return te.innerHTML=z,te.childNodes.length===0?"":te.childNodes[0].nodeValue}var K=ce.a=function(z){var te=z.value,de=te===void 0?"":te,ge=z.className,Ue=z.showTextOnly,Me=z.showLines,Le=z.style,Oe=Le===void 0?{}:Le,Fe=z.stylesPrev,ye=Fe===void 0?{}:Fe,Ae=String(de),re=Object(D.useState)(""),pe=Object(k.a)(re,2),ue=pe[0],Ie=pe[1],Ke=Object(D.useMemo)(function(){try{var ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,ke=/\"\/api\/attachments\/|\"\/attachments\/download\//g,xe=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Ae=Ae.replace(ze,"("+B.a.API_SERVER+"/api/attachments/").replace(ke,'"'+B.a.API_SERVER+"/api/attachments/").replace(xe,'"'+B.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,`
|
|
|
`),Ae=Ae.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
|
`)}catch(fe){}var Ee=v(Ae),Se=T();if(Ae.match(/\[TOC\]/)&&(Ee=Ee.replace("<p>[TOC]</p>",a()),l()),Ee=Ee.replace(/(__special_katext_id_\d+__)/g,function(fe,J){var Ce=Se[J],We=Ce.type,Ve=Ce.expression;return Object(H.renderToString)(U(Ve)||"",{displayMode:We==="block",throwOnError:!1,output:"html"})}),Ee=Ee.replace(/▁/g,"\u2581\u2581\u2581"),C(),Ue){var $=document.createElement("div");return $.innerHTML=Ee,$.innerText}return setTimeout(function(){return Ge()},500),Ee},[Ae]),Ne=Object(D.useRef)();r.WebkitLineClamp=Me,Me&&(Oe=Object(j.a)(Object(j.a)({},Oe),r));function je(ze){var ke=ze.target;if(ke.tagName.toUpperCase()==="A"){var xe=ke.getAttribute("href");if(xe.indexOf("office")>-1)ze.preventDefault(),Ie(xe);else if(xe.startsWith("#")){ze.preventDefault();var Ee=document.getElementById(xe.replace("#",""));Ee&&Ee.scrollIntoView(!0)}}}var Ge=function(){var ke,xe=(ke=Ne.current)===null||ke===void 0?void 0:ke.querySelectorAll("video");xe==null||xe.forEach(function(Ee){if(Ee.oncontextmenu=function(){return!1},Ee.src.indexOf(".m3u8")>-1&&!Ee.canPlayType("application/vnd.apple.mpegurl")){if(P.a.isSupported()){var Se=new P.a;Se.loadSource(Ee.src),Se.attachMedia(Ee)}}})};return Object(D.useEffect)(function(){if(Ne.current&&Ke&&(Ke.match(W)&&window.PR.prettyPrint()),Ne.current)return Ne.current.addEventListener("click",je),function(){Ne.current.removeEventListener("click",je),C(),l()}},[Ke,Ne.current,je]),R.a.createElement(R.a.Fragment,null,R.a.createElement("div",{ref:Ne,style:Object(j.a)({},Oe),className:"".concat(ge||""," markdown-body "),dangerouslySetInnerHTML:{__html:Ke}}),R.a.createElement(F.a,{close:!0,data:ue,type:ue!=null&&ue.length?"office":"",style:Object(j.a)({},ye),onClose:function(){return Ie("")}}))}},"9VGf":function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return D});var j=ie("q1tI"),k=ie.n(j);function D(R,O){var c=Object(j.useRef)();Object(j.useEffect)(function(){c.current=R}),Object(j.useEffect)(function(){function S(){c.current()}if(O!==null){var y=setInterval(S,O);return function(){return clearInterval(y)}}},[O])}},BU3w:function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return c});var j=ie("MNnm"),k="rc-util-key";function D(S){if(S.attachTo)return S.attachTo;var y=document.querySelector("head");return y||document.body}function R(S){var y,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(j.a)())return null;var u=document.createElement("style");if((y=p.csp)===null||y===void 0?void 0:y.nonce){var o;u.nonce=(o=p.csp)===null||o===void 0?void 0:o.nonce}u.innerHTML=S;var d=D(p),s=d.firstChild;return p.prepend&&d.prepend?d.prepend(u):p.prepend&&s?d.insertBefore(u,s):d.appendChild(u),u}var O=new Map;function c(S,y){var p=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=D(p);if(!O.has(u)){var o=R("",p),d=o.parentNode;O.set(u,d),d.removeChild(o)}var s=Array.from(O.get(u).children).find(function(i){return i.tagName==="STYLE"&&i[k]===y});if(s){var l,r;if(((l=p.csp)===null||l===void 0?void 0:l.nonce)&&s.nonce!==((r=p.csp)===null||r===void 0?void 0:r.nonce)){var n;s.nonce=(n=p.csp)===null||n===void 0?void 0:n.nonce}return s.innerHTML!==S&&(s.innerHTML=S),s}var a=R(S,p);return a[k]=y,a}},Bd2K:function(Ze,ce,ie){(function(j){j(ie("VrN/"),ie("osHv"))})(function(j){j.defineOption("autoCloseTags",!1,function(p,u,o){if(o!=j.Init&&o&&p.removeKeyMap("autoCloseTags"),!u)return;var d={name:"autoCloseTags"};(typeof u!="object"||u.whenClosing!==!1)&&(d["'/'"]=function(s){return c(s)}),(typeof u!="object"||u.whenOpening!==!1)&&(d["'>'"]=function(s){return R(s)}),p.addKeyMap(d)});var k=["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 R(p){if(p.getOption("disableInput"))return j.Pass;for(var u=p.listSelections(),o=[],d=p.getOption("autoCloseTags"),s=0;s<u.length;s++){if(!u[s].empty())return j.Pass;var l=u[s].head,r=p.getTokenAt(l),n=j.innerMode(p.getMode(),r.state),a=n.state,i=n.mode.xmlCurrentTag&&n.mode.xmlCurrentTag(a),h=i&&i.name;if(!h)return j.Pass;var f=n.mode.configuration=="html",w=typeof d=="object"&&d.dontCloseTags||f&&k,m=typeof d=="object"&&d.indentTags||f&&D;r.end>l.ch&&(h=h.slice(0,h.length-r.end+l.ch));var T=h.toLowerCase();if(!h||r.type=="string"&&(r.end!=l.ch||!/[\"\']/.test(r.string.charAt(r.string.length-1))||r.string.length==1)||r.type=="tag"&&i.close||r.string.indexOf("/")==l.ch-r.start-1||w&&S(w,T)>-1||y(p,n.mode.xmlCurrentContext&&n.mode.xmlCurrentContext(a)||[],h,l,!0))return j.Pass;var C=typeof d=="object"&&d.emptyTags;if(C&&S(C,h)>-1){o[s]={text:"/>",newPos:j.Pos(l.line,l.ch+2)};continue}var x=m&&S(m,T)>-1;o[s]={indent:x,text:">"+(x?`
|
|
|
|
|
|
`:"")+"</"+h+">",newPos:x?j.Pos(l.line+1,0):j.Pos(l.line,l.ch+1)}}for(var b=typeof d=="object"&&d.dontIndentOnAutoClose,s=u.length-1;s>=0;s--){var E=o[s];p.replaceRange(E.text,u[s].head,u[s].anchor,"+insert");var A=p.listSelections().slice(0);A[s]={head:E.newPos,anchor:E.newPos},p.setSelections(A),!b&&E.indent&&(p.indentLine(E.newPos.line,null,!0),p.indentLine(E.newPos.line+1,null,!0))}}function O(p,u){for(var o=p.listSelections(),d=[],s=u?"/":"</",l=p.getOption("autoCloseTags"),r=typeof l=="object"&&l.dontIndentOnSlash,n=0;n<o.length;n++){if(!o[n].empty())return j.Pass;var a=o[n].head,i=p.getTokenAt(a),h=j.innerMode(p.getMode(),i.state),f=h.state;if(u&&(i.type=="string"||i.string.charAt(0)!="<"||i.start!=a.ch-1))return j.Pass;var w,m=h.mode.name!="xml"&&p.getMode().name=="htmlmixed";if(m&&h.mode.name=="javascript")w=s+"script";else if(m&&h.mode.name=="css")w=s+"style";else{var T=h.mode.xmlCurrentContext&&h.mode.xmlCurrentContext(f);if(!T||T.length&&y(p,T,T[T.length-1],a))return j.Pass;w=s+T[T.length-1]}p.getLine(a.line).charAt(i.end)!=">"&&(w+=">"),d[n]=w}if(p.replaceSelections(d),o=p.listSelections(),!r)for(var n=0;n<o.length;n++)(n==o.length-1||o[n].head.line<o[n+1].head.line)&&p.indentLine(o[n].head.line)}function c(p){return p.getOption("disableInput")?j.Pass:O(p,!0)}j.commands.closeTag=function(p){return O(p)};function S(p,u){if(p.indexOf)return p.indexOf(u);for(var o=0,d=p.length;o<d;++o)if(p[o]==u)return o;return-1}function y(p,u,o,d,s){if(!j.scanForClosingTag)return!1;var l=Math.min(p.lastLine()+1,d.line+500),r=j.scanForClosingTag(p,d,null,l);if(!r||r.tag!=o)return!1;for(var n=s?1:0,a=u.length-1;a>=0&&u[a]==o;a--)++n;d=r.to;for(var a=1;a<n;a++){var i=j.scanForClosingTag(p,d,null,l);if(!i||i.tag!=o)return!1;d=i.to}return!0}})},BjJ7:function(Ze,ce,ie){"use strict";ie.d(ce,"d",function(){return k}),ie.d(ce,"c",function(){return D}),ie.d(ce,"e",function(){return R}),ie.d(ce,"b",function(){return O}),ie.d(ce,"a",function(){return S});var j=ie("m3rI");function k(y){var p=!0;if(y.length>0){for(var u=0;u<y.length;u++)if(y[u].compile_success==0||!y[u].compile_success){p=!1;break}}else p=!1;return p}function D(y){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=[],o=0;o<y.length;o++){var d=y[o],s=p?"".concat(p,"/").concat(d.name):"".concat(d.name);u.push({title:d.name,isLeaf:!(d.type==="tree"),key:s})}return u}function R(y,p,u){for(var o=0;o<y.length;o++){var d=y[o];if(d.key===p){d.children=u;break}d.children&&R(d.children,p,u)}return y}function O(y,p,u){var o;return function(){var d=this,s=arguments,l=function(){o=null,u||y.apply(d,s)},r=u&&!o;clearTimeout(o),o=setTimeout(l,p),r&&y.apply(d,s)}}var c=!0,S=j.a.API_SERVER},"C+DQ":function(Ze,ce,ie){},DlQD:function(Ze,ce,ie){(function(j,k){Ze.exports=k()})(this,function(){"use strict";function j(le,se){for(var he=0;he<se.length;he++){var Y=se[he];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(le,Y.key,Y)}}function k(le,se,he){return se&&j(le.prototype,se),he&&j(le,he),le}function D(le,se){if(!le)return;if(typeof le=="string")return R(le,se);var he=Object.prototype.toString.call(le).slice(8,-1);if(he==="Object"&&le.constructor&&(he=le.constructor.name),he==="Map"||he==="Set")return Array.from(le);if(he==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(he))return R(le,se)}function R(le,se){(se==null||se>le.length)&&(se=le.length);for(var he=0,Y=new Array(se);he<se;he++)Y[he]=le[he];return Y}function O(le,se){var he;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(he=D(le))||se&&le&&typeof le.length=="number"){he&&(le=he);var Y=0;return function(){return Y>=le.length?{done:!0}:{done:!1,value:le[Y++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return he=le[Symbol.iterator](),he.next.bind(he)}function c(le,se){return se={exports:{}},le(se,se.exports),se.exports}var S=c(function(le){function se(){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 he(Y){le.exports.defaults=Y}le.exports={defaults:se(),getDefaults:se,changeDefaults:he}}),y=S.defaults,p=S.getDefaults,u=S.changeDefaults,o=/[&<>"']/,d=/[&<>"']/g,s=/[<>"']|&(?!#?\w+;)/,l=/[<>"']|&(?!#?\w+;)/g,r={"&":"&","<":"<",">":">",'"':""","'":"'"},n=function(se){return r[se]};function a(le,se){if(se){if(o.test(le))return le.replace(d,n)}else if(s.test(le))return le.replace(l,n);return le}var i=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function h(le){return le.replace(i,function(se,he){return he=he.toLowerCase(),he==="colon"?":":he.charAt(0)==="#"?he.charAt(1)==="x"?String.fromCharCode(parseInt(he.substring(2),16)):String.fromCharCode(+he.substring(1)):""})}var f=/(^|[^\[])\^/g;function w(le,se){le=le.source||le,se=se||"";var he={replace:function(Z,G){return G=G.source||G,G=G.replace(f,"$1"),le=le.replace(Z,G),he},getRegex:function(){return new RegExp(le,se)}};return he}var m=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function C(le,se,he){if(le){var Y;try{Y=decodeURIComponent(h(he)).replace(m,"").toLowerCase()}catch(Z){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}se&&!T.test(he)&&(he=v(se,he));try{he=encodeURI(he).replace(/%25/g,"%")}catch(Z){return null}return he}var x={},b=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,A=/^([^:]+:\/*[^/]*)[\s\S]*$/;function v(le,se){x[" "+le]||(b.test(le)?x[" "+le]=le+"/":x[" "+le]=B(le,"/",!0)),le=x[" "+le];var he=le.indexOf(":")===-1;return se.substring(0,2)==="//"?he?se:le.replace(E,"$1")+se:se.charAt(0)==="/"?he?se:le.replace(A,"$1")+se:le+se}var M={exec:function(){}};function I(le){for(var se=1,he,Y;se<arguments.length;se++){he=arguments[se];for(Y in he)Object.prototype.hasOwnProperty.call(he,Y)&&(le[Y]=he[Y])}return le}function P(le,se){var he=le.replace(/\|/g,function(G,ae,Te){for(var X=!1,me=ae;--me>=0&&Te[me]==="\\";)X=!X;return X?"|":" |"}),Y=he.split(/ \|/),Z=0;if(Y.length>se)Y.splice(se);else for(;Y.length<se;)Y.push("");for(;Z<Y.length;Z++)Y[Z]=Y[Z].trim().replace(/\\\|/g,"|");return Y}function B(le,se,he){var Y=le.length;if(Y===0)return"";for(var Z=0;Z<Y;){var G=le.charAt(Y-Z-1);if(G===se&&!he)Z++;else if(G!==se&&he)Z++;else break}return le.substr(0,Y-Z)}function H(le,se){if(le.indexOf(se[1])===-1)return-1;for(var he=le.length,Y=0,Z=0;Z<he;Z++)if(le[Z]==="\\")Z++;else if(le[Z]===se[0])Y++;else if(le[Z]===se[1]&&(Y--,Y<0))return Z;return-1}function F(le){le&&le.sanitize&&!le.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 W={escape:a,unescape:h,edit:w,cleanUrl:C,resolveUrl:v,noopTest:M,merge:I,splitCells:P,rtrim:B,findClosingBracket:H,checkSanitizeDeprecation:F},U=S.defaults,K=W.rtrim,z=W.splitCells,te=W.escape,de=W.findClosingBracket;function ge(le,se,he){var Y=se.href,Z=se.title?te(se.title):null,G=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:he,href:Y,title:Z,text:G}:{type:"image",raw:he,href:Y,title:Z,text:te(G)}}function Ue(le,se){var he=le.match(/^(\s+)(?:```)/);if(he===null)return se;var Y=he[1];return se.split(`
|
|
|
`).map(function(Z){var G=Z.match(/^\s+/);if(G===null)return Z;var ae=G[0];return ae.length>=Y.length?Z.slice(Y.length):Z}).join(`
|
|
|
`)}var Me=function(){function le(he){this.options=he||U}var se=le.prototype;return se.space=function(Y){var Z=this.rules.block.newline.exec(Y);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
|
`}},se.code=function(Y,Z){var G=this.rules.block.code.exec(Y);if(G){var ae=Z[Z.length-1];if(ae&&ae.type==="paragraph")return{raw:G[0],text:G[0].trimRight()};var Te=G[0].replace(/^ {4}/gm,"");return{type:"code",raw:G[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:K(Te,`
|
|
|
`)}}},se.fences=function(Y){var Z=this.rules.block.fences.exec(Y);if(Z){var G=Z[0],ae=Ue(G,Z[3]||"");return{type:"code",raw:G,lang:Z[2]?Z[2].trim():Z[2],text:ae}}},se.heading=function(Y){var Z=this.rules.block.heading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},se.nptable=function(Y){var Z=this.rules.block.nptable.exec(Y);if(Z){var G={type:"table",header:z(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
|
`):[],raw:Z[0]};if(G.header.length===G.align.length){var ae=G.align.length,Te;for(Te=0;Te<ae;Te++)/^ *-+: *$/.test(G.align[Te])?G.align[Te]="right":/^ *:-+: *$/.test(G.align[Te])?G.align[Te]="center":/^ *:-+ *$/.test(G.align[Te])?G.align[Te]="left":G.align[Te]=null;for(ae=G.cells.length,Te=0;Te<ae;Te++)G.cells[Te]=z(G.cells[Te],G.header.length);return G}}},se.hr=function(Y){var Z=this.rules.block.hr.exec(Y);if(Z)return{type:"hr",raw:Z[0]}},se.blockquote=function(Y){var Z=this.rules.block.blockquote.exec(Y);if(Z){var G=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:G}}},se.list=function(Y){var Z=this.rules.block.list.exec(Y);if(Z){for(var G=Z[0],ae=Z[2],Te=ae.length>1,X=ae[ae.length-1]===")",me={type:"list",raw:G,ordered:Te,start:Te?+ae.slice(0,-1):"",loose:!1,items:[]},De=Z[0].match(this.rules.block.item),oe=!1,ve,Be,tt,Qe,$e,st,mt,ct=De.length,nt=0;nt<ct;nt++)ve=De[nt],G=ve,Be=ve.length,ve=ve.replace(/^ *([*+-]|\d+[.)]) */,""),~ve.indexOf(`
|
|
|
`)&&(Be-=ve.length,ve=this.options.pedantic?ve.replace(/^ {1,4}/gm,""):ve.replace(new RegExp("^ {1,"+Be+"}","gm"),"")),nt!==ct-1&&(tt=this.rules.block.bullet.exec(De[nt+1])[0],(Te?tt.length===1||!X&&tt[tt.length-1]===")":tt.length>1||this.options.smartLists&&tt!==ae)&&(Qe=De.slice(nt+1).join(`
|
|
|
`),me.raw=me.raw.substring(0,me.raw.length-Qe.length),nt=ct-1)),$e=oe||/\n\n(?!\s*$)/.test(ve),nt!==ct-1&&(oe=ve.charAt(ve.length-1)===`
|
|
|
`,$e||($e=oe)),$e&&(me.loose=!0),st=/^\[[ xX]\] /.test(ve),mt=void 0,st&&(mt=ve[1]!==" ",ve=ve.replace(/^\[[ xX]\] +/,"")),me.items.push({type:"list_item",raw:G,task:st,checked:mt,loose:$e,text:ve});return me}},se.html=function(Y){var Z=this.rules.block.html.exec(Y);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):te(Z[0]):Z[0]}},se.def=function(Y){var Z=this.rules.block.def.exec(Y);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var G=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:G,raw:Z[0],href:Z[2],title:Z[3]}}},se.table=function(Y){var Z=this.rules.block.table.exec(Y);if(Z){var G={type:"table",header:z(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
|
`):[]};if(G.header.length===G.align.length){G.raw=Z[0];var ae=G.align.length,Te;for(Te=0;Te<ae;Te++)/^ *-+: *$/.test(G.align[Te])?G.align[Te]="right":/^ *:-+: *$/.test(G.align[Te])?G.align[Te]="center":/^ *:-+ *$/.test(G.align[Te])?G.align[Te]="left":G.align[Te]=null;for(ae=G.cells.length,Te=0;Te<ae;Te++)G.cells[Te]=z(G.cells[Te].replace(/^ *\| *| *\| *$/g,""),G.header.length);return G}}},se.lheading=function(Y){var Z=this.rules.block.lheading.exec(Y);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},se.paragraph=function(Y){var Z=this.rules.block.paragraph.exec(Y);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
|
`?Z[1].slice(0,-1):Z[1]}},se.text=function(Y,Z){var G=this.rules.block.text.exec(Y);if(G){var ae=Z[Z.length-1];return ae&&ae.type==="text"?{raw:G[0],text:G[0]}:{type:"text",raw:G[0],text:G[0]}}},se.escape=function(Y){var Z=this.rules.inline.escape.exec(Y);if(Z)return{type:"escape",raw:Z[0],text:te(Z[1])}},se.tag=function(Y,Z,G){var ae=this.rules.inline.tag.exec(Y);if(ae)return!Z&&/^<a /i.test(ae[0])?Z=!0:Z&&/^<\/a>/i.test(ae[0])&&(Z=!1),!G&&/^<(pre|code|kbd|script)(\s|>)/i.test(ae[0])?G=!0:G&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ae[0])&&(G=!1),{type:this.options.sanitize?"text":"html",raw:ae[0],inLink:Z,inRawBlock:G,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):te(ae[0]):ae[0]}},se.link=function(Y){var Z=this.rules.inline.link.exec(Y);if(Z){var G=de(Z[2],"()");if(G>-1){var ae=Z[0].indexOf("!")===0?5:4,Te=ae+Z[1].length+G;Z[2]=Z[2].substring(0,G),Z[0]=Z[0].substring(0,Te).trim(),Z[3]=""}var X=Z[2],me="";if(this.options.pedantic){var De=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(X);De?(X=De[1],me=De[3]):me=""}else me=Z[3]?Z[3].slice(1,-1):"";X=X.trim().replace(/^<([\s\S]*)>$/,"$1");var oe=ge(Z,{href:X&&X.replace(this.rules.inline._escapes,"$1"),title:me&&me.replace(this.rules.inline._escapes,"$1")},Z[0]);return oe}},se.reflink=function(Y,Z){var G;if((G=this.rules.inline.reflink.exec(Y))||(G=this.rules.inline.nolink.exec(Y))){var ae=(G[2]||G[1]).replace(/\s+/g," ");if(ae=Z[ae.toLowerCase()],!ae||!ae.href){var Te=G[0].charAt(0);return{type:"text",raw:Te,text:Te}}var X=ge(G,ae,G[0]);return X}},se.strong=function(Y,Z,G){G===void 0&&(G="");var ae=this.rules.inline.strong.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(G===""||this.rules.inline.punctuation.exec(G)))){Z=Z.slice(-1*Y.length);var Te=ae[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var X;(ae=Te.exec(Z))!=null;)if(X=this.rules.inline.strong.middle.exec(Z.slice(0,ae.index+3)),X)return{type:"strong",raw:Y.slice(0,X[0].length),text:Y.slice(2,X[0].length-2)}}},se.em=function(Y,Z,G){G===void 0&&(G="");var ae=this.rules.inline.em.start.exec(Y);if(ae&&(!ae[1]||ae[1]&&(G===""||this.rules.inline.punctuation.exec(G)))){Z=Z.slice(-1*Y.length);var Te=ae[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var X;(ae=Te.exec(Z))!=null;)if(X=this.rules.inline.em.middle.exec(Z.slice(0,ae.index+2)),X)return{type:"em",raw:Y.slice(0,X[0].length),text:Y.slice(1,X[0].length-1)}}},se.codespan=function(Y){var Z=this.rules.inline.code.exec(Y);if(Z){var G=Z[2].replace(/\n/g," "),ae=/[^ ]/.test(G),Te=G.startsWith(" ")&&G.endsWith(" ");return ae&&Te&&(G=G.substring(1,G.length-1)),G=te(G,!0),{type:"codespan",raw:Z[0],text:G}}},se.br=function(Y){var Z=this.rules.inline.br.exec(Y);if(Z)return{type:"br",raw:Z[0]}},se.del=function(Y){var Z=this.rules.inline.del.exec(Y);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},se.autolink=function(Y,Z){var G=this.rules.inline.autolink.exec(Y);if(G){var ae,Te;return G[2]==="@"?(ae=te(this.options.mangle?Z(G[1]):G[1]),Te="mailto:"+ae):(ae=te(G[1]),Te=ae),{type:"link",raw:G[0],text:ae,href:Te,tokens:[{type:"text",raw:ae,text:ae}]}}},se.url=function(Y,Z){var G;if(G=this.rules.inline.url.exec(Y)){var ae,Te;if(G[2]==="@")ae=te(this.options.mangle?Z(G[0]):G[0]),Te="mailto:"+ae;else{var X;do X=G[0],G[0]=this.rules.inline._backpedal.exec(G[0])[0];while(X!==G[0]);ae=te(G[0]),G[1]==="www."?Te="http://"+ae:Te=ae}return{type:"link",raw:G[0],text:ae,href:Te,tokens:[{type:"text",raw:ae,text:ae}]}}},se.inlineText=function(Y,Z,G){var ae=this.rules.inline.text.exec(Y);if(ae){var Te;return Z?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ae[0]):te(ae[0]):ae[0]:Te=te(this.options.smartypants?G(ae[0]):ae[0]),{type:"text",raw:ae[0],text:Te}}},le}(),Le=W.noopTest,Oe=W.edit,Fe=W.merge,ye={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:Le,table:Le,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ye._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ye._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ye.def=Oe(ye.def).replace("label",ye._label).replace("title",ye._title).getRegex(),ye.bullet=/(?:[*+-]|\d{1,9}[.)])/,ye.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ye.item=Oe(ye.item,"gm").replace(/bull/g,ye.bullet).getRegex(),ye.list=Oe(ye.list).replace(/bull/g,ye.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ye.def.source+")").getRegex(),ye._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",ye._comment=/<!--(?!-?>)[\s\S]*?-->/,ye.html=Oe(ye.html,"i").replace("comment",ye._comment).replace("tag",ye._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ye.paragraph=Oe(ye._paragraph).replace("hr",ye.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",ye._tag).getRegex(),ye.blockquote=Oe(ye.blockquote).replace("paragraph",ye.paragraph).getRegex(),ye.normal=Fe({},ye),ye.gfm=Fe({},ye.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*|$)"}),ye.gfm.nptable=Oe(ye.gfm.nptable).replace("hr",ye.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",ye._tag).getRegex(),ye.gfm.table=Oe(ye.gfm.table).replace("hr",ye.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",ye._tag).getRegex(),ye.pedantic=Fe({},ye.normal,{html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ye._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:Le,paragraph:Oe(ye.normal._paragraph).replace("hr",ye.hr).replace("heading",` *#{1,6} *[^
|
|
|
]`).replace("lheading",ye.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Ae={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,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:Le,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};Ae._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Ae.punctuation=Oe(Ae.punctuation).replace(/punctuation/g,Ae._punctuation).getRegex(),Ae._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",Ae._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",Ae.em.start=Oe(Ae.em.start).replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.em.middle=Oe(Ae.em.middle).replace(/punctuation/g,Ae._punctuation).replace(/overlapSkip/g,Ae._overlapSkip).getRegex(),Ae.em.endAst=Oe(Ae.em.endAst,"g").replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.em.endUnd=Oe(Ae.em.endUnd,"g").replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.strong.start=Oe(Ae.strong.start).replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.strong.middle=Oe(Ae.strong.middle).replace(/punctuation/g,Ae._punctuation).replace(/blockSkip/g,Ae._blockSkip).getRegex(),Ae.strong.endAst=Oe(Ae.strong.endAst,"g").replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.strong.endUnd=Oe(Ae.strong.endUnd,"g").replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.blockSkip=Oe(Ae._blockSkip,"g").getRegex(),Ae.overlapSkip=Oe(Ae._overlapSkip,"g").getRegex(),Ae._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Ae._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Ae._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])?)+(?![-_])/,Ae.autolink=Oe(Ae.autolink).replace("scheme",Ae._scheme).replace("email",Ae._email).getRegex(),Ae._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Ae.tag=Oe(Ae.tag).replace("comment",ye._comment).replace("attribute",Ae._attribute).getRegex(),Ae._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ae._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,Ae._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Ae.link=Oe(Ae.link).replace("label",Ae._label).replace("href",Ae._href).replace("title",Ae._title).getRegex(),Ae.reflink=Oe(Ae.reflink).replace("label",Ae._label).getRegex(),Ae.reflinkSearch=Oe(Ae.reflinkSearch,"g").replace("reflink",Ae.reflink).replace("nolink",Ae.nolink).getRegex(),Ae.normal=Fe({},Ae),Ae.pedantic=Fe({},Ae.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:Oe(/^!?\[(label)\]\((.*?)\)/).replace("label",Ae._label).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ae._label).getRegex()}),Ae.gfm=Fe({},Ae.normal,{escape:Oe(Ae.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),Ae.gfm.url=Oe(Ae.gfm.url,"i").replace("email",Ae.gfm._extended_email).getRegex(),Ae.breaks=Fe({},Ae.gfm,{br:Oe(Ae.br).replace("{2,}","*").getRegex(),text:Oe(Ae.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var re={block:ye,inline:Ae},pe=S.defaults,ue=re.block,Ie=re.inline;function Ke(le){return le.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 Ne(le){var se="",he,Y,Z=le.length;for(he=0;he<Z;he++)Y=le.charCodeAt(he),Math.random()>.5&&(Y="x"+Y.toString(16)),se+="&#"+Y+";";return se}var je=function(){function le(he){this.tokens=[],this.tokens.links=Object.create(null),this.options=he||pe,this.options.tokenizer=this.options.tokenizer||new Me,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:ue.normal,inline:Ie.normal};this.options.pedantic?(Y.block=ue.pedantic,Y.inline=Ie.pedantic):this.options.gfm&&(Y.block=ue.gfm,this.options.breaks?Y.inline=Ie.breaks:Y.inline=Ie.gfm),this.tokenizer.rules=Y}le.lex=function(Y,Z){var G=new le(Z);return G.lex(Y)};var se=le.prototype;return se.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
|
|
|
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},se.blockTokens=function(Y,Z,G){Z===void 0&&(Z=[]),G===void 0&&(G=!0),Y=Y.replace(/^ +$/gm,"");for(var ae,Te,X,me;Y;){if(ae=this.tokenizer.space(Y)){Y=Y.substring(ae.raw.length),ae.type&&Z.push(ae);continue}if(ae=this.tokenizer.code(Y,Z)){Y=Y.substring(ae.raw.length),ae.type?Z.push(ae):(me=Z[Z.length-1],me.raw+=`
|
|
|
`+ae.raw,me.text+=`
|
|
|
`+ae.text);continue}if(ae=this.tokenizer.fences(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.heading(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.nptable(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.hr(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.blockquote(Y)){Y=Y.substring(ae.raw.length),ae.tokens=this.blockTokens(ae.text,[],G),Z.push(ae);continue}if(ae=this.tokenizer.list(Y)){for(Y=Y.substring(ae.raw.length),X=ae.items.length,Te=0;Te<X;Te++)ae.items[Te].tokens=this.blockTokens(ae.items[Te].text,[],!1);Z.push(ae);continue}if(ae=this.tokenizer.html(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(G&&(ae=this.tokenizer.def(Y))){Y=Y.substring(ae.raw.length),this.tokens.links[ae.tag]||(this.tokens.links[ae.tag]={href:ae.href,title:ae.title});continue}if(ae=this.tokenizer.table(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.lheading(Y)){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(G&&(ae=this.tokenizer.paragraph(Y))){Y=Y.substring(ae.raw.length),Z.push(ae);continue}if(ae=this.tokenizer.text(Y,Z)){Y=Y.substring(ae.raw.length),ae.type?Z.push(ae):(me=Z[Z.length-1],me.raw+=`
|
|
|
`+ae.raw,me.text+=`
|
|
|
`+ae.text);continue}if(Y){var De="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(De);break}else throw new Error(De)}}return Z},se.inline=function(Y){var Z,G,ae,Te,X,me,De=Y.length;for(Z=0;Z<De;Z++){me=Y[Z];switch(me.type){case"paragraph":case"text":case"heading":{me.tokens=[],this.inlineTokens(me.text,me.tokens);break}case"table":{for(me.tokens={header:[],cells:[]},Te=me.header.length,G=0;G<Te;G++)me.tokens.header[G]=[],this.inlineTokens(me.header[G],me.tokens.header[G]);for(Te=me.cells.length,G=0;G<Te;G++)for(X=me.cells[G],me.tokens.cells[G]=[],ae=0;ae<X.length;ae++)me.tokens.cells[G][ae]=[],this.inlineTokens(X[ae],me.tokens.cells[G][ae]);break}case"blockquote":{this.inline(me.tokens);break}case"list":{for(Te=me.items.length,G=0;G<Te;G++)this.inline(me.items[G].tokens);break}}}return Y},se.inlineTokens=function(Y,Z,G,ae,Te){Z===void 0&&(Z=[]),G===void 0&&(G=!1),ae===void 0&&(ae=!1),Te===void 0&&(Te="");var X,me=Y,De;if(this.tokens.links){var oe=Object.keys(this.tokens.links);if(oe.length>0)for(;(De=this.tokenizer.rules.inline.reflinkSearch.exec(me))!=null;)oe.includes(De[0].slice(De[0].lastIndexOf("[")+1,-1))&&(me=me.slice(0,De.index)+"["+"a".repeat(De[0].length-2)+"]"+me.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(De=this.tokenizer.rules.inline.blockSkip.exec(me))!=null;)me=me.slice(0,De.index)+"["+"a".repeat(De[0].length-2)+"]"+me.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(X=this.tokenizer.escape(Y)){Y=Y.substring(X.raw.length),Z.push(X);continue}if(X=this.tokenizer.tag(Y,G,ae)){Y=Y.substring(X.raw.length),G=X.inLink,ae=X.inRawBlock,Z.push(X);continue}if(X=this.tokenizer.link(Y)){Y=Y.substring(X.raw.length),X.type==="link"&&(X.tokens=this.inlineTokens(X.text,[],!0,ae)),Z.push(X);continue}if(X=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(X.raw.length),X.type==="link"&&(X.tokens=this.inlineTokens(X.text,[],!0,ae)),Z.push(X);continue}if(X=this.tokenizer.strong(Y,me,Te)){Y=Y.substring(X.raw.length),X.tokens=this.inlineTokens(X.text,[],G,ae),Z.push(X);continue}if(X=this.tokenizer.em(Y,me,Te)){Y=Y.substring(X.raw.length),X.tokens=this.inlineTokens(X.text,[],G,ae),Z.push(X);continue}if(X=this.tokenizer.codespan(Y)){Y=Y.substring(X.raw.length),Z.push(X);continue}if(X=this.tokenizer.br(Y)){Y=Y.substring(X.raw.length),Z.push(X);continue}if(X=this.tokenizer.del(Y)){Y=Y.substring(X.raw.length),X.tokens=this.inlineTokens(X.text,[],G,ae),Z.push(X);continue}if(X=this.tokenizer.autolink(Y,Ne)){Y=Y.substring(X.raw.length),Z.push(X);continue}if(!G&&(X=this.tokenizer.url(Y,Ne))){Y=Y.substring(X.raw.length),Z.push(X);continue}if(X=this.tokenizer.inlineText(Y,ae,Ke)){Y=Y.substring(X.raw.length),Te=X.raw.slice(-1),Z.push(X);continue}if(Y){var ve="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(ve);break}else throw new Error(ve)}}return Z},k(le,null,[{key:"rules",get:function(){return{block:ue,inline:Ie}}}]),le}(),Ge=S.defaults,ze=W.cleanUrl,ke=W.escape,xe=function(){function le(he){this.options=he||Ge}var se=le.prototype;return se.code=function(Y,Z,G){var ae=(Z||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Y,ae);Te!=null&&Te!==Y&&(G=!0,Y=Te)}return ae?'<pre><code class="'+this.options.langPrefix+ke(ae,!0)+'">'+(G?Y:ke(Y,!0))+`</code></pre>
|
|
|
`:"<pre><code>"+(G?Y:ke(Y,!0))+`</code></pre>
|
|
|
`},se.blockquote=function(Y){return`<blockquote>
|
|
|
`+Y+`</blockquote>
|
|
|
`},se.html=function(Y){return Y},se.heading=function(Y,Z,G,ae){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+ae.slug(G)+'">'+Y+"</h"+Z+`>
|
|
|
`:"<h"+Z+">"+Y+"</h"+Z+`>
|
|
|
`},se.hr=function(){return this.options.xhtml?`<hr/>
|
|
|
`:`<hr>
|
|
|
`},se.list=function(Y,Z,G){var ae=Z?"ol":"ul",Te=Z&&G!==1?' start="'+G+'"':"";return"<"+ae+Te+`>
|
|
|
`+Y+"</"+ae+`>
|
|
|
`},se.listitem=function(Y){return"<li>"+Y+`</li>
|
|
|
`},se.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},se.paragraph=function(Y){return"<p>"+Y+`</p>
|
|
|
`},se.table=function(Y,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
|
<thead>
|
|
|
`+Y+`</thead>
|
|
|
`+Z+`</table>
|
|
|
`},se.tablerow=function(Y){return`<tr>
|
|
|
`+Y+`</tr>
|
|
|
`},se.tablecell=function(Y,Z){var G=Z.header?"th":"td",ae=Z.align?"<"+G+' align="'+Z.align+'">':"<"+G+">";return ae+Y+"</"+G+`>
|
|
|
`},se.strong=function(Y){return"<strong>"+Y+"</strong>"},se.em=function(Y){return"<em>"+Y+"</em>"},se.codespan=function(Y){return"<code>"+Y+"</code>"},se.br=function(){return this.options.xhtml?"<br/>":"<br>"},se.del=function(Y){return"<del>"+Y+"</del>"},se.link=function(Y,Z,G){if(Y=ze(this.options.sanitize,this.options.baseUrl,Y),Y===null)return G;var ae='<a href="'+ke(Y)+'"';return Z&&(ae+=' title="'+Z+'"'),ae+=">"+G+"</a>",ae},se.image=function(Y,Z,G){if(Y=ze(this.options.sanitize,this.options.baseUrl,Y),Y===null)return G;var ae='<img src="'+Y+'" alt="'+G+'"';return Z&&(ae+=' title="'+Z+'"'),ae+=this.options.xhtml?"/>":">",ae},se.text=function(Y){return Y},le}(),Ee=function(){function le(){}var se=le.prototype;return se.strong=function(Y){return Y},se.em=function(Y){return Y},se.codespan=function(Y){return Y},se.del=function(Y){return Y},se.html=function(Y){return Y},se.text=function(Y){return Y},se.link=function(Y,Z,G){return""+G},se.image=function(Y,Z,G){return""+G},se.br=function(){return""},le}(),Se=function(){function le(){this.seen={}}var se=le.prototype;return se.slug=function(Y){var Z=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var G=Z;do this.seen[G]++,Z=G+"-"+this.seen[G];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},le}(),$=S.defaults,fe=W.unescape,J=function(){function le(he){this.options=he||$,this.options.renderer=this.options.renderer||new xe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ee,this.slugger=new Se}le.parse=function(Y,Z){var G=new le(Z);return G.parse(Y)};var se=le.prototype;return se.parse=function(Y,Z){Z===void 0&&(Z=!0);var G="",ae,Te,X,me,De,oe,ve,Be,tt,Qe,$e,st,mt,ct,nt,_t,St,Et,Xt=Y.length;for(ae=0;ae<Xt;ae++){Qe=Y[ae];switch(Qe.type){case"space":continue;case"hr":{G+=this.renderer.hr();continue}case"heading":{G+=this.renderer.heading(this.parseInline(Qe.tokens),Qe.depth,fe(this.parseInline(Qe.tokens,this.textRenderer)),this.slugger);continue}case"code":{G+=this.renderer.code(Qe.text,Qe.lang,Qe.escaped);continue}case"table":{for(Be="",ve="",me=Qe.header.length,Te=0;Te<me;Te++)ve+=this.renderer.tablecell(this.parseInline(Qe.tokens.header[Te]),{header:!0,align:Qe.align[Te]});for(Be+=this.renderer.tablerow(ve),tt="",me=Qe.cells.length,Te=0;Te<me;Te++){for(oe=Qe.tokens.cells[Te],ve="",De=oe.length,X=0;X<De;X++)ve+=this.renderer.tablecell(this.parseInline(oe[X]),{header:!1,align:Qe.align[X]});tt+=this.renderer.tablerow(ve)}G+=this.renderer.table(Be,tt);continue}case"blockquote":{tt=this.parse(Qe.tokens),G+=this.renderer.blockquote(tt);continue}case"list":{for($e=Qe.ordered,st=Qe.start,mt=Qe.loose,me=Qe.items.length,tt="",Te=0;Te<me;Te++)nt=Qe.items[Te],_t=nt.checked,St=nt.task,ct="",nt.task&&(Et=this.renderer.checkbox(_t),mt?nt.tokens.length>0&&nt.tokens[0].type==="text"?(nt.tokens[0].text=Et+" "+nt.tokens[0].text,nt.tokens[0].tokens&&nt.tokens[0].tokens.length>0&&nt.tokens[0].tokens[0].type==="text"&&(nt.tokens[0].tokens[0].text=Et+" "+nt.tokens[0].tokens[0].text)):nt.tokens.unshift({type:"text",text:Et}):ct+=Et),ct+=this.parse(nt.tokens,mt),tt+=this.renderer.listitem(ct,St,_t);G+=this.renderer.list(tt,$e,st);continue}case"html":{G+=this.renderer.html(Qe.text);continue}case"paragraph":{G+=this.renderer.paragraph(this.parseInline(Qe.tokens));continue}case"text":{for(tt=Qe.tokens?this.parseInline(Qe.tokens):Qe.text;ae+1<Xt&&Y[ae+1].type==="text";)Qe=Y[++ae],tt+=`
|
|
|
`+(Qe.tokens?this.parseInline(Qe.tokens):Qe.text);G+=Z?this.renderer.paragraph(tt):tt;continue}default:{var Kt='Token with "'+Qe.type+'" type was not found.';if(this.options.silent){console.error(Kt);return}else throw new Error(Kt)}}}return G},se.parseInline=function(Y,Z){Z=Z||this.renderer;var G="",ae,Te,X=Y.length;for(ae=0;ae<X;ae++){Te=Y[ae];switch(Te.type){case"escape":{G+=Z.text(Te.text);break}case"html":{G+=Z.html(Te.text);break}case"link":{G+=Z.link(Te.href,Te.title,this.parseInline(Te.tokens,Z));break}case"image":{G+=Z.image(Te.href,Te.title,Te.text);break}case"strong":{G+=Z.strong(this.parseInline(Te.tokens,Z));break}case"em":{G+=Z.em(this.parseInline(Te.tokens,Z));break}case"codespan":{G+=Z.codespan(Te.text);break}case"br":{G+=Z.br();break}case"del":{G+=Z.del(this.parseInline(Te.tokens,Z));break}case"text":{G+=Z.text(Te.text);break}default:{var me='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(me);return}else throw new Error(me)}}}return G},le}(),Ce=W.merge,We=W.checkSanitizeDeprecation,Ve=W.escape,Pe=S.getDefaults,Je=S.changeDefaults,ne=S.defaults;function be(le,se,he){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof se=="function"&&(he=se,se=null),se=Ce({},be.defaults,se||{}),We(se),he){var Y=se.highlight,Z;try{Z=je.lex(le,se)}catch(X){return he(X)}var G=function(me){var De;if(!me)try{De=J.parse(Z,se)}catch(oe){me=oe}return se.highlight=Y,me?he(me):he(null,De)};if(!Y||Y.length<3)return G();if(delete se.highlight,!Z.length)return G();var ae=0;be.walkTokens(Z,function(X){X.type==="code"&&(ae++,setTimeout(function(){Y(X.text,X.lang,function(me,De){if(me)return G(me);De!=null&&De!==X.text&&(X.text=De,X.escaped=!0),ae--,ae===0&&G()})},0))}),ae===0&&G();return}try{var Te=je.lex(le,se);return se.walkTokens&&be.walkTokens(Te,se.walkTokens),J.parse(Te,se)}catch(X){if(X.message+=`
|
|
|
Please report this to https://github.com/markedjs/marked.`,se.silent)return"<p>An error occurred:</p><pre>"+Ve(X.message+"",!0)+"</pre>";throw X}}be.options=be.setOptions=function(le){return Ce(be.defaults,le),Je(be.defaults),be},be.getDefaults=Pe,be.defaults=ne,be.use=function(le){var se=Ce({},le);if(le.renderer&&function(){var Y=be.defaults.renderer||new xe,Z=function(Te){var X=Y[Te];Y[Te]=function(){for(var me=arguments.length,De=new Array(me),oe=0;oe<me;oe++)De[oe]=arguments[oe];var ve=le.renderer[Te].apply(Y,De);return ve===!1&&(ve=X.apply(Y,De)),ve}};for(var G in le.renderer)Z(G);se.renderer=Y}(),le.tokenizer&&function(){var Y=be.defaults.tokenizer||new Me,Z=function(Te){var X=Y[Te];Y[Te]=function(){for(var me=arguments.length,De=new Array(me),oe=0;oe<me;oe++)De[oe]=arguments[oe];var ve=le.tokenizer[Te].apply(Y,De);return ve===!1&&(ve=X.apply(Y,De)),ve}};for(var G in le.tokenizer)Z(G);se.tokenizer=Y}(),le.walkTokens){var he=be.defaults.walkTokens;se.walkTokens=function(Y){le.walkTokens(Y),he&&he(Y)}}be.setOptions(se)},be.walkTokens=function(le,se){for(var he=O(le),Y;!(Y=he()).done;){var Z=Y.value;se(Z);switch(Z.type){case"table":{for(var G=O(Z.tokens.header),ae;!(ae=G()).done;){var Te=ae.value;be.walkTokens(Te,se)}for(var X=O(Z.tokens.cells),me;!(me=X()).done;)for(var De=me.value,oe=O(De),ve;!(ve=oe()).done;){var Be=ve.value;be.walkTokens(Be,se)}break}case"list":{be.walkTokens(Z.items,se);break}default:Z.tokens&&be.walkTokens(Z.tokens,se)}}},be.Parser=J,be.parser=J.parse,be.Renderer=xe,be.TextRenderer=Ee,be.Lexer=je,be.lexer=je.lex,be.Tokenizer=Me,be.Slugger=Se,be.parse=be;var Re=be;return Re})},Dqnf:function(Ze,ce,ie){"use strict";var j=ie("k1fw"),k=ie("tJVT"),D=ie("rAM+"),R=ie("q1tI"),O=ie.n(R),c=ie("J66h"),S=ie.n(c),y=ie("/POA"),p=ie.n(y),u=ie("q7KB"),o=ie.n(u),d=ie("ER/M"),s=ie.n(d),l=ie("dhSg"),r=ie("bdgK");function n(h,f,w){var m=w._core._renderService.dimensions.actualCellWidth||9.5,T=w._core._renderService.dimensions.actualCellHeight||18,C=Math.floor(f/T),x=Math.floor(h/m);return[x,C]}function a(h,f){var w=new r.default(function(m){var T=Object(D.a)(m),C;try{for(T.s();!(C=T.n()).done;){var x=C.value;if(x.target.offsetHeight>0||x.target.offsetWidth>0){var b=n(x.target.offsetWidth,x.target.offsetHeight,h),E=Object(k.a)(b,2),A=E[0],v=E[1];console.log("cols, rows",A,v),l.a.publish("ssh-xterm-resize",{columns:A,rows:v,width:x.target.offsetWidth,height:x.target.offsetHeight}),h.resize(A,v);var M=c.Base64.decode("IA=="),I=c.Base64.decode("CBtbSw==");h.write(M),h.write(I)}}}catch(P){T.e(P)}finally{T.f()}});return w.observe(f),w}var i=3e4;ce.a=function(h){var f=h.sshConfigData,w=h.sid,m=Object(R.useState)(null),T=Object(k.a)(m,2),C=T[0],x=T[1],b=f.ws_url,E=f.password,A=f.port,v=Object(R.useRef)(),M=Object(R.useRef)(),I=Object(R.useRef)(!1);return Object(R.useEffect)(function(){if(v.current&&b){var P=new y.Terminal({fontSize:16,rendererType:"dom"});P.open(v.current),P.onData(function(H){M.current&&(M.current.readyState===1&&(M.current.send(JSON.stringify({tp:"client",data:H})),l.a.publish("on-operating-ssh")))}),P.write("Connecting..."),x(P);var B=a(P,v.current);return function(){P.dispose(),B.unobserve(v.current)}}},[b,v.current]),Object(R.useEffect)(function(){if(C&&b){function P(){var K=new WebSocket(b);M.current=K,K.onopen=function(){var z=C.element.parentElement;if(z){var te=z.offsetWidth,de=z.offsetHeight;console.log("init",{tp:"init",data:Object(j.a)(Object(j.a)({},f),{},{secret:E,width:te,height:de,rows:C.rows,columns:C.cols})}),K.send(JSON.stringify({tp:"init",data:Object(j.a)(Object(j.a)({},f),{},{secret:E,width:te,height:de,rows:C.rows,columns:C.cols})}))}C.focus()},K.onerror=function(z){console.log("------in socket error----",z,K,b)},K.onmessage=function(z){I.current||(C.write("\r"),setTimeout(function(){},1e3)),I.current=!0,console.log("event:",z);var te=c.Base64.decode(z.data.toString()),de=C._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",te,de,C),C.write(te)},K.onclose=function(z){B&&clearInterval(B),C.write(`\r
|
|
|
connection closed`)}}var B=setInterval(function(){M.current&&M.current.send(JSON.stringify({tp:"h"}))},i),H=l.a.subscribe("create-socket",function(K){w==K&&(M.current&&M.current.readyState===1?C.focus():P(),C.focus())}),F=l.a.subscribe("close-socket",function(K){w===K&&(M.current&&(M.current.close(),I.current=!1,C.clear()),M.current=null)}),W=l.a.subscribe("ssh-xterm-resize",function(K){M.current&&M.current.readyState===1&&M.current.send(JSON.stringify({tp:"resize",data:Object(j.a)({},K)}))}),U=l.a.subscribe("ssh-add-connect-time",function(){M.current&&M.current.readyState===1&&M.current.send(JSON.stringify({tp:"overtime"}))});return function(){F(),H(),W(),U(),M.current&&(M.current.close(),I.current=!1)}}},[C,b,A]),O.a.createElement("div",{ref:v,className:s.a["xterm-panel"]},b?null:O.a.createElement("p",{style:{color:"#fff"}},"\u6B63\u5728\u8FDE\u63A5\u547D\u4EE4\u884C\u670D\u52A1..."))}},ELLl:function(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){var k={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=j.Pos;j.defineOption("autoCloseBrackets",!1,function(r,n,a){a&&a!=j.Init&&(r.removeKeyMap(O),r.state.closeBrackets=null),n&&(c(R(n,"pairs")),r.state.closeBrackets=n,r.addKeyMap(O))});function R(r,n){return n=="pairs"&&typeof r=="string"?r:typeof r=="object"&&r[n]!=null?r[n]:k[n]}var O={Backspace:p,Enter:u};function c(r){for(var n=0;n<r.length;n++){var a=r.charAt(n),i="'"+a+"'";O[i]||(O[i]=S(a))}}c(k.pairs+"`");function S(r){return function(n){return d(n,r)}}function y(r){var n=r.state.closeBrackets;if(!n||n.override)return n;var a=r.getModeAt(r.getCursor());return a.closeBrackets||n}function p(r){var n=y(r);if(!n||r.getOption("disableInput"))return j.Pass;for(var a=R(n,"pairs"),i=r.listSelections(),h=0;h<i.length;h++){if(!i[h].empty())return j.Pass;var f=s(r,i[h].head);if(!f||a.indexOf(f)%2!=0)return j.Pass}for(var h=i.length-1;h>=0;h--){var w=i[h].head;r.replaceRange("",D(w.line,w.ch-1),D(w.line,w.ch+1),"+delete")}}function u(r){var n=y(r),a=n&&R(n,"explode");if(!a||r.getOption("disableInput"))return j.Pass;for(var i=r.listSelections(),h=0;h<i.length;h++){if(!i[h].empty())return j.Pass;var f=s(r,i[h].head);if(!f||a.indexOf(f)%2!=0)return j.Pass}r.operation(function(){var w=r.lineSeparator()||`
|
|
|
`;r.replaceSelection(w+w,null),r.execCommand("goCharLeft"),i=r.listSelections();for(var m=0;m<i.length;m++){var T=i[m].head.line;r.indentLine(T,null,!0),r.indentLine(T+1,null,!0)}})}function o(r){var n=j.cmpPos(r.anchor,r.head)>0;return{anchor:new D(r.anchor.line,r.anchor.ch+(n?-1:1)),head:new D(r.head.line,r.head.ch+(n?1:-1))}}function d(r,n){var a=y(r);if(!a||r.getOption("disableInput"))return j.Pass;var i=R(a,"pairs"),h=i.indexOf(n);if(h==-1)return j.Pass;for(var f=R(a,"closeBefore"),w=R(a,"triples"),m=i.charAt(h+1)==n,T=r.listSelections(),C=h%2==0,x,b=0;b<T.length;b++){var E=T[b],A=E.head,v,M=r.getRange(A,D(A.line,A.ch+1));if(C&&!E.empty())v="surround";else if((m||!C)&&M==n)m&&l(r,A)?v="both":w.indexOf(n)>=0&&r.getRange(A,D(A.line,A.ch+3))==n+n+n?v="skipThree":v="skip";else if(m&&A.ch>1&&w.indexOf(n)>=0&&r.getRange(D(A.line,A.ch-2),A)==n+n){if(A.ch>2&&/\bstring/.test(r.getTokenTypeAt(D(A.line,A.ch-2))))return j.Pass;v="addFour"}else if(m){var I=A.ch==0?" ":r.getRange(D(A.line,A.ch-1),A);if(!j.isWordChar(M)&&I!=n&&!j.isWordChar(I))v="both";else return j.Pass}else if(C&&(M.length===0||/\s/.test(M)||f.indexOf(M)>-1))v="both";else return j.Pass;if(!x)x=v;else if(x!=v)return j.Pass}var P=h%2?i.charAt(h-1):n,B=h%2?n:i.charAt(h+1);r.operation(function(){if(x=="skip")r.execCommand("goCharRight");else if(x=="skipThree")for(var H=0;H<3;H++)r.execCommand("goCharRight");else if(x=="surround"){for(var F=r.getSelections(),H=0;H<F.length;H++)F[H]=P+F[H]+B;r.replaceSelections(F,"around"),F=r.listSelections().slice();for(var H=0;H<F.length;H++)F[H]=o(F[H]);r.setSelections(F)}else x=="both"?(r.replaceSelection(P+B,null),r.triggerElectric(P+B),r.execCommand("goCharLeft")):x=="addFour"&&(r.replaceSelection(P+P+P+P,"before"),r.execCommand("goCharRight"))})}function s(r,n){var a=r.getRange(D(n.line,n.ch-1),D(n.line,n.ch+1));return a.length==2?a:null}function l(r,n){var a=r.getTokenAt(D(n.line,n.ch+1));return/\bstring/.test(a.type)&&a.start==n.ch&&(n.ch==0||!/\bstring/.test(r.getTokenTypeAt(n)))}})},"ER/M":function(Ze,ce,ie){Ze.exports={"xterm-panel":"xterm-panel___2r2xx"}},Fv0C:function(Ze,ce,ie){"use strict";function j(l){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(n){return typeof n}:j=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},j(l)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=p(ie("Lo0S")),D=ie("vewr"),R=p(ie("8CQX")),O=S(ie("mHUz")),c=p(ie("GdRQ"));function S(l){return l&&l.__esModule?l:{default:l}}function y(){if(typeof WeakMap!="function")return null;var l=new WeakMap;return y=function(){return l},l}function p(l){if(l&&l.__esModule)return l;if(l===null||j(l)!=="object"&&typeof l!="function")return{default:l};var r=y();if(r&&r.has(l))return r.get(l);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in l)if(Object.prototype.hasOwnProperty.call(l,i)){var h=a?Object.getOwnPropertyDescriptor(l,i):null;h&&(h.get||h.set)?Object.defineProperty(n,i,h):n[i]=l[i]}return n.default=l,r&&r.set(l,n),n}function u(l,r){if(!(l instanceof r))throw new TypeError("Cannot call a class as a function")}function o(l,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function d(l,r,n){return r&&o(l.prototype,r),n&&o(l,n),l}var s=function(){function l(r){u(this,l),this._target=r||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 d(l,[{key:"_sendKeyEvent",value:function(n,a,i){if(i)this._keyDownList[a]=n;else{if(!(a in this._keyDownList))return;delete this._keyDownList[a]}k.Debug("onkeyevent "+(i?"down":"up")+", keysym: "+n,", code: "+a),this.onkeyevent(n,a,i)}},{key:"_getKeyCode",value:function(n){var a=R.getKeycode(n);if(a!=="Unidentified")return a;if(n.keyCode&&n.type!=="keypress"&&n.keyCode!==229)return"Platform"+n.keyCode;if(n.keyIdentifier){if(n.keyIdentifier.substr(0,2)!=="U+")return n.keyIdentifier;var i=parseInt(n.keyIdentifier.substr(2),16),h=String.fromCharCode(i).toUpperCase();return"Platform"+h.charCodeAt()}return"Unidentified"}},{key:"_handleKeyDown",value:function(n){var a=this._getKeyCode(n),i=R.getKeysym(n);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),a==="AltRight"&&n.timeStamp-this._altGrCtrlTime<50?i=O.default.XK_ISO_Level3_Shift:this._sendKeyEvent(O.default.XK_Control_L,"ControlLeft",!0)),a==="Unidentified"){i&&(this._sendKeyEvent(i,a,!0),this._sendKeyEvent(i,a,!1)),(0,D.stopEvent)(n);return}if(c.isMac()||c.isIOS())switch(i){case O.default.XK_Super_L:i=O.default.XK_Alt_L;break;case O.default.XK_Super_R:i=O.default.XK_Super_L;break;case O.default.XK_Alt_L:i=O.default.XK_Mode_switch;break;case O.default.XK_Alt_R:i=O.default.XK_ISO_Level3_Shift;break}if(a in this._keyDownList&&(i=this._keyDownList[a]),(c.isMac()||c.isIOS())&&a==="CapsLock"){this._sendKeyEvent(O.default.XK_Caps_Lock,"CapsLock",!0),this._sendKeyEvent(O.default.XK_Caps_Lock,"CapsLock",!1),(0,D.stopEvent)(n);return}if(!i&&(!n.key||c.isIE()||c.isEdge())){this._pendingKey=a,setTimeout(this._handleKeyPressTimeout.bind(this),10,n);return}if(this._pendingKey=null,(0,D.stopEvent)(n),a==="ControlLeft"&&c.isWindows()&&!("ControlLeft"in this._keyDownList)){this._altGrArmed=!0,this._altGrTimeout=setTimeout(this._handleAltGrTimeout.bind(this),100),this._altGrCtrlTime=n.timeStamp;return}this._sendKeyEvent(i,a,!0)}},{key:"_handleKeyPress",value:function(n){if((0,D.stopEvent)(n),this._pendingKey===null)return;var a=this._getKeyCode(n),i=R.getKeysym(n);if(a!=="Unidentified"&&a!=this._pendingKey)return;if(a=this._pendingKey,this._pendingKey=null,!i){k.Info("keypress with no keysym:",n);return}this._sendKeyEvent(i,a,!0)}},{key:"_handleKeyPressTimeout",value:function(n){if(this._pendingKey===null)return;var a,i=this._pendingKey;if(this._pendingKey=null,n.keyCode>=48&&n.keyCode<=57)a=n.keyCode;else if(n.keyCode>=65&&n.keyCode<=90){var h=String.fromCharCode(n.keyCode);n.shiftKey?h=h.toUpperCase():h=h.toLowerCase(),a=h.charCodeAt()}else a=0;this._sendKeyEvent(a,i,!0)}},{key:"_handleKeyUp",value:function(n){(0,D.stopEvent)(n);var a=this._getKeyCode(n);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(O.default.XK_Control_L,"ControlLeft",!0)),(c.isMac()||c.isIOS())&&a==="CapsLock"){this._sendKeyEvent(O.default.XK_Caps_Lock,"CapsLock",!0),this._sendKeyEvent(O.default.XK_Caps_Lock,"CapsLock",!1);return}this._sendKeyEvent(this._keyDownList[a],a,!1),c.isWindows()&&(a==="ShiftLeft"||a==="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(O.default.XK_Control_L,"ControlLeft",!0)}},{key:"_allKeysUp",value:function(){k.Debug(">> Keyboard.allKeysUp");for(var n in this._keyDownList)this._sendKeyEvent(this._keyDownList[n],n,!1);k.Debug("<< Keyboard.allKeysUp")}},{key:"_checkAlt",value:function(n){if(n.skipCheckAlt)return;if(n.altKey)return;var a=this._target,i=this._keyDownList;["AltLeft","AltRight"].forEach(function(h){if(!(h in i))return;var f=new KeyboardEvent("keyup",{key:i[h],code:h});f.skipCheckAlt=!0,a.dispatchEvent(f)})}},{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),c.isWindows()&&c.isFirefox()){var n=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach(function(a){return document.addEventListener(a,n,{capture:!0,passive:!0})})}}},{key:"ungrab",value:function(){if(c.isWindows()&&c.isFirefox()){var n=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach(function(a){return document.removeEventListener(a,n)})}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}();ce.default=s},GQ8N:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.toUnsigned32bit=j,ce.toSigned32bit=k;function j(D){return D>>>0}function k(D){return D|0}},GdRQ:function(Ze,ce,ie){"use strict";function j(C){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(b){return typeof b}:j=function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},j(C)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.isMac=a,ce.isWindows=i,ce.isIOS=h,ce.isSafari=f,ce.isIE=w,ce.isEdge=m,ce.isFirefox=T,ce.hasScrollbarGutter=ce.supportsImageMetadata=ce.supportsCursorURIs=ce.dragThreshold=ce.isTouchDevice=void 0;var k=R(ie("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var C=new WeakMap;return D=function(){return C},C}function R(C){if(C&&C.__esModule)return C;if(C===null||j(C)!=="object"&&typeof C!="function")return{default:C};var x=D();if(x&&x.has(C))return x.get(C);var b={},E=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in C)if(Object.prototype.hasOwnProperty.call(C,A)){var v=E?Object.getOwnPropertyDescriptor(C,A):null;v&&(v.get||v.set)?Object.defineProperty(b,A,v):b[A]=C[A]}return b.default=C,x&&x.set(C,b),b}var O="ontouchstart"in document.documentElement||document.ontouchstart!==void 0||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;ce.isTouchDevice=O,window.addEventListener("touchstart",function C(){ce.isTouchDevice=O=!0,window.removeEventListener("touchstart",C,!1)},!1);var c=10*(window.devicePixelRatio||1);ce.dragThreshold=c;var S=!1;try{var y=document.createElement("canvas");y.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',y.style.cursor.indexOf("url")===0?(k.Info("Data URI scheme cursor supported"),S=!0):k.Warn("Data URI scheme cursor not supported")}catch(C){k.Error("Data URI scheme cursor test exception: "+C)}var p=S;ce.supportsCursorURIs=p;var u=!1;try{new ImageData(new Uint8ClampedArray(4),1,1),u=!0}catch(C){}var o=u;ce.supportsImageMetadata=o;var d=!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 r=s.offsetWidth-l.offsetWidth;s.parentNode.removeChild(s),d=r!=0}catch(C){k.Error("Scrollbar test exception: "+C)}var n=d;ce.hasScrollbarGutter=n;function a(){return navigator&&!!/mac/i.exec(navigator.platform)}function i(){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 f(){return navigator&&navigator.userAgent.indexOf("Safari")!==-1&&navigator.userAgent.indexOf("Chrome")===-1}function w(){return navigator&&!!/trident/i.exec(navigator.userAgent)}function m(){return navigator&&!!/edge/i.exec(navigator.userAgent)}function T(){return navigator&&!!/firefox/i.exec(navigator.userAgent)}},Gytx:function(Ze,ce){Ze.exports=function(j,k,D,R){var O=D?D.call(R,j,k):void 0;if(O!==void 0)return!!O;if(j===k)return!0;if(typeof j!="object"||!j||typeof k!="object"||!k)return!1;var c=Object.keys(j),S=Object.keys(k);if(c.length!==S.length)return!1;for(var y=Object.prototype.hasOwnProperty.bind(k),p=0;p<c.length;p++){var u=c[p];if(!y(u))return!1;var o=j[u],d=k[u];if(O=D?D.call(R,o,d,u):void 0,O===!1||O===void 0&&o!==d)return!1}return!0}},HmJG:function(Ze,ce,ie){},ItS6:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=ie("eP3c"),k=D(ie("1q3G"));function D(y){return y&&y.__esModule?y:{default:y}}function R(y,p){if(!(y instanceof p))throw new TypeError("Cannot call a class as a function")}function O(y,p){for(var u=0;u<p.length;u++){var o=p[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}function c(y,p,u){return p&&O(y.prototype,p),u&&O(y,u),y}var S=function(){function y(){R(this,y),this.strm=new k.default,this.chunkSize=1024*10*10,this.strm.output=new Uint8Array(this.chunkSize),this.windowBits=5,(0,j.inflateInit)(this.strm,this.windowBits)}return c(y,[{key:"setInput",value:function(u){u?(this.strm.input=u,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(u){u>this.chunkSize&&(this.chunkSize=u,this.strm.output=new Uint8Array(this.chunkSize)),this.strm.next_out=0,this.strm.avail_out=u;var o=(0,j.inflate)(this.strm,0);if(o<0)throw new Error("zlib inflate failed");if(this.strm.next_out!=u)throw new Error("Incomplete zlib block");return new Uint8Array(this.strm.output.buffer,0,this.strm.next_out)}},{key:"reset",value:function(){(0,j.inflateReset)(this.strm)}}]),y}();ce.default=S},IxHN:function(Ze,ce,ie){"use strict";var j=ie("q1tI"),k=ie.n(j),D=ie("07cG"),R=ie.n(D);ce.a=function(O){var c=O.message,S=O.className,y=O.children,p=O.style,u=p===void 0?{}:p;return k.a.createElement("div",{className:"".concat(R.a.idsRingWrapper," ").concat(S)},k.a.createElement("div",{className:R.a.ldsRing},k.a.createElement("div",null),k.a.createElement("div",null),k.a.createElement("div",null),k.a.createElement("div",null)),c?k.a.createElement("p",{style:u},c):null,y)}},J66h:function(Ze,ce,ie){(function(j){var k,D;(function(R,O){Ze.exports=O(R)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof j!="undefined"?j:this,function(R){"use strict";R=R||{};var O=R.Base64,c="2.6.4",S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=function(P){for(var B={},H=0,F=P.length;H<F;H++)B[P.charAt(H)]=H;return B}(S),p=String.fromCharCode,u=function(P){if(P.length<2){var B=P.charCodeAt(0);return B<128?P:B<2048?p(192|B>>>6)+p(128|B&63):p(224|B>>>12&15)+p(128|B>>>6&63)+p(128|B&63)}else{var B=65536+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return p(240|B>>>18&7)+p(128|B>>>12&63)+p(128|B>>>6&63)+p(128|B&63)}},o=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,d=function(P){return P.replace(o,u)},s=function(P){var B=[0,2,1][P.length%3],H=P.charCodeAt(0)<<16|(P.length>1?P.charCodeAt(1):0)<<8|(P.length>2?P.charCodeAt(2):0),F=[S.charAt(H>>>18),S.charAt(H>>>12&63),B>=2?"=":S.charAt(H>>>6&63),B>=1?"=":S.charAt(H&63)];return F.join("")},l=R.btoa&&typeof R.btoa=="function"?function(P){return R.btoa(P)}:function(P){if(P.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return P.replace(/[\s\S]{1,3}/g,s)},r=function(P){return l(d(String(P)))},n=function(P){return P.replace(/[+\/]/g,function(B){return B=="+"?"-":"_"}).replace(/=/g,"")},a=function(P,B){return B?n(r(P)):r(P)},i=function(P){return a(P,!0)},h;R.Uint8Array&&(h=function(P,B){for(var H="",F=0,W=P.length;F<W;F+=3){var U=P[F],K=P[F+1],z=P[F+2],te=U<<16|K<<8|z;H+=S.charAt(te>>>18)+S.charAt(te>>>12&63)+(typeof K!="undefined"?S.charAt(te>>>6&63):"=")+(typeof z!="undefined"?S.charAt(te&63):"=")}return B?n(H):H});var f=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(P){switch(P.length){case 4:var B=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),H=B-65536;return p((H>>>10)+55296)+p((H&1023)+56320);case 3:return p((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return p((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},m=function(P){return P.replace(f,w)},T=function(P){var B=P.length,H=B%4,F=(B>0?y[P.charAt(0)]<<18:0)|(B>1?y[P.charAt(1)]<<12:0)|(B>2?y[P.charAt(2)]<<6:0)|(B>3?y[P.charAt(3)]:0),W=[p(F>>>16),p(F>>>8&255),p(F&255)];return W.length-=[0,0,2,1][H],W.join("")},C=R.atob&&typeof R.atob=="function"?function(P){return R.atob(P)}:function(P){return P.replace(/\S{1,4}/g,T)},x=function(P){return C(String(P).replace(/[^A-Za-z0-9\+\/]/g,""))},b=function(P){return m(C(P))},E=function(P){return String(P).replace(/[-_]/g,function(B){return B=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},A=function(P){return b(E(P))},v;R.Uint8Array&&(v=function(P){return Uint8Array.from(x(E(P)),function(B){return B.charCodeAt(0)})});var M=function(){var P=R.Base64;return R.Base64=O,P};if(R.Base64={VERSION:c,atob:x,btoa:l,fromBase64:A,toBase64:a,utob:d,encode:a,encodeURI:i,btou:m,decode:A,noConflict:M,fromUint8Array:h,toUint8Array:v},typeof Object.defineProperty=="function"){var I=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}};R.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",I(function(){return A(this)})),Object.defineProperty(String.prototype,"toBase64",I(function(P){return a(this,P)})),Object.defineProperty(String.prototype,"toBase64URI",I(function(){return a(this,!0)}))}}return R.Meteor&&(Base64=R.Base64),Ze.exports?Ze.exports.Base64=R.Base64:!(k=[],D=function(){return R.Base64}.apply(ce,k),D!==void 0&&(Ze.exports=D)),{Base64:R.Base64}})}).call(this,ie("IyRk"))},JSwD:function(Ze,ce,ie){"use strict";function j(n){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(i){return typeof i}:j=function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},j(n)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=r;var k=R(ie("6BzB"));function D(){if(typeof WeakMap!="function")return null;var n=new WeakMap;return D=function(){return n},n}function R(n){if(n&&n.__esModule)return n;if(n===null||j(n)!=="object"&&typeof n!="function")return{default:n};var a=D();if(a&&a.has(n))return a.get(n);var i={},h=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in n)if(Object.prototype.hasOwnProperty.call(n,f)){var w=h?Object.getOwnPropertyDescriptor(n,f):null;w&&(w.get||w.set)?Object.defineProperty(i,f,w):i[f]=n[f]}return i.default=n,a&&a.set(n,i),i}var O=15,c=852,S=592,y=0,p=1,u=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],d=[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 r(n,a,i,h,f,w,m,T){var C=T.bits,x=0,b=0,E=0,A=0,v=0,M=0,I=0,P=0,B=0,H=0,F,W,U,K,z,te=null,de=0,ge,Ue=new k.Buf16(O+1),Me=new k.Buf16(O+1),Le=null,Oe=0,Fe,ye,Ae;for(x=0;x<=O;x++)Ue[x]=0;for(b=0;b<h;b++)Ue[a[i+b]]++;for(v=C,A=O;A>=1&&!(Ue[A]!==0);A--);if(v>A&&(v=A),A===0)return f[w++]=1<<24|64<<16|0,f[w++]=1<<24|64<<16|0,T.bits=1,0;for(E=1;E<A&&!(Ue[E]!==0);E++);for(v<E&&(v=E),P=1,x=1;x<=O;x++)if(P<<=1,P-=Ue[x],P<0)return-1;if(P>0&&(n===y||A!==1))return-1;for(Me[1]=0,x=1;x<O;x++)Me[x+1]=Me[x]+Ue[x];for(b=0;b<h;b++)a[i+b]!==0&&(m[Me[a[i+b]]++]=b);if(n===y?(te=Le=m,ge=19):n===p?(te=o,de-=257,Le=d,Oe-=257,ge=256):(te=s,Le=l,ge=-1),H=0,b=0,x=E,z=w,M=v,I=0,U=-1,B=1<<v,K=B-1,n===p&&B>c||n===u&&B>S)return 1;for(;;){Fe=x-I,m[b]<ge?(ye=0,Ae=m[b]):m[b]>ge?(ye=Le[Oe+m[b]],Ae=te[de+m[b]]):(ye=32+64,Ae=0),F=1<<x-I,W=1<<M,E=W;do W-=F,f[z+(H>>I)+W]=Fe<<24|ye<<16|Ae|0;while(W!==0);for(F=1<<x-1;H&F;)F>>=1;if(F!==0?(H&=F-1,H+=F):H=0,b++,--Ue[x]===0){if(x===A)break;x=a[i+m[b]]}if(x>v&&(H&K)!==U){for(I===0&&(I=v),z+=E,M=x-I,P=1<<M;M+I<A&&!(P-=Ue[M+I],P<=0);)M++,P<<=1;if(B+=1<<M,n===p&&B>c||n===u&&B>S)return 1;U=H&K,f[U]=v<<24|M<<16|z-w|0}}return H!==0&&(f[z+H]=x-I<<24|64<<16|0),T.bits=v,0}},LCi9:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(f,w){if(!(f instanceof w))throw new TypeError("Cannot call a class as a function")}function k(f,w){for(var m=0;m<w.length;m++){var T=w[m];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(f,T.key,T)}}function D(f,w,m){return w&&k(f.prototype,w),m&&k(f,m),f}var R=0,O=1,c=2,S=4,y=8,p=16,u=32,o=64,d=127,s=50,l=90,r=250,n=1e3,a=1e3,i=50,h=function(){function f(){j(this,f),this._target=null,this._state=d,this._tracked=[],this._ignored=[],this._waitingRelease=!1,this._releaseStart=0,this._longpressTimeoutId=null,this._twoTouchTimeoutId=null,this._boundEventHandler=this._eventHandler.bind(this)}return D(f,[{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 T;m.stopPropagation(),m.preventDefault();switch(m.type){case"touchstart":T=this._touchStart;break;case"touchmove":T=this._touchMove;break;case"touchend":case"touchcancel":T=this._touchEnd;break}for(var C=0;C<m.changedTouches.length;C++){var x=m.changedTouches[C];T.call(this,x.identifier,x.clientX,x.clientY)}}},{key:"_touchStart",value:function(m,T,C){if(this._hasDetectedGesture()||this._state===R){this._ignored.push(m);return}if(this._tracked.length>0&&Date.now()-this._tracked[0].started>r){this._state=R,this._ignored.push(m);return}if(this._waitingRelease){this._state=R,this._ignored.push(m);return}this._tracked.push({id:m,started:Date.now(),active:!0,firstX:T,firstY:C,lastX:T,lastY:C,angle:0});switch(this._tracked.length){case 1:this._startLongpressTimeout();break;case 2:this._state&=~(O|y|p),this._stopLongpressTimeout();break;case 3:this._state&=~(c|u|o);break;default:this._state=R}}},{key:"_touchMove",value:function(m,T,C){var x=this._tracked.find(function(I){return I.id===m});if(x===void 0)return;x.lastX=T,x.lastY=C;var b=T-x.firstX,E=C-x.firstY;if((x.firstX!==x.lastX||x.firstY!==x.lastY)&&(x.angle=Math.atan2(E,b)*180/Math.PI),!this._hasDetectedGesture()){if(Math.hypot(b,E)<s)return;if(this._state&=~(O|c|S|p),this._stopLongpressTimeout(),this._tracked.length!==1&&(this._state&=~y),this._tracked.length!==2&&(this._state&=~(u|o)),this._tracked.length===2){var A=this._tracked.find(function(I){return I.id!==m}),v=Math.hypot(A.firstX-A.lastX,A.firstY-A.lastY);if(v>s){var M=Math.abs(x.angle-A.angle);M=Math.abs((M+180)%360-180),M>l?this._state&=~u: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,T,C){if(this._ignored.indexOf(m)!==-1){this._ignored.splice(this._ignored.indexOf(m),1),this._ignored.length===0&&this._tracked.length===0&&(this._state=d,this._waitingRelease=!1);return}if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning()&&(this._stopTwoTouchTimeout(),this._state=R),!this._hasDetectedGesture()&&(this._state&=~(y|u|o),this._state&=~p,this._stopLongpressTimeout(),!this._waitingRelease)){this._releaseStart=Date.now(),this._waitingRelease=!0;switch(this._tracked.length){case 1:this._state&=~(c|S);break;case 2:this._state&=~(O|S);break}}if(this._waitingRelease){Date.now()-this._releaseStart>r&&(this._state=R),this._tracked.some(function(E){return Date.now()-E.started>n})&&(this._state=R);var x=this._tracked.find(function(E){return E.id===m});if(x.active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(this._state!==R)return}this._hasDetectedGesture()&&this._pushEvent("gestureend");for(var b=0;b<this._tracked.length;b++)this._tracked[b].active&&this._ignored.push(this._tracked[b].id);this._tracked=[],this._state=R,this._ignored.indexOf(m)!==-1&&this._ignored.splice(this._ignored.indexOf(m),1),this._ignored.length===0&&(this._state=d,this._waitingRelease=!1)}},{key:"_hasDetectedGesture",value:function(){return this._state===R||this._state&this._state-1?!1:!(this._state&(O|c|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()},a)}},{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()},i)}},{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(),T=Math.abs(m.x),C=Math.abs(m.y),x=this._getAverageDistance(),b=Math.abs(Math.hypot(x.first.x,x.first.y)-Math.hypot(x.last.x,x.last.y));C<b&&T<b?this._state=o:this._state=u,this._pushEvent("gesturestart"),this._pushEvent("gesturemove")}},{key:"_pushEvent",value:function(m){var T={type:this._stateToGesture(this._state)},C=this._getPosition(),x=C.last;m==="gesturestart"&&(x=C.first);switch(this._state){case u:case o:x=C.first;break}if(T.clientX=x.x,T.clientY=x.y,this._state===o){var b=this._getAverageDistance();m==="gesturestart"?(T.magnitudeX=b.first.x,T.magnitudeY=b.first.y):(T.magnitudeX=b.last.x,T.magnitudeY=b.last.y)}else if(this._state===u)if(m==="gesturestart")T.magnitudeX=0,T.magnitudeY=0;else{var E=this._getAverageMovement();T.magnitudeX=E.x,T.magnitudeY=E.y}var A=new CustomEvent(m,{detail:T});this._target.dispatchEvent(A)}},{key:"_stateToGesture",value:function(m){switch(m){case O:return"onetap";case c:return"twotap";case S:return"threetap";case y:return"drag";case p:return"longpress";case u: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,T=0,C=0,x=0,b=0,E=0;E<this._tracked.length;E++)T+=this._tracked[E].firstX,C+=this._tracked[E].firstY,x+=this._tracked[E].lastX,b+=this._tracked[E].lastY;return{first:{x:T/m,y:C/m},last:{x:x/m,y:b/m}}}},{key:"_getAverageMovement",value:function(){if(this._tracked.length===0)throw new Error("Failed to get gesture movement, no tracked touches");var m,T;m=T=0;for(var C=this._tracked.length,x=0;x<this._tracked.length;x++)m+=this._tracked[x].lastX-this._tracked[x].firstX,T+=this._tracked[x].lastY-this._tracked[x].firstY;return{x:m/C,y:T/C}}},{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],T=this._tracked[this._tracked.length-1],C=Math.abs(T.firstX-m.firstX),x=Math.abs(T.firstY-m.firstY),b=Math.abs(T.lastX-m.lastX),E=Math.abs(T.lastY-m.lastY);return{first:{x:C,y:x},last:{x:b,y:E}}}}]),f}();ce.default=h},LdHM:function(Ze,ce,ie){"use strict";ie.d(ce,"b",function(){return f}),ie.d(ce,"a",function(){return m});var j=ie("1OyB"),k=ie("vuIU"),D=ie("Ji7U"),R=ie("LK+K"),O=ie("q1tI"),c=ie("rePB"),S=ie("Ff2n"),y=ie("ODXe"),p=ie("4IlW"),u=ie("bX4T"),o=ie("YrtM"),d=ie("TSYQ"),s=ie.n(d),l=ie("+nKL"),r=ie("8OUc"),n=function(z,te){var de=z.prefixCls,ge=z.id,Ue=z.flattenOptions,Me=z.childrenAsData,Le=z.values,Oe=z.searchValue,Fe=z.multiple,ye=z.defaultActiveFirstOption,Ae=z.height,re=z.itemHeight,pe=z.notFoundContent,ue=z.open,Ie=z.menuItemSelectedIcon,Ke=z.virtual,Ne=z.onSelect,je=z.onToggleOpen,Ge=z.onActiveValue,ze=z.onScroll,ke=z.onMouseEnter,xe="".concat(de,"-item"),Ee=Object(o.a)(function(){return Ue},[ue,Ue],function(Re,le){return le[0]&&Re[1]!==le[1]}),Se=O.useRef(null),$=function(le){le.preventDefault()},fe=function(le){Se.current&&Se.current.scrollTo({index:le})},J=function(le){for(var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,he=Ee.length,Y=0;Y<he;Y+=1){var Z=(le+Y*se+he)%he,G=Ee[Z],ae=G.group,Te=G.data;if(!ae&&!Te.disabled)return Z}return-1},Ce=O.useState(function(){return J(0)}),We=Object(y.a)(Ce,2),Ve=We[0],Pe=We[1],Je=function(le){Pe(le);var se=Ee[le];if(!se){Ge(null,-1);return}Ge(se.data.value,le)};O.useEffect(function(){Je(ye!==!1?J(0):-1)},[Ee.length,Oe]),O.useEffect(function(){var Re=setTimeout(function(){if(!Fe&&ue&&Le.size===1){var le=Array.from(Le)[0],se=Ee.findIndex(function(he){var Y=he.data;return Y.value===le});Je(se),fe(se)}});return function(){return clearTimeout(Re)}},[ue]);var ne=function(le){le!==void 0&&Ne(le,{selected:!Le.has(le)}),Fe||je(!1)};if(O.useImperativeHandle(te,function(){return{onKeyDown:function(le){var se=le.which;switch(se){case p.a.UP:case p.a.DOWN:{var he=0;if(se===p.a.UP?he=-1:se===p.a.DOWN&&(he=1),he!==0){var Y=J(Ve+he,he);fe(Y),Je(Y)}break}case p.a.ENTER:{var Z=Ee[Ve];Z&&!Z.data.disabled?ne(Z.data.value):ne(void 0),ue&&le.preventDefault();break}case p.a.ESC:je(!1)}},onKeyUp:function(){},scrollTo:function(le){fe(le)}}}),Ee.length===0)return O.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),className:"".concat(xe,"-empty"),onMouseDown:$},pe);function be(Re){var le=Ee[Re];if(!le)return null;var se=le.data||{},he=se.value,Y=se.label,Z=se.children,G=Object(u.a)(se,!0),ae=Me?Z:Y;return le?O.createElement("div",Object.assign({"aria-label":typeof ae=="string"?ae:null},G,{key:Re,role:"option",id:"".concat(ge,"_list_").concat(Re),"aria-selected":Le.has(he)}),he):null}return O.createElement(O.Fragment,null,O.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(Ve-1),be(Ve),be(Ve+1)),O.createElement(l.a,{itemKey:"key",ref:Se,data:Ee,height:Ae,itemHeight:re,fullHeight:!1,onMouseDown:$,onScroll:ze,virtual:Ke,onMouseEnter:ke},function(Re,le){var se,he=Re.group,Y=Re.groupOption,Z=Re.data,G=Z.label,ae=Z.key;if(he)return O.createElement("div",{className:s()(xe,"".concat(xe,"-group"))},G!==void 0?G:ae);var Te=Z.disabled,X=Z.value,me=Z.title,De=Z.children,oe=Z.style,ve=Z.className,Be=Object(S.a)(Z,["disabled","value","title","children","style","className"]),tt=Le.has(X),Qe="".concat(xe,"-option"),$e=s()(xe,Qe,ve,(se={},Object(c.a)(se,"".concat(Qe,"-grouped"),Y),Object(c.a)(se,"".concat(Qe,"-active"),Ve===le&&!Te),Object(c.a)(se,"".concat(Qe,"-disabled"),Te),Object(c.a)(se,"".concat(Qe,"-selected"),tt),se)),st=Me?De:G,mt=!Ie||typeof Ie=="function"||tt;return O.createElement("div",Object.assign({},Be,{"aria-selected":tt,className:$e,title:me,onMouseMove:function(){if(Ve===le||Te)return;Je(le)},onClick:function(){Te||ne(X)},style:oe}),O.createElement("div",{className:"".concat(Qe,"-content")},st||X),O.isValidElement(Ie)||tt,mt&&O.createElement(r.a,{className:"".concat(xe,"-option-state"),customizeIcon:Ie,customizeIconProps:{isSelected:tt}},tt?"\u2713":null))}))},a=O.forwardRef(n);a.displayName="OptionList";var i=a,h=function(){return null};h.isSelectOption=!0;var f=h,w=function(){return null};w.isSelectOptGroup=!0;var m=w,T=ie("VTBJ"),C=ie("Zm9Q");function x(K){var z=K.key,te=K.props,de=te.children,ge=te.value,Ue=Object(S.a)(te,["children","value"]);return Object(T.a)({key:z,value:ge!==void 0?ge:z,children:de},Ue)}function b(K){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(C.a)(K).map(function(te,de){if(!O.isValidElement(te)||!te.type)return null;var ge=te.type.isSelectOptGroup,Ue=te.key,Me=te.props,Le=Me.children,Oe=Object(S.a)(Me,["children"]);return z||!ge?x(te):Object(T.a)(Object(T.a)({key:"__RC_SELECT_GRP__".concat(Ue===null?de:Ue,"__"),label:Ue},Oe),{},{options:b(Le)})}).filter(function(te){return te})}var E=ie("2Qr1"),A=ie("qNPg"),v=ie("U8pU"),M=ie("Kwbf"),I=ie("WKfj");function P(K){var z=K.mode,te=K.options,de=K.children,ge=K.backfill,Ue=K.allowClear,Me=K.placeholder,Le=K.getInputElement,Oe=K.showSearch,Fe=K.onSearch,ye=K.defaultOpen,Ae=K.autoFocus,re=K.labelInValue,pe=K.value,ue=K.inputValue,Ie=K.optionLabelProp,Ke=z==="multiple"||z==="tags",Ne=Oe!==void 0?Oe:Ke||z==="combobox",je=te||b(de);if(Object(M.a)(z!=="tags"||je.every(function(xe){return!xe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),z==="tags"||z==="combobox"){var Ge=je.some(function(xe){return xe.options?xe.options.some(function(Ee){return typeof("value"in Ee?Ee.value:Ee.key)=="number"}):typeof("value"in xe?xe.value:xe.key)=="number"});Object(M.a)(!Ge,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(M.a)(z!=="combobox"||!Ie,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(M.a)(z==="combobox"||!ge,"`backfill` only works with `combobox` mode."),Object(M.a)(z==="combobox"||!Le,"`getInputElement` only work with `combobox` mode."),Object(M.b)(z!=="combobox"||!Le||!Ue||!Me,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),Fe&&!Ne&&z!=="combobox"&&z!=="tags"&&Object(M.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(M.b)(!ye||Ae,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),pe!=null){var ze=Object(I.d)(pe);Object(M.a)(!re||ze.every(function(xe){return Object(v.a)(xe)==="object"&&("key"in xe||"value"in xe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(M.a)(!Ke||Array.isArray(pe),"`value` should be array when `mode` is `multiple` or `tags`")}if(de){var ke=null;Object(C.a)(de).some(function(xe){if(!O.isValidElement(xe)||!xe.type)return!1;var Ee=xe.type;if(Ee.isSelectOption)return!1;if(Ee.isSelectOptGroup){var Se=Object(C.a)(xe.props.children).every(function($){return!O.isValidElement($)||!xe.type||$.type.isSelectOption?!0:(ke=$.type,!1)});return!Se}return ke=Ee,!0}),ke&&Object(M.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(M.a)(ue===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var B=P,H=Object(A.a)({prefixCls:"rc-select",components:{optionList:i},convertChildrenToData:b,flattenOptions:E.d,getLabeledValue:E.e,filterOptions:E.b,isValueDisabled:E.g,findValueOption:E.c,warningProps:B,fillOptionsWithMissingValue:E.a}),F=function(K){Object(D.a)(te,K);var z=Object(R.a)(te);function te(){var de;return Object(j.a)(this,te),de=z.apply(this,arguments),de.selectRef=O.createRef(),de.focus=function(){de.selectRef.current.focus()},de.blur=function(){de.selectRef.current.blur()},de}return Object(k.a)(te,[{key:"render",value:function(){return O.createElement(H,Object.assign({ref:this.selectRef},this.props))}}]),te}(O.Component);F.Option=f,F.OptGroup=m;var W=F,U=ce.c=W},Lmeb:function(Ze,ce,ie){},Lo0S:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.initLogging=c,ce.getLogging=S,ce.Error=ce.Warn=ce.Info=ce.Debug=void 0;var j="warn",k=function(){};ce.Debug=k;var D=function(){};ce.Info=D;var R=function(){};ce.Warn=R;var O=function(){};ce.Error=O;function c(y){if(typeof y=="undefined"?y=j:j=y,ce.Debug=k=ce.Info=D=ce.Warn=R=ce.Error=O=function(){},typeof window.console!="undefined")switch(y){case"debug":ce.Debug=k=console.debug.bind(window.console);case"info":ce.Info=D=console.info.bind(window.console);case"warn":ce.Warn=R=console.warn.bind(window.console);case"error":ce.Error=O=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+y+"'")}}function S(){return j}c()},M8RZ:function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return p});var j=ie("fWQN"),k=ie("mtLc"),D=ie("yKVA"),R=ie("879j"),O=ie("q1tI"),c=ie.n(O),S=ie("i8i4"),y=ie.n(S),p=function(u){Object(D.a)(d,u);var o=Object(R.a)(d);function d(s){var l;Object(j.a)(this,d),l=o.call(this,s);var r=window.document;return l.node=r.createElement("div"),r.body.appendChild(l.node),l}return Object(k.a)(d,[{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)}}]),d}(c.a.Component)},MZdM:function(Ze,ce,ie){"use strict";function j(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(r){return typeof r}:j=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},j(s)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=y(ie("Lo0S")),D=c(ie("N/zr")),R=ie("GdRQ"),O=ie("GQ8N");function c(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 y(s){if(s&&s.__esModule)return s;if(s===null||j(s)!=="object"&&typeof s!="function")return{default:s};var l=S();if(l&&l.has(s))return l.get(s);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)){var i=n?Object.getOwnPropertyDescriptor(s,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=s[a]}return r.default=s,l&&l.set(s,r),r}function p(s,l){if(!(s instanceof l))throw new TypeError("Cannot call a class as a function")}function u(s,l){for(var r=0;r<l.length;r++){var n=l[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,n.key,n)}}function o(s,l,r){return l&&u(s.prototype,l),r&&u(s,r),s}var d=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,k.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},k.Debug("User Agent: "+navigator.userAgent),!("createImageData"in this._drawCtx))throw new Error("Canvas does not support createImageData");this._tile16x16=this._drawCtx.createImageData(16,16),k.Debug("<< Display.constructor"),this._scale=1,this._clipViewport=!1,this.onflush=function(){}}return o(s,[{key:"viewportChangePos",value:function(r,n){var a=this._viewportLoc;r=Math.floor(r),n=Math.floor(n),this._clipViewport||(r=-a.w,n=-a.h);var i=a.x+a.w-1,h=a.y+a.h-1;if(r<0&&a.x+r<0&&(r=-a.x),i+r>=this._fbWidth&&(r-=i+r-this._fbWidth+1),a.y+n<0&&(n=-a.y),h+n>=this._fbHeight&&(n-=h+n-this._fbHeight+1),r===0&&n===0)return;k.Debug("viewportChange deltaX: "+r+", deltaY: "+n),a.x+=r,a.y+=n,this._damage(a.x,a.y,a.w,a.h),this.flip()}},{key:"viewportChangeSize",value:function(r,n){(!this._clipViewport||typeof r=="undefined"||typeof n=="undefined")&&(k.Debug("Setting viewport to full display region"),r=this._fbWidth,n=this._fbHeight),r=Math.floor(r),n=Math.floor(n),r>this._fbWidth&&(r=this._fbWidth),n>this._fbHeight&&(n=this._fbHeight);var a=this._viewportLoc;if(a.w!==r||a.h!==n){a.w=r,a.h=n;var i=this._target;i.width=r,i.height=n,this.viewportChangePos(0,0),this._damage(a.x,a.y,a.w,a.h),this.flip(),this._rescale(this._scale)}}},{key:"absX",value:function(r){return this._scale===0?0:(0,O.toSigned32bit)(r/this._scale+this._viewportLoc.x)}},{key:"absY",value:function(r){return this._scale===0?0:(0,O.toSigned32bit)(r/this._scale+this._viewportLoc.y)}},{key:"resize",value:function(r,n){this._prevDrawStyle="",this._fbWidth=r,this._fbHeight=n;var a=this._backbuffer;if(a.width!==r||a.height!==n){var i=null;a.width>0&&a.height>0&&(i=this._drawCtx.getImageData(0,0,a.width,a.height)),a.width!==r&&(a.width=r),a.height!==n&&(a.height=n),i&&this._drawCtx.putImageData(i,0,0)}var h=this._viewportLoc;this.viewportChangeSize(h.w,h.h),this.viewportChangePos(0,0)}},{key:"_damage",value:function(r,n,a,i){r<this._damageBounds.left&&(this._damageBounds.left=r),n<this._damageBounds.top&&(this._damageBounds.top=n),r+a>this._damageBounds.right&&(this._damageBounds.right=r+a),n+i>this._damageBounds.bottom&&(this._damageBounds.bottom=n+i)}},{key:"flip",value:function(r){if(this._renderQ.length!==0&&!r)this._renderQPush({type:"flip"});else{var n=this._damageBounds.left,a=this._damageBounds.top,i=this._damageBounds.right-n,h=this._damageBounds.bottom-a,f=n-this._viewportLoc.x,w=a-this._viewportLoc.y;f<0&&(i+=f,n-=f,f=0),w<0&&(h+=w,a-=w,w=0),f+i>this._viewportLoc.w&&(i=this._viewportLoc.w-f),w+h>this._viewportLoc.h&&(h=this._viewportLoc.h-w),i>0&&h>0&&this._targetCtx.drawImage(this._backbuffer,n,a,i,h,f,w,i,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(r,n,a,i,h,f){this._renderQ.length!==0&&!f?this._renderQPush({type:"fill",x:r,y:n,width:a,height:i,color:h}):(this._setFillColor(h),this._drawCtx.fillRect(r,n,a,i),this._damage(r,n,a,i))}},{key:"copyImage",value:function(r,n,a,i,h,f,w){this._renderQ.length!==0&&!w?this._renderQPush({type:"copy",oldX:r,oldY:n,x:a,y:i,width:h,height:f}):(this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,r,n,h,f,a,i,h,f),this._damage(a,i,h,f))}},{key:"imageRect",value:function(r,n,a,i,h,f){if(a===0||i===0)return;var w=new Image;w.src="data: "+h+";base64,"+D.default.encode(f),this._renderQPush({type:"img",img:w,x:r,y:n,width:a,height:i})}},{key:"startTile",value:function(r,n,a,i,h){this._tileX=r,this._tileY=n,a===16&&i===16?this._tile=this._tile16x16:this._tile=this._drawCtx.createImageData(a,i);for(var f=h[2],w=h[1],m=h[0],T=this._tile.data,C=0;C<a*i*4;C+=4)T[C]=f,T[C+1]=w,T[C+2]=m,T[C+3]=255}},{key:"subTile",value:function(r,n,a,i,h){for(var f=h[2],w=h[1],m=h[0],T=r+a,C=n+i,x=this._tile.data,b=this._tile.width,E=n;E<C;E++)for(var A=r;A<T;A++){var v=(A+E*b)*4;x[v]=f,x[v+1]=w,x[v+2]=m,x[v+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(r,n,a,i,h,f,w){if(this._renderQ.length!==0&&!w){var m=new Uint8Array(a*i*4);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blit",data:m,x:r,y:n,width:a,height:i})}else this._bgrxImageData(r,n,a,i,h,f)}},{key:"blitRgbImage",value:function(r,n,a,i,h,f,w){if(this._renderQ.length!==0&&!w){var m=new Uint8Array(a*i*3);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blitRgb",data:m,x:r,y:n,width:a,height:i})}else this._rgbImageData(r,n,a,i,h,f)}},{key:"blitRgbxImage",value:function(r,n,a,i,h,f,w){if(this._renderQ.length!==0&&!w){var m=new Uint8Array(a*i*4);m.set(new Uint8Array(h.buffer,0,m.length)),this._renderQPush({type:"blitRgbx",data:m,x:r,y:n,width:a,height:i})}else this._rgbxImageData(r,n,a,i,h,f)}},{key:"drawImage",value:function(r,n,a){this._drawCtx.drawImage(r,n,a),this._damage(n,a,r.width,r.height)}},{key:"autoscale",value:function(r,n){var a;if(r===0||n===0)a=0;else{var i=this._viewportLoc,h=r/n,f=i.w/i.h;f>=h?a=r/i.w:a=n/i.h}this._rescale(a)}},{key:"_rescale",value:function(r){this._scale=r;var n=this._viewportLoc,a=r*n.w+"px",i=r*n.h+"px";(this._target.style.width!==a||this._target.style.height!==i)&&(this._target.style.width=a,this._target.style.height=i)}},{key:"_setFillColor",value:function(r){var n="rgb("+r[2]+","+r[1]+","+r[0]+")";n!==this._prevDrawStyle&&(this._drawCtx.fillStyle=n,this._prevDrawStyle=n)}},{key:"_rgbImageData",value:function(r,n,a,i,h,f){for(var w=this._drawCtx.createImageData(a,i),m=w.data,T=0,C=f;T<a*i*4;T+=4,C+=3)m[T]=h[C],m[T+1]=h[C+1],m[T+2]=h[C+2],m[T+3]=255;this._drawCtx.putImageData(w,r,n),this._damage(r,n,w.width,w.height)}},{key:"_bgrxImageData",value:function(r,n,a,i,h,f){for(var w=this._drawCtx.createImageData(a,i),m=w.data,T=0,C=f;T<a*i*4;T+=4,C+=4)m[T]=h[C+2],m[T+1]=h[C+1],m[T+2]=h[C],m[T+3]=255;this._drawCtx.putImageData(w,r,n),this._damage(r,n,w.width,w.height)}},{key:"_rgbxImageData",value:function(r,n,a,i,h,f){var w;R.supportsImageMetadata?w=new ImageData(new Uint8ClampedArray(h.buffer,h.byteOffset,a*i*4),a,i):(w=this._drawCtx.createImageData(a,i),w.data.set(new Uint8ClampedArray(h.buffer,h.byteOffset,a*i*4))),this._drawCtx.putImageData(w,r,n),this._damage(r,n,w.width,w.height)}},{key:"_renderQPush",value:function(r){this._renderQ.push(r),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 r=!0;r&&this._renderQ.length>0;){var n=this._renderQ[0];switch(n.type){case"flip":this.flip(!0);break;case"copy":this.copyImage(n.oldX,n.oldY,n.x,n.y,n.width,n.height,!0);break;case"fill":this.fillRect(n.x,n.y,n.width,n.height,n.color,!0);break;case"blit":this.blitImage(n.x,n.y,n.width,n.height,n.data,0,!0);break;case"blitRgb":this.blitRgbImage(n.x,n.y,n.width,n.height,n.data,0,!0);break;case"blitRgbx":this.blitRgbxImage(n.x,n.y,n.width,n.height,n.data,0,!0);break;case"img":if(n.img.complete&&n.img.width!==0&&n.img.height!==0){if(n.img.width!==n.width||n.img.height!==n.height){k.Error("Decoded image has incorrect dimensions. Got "+n.img.width+"x"+n.img.height+". Expected "+n.width+"x"+n.height+".");return}this.drawImage(n.img,n.x,n.y)}else n.img._noVNCDisplay=this,n.img.addEventListener("load",this._resumeRenderQ),r=!1;break}r&&this._renderQ.shift()}this._renderQ.length===0&&this._flushing&&(this._flushing=!1,this.onflush())}},{key:"scale",get:function(){return this._scale},set:function(r){this._rescale(r)}},{key:"clipViewport",get:function(){return this._clipViewport},set:function(r){this._clipViewport=r;var n=this._viewportLoc;this.viewportChangeSize(n.w,n.h),this.viewportChangePos(0,0)}},{key:"width",get:function(){return this._fbWidth}},{key:"height",get:function(){return this._fbHeight}}]),s}();ce.default=d},Mmt2:function(Ze,ce,ie){"use strict";function j(o){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(s){return typeof s}:j=function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},j(o)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=R(ie("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var o=new WeakMap;return D=function(){return o},o}function R(o){if(o&&o.__esModule)return o;if(o===null||j(o)!=="object"&&typeof o!="function")return{default:o};var d=D();if(d&&d.has(o))return d.get(o);var s={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in o)if(Object.prototype.hasOwnProperty.call(o,r)){var n=l?Object.getOwnPropertyDescriptor(o,r):null;n&&(n.get||n.set)?Object.defineProperty(s,r,n):s[r]=o[r]}return s.default=o,d&&d.set(o,s),s}function O(o,d){if(!(o instanceof d))throw new TypeError("Cannot call a class as a function")}function c(o,d){for(var s=0;s<d.length;s++){var l=d[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(o,l.key,l)}}function S(o,d,s){return d&&c(o.prototype,d),s&&c(o,s),o}var y=!1,p=40*1024*1024,u=function(){function o(){O(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,r=s-1;r>=0;r--)l+=this._rQ[this._rQi++]<<r*8;return l}},{key:"rQshiftStr",value:function(s){typeof s=="undefined"&&(s=this.rQlen);for(var l="",r=0;r<s;r+=4096){var n=this.rQshiftBytes(Math.min(4096,s-r));l+=String.fromCharCode.apply(null,n)}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,r){if(this.rQlen<l){if(r){if(this._rQi<r)throw new Error("rQwait cannot backup "+r+" bytes");this._rQi-=r}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 r=this;this.init(),this._websocket=new WebSocket(s,l),this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=function(){k.Debug(">> WebSock.onopen"),r._websocket.protocol&&k.Info("Server choose sub-protocol: "+r._websocket.protocol),r._eventHandlers.open(),k.Debug("<< WebSock.onopen")},this._websocket.onclose=function(n){k.Debug(">> WebSock.onclose"),r._eventHandlers.close(n),k.Debug("<< WebSock.onclose")},this._websocket.onerror=function(n){k.Debug(">> WebSock.onerror: "+n),r._eventHandlers.error(n),k.Debug("<< WebSock.onerror: "+n)}}},{key:"close",value:function(){this._websocket&&((this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(k.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,r=this._rQbufferSize<l;if(r&&(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(r){var n=this._rQ.buffer;this._rQ=new Uint8Array(this._rQbufferSize),this._rQ.set(new Uint8Array(n,this._rQi,this._rQlen-this._rQi))}else y?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)):k.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}();ce.default=u},"N/zr":function(Ze,ce,ie){"use strict";function j(c){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(y){return typeof y}:j=function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},j(c)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var k=R(ie("Lo0S"));function D(){if(typeof WeakMap!="function")return null;var c=new WeakMap;return D=function(){return c},c}function R(c){if(c&&c.__esModule)return c;if(c===null||j(c)!=="object"&&typeof c!="function")return{default:c};var S=D();if(S&&S.has(c))return S.get(c);var y={},p=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in c)if(Object.prototype.hasOwnProperty.call(c,u)){var o=p?Object.getOwnPropertyDescriptor(c,u):null;o&&(o.get||o.set)?Object.defineProperty(y,u,o):y[u]=c[u]}return y.default=c,S&&S.set(c,y),y}var O={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode:function(S){"use strict";for(var y="",p=S.length,u=p%3,o=0;o<p-2;o+=3)y+=this.toBase64Table[S[o]>>2],y+=this.toBase64Table[((S[o]&3)<<4)+(S[o+1]>>4)],y+=this.toBase64Table[((S[o+1]&15)<<2)+(S[o+2]>>6)],y+=this.toBase64Table[S[o+2]&63];var d=p-u;return u===2?(y+=this.toBase64Table[S[d]>>2],y+=this.toBase64Table[((S[d]&3)<<4)+(S[d+1]>>4)],y+=this.toBase64Table[(S[d+1]&15)<<2],y+=this.toBase64Table[64]):u===1&&(y+=this.toBase64Table[S[d]>>2],y+=this.toBase64Table[(S[d]&3)<<4],y+=this.toBase64Table[64],y+=this.toBase64Table[64]),y},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 y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=S.indexOf("=")-y;p<0&&(p=S.length-y);for(var u=(p>>2)*3+Math.floor(p%4/1.5),o=new Array(u),d=0,s=0,l=0,r=y;r<S.length;r++){var n=this.toBinaryTable[S.charCodeAt(r)&127],a=S.charAt(r)===this.base64Pad;if(n===-1){k.Error("Illegal character code "+S.charCodeAt(r)+" at position "+r);continue}s=s<<6|n,d+=6,d>=8&&(d-=8,a||(o[l++]=s>>d&255),s&=(1<<d)-1)}if(d){var i=new Error("Corrupted base64 string");throw i.name="Base64-Error",i}return o}};ce.default=O},NBmB:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.encodingName=k,ce.encodings=void 0;var j={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};ce.encodings=j;function k(D){switch(D){case j.encodingRaw:return"Raw";case j.encodingCopyRect:return"CopyRect";case j.encodingRRE:return"RRE";case j.encodingHextile:return"Hextile";case j.encodingTight:return"Tight";case j.encodingTightPNG:return"TightPNG";default:return"[unknown encoding "+D+"]"}}},OLES:function(Ze,ce,ie){"use strict";var j=ie("U8pU"),k=ie("VTBJ"),D=ie("Ff2n"),R=ie("q1tI"),O=ie("uciX"),c=ie("7ixt"),S=function(s){var l=s.overlay,r=s.prefixCls,n=s.id,a=s.overlayInnerStyle;return R.createElement("div",{className:"".concat(r,"-inner"),id:n,role:"tooltip",style:a},typeof l=="function"?l():l)},y=S,p=function(s,l){var r=s.overlayClassName,n=s.trigger,a=n===void 0?["hover"]:n,i=s.mouseEnterDelay,h=i===void 0?0:i,f=s.mouseLeaveDelay,w=f===void 0?.1:f,m=s.overlayStyle,T=s.prefixCls,C=T===void 0?"rc-tooltip":T,x=s.children,b=s.onVisibleChange,E=s.afterVisibleChange,A=s.transitionName,v=s.animation,M=s.placement,I=M===void 0?"right":M,P=s.align,B=P===void 0?{}:P,H=s.destroyTooltipOnHide,F=H===void 0?!1:H,W=s.defaultVisible,U=s.getTooltipContainer,K=s.overlayInnerStyle,z=Object(D.a)(s,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),te=Object(R.useRef)(null);Object(R.useImperativeHandle)(l,function(){return te.current});var de=Object(k.a)({},z);"visible"in s&&(de.popupVisible=s.visible);var ge=function(){var Fe=s.arrowContent,ye=Fe===void 0?null:Fe,Ae=s.overlay,re=s.id;return[R.createElement("div",{className:"".concat(C,"-arrow"),key:"arrow"},ye),R.createElement(y,{key:"content",prefixCls:C,id:re,overlay:Ae,overlayInnerStyle:K})]},Ue=!1,Me=!1;if(typeof F=="boolean")Ue=F;else if(F&&Object(j.a)(F)==="object"){var Le=F.keepParent;Ue=Le===!0,Me=Le===!1}return R.createElement(O.a,Object.assign({popupClassName:r,prefixCls:C,popup:ge,action:a,builtinPlacements:c.a,popupPlacement:I,ref:te,popupAlign:B,getPopupContainer:U,onPopupVisibleChange:b,afterPopupVisibleChange:E,popupTransitionName:A,popupAnimation:v,defaultPopupVisible:W,destroyPopupOnHide:Ue,autoDestroy:Me,mouseLeaveDelay:w,popupStyle:m,mouseEnterDelay:h},de),x)},u=Object(R.forwardRef)(p),o=ce.a=u},Ot1p:function(Ze,ce,ie){"use strict";var j=ie("2qtc"),k=ie("kLXV"),D=ie("rAM+"),R=ie("miYZ"),O=ie("tsqr"),c=ie("tJVT"),S=ie("jrin"),y=ie("q1tI"),p=ie.n(y),u=ie("VrN/"),o=ie.n(u),d=ie("bdgK"),s=ie("p77/"),l=ie("Bd2K"),r=ie("ELLl"),n=ie("19Vz"),a=ie("lZu9"),i=ie("+NIl"),h=ie("kSUc"),f=ie("9Bee"),w=function(le){var se=le.value,he=se===void 0?"":se,Y=le.className,Z=le.showTextOnly,G=le.showLines,ae=le.style,Te=ae===void 0?{}:ae,X=Object(y.useMemo)(function(){return""},[he]);return p.a.createElement(p.a.Fragment,null,p.a.createElement("div",{dangerouslySetInnerHTML:{__html:X}}))},m=ie("0Owb"),T=ie("dejd"),C=ie("C+DQ"),x=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function b(le){var se=le.onActionCallback,he=le.title,Y=le.icon,Z=le.actionName,G=le.className,ae=G===void 0?"":G,Te=le.children;function X(){se(Z)}return p.a.createElement("a",{title:he,className:ae,onClick:X},p.a.createElement("i",{className:"md-iconfont ".concat(Y)}),Te)}var E=function(le){var se=le.watch,he=le.showNullButton,Y=le.onActionCallback,Z=le.fullScreen,G=le.insertTemp,ae=le.hidetoolBar,Te=[].concat(x,[{title:"".concat(se?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(se?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return p.a.createElement("ul",{className:"markdown-toolbar-container"},!ae&&Te.map(function(X,me){return p.a.createElement("li",{key:me},X.actionName?p.a.createElement(b,Object(m.a)({},X,{onActionCallback:Y})):p.a.createElement("span",{className:"v-line"}))}),he?p.a.createElement("li",null,p.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Y},p.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,G&&p.a.createElement("li",null,p.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(G),onActionCallback:Y},p.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),p.a.createElement("li",{className:"btn-full-screen"},p.a.createElement(b,{icon:"".concat(Z?"icon-shrink":"icon-enlarge"),title:Z?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Y})))},A=ie("M8RZ"),v=ie("+L6B"),M=ie("2/Rp"),I=ie("y8nQ"),P=ie("Vl3Y"),B=ie("5NDa"),H=ie("5rEg"),F={labelCol:{span:4},wrapperCol:{span:20}},W=function(le){var se=le.callback,he=le.onCancel;function Y(Z){se(Z)}return p.a.createElement(P.a,Object(m.a)({},F,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Y}),p.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},p.a.createElement(H.a,null)),p.a.createElement(P.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},p.a.createElement(H.a,null)),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(M.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(M.a,{type:"ghost",onClick:he},"\u53D6\u6D88")))},U=ie("7ahc"),K=ie("HmJG"),z=ie("BjJ7"),te=P.a.useForm,de={width:280,marginRight:10},ge={labelCol:{span:5},wrapperCol:{span:19}},Ue=function(le){var se=le.callback,he=le.onCancel,Y=te(),Z=Object(c.a)(Y,1),G=Z[0];function ae(me){se(me)}function Te(me,De){G.setFieldsValue({src:"/api/attachments/".concat(me.id),type:De.type})}function X(me){var De=me.target.files[0];Le(De,Te)}return p.a.createElement(P.a,Object(m.a)({form:G},ge,{className:"upload-image-panel",onFinish:ae}),p.a.createElement(P.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},p.a.createElement("div",{className:"flex-container"},p.a.createElement(P.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},p.a.createElement(H.a,{style:de})),p.a.createElement(Me,{onFileChange:X}))),p.a.createElement(P.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},p.a.createElement(H.a,{style:{width:264}})),p.a.createElement(P.a.Item,{style:{textAlign:"right"}},p.a.createElement(M.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(M.a,{type:"ghost",onClick:he},"\u53D6\u6D88")))};function Me(le){var se=le.onFileChange;return p.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",p.a.createElement("input",{type:"file",onChange:se}))}function Le(le,se){if(!le)throw new String("\u6CA1\u6709\u6587\u4EF6");var he=new FormData;he.append("editormd-image-file",le),he.append("file_param_name","editormd-image-file"),he.append("byxhr","true");var Y=new window.XMLHttpRequest;Y.withCredentials=!0,Y.addEventListener("load",function(Z){se(JSON.parse(Z.target.responseText),le)},!1),Y.addEventListener("error",function(Z){console.error(Z)},!1),Y.open("POST","".concat(z.a,"/api/attachments.json")),Y.send(he)}var Oe=ie("giR+"),Fe=ie("fyUT"),ye=ie("7Kak"),Ae=ie("9yH6"),re=Ae.a.Group,pe={margin:"0 8px"},ue=function(le){var se=le.callback,he=le.onCancel;function Y(Z){se(Z)}return p.a.createElement(P.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Y},p.a.createElement("div",{className:"flex-container"},p.a.createElement("span",{style:pe},"\u5355\u5143\u683C\u6570\uFF1A"),p.a.createElement("span",{style:pe},"\u884C\u6570"),p.a.createElement(P.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},p.a.createElement(Fe.a,null)),p.a.createElement("span",{style:pe},"\u5217\u6570"),p.a.createElement(P.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},p.a.createElement(Fe.a,null))),p.a.createElement("div",{className:"flex-container",style:{marginTop:12}},p.a.createElement("span",{style:pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),p.a.createElement(P.a.Item,{name:"align"},p.a.createElement(re,null,p.a.createElement(Ae.a,{value:"default"},p.a.createElement("i",{className:"fa fa-align-justify"})),p.a.createElement(Ae.a,{value:"left"},p.a.createElement("i",{className:"fa fa-align-left"})),p.a.createElement(Ae.a,{value:"center"},p.a.createElement("i",{className:"fa fa-align-center"})),p.a.createElement(Ae.a,{value:"right"},p.a.createElement("i",{className:"fa fa-align-right"}))))),p.a.createElement("div",{className:"flex-container flex-end"},p.a.createElement(M.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),p.a.createElement(M.a,{type:"ghost",onClick:he},"\u53D6\u6D88")))},Ie=ie("m3rI"),Ke="link",Ne="upload-image",je="code-block",Ge="add-table",ze="------------",ke={default:ze,left:":".concat(ze),center:":".concat(ze,":"),right:"".concat(ze,":")},xe=ie("9VGf"),Ee,Se;function $(){}var fe=0,J=1e4,Ce="\u2581",We=`
|
|
|
**\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(le){return/^\d+$/.test(le)?"".concat(le,"px"):le}var Pe=navigator.platform.toUpperCase().indexOf("MAC")>=0,Je=Pe?"Cmd":"Ctrl",ne=(Ee={},Object(S.a)(Ee,Je+"-B","bold"),Object(S.a)(Ee,Je+"-I","italic"),Ee),be=(Se={},Object(S.a)(Se,Ke,"\u6DFB\u52A0\u94FE\u63A5"),Object(S.a)(Se,je,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(S.a)(Se,Ne,"\u6DFB\u52A0\u56FE\u7247"),Object(S.a)(Se,Ge,"\u6DFB\u52A0\u8868\u683C"),Se),Re=ce.a=function(le){var se=le.defaultValue,he=se===void 0?"":se,Y=le.onChange,Z=le.width,G=Z===void 0?"100%":Z,ae=le.height,Te=ae===void 0?400:ae,X=le.miniToolbar,me=X===void 0?!1:X,De=le.isFocus,oe=De===void 0?!1:De,ve=le.watch,Be=le.insertTemp,tt=le.mode,Qe=tt===void 0?"markdown":tt,$e=le.id,st=$e===void 0?"markdown-editor-id":$e,mt=le.showResizeBar,ct=mt===void 0?!1:mt,nt=le.noStorage,_t=nt===void 0?!1:nt,St=le.showNullButton,Et=St===void 0?!1:St,Xt=le.hidetoolBar,Kt=Xt===void 0?!1:Xt,Rt=le.fullScreen,Ct=Rt===void 0?!1:Rt,Lt=le.onBlur,nr=le.onCMBeforeChange,wt=le.onFullScreen,dt=le.className,Lr=dt===void 0?"":dt,fn=le.disablePaste,vr=fn===void 0?!1:fn,Tt=le.placeholder,kr=Tt===void 0?"":Tt,Pr=le.values,Qr=Pr===void 0?"":Pr,et=Object(y.useState)(null),vt=Object(c.a)(et,2),it=vt[0],Un=vt[1],pn=Object(y.useState)(he),qr=Object(c.a)(pn,2),Zr=qr[0],gt=qr[1],Zi=Object(y.useState)(ve),Kn=Object(c.a)(Zi,2),_r=Kn[0],pr=Kn[1],yi=Object(y.useState)(Ct),Bn=Object(c.a)(yi,2),dr=Bn[0],mn=Bn[1],bi=Object(y.useState)(""),gn=Object(c.a)(bi,2),Rr=gn[0],Dr=gn[1],xi=Object(y.useState)(0),Xn=Object(c.a)(xi,2),$r=Xn[0],Hn=Xn[1],Ei=Object(y.useState)(Te),yr=Object(c.a)(Ei,2),Si=yr[0],wi=yr[1],vn=Object(y.useState)(!1),Fr=Object(c.a)(vn,2),Na=Fr[0],jn=Fr[1],Jr=Object(y.useRef)(),Wn=Object(y.useRef)(),Nr=Object(y.useRef)(),en=Object(y.useRef)();Object(y.useEffect)(function(){gt(Qr),it==null||it.setValue(Qr)},[Qr]),Object(y.useEffect)(function(){wt==null||wt(dr)},[dr]),Object(y.useEffect)(function(){if(Jr.current){var ht=o.a.fromTextArea(Jr.current,{mode:Qe,lineNumbers:!me,lineWrapping:!0,value:he,autoCloseTags:!0,autoCloseBrackets:!0});oe&&ht.focus();function yt(bt,Dt){if(vr){Dt.preventDefault();return}var Ot=Dt.clipboardData;if(Ot){var It=Ot.types.toString(),Ht=Ot.items,Ft=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(It==="Files"||Ot.types.indexOf("Files")>-1){if(Dt.preventDefault(),Qe=="stex")return;try{var Jt,br=Ht[1];((Jt=Ht[0])===null||Jt===void 0?void 0:Jt.kind)==="file"&&(br=Ht[0]);var Pt=br.getAsFile(),Ur=Pt.name.split(".").pop();Le(Pt,function(er){if(er.id){var Kr,Br,yn;(Pt==null||((Kr=Pt.type)===null||Kr===void 0)?void 0:Kr.indexOf("image"))>-1?ht.replaceSelection(".concat(er.content_type,")")):(Pt==null||((Br=Pt.type)===null||Br===void 0)?void 0:Br.indexOf("video"))>-1?ht.replaceSelection('<video width="100%" controls src="'.concat(Ie.a.API_SERVER,"/api/attachments/").concat(er.id,'"></video>')):(Pt==null||((yn=Pt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?ht.replaceSelection('<a href="'.concat(Ie.a.API_SERVER,"/api/attachments/").concat(er.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):Ft.includes(Ur)?ht.replaceSelection('<a href="'.concat(Ie.a.API_SERVER,"/api/attachments/").concat(er.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):ht.replaceSelection("[".concat(Pt.name,"](").concat(Ie.a.API_SERVER,"/api/attachments/").concat(er.id,"?type=").concat(er.content_type,")"))}else(er==null?void 0:er.status)===401&&(document.location.href="/user/login")})}catch(er){O.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ht.on("paste",yt),Un(ht),function(){ht.off("paste",yt)}}},[]);var Ti=Object(y.useCallback)(function(){if(Wn.current)try{}catch(ht){console.log(ht,"---- to set md editor body height")}},[Si,Wn,dr]);Object(y.useEffect)(function(){function ht(){var bt=new d.default(function(Dt){var Ot=Object(D.a)(Dt),It;try{for(Ot.s();!(It=Ot.n()).done;){var Ht=It.value;(Ht.target.offsetHeight>0||Ht.target.offsetWidth>0)&&(Ti(),it.setSize("100%","100%"),it.refresh())}}catch(Ft){Ot.e(Ft)}finally{Ot.f()}});return bt.observe(Jr.current.parentElement),bt}if(it){var yt=ht();return function(){yt.unobserve(Jr.current.parentElement)}}},[it,Ti]),Object(y.useEffect)(function(){if(it){for(var ht=[],yt=function(){var Ht=Dt[bt];Ot=Object(c.a)(Ht,2);var Ft=Ot[0],Jt=Ot[1],br=Object(S.a)({},Ft,function(){zn(Jt)});ht.push(br),it.addKeyMap(br)},bt=0,Dt=Object.entries(ne);bt<Dt.length;bt++){var Ot;yt()}return function(){var It=Object(D.a)(ht),Ht;try{for(It.s();!(Ht=It.n()).done;){var Ft=Ht.value;it.removeKeyMap(Ft)}}catch(Jt){It.e(Jt)}finally{It.f()}}}},[it]),Object(y.useEffect)(function(){Ct!==dr&&mn(Ct)},[Ct]),Object(xe.a)(function(){if(!_t&&$r>0){var ht=new Date().getTime(),yt=window.sessionStorage.getItem(st);ht>=$r+J&&(!yt||yt!==Zr)&&(window.sessionStorage.setItem(st,Zr),jn(!0))}},J),Object(y.useEffect)(function(){pr(ve)},[it,ve]),Object(y.useEffect)(function(){it&&(oe&&it.focus())},[it,oe]),Object(y.useEffect)(function(){if(_r&&it){var ht=it.getScrollerElement();function yt(bt){var Dt=bt.target;if(en.current){var Ot=Dt.scrollTop/Dt.scrollHeight;en.current.scrollTop=en.current.scrollHeight*Ot}}return ht.addEventListener("scroll",yt),function(){ht.removeEventListener("scroll",yt)}}},[it,_r]),Object(y.useEffect)(function(){if(it&&nr){function ht(yt,bt){nr(yt,bt)}return it.on("beforeChange",ht),function(){it.off("beforeChange",ht)}}},[it,nr]),Object(y.useEffect)(function(){if(it&&Lt){function ht(){Lt(it.getValue())}return it.on("blur",ht),function(){it.off("blur",ht)}}},[it,Lt]),Object(y.useEffect)(function(){if(it){function ht(yt){var bt=yt.getValue();gt(bt),Hn(new Date().getTime()),yt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Y&&Y(bt)}return it.on("change",ht),function(){it.off("change",ht)}}},[it,Y]),Object(y.useEffect)(function(){it&&(he==null?(it.setValue(""),gt("")):he!==it.getValue()&&(it.setValue(he),gt(he),it.setCursor(it.lineCount(),0)))},[it,he]);var zn=Object(y.useCallback)(function(ht){var yt=it.getCursor(),bt=it.getSelection(),Dt=bt.split(`
|
|
|
`);switch(ht){case"bold":return it.replaceSelection("**"+bt+"**"),bt===""&&it.setCursor(yt.line,yt.ch+2),it.focus();case"italic":return it.replaceSelection("*"+bt+"*"),bt===""&&it.setCursor(yt.line,yt.ch+1),it.focus();case"code":return it.replaceSelection("`"+bt+"`"),bt===""&&it.setCursor(yt.line,yt.ch+1),it.focus();case"inline-latex":return it.replaceSelection("`$$"+bt+"$$`"),bt===""&&it.setCursor(yt.line,yt.ch+3),it.focus();case"latex":return it.replaceSelection("```latex\n"+bt+"\n```"),it.setCursor(yt.line+1,bt.length+1),it.focus();case"line-break":return it.replaceSelection(`<br/>
|
|
|
`),it.focus();case"list-ul":return bt===""?it.replaceSelection("- "+bt):it.replaceSelection(Dt.map(function(Ot){return Ot===""?"":"- ".concat(Ot)}).join(`
|
|
|
`)),it.focus();case"list-ol":return bt===""?it.replaceSelection("1. "+bt):it.replaceSelection(Dt.map(function(Ot,It){return Ot===""?"":"".concat(It+1,". ").concat(Ot)}).join(`
|
|
|
`)),it.focus();case"add-null-ch":return bt===""&&it.setCursor(yt.line,yt.ch+1),it.replaceSelection(Ce),it.focus();case"inster-template-1":return bt===""&&it.setCursor(yt.line,yt.ch),it.replaceSelection(We),it.focus();case"eraser":return it.setValue(""),it.focus();case"trigger-watch":return pr(!_r),it.focus();case"trigger-full-screen":return mn(!dr),it.focus();case Ke:Dr(Ke);return;case je:Dr(je);return;case Ne:Dr(Ne);return;case Ge:Dr(Ge);return;default:throw new Error}},[it,_r,dr]),tn=Object(y.useCallback)(function(ht){Dr("");switch(Rr){case Ke:var yt=ht.title,bt=ht.link;return it.replaceSelection("[".concat(yt,"](").concat(bt,")")),it.focus();case je:var Dt=ht.language,Ot=ht.content;return it.replaceSelection(["```"+Dt,Ot,"```"].join(`
|
|
|
`)),it.focus();case Ne:var It=ht.src,Ht=ht.alt;return it.replaceSelection(".concat(It,' "').concat(Ht,'" )')),it.focus();case Ge:for(var Ft=ht.row,Jt=ht.col,br=ht.align,Pt=`
|
|
|
`,Ur=0;Ur<Ft;Ur++){for(var er=[],Kr=[],Br=0;Br<Jt;Br++)Ur===1&&Kr.push(ke[br]),er.push(" ");Ur===1&&(Pt+="| ".concat(Kr.join(" | "),` |
|
|
|
`)),Pt+="| ".concat(er.join(Jt===1?"":" | "),` |
|
|
|
`)}return it.replaceSelection(Pt+`
|
|
|
`),it.focus();default:throw new Error}},[it,Rr]),_n=Object(y.useMemo)(function(){switch(Rr){case Ke:return p.a.createElement(W,{callback:tn,onCancel:wr});case je:return p.a.createElement(U.b,{callback:tn,onCancel:wr});case Ne:return p.a.createElement(Ue,{callback:tn,onCancel:wr});case Ge:return p.a.createElement(ue,{callback:tn,onCancel:wr});default:return null}},[Rr]);function wr(){Dr("")}Object(y.useEffect)(function(){if(Nr.current){var ht=Nr.current,yt=!1,bt=0;function Dt(Ht){yt=!0,bt=Ht.pageY}function Ot(){yt=!1}function It(Ht){if(yt){var Ft=Ht.pageY-bt;Ft<0&&(Ft=0),Ft>300&&(Ft=300);var Jt=Te+Ft+"px";wi(Jt)}}return ht.addEventListener("mousedown",Dt),document.addEventListener("mousemove",It),document.addEventListener("mouseup",Ot),function(){ht.removeEventListener("mousedown",Dt),document.removeEventListener("mousemove",It),document.removeEventListener("mouseup",Ot)}}},[it,Nr]),Object(y.useEffect)(function(){wi(Te)},[Te]);var Gn=Ve(G),Ci=Ve(Si),Ai={width:Gn,height:Ci},Vn=Object(y.useMemo)(function(){if($r){var ht=new Date($r),yt=ht.getHours(),bt=ht.getMinutes(),Dt=ht.getSeconds();return yt=yt<10?"0"+yt:yt,bt=bt<10?"0"+bt:bt,Dt=Dt<10?"0"+Dt:Dt,"".concat(yt,":").concat(bt,":").concat(Dt)}return 0},[$r]);function Ua(){window.sessionStorage.removeItem(st),jn(!1),Hn(0)}function $i(){jn(!1),Hn(0),it.setValue(window.sessionStorage.getItem(st))}return p.a.createElement(y.Fragment,null,p.a.createElement("div",{className:"markdown-editor-wrapper",ref:Wn},p.a.createElement("div",{className:"markdown-editor-container ".concat(Lr," ").concat(_r?"on-preview":""," ").concat(me?"mini":""," ").concat(dr?"full-screen":""),style:Ai},p.a.createElement(E,{insertTemp:Be,watch:_r,fullScreen:dr,showNullButton:Et,onActionCallback:zn,hidetoolBar:Kt}),p.a.createElement("div",{className:"markdown-editor-body"},p.a.createElement("div",{className:"codemirror-container"},p.a.createElement("textarea",{ref:Jr,placeholder:kr})),_r?p.a.createElement("div",{ref:en,className:"preview-container"},Qe==="stex"&&p.a.createElement(w,{value:Zr}),Qe!=="stex"&&p.a.createElement(f.a,{value:Zr})):null))),ct?p.a.createElement("a",{ref:Nr,className:"editor-resize"}):null,p.a.createElement(A.a,null,be[Rr]?p.a.createElement(k.a,{centered:!0,title:be[Rr],visible:!0,onCancel:wr,footer:null},_n):null))}},P2ho:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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};ce.default=j},QV2g:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=j;function j(){for(var R,O=[],c=0;c<256;c++){R=c;for(var S=0;S<8;S++)R=R&1?3988292384^R>>>1:R>>>1;O[c]=R}return O}var k=j();function D(R,O,c,S){var y=k,p=S+c;R^=-1;for(var u=S;u<p;u++)R=R>>>8^y[(R^O[u])&255];return R^-1}},SJMd:function(Ze,ce){/**
|
|
|
* @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 ie,j,k,D=!1,R,O;window.PR_SHOULD_USE_CONTINUATION=!0;var c,S;(function(){var y=window,p=["break,continue,do,else,for,if,return,while"],u=[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=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],d=[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"],r="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",n=[o,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],a="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",i=[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"],f=[p,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[d,l,s,n,a,i,h,f],m=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",C="kwd",x="com",b="typ",E="lit",A="pun",v="pln",M="tag",I="dec",P="src",B="atn",H="atv",F="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function U(Ne){for(var je=0,Ge=!1,ze=!1,ke=0,xe=Ne.length;ke<xe;++ke){var Ee=Ne[ke];if(Ee.ignoreCase)ze=!0;else if(/[a-z]/i.test(Ee.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ge=!0,ze=!1;break}}var Se={b:8,t:9,n:10,v:11,f:12,r:13};function $(Ve){var Pe=Ve.charCodeAt(0);if(Pe!==92)return Pe;var Je=Ve.charAt(1);return Pe=Se[Je],Pe||("0"<=Je&&Je<="7"?parseInt(Ve.substring(1),8):Je==="u"||Je==="x"?parseInt(Ve.substring(2),16):Ve.charCodeAt(1))}function fe(Ve){if(Ve<32)return(Ve<16?"\\x0":"\\x")+Ve.toString(16);var Pe=String.fromCharCode(Ve);return Pe==="\\"||Pe==="-"||Pe==="]"||Pe==="^"?"\\"+Pe:Pe}function J(Ve){var Pe=Ve.substring(1,Ve.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")),Je=[],ne=Pe[0]==="^",be=["["];ne&&be.push("^");for(var Re=ne?1:0,le=Pe.length;Re<le;++Re){var se=Pe[Re];if(/\\[bdsw]/i.test(se))be.push(se);else{var he=$(se),Y;Re+2<le&&Pe[Re+1]==="-"?(Y=$(Pe[Re+2]),Re+=2):Y=he,Je.push([he,Y]),Y<65||he>122||(Y<65||he>90||Je.push([Math.max(65,he)|32,Math.min(Y,90)|32]),Y<97||he>122||Je.push([Math.max(97,he)&~32,Math.min(Y,122)&~32]))}}Je.sort(function(Te,X){return Te[0]-X[0]||X[1]-Te[1]});for(var Z=[],G=[],Re=0;Re<Je.length;++Re){var ae=Je[Re];ae[0]<=G[1]+1?G[1]=Math.max(G[1],ae[1]):Z.push(G=ae)}for(var Re=0;Re<Z.length;++Re){var ae=Z[Re];be.push(fe(ae[0])),ae[1]>ae[0]&&(ae[1]+1>ae[0]&&be.push("-"),be.push(fe(ae[1])))}return be.push("]"),be.join("")}function Ce(Ve){for(var Pe=Ve.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")),Je=Pe.length,ne=[],be=0,Re=0;be<Je;++be){var le=Pe[be];if(le==="(")++Re;else if(le.charAt(0)==="\\"){var se=+le.substring(1);se&&(se<=Re?ne[se]=-1:Pe[be]=fe(se))}}for(var be=1;be<ne.length;++be)ne[be]===-1&&(ne[be]=++je);for(var be=0,Re=0;be<Je;++be){var le=Pe[be];if(le==="(")++Re,ne[Re]||(Pe[be]="(?:");else if(le.charAt(0)==="\\"){var se=+le.substring(1);se&&se<=Re&&(Pe[be]="\\"+ne[se])}}for(var be=0;be<Je;++be)Pe[be]==="^"&&Pe[be+1]!=="^"&&(Pe[be]="");if(Ve.ignoreCase&&Ge)for(var be=0;be<Je;++be){var le=Pe[be],he=le.charAt(0);le.length>=2&&he==="["?Pe[be]=J(le):he!=="\\"&&(Pe[be]=le.replace(/[a-zA-Z]/g,function(G){var ae=G.charCodeAt(0);return"["+String.fromCharCode(ae&~32,ae|32)+"]"}))}return Pe.join("")}for(var We=[],ke=0,xe=Ne.length;ke<xe;++ke){var Ee=Ne[ke];if(Ee.global||Ee.multiline)throw new Error(""+Ee);We.push("(?:"+Ce(Ee)+")")}return new RegExp(We.join("|"),ze?"gi":"g")}function K(Ne,je){var Ge=/(?:^|\s)nocode(?:\s|$)/,ze=[],ke=0,xe=[],Ee=0;function Se($){var fe=$.nodeType;if(fe==1){if(Ge.test($.className))return;for(var J=$.firstChild;J;J=J.nextSibling)Se(J);var Ce=$.nodeName.toLowerCase();(Ce==="br"||Ce==="li")&&(ze[Ee]=`
|
|
|
`,xe[Ee<<1]=ke++,xe[Ee++<<1|1]=$)}else if(fe==3||fe==4){var We=$.nodeValue;We.length&&(je?We=We.replace(/\r\n?/g,`
|
|
|
`):We=We.replace(/[ \t\r\n]+/g," "),ze[Ee]=We,xe[Ee<<1]=ke,ke+=We.length,xe[Ee++<<1|1]=$)}}return Se(Ne),{sourceCode:ze.join("").replace(/\n$/,""),spans:xe}}function z(Ne,je,Ge,ze,ke){if(!Ge)return;var xe={sourceNode:Ne,pre:1,langExtension:null,numberLines:null,sourceCode:Ge,spans:null,basePos:je,decorations:null};ze(xe),ke.push.apply(ke,xe.decorations)}var te=/\S/;function de(Ne){for(var je=void 0,Ge=Ne.firstChild;Ge;Ge=Ge.nextSibling){var ze=Ge.nodeType;je=ze===1?je?Ne:Ge:ze===3&&te.test(Ge.nodeValue)?Ne:je}return je===Ne?void 0:je}function ge(Ne,je){var Ge={},ze;(function(){for(var Ee=Ne.concat(je),Se=[],$={},fe=0,J=Ee.length;fe<J;++fe){var Ce=Ee[fe],We=Ce[3];if(We)for(var Ve=We.length;--Ve>=0;)Ge[We.charAt(Ve)]=Ce;var Pe=Ce[1],Je=""+Pe;$.hasOwnProperty(Je)||(Se.push(Pe),$[Je]=null)}Se.push(/[\0-\uffff]/),ze=U(Se)})();var ke=je.length,xe=function(Ee){for(var Se=Ee.sourceCode,$=Ee.basePos,fe=Ee.sourceNode,J=[$,v],Ce=0,We=Se.match(ze)||[],Ve={},Pe=0,Je=We.length;Pe<Je;++Pe){var ne=We[Pe],be=Ve[ne],Re=void 0,le;if(typeof be=="string")le=!1;else{var se=Ge[ne.charAt(0)];if(se)Re=ne.match(se[1]),be=se[0];else{for(var he=0;he<ke;++he)if(se=je[he],Re=ne.match(se[1]),Re){be=se[0];break}Re||(be=v)}le=be.length>=5&&be.substring(0,5)==="lang-",le&&!(Re&&typeof Re[1]=="string")&&(le=!1,be=P),le||(Ve[ne]=be)}var Y=Ce;if(Ce+=ne.length,!le)J.push($+Y,be);else{var Z=Re[1],G=ne.indexOf(Z),ae=G+Z.length;Re[2]&&(ae=ne.length-Re[2].length,G=ae-Z.length);var Te=be.substring(5);z(fe,$+Y,ne.substring(0,G),xe,J),z(fe,$+Y+G,Z,Ae(Te,Z),J),z(fe,$+Y+ae,ne.substring(ae),xe,J)}}Ee.decorations=J};return xe}function Ue(Ne){var je=[],Ge=[];Ne.tripleQuotedStrings?je.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ne.multiLineStrings?je.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):je.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ne.verbatimStrings&&Ge.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ze=Ne.hashComments;ze&&(Ne.cStyleComments?(ze>1?je.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):je.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ge.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):je.push([x,/^#[^\r\n]*/,null,"#"])),Ne.cStyleComments&&(Ge.push([x,/^\/\/[^\r\n]*/,null]),Ge.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=Ne.regexLiterals;if(ke){var xe=ke>1?"":`
|
|
|
\r`,Ee=xe?".":"[\\S\\s]",Se="/(?=[^/*"+xe+"])(?:[^/\\x5B\\x5C"+xe+"]|\\x5C"+Ee+"|\\x5B(?:[^\\x5C\\x5D"+xe+"]|\\x5C"+Ee+")*(?:\\x5D|$))+/";Ge.push(["lang-regex",RegExp("^"+W+"("+Se+")")])}var $=Ne.types;$&&Ge.push([b,$]);var fe=(""+Ne.keywords).replace(/^ | $/g,"");fe.length&&Ge.push([C,new RegExp("^(?:"+fe.replace(/[\s,]+/g,"|")+")\\b"),null]),je.push([v,/^\s+/,null,` \r
|
|
|
\xA0`]);var J="^.[^\\s\\w.$@'\"`/\\\\]*";return Ne.regexLiterals&&(J+="(?!s*/)"),Ge.push([E,/^@[a-z_$][a-z_$@0-9]*/i,null],[b,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[v,/^[a-z_$][a-z_$@0-9]*/i,null],[E,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[v,/^\\[\s\S]?/,null],[A,new RegExp(J),null]),ge(je,Ge)}var Me=Ue({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Le(Ne,je,Ge){for(var ze=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,xe=Ne.ownerDocument,Ee=xe.createElement("li");Ne.firstChild;)Ee.appendChild(Ne.firstChild);var Se=[Ee];function $(Pe){var Je=Pe.nodeType;if(Je==1&&!ze.test(Pe.className))if(Pe.nodeName==="br")fe(Pe),Pe.parentNode&&Pe.parentNode.removeChild(Pe);else for(var ne=Pe.firstChild;ne;ne=ne.nextSibling)$(ne);else if((Je==3||Je==4)&&Ge){var be=Pe.nodeValue,Re=be.match(ke);if(Re){var le=be.substring(0,Re.index);Pe.nodeValue=le;var se=be.substring(Re.index+Re[0].length);if(se){var he=Pe.parentNode;he.insertBefore(xe.createTextNode(se),Pe.nextSibling)}fe(Pe),le||Pe.parentNode.removeChild(Pe)}}}function fe(Pe){for(;!Pe.nextSibling;)if(Pe=Pe.parentNode,!Pe)return;function Je(Re,le){var se=le?Re.cloneNode(!1):Re,he=Re.parentNode;if(he){var Y=Je(he,1),Z=Re.nextSibling;Y.appendChild(se);for(var G=Z;G;G=Z)Z=G.nextSibling,Y.appendChild(G)}return se}for(var ne=Je(Pe.nextSibling,0),be;(be=ne.parentNode)&&be.nodeType===1;)ne=be;Se.push(ne)}for(var J=0;J<Se.length;++J)$(Se[J]);je===(je|0)&&Se[0].setAttribute("value",je);var Ce=xe.createElement("ol");Ce.className="linenums";for(var We=Math.max(0,je-1|0)||0,J=0,Ve=Se.length;J<Ve;++J)Ee=Se[J],Ee.className="L"+(J+We)%10,Ee.firstChild||Ee.appendChild(xe.createTextNode("\xA0")),Ce.appendChild(Ee);Ne.appendChild(Ce)}function Oe(Ne){var je=/\bMSIE\s(\d+)/.exec(navigator.userAgent);je=je&&+je[1]<=8;var Ge=/\n/g,ze=Ne.sourceCode,ke=ze.length,xe=0,Ee=Ne.spans,Se=Ee.length,$=0,fe=Ne.decorations,J=fe.length,Ce=0;fe[J]=ke;var We,Ve;for(Ve=We=0;Ve<J;)fe[Ve]!==fe[Ve+2]?(fe[We++]=fe[Ve++],fe[We++]=fe[Ve++]):Ve+=2;for(J=We,Ve=We=0;Ve<J;){for(var Pe=fe[Ve],Je=fe[Ve+1],ne=Ve+2;ne+2<=J&&fe[ne+1]===Je;)ne+=2;fe[We++]=Pe,fe[We++]=Je,Ve=ne}J=fe.length=We;var be=Ne.sourceNode,Re="";be&&(Re=be.style.display,be.style.display="none");try{for(var le=null;$<Se;){var se=Ee[$],he=Ee[$+2]||ke,Y=fe[Ce+2]||ke,ne=Math.min(he,Y),Z=Ee[$+1],G;if(Z.nodeType!==1&&(G=ze.substring(xe,ne))){je&&(G=G.replace(Ge,"\r")),Z.nodeValue=G;var ae=Z.ownerDocument,Te=ae.createElement("span");Te.className=fe[Ce+1];var X=Z.parentNode;X.replaceChild(Te,Z),Te.appendChild(Z),xe<he&&(Ee[$+1]=Z=ae.createTextNode(ze.substring(ne,he)),X.insertBefore(Z,Te.nextSibling))}xe=ne,xe>=he&&($+=2),xe>=Y&&(Ce+=2)}}finally{be&&(be.style.display=Re)}}var Fe={};function ye(Ne,je){for(var Ge=je.length;--Ge>=0;){var ze=je[Ge];Fe.hasOwnProperty(ze)?y.console&&console.warn("cannot override language handler %s",ze):Fe[ze]=Ne}}function Ae(Ne,je){return Ne&&Fe.hasOwnProperty(Ne)||(Ne=/^\s*</.test(je)?"default-markup":"default-code"),Fe[Ne]}ye(Me,["default-code"]),ye(ge([],[[v,/^[^<?]+/],[I,/^<!\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"]),ye(ge([[v,/^[\s]+/,null,` \r
|
|
|
`],[H,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[M,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[B,/^(?!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"]),ye(ge([],[[H,/^[\s\S]+/]]),["uq.val"]),ye(Ue({keywords:d,hashComments:!0,cStyleComments:!0,types:m}),["c","cc","cpp","cxx","cyc","m"]),ye(Ue({keywords:"null,true,false"}),["json"]),ye(Ue({keywords:l,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:m}),["cs"]),ye(Ue({keywords:s,cStyleComments:!0}),["java"]),ye(Ue({keywords:f,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ye(Ue({keywords:i,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ye(Ue({keywords:a,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ye(Ue({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ye(Ue({keywords:n,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ye(Ue({keywords:r,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ye(ge([],[[T,/^[\s\S]+/]]),["regex"]);function re(Ne){var je=Ne.langExtension;try{var Ge=K(Ne.sourceNode,Ne.pre),ze=Ge.sourceCode;Ne.sourceCode=ze,Ne.spans=Ge.spans,Ne.basePos=0,Ae(je,ze)(Ne),Oe(Ne)}catch(ke){y.console&&console.log(ke&&ke.stack||ke)}}function pe(Ne,je,Ge){var ze=Ge||!1,ke=je||null,xe=document.createElement("div");xe.innerHTML="<pre>"+Ne+"</pre>",xe=xe.firstChild,ze&&Le(xe,ze,!0);var Ee={langExtension:ke,numberLines:ze,sourceNode:xe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return re(Ee),xe.innerHTML}function ue(Ne,je){var Ge=je||document.body,ze=Ge.ownerDocument||document;function ke(se){return Ge.getElementsByTagName(se)}for(var xe=[ke("pre"),ke("code"),ke("xmp")],Ee=[],Se=0;Se<xe.length;++Se)for(var $=0,fe=xe[Se].length;$<fe;++$)Ee.push(xe[Se][$]);xe=null;var J=Date;J.now||(J={now:function(){return+new Date}});var Ce=0,We=/\blang(?:uage)?-([\w.]+)(?!\S)/,Ve=/\bprettyprint\b/,Pe=/\bprettyprinted\b/,Je=/pre|xmp/i,ne=/^code$/i,be=/^(?:pre|code|xmp)$/i,Re={};function le(){for(var se=y.PR_SHOULD_USE_CONTINUATION?J.now()+250:Infinity;Ce<Ee.length&&J.now()<se;Ce++){for(var he=Ee[Ce],Y=Re,Z=he;Z=Z.previousSibling;){var G=Z.nodeType,ae=(G===7||G===8)&&Z.nodeValue;if(ae?!/^\??prettify\b/.test(ae):G!==3||/\S/.test(Z.nodeValue))break;if(ae){Y={},ae.replace(/\b(\w+)=([\w:.%+-]+)/g,function(ct,nt,_t){Y[nt]=_t});break}}var Te=he.className;if((Y!==Re||Ve.test(Te))&&!Pe.test(Te)){for(var X=!1,me=he.parentNode;me;me=me.parentNode){var De=me.tagName;if(be.test(De)&&me.className&&Ve.test(me.className)){X=!0;break}}if(!X){he.className+=" prettyprinted";var oe=Y.lang;if(!oe){oe=Te.match(We);var ve;!oe&&(ve=de(he))&&ne.test(ve.tagName)&&(oe=ve.className.match(We)),oe&&(oe=oe[1])}var Be;if(Je.test(he.tagName))Be=1;else{var tt=he.currentStyle,Qe=ze.defaultView,$e=tt?tt.whiteSpace:Qe&&Qe.getComputedStyle?Qe.getComputedStyle(he,null).getPropertyValue("white-space"):0;Be=$e&&$e.substring(0,3)==="pre"}var st=Y.linenums;(st=st==="true"||+st)||(st=Te.match(/\blinenums\b(?::(\d+))?/),st=st?st[1]&&st[1].length?+st[1]:!0:!1),st&&Le(he,st,Be);var mt={langExtension:oe,sourceNode:he,numberLines:st,pre:Be,sourceCode:null,basePos:null,spans:null,decorations:null};re(mt)}}}Ce<Ee.length?y.setTimeout(le,250):typeof Ne=="function"&&Ne()}le()}var Ie=y.PR={createSimpleLexer:ge,registerLangHandler:ye,sourceDecorator:Ue,PR_ATTRIB_NAME:B,PR_ATTRIB_VALUE:H,PR_COMMENT:x,PR_DECLARATION:I,PR_KEYWORD:C,PR_LITERAL:E,PR_NOCODE:F,PR_PLAIN:v,PR_PUNCTUATION:A,PR_SOURCE:P,PR_STRING:T,PR_TAG:M,PR_TYPE:b,prettyPrintOne:D?y.prettyPrintOne=pe:c=pe,prettyPrint:S=D?y.prettyPrint=ue:S=ue},Ke=y.define;typeof Ke=="function"&&Ke.amd&&Ke("google-code-prettify",[],function(){return Ie})})()},SZEN:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.clientToElement=j;function j(k,D,R){var O=R.getBoundingClientRect(),c={x:0,y:0};return k<O.left?c.x=0:k>=O.right?c.x=O.width-1:c.x=k-O.left,D<O.top?c.y=0:D>=O.bottom?c.y=O.height-1:c.y=D-O.top,c}},SgaC:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(O,c){if(!(O instanceof c))throw new TypeError("Cannot call a class as a function")}function k(O,c){for(var S=0;S<c.length;S++){var y=c[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function D(O,c,S){return c&&k(O.prototype,c),S&&k(O,S),O}var R=function(){function O(){j(this,O),this._subrects=0}return D(O,[{key:"decodeRect",value:function(S,y,p,u,o,d,s){if(this._subrects===0){if(o.rQwait("RRE",4+4))return!1;this._subrects=o.rQshift32();var l=o.rQshiftBytes(4);d.fillRect(S,y,p,u,l)}for(;this._subrects>0;){if(o.rQwait("RRE",4+8))return!1;var r=o.rQshiftBytes(4),n=o.rQshift16(),a=o.rQshift16(),i=o.rQshift16(),h=o.rQshift16();d.fillRect(S+n,y+a,i,h,r),this._subrects--}return!0}}]),O}();ce.default=R},VSMT:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.decodeUTF8=j,ce.encodeUTF8=k;function j(D){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;try{return decodeURIComponent(escape(D))}catch(O){if(O instanceof URIError&&R)return D;throw O}}function k(D){return unescape(encodeURIComponent(D))}},"VaU+":function(Ze,ce,ie){Ze.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(Ze,ce,ie){(function(j,k){Ze.exports=k()})(this,function(){"use strict";var j=navigator.userAgent,k=navigator.platform,D=/gecko\/\d/i.test(j),R=/MSIE \d/.test(j),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(j),c=/Edge\/(\d+)/.exec(j),S=R||O||c,y=S&&(R?document.documentMode||6:+(c||O)[1]),p=!c&&/WebKit\//.test(j),u=p&&/Qt\/\d+\.\d+/.test(j),o=!c&&/Chrome\//.test(j),d=/Opera\//.test(j),s=/Apple Computer/.test(navigator.vendor),l=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(j),r=/PhantomJS/.test(j),n=!c&&/AppleWebKit/.test(j)&&/Mobile\/\w+/.test(j),a=/Android/.test(j),i=n||a||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(j),h=n||/Mac/.test(k),f=/\bCrOS\b/.test(j),w=/win/i.test(k),m=d&&j.match(/Version\/(\d*\.\d*)/);m&&(m=Number(m[1])),m&&m>=15&&(d=!1,p=!0);var T=h&&(u||d&&(m==null||m<12.11)),C=D||S&&y>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var b=function(e,t){var _=e.className,g=x(t).exec(_);if(g){var L=_.slice(g.index+g[0].length);e.className=_.slice(0,g.index)+(L?g[1]+L:"")}};function E(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return E(e).appendChild(t)}function v(e,t,_,g){var L=document.createElement(e);if(_&&(L.className=_),g&&(L.style.cssText=g),typeof t=="string")L.appendChild(document.createTextNode(t));else if(t)for(var N=0;N<t.length;++N)L.appendChild(t[N]);return L}function M(e,t,_,g){var L=v(e,t,_,g);return L.setAttribute("role","presentation"),L}var I;document.createRange?I=function(e,t,_,g){var L=document.createRange();return L.setEnd(g||e,_),L.setStart(e,t),L}:I=function(e,t,_){var g=document.body.createTextRange();try{g.moveToElementText(e.parentNode)}catch(L){return g}return g.collapse(!0),g.moveEnd("character",_),g.moveStart("character",t),g};function P(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function B(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var _=e.className;x(t).test(_)||(e.className+=(_?" ":"")+t)}function F(e,t){for(var _=e.split(" "),g=0;g<_.length;g++)_[g]&&!x(_[g]).test(t)&&(t+=" "+_[g]);return t}var W=function(e){e.select()};n?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:S&&(W=function(e){try{e.select()}catch(t){}});function U(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function K(e,t,_){t||(t={});for(var g in e)e.hasOwnProperty(g)&&(_!==!1||!t.hasOwnProperty(g))&&(t[g]=e[g]);return t}function z(e,t,_,g,L){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var N=g||0,V=L||0;;){var Q=e.indexOf(" ",N);if(Q<0||Q>=t)return V+(t-N);V+=Q-N,V+=_-V%_,N=Q+1}}var te=function(){this.id=null,this.f=null,this.time=0,this.handler=U(this.onTimeout,this)};te.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},te.prototype.set=function(e,t){this.f=t;var _=+new Date+e;(!this.id||_<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=_)};function de(e,t){for(var _=0;_<e.length;++_)if(e[_]==t)return _;return-1}var ge=50,Ue={toString:function(){return"CodeMirror.Pass"}},Me={scroll:!1},Le={origin:"*mouse"},Oe={origin:"+move"};function Fe(e,t,_){for(var g=0,L=0;;){var N=e.indexOf(" ",g);N==-1&&(N=e.length);var V=N-g;if(N==e.length||L+V>=t)return g+Math.min(V,t-L);if(L+=N-g,L+=_-L%_,g=N+1,L>=t)return g}}var ye=[""];function Ae(e){for(;ye.length<=e;)ye.push(re(ye)+" ");return ye[e]}function re(e){return e[e.length-1]}function pe(e,t){for(var _=[],g=0;g<e.length;g++)_[g]=t(e[g],g);return _}function ue(e,t,_){for(var g=0,L=_(t);g<e.length&&_(e[g])<=L;)g++;e.splice(g,0,t)}function Ie(){}function Ke(e,t){var _;return Object.create?_=Object.create(e):(Ie.prototype=e,_=new Ie),t&&K(t,_),_}var Ne=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function je(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ne.test(e))}function Ge(e,t){return t?t.source.indexOf("\\w")>-1&&je(e)?!0:t.test(e):je(e)}function ze(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])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 xe(e){return e.charCodeAt(0)>=768&&ke.test(e)}function Ee(e,t,_){for(;(_<0?t>0:t<e.length)&&xe(e.charAt(t));)t+=_;return t}function Se(e,t,_){for(var g=t>_?-1:1;;){if(t==_)return t;var L=(t+_)/2,N=g<0?Math.ceil(L):Math.floor(L);if(N==t)return e(N)?t:_;e(N)?_=N:t=N+g}}function $(e,t,_,g){if(!e)return g(t,_,"ltr",0);for(var L=!1,N=0;N<e.length;++N){var V=e[N];(V.from<_&&V.to>t||t==_&&V.to==t)&&(g(Math.max(V.from,t),Math.min(V.to,_),V.level==1?"rtl":"ltr",N),L=!0)}L||g(t,_,"ltr")}var fe=null;function J(e,t,_){var g;fe=null;for(var L=0;L<e.length;++L){var N=e[L];if(N.from<t&&N.to>t)return L;N.to==t&&(N.from!=N.to&&_=="before"?g=L:fe=L),N.from==t&&(N.from!=N.to&&_!="before"?g=L:fe=L)}return g!=null?g:fe}var Ce=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function _(ee){return ee<=247?e.charAt(ee):1424<=ee&&ee<=1524?"R":1536<=ee&&ee<=1785?t.charAt(ee-1536):1774<=ee&&ee<=2220?"r":8192<=ee&&ee<=8203?"w":ee==8204?"b":"L"}var g=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,L=/[stwN]/,N=/[LRr]/,V=/[Lb1n]/,Q=/[1n]/;function q(ee,_e,we){this.level=ee,this.from=_e,this.to=we}return function(ee,_e){var we=_e=="ltr"?"L":"R";if(ee.length==0||_e=="ltr"&&!g.test(ee))return!1;for(var He=ee.length,Xe=[],Ye=0;Ye<He;++Ye)Xe.push(_(ee.charCodeAt(Ye)));for(var qe=0,rt=we;qe<He;++qe){var at=Xe[qe];at=="m"?Xe[qe]=rt:rt=at}for(var lt=0,ot=we;lt<He;++lt){var ut=Xe[lt];ut=="1"&&ot=="r"?Xe[lt]="n":N.test(ut)&&(ot=ut,ut=="r"&&(Xe[lt]="R"))}for(var pt=1,ft=Xe[0];pt<He-1;++pt){var xt=Xe[pt];xt=="+"&&ft=="1"&&Xe[pt+1]=="1"?Xe[pt]="1":xt==","&&ft==Xe[pt+1]&&(ft=="1"||ft=="n")&&(Xe[pt]=ft),ft=xt}for(var Mt=0;Mt<He;++Mt){var Qt=Xe[Mt];if(Qt==",")Xe[Mt]="N";else if(Qt=="%"){var Ut=void 0;for(Ut=Mt+1;Ut<He&&Xe[Ut]=="%";++Ut);for(var fr=Mt&&Xe[Mt-1]=="!"||Ut<He&&Xe[Ut]=="1"?"1":"N",lr=Mt;lr<Ut;++lr)Xe[lr]=fr;Mt=Ut-1}}for(var Wt=0,ur=we;Wt<He;++Wt){var $t=Xe[Wt];ur=="L"&&$t=="1"?Xe[Wt]="L":N.test($t)&&(ur=$t)}for(var Gt=0;Gt<He;++Gt)if(L.test(Xe[Gt])){var zt=void 0;for(zt=Gt+1;zt<He&&L.test(Xe[zt]);++zt);for(var Bt=(Gt?Xe[Gt-1]:we)=="L",cr=(zt<He?Xe[zt]:we)=="L",Fn=Bt==cr?Bt?"L":"R":we,Yr=Gt;Yr<zt;++Yr)Xe[Yr]=Fn;Gt=zt-1}for(var rr=[],Ar,qt=0;qt<He;)if(V.test(Xe[qt])){var Pa=qt;for(++qt;qt<He&&V.test(Xe[qt]);++qt);rr.push(new q(0,Pa,qt))}else{var Ir=qt,dn=rr.length,hn=_e=="rtl"?1:0;for(++qt;qt<He&&Xe[qt]!="L";++qt);for(var ar=Ir;ar<qt;)if(Q.test(Xe[ar])){Ir<ar&&(rr.splice(dn,0,new q(1,Ir,ar)),dn+=hn);var Nn=ar;for(++ar;ar<qt&&Q.test(Xe[ar]);++ar);rr.splice(dn,0,new q(2,Nn,ar)),dn+=hn,Ir=ar}else++ar;Ir<qt&&rr.splice(dn,0,new q(1,Ir,qt))}return _e=="ltr"&&(rr[0].level==1&&(Ar=ee.match(/^\s+/))&&(rr[0].from=Ar[0].length,rr.unshift(new q(0,0,Ar[0].length))),re(rr).level==1&&(Ar=ee.match(/\s+$/))&&(re(rr).to-=Ar[0].length,rr.push(new q(0,He-Ar[0].length,He)))),_e=="rtl"?rr.reverse():rr}}();function We(e,t){var _=e.order;return _==null&&(_=e.order=Ce(e.text,t)),_}var Ve=[],Pe=function(e,t,_){if(e.addEventListener)e.addEventListener(t,_,!1);else if(e.attachEvent)e.attachEvent("on"+t,_);else{var g=e._handlers||(e._handlers={});g[t]=(g[t]||Ve).concat(_)}};function Je(e,t){return e._handlers&&e._handlers[t]||Ve}function ne(e,t,_){if(e.removeEventListener)e.removeEventListener(t,_,!1);else if(e.detachEvent)e.detachEvent("on"+t,_);else{var g=e._handlers,L=g&&g[t];if(L){var N=de(L,_);N>-1&&(g[t]=L.slice(0,N).concat(L.slice(N+1)))}}}function be(e,t){var _=Je(e,t);if(!_.length)return;for(var g=Array.prototype.slice.call(arguments,2),L=0;L<_.length;++L)_[L].apply(null,g)}function Re(e,t,_){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,_||t.type,e,t),G(t)||t.codemirrorIgnore}function le(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var _=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),g=0;g<t.length;++g)de(_,t[g])==-1&&_.push(t[g])}function se(e,t){return Je(e,t).length>0}function he(e){e.prototype.on=function(t,_){Pe(this,t,_)},e.prototype.off=function(t,_){ne(this,t,_)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function G(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ae(e){Y(e),Z(e)}function Te(e){return e.target||e.srcElement}function X(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),h&&e.ctrlKey&&t==1&&(t=3),t}var me=function(){if(S&&y<9)return!1;var e=v("div");return"draggable"in e||"dragDrop"in e}(),De;function oe(e){if(De==null){var t=v("span","\u200B");A(e,v("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(De=t.offsetWidth<=1&&t.offsetHeight>2&&!(S&&y<8))}var _=De?v("span","\u200B"):v("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return _.setAttribute("cm-text",""),_}var ve;function Be(e){if(ve!=null)return ve;var t=A(e,document.createTextNode("A\u062EA")),_=I(t,0,1).getBoundingClientRect(),g=I(t,1,2).getBoundingClientRect();return E(e),!_||_.left==_.right?!1:ve=g.right-_.right<3}var tt=`
|
|
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,_=[],g=e.length;t<=g;){var L=e.indexOf(`
|
|
|
`,t);L==-1&&(L=e.length);var N=e.slice(t,e.charAt(L-1)=="\r"?L-1:L),V=N.indexOf("\r");V!=-1?(_.push(N.slice(0,V)),t+=V+1):(_.push(N),t=L+1)}return _}:function(e){return e.split(/\r\n?|\n/)},Qe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(_){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},$e=function(){var e=v("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),st=null;function mt(e){if(st!=null)return st;var t=A(e,v("span","x")),_=t.getBoundingClientRect(),g=I(t,0,1).getBoundingClientRect();return st=Math.abs(_.left-g.left)>1}var ct={},nt={};function _t(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),ct[e]=t}function St(e,t){nt[e]=t}function Et(e){if(typeof e=="string"&&nt.hasOwnProperty(e))e=nt[e];else if(e&&typeof e.name=="string"&&nt.hasOwnProperty(e.name)){var t=nt[e.name];typeof t=="string"&&(t={name:t}),e=Ke(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Et("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Et("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Xt(e,t){t=Et(t);var _=ct[t.name];if(!_)return Xt(e,"text/plain");var g=_(e,t);if(Kt.hasOwnProperty(t.name)){var L=Kt[t.name];for(var N in L){if(!L.hasOwnProperty(N))continue;g.hasOwnProperty(N)&&(g["_"+N]=g[N]),g[N]=L[N]}}if(g.name=t.name,t.helperType&&(g.helperType=t.helperType),t.modeProps)for(var V in t.modeProps)g[V]=t.modeProps[V];return g}var Kt={};function Rt(e,t){var _=Kt.hasOwnProperty(e)?Kt[e]:Kt[e]={};K(t,_)}function Ct(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var _={};for(var g in t){var L=t[g];L instanceof Array&&(L=L.concat([])),_[g]=L}return _}function Lt(e,t){for(var _;e.innerMode&&!(_=e.innerMode(t),!_||_.mode==e);)t=_.state,e=_.mode;return _||{mode:e,state:t}}function nr(e,t,_){return e.startState?e.startState(t,_):!0}var wt=function(e,t,_){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=_};wt.prototype.eol=function(){return this.pos>=this.string.length},wt.prototype.sol=function(){return this.pos==this.lineStart},wt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},wt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},wt.prototype.eat=function(e){var t=this.string.charAt(this.pos),_;if(typeof e=="string"?_=t==e:_=t&&(e.test?e.test(t):e(t)),_)return++this.pos,t},wt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},wt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},wt.prototype.skipToEnd=function(){this.pos=this.string.length},wt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},wt.prototype.backUp=function(e){this.pos-=e},wt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},wt.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},wt.prototype.match=function(e,t,_){if(typeof e=="string"){var g=function(V){return _?V.toLowerCase():V},L=this.string.substr(this.pos,e.length);if(g(L)==g(e))return t!==!1&&(this.pos+=e.length),!0}else{var N=this.string.slice(this.pos).match(e);return N&&N.index>0?null:(N&&t!==!1&&(this.pos+=N[0].length),N)}},wt.prototype.current=function(){return this.string.slice(this.start,this.pos)},wt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},wt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},wt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function dt(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var _=e;!_.lines;)for(var g=0;;++g){var L=_.children[g],N=L.chunkSize();if(t<N){_=L;break}t-=N}return _.lines[t]}function Lr(e,t,_){var g=[],L=t.line;return e.iter(t.line,_.line+1,function(N){var V=N.text;L==_.line&&(V=V.slice(0,_.ch)),L==t.line&&(V=V.slice(t.ch)),g.push(V),++L}),g}function fn(e,t,_){var g=[];return e.iter(t,_,function(L){g.push(L.text)}),g}function vr(e,t){var _=t-e.height;if(_)for(var g=e;g;g=g.parent)g.height+=_}function Tt(e){if(e.parent==null)return null;for(var t=e.parent,_=de(t.lines,e),g=t.parent;g;t=g,g=g.parent)for(var L=0;!(g.children[L]==t);++L)_+=g.children[L].chunkSize();return _+t.first}function kr(e,t){var _=e.first;e:do{for(var g=0;g<e.children.length;++g){var L=e.children[g],N=L.height;if(t<N){e=L;continue e}t-=N,_+=L.chunkSize()}return _}while(!e.lines);for(var V=0;V<e.lines.length;++V){var Q=e.lines[V],q=Q.height;if(t<q)break;t-=q}return _+V}function Pr(e,t){return t>=e.first&&t<e.first+e.size}function Qr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,_){if(_===void 0&&(_=null),!(this instanceof et))return new et(e,t,_);this.line=e,this.ch=t,this.sticky=_}function vt(e,t){return e.line-t.line||e.ch-t.ch}function it(e,t){return e.sticky==t.sticky&&vt(e,t)==0}function Un(e){return et(e.line,e.ch)}function pn(e,t){return vt(e,t)<0?t:e}function qr(e,t){return vt(e,t)<0?e:t}function Zr(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function gt(e,t){if(t.line<e.first)return et(e.first,0);var _=e.first+e.size-1;return t.line>_?et(_,dt(e,_).text.length):Zi(t,dt(e,t.line).text.length)}function Zi(e,t){var _=e.ch;return _==null||_>t?et(e.line,t):_<0?et(e.line,0):e}function Kn(e,t){for(var _=[],g=0;g<t.length;g++)_[g]=gt(e,t[g]);return _}var _r=function(e,t){this.state=e,this.lookAhead=t},pr=function(e,t,_,g){this.state=t,this.doc=e,this.line=_,this.maxLookAhead=g||0,this.baseTokens=null,this.baseTokenPos=1};pr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},pr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},pr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},pr.fromSaved=function(e,t,_){return t instanceof _r?new pr(e,Ct(e.mode,t.state),_,t.lookAhead):new pr(e,Ct(e.mode,t),_)},pr.prototype.save=function(e){var t=e!==!1?Ct(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new _r(t,this.maxLookAhead):t};function yi(e,t,_,g){var L=[e.state.modeGen],N={};Xn(e,t.text,e.doc.mode,_,function(ee,_e){return L.push(ee,_e)},N,g);for(var V=_.state,Q=function(ee){_.baseTokens=L;var _e=e.state.overlays[ee],we=1,He=0;_.state=!0,Xn(e,t.text,_e.mode,_,function(Xe,Ye){for(var qe=we;He<Xe;){var rt=L[we];rt>Xe&&L.splice(we,1,Xe,L[we+1],rt),we+=2,He=Math.min(Xe,rt)}if(!Ye)return;if(_e.opaque)L.splice(qe,we-qe,Xe,"overlay "+Ye),we=qe+2;else for(;qe<we;qe+=2){var at=L[qe+1];L[qe+1]=(at?at+" ":"")+"overlay "+Ye}},N),_.state=V,_.baseTokens=null,_.baseTokenPos=1},q=0;q<e.state.overlays.length;++q)Q(q);return{styles:L,classes:N.bgClass||N.textClass?N:null}}function Bn(e,t,_){if(!t.styles||t.styles[0]!=e.state.modeGen){var g=dr(e,Tt(t)),L=t.text.length>e.options.maxHighlightLength&&Ct(e.doc.mode,g.state),N=yi(e,t,g);L&&(g.state=L),t.stateAfter=g.save(!L),t.styles=N.styles,N.classes?t.styleClasses=N.classes:t.styleClasses&&(t.styleClasses=null),_===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function dr(e,t,_){var g=e.doc,L=e.display;if(!g.mode.startState)return new pr(g,!0,t);var N=$r(e,t,_),V=N>g.first&&dt(g,N-1).stateAfter,Q=V?pr.fromSaved(g,V,N):new pr(g,nr(g.mode),N);return g.iter(N,t,function(q){mn(e,q.text,Q);var ee=Q.line;q.stateAfter=ee==t-1||ee%5==0||ee>=L.viewFrom&&ee<L.viewTo?Q.save():null,Q.nextLine()}),_&&(g.modeFrontier=Q.line),Q}function mn(e,t,_,g){var L=e.doc.mode,N=new wt(t,e.options.tabSize,_);for(N.start=N.pos=g||0,t==""&&bi(L,_.state);!N.eol();)gn(L,N,_.state),N.start=N.pos}function bi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var _=Lt(e,t);if(_.mode.blankLine)return _.mode.blankLine(_.state)}function gn(e,t,_,g){for(var L=0;L<10;L++){g&&(g[0]=Lt(e,_).mode);var N=e.token(t,_);if(t.pos>t.start)return N}throw new Error("Mode "+e.name+" failed to advance stream.")}var Rr=function(e,t,_){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=_};function Dr(e,t,_,g){var L=e.doc,N=L.mode,V;t=gt(L,t);var Q=dt(L,t.line),q=dr(e,t.line,_),ee=new wt(Q.text,e.options.tabSize,q),_e;for(g&&(_e=[]);(g||ee.pos<t.ch)&&!ee.eol();)ee.start=ee.pos,V=gn(N,ee,q.state),g&&_e.push(new Rr(ee,V,Ct(L.mode,q.state)));return g?_e:new Rr(ee,V,q.state)}function xi(e,t){if(e)for(;;){var _=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!_)break;e=e.slice(0,_.index)+e.slice(_.index+_[0].length);var g=_[1]?"bgClass":"textClass";t[g]==null?t[g]=_[2]:new RegExp("(?:^|\\s)"+_[2]+"(?:$|\\s)").test(t[g])||(t[g]+=" "+_[2])}return e}function Xn(e,t,_,g,L,N,V){var Q=_.flattenSpans;Q==null&&(Q=e.options.flattenSpans);var q=0,ee=null,_e=new wt(t,e.options.tabSize,g),we,He=e.options.addModeClass&&[null];for(t==""&&xi(bi(_,g.state),N);!_e.eol();){if(_e.pos>e.options.maxHighlightLength?(Q=!1,V&&mn(e,t,g,_e.pos),_e.pos=t.length,we=null):we=xi(gn(_,_e,g.state,He),N),He){var Xe=He[0].name;Xe&&(we="m-"+(we?Xe+" "+we:Xe))}if(!Q||ee!=we){for(;q<_e.start;)q=Math.min(_e.start,q+5e3),L(q,ee);ee=we}_e.start=_e.pos}for(;q<_e.pos;){var Ye=Math.min(_e.pos,q+5e3);L(Ye,ee),q=Ye}}function $r(e,t,_){for(var g,L,N=e.doc,V=_?-1:t-(e.doc.mode.innerMode?1e3:100),Q=t;Q>V;--Q){if(Q<=N.first)return N.first;var q=dt(N,Q-1),ee=q.stateAfter;if(ee&&(!_||Q+(ee instanceof _r?ee.lookAhead:0)<=N.modeFrontier))return Q;var _e=z(q.text,null,e.options.tabSize);(L==null||g>_e)&&(L=Q-1,g=_e)}return L}function Hn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var _=e.first,g=t-1;g>_;g--){var L=dt(e,g).stateAfter;if(L&&(!(L instanceof _r)||g+L.lookAhead<t)){_=g+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,_)}var Ei=!1,yr=!1;function Si(){Ei=!0}function wi(){yr=!0}function vn(e,t,_){this.marker=e,this.from=t,this.to=_}function Fr(e,t){if(e)for(var _=0;_<e.length;++_){var g=e[_];if(g.marker==t)return g}}function Na(e,t){for(var _,g=0;g<e.length;++g)e[g]!=t&&(_||(_=[])).push(e[g]);return _}function jn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Jr(e,t,_){var g;if(e)for(var L=0;L<e.length;++L){var N=e[L],V=N.marker,Q=N.from==null||(V.inclusiveLeft?N.from<=t:N.from<t);if(Q||N.from==t&&V.type=="bookmark"&&(!_||!N.marker.insertLeft)){var q=N.to==null||(V.inclusiveRight?N.to>=t:N.to>t);(g||(g=[])).push(new vn(V,N.from,q?null:N.to))}}return g}function Wn(e,t,_){var g;if(e)for(var L=0;L<e.length;++L){var N=e[L],V=N.marker,Q=N.to==null||(V.inclusiveRight?N.to>=t:N.to>t);if(Q||N.from==t&&V.type=="bookmark"&&(!_||N.marker.insertLeft)){var q=N.from==null||(V.inclusiveLeft?N.from<=t:N.from<t);(g||(g=[])).push(new vn(V,q?null:N.from-t,N.to==null?null:N.to-t))}}return g}function Nr(e,t){if(t.full)return null;var _=Pr(e,t.from.line)&&dt(e,t.from.line).markedSpans,g=Pr(e,t.to.line)&&dt(e,t.to.line).markedSpans;if(!_&&!g)return null;var L=t.from.ch,N=t.to.ch,V=vt(t.from,t.to)==0,Q=Jr(_,L,V),q=Wn(g,N,V),ee=t.text.length==1,_e=re(t.text).length+(ee?L:0);if(Q)for(var we=0;we<Q.length;++we){var He=Q[we];if(He.to==null){var Xe=Fr(q,He.marker);Xe?ee&&(He.to=Xe.to==null?null:Xe.to+_e):He.to=L}}if(q)for(var Ye=0;Ye<q.length;++Ye){var qe=q[Ye];if(qe.to!=null&&(qe.to+=_e),qe.from==null){var rt=Fr(Q,qe.marker);rt||(qe.from=_e,ee&&(Q||(Q=[])).push(qe))}else qe.from+=_e,ee&&(Q||(Q=[])).push(qe)}Q&&(Q=en(Q)),q&&q!=Q&&(q=en(q));var at=[Q];if(!ee){var lt=t.text.length-2,ot;if(lt>0&&Q)for(var ut=0;ut<Q.length;++ut)Q[ut].to==null&&(ot||(ot=[])).push(new vn(Q[ut].marker,null,null));for(var pt=0;pt<lt;++pt)at.push(ot);at.push(q)}return at}function en(e){for(var t=0;t<e.length;++t){var _=e[t];_.from!=null&&_.from==_.to&&_.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ti(e,t,_){var g=null;if(e.iter(t.line,_.line+1,function(Xe){if(Xe.markedSpans)for(var Ye=0;Ye<Xe.markedSpans.length;++Ye){var qe=Xe.markedSpans[Ye].marker;qe.readOnly&&(!g||de(g,qe)==-1)&&(g||(g=[])).push(qe)}}),!g)return null;for(var L=[{from:t,to:_}],N=0;N<g.length;++N)for(var V=g[N],Q=V.find(0),q=0;q<L.length;++q){var ee=L[q];if(vt(ee.to,Q.from)<0||vt(ee.from,Q.to)>0)continue;var _e=[q,1],we=vt(ee.from,Q.from),He=vt(ee.to,Q.to);(we<0||!V.inclusiveLeft&&!we)&&_e.push({from:ee.from,to:Q.from}),(He>0||!V.inclusiveRight&&!He)&&_e.push({from:Q.to,to:ee.to}),L.splice.apply(L,_e),q+=_e.length-3}return L}function zn(e){var t=e.markedSpans;if(!t)return;for(var _=0;_<t.length;++_)t[_].marker.detachLine(e);e.markedSpans=null}function tn(e,t){if(!t)return;for(var _=0;_<t.length;++_)t[_].marker.attachLine(e);e.markedSpans=t}function _n(e){return e.inclusiveLeft?-1:0}function wr(e){return e.inclusiveRight?1:0}function Gn(e,t){var _=e.lines.length-t.lines.length;if(_!=0)return _;var g=e.find(),L=t.find(),N=vt(g.from,L.from)||_n(e)-_n(t);if(N)return-N;var V=vt(g.to,L.to)||wr(e)-wr(t);return V||t.id-e.id}function Ci(e,t){var _=yr&&e.markedSpans,g;if(_)for(var L=void 0,N=0;N<_.length;++N)L=_[N],L.marker.collapsed&&(t?L.from:L.to)==null&&(!g||Gn(g,L.marker)<0)&&(g=L.marker);return g}function Ai(e){return Ci(e,!0)}function Vn(e){return Ci(e,!1)}function Ua(e,t){var _=yr&&e.markedSpans,g;if(_)for(var L=0;L<_.length;++L){var N=_[L];N.marker.collapsed&&(N.from==null||N.from<t)&&(N.to==null||N.to>t)&&(!g||Gn(g,N.marker)<0)&&(g=N.marker)}return g}function $i(e,t,_,g,L){var N=dt(e,t),V=yr&&N.markedSpans;if(V)for(var Q=0;Q<V.length;++Q){var q=V[Q];if(!q.marker.collapsed)continue;var ee=q.marker.find(0),_e=vt(ee.from,_)||_n(q.marker)-_n(L),we=vt(ee.to,g)||wr(q.marker)-wr(L);if(_e>=0&&we<=0||_e<=0&&we>=0)continue;if(_e<=0&&(q.marker.inclusiveRight&&L.inclusiveLeft?vt(ee.to,_)>=0:vt(ee.to,_)>0)||_e>=0&&(q.marker.inclusiveRight&&L.inclusiveLeft?vt(ee.from,g)<=0:vt(ee.from,g)<0))return!0}}function ht(e){for(var t;t=Ai(e);)e=t.find(-1,!0).line;return e}function yt(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function bt(e){for(var t,_;t=Vn(e);)e=t.find(1,!0).line,(_||(_=[])).push(e);return _}function Dt(e,t){var _=dt(e,t),g=ht(_);return _==g?t:Tt(g)}function Ot(e,t){if(t>e.lastLine())return t;var _=dt(e,t),g;if(!It(e,_))return t;for(;g=Vn(_);)_=g.find(1,!0).line;return Tt(_)+1}function It(e,t){var _=yr&&t.markedSpans;if(_)for(var g=void 0,L=0;L<_.length;++L){if(g=_[L],!g.marker.collapsed)continue;if(g.from==null)return!0;if(g.marker.widgetNode)continue;if(g.from==0&&g.marker.inclusiveLeft&&Ht(e,t,g))return!0}}function Ht(e,t,_){if(_.to==null){var g=_.marker.find(1,!0);return Ht(e,g.line,Fr(g.line.markedSpans,_.marker))}if(_.marker.inclusiveRight&&_.to==t.text.length)return!0;for(var L=void 0,N=0;N<t.markedSpans.length;++N)if(L=t.markedSpans[N],L.marker.collapsed&&!L.marker.widgetNode&&L.from==_.to&&(L.to==null||L.to!=_.from)&&(L.marker.inclusiveLeft||_.marker.inclusiveRight)&&Ht(e,t,L))return!0}function Ft(e){e=ht(e);for(var t=0,_=e.parent,g=0;g<_.lines.length;++g){var L=_.lines[g];if(L==e)break;t+=L.height}for(var N=_.parent;N;_=N,N=_.parent)for(var V=0;V<N.children.length;++V){var Q=N.children[V];if(Q==_)break;t+=Q.height}return t}function Jt(e){if(e.height==0)return 0;for(var t=e.text.length,_,g=e;_=Ai(g);){var L=_.find(0,!0);g=L.from.line,t+=L.from.ch-L.to.ch}for(g=e;_=Vn(g);){var N=_.find(0,!0);t-=g.text.length-N.from.ch,g=N.to.line,t+=g.text.length-N.to.ch}return t}function br(e){var t=e.display,_=e.doc;t.maxLine=dt(_,_.first),t.maxLineLength=Jt(t.maxLine),t.maxLineChanged=!0,_.iter(function(g){var L=Jt(g);L>t.maxLineLength&&(t.maxLineLength=L,t.maxLine=g)})}var Pt=function(e,t,_){this.text=e,tn(this,t),this.height=_?_(this):1};Pt.prototype.lineNo=function(){return Tt(this)},he(Pt);function Ur(e,t,_,g){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),zn(e),tn(e,_);var L=g?g(e):1;L!=e.height&&vr(e,L)}function er(e){e.parent=null,zn(e)}var Kr={},Br={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var _=t.addModeClass?Br:Kr;return _[e]||(_[e]=e.replace(/\S+/g,"cm-$&"))}function Ka(e,t){var _=M("span",null,null,p?"padding-right: .1px":null),g={pre:M("pre",[_],"CodeMirror-line"),content:_,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var L=0;L<=(t.rest?t.rest.length:0);L++){var N=L?t.rest[L-1]:t.line,V=void 0;g.pos=0,g.addToken=Ts,Be(e.display.measure)&&(V=We(N,e.doc.direction))&&(g.addToken=As(g.addToken,V)),g.map=[];var Q=t!=e.display.externalMeasured&&Tt(N);Ls(N,g,Bn(e,N,Q)),N.styleClasses&&(N.styleClasses.bgClass&&(g.bgClass=F(N.styleClasses.bgClass,g.bgClass||"")),N.styleClasses.textClass&&(g.textClass=F(N.styleClasses.textClass,g.textClass||""))),g.map.length==0&&g.map.push(0,0,g.content.appendChild(oe(e.display.measure))),L==0?(t.measure.map=g.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(g.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(p){var q=g.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(g.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,g.pre),g.pre.className&&(g.textClass=F(g.pre.className,g.textClass||"")),g}function ws(e){var t=v("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ts(e,t,_,g,L,N,V){if(!t)return;var Q=e.splitSpaces?Cs(t,e.trailingSpace):t,q=e.cm.state.specialChars,ee=!1,_e;if(!q.test(t))e.col+=t.length,_e=document.createTextNode(Q),e.map.push(e.pos,e.pos+t.length,_e),S&&y<9&&(ee=!0),e.pos+=t.length;else{_e=document.createDocumentFragment();for(var we=0;;){q.lastIndex=we;var He=q.exec(t),Xe=He?He.index-we:t.length-we;if(Xe){var Ye=document.createTextNode(Q.slice(we,we+Xe));S&&y<9?_e.appendChild(v("span",[Ye])):_e.appendChild(Ye),e.map.push(e.pos,e.pos+Xe,Ye),e.col+=Xe,e.pos+=Xe}if(!He)break;we+=Xe+1;var qe=void 0;if(He[0]==" "){var rt=e.cm.options.tabSize,at=rt-e.col%rt;qe=_e.appendChild(v("span",Ae(at),"cm-tab")),qe.setAttribute("role","presentation"),qe.setAttribute("cm-text"," "),e.col+=at}else He[0]=="\r"||He[0]==`
|
|
|
`?(qe=_e.appendChild(v("span",He[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),qe.setAttribute("cm-text",He[0]),e.col+=1):(qe=e.cm.options.specialCharPlaceholder(He[0]),qe.setAttribute("cm-text",He[0]),S&&y<9?_e.appendChild(v("span",[qe])):_e.appendChild(qe),e.col+=1);e.map.push(e.pos,e.pos+1,qe),e.pos++}}if(e.trailingSpace=Q.charCodeAt(t.length-1)==32,_||g||L||ee||N||V){var lt=_||"";g&&(lt+=g),L&&(lt+=L);var ot=v("span",[_e],lt,N);if(V)for(var ut in V)V.hasOwnProperty(ut)&&ut!="style"&&ut!="class"&&ot.setAttribute(ut,V[ut]);return e.content.appendChild(ot)}e.content.appendChild(_e)}function Cs(e,t){if(e.length>1&&!/ /.test(e))return e;for(var _=t,g="",L=0;L<e.length;L++){var N=e.charAt(L);N==" "&&_&&(L==e.length-1||e.charCodeAt(L+1)==32)&&(N="\xA0"),g+=N,_=N==" "}return g}function As(e,t){return function(_,g,L,N,V,Q,q){L=L?L+" cm-force-border":"cm-force-border";for(var ee=_.pos,_e=ee+g.length;;){for(var we=void 0,He=0;He<t.length&&!(we=t[He],we.to>ee&&we.from<=ee);He++);if(we.to>=_e)return e(_,g,L,N,V,Q,q);e(_,g.slice(0,we.to-ee),L,N,null,Q,q),N=null,g=g.slice(we.to-ee),ee=we.to}}}function Ba(e,t,_,g){var L=!g&&_.widgetNode;L&&e.map.push(e.pos,e.pos+t,L),!g&&e.cm.display.input.needsContentAttribute&&(L||(L=e.content.appendChild(document.createElement("span"))),L.setAttribute("cm-marker",_.id)),L&&(e.cm.display.input.setUneditable(L),e.content.appendChild(L)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,_){var g=e.markedSpans,L=e.text,N=0;if(!g){for(var V=1;V<_.length;V+=2)t.addToken(t,L.slice(N,N=_[V]),yn(_[V+1],t.cm.options));return}for(var Q=L.length,q=0,ee=1,_e="",we,He,Xe=0,Ye,qe,rt,at,lt;;){if(Xe==q){Ye=qe=rt=He="",lt=null,at=null,Xe=Infinity;for(var ot=[],ut=void 0,pt=0;pt<g.length;++pt){var ft=g[pt],xt=ft.marker;if(xt.type=="bookmark"&&ft.from==q&&xt.widgetNode)ot.push(xt);else if(ft.from<=q&&(ft.to==null||ft.to>q||xt.collapsed&&ft.to==q&&ft.from==q)){if(ft.to!=null&&ft.to!=q&&Xe>ft.to&&(Xe=ft.to,qe=""),xt.className&&(Ye+=" "+xt.className),xt.css&&(He=(He?He+";":"")+xt.css),xt.startStyle&&ft.from==q&&(rt+=" "+xt.startStyle),xt.endStyle&&ft.to==Xe&&(ut||(ut=[])).push(xt.endStyle,ft.to),xt.title&&((lt||(lt={})).title=xt.title),xt.attributes)for(var Mt in xt.attributes)(lt||(lt={}))[Mt]=xt.attributes[Mt];xt.collapsed&&(!at||Gn(at.marker,xt)<0)&&(at=ft)}else ft.from>q&&Xe>ft.from&&(Xe=ft.from)}if(ut)for(var Qt=0;Qt<ut.length;Qt+=2)ut[Qt+1]==Xe&&(qe+=" "+ut[Qt]);if(!at||at.from==q)for(var Ut=0;Ut<ot.length;++Ut)Ba(t,0,ot[Ut]);if(at&&(at.from||0)==q){if(Ba(t,(at.to==null?Q+1:at.to)-q,at.marker,at.from==null),at.to==null)return;at.to==q&&(at=!1)}}if(q>=Q)break;for(var fr=Math.min(Q,Xe);;){if(_e){var lr=q+_e.length;if(!at){var Wt=lr>fr?_e.slice(0,fr-q):_e;t.addToken(t,Wt,we?we+Ye:Ye,rt,q+Wt.length==Xe?qe:"",He,lt)}if(lr>=fr){_e=_e.slice(fr-q),q=fr;break}q=lr,rt=""}_e=L.slice(N,N=_[ee++]),we=yn(_[ee++],t.cm.options)}}}function Xa(e,t,_){this.line=t,this.rest=bt(t),this.size=this.rest?Tt(re(this.rest))-_+1:1,this.node=this.text=null,this.hidden=It(e,t)}function Li(e,t,_){for(var g=[],L,N=t;N<_;N=L){var V=new Xa(e.doc,dt(e.doc,N),N);L=N+V.size,g.push(V)}return g}var bn=null;function ks(e){bn?bn.ops.push(e):e.ownsGroup=bn={ops:[e],delayedCallbacks:[]}}function Rs(e){var t=e.delayedCallbacks,_=0;do{for(;_<t.length;_++)t[_].call(null);for(var g=0;g<e.ops.length;g++){var L=e.ops[g];if(L.cursorActivityHandlers)for(;L.cursorActivityCalled<L.cursorActivityHandlers.length;)L.cursorActivityHandlers[L.cursorActivityCalled++].call(null,L.cm)}}while(_<t.length)}function Ds(e,t){var _=e.ownsGroup;if(!_)return;try{Rs(_)}finally{bn=null,t(_)}}var Yn=null;function Zt(e,t){var _=Je(e,t);if(!_.length)return;var g=Array.prototype.slice.call(arguments,2),L;bn?L=bn.delayedCallbacks:Yn?L=Yn:(L=Yn=[],setTimeout(Os,0));for(var N=function(Q){L.push(function(){return _[Q].apply(null,g)})},V=0;V<_.length;++V)N(V)}function Os(){var e=Yn;Yn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,_,g){for(var L=0;L<t.changes.length;L++){var N=t.changes[L];N=="text"?Is(e,t):N=="gutter"?Wa(e,t,_,g):N=="class"?Ji(e,t):N=="widget"&&Ps(e,t,g)}t.changes=null}function Qn(e){return e.node==e.text&&(e.node=v("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),S&&y<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var _=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(_&&(_+=" CodeMirror-linebackground"),t.background)_?t.background.className=_:(t.background.parentNode.removeChild(t.background),t.background=null);else if(_){var g=Qn(t);t.background=g.insertBefore(v("div",null,_),g.firstChild),e.display.input.setUneditable(t.background)}}function ja(e,t){var _=e.display.externalMeasured;return _&&_.line==t.line?(e.display.externalMeasured=null,t.measure=_.measure,_.built):Ka(e,t)}function Is(e,t){var _=t.text.className,g=ja(e,t);t.text==t.node&&(t.node=g.pre),t.text.parentNode.replaceChild(g.pre,t.text),t.text=g.pre,g.bgClass!=t.bgClass||g.textClass!=t.textClass?(t.bgClass=g.bgClass,t.textClass=g.textClass,Ji(e,t)):_&&(t.text.className=_)}function Ji(e,t){Ms(e,t),t.line.wrapClass?Qn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var _=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=_||""}function Wa(e,t,_,g){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var L=Qn(t);t.gutterBackground=v("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?g.fixedPos:-g.gutterTotalWidth)+"px; width: "+g.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),L.insertBefore(t.gutterBackground,t.text)}var N=t.line.gutterMarkers;if(e.options.lineNumbers||N){var V=Qn(t),Q=t.gutter=v("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?g.fixedPos:-g.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Q),V.insertBefore(Q,t.text),t.line.gutterClass&&(Q.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!N||!N["CodeMirror-linenumbers"])&&(t.lineNumber=Q.appendChild(v("div",Qr(e.options,_),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+g.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),N)for(var q=0;q<e.display.gutterSpecs.length;++q){var ee=e.display.gutterSpecs[q].className,_e=N.hasOwnProperty(ee)&&N[ee];_e&&Q.appendChild(v("div",[_e],"CodeMirror-gutter-elt","left: "+g.gutterLeft[ee]+"px; width: "+g.gutterWidth[ee]+"px"))}}}function Ps(e,t,_){t.alignable&&(t.alignable=null);for(var g=x("CodeMirror-linewidget"),L=t.node.firstChild,N=void 0;L;L=N)N=L.nextSibling,g.test(L.className)&&t.node.removeChild(L);za(e,t,_)}function Fs(e,t,_,g){var L=ja(e,t);return t.text=t.node=L.pre,L.bgClass&&(t.bgClass=L.bgClass),L.textClass&&(t.textClass=L.textClass),Ji(e,t),Wa(e,t,_,g),za(e,t,g),t.node}function za(e,t,_){if(Ga(e,t.line,t,_,!0),t.rest)for(var g=0;g<t.rest.length;g++)Ga(e,t.rest[g],t,_,!1)}function Ga(e,t,_,g,L){if(!t.widgets)return;for(var N=Qn(_),V=0,Q=t.widgets;V<Q.length;++V){var q=Q[V],ee=v("div",[q.node],"CodeMirror-linewidget"+(q.className?" "+q.className:""));q.handleMouseEvents||ee.setAttribute("cm-ignore-events","true"),Ns(q,ee,_,g),e.display.input.setUneditable(ee),L&&q.above?N.insertBefore(ee,_.gutter||_.text):N.appendChild(ee),Zt(q,"redraw")}}function Ns(e,t,_,g){if(e.noHScroll){(_.alignable||(_.alignable=[])).push(t);var L=g.wrapperWidth;t.style.left=g.fixedPos+"px",e.coverGutter||(L-=g.gutterTotalWidth,t.style.paddingLeft=g.gutterTotalWidth+"px"),t.style.width=L+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-g.gutterTotalWidth+"px"))}function qn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!P(document.body,e.node)){var _="position: relative;";e.coverGutter&&(_+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(_+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,v("div",[e.node],null,_))}return e.height=e.node.parentNode.offsetHeight}function Or(e,t){for(var _=Te(t);_!=e.wrapper;_=_.parentNode)if(!_||_.nodeType==1&&_.getAttribute("cm-ignore-events")=="true"||_.parentNode==e.sizer&&_!=e.mover)return!0}function ki(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Va(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,v("pre","x","CodeMirror-line-like")),_=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,g={left:parseInt(_.paddingLeft),right:parseInt(_.paddingRight)};return!isNaN(g.left)&&!isNaN(g.right)&&(e.cachedPaddingH=g),g}function Tr(e){return ge-e.display.nativeBarWidth}function rn(e){return e.display.scroller.clientWidth-Tr(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-Tr(e)-e.display.barHeight}function Us(e,t,_){var g=e.options.lineWrapping,L=g&&rn(e);if(!t.measure.heights||g&&t.measure.width!=L){var N=t.measure.heights=[];if(g){t.measure.width=L;for(var V=t.text.firstChild.getClientRects(),Q=0;Q<V.length-1;Q++){var q=V[Q],ee=V[Q+1];Math.abs(q.bottom-ee.bottom)>2&&N.push((q.bottom+ee.top)/2-_.top)}}N.push(_.bottom-_.top)}}function Ya(e,t,_){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var g=0;g<e.rest.length;g++)if(e.rest[g]==t)return{map:e.measure.maps[g],cache:e.measure.caches[g]};for(var L=0;L<e.rest.length;L++)if(Tt(e.rest[L])>_)return{map:e.measure.maps[L],cache:e.measure.caches[L],before:!0}}function Ks(e,t){t=ht(t);var _=Tt(t),g=e.display.externalMeasured=new Xa(e.doc,t,_);g.lineN=_;var L=g.built=Ka(e,g);return g.text=L.pre,A(e.display.lineMeasure,L.pre),g}function Qa(e,t,_,g){return Cr(e,xn(e,t),_,g)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[on(e,t)];var _=e.display.externalMeasured;if(_&&t>=_.lineN&&t<_.lineN+_.size)return _}function xn(e,t){var _=Tt(t),g=ra(e,_);g&&!g.text?g=null:g&&g.changes&&(Ha(e,g,_,la(e)),e.curOp.forceUpdate=!0),g||(g=Ks(e,t));var L=Ya(g,t,_);return{line:t,view:g,rect:null,map:L.map,cache:L.cache,before:L.before,hasHeights:!1}}function Cr(e,t,_,g,L){t.before&&(_=-1);var N=_+(g||""),V;return t.cache.hasOwnProperty(N)?V=t.cache[N]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),V=Xs(e,t,_,g),V.bogus||(t.cache[N]=V)),{left:V.left,right:V.right,top:L?V.rtop:V.top,bottom:L?V.rbottom:V.bottom}}var qa={left:0,right:0,top:0,bottom:0};function Za(e,t,_){for(var g,L,N,V,Q,q,ee=0;ee<e.length;ee+=3)if(Q=e[ee],q=e[ee+1],t<Q?(L=0,N=1,V="left"):t<q?(L=t-Q,N=L+1):(ee==e.length-3||t==q&&e[ee+3]>t)&&(N=q-Q,L=N-1,t>=q&&(V="right")),L!=null){if(g=e[ee+2],Q==q&&_==(g.insertLeft?"left":"right")&&(V=_),_=="left"&&L==0)for(;ee&&e[ee-2]==e[ee-3]&&e[ee-1].insertLeft;)g=e[(ee-=3)+2],V="left";if(_=="right"&&L==q-Q)for(;ee<e.length-3&&e[ee+3]==e[ee+4]&&!e[ee+5].insertLeft;)g=e[(ee+=3)+2],V="right";break}return{node:g,start:L,end:N,collapse:V,coverStart:Q,coverEnd:q}}function Bs(e,t){var _=qa;if(t=="left")for(var g=0;g<e.length&&!((_=e[g]).left!=_.right);g++);else for(var L=e.length-1;L>=0&&!((_=e[L]).left!=_.right);L--);return _}function Xs(e,t,_,g){var L=Za(t.map,_,g),N=L.node,V=L.start,Q=L.end,q=L.collapse,ee;if(N.nodeType==3){for(var _e=0;_e<4;_e++){for(;V&&xe(t.line.text.charAt(L.coverStart+V));)--V;for(;L.coverStart+Q<L.coverEnd&&xe(t.line.text.charAt(L.coverStart+Q));)++Q;if(S&&y<9&&V==0&&Q==L.coverEnd-L.coverStart?ee=N.parentNode.getBoundingClientRect():ee=Bs(I(N,V,Q).getClientRects(),g),ee.left||ee.right||V==0)break;Q=V,V=V-1,q="right"}S&&y<11&&(ee=Hs(e.display.measure,ee))}else{V>0&&(q=g="right");var we;e.options.lineWrapping&&(we=N.getClientRects()).length>1?ee=we[g=="right"?we.length-1:0]:ee=N.getBoundingClientRect()}if(S&&y<9&&!V&&(!ee||!ee.left&&!ee.right)){var He=N.parentNode.getClientRects()[0];He?ee={left:He.left,right:He.left+Sn(e.display),top:He.top,bottom:He.bottom}:ee=qa}for(var Xe=ee.top-t.rect.top,Ye=ee.bottom-t.rect.top,qe=(Xe+Ye)/2,rt=t.view.measure.heights,at=0;at<rt.length-1&&!(qe<rt[at]);at++);var lt=at?rt[at-1]:0,ot=rt[at],ut={left:(q=="right"?ee.right:ee.left)-t.rect.left,right:(q=="left"?ee.left:ee.right)-t.rect.left,top:lt,bottom:ot};return!ee.left&&!ee.right&&(ut.bogus=!0),e.options.singleCursorHeightPerLine||(ut.rtop=Xe,ut.rbottom=Ye),ut}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!mt(e))return t;var _=screen.logicalXDPI/screen.deviceXDPI,g=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*_,right:t.right*_,top:t.top*g,bottom:t.bottom*g}}function $a(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Ja(e){e.display.externalMeasure=null,E(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)$a(e.display.view[t])}function Zn(e){Ja(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return o&&a?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return o&&a?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var _=0;_<e.widgets.length;++_)e.widgets[_].above&&(t+=qn(e.widgets[_]));return t}function Ri(e,t,_,g,L){if(!L){var N=na(t);_.top+=N,_.bottom+=N}if(g=="line")return _;g||(g="local");var V=Ft(t);if(g=="local"?V+=ki(e.display):V-=e.display.viewOffset,g=="page"||g=="window"){var Q=e.display.lineSpace.getBoundingClientRect();V+=Q.top+(g=="window"?0:to());var q=Q.left+(g=="window"?0:eo());_.left+=q,_.right+=q}return _.top+=V,_.bottom+=V,_}function ro(e,t,_){if(_=="div")return t;var g=t.left,L=t.top;if(_=="page")g-=eo(),L-=to();else if(_=="local"||!_){var N=e.display.sizer.getBoundingClientRect();g+=N.left,L+=N.top}var V=e.display.lineSpace.getBoundingClientRect();return{left:g-V.left,top:L-V.top}}function ia(e,t,_,g,L){return g||(g=dt(e.doc,t.line)),Ri(e,g,Qa(e,g,t.ch,L),_)}function xr(e,t,_,g,L,N){g=g||dt(e.doc,t.line),L||(L=xn(e,g));function V(Ye,qe){var rt=Cr(e,L,Ye,qe?"right":"left",N);return qe?rt.left=rt.right:rt.right=rt.left,Ri(e,g,rt,_)}var Q=We(g,e.doc.direction),q=t.ch,ee=t.sticky;if(q>=g.text.length?(q=g.text.length,ee="before"):q<=0&&(q=0,ee="after"),!Q)return V(ee=="before"?q-1:q,ee=="before");function _e(Ye,qe,rt){var at=Q[qe],lt=at.level==1;return V(rt?Ye-1:Ye,lt!=rt)}var we=J(Q,q,ee),He=fe,Xe=_e(q,we,ee=="before");return He!=null&&(Xe.other=_e(q,He,ee!="before")),Xe}function no(e,t){var _=0;t=gt(e.doc,t),e.options.lineWrapping||(_=Sn(e.display)*t.ch);var g=dt(e.doc,t.line),L=Ft(g)+ki(e.display);return{left:_,right:_,top:L,bottom:L+g.height}}function aa(e,t,_,g,L){var N=et(e,t,_);return N.xRel=L,g&&(N.outside=g),N}function oa(e,t,_){var g=e.doc;if(_+=e.display.viewOffset,_<0)return aa(g.first,0,null,-1,-1);var L=kr(g,_),N=g.first+g.size-1;if(L>N)return aa(g.first+g.size-1,dt(g,N).text.length,null,1,1);t<0&&(t=0);for(var V=dt(g,L);;){var Q=js(e,V,L,t,_),q=Ua(V,Q.ch+(Q.xRel>0||Q.outside>0?1:0));if(!q)return Q;var ee=q.find(1);if(ee.line==L)return ee;V=dt(g,L=ee.line)}}function io(e,t,_,g){g-=na(t);var L=t.text.length,N=Se(function(V){return Cr(e,_,V-1).bottom<=g},L,0);return L=Se(function(V){return Cr(e,_,V).top>g},N,L),{begin:N,end:L}}function ao(e,t,_,g){_||(_=xn(e,t));var L=Ri(e,t,Cr(e,_,g),"line").top;return io(e,t,_,L)}function sa(e,t,_,g){return e.bottom<=_?!1:e.top>_?!0:(g?e.left:e.right)>t}function js(e,t,_,g,L){L-=Ft(t);var N=xn(e,t),V=na(t),Q=0,q=t.text.length,ee=!0,_e=We(t,e.doc.direction);if(_e){var we=(e.options.lineWrapping?zs:Ws)(e,t,_,N,_e,g,L);ee=we.level!=1,Q=ee?we.from:we.to-1,q=ee?we.to:we.from-1}var He=null,Xe=null,Ye=Se(function(pt){var ft=Cr(e,N,pt);return ft.top+=V,ft.bottom+=V,sa(ft,g,L,!1)?(ft.top<=L&&ft.left<=g&&(He=pt,Xe=ft),!0):!1},Q,q),qe,rt,at=!1;if(Xe){var lt=g-Xe.left<Xe.right-g,ot=lt==ee;Ye=He+(ot?0:1),rt=ot?"after":"before",qe=lt?Xe.left:Xe.right}else{!ee&&(Ye==q||Ye==Q)&&Ye++,rt=Ye==0?"after":Ye==t.text.length?"before":Cr(e,N,Ye-(ee?1:0)).bottom+V<=L==ee?"after":"before";var ut=xr(e,et(_,Ye,rt),"line",t,N);qe=ut.left,at=L<ut.top?-1:L>=ut.bottom?1:0}return Ye=Ee(t.text,Ye,1),aa(_,Ye,rt,at,g-qe)}function Ws(e,t,_,g,L,N,V){var Q=Se(function(we){var He=L[we],Xe=He.level!=1;return sa(xr(e,et(_,Xe?He.to:He.from,Xe?"before":"after"),"line",t,g),N,V,!0)},0,L.length-1),q=L[Q];if(Q>0){var ee=q.level!=1,_e=xr(e,et(_,ee?q.from:q.to,ee?"after":"before"),"line",t,g);sa(_e,N,V,!0)&&_e.top>V&&(q=L[Q-1])}return q}function zs(e,t,_,g,L,N,V){var Q=io(e,t,g,V),q=Q.begin,ee=Q.end;/\s/.test(t.text.charAt(ee-1))&&ee--;for(var _e=null,we=null,He=0;He<L.length;He++){var Xe=L[He];if(Xe.from>=ee||Xe.to<=q)continue;var Ye=Xe.level!=1,qe=Cr(e,g,Ye?Math.min(ee,Xe.to)-1:Math.max(q,Xe.from)).right,rt=qe<N?N-qe+1e9:qe-N;(!_e||we>rt)&&(_e=Xe,we=rt)}return _e||(_e=L[L.length-1]),_e.from<q&&(_e={from:q,to:_e.to,level:_e.level}),_e.to>ee&&(_e={from:_e.from,to:ee,level:_e.level}),_e}var nn;function En(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(nn==null){nn=v("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)nn.appendChild(document.createTextNode("x")),nn.appendChild(v("br"));nn.appendChild(document.createTextNode("x"))}A(e.measure,nn);var _=nn.offsetHeight/50;return _>3&&(e.cachedTextHeight=_),E(e.measure),_||1}function Sn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=v("span","xxxxxxxxxx"),_=v("pre",[t],"CodeMirror-line-like");A(e.measure,_);var g=t.getBoundingClientRect(),L=(g.right-g.left)/10;return L>2&&(e.cachedCharWidth=L),L||10}function la(e){for(var t=e.display,_={},g={},L=t.gutters.clientLeft,N=t.gutters.firstChild,V=0;N;N=N.nextSibling,++V){var Q=e.display.gutterSpecs[V].className;_[Q]=N.offsetLeft+N.clientLeft+L,g[Q]=N.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:_,gutterWidth:g,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=En(e.display),_=e.options.lineWrapping,g=_&&Math.max(5,e.display.scroller.clientWidth/Sn(e.display)-3);return function(L){if(It(e.doc,L))return 0;var N=0;if(L.widgets)for(var V=0;V<L.widgets.length;V++)L.widgets[V].height&&(N+=L.widgets[V].height);return _?N+(Math.ceil(L.text.length/g)||1)*t:N+t}}function ca(e){var t=e.doc,_=oo(e);t.iter(function(g){var L=_(g);L!=g.height&&vr(g,L)})}function an(e,t,_,g){var L=e.display;if(!_&&Te(t).getAttribute("cm-not-content")=="true")return null;var N,V,Q=L.lineSpace.getBoundingClientRect();try{N=t.clientX-Q.left,V=t.clientY-Q.top}catch(we){return null}var q=oa(e,N,V),ee;if(g&&q.xRel>0&&(ee=dt(e.doc,q.line).text).length==q.ch){var _e=z(ee,ee.length,e.options.tabSize)-ee.length;q=et(q.line,Math.max(0,Math.round((N-Va(e.display).left)/Sn(e.display))-_e))}return q}function on(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var _=e.display.view,g=0;g<_.length;g++)if(t-=_[g].size,t<0)return g}function or(e,t,_,g){t==null&&(t=e.doc.first),_==null&&(_=e.doc.first+e.doc.size),g||(g=0);var L=e.display;if(g&&_<L.viewTo&&(L.updateLineNumbers==null||L.updateLineNumbers>t)&&(L.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=L.viewTo)yr&&Dt(e.doc,t)<L.viewTo&&Hr(e);else if(_<=L.viewFrom)yr&&Ot(e.doc,_+g)>L.viewFrom?Hr(e):(L.viewFrom+=g,L.viewTo+=g);else if(t<=L.viewFrom&&_>=L.viewTo)Hr(e);else if(t<=L.viewFrom){var N=Di(e,_,_+g,1);N?(L.view=L.view.slice(N.index),L.viewFrom=N.lineN,L.viewTo+=g):Hr(e)}else if(_>=L.viewTo){var V=Di(e,t,t,-1);V?(L.view=L.view.slice(0,V.index),L.viewTo=V.lineN):Hr(e)}else{var Q=Di(e,t,t,-1),q=Di(e,_,_+g,1);Q&&q?(L.view=L.view.slice(0,Q.index).concat(Li(e,Q.lineN,q.lineN)).concat(L.view.slice(q.index)),L.viewTo+=g):Hr(e)}var ee=L.externalMeasured;ee&&(_<ee.lineN?ee.lineN+=g:t<ee.lineN+ee.size&&(L.externalMeasured=null))}function Xr(e,t,_){e.curOp.viewChanged=!0;var g=e.display,L=e.display.externalMeasured;if(L&&t>=L.lineN&&t<L.lineN+L.size&&(g.externalMeasured=null),t<g.viewFrom||t>=g.viewTo)return;var N=g.view[on(e,t)];if(N.node==null)return;var V=N.changes||(N.changes=[]);de(V,_)==-1&&V.push(_)}function Hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Di(e,t,_,g){var L=on(e,t),N,V=e.display.view;if(!yr||_==e.doc.first+e.doc.size)return{index:L,lineN:_};for(var Q=e.display.viewFrom,q=0;q<L;q++)Q+=V[q].size;if(Q!=t){if(g>0){if(L==V.length-1)return null;N=Q+V[L].size-t,L++}else N=Q-t;t+=N,_+=N}for(;Dt(e.doc,_)!=_;){if(L==(g<0?0:V.length-1))return null;_+=g*V[L-(g<0?1:0)].size,L+=g}return{index:L,lineN:_}}function Gs(e,t,_){var g=e.display,L=g.view;L.length==0||t>=g.viewTo||_<=g.viewFrom?(g.view=Li(e,t,_),g.viewFrom=t):(g.viewFrom>t?g.view=Li(e,t,g.viewFrom).concat(g.view):g.viewFrom<t&&(g.view=g.view.slice(on(e,t))),g.viewFrom=t,g.viewTo<_?g.view=g.view.concat(Li(e,g.viewTo,_)):g.viewTo>_&&(g.view=g.view.slice(0,on(e,_)))),g.viewTo=_}function so(e){for(var t=e.display.view,_=0,g=0;g<t.length;g++){var L=t[g];!L.hidden&&(!L.node||L.changes)&&++_}return _}function $n(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var _=e.doc,g={},L=g.cursors=document.createDocumentFragment(),N=g.selection=document.createDocumentFragment(),V=0;V<_.sel.ranges.length;V++){if(!t&&V==_.sel.primIndex)continue;var Q=_.sel.ranges[V];if(Q.from().line>=e.display.viewTo||Q.to().line<e.display.viewFrom)continue;var q=Q.empty();(q||e.options.showCursorWhenSelecting)&&uo(e,Q.head,L),q||Vs(e,Q,N)}return g}function uo(e,t,_){var g=xr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),L=_.appendChild(v("div","\xA0","CodeMirror-cursor"));if(L.style.left=g.left+"px",L.style.top=g.top+"px",L.style.height=Math.max(0,g.bottom-g.top)*e.options.cursorHeight+"px",g.other){var N=_.appendChild(v("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));N.style.display="",N.style.left=g.other.left+"px",N.style.top=g.other.top+"px",N.style.height=(g.other.bottom-g.other.top)*.85+"px"}}function Oi(e,t){return e.top-t.top||e.left-t.left}function Vs(e,t,_){var g=e.display,L=e.doc,N=document.createDocumentFragment(),V=Va(e.display),Q=V.left,q=Math.max(g.sizerWidth,rn(e)-g.sizer.offsetLeft)-V.right,ee=L.direction=="ltr";function _e(ot,ut,pt,ft){ut<0&&(ut=0),ut=Math.round(ut),ft=Math.round(ft),N.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+ot+`px;
|
|
|
top: `+ut+"px; width: "+(pt==null?q-ot:pt)+`px;
|
|
|
height: `+(ft-ut)+"px"))}function we(ot,ut,pt){var ft=dt(L,ot),xt=ft.text.length,Mt,Qt;function Ut(Wt,ur){return ia(e,et(ot,Wt),"div",ft,ur)}function fr(Wt,ur,$t){var Gt=ao(e,ft,null,Wt),zt=ur=="ltr"==($t=="after")?"left":"right",Bt=$t=="after"?Gt.begin:Gt.end-(/\s/.test(ft.text.charAt(Gt.end-1))?2:1);return Ut(Bt,zt)[zt]}var lr=We(ft,L.direction);return $(lr,ut||0,pt==null?xt:pt,function(Wt,ur,$t,Gt){var zt=$t=="ltr",Bt=Ut(Wt,zt?"left":"right"),cr=Ut(ur-1,zt?"right":"left"),Fn=ut==null&&Wt==0,Yr=pt==null&&ur==xt,rr=Gt==0,Ar=!lr||Gt==lr.length-1;if(cr.top-Bt.top<=3){var qt=(ee?Fn:Yr)&&rr,Pa=(ee?Yr:Fn)&&Ar,Ir=qt?Q:(zt?Bt:cr).left,dn=Pa?q:(zt?cr:Bt).right;_e(Ir,Bt.top,dn-Ir,Bt.bottom)}else{var hn,ar,Nn,Fa;zt?(hn=ee&&Fn&&rr?Q:Bt.left,ar=ee?q:fr(Wt,$t,"before"),Nn=ee?Q:fr(ur,$t,"after"),Fa=ee&&Yr&&Ar?q:cr.right):(hn=ee?fr(Wt,$t,"before"):Q,ar=!ee&&Fn&&rr?q:Bt.right,Nn=!ee&&Yr&&Ar?Q:cr.left,Fa=ee?fr(ur,$t,"after"):q),_e(hn,Bt.top,ar-hn,Bt.bottom),Bt.bottom<cr.top&&_e(Q,Bt.bottom,null,cr.top),_e(Nn,cr.top,Fa-Nn,cr.bottom)}(!Mt||Oi(Bt,Mt)<0)&&(Mt=Bt),Oi(cr,Mt)<0&&(Mt=cr),(!Qt||Oi(Bt,Qt)<0)&&(Qt=Bt),Oi(cr,Qt)<0&&(Qt=cr)}),{start:Mt,end:Qt}}var He=t.from(),Xe=t.to();if(He.line==Xe.line)we(He.line,He.ch,Xe.ch);else{var Ye=dt(L,He.line),qe=dt(L,Xe.line),rt=ht(Ye)==ht(qe),at=we(He.line,He.ch,rt?Ye.text.length+1:null).end,lt=we(Xe.line,rt?0:null,Xe.ch).start;rt&&(at.top<lt.top-2?(_e(at.right,at.top,null,at.bottom),_e(Q,lt.top,lt.left,lt.bottom)):_e(at.right,at.top,lt.left-at.right,at.bottom)),at.bottom<lt.top&&_e(Q,at.bottom,null,lt.top)}_.appendChild(N)}function da(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var _=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||wn(e),t.cursorDiv.style.visibility=(_=!_)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),ha(e))}function ho(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,wn(e))},100)}function ha(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(be(e,"focus",e,t),e.state.focused=!0,H(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()),da(e)}function wn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,b(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Mi(e){for(var t=e.display,_=t.lineDiv.offsetTop,g=0;g<t.view.length;g++){var L=t.view[g],N=e.options.lineWrapping,V=void 0,Q=0;if(L.hidden)continue;if(S&&y<8){var q=L.node.offsetTop+L.node.offsetHeight;V=q-_,_=q}else{var ee=L.node.getBoundingClientRect();V=ee.bottom-ee.top,!N&&L.text.firstChild&&(Q=L.text.firstChild.getBoundingClientRect().right-ee.left-1)}var _e=L.line.height-V;if((_e>.005||_e<-.005)&&(vr(L.line,V),fo(L.line),L.rest))for(var we=0;we<L.rest.length;we++)fo(L.rest[we]);if(Q>e.display.sizerWidth){var He=Math.ceil(Q/Sn(e.display));He>e.display.maxLineLength&&(e.display.maxLineLength=He,e.display.maxLine=L.line,e.display.maxLineChanged=!0)}}}function fo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var _=e.widgets[t],g=_.node.parentNode;g&&(_.height=g.offsetHeight)}}function Ii(e,t,_){var g=_&&_.top!=null?Math.max(0,_.top):e.scroller.scrollTop;g=Math.floor(g-ki(e));var L=_&&_.bottom!=null?_.bottom:g+e.wrapper.clientHeight,N=kr(t,g),V=kr(t,L);if(_&&_.ensure){var Q=_.ensure.from.line,q=_.ensure.to.line;Q<N?(N=Q,V=kr(t,Ft(dt(t,Q))+e.wrapper.clientHeight)):Math.min(q,t.lastLine())>=V&&(N=kr(t,Ft(dt(t,q))-e.wrapper.clientHeight),V=q)}return{from:N,to:Math.max(V,N+1)}}function Ys(e,t){if(Re(e,"scrollCursorIntoView"))return;var _=e.display,g=_.sizer.getBoundingClientRect(),L=null;if(t.top+g.top<0?L=!0:t.bottom+g.top>(window.innerHeight||document.documentElement.clientHeight)&&(L=!1),L!=null&&!r){var N=v("div","\u200B",null,`position: absolute;
|
|
|
top: `+(t.top-_.viewOffset-ki(e.display))+`px;
|
|
|
height: `+(t.bottom-t.top+Tr(e)+_.barHeight)+`px;
|
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(N),N.scrollIntoView(L),e.display.lineSpace.removeChild(N)}}function Qs(e,t,_,g){g==null&&(g=0);var L;!e.options.lineWrapping&&t==_&&(t=t.ch?et(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,_=t.sticky=="before"?et(t.line,t.ch+1,"before"):t);for(var N=0;N<5;N++){var V=!1,Q=xr(e,t),q=!_||_==t?Q:xr(e,_);L={left:Math.min(Q.left,q.left),top:Math.min(Q.top,q.top)-g,right:Math.max(Q.left,q.left),bottom:Math.max(Q.bottom,q.bottom)+g};var ee=fa(e,L),_e=e.doc.scrollTop,we=e.doc.scrollLeft;if(ee.scrollTop!=null&&(ei(e,ee.scrollTop),Math.abs(e.doc.scrollTop-_e)>1&&(V=!0)),ee.scrollLeft!=null&&(sn(e,ee.scrollLeft),Math.abs(e.doc.scrollLeft-we)>1&&(V=!0)),!V)break}return L}function qs(e,t){var _=fa(e,t);_.scrollTop!=null&&ei(e,_.scrollTop),_.scrollLeft!=null&&sn(e,_.scrollLeft)}function fa(e,t){var _=e.display,g=En(e.display);t.top<0&&(t.top=0);var L=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:_.scroller.scrollTop,N=ta(e),V={};t.bottom-t.top>N&&(t.bottom=t.top+N);var Q=e.doc.height+ea(_),q=t.top<g,ee=t.bottom>Q-g;if(t.top<L)V.scrollTop=q?0:t.top;else if(t.bottom>L+N){var _e=Math.min(t.top,(ee?Q:t.bottom)-N);_e!=L&&(V.scrollTop=_e)}var we=e.options.fixedGutter?0:_.gutters.offsetWidth,He=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:_.scroller.scrollLeft-we,Xe=rn(e)-_.gutters.offsetWidth,Ye=t.right-t.left>Xe;return Ye&&(t.right=t.left+Xe),t.left<10?V.scrollLeft=0:t.left<He?V.scrollLeft=Math.max(0,t.left+we-(Ye?0:10)):t.right>Xe+He-3&&(V.scrollLeft=t.right+(Ye?0:10)-Xe),V}function pa(e,t){if(t==null)return;Pi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Tn(e){Pi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Jn(e,t,_){(t!=null||_!=null)&&Pi(e),t!=null&&(e.curOp.scrollLeft=t),_!=null&&(e.curOp.scrollTop=_)}function Zs(e,t){Pi(e),e.curOp.scrollToPos=t}function Pi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var _=no(e,t.from),g=no(e,t.to);po(e,_,g,t.margin)}}function po(e,t,_,g){var L=fa(e,{left:Math.min(t.left,_.left),top:Math.min(t.top,_.top)-g,right:Math.max(t.right,_.right),bottom:Math.max(t.bottom,_.bottom)+g});Jn(e,L.scrollLeft,L.scrollTop)}function ei(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||ga(e,{top:t}),mo(e,t,!0),D&&ga(e),ni(e,100)}function mo(e,t,_){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!_)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function sn(e,t,_,g){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(_?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!g)return;e.doc.scrollLeft=t,bo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ti(e){var t=e.display,_=t.gutters.offsetWidth,g=Math.round(e.doc.height+ea(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?_:0,docHeight:g,scrollHeight:g+Tr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:_}}var ln=function(e,t,_){this.cm=_;var g=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),L=this.horiz=v("div",[v("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");g.tabIndex=L.tabIndex=-1,e(g),e(L),Pe(g,"scroll",function(){g.clientHeight&&t(g.scrollTop,"vertical")}),Pe(L,"scroll",function(){L.clientWidth&&t(L.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,S&&y<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ln.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,_=e.scrollHeight>e.clientHeight+1,g=e.nativeBarWidth;if(_){this.vert.style.display="block",this.vert.style.bottom=t?g+"px":"0";var L=e.viewHeight-(t?g:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+L)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=_?g+"px":"0",this.horiz.style.left=e.barLeft+"px";var N=e.viewWidth-e.barLeft-(_?g:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+N)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(g==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:_?g:0,bottom:t?g:0}},ln.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ln.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ln.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 te,this.disableVert=new te},ln.prototype.enableZeroWidthBar=function(e,t,_){e.style.pointerEvents="auto";function g(){var L=e.getBoundingClientRect(),N=_=="vert"?document.elementFromPoint(L.right-1,(L.top+L.bottom)/2):document.elementFromPoint((L.right+L.left)/2,L.bottom-1);N!=e?e.style.pointerEvents="none":t.set(1e3,g)}t.set(1e3,g)},ln.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ri=function(){};ri.prototype.update=function(){return{bottom:0,right:0}},ri.prototype.setScrollLeft=function(){},ri.prototype.setScrollTop=function(){},ri.prototype.clear=function(){};function Cn(e,t){t||(t=ti(e));var _=e.display.barWidth,g=e.display.barHeight;go(e,t);for(var L=0;L<4&&_!=e.display.barWidth||g!=e.display.barHeight;L++)_!=e.display.barWidth&&e.options.lineWrapping&&Mi(e),go(e,ti(e)),_=e.display.barWidth,g=e.display.barHeight}function go(e,t){var _=e.display,g=_.scrollbars.update(t);_.sizer.style.paddingRight=(_.barWidth=g.right)+"px",_.sizer.style.paddingBottom=(_.barHeight=g.bottom)+"px",_.heightForcer.style.borderBottom=g.bottom+"px solid transparent",g.right&&g.bottom?(_.scrollbarFiller.style.display="block",_.scrollbarFiller.style.height=g.bottom+"px",_.scrollbarFiller.style.width=g.right+"px"):_.scrollbarFiller.style.display="",g.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(_.gutterFiller.style.display="block",_.gutterFiller.style.height=g.bottom+"px",_.gutterFiller.style.width=t.gutterWidth+"px"):_.gutterFiller.style.display=""}var vo={native:ln,null:ri};function _o(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&b(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Pe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,_){_=="horizontal"?sn(e,t):ei(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var $s=0;function un(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},ks(e.curOp)}function cn(e){var t=e.curOp;t&&Ds(t,function(_){for(var g=0;g<_.ops.length;g++)_.ops[g].cm.curOp=null;Js(_)})}function Js(e){for(var t=e.ops,_=0;_<t.length;_++)el(t[_]);for(var g=0;g<t.length;g++)tl(t[g]);for(var L=0;L<t.length;L++)rl(t[L]);for(var N=0;N<t.length;N++)nl(t[N]);for(var V=0;V<t.length;V++)il(t[V])}function el(e){var t=e.cm,_=t.display;ol(t),e.updateMaxLine&&br(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<_.viewFrom||e.scrollToPos.to.line>=_.viewTo)||_.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Fi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&ma(e.cm,e.update)}function rl(e){var t=e.cm,_=t.display;e.updatedDisplay&&Mi(t),e.barMeasure=ti(t),_.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qa(t,_.maxLine,_.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(_.scroller.clientWidth,_.sizer.offsetLeft+e.adjustWidthTo+Tr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,_.sizer.offsetLeft+e.adjustWidthTo-rn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=_.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var _=e.focus&&e.focus==B();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,_),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Cn(t,e.barMeasure),e.updatedDisplay&&_a(t,e.barMeasure),e.selectionChanged&&da(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),_&&co(e.cm)}function il(e){var t=e.cm,_=t.display,g=t.doc;if(e.updatedDisplay&&yo(t,e.update),_.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(_.wheelStartX=_.wheelStartY=null),e.scrollTop!=null&&mo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sn(t,e.scrollLeft,!0,!0),e.scrollToPos){var L=Qs(t,gt(g,e.scrollToPos.from),gt(g,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,L)}var N=e.maybeHiddenMarkers,V=e.maybeUnhiddenMarkers;if(N)for(var Q=0;Q<N.length;++Q)N[Q].lines.length||be(N[Q],"hide");if(V)for(var q=0;q<V.length;++q)V[q].lines.length&&be(V[q],"unhide");_.wrapper.offsetHeight&&(g.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function hr(e,t){if(e.curOp)return t();un(e);try{return t()}finally{cn(e)}}function Vt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);un(e);try{return t.apply(e,arguments)}finally{cn(e)}}}function ir(e){return function(){if(this.curOp)return e.apply(this,arguments);un(this);try{return e.apply(this,arguments)}finally{cn(this)}}}function Yt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);un(t);try{return e.apply(this,arguments)}finally{cn(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,U(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var _=+new Date+e.options.workTime,g=dr(e,t.highlightFrontier),L=[];t.iter(g.line,Math.min(t.first+t.size,e.display.viewTo+500),function(N){if(g.line>=e.display.viewFrom){var V=N.styles,Q=N.text.length>e.options.maxHighlightLength?Ct(t.mode,g.state):null,q=yi(e,N,g,!0);Q&&(g.state=Q),N.styles=q.styles;var ee=N.styleClasses,_e=q.classes;_e?N.styleClasses=_e:ee&&(N.styleClasses=null);for(var we=!V||V.length!=N.styles.length||ee!=_e&&(!ee||!_e||ee.bgClass!=_e.bgClass||ee.textClass!=_e.textClass),He=0;!we&&He<V.length;++He)we=V[He]!=N.styles[He];we&&L.push(g.line),N.stateAfter=g.save(),g.nextLine()}else N.text.length<=e.options.maxHighlightLength&&mn(e,N.text,g),N.stateAfter=g.line%5==0?g.save():null,g.nextLine();if(+new Date>_)return ni(e,e.options.workDelay),!0}),t.highlightFrontier=g.line,t.modeFrontier=Math.max(t.modeFrontier,g.line),L.length&&hr(e,function(){for(var N=0;N<L.length;N++)Xr(e,L[N],"text")})}var Fi=function(e,t,_){var g=e.display;this.viewport=t,this.visible=Ii(g,e.doc,t),this.editorIsHidden=!g.wrapper.offsetWidth,this.wrapperHeight=g.wrapper.clientHeight,this.wrapperWidth=g.wrapper.clientWidth,this.oldDisplayWidth=rn(e),this.force=_,this.dims=la(e),this.events=[]};Fi.prototype.signal=function(e,t){se(e,t)&&this.events.push(arguments)},Fi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Tr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Tr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=B();if(!t||!P(e.display.lineDiv,t))return null;var _={activeElt:t};if(window.getSelection){var g=window.getSelection();g.anchorNode&&g.extend&&P(e.display.lineDiv,g.anchorNode)&&(_.anchorNode=g.anchorNode,_.anchorOffset=g.anchorOffset,_.focusNode=g.focusNode,_.focusOffset=g.focusOffset)}return _}function ll(e){if(!e||!e.activeElt||e.activeElt==B())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&P(document.body,e.anchorNode)&&P(document.body,e.focusNode)){var t=window.getSelection(),_=document.createRange();_.setEnd(e.anchorNode,e.anchorOffset),_.collapse(!1),t.removeAllRanges(),t.addRange(_),t.extend(e.focusNode,e.focusOffset)}}function ma(e,t){var _=e.display,g=e.doc;if(t.editorIsHidden)return Hr(e),!1;if(!t.force&&t.visible.from>=_.viewFrom&&t.visible.to<=_.viewTo&&(_.updateLineNumbers==null||_.updateLineNumbers>=_.viewTo)&&_.renderedView==_.view&&so(e)==0)return!1;xo(e)&&(Hr(e),t.dims=la(e));var L=g.first+g.size,N=Math.max(t.visible.from-e.options.viewportMargin,g.first),V=Math.min(L,t.visible.to+e.options.viewportMargin);_.viewFrom<N&&N-_.viewFrom<20&&(N=Math.max(g.first,_.viewFrom)),_.viewTo>V&&_.viewTo-V<20&&(V=Math.min(L,_.viewTo)),yr&&(N=Dt(e.doc,N),V=Ot(e.doc,V));var Q=N!=_.viewFrom||V!=_.viewTo||_.lastWrapHeight!=t.wrapperHeight||_.lastWrapWidth!=t.wrapperWidth;Gs(e,N,V),_.viewOffset=Ft(dt(e.doc,_.viewFrom)),e.display.mover.style.top=_.viewOffset+"px";var q=so(e);if(!Q&&q==0&&!t.force&&_.renderedView==_.view&&(_.updateLineNumbers==null||_.updateLineNumbers>=_.viewTo))return!1;var ee=sl(e);return q>4&&(_.lineDiv.style.display="none"),ul(e,_.updateLineNumbers,t.dims),q>4&&(_.lineDiv.style.display=""),_.renderedView=_.view,ll(ee),E(_.cursorDiv),E(_.selectionDiv),_.gutters.style.height=_.sizer.style.minHeight=0,Q&&(_.lastWrapHeight=t.wrapperHeight,_.lastWrapWidth=t.wrapperWidth,ni(e,400)),_.updateLineNumbers=null,!0}function yo(e,t){for(var _=t.viewport,g=!0;;g=!1){if(!g||!e.options.lineWrapping||t.oldDisplayWidth==rn(e)){if(_&&_.top!=null&&(_={top:Math.min(e.doc.height+ea(e.display)-ta(e),_.top)}),t.visible=Ii(e.display,e.doc,_),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else g&&(t.visible=Ii(e.display,e.doc,_));if(!ma(e,t))break;Mi(e);var L=ti(e);$n(e),Cn(e,L),_a(e,L),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var _=new Fi(e,t);if(ma(e,_)){Mi(e),yo(e,_);var g=ti(e);$n(e),Cn(e,g),_a(e,g),_.finish()}}function ul(e,t,_){var g=e.display,L=e.options.lineNumbers,N=g.lineDiv,V=N.firstChild;function Q(Ye){var qe=Ye.nextSibling;return p&&h&&e.display.currentWheelTarget==Ye?Ye.style.display="none":Ye.parentNode.removeChild(Ye),qe}for(var q=g.view,ee=g.viewFrom,_e=0;_e<q.length;_e++){var we=q[_e];if(!we.hidden)if(!we.node||we.node.parentNode!=N){var He=Fs(e,we,ee,_);N.insertBefore(He,V)}else{for(;V!=we.node;)V=Q(V);var Xe=L&&t!=null&&t<=ee&&we.lineNumber;we.changes&&(de(we.changes,"gutter")>-1&&(Xe=!1),Ha(e,we,ee,_)),Xe&&(E(we.lineNumber),we.lineNumber.appendChild(document.createTextNode(Qr(e.options,ee)))),V=we.node.nextSibling}ee+=we.size}for(;V;)V=Q(V)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function _a(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Tr(e)+"px"}function bo(e){var t=e.display,_=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var g=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,L=t.gutters.offsetWidth,N=g+"px",V=0;V<_.length;V++)if(!_[V].hidden){e.options.fixedGutter&&(_[V].gutter&&(_[V].gutter.style.left=N),_[V].gutterBackground&&(_[V].gutterBackground.style.left=N));var Q=_[V].alignable;if(Q)for(var q=0;q<Q.length;q++)Q[q].style.left=N}e.options.fixedGutter&&(t.gutters.style.left=g+L+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,_=Qr(e.options,t.first+t.size-1),g=e.display;if(_.length!=g.lineNumChars){var L=g.measure.appendChild(v("div",[v("div",_)],"CodeMirror-linenumber CodeMirror-gutter-elt")),N=L.firstChild.offsetWidth,V=L.offsetWidth-N;return g.lineGutter.style.width="",g.lineNumInnerWidth=Math.max(N,g.lineGutter.offsetWidth-V)+1,g.lineNumWidth=g.lineNumInnerWidth+V,g.lineNumChars=g.lineNumInnerWidth?_.length:-1,g.lineGutter.style.width=g.lineNumWidth+"px",va(e.display),!0}return!1}function ya(e,t){for(var _=[],g=!1,L=0;L<e.length;L++){var N=e[L],V=null;if(typeof N!="string"&&(V=N.style,N=N.className),N=="CodeMirror-linenumbers")if(t)g=!0;else continue;_.push({className:N,style:V})}return t&&!g&&_.push({className:"CodeMirror-linenumbers",style:null}),_}function Eo(e){var t=e.gutters,_=e.gutterSpecs;E(t),e.lineGutter=null;for(var g=0;g<_.length;++g){var L=_[g],N=L.className,V=L.style,Q=t.appendChild(v("div",null,"CodeMirror-gutter "+N));V&&(Q.style.cssText=V),N=="CodeMirror-linenumbers"&&(e.lineGutter=Q,Q.style.width=(e.lineNumWidth||1)+"px")}t.style.display=_.length?"":"none",va(e)}function ii(e){Eo(e.display),or(e),bo(e)}function cl(e,t,_,g){var L=this;this.input=_,L.scrollbarFiller=v("div",null,"CodeMirror-scrollbar-filler"),L.scrollbarFiller.setAttribute("cm-not-content","true"),L.gutterFiller=v("div",null,"CodeMirror-gutter-filler"),L.gutterFiller.setAttribute("cm-not-content","true"),L.lineDiv=M("div",null,"CodeMirror-code"),L.selectionDiv=v("div",null,null,"position: relative; z-index: 1"),L.cursorDiv=v("div",null,"CodeMirror-cursors"),L.measure=v("div",null,"CodeMirror-measure"),L.lineMeasure=v("div",null,"CodeMirror-measure"),L.lineSpace=M("div",[L.measure,L.lineMeasure,L.selectionDiv,L.cursorDiv,L.lineDiv],null,"position: relative; outline: none");var N=M("div",[L.lineSpace],"CodeMirror-lines");L.mover=v("div",[N],null,"position: relative"),L.sizer=v("div",[L.mover],"CodeMirror-sizer"),L.sizerWidth=null,L.heightForcer=v("div",null,null,"position: absolute; height: "+ge+"px; width: 1px;"),L.gutters=v("div",null,"CodeMirror-gutters"),L.lineGutter=null,L.scroller=v("div",[L.sizer,L.heightForcer,L.gutters],"CodeMirror-scroll"),L.scroller.setAttribute("tabIndex","-1"),L.wrapper=v("div",[L.scrollbarFiller,L.gutterFiller,L.scroller],"CodeMirror"),S&&y<8&&(L.gutters.style.zIndex=-1,L.scroller.style.paddingRight=0),!p&&!(D&&i)&&(L.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(L.wrapper):e(L.wrapper)),L.viewFrom=L.viewTo=t.first,L.reportedViewFrom=L.reportedViewTo=t.first,L.view=[],L.renderedView=null,L.externalMeasured=null,L.viewOffset=0,L.lastWrapHeight=L.lastWrapWidth=0,L.updateLineNumbers=null,L.nativeBarWidth=L.barHeight=L.barWidth=0,L.scrollbarsClipped=!1,L.lineNumWidth=L.lineNumInnerWidth=L.lineNumChars=null,L.alignWidgets=!1,L.cachedCharWidth=L.cachedTextHeight=L.cachedPaddingH=null,L.maxLine=null,L.maxLineLength=0,L.maxLineChanged=!1,L.wheelDX=L.wheelDY=L.wheelStartX=L.wheelStartY=null,L.shift=!1,L.selForContextMenu=null,L.activeTouch=null,L.gutterSpecs=ya(g.gutters,g.lineNumbers),Eo(L),_.init(L)}var Ni=0,mr=null;S?mr=-.53:D?mr=15:o?mr=-.7:s&&(mr=-1/3);function So(e){var t=e.wheelDeltaX,_=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),_==null&&e.detail&&e.axis==e.VERTICAL_AXIS?_=e.detail:_==null&&(_=e.wheelDelta),{x:t,y:_}}function dl(e){var t=So(e);return t.x*=mr,t.y*=mr,t}function wo(e,t){var _=So(t),g=_.x,L=_.y,N=e.display,V=N.scroller,Q=V.scrollWidth>V.clientWidth,q=V.scrollHeight>V.clientHeight;if(!(g&&Q||L&&q))return;if(L&&h&&p){e:for(var ee=t.target,_e=N.view;ee!=V;ee=ee.parentNode)for(var we=0;we<_e.length;we++)if(_e[we].node==ee){e.display.currentWheelTarget=ee;break e}}if(g&&!D&&!d&&mr!=null){L&&q&&ei(e,Math.max(0,V.scrollTop+L*mr)),sn(e,Math.max(0,V.scrollLeft+g*mr)),(!L||L&&q)&&Y(t),N.wheelStartX=null;return}if(L&&mr!=null){var He=L*mr,Xe=e.doc.scrollTop,Ye=Xe+N.wrapper.clientHeight;He<0?Xe=Math.max(0,Xe+He-50):Ye=Math.min(e.doc.height,Ye+He+50),ga(e,{top:Xe,bottom:Ye})}Ni<20&&(N.wheelStartX==null?(N.wheelStartX=V.scrollLeft,N.wheelStartY=V.scrollTop,N.wheelDX=g,N.wheelDY=L,setTimeout(function(){if(N.wheelStartX==null)return;var qe=V.scrollLeft-N.wheelStartX,rt=V.scrollTop-N.wheelStartY,at=rt&&N.wheelDY&&rt/N.wheelDY||qe&&N.wheelDX&&qe/N.wheelDX;if(N.wheelStartX=N.wheelStartY=null,!at)return;mr=(mr*Ni+at)/(Ni+1),++Ni},200)):(N.wheelDX+=g,N.wheelDY+=L))}var gr=function(e,t){this.ranges=e,this.primIndex=t};gr.prototype.primary=function(){return this.ranges[this.primIndex]},gr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var _=this.ranges[t],g=e.ranges[t];if(!it(_.anchor,g.anchor)||!it(_.head,g.head))return!1}return!0},gr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(Un(this.ranges[t].anchor),Un(this.ranges[t].head));return new gr(e,this.primIndex)},gr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},gr.prototype.contains=function(e,t){t||(t=e);for(var _=0;_<this.ranges.length;_++){var g=this.ranges[_];if(vt(t,g.from())>=0&&vt(e,g.to())<=0)return _}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return qr(this.anchor,this.head)},At.prototype.to=function(){return pn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,_){var g=e&&e.options.selectionsMayTouch,L=t[_];t.sort(function(He,Xe){return vt(He.from(),Xe.from())}),_=de(t,L);for(var N=1;N<t.length;N++){var V=t[N],Q=t[N-1],q=vt(Q.to(),V.from());if(g&&!V.empty()?q>0:q>=0){var ee=qr(Q.from(),V.from()),_e=pn(Q.to(),V.to()),we=Q.empty()?V.from()==V.head:Q.from()==Q.head;N<=_&&--_,t.splice(--N,2,new At(we?_e:ee,we?ee:_e))}}return new gr(t,_)}function jr(e,t){return new gr([new At(e,t||e)],0)}function Wr(e){return e.text?et(e.from.line+e.text.length-1,re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function To(e,t){if(vt(e,t.from)<0)return e;if(vt(e,t.to)<=0)return Wr(t);var _=e.line+t.text.length-(t.to.line-t.from.line)-1,g=e.ch;return e.line==t.to.line&&(g+=Wr(t).ch-t.to.ch),et(_,g)}function ba(e,t){for(var _=[],g=0;g<e.sel.ranges.length;g++){var L=e.sel.ranges[g];_.push(new At(To(L.anchor,t),To(L.head,t)))}return Er(e.cm,_,e.sel.primIndex)}function Co(e,t,_){return e.line==t.line?et(_.line,e.ch-t.ch+_.ch):et(_.line+(e.line-t.line),e.ch)}function hl(e,t,_){for(var g=[],L=et(e.first,0),N=L,V=0;V<t.length;V++){var Q=t[V],q=Co(Q.from,L,N),ee=Co(Wr(Q),L,N);if(L=Q.to,N=ee,_=="around"){var _e=e.sel.ranges[V],we=vt(_e.head,_e.anchor)<0;g[V]=new At(we?ee:q,we?q:ee)}else g[V]=new At(q,q)}return new gr(g,e.sel.primIndex)}function xa(e){e.doc.mode=Xt(e.options,e.doc.modeOption),ai(e)}function ai(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&or(e)}function Ao(e,t){return t.from.ch==0&&t.to.ch==0&&re(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ea(e,t,_,g){function L(lt){return _?_[lt]:null}function N(lt,ot,ut){Ur(lt,ot,ut,g),Zt(lt,"change",lt,t)}function V(lt,ot){for(var ut=[],pt=lt;pt<ot;++pt)ut.push(new Pt(ee[pt],L(pt),g));return ut}var Q=t.from,q=t.to,ee=t.text,_e=dt(e,Q.line),we=dt(e,q.line),He=re(ee),Xe=L(ee.length-1),Ye=q.line-Q.line;if(t.full)e.insert(0,V(0,ee.length)),e.remove(ee.length,e.size-ee.length);else if(Ao(e,t)){var qe=V(0,ee.length-1);N(we,we.text,Xe),Ye&&e.remove(Q.line,Ye),qe.length&&e.insert(Q.line,qe)}else if(_e==we)if(ee.length==1)N(_e,_e.text.slice(0,Q.ch)+He+_e.text.slice(q.ch),Xe);else{var rt=V(1,ee.length-1);rt.push(new Pt(He+_e.text.slice(q.ch),Xe,g)),N(_e,_e.text.slice(0,Q.ch)+ee[0],L(0)),e.insert(Q.line+1,rt)}else if(ee.length==1)N(_e,_e.text.slice(0,Q.ch)+ee[0]+we.text.slice(q.ch),L(0)),e.remove(Q.line+1,Ye);else{N(_e,_e.text.slice(0,Q.ch)+ee[0],L(0)),N(we,He+we.text.slice(q.ch),Xe);var at=V(1,ee.length-1);Ye>1&&e.remove(Q.line+1,Ye-1),e.insert(Q.line+1,at)}Zt(e,"change",e,t)}function zr(e,t,_){function g(L,N,V){if(L.linked)for(var Q=0;Q<L.linked.length;++Q){var q=L.linked[Q];if(q.doc==N)continue;var ee=V&&q.sharedHist;if(_&&!ee)continue;t(q.doc,ee),g(q.doc,L,ee)}}g(e,null,!0)}function Lo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,ca(e),xa(e),ko(e),e.options.lineWrapping||br(e),e.options.mode=t.modeOption,or(e)}function ko(e){(e.doc.direction=="rtl"?H:b)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){hr(e,function(){ko(e),or(e)})}function Ui(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Sa(e,t){var _={from:Un(t.from),to:Wr(t),text:Lr(e,t.from,t.to)};return Oo(e,_,t.from.line,t.to.line+1),zr(e,function(g){return Oo(g,_,t.from.line,t.to.line+1)},!0),_}function Ro(e){for(;e.length;){var t=re(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Ro(e.done),re(e.done);if(e.done.length&&!re(e.done).ranges)return re(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),re(e.done)}function Do(e,t,_,g){var L=e.history;L.undone.length=0;var N=+new Date,V,Q;if((L.lastOp==g||L.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&L.lastModTime>N-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(V=pl(L,L.lastOp==g)))Q=re(V.changes),vt(t.from,t.to)==0&&vt(t.from,Q.to)==0?Q.to=Wr(t):V.changes.push(Sa(e,t));else{var q=re(L.done);for((!q||!q.ranges)&&Ki(e.sel,L.done),V={changes:[Sa(e,t)],generation:L.generation},L.done.push(V);L.done.length>L.undoDepth;)L.done.shift(),L.done[0].ranges||L.done.shift()}L.done.push(_),L.generation=++L.maxGeneration,L.lastModTime=L.lastSelTime=N,L.lastOp=L.lastSelOp=g,L.lastOrigin=L.lastSelOrigin=t.origin,Q||be(e,"historyAdded")}function ml(e,t,_,g){var L=t.charAt(0);return L=="*"||L=="+"&&_.ranges.length==g.ranges.length&&_.somethingSelected()==g.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,_,g){var L=e.history,N=g&&g.origin;_==L.lastSelOp||N&&L.lastSelOrigin==N&&(L.lastModTime==L.lastSelTime&&L.lastOrigin==N||ml(e,N,re(L.done),t))?L.done[L.done.length-1]=t:Ki(t,L.done),L.lastSelTime=+new Date,L.lastSelOrigin=N,L.lastSelOp=_,g&&g.clearRedo!==!1&&Ro(L.undone)}function Ki(e,t){var _=re(t);_&&_.ranges&&_.equals(e)||t.push(e)}function Oo(e,t,_,g){var L=t["spans_"+e.id],N=0;e.iter(Math.max(e.first,_),Math.min(e.first+e.size,g),function(V){V.markedSpans&&((L||(L=t["spans_"+e.id]={}))[N]=V.markedSpans),++N})}function vl(e){if(!e)return null;for(var t,_=0;_<e.length;++_)e[_].marker.explicitlyCleared?t||(t=e.slice(0,_)):t&&t.push(e[_]);return t?t.length?t:null:e}function _l(e,t){var _=t["spans_"+e.id];if(!_)return null;for(var g=[],L=0;L<t.text.length;++L)g.push(vl(_[L]));return g}function Mo(e,t){var _=_l(e,t),g=Nr(e,t);if(!_)return g;if(!g)return _;for(var L=0;L<_.length;++L){var N=_[L],V=g[L];if(N&&V){e:for(var Q=0;Q<V.length;++Q){for(var q=V[Q],ee=0;ee<N.length;++ee)if(N[ee].marker==q.marker)continue e;N.push(q)}}else V&&(_[L]=V)}return _}function An(e,t,_){for(var g=[],L=0;L<e.length;++L){var N=e[L];if(N.ranges){g.push(_?gr.prototype.deepCopy.call(N):N);continue}var V=N.changes,Q=[];g.push({changes:Q});for(var q=0;q<V.length;++q){var ee=V[q],_e=void 0;if(Q.push({from:ee.from,to:ee.to,text:ee.text}),t)for(var we in ee)(_e=we.match(/^spans_(\d+)$/))&&(de(t,Number(_e[1]))>-1&&(re(Q)[we]=ee[we],delete ee[we]))}}return g}function wa(e,t,_,g){if(g){var L=e.anchor;if(_){var N=vt(t,L)<0;N!=vt(_,L)<0?(L=t,t=_):N!=vt(t,_)<0&&(t=_)}return new At(L,t)}else return new At(_||t,t)}function Bi(e,t,_,g,L){L==null&&(L=e.cm&&(e.cm.display.shift||e.extend)),tr(e,new gr([wa(e.sel.primary(),t,_,L)],0),g)}function Io(e,t,_){for(var g=[],L=e.cm&&(e.cm.display.shift||e.extend),N=0;N<e.sel.ranges.length;N++)g[N]=wa(e.sel.ranges[N],t[N],null,L);var V=Er(e.cm,g,e.sel.primIndex);tr(e,V,_)}function Ta(e,t,_,g){var L=e.sel.ranges.slice(0);L[t]=_,tr(e,Er(e.cm,L,e.sel.primIndex),g)}function Po(e,t,_,g){tr(e,jr(t,_),g)}function yl(e,t,_){var g={ranges:t.ranges,update:function(L){this.ranges=[];for(var N=0;N<L.length;N++)this.ranges[N]=new At(gt(e,L[N].anchor),gt(e,L[N].head))},origin:_&&_.origin};return be(e,"beforeSelectionChange",e,g),e.cm&&be(e.cm,"beforeSelectionChange",e.cm,g),g.ranges!=t.ranges?Er(e.cm,g.ranges,g.ranges.length-1):t}function Fo(e,t,_){var g=e.history.done,L=re(g);L&&L.ranges?(g[g.length-1]=t,Xi(e,t,_)):tr(e,t,_)}function tr(e,t,_){Xi(e,t,_),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,_)}function Xi(e,t,_){(se(e,"beforeSelectionChange")||e.cm&&se(e.cm,"beforeSelectionChange"))&&(t=yl(e,t,_));var g=_&&_.bias||(vt(t.primary().head,e.sel.primary().head)<0?-1:1);No(e,Ko(e,t,g,!0)),!(_&&_.scroll===!1)&&e.cm&&Tn(e.cm)}function No(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,le(e.cm)),Zt(e,"cursorActivity",e)}function Uo(e){No(e,Ko(e,e.sel,null,!1))}function Ko(e,t,_,g){for(var L,N=0;N<t.ranges.length;N++){var V=t.ranges[N],Q=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[N],q=Hi(e,V.anchor,Q&&Q.anchor,_,g),ee=Hi(e,V.head,Q&&Q.head,_,g);(L||q!=V.anchor||ee!=V.head)&&(L||(L=t.ranges.slice(0,N)),L[N]=new At(q,ee))}return L?Er(e.cm,L,t.primIndex):t}function Ln(e,t,_,g,L){var N=dt(e,t.line);if(N.markedSpans)for(var V=0;V<N.markedSpans.length;++V){var Q=N.markedSpans[V],q=Q.marker,ee="selectLeft"in q?!q.selectLeft:q.inclusiveLeft,_e="selectRight"in q?!q.selectRight:q.inclusiveRight;if((Q.from==null||(ee?Q.from<=t.ch:Q.from<t.ch))&&(Q.to==null||(_e?Q.to>=t.ch:Q.to>t.ch))){if(L&&(be(q,"beforeCursorEnter"),q.explicitlyCleared))if(N.markedSpans){--V;continue}else break;if(!q.atomic)continue;if(_){var we=q.find(g<0?1:-1),He=void 0;if((g<0?_e:ee)&&(we=Bo(e,we,-g,we&&we.line==t.line?N:null)),we&&we.line==t.line&&(He=vt(we,_))&&(g<0?He<0:He>0))return Ln(e,we,t,g,L)}var Xe=q.find(g<0?-1:1);return(g<0?ee:_e)&&(Xe=Bo(e,Xe,g,Xe.line==t.line?N:null)),Xe?Ln(e,Xe,t,g,L):null}}return t}function Hi(e,t,_,g,L){var N=g||1,V=Ln(e,t,_,N,L)||!L&&Ln(e,t,_,N,!0)||Ln(e,t,_,-N,L)||!L&&Ln(e,t,_,-N,!0);return V||(e.cantEdit=!0,et(e.first,0))}function Bo(e,t,_,g){return _<0&&t.ch==0?t.line>e.first?gt(e,et(t.line-1)):null:_>0&&t.ch==(g||dt(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+_)}function Xo(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),Me)}function Ho(e,t,_){var g={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return g.canceled=!0}};return _&&(g.update=function(L,N,V,Q){L&&(g.from=gt(e,L)),N&&(g.to=gt(e,N)),V&&(g.text=V),Q!==void 0&&(g.origin=Q)}),be(e,"beforeChange",e,g),e.cm&&be(e.cm,"beforeChange",e.cm,g),g.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:g.from,to:g.to,text:g.text,origin:g.origin}}function kn(e,t,_){if(e.cm){if(!e.cm.curOp)return Vt(e.cm,kn)(e,t,_);if(e.cm.state.suppressEdits)return}if((se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var g=Ei&&!_&&Ti(e,t.from,t.to);if(g)for(var L=g.length-1;L>=0;--L)jo(e,{from:g[L].from,to:g[L].to,text:L?[""]:t.text,origin:t.origin});else jo(e,t)}function jo(e,t){if(t.text.length==1&&t.text[0]==""&&vt(t.from,t.to)==0)return;var _=ba(e,t);Do(e,t,_,e.cm?e.cm.curOp.id:NaN),oi(e,t,_,Nr(e,t));var g=[];zr(e,function(L,N){!N&&de(g,L.history)==-1&&(Vo(L.history,t),g.push(L.history)),oi(L,t,null,Nr(L,t))})}function ji(e,t,_){var g=e.cm&&e.cm.state.suppressEdits;if(g&&!_)return;for(var L=e.history,N,V=e.sel,Q=t=="undo"?L.done:L.undone,q=t=="undo"?L.undone:L.done,ee=0;ee<Q.length&&!(N=Q[ee],_?N.ranges&&!N.equals(e.sel):!N.ranges);ee++);if(ee==Q.length)return;for(L.lastOrigin=L.lastSelOrigin=null;;)if(N=Q.pop(),N.ranges){if(Ki(N,q),_&&!N.equals(e.sel)){tr(e,N,{clearRedo:!1});return}V=N}else if(g){Q.push(N);return}else break;var _e=[];Ki(V,q),q.push({changes:_e,generation:L.generation}),L.generation=N.generation||++L.maxGeneration;for(var we=se(e,"beforeChange")||e.cm&&se(e.cm,"beforeChange"),He=function(qe){var rt=N.changes[qe];if(rt.origin=t,we&&!Ho(e,rt,!1))return Q.length=0,{};_e.push(Sa(e,rt));var at=qe?ba(e,rt):re(Q);oi(e,rt,at,Mo(e,rt)),!qe&&e.cm&&e.cm.scrollIntoView({from:rt.from,to:Wr(rt)});var lt=[];zr(e,function(ot,ut){!ut&&de(lt,ot.history)==-1&&(Vo(ot.history,rt),lt.push(ot.history)),oi(ot,rt,null,Mo(ot,rt))})},Xe=N.changes.length-1;Xe>=0;--Xe){var Ye=He(Xe);if(Ye)return Ye.v}}function Wo(e,t){if(t==0)return;if(e.first+=t,e.sel=new gr(pe(e.sel.ranges,function(L){return new At(et(L.anchor.line+t,L.anchor.ch),et(L.head.line+t,L.head.ch))}),e.sel.primIndex),e.cm){or(e.cm,e.first,e.first-t,t);for(var _=e.cm.display,g=_.viewFrom;g<_.viewTo;g++)Xr(e.cm,g,"gutter")}}function oi(e,t,_,g){if(e.cm&&!e.cm.curOp)return Vt(e.cm,oi)(e,t,_,g);if(t.to.line<e.first){Wo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var L=t.text.length-1-(e.first-t.from.line);Wo(e,L),t={from:et(e.first,0),to:et(t.to.line+L,t.to.ch),text:[re(t.text)],origin:t.origin}}var N=e.lastLine();t.to.line>N&&(t={from:t.from,to:et(N,dt(e,N).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Lr(e,t.from,t.to),_||(_=ba(e,t)),e.cm?bl(e.cm,t,g):Ea(e,t,g),Xi(e,_,Me),e.cantEdit&&Hi(e,et(e.firstLine(),0))&&(e.cantEdit=!1)}function bl(e,t,_){var g=e.doc,L=e.display,N=t.from,V=t.to,Q=!1,q=N.line;e.options.lineWrapping||(q=Tt(ht(dt(g,N.line))),g.iter(q,V.line+1,function(Xe){if(Xe==L.maxLine)return Q=!0,!0})),g.sel.contains(t.from,t.to)>-1&&le(e),Ea(g,t,_,oo(e)),e.options.lineWrapping||(g.iter(q,N.line+t.text.length,function(Xe){var Ye=Jt(Xe);Ye>L.maxLineLength&&(L.maxLine=Xe,L.maxLineLength=Ye,L.maxLineChanged=!0,Q=!1)}),Q&&(e.curOp.updateMaxLine=!0)),Hn(g,N.line),ni(e,400);var ee=t.text.length-(V.line-N.line)-1;t.full?or(e):N.line==V.line&&t.text.length==1&&!Ao(e.doc,t)?Xr(e,N.line,"text"):or(e,N.line,V.line+1,ee);var _e=se(e,"changes"),we=se(e,"change");if(we||_e){var He={from:N,to:V,text:t.text,removed:t.removed,origin:t.origin};we&&Zt(e,"change",e,He),_e&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(He)}e.display.selForContextMenu=null}function Rn(e,t,_,g,L){var N;g||(g=_),vt(g,_)<0&&(N=[g,_],_=N[0],g=N[1]),typeof t=="string"&&(t=e.splitLines(t)),kn(e,{from:_,to:g,text:t,origin:L})}function zo(e,t,_,g){_<e.line?e.line+=g:t<e.line&&(e.line=t,e.ch=0)}function Go(e,t,_,g){for(var L=0;L<e.length;++L){var N=e[L],V=!0;if(N.ranges){N.copied||(N=e[L]=N.deepCopy(),N.copied=!0);for(var Q=0;Q<N.ranges.length;Q++)zo(N.ranges[Q].anchor,t,_,g),zo(N.ranges[Q].head,t,_,g);continue}for(var q=0;q<N.changes.length;++q){var ee=N.changes[q];if(_<ee.from.line)ee.from=et(ee.from.line+g,ee.from.ch),ee.to=et(ee.to.line+g,ee.to.ch);else if(t<=ee.to.line){V=!1;break}}V||(e.splice(0,L+1),L=0)}}function Vo(e,t){var _=t.from.line,g=t.to.line,L=t.text.length-(g-_)-1;Go(e.done,_,g,L),Go(e.undone,_,g,L)}function si(e,t,_,g){var L=t,N=t;return typeof t=="number"?N=dt(e,Zr(e,t)):L=Tt(t),L==null?null:(g(N,L)&&e.cm&&Xr(e.cm,L,_),N)}function li(e){this.lines=e,this.parent=null;for(var t=0,_=0;_<e.length;++_)e[_].parent=this,t+=e[_].height;this.height=t}li.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var _=e,g=e+t;_<g;++_){var L=this.lines[_];this.height-=L.height,er(L),Zt(L,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,_){this.height+=_,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var g=0;g<t.length;++g)t[g].parent=this},iterN:function(e,t,_){for(var g=e+t;e<g;++e)if(_(this.lines[e]))return!0}};function ui(e){this.children=e;for(var t=0,_=0,g=0;g<e.length;++g){var L=e[g];t+=L.chunkSize(),_+=L.height,L.parent=this}this.size=t,this.height=_,this.parent=null}ui.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var _=0;_<this.children.length;++_){var g=this.children[_],L=g.chunkSize();if(e<L){var N=Math.min(t,L-e),V=g.height;if(g.removeInner(e,N),this.height-=V-g.height,L==N&&(this.children.splice(_--,1),g.parent=null),(t-=N)==0)break;e=0}else e-=L}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof li))){var Q=[];this.collapse(Q),this.children=[new li(Q)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,_){this.size+=t.length,this.height+=_;for(var g=0;g<this.children.length;++g){var L=this.children[g],N=L.chunkSize();if(e<=N){if(L.insertInner(e,t,_),L.lines&&L.lines.length>50){for(var V=L.lines.length%25+25,Q=V;Q<L.lines.length;){var q=new li(L.lines.slice(Q,Q+=25));L.height-=q.height,this.children.splice(++g,0,q),q.parent=this}L.lines=L.lines.slice(0,V),this.maybeSpill()}break}e-=N}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),_=new ui(t);if(e.parent){e.size-=_.size,e.height-=_.height;var L=de(e.parent.children,e);e.parent.children.splice(L+1,0,_)}else{var g=new ui(e.children);g.parent=e,e.children=[g,_],e=g}_.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,_){for(var g=0;g<this.children.length;++g){var L=this.children[g],N=L.chunkSize();if(e<N){var V=Math.min(t,N-e);if(L.iterN(e,V,_))return!0;if((t-=V)==0)break;e=0}else e-=N}}};var ci=function(e,t,_){if(_)for(var g in _)_.hasOwnProperty(g)&&(this[g]=_[g]);this.doc=e,this.node=t};ci.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,_=this.line,g=Tt(_);if(g==null||!t)return;for(var L=0;L<t.length;++L)t[L]==this&&t.splice(L--,1);t.length||(_.widgets=null);var N=qn(this);vr(_,Math.max(0,_.height-N)),e&&(hr(e,function(){Yo(e,_,-N),Xr(e,g,"widget")}),Zt(e,"lineWidgetCleared",e,this,g))},ci.prototype.changed=function(){var e=this,t=this.height,_=this.doc.cm,g=this.line;this.height=null;var L=qn(this)-t;if(!L)return;It(this.doc,g)||vr(g,g.height+L),_&&hr(_,function(){_.curOp.forceUpdate=!0,Yo(_,g,L),Zt(_,"lineWidgetChanged",_,e,Tt(g))})},he(ci);function Yo(e,t,_){Ft(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&pa(e,_)}function xl(e,t,_,g){var L=new ci(e,_,g),N=e.cm;return N&&L.noHScroll&&(N.display.alignWidgets=!0),si(e,t,"widget",function(V){var Q=V.widgets||(V.widgets=[]);if(L.insertAt==null?Q.push(L):Q.splice(Math.min(Q.length-1,Math.max(0,L.insertAt)),0,L),L.line=V,N&&!It(e,V)){var q=Ft(V)<e.scrollTop;vr(V,V.height+qn(L)),q&&pa(N,L.height),N.curOp.forceUpdate=!0}return!0}),N&&Zt(N,"lineWidgetAdded",N,L,typeof t=="number"?t:Tt(t)),L}var Qo=0,Gr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Qo};Gr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&un(e),se(this,"clear")){var _=this.find();_&&Zt(this,"clear",_.from,_.to)}for(var g=null,L=null,N=0;N<this.lines.length;++N){var V=this.lines[N],Q=Fr(V.markedSpans,this);e&&!this.collapsed?Xr(e,Tt(V),"text"):e&&(Q.to!=null&&(L=Tt(V)),Q.from!=null&&(g=Tt(V))),V.markedSpans=Na(V.markedSpans,Q),Q.from==null&&this.collapsed&&!It(this.doc,V)&&e&&vr(V,En(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var q=0;q<this.lines.length;++q){var ee=ht(this.lines[q]),_e=Jt(ee);_e>e.display.maxLineLength&&(e.display.maxLine=ee,e.display.maxLineLength=_e,e.display.maxLineChanged=!0)}g!=null&&e&&this.collapsed&&or(e,g,L+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Uo(e.doc)),e&&Zt(e,"markerCleared",e,this,g,L),t&&cn(e),this.parent&&this.parent.clear()},Gr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var _,g,L=0;L<this.lines.length;++L){var N=this.lines[L],V=Fr(N.markedSpans,this);if(V.from!=null&&(_=et(t?N:Tt(N),V.from),e==-1))return _;if(V.to!=null&&(g=et(t?N:Tt(N),V.to),e==1))return g}return _&&{from:_,to:g}},Gr.prototype.changed=function(){var e=this,t=this.find(-1,!0),_=this,g=this.doc.cm;if(!t||!g)return;hr(g,function(){var L=t.line,N=Tt(t.line),V=ra(g,N);if(V&&($a(V),g.curOp.selectionChanged=g.curOp.forceUpdate=!0),g.curOp.updateMaxLine=!0,!It(_.doc,L)&&_.height!=null){var Q=_.height;_.height=null;var q=qn(_)-Q;q&&vr(L,L.height+q)}Zt(g,"markerChanged",g,e)})},Gr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||de(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Gr.prototype.detachLine=function(e){if(this.lines.splice(de(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},he(Gr);function Dn(e,t,_,g,L){if(g&&g.shared)return El(e,t,_,g,L);if(e.cm&&!e.cm.curOp)return Vt(e.cm,Dn)(e,t,_,g,L);var N=new Gr(e,L),V=vt(t,_);if(g&&K(g,N,!1),V>0||V==0&&N.clearWhenEmpty!==!1)return N;if(N.replacedWith&&(N.collapsed=!0,N.widgetNode=M("span",[N.replacedWith],"CodeMirror-widget"),g.handleMouseEvents||N.widgetNode.setAttribute("cm-ignore-events","true"),g.insertLeft&&(N.widgetNode.insertLeft=!0)),N.collapsed){if($i(e,t.line,t,_,N)||t.line!=_.line&&$i(e,_.line,t,_,N))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}N.addToHistory&&Do(e,{from:t,to:_,origin:"markText"},e.sel,NaN);var Q=t.line,q=e.cm,ee;if(e.iter(Q,_.line+1,function(we){q&&N.collapsed&&!q.options.lineWrapping&&ht(we)==q.display.maxLine&&(ee=!0),N.collapsed&&Q!=t.line&&vr(we,0),jn(we,new vn(N,Q==t.line?t.ch:null,Q==_.line?_.ch:null)),++Q}),N.collapsed&&e.iter(t.line,_.line+1,function(we){It(e,we)&&vr(we,0)}),N.clearOnEnter&&Pe(N,"beforeCursorEnter",function(){return N.clear()}),N.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),N.collapsed&&(N.id=++Qo,N.atomic=!0),q){if(ee&&(q.curOp.updateMaxLine=!0),N.collapsed)or(q,t.line,_.line+1);else if(N.className||N.startStyle||N.endStyle||N.css||N.attributes||N.title)for(var _e=t.line;_e<=_.line;_e++)Xr(q,_e,"text");N.atomic&&Uo(q.doc),Zt(q,"markerAdded",q,N)}return N}var di=function(e,t){this.markers=e,this.primary=t;for(var _=0;_<e.length;++_)e[_].parent=this};di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Zt(this,"clear")},di.prototype.find=function(e,t){return this.primary.find(e,t)},he(di);function El(e,t,_,g,L){g=K(g),g.shared=!1;var N=[Dn(e,t,_,g,L)],V=N[0],Q=g.widgetNode;return zr(e,function(q){Q&&(g.widgetNode=Q.cloneNode(!0)),N.push(Dn(q,gt(q,t),gt(q,_),g,L));for(var ee=0;ee<q.linked.length;++ee)if(q.linked[ee].isParent)return;V=re(N)}),new di(N,V)}function qo(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var _=0;_<t.length;_++){var g=t[_],L=g.find(),N=e.clipPos(L.from),V=e.clipPos(L.to);if(vt(N,V)){var Q=Dn(e,N,V,g.primary,g.primary.type);g.markers.push(Q),Q.parent=g}}}function wl(e){for(var t=function(g){var L=e[g],N=[L.primary.doc];zr(L.primary.doc,function(q){return N.push(q)});for(var V=0;V<L.markers.length;V++){var Q=L.markers[V];de(N,Q.doc)==-1&&(Q.parent=null,L.markers.splice(V--,1))}},_=0;_<e.length;_++)t(_)}var Tl=0,sr=function(e,t,_,g,L){if(!(this instanceof sr))return new sr(e,t,_,g,L);_==null&&(_=0),ui.call(this,[new li([new Pt("",null)])]),this.first=_,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=_;var N=et(_,0);this.sel=jr(N),this.history=new Ui(null),this.id=++Tl,this.modeOption=t,this.lineSep=g,this.direction=L=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ea(this,{from:N,to:N,text:e}),tr(this,jr(N),Me)};sr.prototype=Ke(ui.prototype,{constructor:sr,iter:function(e,t,_){_?this.iterN(e-this.first,t-e,_):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var _=0,g=0;g<t.length;++g)_+=t[g].height;this.insertInner(e-this.first,t,_)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Yt(function(e){var t=et(this.first,0),_=this.first+this.size-1;kn(this,{from:t,to:et(_,dt(this,_).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Jn(this.cm,0,0),tr(this,jr(t),Me)}),replaceRange:function(e,t,_,g){t=gt(this,t),_=_?gt(this,_):t,Rn(this,e,t,_,g)},getRange:function(e,t,_){var g=Lr(this,gt(this,e),gt(this,t));return _===!1?g:g.join(_||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Pr(this,e))return dt(this,e)},getLineNumber:function(e){return Tt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=dt(this,e)),ht(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return gt(this,e)},getCursor:function(e){var t=this.sel.primary(),_;return e==null||e=="head"?_=t.head:e=="anchor"?_=t.anchor:e=="end"||e=="to"||e===!1?_=t.to():_=t.from(),_},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Yt(function(e,t,_){Po(this,gt(this,typeof e=="number"?et(e,t||0):e),null,_)}),setSelection:Yt(function(e,t,_){Po(this,gt(this,e),gt(this,t||e),_)}),extendSelection:Yt(function(e,t,_){Bi(this,gt(this,e),t&>(this,t),_)}),extendSelections:Yt(function(e,t){Io(this,Kn(this,e),t)}),extendSelectionsBy:Yt(function(e,t){var _=pe(this.sel.ranges,e);Io(this,Kn(this,_),t)}),setSelections:Yt(function(e,t,_){if(!e.length)return;for(var g=[],L=0;L<e.length;L++)g[L]=new At(gt(this,e[L].anchor),gt(this,e[L].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),tr(this,Er(this.cm,g,t),_)}),addSelection:Yt(function(e,t,_){var g=this.sel.ranges.slice(0);g.push(new At(gt(this,e),gt(this,t||e))),tr(this,Er(this.cm,g,g.length-1),_)}),getSelection:function(e){for(var t=this.sel.ranges,_,g=0;g<t.length;g++){var L=Lr(this,t[g].from(),t[g].to());_=_?_.concat(L):L}return e===!1?_:_.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],_=this.sel.ranges,g=0;g<_.length;g++){var L=Lr(this,_[g].from(),_[g].to());e!==!1&&(L=L.join(e||this.lineSeparator())),t[g]=L}return t},replaceSelection:function(e,t,_){for(var g=[],L=0;L<this.sel.ranges.length;L++)g[L]=e;this.replaceSelections(g,t,_||"+input")},replaceSelections:Yt(function(e,t,_){for(var g=[],L=this.sel,N=0;N<L.ranges.length;N++){var V=L.ranges[N];g[N]={from:V.from(),to:V.to(),text:this.splitLines(e[N]),origin:_}}for(var Q=t&&t!="end"&&hl(this,g,t),q=g.length-1;q>=0;q--)kn(this,g[q]);Q?Fo(this,Q):this.cm&&Tn(this.cm)}),undo:Yt(function(){ji(this,"undo")}),redo:Yt(function(){ji(this,"redo")}),undoSelection:Yt(function(){ji(this,"undo",!0)}),redoSelection:Yt(function(){ji(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,_=0,g=0;g<e.done.length;g++)e.done[g].ranges||++t;for(var L=0;L<e.undone.length;L++)e.undone[L].ranges||++_;return{undo:t,redo:_}},clearHistory:function(){var e=this;this.history=new Ui(this.history.maxGeneration),zr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:An(this.history.done),undone:An(this.history.undone)}},setHistory:function(e){var t=this.history=new Ui(this.history.maxGeneration);t.done=An(e.done.slice(0),null,!0),t.undone=An(e.undone.slice(0),null,!0)},setGutterMarker:Yt(function(e,t,_){return si(this,e,"gutter",function(g){var L=g.gutterMarkers||(g.gutterMarkers={});return L[t]=_,!_&&ze(L)&&(g.gutterMarkers=null),!0})}),clearGutter:Yt(function(e){var t=this;this.iter(function(_){_.gutterMarkers&&_.gutterMarkers[e]&&si(t,_,"gutter",function(){return _.gutterMarkers[e]=null,ze(_.gutterMarkers)&&(_.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Pr(this,e))return null;if(t=e,e=dt(this,e),!e)return null}else if(t=Tt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Yt(function(e,t,_){return si(this,e,t=="gutter"?"gutter":"class",function(g){var L=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!g[L])g[L]=_;else{if(x(_).test(g[L]))return!1;g[L]+=" "+_}return!0})}),removeLineClass:Yt(function(e,t,_){return si(this,e,t=="gutter"?"gutter":"class",function(g){var L=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",N=g[L];if(N)if(_==null)g[L]=null;else{var V=N.match(x(_));if(!V)return!1;var Q=V.index+V[0].length;g[L]=N.slice(0,V.index)+(!V.index||Q==N.length?"":" ")+N.slice(Q)||null}else return!1;return!0})}),addLineWidget:Yt(function(e,t,_){return xl(this,e,t,_)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,_){return Dn(this,gt(this,e),gt(this,t),_,_&&_.type||"range")},setBookmark:function(e,t){var _={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=gt(this,e),Dn(this,e,e,_,"bookmark")},findMarksAt:function(e){e=gt(this,e);var t=[],_=dt(this,e.line).markedSpans;if(_)for(var g=0;g<_.length;++g){var L=_[g];(L.from==null||L.from<=e.ch)&&(L.to==null||L.to>=e.ch)&&t.push(L.marker.parent||L.marker)}return t},findMarks:function(e,t,_){e=gt(this,e),t=gt(this,t);var g=[],L=e.line;return this.iter(e.line,t.line+1,function(N){var V=N.markedSpans;if(V)for(var Q=0;Q<V.length;Q++){var q=V[Q];!(q.to!=null&&L==e.line&&e.ch>=q.to||q.from==null&&L!=e.line||q.from!=null&&L==t.line&&q.from>=t.ch)&&(!_||_(q.marker))&&g.push(q.marker.parent||q.marker)}++L}),g},getAllMarks:function(){var e=[];return this.iter(function(t){var _=t.markedSpans;if(_)for(var g=0;g<_.length;++g)_[g].from!=null&&e.push(_[g].marker)}),e},posFromIndex:function(e){var t,_=this.first,g=this.lineSeparator().length;return this.iter(function(L){var N=L.text.length+g;if(N>e)return t=e,!0;e-=N,++_}),gt(this,et(_,t))},indexFromPos:function(e){e=gt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var _=this.lineSeparator().length;return this.iter(this.first,e.line,function(g){t+=g.text.length+_}),t},copy:function(e){var t=new sr(fn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,_=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<_&&(_=e.to);var g=new sr(fn(this,t,_),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(g.history=this.history),(this.linked||(this.linked=[])).push({doc:g,sharedHist:e.sharedHist}),g.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(g,qo(this)),g},unlinkDoc:function(e){if(e instanceof Nt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var _=this.linked[t];if(_.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(qo(this));break}if(e.history==this.history){var g=[e.id];zr(e,function(L){return g.push(L.id)},!0),e.history=new Ui(null),e.history.done=An(this.history.done,g),e.history.undone=An(this.history.undone,g)}},iterLinkedDocs:function(e){zr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):tt(e)},lineSeparator:function(){return this.lineSep||`
|
|
|
`},setDirection:Yt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),sr.prototype.eachLine=sr.prototype.iter;var Zo=0;function Cl(e){var t=this;if($o(t),Re(t,e)||Or(t.display,e))return;Y(e),S&&(Zo=+new Date);var _=an(t,e,!0),g=e.dataTransfer.files;if(!_||t.isReadOnly())return;if(g&&g.length&&window.FileReader&&window.File)for(var L=g.length,N=Array(L),V=0,Q=function(){++V==L&&Vt(t,function(){_=gt(t.doc,_);var Xe={from:_,to:_,text:t.doc.splitLines(N.filter(function(Ye){return Ye!=null}).join(t.doc.lineSeparator())),origin:"paste"};kn(t.doc,Xe),Fo(t.doc,jr(gt(t.doc,_),gt(t.doc,Wr(Xe))))})()},q=function(Xe,Ye){if(t.options.allowDropFileTypes&&de(t.options.allowDropFileTypes,Xe.type)==-1){Q();return}var qe=new FileReader;qe.onerror=function(){return Q()},qe.onload=function(){var rt=qe.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(rt)){Q();return}N[Ye]=rt,Q()},qe.readAsText(Xe)},ee=0;ee<g.length;ee++)q(g[ee],ee);else{if(t.state.draggingText&&t.doc.sel.contains(_)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var _e=e.dataTransfer.getData("Text");if(_e){var we;if(t.state.draggingText&&!t.state.draggingText.copy&&(we=t.listSelections()),Xi(t.doc,jr(_,_)),we)for(var He=0;He<we.length;++He)Rn(t.doc,"",we[He].anchor,we[He].head,"drag");t.replaceSelection(_e,"around","paste"),t.display.input.focus()}}catch(Xe){}}}function Al(e,t){if(S&&(!e.state.draggingText||+new Date-Zo<100)){ae(t);return}if(Re(e,t)||Or(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!s){var _=v("img",null,null,"position: fixed; left: 0; top: 0;");_.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(_.width=_.height=1,e.display.wrapper.appendChild(_),_._top=_.offsetTop),t.dataTransfer.setDragImage(_,0,0),d&&_.parentNode.removeChild(_)}}function Ll(e,t){var _=an(e,t);if(!_)return;var g=document.createDocumentFragment();uo(e,_,g),e.display.dragCursor||(e.display.dragCursor=v("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,g)}function $o(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Jo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),_=[],g=0;g<t.length;g++){var L=t[g].CodeMirror;L&&_.push(L)}_.length&&_[0].operation(function(){for(var N=0;N<_.length;N++)e(_[N])})}var es=!1;function kl(){if(es)return;Rl(),es=!0}function Rl(){var e;Pe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Jo(Dl)},100))}),Pe(window,"blur",function(){return Jo(wn)})}function Dl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Vr={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"},hi=0;hi<10;hi++)Vr[hi+48]=Vr[hi+96]=String(hi);for(var Wi=65;Wi<=90;Wi++)Vr[Wi]=String.fromCharCode(Wi);for(var fi=1;fi<=12;fi++)Vr[fi+111]=Vr[fi+63235]="F"+fi;var Mr={};Mr.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"},Mr.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"},Mr.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"},Mr.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"]},Mr.default=h?Mr.macDefault:Mr.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var _,g,L,N,V=0;V<t.length-1;V++){var Q=t[V];if(/^(cmd|meta|m)$/i.test(Q))N=!0;else if(/^a(lt)?$/i.test(Q))_=!0;else if(/^(c|ctrl|control)$/i.test(Q))g=!0;else if(/^s(hift)?$/i.test(Q))L=!0;else throw new Error("Unrecognized modifier name: "+Q)}return _&&(e="Alt-"+e),g&&(e="Ctrl-"+e),N&&(e="Cmd-"+e),L&&(e="Shift-"+e),e}function Ml(e){var t={};for(var _ in e)if(e.hasOwnProperty(_)){var g=e[_];if(/^(name|fallthrough|(de|at)tach)$/.test(_))continue;if(g=="..."){delete e[_];continue}for(var L=pe(_.split(" "),Ol),N=0;N<L.length;N++){var V=void 0,Q=void 0;N==L.length-1?(Q=L.join(" "),V=g):(Q=L.slice(0,N+1).join(" "),V="...");var q=t[Q];if(!q)t[Q]=V;else if(q!=V)throw new Error("Inconsistent bindings for "+Q)}delete e[_]}for(var ee in t)e[ee]=t[ee];return e}function On(e,t,_,g){t=zi(t);var L=t.call?t.call(e,g):t[e];if(L===!1)return"nothing";if(L==="...")return"multi";if(L!=null&&_(L))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return On(e,t.fallthrough,_,g);for(var N=0;N<t.fallthrough.length;N++){var V=On(e,t.fallthrough[N],_,g);if(V)return V}}}function ts(e){var t=typeof e=="string"?e:Vr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,_){var g=e;return t.altKey&&g!="Alt"&&(e="Alt-"+e),(T?t.metaKey:t.ctrlKey)&&g!="Ctrl"&&(e="Ctrl-"+e),(T?t.ctrlKey:t.metaKey)&&g!="Mod"&&(e="Cmd-"+e),!_&&t.shiftKey&&g!="Shift"&&(e="Shift-"+e),e}function ns(e,t){if(d&&e.keyCode==34&&e.char)return!1;var _=Vr[e.keyCode];return _==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(_=e.code),rs(_,e,t))}function zi(e){return typeof e=="string"?Mr[e]:e}function Mn(e,t){for(var _=e.doc.sel.ranges,g=[],L=0;L<_.length;L++){for(var N=t(_[L]);g.length&&vt(N.from,re(g).to)<=0;){var V=g.pop();if(vt(V.from,N.from)<0){N.from=V.from;break}}g.push(N)}hr(e,function(){for(var Q=g.length-1;Q>=0;Q--)Rn(e.doc,"",g[Q].from,g[Q].to,"+delete");Tn(e)})}function Ca(e,t,_){var g=Ee(e.text,t+_,_);return g<0||g>e.text.length?null:g}function Aa(e,t,_){var g=Ca(e,t.ch,_);return g==null?null:new et(t.line,g,_<0?"after":"before")}function La(e,t,_,g,L){if(e){t.doc.direction=="rtl"&&(L=-L);var N=We(_,t.doc.direction);if(N){var V=L<0?re(N):N[0],Q=L<0==(V.level==1),q=Q?"after":"before",ee;if(V.level>0||t.doc.direction=="rtl"){var _e=xn(t,_);ee=L<0?_.text.length-1:0;var we=Cr(t,_e,ee).top;ee=Se(function(He){return Cr(t,_e,He).top==we},L<0==(V.level==1)?V.from:V.to-1,ee),q=="before"&&(ee=Ca(_,ee,1))}else ee=L<0?V.to:V.from;return new et(g,ee,q)}}return new et(g,L<0?_.text.length:0,L<0?"before":"after")}function Il(e,t,_,g){var L=We(t,e.doc.direction);if(!L)return Aa(t,_,g);_.ch>=t.text.length?(_.ch=t.text.length,_.sticky="before"):_.ch<=0&&(_.ch=0,_.sticky="after");var N=J(L,_.ch,_.sticky),V=L[N];if(e.doc.direction=="ltr"&&V.level%2==0&&(g>0?V.to>_.ch:V.from<_.ch))return Aa(t,_,g);var Q=function(at,lt){return Ca(t,at instanceof et?at.ch:at,lt)},q,ee=function(at){return e.options.lineWrapping?(q=q||xn(e,t),ao(e,t,q,at)):{begin:0,end:t.text.length}},_e=ee(_.sticky=="before"?Q(_,-1):_.ch);if(e.doc.direction=="rtl"||V.level==1){var we=V.level==1==g<0,He=Q(_,we?1:-1);if(He!=null&&(we?He<=V.to&&He<=_e.end:He>=V.from&&He>=_e.begin)){var Xe=we?"before":"after";return new et(_.line,He,Xe)}}var Ye=function(at,lt,ot){for(var ut=function(Mt,Qt){return Qt?new et(_.line,Q(Mt,1),"before"):new et(_.line,Mt,"after")};at>=0&&at<L.length;at+=lt){var pt=L[at],ft=lt>0==(pt.level!=1),xt=ft?ot.begin:Q(ot.end,-1);if(pt.from<=xt&&xt<pt.to)return ut(xt,ft);if(xt=ft?pt.from:Q(pt.to,-1),ot.begin<=xt&&xt<ot.end)return ut(xt,ft)}},qe=Ye(N+g,g,_e);if(qe)return qe;var rt=g>0?_e.end:Q(_e.begin,-1);return rt!=null&&!(g>0&&rt==t.text.length)&&(qe=Ye(g>0?0:L.length-1,g,ee(rt)),qe)?qe:null}var pi={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Me)},killLine:function(e){return Mn(e,function(t){if(t.empty()){var _=dt(e.doc,t.head.line).text.length;return t.head.ch==_&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,_)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Mn(e,function(t){return{from:et(t.from().line,0),to:gt(e.doc,et(t.to().line+1,0))}})},delLineLeft:function(e){return Mn(e,function(t){return{from:et(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Mn(e,function(t){var _=e.charCoords(t.head,"div").top+5,g=e.coordsChar({left:0,top:_},"div");return{from:g,to:t.from()}})},delWrappedLineRight:function(e){return Mn(e,function(t){var _=e.charCoords(t.head,"div").top+5,g=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:_},"div");return{from:t.from(),to:g}})},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(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pl(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var _=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:_},"div")},Oe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var _=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:_},"div")},Oe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var _=e.cursorCoords(t.head,"div").top+5,g=e.coordsChar({left:0,top:_},"div");return g.ch<e.getLine(g.line).search(/\S/)?as(e,t.head):g},Oe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],_=e.listSelections(),g=e.options.tabSize,L=0;L<_.length;L++){var N=_[L].from(),V=z(e.getLine(N.line),N.ch,g);t.push(Ae(g-V%g))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return hr(e,function(){for(var t=e.listSelections(),_=[],g=0;g<t.length;g++){if(!t[g].empty())continue;var L=t[g].head,N=dt(e.doc,L.line).text;if(N){if(L.ch==N.length&&(L=new et(L.line,L.ch-1)),L.ch>0)L=new et(L.line,L.ch+1),e.replaceRange(N.charAt(L.ch-1)+N.charAt(L.ch-2),et(L.line,L.ch-2),L,"+transpose");else if(L.line>e.doc.first){var V=dt(e.doc,L.line-1).text;V&&(L=new et(L.line,1),e.replaceRange(N.charAt(0)+e.doc.lineSeparator()+V.charAt(V.length-1),et(L.line-1,V.length-1),L,"+transpose"))}}_.push(new At(L,L))}e.setSelections(_)})},newlineAndIndent:function(e){return hr(e,function(){for(var t=e.listSelections(),_=t.length-1;_>=0;_--)e.replaceRange(e.doc.lineSeparator(),t[_].anchor,t[_].head,"+input");t=e.listSelections();for(var g=0;g<t.length;g++)e.indentLine(t[g].from().line,null,!0);Tn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var _=dt(e.doc,t),g=ht(_);return g!=_&&(t=Tt(g)),La(!0,e,g,t,1)}function Pl(e,t){var _=dt(e.doc,t),g=yt(_);return g!=_&&(t=Tt(g)),La(!0,e,_,t,-1)}function as(e,t){var _=is(e,t.line),g=dt(e.doc,_.line),L=We(g,e.doc.direction);if(!L||L[0].level==0){var N=Math.max(_.ch,g.text.search(/\S/)),V=t.line==_.line&&t.ch<=N&&t.ch;return et(_.line,V?0:N,_.sticky)}return _}function Gi(e,t,_){if(typeof t=="string"&&(t=pi[t],!t))return!1;e.display.input.ensurePolled();var g=e.display.shift,L=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),_&&(e.display.shift=!1),L=t(e)!=Ue}finally{e.display.shift=g,e.state.suppressEdits=!1}return L}function Fl(e,t,_){for(var g=0;g<e.state.keyMaps.length;g++){var L=On(t,e.state.keyMaps[g],_,e);if(L)return L}return e.options.extraKeys&&On(t,e.options.extraKeys,_,e)||On(t,e.options.keyMap,_,e)}var Nl=new te;function mi(e,t,_,g){var L=e.state.keySeq;if(L){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==L&&(e.state.keySeq=null,e.display.input.reset())}),os(e,L+" "+t,_,g))return!0}return os(e,t,_,g)}function os(e,t,_,g){var L=Fl(e,t,g);return L=="multi"&&(e.state.keySeq=t),L=="handled"&&Zt(e,"keyHandled",e,t,_),(L=="handled"||L=="multi")&&(Y(_),da(e)),!!L}function ss(e,t){var _=ns(t,!0);return _?t.shiftKey&&!e.state.keySeq?mi(e,"Shift-"+_,t,function(g){return Gi(e,g,!0)})||mi(e,_,t,function(g){if(typeof g=="string"?/^go[A-Z]/.test(g):g.motion)return Gi(e,g)}):mi(e,_,t,function(g){return Gi(e,g)}):!1}function Ul(e,t,_){return mi(e,"'"+_+"'",t,function(g){return Gi(e,g,!0)})}var ka=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=B(),Re(t,e))return;S&&y<11&&e.keyCode==27&&(e.returnValue=!1);var _=e.keyCode;t.display.shift=_==16||e.shiftKey;var g=ss(t,e);d&&(ka=g?_:null,!g&&_==88&&!$e&&(h?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!h&&!g&&_==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),_==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Kl(t)}function Kl(e){var t=e.display.lineDiv;H(t,"CodeMirror-crosshair");function _(g){(g.keyCode==18||!g.altKey)&&(b(t,"CodeMirror-crosshair"),ne(document,"keyup",_),ne(document,"mouseover",_))}Pe(document,"keyup",_),Pe(document,"mouseover",_)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Re(this,e)}function cs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Or(t.display,e)||Re(t,e)||e.ctrlKey&&!e.altKey||h&&e.metaKey)return;var _=e.keyCode,g=e.charCode;if(d&&_==ka){ka=null,Y(e);return}if(d&&(!e.which||e.which<10)&&ss(t,e))return;var L=String.fromCharCode(g==null?_:g);if(L=="\b")return;if(Ul(t,e,L))return;t.display.input.onKeyPress(e)}var Bl=400,Ra=function(e,t,_){this.time=e,this.pos=t,this.button=_};Ra.prototype.compare=function(e,t,_){return this.time+Bl>e&&vt(t,this.pos)==0&&_==this.button};var gi,vi;function Xl(e,t){var _=+new Date;return vi&&vi.compare(_,e,t)?(gi=vi=null,"triple"):gi&&gi.compare(_,e,t)?(vi=new Ra(_,e,t),gi=null,"double"):(gi=new Ra(_,e,t),vi=null,"single")}function ds(e){var t=this,_=t.display;if(Re(t,e)||_.activeTouch&&_.input.supportsTouch())return;if(_.input.ensurePolled(),_.shift=e.shiftKey,Or(_,e)){p||(_.scroller.draggable=!1,setTimeout(function(){return _.scroller.draggable=!0},100));return}if(Da(t,e))return;var g=an(t,e),L=X(e),N=g?Xl(g,L):"single";if(window.focus(),L==1&&t.state.selectingText&&t.state.selectingText(e),g&&Hl(t,L,g,N,e))return;L==1?g?Wl(t,g,N,e):Te(e)==_.scroller&&Y(e):L==2?(g&&Bi(t.doc,g),setTimeout(function(){return _.input.focus()},20)):L==3&&(C?t.display.input.onContextMenu(e):ho(t))}function Hl(e,t,_,g,L){var N="Click";return g=="double"?N="Double"+N:g=="triple"&&(N="Triple"+N),N=(t==1?"Left":t==2?"Middle":"Right")+N,mi(e,rs(N,L),L,function(V){if(typeof V=="string"&&(V=pi[V]),!V)return!1;var Q=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Q=V(e,_)!=Ue}finally{e.state.suppressEdits=!1}return Q})}function jl(e,t,_){var g=e.getOption("configureMouse"),L=g?g(e,t,_):{};if(L.unit==null){var N=f?_.shiftKey&&_.metaKey:_.altKey;L.unit=N?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(L.extend==null||e.doc.extend)&&(L.extend=e.doc.extend||_.shiftKey),L.addNew==null&&(L.addNew=h?_.metaKey:_.ctrlKey),L.moveOnDrag==null&&(L.moveOnDrag=!(h?_.altKey:_.ctrlKey)),L}function Wl(e,t,_,g){S?setTimeout(U(co,e),0):e.curOp.focus=B();var L=jl(e,_,g),N=e.doc.sel,V;e.options.dragDrop&&me&&!e.isReadOnly()&&_=="single"&&(V=N.contains(t))>-1&&(vt((V=N.ranges[V]).from(),t)<0||t.xRel>0)&&(vt(V.to(),t)>0||t.xRel<0)?zl(e,g,t,L):Gl(e,g,t,L)}function zl(e,t,_,g){var L=e.display,N=!1,V=Vt(e,function(ee){p&&(L.scroller.draggable=!1),e.state.draggingText=!1,ne(L.wrapper.ownerDocument,"mouseup",V),ne(L.wrapper.ownerDocument,"mousemove",Q),ne(L.scroller,"dragstart",q),ne(L.scroller,"drop",V),N||(Y(ee),g.addNew||Bi(e.doc,_,null,null,g.extend),p&&!s||S&&y==9?setTimeout(function(){L.wrapper.ownerDocument.body.focus({preventScroll:!0}),L.input.focus()},20):L.input.focus())}),Q=function(ee){N=N||Math.abs(t.clientX-ee.clientX)+Math.abs(t.clientY-ee.clientY)>=10},q=function(){return N=!0};p&&(L.scroller.draggable=!0),e.state.draggingText=V,V.copy=!g.moveOnDrag,L.scroller.dragDrop&&L.scroller.dragDrop(),Pe(L.wrapper.ownerDocument,"mouseup",V),Pe(L.wrapper.ownerDocument,"mousemove",Q),Pe(L.scroller,"dragstart",q),Pe(L.scroller,"drop",V),ho(e),setTimeout(function(){return L.input.focus()},20)}function hs(e,t,_){if(_=="char")return new At(t,t);if(_=="word")return e.findWordAt(t);if(_=="line")return new At(et(t.line,0),gt(e.doc,et(t.line+1,0)));var g=_(e,t);return new At(g.from,g.to)}function Gl(e,t,_,g){var L=e.display,N=e.doc;Y(t);var V,Q,q=N.sel,ee=q.ranges;if(g.addNew&&!g.extend?(Q=N.sel.contains(_),Q>-1?V=ee[Q]:V=new At(_,_)):(V=N.sel.primary(),Q=N.sel.primIndex),g.unit=="rectangle")g.addNew||(V=new At(_,_)),_=an(e,t,!0,!0),Q=-1;else{var _e=hs(e,_,g.unit);g.extend?V=wa(V,_e.anchor,_e.head,g.extend):V=_e}g.addNew?Q==-1?(Q=ee.length,tr(N,Er(e,ee.concat([V]),Q),{scroll:!1,origin:"*mouse"})):ee.length>1&&ee[Q].empty()&&g.unit=="char"&&!g.extend?(tr(N,Er(e,ee.slice(0,Q).concat(ee.slice(Q+1)),0),{scroll:!1,origin:"*mouse"}),q=N.sel):Ta(N,Q,V,Le):(Q=0,tr(N,new gr([V],0),Le),q=N.sel);var we=_;function He(ot){if(vt(we,ot)==0)return;if(we=ot,g.unit=="rectangle"){for(var ut=[],pt=e.options.tabSize,ft=z(dt(N,_.line).text,_.ch,pt),xt=z(dt(N,ot.line).text,ot.ch,pt),Mt=Math.min(ft,xt),Qt=Math.max(ft,xt),Ut=Math.min(_.line,ot.line),fr=Math.min(e.lastLine(),Math.max(_.line,ot.line));Ut<=fr;Ut++){var lr=dt(N,Ut).text,Wt=Fe(lr,Mt,pt);Mt==Qt?ut.push(new At(et(Ut,Wt),et(Ut,Wt))):lr.length>Wt&&ut.push(new At(et(Ut,Wt),et(Ut,Fe(lr,Qt,pt))))}ut.length||ut.push(new At(_,_)),tr(N,Er(e,q.ranges.slice(0,Q).concat(ut),Q),{origin:"*mouse",scroll:!1}),e.scrollIntoView(ot)}else{var ur=V,$t=hs(e,ot,g.unit),Gt=ur.anchor,zt;vt($t.anchor,Gt)>0?(zt=$t.head,Gt=qr(ur.from(),$t.anchor)):(zt=$t.anchor,Gt=pn(ur.to(),$t.head));var Bt=q.ranges.slice(0);Bt[Q]=Vl(e,new At(gt(N,Gt),zt)),tr(N,Er(e,Bt,Q),Le)}}var Xe=L.wrapper.getBoundingClientRect(),Ye=0;function qe(ot){var ut=++Ye,pt=an(e,ot,!0,g.unit=="rectangle");if(!pt)return;if(vt(pt,we)!=0){e.curOp.focus=B(),He(pt);var ft=Ii(L,N);(pt.line>=ft.to||pt.line<ft.from)&&setTimeout(Vt(e,function(){Ye==ut&&qe(ot)}),150)}else{var xt=ot.clientY<Xe.top?-20:ot.clientY>Xe.bottom?20:0;xt&&setTimeout(Vt(e,function(){if(Ye!=ut)return;L.scroller.scrollTop+=xt,qe(ot)}),50)}}function rt(ot){e.state.selectingText=!1,Ye=Infinity,ot&&(Y(ot),L.input.focus()),ne(L.wrapper.ownerDocument,"mousemove",at),ne(L.wrapper.ownerDocument,"mouseup",lt),N.history.lastSelOrigin=null}var at=Vt(e,function(ot){ot.buttons===0||!X(ot)?rt(ot):qe(ot)}),lt=Vt(e,rt);e.state.selectingText=lt,Pe(L.wrapper.ownerDocument,"mousemove",at),Pe(L.wrapper.ownerDocument,"mouseup",lt)}function Vl(e,t){var _=t.anchor,g=t.head,L=dt(e.doc,_.line);if(vt(_,g)==0&&_.sticky==g.sticky)return t;var N=We(L);if(!N)return t;var V=J(N,_.ch,_.sticky),Q=N[V];if(Q.from!=_.ch&&Q.to!=_.ch)return t;var q=V+(Q.from==_.ch==(Q.level!=1)?0:1);if(q==0||q==N.length)return t;var ee;if(g.line!=_.line)ee=(g.line-_.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var _e=J(N,g.ch,g.sticky),we=_e-V||(g.ch-_.ch)*(Q.level==1?-1:1);_e==q-1||_e==q?ee=we<0:ee=we>0}var He=N[q+(ee?-1:0)],Xe=ee==(He.level==1),Ye=Xe?He.from:He.to,qe=Xe?"after":"before";return _.ch==Ye&&_.sticky==qe?t:new At(new et(_.line,Ye,qe),g)}function fs(e,t,_,g){var L,N;if(t.touches)L=t.touches[0].clientX,N=t.touches[0].clientY;else try{L=t.clientX,N=t.clientY}catch(He){return!1}if(L>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;g&&Y(t);var V=e.display,Q=V.lineDiv.getBoundingClientRect();if(N>Q.bottom||!se(e,_))return G(t);N-=Q.top-V.viewOffset;for(var q=0;q<e.display.gutterSpecs.length;++q){var ee=V.gutters.childNodes[q];if(ee&&ee.getBoundingClientRect().right>=L){var _e=kr(e.doc,N),we=e.display.gutterSpecs[q];return be(e,_,e,_e,we.className,t),G(t)}}}function Da(e,t){return fs(e,t,"gutterClick",!0)}function ps(e,t){if(Or(e.display,t)||Yl(e,t))return;if(Re(e,t,"contextmenu"))return;C||e.display.input.onContextMenu(t)}function Yl(e,t){return se(e,"gutterContextMenu")?fs(e,t,"gutterContextMenu",!1):!1}function ms(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Zn(e)}var In={toString:function(){return"CodeMirror.Init"}},gs={},Vi={};function Ql(e){var t=e.optionHandlers;function _(g,L,N,V){e.defaults[g]=L,N&&(t[g]=V?function(Q,q,ee){ee!=In&&N(Q,q,ee)}:N)}e.defineOption=_,e.Init=In,_("value","",function(g,L){return g.setValue(L)},!0),_("mode",null,function(g,L){g.doc.modeOption=L,xa(g)},!0),_("indentUnit",2,xa,!0),_("indentWithTabs",!1),_("smartIndent",!0),_("tabSize",4,function(g){ai(g),Zn(g),or(g)},!0),_("lineSeparator",null,function(g,L){if(g.doc.lineSep=L,!L)return;var N=[],V=g.doc.first;g.doc.iter(function(q){for(var ee=0;;){var _e=q.text.indexOf(L,ee);if(_e==-1)break;ee=_e+L.length,N.push(et(V,_e))}V++});for(var Q=N.length-1;Q>=0;Q--)Rn(g.doc,L,N[Q],et(N[Q].line,N[Q].ch+L.length))}),_("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(g,L,N){g.state.specialChars=new RegExp(L.source+(L.test(" ")?"":"| "),"g"),N!=In&&g.refresh()}),_("specialCharPlaceholder",ws,function(g){return g.refresh()},!0),_("electricChars",!0),_("inputStyle",i?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),_("spellcheck",!1,function(g,L){return g.getInputField().spellcheck=L},!0),_("autocorrect",!1,function(g,L){return g.getInputField().autocorrect=L},!0),_("autocapitalize",!1,function(g,L){return g.getInputField().autocapitalize=L},!0),_("rtlMoveVisually",!w),_("wholeLineUpdateBefore",!0),_("theme","default",function(g){ms(g),ii(g)},!0),_("keyMap","default",function(g,L,N){var V=zi(L),Q=N!=In&&zi(N);Q&&Q.detach&&Q.detach(g,V),V.attach&&V.attach(g,Q||null)}),_("extraKeys",null),_("configureMouse",null),_("lineWrapping",!1,Zl,!0),_("gutters",[],function(g,L){g.display.gutterSpecs=ya(L,g.options.lineNumbers),ii(g)},!0),_("fixedGutter",!0,function(g,L){g.display.gutters.style.left=L?ua(g.display)+"px":"0",g.refresh()},!0),_("coverGutterNextToScrollbar",!1,function(g){return Cn(g)},!0),_("scrollbarStyle","native",function(g){_o(g),Cn(g),g.display.scrollbars.setScrollTop(g.doc.scrollTop),g.display.scrollbars.setScrollLeft(g.doc.scrollLeft)},!0),_("lineNumbers",!1,function(g,L){g.display.gutterSpecs=ya(g.options.gutters,L),ii(g)},!0),_("firstLineNumber",1,ii,!0),_("lineNumberFormatter",function(g){return g},ii,!0),_("showCursorWhenSelecting",!1,$n,!0),_("resetSelectionOnContextMenu",!0),_("lineWiseCopyCut",!0),_("pasteLinesPerSelection",!0),_("selectionsMayTouch",!1),_("readOnly",!1,function(g,L){L=="nocursor"&&(wn(g),g.display.input.blur()),g.display.input.readOnlyChanged(L)}),_("screenReaderLabel",null,function(g,L){L=L===""?null:L,g.display.input.screenReaderLabelChanged(L)}),_("disableInput",!1,function(g,L){L||g.display.input.reset()},!0),_("dragDrop",!0,ql),_("allowDropFileTypes",null),_("cursorBlinkRate",530),_("cursorScrollMargin",0),_("cursorHeight",1,$n,!0),_("singleCursorHeightPerLine",!0,$n,!0),_("workTime",100),_("workDelay",100),_("flattenSpans",!0,ai,!0),_("addModeClass",!1,ai,!0),_("pollInterval",100),_("undoDepth",200,function(g,L){return g.doc.history.undoDepth=L}),_("historyEventDelay",1250),_("viewportMargin",10,function(g){return g.refresh()},!0),_("maxHighlightLength",1e4,ai,!0),_("moveInputWithCursor",!0,function(g,L){L||g.display.input.resetPosition()}),_("tabindex",null,function(g,L){return g.display.input.getField().tabIndex=L||""}),_("autofocus",null),_("direction","ltr",function(g,L){return g.doc.setDirection(L)},!0),_("phrases",null)}function ql(e,t,_){var g=_&&_!=In;if(!t!=!g){var L=e.display.dragFunctions,N=t?Pe:ne;N(e.display.scroller,"dragstart",L.start),N(e.display.scroller,"dragenter",L.enter),N(e.display.scroller,"dragover",L.over),N(e.display.scroller,"dragleave",L.leave),N(e.display.scroller,"drop",L.drop)}}function Zl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(b(e.display.wrapper,"CodeMirror-wrap"),br(e)),ca(e),or(e),Zn(e),setTimeout(function(){return Cn(e)},100)}function Nt(e,t){var _=this;if(!(this instanceof Nt))return new Nt(e,t);this.options=t=t?K(t):{},K(gs,t,!1);var g=t.value;typeof g=="string"?g=new sr(g,t.mode,null,t.lineSeparator,t.direction):t.mode&&(g.modeOption=t.mode),this.doc=g;var L=new Nt.inputStyles[t.inputStyle](this),N=this.display=new cl(e,g,L,t);N.wrapper.CodeMirror=this,ms(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),_o(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new te,keySeq:null,specialChars:null},t.autofocus&&!i&&N.input.focus(),S&&y<11&&setTimeout(function(){return _.display.input.reset(!0)},20),$l(this),kl(),un(this),this.curOp.forceUpdate=!0,Lo(this,g),t.autofocus&&!i||this.hasFocus()?setTimeout(function(){_.hasFocus()&&!_.state.focused&&ha(_)},20):wn(this);for(var V in Vi)Vi.hasOwnProperty(V)&&Vi[V](this,t[V],In);xo(this),t.finishInit&&t.finishInit(this);for(var Q=0;Q<Oa.length;++Q)Oa[Q](this);cn(this),p&&t.lineWrapping&&getComputedStyle(N.lineDiv).textRendering=="optimizelegibility"&&(N.lineDiv.style.textRendering="auto")}Nt.defaults=gs,Nt.optionHandlers=Vi;function $l(e){var t=e.display;Pe(t.scroller,"mousedown",Vt(e,ds)),S&&y<11?Pe(t.scroller,"dblclick",Vt(e,function(q){if(Re(e,q))return;var ee=an(e,q);if(!ee||Da(e,q)||Or(e.display,q))return;Y(q);var _e=e.findWordAt(ee);Bi(e.doc,_e.anchor,_e.head)})):Pe(t.scroller,"dblclick",function(q){return Re(e,q)||Y(q)}),Pe(t.scroller,"contextmenu",function(q){return ps(e,q)}),Pe(t.input.getField(),"contextmenu",function(q){t.scroller.contains(q.target)||ps(e,q)});var _,g={end:0};function L(){t.activeTouch&&(_=setTimeout(function(){return t.activeTouch=null},1e3),g=t.activeTouch,g.end=+new Date)}function N(q){if(q.touches.length!=1)return!1;var ee=q.touches[0];return ee.radiusX<=1&&ee.radiusY<=1}function V(q,ee){if(ee.left==null)return!0;var _e=ee.left-q.left,we=ee.top-q.top;return _e*_e+we*we>20*20}Pe(t.scroller,"touchstart",function(q){if(!Re(e,q)&&!N(q)&&!Da(e,q)){t.input.ensurePolled(),clearTimeout(_);var ee=+new Date;t.activeTouch={start:ee,moved:!1,prev:ee-g.end<=300?g:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),Pe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Pe(t.scroller,"touchend",function(q){var ee=t.activeTouch;if(ee&&!Or(t,q)&&ee.left!=null&&!ee.moved&&new Date-ee.start<300){var _e=e.coordsChar(t.activeTouch,"page"),we;!ee.prev||V(ee,ee.prev)?we=new At(_e,_e):!ee.prev.prev||V(ee,ee.prev.prev)?we=e.findWordAt(_e):we=new At(et(_e.line,0),gt(e.doc,et(_e.line+1,0))),e.setSelection(we.anchor,we.head),e.focus(),Y(q)}L()}),Pe(t.scroller,"touchcancel",L),Pe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ei(e,t.scroller.scrollTop),sn(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),Pe(t.scroller,"mousewheel",function(q){return wo(e,q)}),Pe(t.scroller,"DOMMouseScroll",function(q){return wo(e,q)}),Pe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){Re(e,q)||ae(q)},over:function(q){Re(e,q)||(Ll(e,q),ae(q))},start:function(q){return Al(e,q)},drop:Vt(e,Cl),leave:function(q){Re(e,q)||$o(e)}};var Q=t.input.getField();Pe(Q,"keyup",function(q){return us.call(e,q)}),Pe(Q,"keydown",Vt(e,ls)),Pe(Q,"keypress",Vt(e,cs)),Pe(Q,"focus",function(q){return ha(e,q)}),Pe(Q,"blur",function(q){return wn(e,q)})}var Oa=[];Nt.defineInitHook=function(e){return Oa.push(e)};function _i(e,t,_,g){var L=e.doc,N;_==null&&(_="add"),_=="smart"&&(L.mode.indent?N=dr(e,t).state:_="prev");var V=e.options.tabSize,Q=dt(L,t),q=z(Q.text,null,V);Q.stateAfter&&(Q.stateAfter=null);var ee=Q.text.match(/^\s*/)[0],_e;if(!g&&!/\S/.test(Q.text))_e=0,_="not";else if(_=="smart"&&(_e=L.mode.indent(N,Q.text.slice(ee.length),Q.text),_e==Ue||_e>150)){if(!g)return;_="prev"}_=="prev"?t>L.first?_e=z(dt(L,t-1).text,null,V):_e=0:_=="add"?_e=q+e.options.indentUnit:_=="subtract"?_e=q-e.options.indentUnit:typeof _=="number"&&(_e=q+_),_e=Math.max(0,_e);var we="",He=0;if(e.options.indentWithTabs)for(var Xe=Math.floor(_e/V);Xe;--Xe)He+=V,we+=" ";if(He<_e&&(we+=Ae(_e-He)),we!=ee)return Rn(L,we,et(t,0),et(t,ee.length),"+input"),Q.stateAfter=null,!0;for(var Ye=0;Ye<L.sel.ranges.length;Ye++){var qe=L.sel.ranges[Ye];if(qe.head.line==t&&qe.head.ch<ee.length){var rt=et(t,ee.length);Ta(L,Ye,new At(rt,rt));break}}}var Sr=null;function Yi(e){Sr=e}function Ma(e,t,_,g,L){var N=e.doc;e.display.shift=!1,g||(g=N.sel);var V=+new Date-200,Q=L=="paste"||e.state.pasteIncoming>V,q=tt(t),ee=null;if(Q&&g.ranges.length>1)if(Sr&&Sr.text.join(`
|
|
|
`)==t){if(g.ranges.length%Sr.text.length==0){ee=[];for(var _e=0;_e<Sr.text.length;_e++)ee.push(N.splitLines(Sr.text[_e]))}}else q.length==g.ranges.length&&e.options.pasteLinesPerSelection&&(ee=pe(q,function(at){return[at]}));for(var we=e.curOp.updateInput,He=g.ranges.length-1;He>=0;He--){var Xe=g.ranges[He],Ye=Xe.from(),qe=Xe.to();Xe.empty()&&(_&&_>0?Ye=et(Ye.line,Ye.ch-_):e.state.overwrite&&!Q?qe=et(qe.line,Math.min(dt(N,qe.line).text.length,qe.ch+re(q).length)):Q&&Sr&&Sr.lineWise&&Sr.text.join(`
|
|
|
`)==q.join(`
|
|
|
`)&&(Ye=qe=et(Ye.line,0)));var rt={from:Ye,to:qe,text:ee?ee[He%ee.length]:q,origin:L||(Q?"paste":e.state.cutIncoming>V?"cut":"+input")};kn(e.doc,rt),Zt(e,"inputRead",e,rt)}t&&!Q&&_s(e,t),Tn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=we),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var _=e.clipboardData&&e.clipboardData.getData("Text");if(_)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&hr(t,function(){return Ma(t,_,0,null,"paste")}),!0}function _s(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var _=e.doc.sel,g=_.ranges.length-1;g>=0;g--){var L=_.ranges[g];if(L.head.ch>100||g&&_.ranges[g-1].head.line==L.head.line)continue;var N=e.getModeAt(L.head),V=!1;if(N.electricChars){for(var Q=0;Q<N.electricChars.length;Q++)if(t.indexOf(N.electricChars.charAt(Q))>-1){V=_i(e,L.head.line,"smart");break}}else N.electricInput&&(N.electricInput.test(dt(e.doc,L.head.line).text.slice(0,L.head.ch))&&(V=_i(e,L.head.line,"smart")));V&&Zt(e,"electricInput",e,L.head.line)}}function ys(e){for(var t=[],_=[],g=0;g<e.doc.sel.ranges.length;g++){var L=e.doc.sel.ranges[g].head.line,N={anchor:et(L,0),head:et(L+1,0)};_.push(N),t.push(e.getRange(N.anchor,N.head))}return{text:t,ranges:_}}function bs(e,t,_,g){e.setAttribute("autocorrect",_?"":"off"),e.setAttribute("autocapitalize",g?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=v("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=v("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return p?e.style.width="1000px":e.setAttribute("wrap","off"),n&&(e.style.border="1px solid black"),bs(e),t}function Jl(e){var t=e.optionHandlers,_=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(g,L){var N=this.options,V=N[g];if(N[g]==L&&g!="mode")return;N[g]=L,t.hasOwnProperty(g)&&Vt(this,t[g])(this,L,V),be(this,"optionChange",this,g)},getOption:function(g){return this.options[g]},getDoc:function(){return this.doc},addKeyMap:function(g,L){this.state.keyMaps[L?"push":"unshift"](zi(g))},removeKeyMap:function(g){for(var L=this.state.keyMaps,N=0;N<L.length;++N)if(L[N]==g||L[N].name==g)return L.splice(N,1),!0},addOverlay:ir(function(g,L){var N=g.token?g:e.getMode(this.options,g);if(N.startState)throw new Error("Overlays may not be stateful.");ue(this.state.overlays,{mode:N,modeSpec:g,opaque:L&&L.opaque,priority:L&&L.priority||0},function(V){return V.priority}),this.state.modeGen++,or(this)}),removeOverlay:ir(function(g){for(var L=this.state.overlays,N=0;N<L.length;++N){var V=L[N].modeSpec;if(V==g||typeof g=="string"&&V.name==g){L.splice(N,1),this.state.modeGen++,or(this);return}}}),indentLine:ir(function(g,L,N){typeof L!="string"&&typeof L!="number"&&(L==null?L=this.options.smartIndent?"smart":"prev":L=L?"add":"subtract"),Pr(this.doc,g)&&_i(this,g,L,N)}),indentSelection:ir(function(g){for(var L=this.doc.sel.ranges,N=-1,V=0;V<L.length;V++){var Q=L[V];if(Q.empty())Q.head.line>N&&(_i(this,Q.head.line,g,!0),N=Q.head.line,V==this.doc.sel.primIndex&&Tn(this));else{var q=Q.from(),ee=Q.to(),_e=Math.max(N,q.line);N=Math.min(this.lastLine(),ee.line-(ee.ch?0:1))+1;for(var we=_e;we<N;++we)_i(this,we,g);var He=this.doc.sel.ranges;q.ch==0&&L.length==He.length&&He[V].from().ch>0&&Ta(this.doc,V,new At(q,He[V].to()),Me)}}}),getTokenAt:function(g,L){return Dr(this,g,L)},getLineTokens:function(g,L){return Dr(this,et(g),L,!0)},getTokenTypeAt:function(g){g=gt(this.doc,g);var L=Bn(this,dt(this.doc,g.line)),N=0,V=(L.length-1)/2,Q=g.ch,q;if(Q==0)q=L[2];else for(;;){var ee=N+V>>1;if((ee?L[ee*2-1]:0)>=Q)V=ee;else if(L[ee*2+1]<Q)N=ee+1;else{q=L[ee*2+2];break}}var _e=q?q.indexOf("overlay "):-1;return _e<0?q:_e==0?null:q.slice(0,_e-1)},getModeAt:function(g){var L=this.doc.mode;return L.innerMode?e.innerMode(L,this.getTokenAt(g).state).mode:L},getHelper:function(g,L){return this.getHelpers(g,L)[0]},getHelpers:function(g,L){var N=[];if(!_.hasOwnProperty(L))return N;var V=_[L],Q=this.getModeAt(g);if(typeof Q[L]=="string")V[Q[L]]&&N.push(V[Q[L]]);else if(Q[L])for(var q=0;q<Q[L].length;q++){var ee=V[Q[L][q]];ee&&N.push(ee)}else Q.helperType&&V[Q.helperType]?N.push(V[Q.helperType]):V[Q.name]&&N.push(V[Q.name]);for(var _e=0;_e<V._global.length;_e++){var we=V._global[_e];we.pred(Q,this)&&de(N,we.val)==-1&&N.push(we.val)}return N},getStateAfter:function(g,L){var N=this.doc;return g=Zr(N,g==null?N.first+N.size-1:g),dr(this,g+1,L).state},cursorCoords:function(g,L){var N,V=this.doc.sel.primary();return g==null?N=V.head:typeof g=="object"?N=gt(this.doc,g):N=g?V.from():V.to(),xr(this,N,L||"page")},charCoords:function(g,L){return ia(this,gt(this.doc,g),L||"page")},coordsChar:function(g,L){return g=ro(this,g,L||"page"),oa(this,g.left,g.top)},lineAtHeight:function(g,L){return g=ro(this,{top:g,left:0},L||"page").top,kr(this.doc,g+this.display.viewOffset)},heightAtLine:function(g,L,N){var V=!1,Q;if(typeof g=="number"){var q=this.doc.first+this.doc.size-1;g<this.doc.first?g=this.doc.first:g>q&&(g=q,V=!0),Q=dt(this.doc,g)}else Q=g;return Ri(this,Q,{top:0,left:0},L||"page",N||V).top+(V?this.doc.height-Ft(Q):0)},defaultTextHeight:function(){return En(this.display)},defaultCharWidth:function(){return Sn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(g,L,N,V,Q){var q=this.display;g=xr(this,gt(this.doc,g));var ee=g.bottom,_e=g.left;if(L.style.position="absolute",L.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(L),q.sizer.appendChild(L),V=="over")ee=g.top;else if(V=="above"||V=="near"){var we=Math.max(q.wrapper.clientHeight,this.doc.height),He=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(V=="above"||g.bottom+L.offsetHeight>we)&&g.top>L.offsetHeight?ee=g.top-L.offsetHeight:g.bottom+L.offsetHeight<=we&&(ee=g.bottom),_e+L.offsetWidth>He&&(_e=He-L.offsetWidth)}L.style.top=ee+"px",L.style.left=L.style.right="",Q=="right"?(_e=q.sizer.clientWidth-L.offsetWidth,L.style.right="0px"):(Q=="left"?_e=0:Q=="middle"&&(_e=(q.sizer.clientWidth-L.offsetWidth)/2),L.style.left=_e+"px"),N&&qs(this,{left:_e,top:ee,right:_e+L.offsetWidth,bottom:ee+L.offsetHeight})},triggerOnKeyDown:ir(ls),triggerOnKeyPress:ir(cs),triggerOnKeyUp:us,triggerOnMouseDown:ir(ds),execCommand:function(g){if(pi.hasOwnProperty(g))return pi[g].call(null,this)},triggerElectric:ir(function(g){_s(this,g)}),findPosH:function(g,L,N,V){var Q=1;L<0&&(Q=-1,L=-L);for(var q=gt(this.doc,g),ee=0;ee<L&&!(q=Ia(this.doc,q,Q,N,V),q.hitSide);++ee);return q},moveH:ir(function(g,L){var N=this;this.extendSelectionsBy(function(V){return N.display.shift||N.doc.extend||V.empty()?Ia(N.doc,V.head,g,L,N.options.rtlMoveVisually):g<0?V.from():V.to()},Oe)}),deleteH:ir(function(g,L){var N=this.doc.sel,V=this.doc;N.somethingSelected()?V.replaceSelection("",null,"+delete"):Mn(this,function(Q){var q=Ia(V,Q.head,g,L,!1);return g<0?{from:q,to:Q.head}:{from:Q.head,to:q}})}),findPosV:function(g,L,N,V){var Q=1,q=V;L<0&&(Q=-1,L=-L);for(var ee=gt(this.doc,g),_e=0;_e<L;++_e){var we=xr(this,ee,"div");if(q==null?q=we.left:we.left=q,ee=Es(this,we,Q,N),ee.hitSide)break}return ee},moveV:ir(function(g,L){var N=this,V=this.doc,Q=[],q=!this.display.shift&&!V.extend&&V.sel.somethingSelected();if(V.extendSelectionsBy(function(_e){if(q)return g<0?_e.from():_e.to();var we=xr(N,_e.head,"div");_e.goalColumn!=null&&(we.left=_e.goalColumn),Q.push(we.left);var He=Es(N,we,g,L);return L=="page"&&_e==V.sel.primary()&&pa(N,ia(N,He,"div").top-we.top),He},Oe),Q.length)for(var ee=0;ee<V.sel.ranges.length;ee++)V.sel.ranges[ee].goalColumn=Q[ee]}),findWordAt:function(g){var L=this.doc,N=dt(L,g.line).text,V=g.ch,Q=g.ch;if(N){var q=this.getHelper(g,"wordChars");(g.sticky=="before"||Q==N.length)&&V?--V:++Q;for(var ee=N.charAt(V),_e=Ge(ee,q)?function(we){return Ge(we,q)}:/\s/.test(ee)?function(we){return/\s/.test(we)}:function(we){return!/\s/.test(we)&&!Ge(we)};V>0&&_e(N.charAt(V-1));)--V;for(;Q<N.length&&_e(N.charAt(Q));)++Q}return new At(et(g.line,V),et(g.line,Q))},toggleOverwrite:function(g){if(g!=null&&g==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):b(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==B()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ir(function(g,L){Jn(this,g,L)}),getScrollInfo:function(){var g=this.display.scroller;return{left:g.scrollLeft,top:g.scrollTop,height:g.scrollHeight-Tr(this)-this.display.barHeight,width:g.scrollWidth-Tr(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:rn(this)}},scrollIntoView:ir(function(g,L){g==null?(g={from:this.doc.sel.primary().head,to:null},L==null&&(L=this.options.cursorScrollMargin)):typeof g=="number"?g={from:et(g,0),to:null}:g.from==null&&(g={from:g,to:null}),g.to||(g.to=g.from),g.margin=L||0,g.from.line!=null?Zs(this,g):po(this,g.from,g.to,g.margin)}),setSize:ir(function(g,L){var N=this,V=function(q){return typeof q=="number"||/^\d+$/.test(String(q))?q+"px":q};g!=null&&(this.display.wrapper.style.width=V(g)),L!=null&&(this.display.wrapper.style.height=V(L)),this.options.lineWrapping&&Ja(this);var Q=this.display.viewFrom;this.doc.iter(Q,this.display.viewTo,function(q){if(q.widgets){for(var ee=0;ee<q.widgets.length;ee++)if(q.widgets[ee].noHScroll){Xr(N,Q,"widget");break}}++Q}),this.curOp.forceUpdate=!0,be(this,"refresh",this)}),operation:function(g){return hr(this,g)},startOperation:function(){return un(this)},endOperation:function(){return cn(this)},refresh:ir(function(){var g=this.display.cachedTextHeight;or(this),this.curOp.forceUpdate=!0,Zn(this),Jn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(g==null||Math.abs(g-En(this.display))>.5||this.options.lineWrapping)&&ca(this),be(this,"refresh",this)}),swapDoc:ir(function(g){var L=this.doc;return L.cm=null,this.state.selectingText&&this.state.selectingText(),Lo(this,g),Zn(this),this.display.input.reset(),Jn(this,g.scrollLeft,g.scrollTop),this.curOp.forceScroll=!0,Zt(this,"swapDoc",this,L),L}),phrase:function(g){var L=this.options.phrases;return L&&Object.prototype.hasOwnProperty.call(L,g)?L[g]:g},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}},he(e),e.registerHelper=function(g,L,N){_.hasOwnProperty(g)||(_[g]=e[g]={_global:[]}),_[g][L]=N},e.registerGlobalHelper=function(g,L,N,V){e.registerHelper(g,L,V),_[g]._global.push({pred:N,val:V})}}function Ia(e,t,_,g,L){var N=t,V=_,Q=dt(e,t.line),q=L&&e.direction=="rtl"?-_:_;function ee(){var lt=t.line+q;return lt<e.first||lt>=e.first+e.size?!1:(t=new et(lt,t.ch,t.sticky),Q=dt(e,lt))}function _e(lt){var ot;if(g=="codepoint"){var ut=Q.text.charCodeAt(t.ch+(g>0?0:-1));isNaN(ut)?ot=null:ot=new et(t.line,Math.max(0,Math.min(Q.text.length,t.ch+_*(ut>=55296&&ut<56320?2:1))),-_)}else L?ot=Il(e.cm,Q,t,_):ot=Aa(Q,t,_);if(ot==null)if(!lt&&ee())t=La(L,e.cm,Q,t.line,q);else return!1;else t=ot;return!0}if(g=="char"||g=="codepoint")_e();else if(g=="column")_e(!0);else if(g=="word"||g=="group")for(var we=null,He=g=="group",Xe=e.cm&&e.cm.getHelper(t,"wordChars"),Ye=!0;!(_<0&&!_e(!Ye));Ye=!1){var qe=Q.text.charAt(t.ch)||`
|
|
|
`,rt=Ge(qe,Xe)?"w":He&&qe==`
|
|
|
`?"n":!He||/\s/.test(qe)?null:"p";if(He&&!Ye&&!rt&&(rt="s"),we&&we!=rt){_<0&&(_=1,_e(),t.sticky="after");break}if(rt&&(we=rt),_>0&&!_e(!Ye))break}var at=Hi(e,t,N,V,!0);return it(N,at)&&(at.hitSide=!0),at}function Es(e,t,_,g){var L=e.doc,N=t.left,V;if(g=="page"){var Q=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Q-.5*En(e.display),3);V=(_>0?t.bottom:t.top)+_*q}else g=="line"&&(V=_>0?t.bottom+3:t.top-3);for(var ee;!(ee=oa(e,N,V),!ee.outside);){if(_<0?V<=0:V>=L.height){ee.hitSide=!0;break}V+=_*5}return ee}var kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new te,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};kt.prototype.init=function(e){var t=this,_=this,g=_.cm,L=_.div=e.lineDiv;bs(L,g.options.spellcheck,g.options.autocorrect,g.options.autocapitalize);function N(Q){for(var q=Q.target;q;q=q.parentNode){if(q==L)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}Pe(L,"paste",function(Q){if(!N(Q)||Re(g,Q)||vs(Q,g))return;y<=11&&setTimeout(Vt(g,function(){return t.updateFromDOM()}),20)}),Pe(L,"compositionstart",function(Q){t.composing={data:Q.data,done:!1}}),Pe(L,"compositionupdate",function(Q){t.composing||(t.composing={data:Q.data,done:!1})}),Pe(L,"compositionend",function(Q){t.composing&&(Q.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Pe(L,"touchstart",function(){return _.forceCompositionEnd()}),Pe(L,"input",function(){t.composing||t.readFromDOMSoon()});function V(Q){if(!N(Q)||Re(g,Q))return;if(g.somethingSelected())Yi({lineWise:!1,text:g.getSelections()}),Q.type=="cut"&&g.replaceSelection("",null,"cut");else if(g.options.lineWiseCopyCut){var q=ys(g);Yi({lineWise:!0,text:q.text}),Q.type=="cut"&&g.operation(function(){g.setSelections(q.ranges,0,Me),g.replaceSelection("",null,"cut")})}else return;if(Q.clipboardData){Q.clipboardData.clearData();var ee=Sr.text.join(`
|
|
|
`);if(Q.clipboardData.setData("Text",ee),Q.clipboardData.getData("Text")==ee){Q.preventDefault();return}}var _e=xs(),we=_e.firstChild;g.display.lineSpace.insertBefore(_e,g.display.lineSpace.firstChild),we.value=Sr.text.join(`
|
|
|
`);var He=document.activeElement;W(we),setTimeout(function(){g.display.lineSpace.removeChild(_e),He.focus(),He==L&&_.showPrimarySelection()},50)}Pe(L,"copy",V),Pe(L,"cut",V)},kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},kt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,_=t.doc.sel.primary(),g=_.from(),L=_.to();if(t.display.viewTo==t.display.viewFrom||g.line>=t.display.viewTo||L.line<t.display.viewFrom){e.removeAllRanges();return}var N=Qi(t,e.anchorNode,e.anchorOffset),V=Qi(t,e.focusNode,e.focusOffset);if(N&&!N.bad&&V&&!V.bad&&vt(qr(N,V),g)==0&&vt(pn(N,V),L)==0)return;var Q=t.display.view,q=g.line>=t.display.viewFrom&&Ss(t,g)||{node:Q[0].measure.map[2],offset:0},ee=L.line<t.display.viewTo&&Ss(t,L);if(!ee){var _e=Q[Q.length-1].measure,we=_e.maps?_e.maps[_e.maps.length-1]:_e.map;ee={node:we[we.length-1],offset:we[we.length-2]-we[we.length-3]}}if(!q||!ee){e.removeAllRanges();return}var He=e.rangeCount&&e.getRangeAt(0),Xe;try{Xe=I(q.node,q.offset,ee.offset,ee.node)}catch(Ye){}Xe&&(!D&&t.state.focused?(e.collapse(q.node,q.offset),Xe.collapsed||(e.removeAllRanges(),e.addRange(Xe))):(e.removeAllRanges(),e.addRange(Xe)),He&&e.anchorNode==null?e.addRange(He):D&&this.startGracePeriod()),this.rememberSelection()},kt.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)},kt.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return P(this.div,t)},kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},kt.prototype.blur=function(){this.div.blur()},kt.prototype.getField=function(){return this.div},kt.prototype.supportsTouch=function(){return!0},kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():hr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(a&&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 _=Qi(t,e.anchorNode,e.anchorOffset),g=Qi(t,e.focusNode,e.focusOffset);_&&g&&hr(t,function(){tr(t.doc,jr(_,g),Me),(_.bad||g.bad)&&(t.curOp.selectionChanged=!0)})},kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,_=e.doc.sel.primary(),g=_.from(),L=_.to();if(g.ch==0&&g.line>e.firstLine()&&(g=et(g.line-1,dt(e.doc,g.line-1).length)),L.ch==dt(e.doc,L.line).text.length&&L.line<e.lastLine()&&(L=et(L.line+1,0)),g.line<t.viewFrom||L.line>t.viewTo-1)return!1;var N,V,Q;g.line==t.viewFrom||(N=on(e,g.line))==0?(V=Tt(t.view[0].line),Q=t.view[0].node):(V=Tt(t.view[N].line),Q=t.view[N-1].node.nextSibling);var q=on(e,L.line),ee,_e;if(q==t.view.length-1?(ee=t.viewTo-1,_e=t.lineDiv.lastChild):(ee=Tt(t.view[q+1].line)-1,_e=t.view[q+1].node.previousSibling),!Q)return!1;for(var we=e.doc.splitLines(tu(e,Q,_e,V,ee)),He=Lr(e.doc,et(V,0),et(ee,dt(e.doc,ee).text.length));we.length>1&&He.length>1;)if(re(we)==re(He))we.pop(),He.pop(),ee--;else if(we[0]==He[0])we.shift(),He.shift(),V++;else break;for(var Xe=0,Ye=0,qe=we[0],rt=He[0],at=Math.min(qe.length,rt.length);Xe<at&&qe.charCodeAt(Xe)==rt.charCodeAt(Xe);)++Xe;for(var lt=re(we),ot=re(He),ut=Math.min(lt.length-(we.length==1?Xe:0),ot.length-(He.length==1?Xe:0));Ye<ut&<.charCodeAt(lt.length-Ye-1)==ot.charCodeAt(ot.length-Ye-1);)++Ye;if(we.length==1&&He.length==1&&V==g.line)for(;Xe&&Xe>g.ch&<.charCodeAt(lt.length-Ye-1)==ot.charCodeAt(ot.length-Ye-1);)Xe--,Ye++;we[we.length-1]=lt.slice(0,lt.length-Ye).replace(/^\u200b+/,""),we[0]=we[0].slice(Xe).replace(/\u200b+$/,"");var pt=et(V,Xe),ft=et(ee,He.length?re(He).length-Ye:0);if(we.length>1||we[0]||vt(pt,ft))return Rn(e.doc,we,pt,ft,"+input"),!0},kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},kt.prototype.reset=function(){this.forceCompositionEnd()},kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},kt.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)},kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&hr(this.cm,function(){return or(e.cm)})},kt.prototype.setUneditable=function(e){e.contentEditable="false"},kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Vt(this.cm,Ma)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},kt.prototype.onContextMenu=function(){},kt.prototype.resetPosition=function(){},kt.prototype.needsContentAttribute=!0;function Ss(e,t){var _=ra(e,t.line);if(!_||_.hidden)return null;var g=dt(e.doc,t.line),L=Ya(_,g,t.line),N=We(g,e.doc.direction),V="left";if(N){var Q=J(N,t.ch);V=Q%2?"right":"left"}var q=Za(L.map,t.ch,V);return q.offset=q.collapse=="right"?q.end:q.start,q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Pn(e,t){return t&&(e.bad=!0),e}function tu(e,t,_,g,L){var N="",V=!1,Q=e.doc.lineSeparator(),q=!1;function ee(Xe){return function(Ye){return Ye.id==Xe}}function _e(){V&&(N+=Q,q&&(N+=Q),V=q=!1)}function we(Xe){Xe&&(_e(),N+=Xe)}function He(Xe){if(Xe.nodeType==1){var Ye=Xe.getAttribute("cm-text");if(Ye){we(Ye);return}var qe=Xe.getAttribute("cm-marker"),rt;if(qe){var at=e.findMarks(et(g,0),et(L+1,0),ee(+qe));at.length&&(rt=at[0].find(0))&&we(Lr(e.doc,rt.from,rt.to).join(Q));return}if(Xe.getAttribute("contenteditable")=="false")return;var lt=/^(pre|div|p|li|table|br)$/i.test(Xe.nodeName);if(!/^br$/i.test(Xe.nodeName)&&Xe.textContent.length==0)return;lt&&_e();for(var ot=0;ot<Xe.childNodes.length;ot++)He(Xe.childNodes[ot]);/^(pre|p)$/i.test(Xe.nodeName)&&(q=!0),lt&&(V=!0)}else Xe.nodeType==3&&we(Xe.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(He(t),t==_);)t=t.nextSibling,q=!1;return N}function Qi(e,t,_){var g;if(t==e.display.lineDiv){if(g=e.display.lineDiv.childNodes[_],!g)return Pn(e.clipPos(et(e.display.viewTo-1)),!0);t=null,_=0}else for(g=t;;g=g.parentNode){if(!g||g==e.display.lineDiv)return null;if(g.parentNode&&g.parentNode==e.display.lineDiv)break}for(var L=0;L<e.display.view.length;L++){var N=e.display.view[L];if(N.node==g)return ru(N,t,_)}}function ru(e,t,_){var g=e.text.firstChild,L=!1;if(!t||!P(g,t))return Pn(et(Tt(e.line),0),!0);if(t==g&&(L=!0,t=g.childNodes[_],_=0,!t)){var N=e.rest?re(e.rest):e.line;return Pn(et(Tt(N),N.text.length),L)}var V=t.nodeType==3?t:null,Q=t;for(!V&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(V=t.firstChild,_&&(_=V.nodeValue.length));Q.parentNode!=g;)Q=Q.parentNode;var q=e.measure,ee=q.maps;function _e(rt,at,lt){for(var ot=-1;ot<(ee?ee.length:0);ot++)for(var ut=ot<0?q.map:ee[ot],pt=0;pt<ut.length;pt+=3){var ft=ut[pt+2];if(ft==rt||ft==at){var xt=Tt(ot<0?e.line:e.rest[ot]),Mt=ut[pt]+lt;return(lt<0||ft!=rt)&&(Mt=ut[pt+(lt?1:0)]),et(xt,Mt)}}}var we=_e(V,Q,_);if(we)return Pn(we,L);for(var He=Q.nextSibling,Xe=V?V.nodeValue.length-_:0;He;He=He.nextSibling){if(we=_e(He,He.firstChild,0),we)return Pn(et(we.line,we.ch-Xe),L);Xe+=He.textContent.length}for(var Ye=Q.previousSibling,qe=_;Ye;Ye=Ye.previousSibling){if(we=_e(Ye,Ye.firstChild,-1),we)return Pn(et(we.line,we.ch+qe),L);qe+=Ye.textContent.length}}var jt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new te,this.hasSelection=!1,this.composing=null};jt.prototype.init=function(e){var t=this,_=this,g=this.cm;this.createField(e);var L=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),n&&(L.style.width="0px"),Pe(L,"input",function(){S&&y>=9&&t.hasSelection&&(t.hasSelection=null),_.poll()}),Pe(L,"paste",function(V){if(Re(g,V)||vs(V,g))return;g.state.pasteIncoming=+new Date,_.fastPoll()});function N(V){if(Re(g,V))return;if(g.somethingSelected())Yi({lineWise:!1,text:g.getSelections()});else if(g.options.lineWiseCopyCut){var Q=ys(g);Yi({lineWise:!0,text:Q.text}),V.type=="cut"?g.setSelections(Q.ranges,null,Me):(_.prevInput="",L.value=Q.text.join(`
|
|
|
`),W(L))}else return;V.type=="cut"&&(g.state.cutIncoming=+new Date)}Pe(L,"cut",N),Pe(L,"copy",N),Pe(e.scroller,"paste",function(V){if(Or(e,V)||Re(g,V))return;if(!L.dispatchEvent){g.state.pasteIncoming=+new Date,_.focus();return}var Q=new Event("paste");Q.clipboardData=V.clipboardData,L.dispatchEvent(Q)}),Pe(e.lineSpace,"selectstart",function(V){Or(e,V)||Y(V)}),Pe(L,"compositionstart",function(){var V=g.getCursor("from");_.composing&&_.composing.range.clear(),_.composing={start:V,range:g.markText(V,g.getCursor("to"),{className:"CodeMirror-composing"})}}),Pe(L,"compositionend",function(){_.composing&&(_.poll(),_.composing.range.clear(),_.composing=null)})},jt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},jt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},jt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,_=e.doc,g=lo(e);if(e.options.moveInputWithCursor){var L=xr(e,_.sel.primary().head,"div"),N=t.wrapper.getBoundingClientRect(),V=t.lineDiv.getBoundingClientRect();g.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,L.top+V.top-N.top)),g.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,L.left+V.left-N.left))}return g},jt.prototype.showSelection=function(e){var t=this.cm,_=t.display;A(_.cursorDiv,e.cursors),A(_.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},jt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var _=t.getSelection();this.textarea.value=_,t.state.focused&&W(this.textarea),S&&y>=9&&(this.hasSelection=_)}else e||(this.prevInput=this.textarea.value="",S&&y>=9&&(this.hasSelection=null))},jt.prototype.getField=function(){return this.textarea},jt.prototype.supportsTouch=function(){return!1},jt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!i||B()!=this.textarea))try{this.textarea.focus()}catch(e){}},jt.prototype.blur=function(){this.textarea.blur()},jt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},jt.prototype.receivedFocus=function(){this.slowPoll()},jt.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()})},jt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function _(){var g=t.poll();!g&&!e?(e=!0,t.polling.set(60,_)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,_)},jt.prototype.poll=function(){var e=this,t=this.cm,_=this.textarea,g=this.prevInput;if(this.contextMenuPending||!t.state.focused||Qe(_)&&!g&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var L=_.value;if(L==g&&!t.somethingSelected())return!1;if(S&&y>=9&&this.hasSelection===L||h&&/[\uf700-\uf7ff]/.test(L))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var N=L.charCodeAt(0);if(N==8203&&!g&&(g="\u200B"),N==8666)return this.reset(),this.cm.execCommand("undo")}for(var V=0,Q=Math.min(g.length,L.length);V<Q&&g.charCodeAt(V)==L.charCodeAt(V);)++V;return hr(t,function(){Ma(t,L.slice(V),g.length-V,null,e.composing?"*compose":null),L.length>1e3||L.indexOf(`
|
|
|
`)>-1?_.value=e.prevInput="":e.prevInput=L,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},jt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},jt.prototype.onKeyPress=function(){S&&y>=9&&(this.hasSelection=null),this.fastPoll()},jt.prototype.onContextMenu=function(e){var t=this,_=t.cm,g=_.display,L=t.textarea;t.contextMenuPending&&t.contextMenuPending();var N=an(_,e),V=g.scroller.scrollTop;if(!N||d)return;var Q=_.options.resetSelectionOnContextMenu;Q&&_.doc.sel.contains(N)==-1&&Vt(_,tr)(_.doc,jr(N),Me);var q=L.style.cssText,ee=t.wrapper.style.cssText,_e=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",L.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
|
top: `+(e.clientY-_e.top-5)+"px; left: "+(e.clientX-_e.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 we;p&&(we=window.scrollY),g.input.focus(),p&&window.scrollTo(null,we),g.input.reset(),_.somethingSelected()||(L.value=t.prevInput=" "),t.contextMenuPending=Xe,g.selForContextMenu=_.doc.sel,clearTimeout(g.detectingSelectAll);function He(){if(L.selectionStart!=null){var qe=_.somethingSelected(),rt="\u200B"+(qe?L.value:"");L.value="\u21DA",L.value=rt,t.prevInput=qe?"":"\u200B",L.selectionStart=1,L.selectionEnd=rt.length,g.selForContextMenu=_.doc.sel}}function Xe(){if(t.contextMenuPending!=Xe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=ee,L.style.cssText=q,S&&y<9&&g.scrollbars.setScrollTop(g.scroller.scrollTop=V),L.selectionStart!=null){(!S||S&&y<9)&&He();var qe=0,rt=function(){g.selForContextMenu==_.doc.sel&&L.selectionStart==0&&L.selectionEnd>0&&t.prevInput=="\u200B"?Vt(_,Xo)(_):qe++<10?g.detectingSelectAll=setTimeout(rt,500):(g.selForContextMenu=null,g.input.reset())};g.detectingSelectAll=setTimeout(rt,200)}}if(S&&y>=9&&He(),C){ae(e);var Ye=function(){ne(window,"mouseup",Ye),setTimeout(Xe,20)};Pe(window,"mouseup",Ye)}else setTimeout(Xe,50)},jt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},jt.prototype.setUneditable=function(){},jt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?K(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var _=B();t.autofocus=_==e||e.getAttribute("autofocus")!=null&&_==document.body}function g(){e.value=Q.getValue()}var L;if(e.form&&(Pe(e.form,"submit",g),!t.leaveSubmitMethodAlone)){var N=e.form;L=N.submit;try{var V=N.submit=function(){g(),N.submit=L,N.submit(),N.submit=V}}catch(q){}}t.finishInit=function(q){q.save=g,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,g(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(ne(e.form,"submit",g),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=L))}},e.style.display="none";var Q=Nt(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Q}function iu(e){e.off=ne,e.on=Pe,e.wheelEventPixels=dl,e.Doc=sr,e.splitLines=tt,e.countColumn=z,e.findColumn=Fe,e.isWordChar=je,e.Pass=Ue,e.signal=be,e.Line=Pt,e.changeEnd=Wr,e.scrollbarModel=vo,e.Pos=et,e.cmpPos=vt,e.modes=ct,e.mimeModes=nt,e.resolveMode=Et,e.getMode=Xt,e.modeExtensions=Kt,e.extendMode=Rt,e.copyState=Ct,e.startState=nr,e.innerMode=Lt,e.commands=pi,e.keyMap=Mr,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=On,e.normalizeKeyMap=Ml,e.StringStream=wt,e.SharedTextMarker=di,e.TextMarker=Gr,e.LineWidget=ci,e.e_preventDefault=Y,e.e_stopPropagation=Z,e.e_stop=ae,e.addClass=H,e.contains=P,e.rmClass=b,e.keyNames=Vr}Ql(Nt),Jl(Nt);var au="iter insert remove copy getEditor constructor".split(" ");for(var qi in sr.prototype)sr.prototype.hasOwnProperty(qi)&&de(au,qi)<0&&(Nt.prototype[qi]=function(e){return function(){return e.apply(this.doc,arguments)}}(sr.prototype[qi]));return he(sr),Nt.inputStyles={textarea:jt,contenteditable:kt},Nt.defineMode=function(e){!Nt.defaults.mode&&e!="null"&&(Nt.defaults.mode=e),_t.apply(this,arguments)},Nt.defineMIME=St,Nt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Nt.defineMIME("text/plain","null"),Nt.defineExtension=function(e,t){Nt.prototype[e]=t},Nt.defineDocExtension=function(e,t){sr.prototype[e]=t},Nt.fromTextArea=nu,iu(Nt),Nt.version="5.58.2",Nt})},Y1PL:function(Ze,ce,ie){"use strict";ie.r(ce),ie.d(ce,"ResizableTextArea",function(){return de});var j=ie("wx14"),k=ie("1OyB"),D=ie("vuIU"),R=ie("Ji7U"),O=ie("LK+K"),c=ie("q1tI"),S=ie("VTBJ"),y=ie("rePB"),p=ie("Zm9Q"),u=ie("Kwbf"),o=ie("c+Xe"),d=ie("m+aA"),s=ie("bdgK"),l=new Map;function r(Me){Me.forEach(function(Le){var Oe,Fe=Le.target;(Oe=l.get(Fe))===null||Oe===void 0||Oe.forEach(function(ye){return ye(Fe)})})}var n=new s.default(r),a=null,i=null;function h(Me,Le){l.has(Me)||(l.set(Me,new Set),n.observe(Me)),l.get(Me).add(Le)}function f(Me,Le){l.has(Me)&&(l.get(Me).delete(Le),l.get(Me).size||(n.unobserve(Me),l.delete(Me)))}var w=function(Me){Object(R.a)(Oe,Me);var Le=Object(O.a)(Oe);function Oe(){return Object(k.a)(this,Oe),Le.apply(this,arguments)}return Object(D.a)(Oe,[{key:"render",value:function(){return this.props.children}}]),Oe}(c.Component),m=c.createContext(null);function T(Me){var Le=Me.children,Oe=Me.onBatchResize,Fe=c.useRef(0),ye=c.useRef([]),Ae=c.useContext(m),re=c.useCallback(function(pe,ue,Ie){Fe.current+=1;var Ke=Fe.current;ye.current.push({size:pe,element:ue,data:Ie}),Promise.resolve().then(function(){Ke===Fe.current&&(Oe==null||Oe(ye.current),ye.current=[])}),Ae==null||Ae(pe,ue,Ie)},[Oe,Ae]);return c.createElement(m.Provider,{value:re},Le)}function C(Me){var Le=Me.children,Oe=Me.disabled,Fe=c.useRef(null),ye=c.useRef(null),Ae=c.useContext(m),re=c.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),pe=c.isValidElement(Le)&&Object(o.c)(Le),ue=pe?Le.ref:null,Ie=c.useMemo(function(){return Object(o.a)(ue,Fe)},[ue,Fe]),Ke=c.useRef(Me);Ke.current=Me;var Ne=c.useCallback(function(je){var Ge=Ke.current,ze=Ge.onResize,ke=Ge.data,xe=je.getBoundingClientRect(),Ee=xe.width,Se=xe.height,$=je.offsetWidth,fe=je.offsetHeight,J=Math.floor(Ee),Ce=Math.floor(Se);if(re.current.width!==J||re.current.height!==Ce||re.current.offsetWidth!==$||re.current.offsetHeight!==fe){var We={width:J,height:Ce,offsetWidth:$,offsetHeight:fe};re.current=We;var Ve=$===Math.round(Ee)?Ee:$,Pe=fe===Math.round(Se)?Se:fe,Je=Object(S.a)(Object(S.a)({},We),{},{offsetWidth:Ve,offsetHeight:Pe});Ae==null||Ae(Je,je,ke),ze&&Promise.resolve().then(function(){ze(Je,je)})}},[]);return c.useEffect(function(){var je=Object(d.a)(Fe.current)||Object(d.a)(ye.current);return je&&!Oe&&h(je,Ne),function(){return f(je,Ne)}},[Fe.current,Oe]),c.createElement(w,{ref:ye},pe?c.cloneElement(Le,{ref:Ie}):Le)}var x="rc-observer-key";function b(Me){var Le=Me.children,Oe=Object(p.a)(Le);return Oe.map(function(Fe,ye){var Ae=(Fe==null?void 0:Fe.key)||"".concat(x,"-").concat(ye);return c.createElement(C,Object(j.a)({},Me,{key:Ae}),Fe)})}b.Collection=T;var E=b,A=ie("bT9E"),v=ie("TSYQ"),M=ie.n(v),I=`
|
|
|
min-height:0 !important;
|
|
|
max-height:none !important;
|
|
|
height:0 !important;
|
|
|
visibility:hidden !important;
|
|
|
overflow:hidden !important;
|
|
|
position:absolute !important;
|
|
|
z-index:-1000 !important;
|
|
|
top:0 !important;
|
|
|
right:0 !important
|
|
|
`,P=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],B={},H;function F(Me){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=Me.getAttribute("id")||Me.getAttribute("data-reactid")||Me.getAttribute("name");if(Le&&B[Oe])return B[Oe];var Fe=window.getComputedStyle(Me),ye=Fe.getPropertyValue("box-sizing")||Fe.getPropertyValue("-moz-box-sizing")||Fe.getPropertyValue("-webkit-box-sizing"),Ae=parseFloat(Fe.getPropertyValue("padding-bottom"))+parseFloat(Fe.getPropertyValue("padding-top")),re=parseFloat(Fe.getPropertyValue("border-bottom-width"))+parseFloat(Fe.getPropertyValue("border-top-width")),pe=P.map(function(Ie){return"".concat(Ie,":").concat(Fe.getPropertyValue(Ie))}).join(";"),ue={sizingStyle:pe,paddingSize:Ae,borderSize:re,boxSizing:ye};return Le&&Oe&&(B[Oe]=ue),ue}function W(Me){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,Fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;H||(H=document.createElement("textarea"),H.setAttribute("tab-index","-1"),H.setAttribute("aria-hidden","true"),document.body.appendChild(H)),Me.getAttribute("wrap")?H.setAttribute("wrap",Me.getAttribute("wrap")):H.removeAttribute("wrap");var ye=F(Me,Le),Ae=ye.paddingSize,re=ye.borderSize,pe=ye.boxSizing,ue=ye.sizingStyle;H.setAttribute("style","".concat(ue,";").concat(I)),H.value=Me.value||Me.placeholder||"";var Ie=Number.MIN_SAFE_INTEGER,Ke=Number.MAX_SAFE_INTEGER,Ne=H.scrollHeight,je;if(pe==="border-box"?Ne+=re:pe==="content-box"&&(Ne-=Ae),Oe!==null||Fe!==null){H.value=" ";var Ge=H.scrollHeight-Ae;Oe!==null&&(Ie=Ge*Oe,pe==="border-box"&&(Ie=Ie+Ae+re),Ne=Math.max(Ie,Ne)),Fe!==null&&(Ke=Ge*Fe,pe==="border-box"&&(Ke=Ke+Ae+re),je=Ne>Ke?"":"hidden",Ne=Math.min(Ke,Ne))}return{height:Ne,minHeight:Ie,maxHeight:Ke,overflowY:je,resize:"none"}}var U=ie("Gytx"),K=ie.n(U),z;(function(Me){Me[Me.NONE=0]="NONE",Me[Me.RESIZING=1]="RESIZING",Me[Me.RESIZED=2]="RESIZED"})(z||(z={}));var te=function(Me){Object(R.a)(Oe,Me);var Le=Object(O.a)(Oe);function Oe(Fe){var ye;return Object(k.a)(this,Oe),ye=Le.call(this,Fe),ye.nextFrameActionId=void 0,ye.resizeFrameId=void 0,ye.textArea=void 0,ye.saveTextArea=function(Ae){ye.textArea=Ae},ye.handleResize=function(Ae){var re=ye.state.resizeStatus,pe=ye.props,ue=pe.autoSize,Ie=pe.onResize;if(re!==z.NONE)return;typeof Ie=="function"&&Ie(Ae),ue&&ye.resizeOnNextFrame()},ye.resizeOnNextFrame=function(){cancelAnimationFrame(ye.nextFrameActionId),ye.nextFrameActionId=requestAnimationFrame(ye.resizeTextarea)},ye.resizeTextarea=function(){var Ae=ye.props.autoSize;if(!Ae||!ye.textArea)return;var re=Ae.minRows,pe=Ae.maxRows,ue=W(ye.textArea,!1,re,pe);ye.setState({textareaStyles:ue,resizeStatus:z.RESIZING},function(){cancelAnimationFrame(ye.resizeFrameId),ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:z.RESIZED},function(){ye.resizeFrameId=requestAnimationFrame(function(){ye.setState({resizeStatus:z.NONE}),ye.fixFirefoxAutoScroll()})})})})},ye.renderTextArea=function(){var Ae=ye.props,re=Ae.prefixCls,pe=re===void 0?"rc-textarea":re,ue=Ae.autoSize,Ie=Ae.onResize,Ke=Ae.className,Ne=Ae.disabled,je=ye.state,Ge=je.textareaStyles,ze=je.resizeStatus,ke=Object(A.a)(ye.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),xe=M()(pe,Ke,Object(y.a)({},"".concat(pe,"-disabled"),Ne));"value"in ke&&(ke.value=ke.value||"");var Ee=Object(S.a)(Object(S.a)(Object(S.a)({},ye.props.style),Ge),ze===z.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return c.createElement(E,{onResize:ye.handleResize,disabled:!(ue||Ie)},c.createElement("textarea",Object(j.a)({},ke,{className:xe,style:Ee,ref:ye.saveTextArea})))},ye.state={textareaStyles:{},resizeStatus:z.NONE},ye}return Object(D.a)(Oe,[{key:"componentDidUpdate",value:function(ye){(ye.value!==this.props.value||!K()(ye.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 ye=this.textArea.selectionStart,Ae=this.textArea.selectionEnd;this.textArea.setSelectionRange(ye,Ae)}}catch(re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Oe}(c.Component),de=te,ge=function(Me){Object(R.a)(Oe,Me);var Le=Object(O.a)(Oe);function Oe(Fe){var ye;Object(k.a)(this,Oe),ye=Le.call(this,Fe),ye.resizableTextArea=void 0,ye.focus=function(){ye.resizableTextArea.textArea.focus()},ye.saveTextArea=function(re){ye.resizableTextArea=re},ye.handleChange=function(re){var pe=ye.props.onChange;ye.setValue(re.target.value,function(){ye.resizableTextArea.resizeTextarea()}),pe&&pe(re)},ye.handleKeyDown=function(re){var pe=ye.props,ue=pe.onPressEnter,Ie=pe.onKeyDown;re.keyCode===13&&ue&&ue(re),Ie&&Ie(re)};var Ae=typeof Fe.value=="undefined"||Fe.value===null?Fe.defaultValue:Fe.value;return ye.state={value:Ae},ye}return Object(D.a)(Oe,[{key:"setValue",value:function(ye,Ae){"value"in this.props||this.setState({value:ye},Ae)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return c.createElement(de,Object(j.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ye){return"value"in ye?{value:ye.value}:null}}]),Oe}(c.Component),Ue=ce.default=ge},YJ9k:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(O,c){if(!(O instanceof c))throw new TypeError("Cannot call a class as a function")}function k(O,c){for(var S=0;S<c.length;S++){var y=c[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function D(O,c,S){return c&&k(O.prototype,c),S&&k(O,S),O}var R=function(){function O(){j(this,O),this._listeners=new Map}return D(O,[{key:"addEventListener",value:function(S,y){this._listeners.has(S)||this._listeners.set(S,new Set),this._listeners.get(S).add(y)}},{key:"removeEventListener",value:function(S,y){this._listeners.has(S)&&this._listeners.get(S).delete(y)}},{key:"dispatchEvent",value:function(S){var y=this;return this._listeners.has(S.type)?(this._listeners.get(S.type).forEach(function(p){return p.call(y,S)}),!S.defaultPrevented):!0}}]),O}();ce.default=R},ZW9T:function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return w});var j=ie("k1fw"),k=ie("miYZ"),D=ie("tsqr"),R=ie("rAM+"),O=ie("tJVT"),c=ie("PpiC"),S=ie("q1tI"),y=ie.n(S),p=ie("bdgK");function u(m,T,C,x,b){var E=T.getWordUntilPosition(C),A={startLineNumber:C.lineNumber,endLineNumber:C.lineNumber,startColumn:E.startColumn,endColumn:E.endColumn},v=x.map(function(M){return{label:M,kind:m.languages.CompletionItemKind.Keyword,insertText:M,insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:A}});return b.map(function(M){v.push(Object(j.a)(Object(j.a)({},M),{},{range:A}))}),v}var o=function(m){var T={label:"ifelse",kind:m.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},C=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];m.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(A,v){var M=u(m,A,v,C,[T]);return{suggestions:M}}});var x=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];m.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(A,v){var M=[{label:"print",kind:m.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],I=u(m,A,v,x,M);return{suggestions:I}}});var b=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];m.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(A,v){var M=[T,{label:"main",kind:m.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:m.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
|
`),insertTextRules:m.languages.CompletionItemInsertTextRule.InsertAsSnippet}],I=u(m,A,v,b,M);return{suggestions:I}}})},d="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",s=ie("LvDl");function l(m){return/^\d+$/.test(m)?"".concat(m,"px"):m}function r(){}var n=!1,a={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function i(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],T=m;if(Array.isArray(m)){for(var C=0;C<m.length;C++){var x=a[m[C]];if(x)return x}return T[0]}return a[T]||T}var h=null,f=ce.b=function(m){var T=m.width,C=T===void 0?"100%":T,x=m.height,b=x===void 0?"100%":x,E=m.value,A=m.language,v=A===void 0?"javascript":A,M=m.style,I=M===void 0?{}:M,P=m.options,B=P===void 0?{}:P,H=m.overrideServices,F=H===void 0?{}:H,W=m.theme,U=W===void 0?"vs-dark":W,K=m.onEditBlur,z=m.onSave,te=m.autoHeight,de=te===void 0?!1:te,ge=m.forbidCopy,Ue=ge===void 0?!1:ge,Me=m.onChange,Le=Me===void 0?r:Me,Oe=m.editorDidMount,Fe=Oe===void 0?r:Oe,ye=m.onFocus,Ae=ye===void 0?r:ye,re=m.filename,pe=re===void 0?"educoder.txt":re,ue=Object(c.a)(m,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Ie=Object(S.useRef)(),Ke=Object(S.useRef)({}),Ne=Object(S.useRef)(),je=Object(S.useRef)(!1),Ge=Object(S.useRef)(),ze=Object(S.useState)(!1),ke=Object(O.a)(ze,2),xe=ke[0],Ee=ke[1];function Se(){var G;return Ie.current&&(G=new p.default(function(ae){var Te=Object(R.a)(ae),X;try{for(Te.s();!(X=Te.n()).done;){var me=X.value;(me.target.offsetHeight>0||me.target.offsetWidth>0)&&Ke.current.instance.layout()}}catch(De){Te.e(De)}finally{Te.f()}}),G.observe(Ie.current)),G}function $(){D.b.warn(decodeURIComponent(d))}var fe=function(){var ae=Ke.current.instance;if(E!=null&&ae&&xe){var Te=ae.getModel();Te&&E!==Te.getValue()&&(n=!0,Te.setValue(E),ae.layout(),n=!1)}};Object(S.useEffect)(function(){Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(function(){fe()},500)},[E,xe,Ke.current]);function J(){var G=Ke.current.instance;if(G){var ae=G.getSelection(),Te=Ke.current.pastePos||{},X=new h.Range(Te.startLineNumber||ae.endLineNumber,Te.startColumn||ae.endColumn,Te.endLineNumber||ae.endLineNumber,Te.endColumn||ae.endColumn);setTimeout(function(){G.executeEdits("",[{range:X,text:""}])},300)}}function Ce(G){(window.navigator.platform.match("Mac")?G.metaKey:G.ctrlKey)&&G.keyCode==83&&(G.preventDefault(),z())}var We=function(){if(de&&Ke.current.instance){var ae=Ke.current.instance.getContentHeight();Y(ae<b?b:ae)}else Y(b)};function Ve(G){var ae=document.createEvent("MouseEvents");ae.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),G.dispatchEvent(ae)}function Pe(G,ae){var Te=window.URL||window.webkitURL||window,X=new Blob([ae]),me=document.createElementNS("http://www.w3.org/1999/xhtml","a");me.href=Te.createObjectURL(X),me.download=G,Ve(me)}Object(S.useEffect)(function(){We()},[We]),Object(S.useEffect)(function(){Ie.current&&!xe&&ie.e(26).then(ie.t.bind(null,"M/lh",7)).then(function(G){try{h=G,Ke.current.instance=h.editor.create(Ie.current,{value:E,language:i(v),theme:U,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},F);var ae=Ke.current.instance;if(Fe(ae,h),setTimeout(function(){We(),Ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Pe(pe||"educoder.txt",ae.getValue())}})},500),Ke.current.subscription=ae.onDidChangeModelContent(function(X){je.current?clearTimeout(Ge.current):(We(),Le(ae.getValue(),X)),Ge.current=setTimeout(function(){je.current=!1},500)}),window.Monaco||o(h),Ue&&(ae.addCommand(h.KeyMod.CtrlCmd|h.KeyMod.Shift|h.KeyCode.KEY_V,function(){return $(),null}),ae.addCommand(h.KeyMod.CtrlCmd|h.KeyCode.KEY_C,function(){return $(),null})),window.Monaco=h,K&&ae.onDidBlurEditorWidget(function(){K(ae.getValue())}),Ae&&ae.onDidFocusEditorText(function(){Ae(ae.getValue())}),Ue){ae.addCommand(h.KeyMod.CtrlCmd|h.KeyCode.KEY_V,function(){return $(),null}),ae.onDidPaste(function(X){Ke.current.pastePos=X});try{window.addEventListener("paste",J)}catch(X){}}var Te=Se();return Ee(!0),function(){var X=Ke.current.instance;X.dispose();var me=X.getModel();me&&me.dispose(),Ke.current.subscription&&Ke.current.subscription.dispose(),Ue&&window.removeEventListener("paste",J),Te.unobserve(Ie.current)}}catch(X){}})},[]),Object(S.useEffect)(function(){var G=Ke.current.instance;if(G&&xe)return document.addEventListener("keydown",Ce,!1),function(){document.removeEventListener("keydown",Ce)}},[z,xe]),Object(S.useEffect)(function(){var G=Ke.current.instance;if(G&&xe){var ae=i(v);h.editor.setModelLanguage(G.getModel(),ae),console.log("language:",v,G.getModel(),ae)}},[v,xe]),Object(S.useEffect)(function(){var G=Ke.current.instance;G&&xe&&h.editor.setTheme(U)},[U,xe]),Object(S.useEffect)(function(){var G=Ke.current.instance;G&&xe&&(G.updateOptions(Object(j.a)({},B)),setTimeout(function(){G.getModel().updateOptions(Object(j.a)({},B))},200))},[JSON.stringify(B),xe]),Object(S.useEffect)(function(){var G=Ke.current.instance;G&&xe&&G.layout()},[C,b,xe]);var Je=Object(S.useState)(l(C)),ne=Object(O.a)(Je,2),be=ne[0],Re=ne[1],le=Object(S.useState)(l(b)),se=Object(O.a)(le,2),he=se[0],Y=se[1],Z=Object(j.a)(Object(j.a)({},I),{},{width:be,height:he});return y.a.createElement("div",{className:"my-monaco-editor",ref:Ie,style:Z})};function w(m){var T=m.width,C=T===void 0?"100%":T,x=m.height,b=x===void 0?"100%":x,E=m.original,A=m.modified,v=m.language,M=m.options,I=M===void 0?{}:M,P=Object(S.useRef)(),B=Object(S.useState)(null),H=Object(O.a)(B,2),F=H[0],W=H[1];function U(de){var ge;return P.current&&(ge=new p.default(function(Ue){var Me=Object(R.a)(Ue),Le;try{for(Me.s();!(Le=Me.n()).done;){var Oe=Le.value;(Oe.target.offsetHeight>0||Oe.target.offsetWidth>0)&&de.layout()}}catch(Fe){Me.e(Fe)}finally{Me.f()}}),ge.observe(P.current)),ge}Object(S.useEffect)(function(){P.current&&ie.e(26).then(ie.t.bind(null,"M/lh",7)).then(function(de){h=de;var ge=h.editor.createDiffEditor(P.current,Object(j.a)(Object(j.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},I),{},{wordWrap:!0}));W(ge);var Ue=U(ge);return function(){ge.dispose();var Me=ge.getModel();Me&&Me.dispose(),Ue.unobserve(P.current)}})},[]),Object(S.useEffect)(function(){F&&F.setModel({original:h.editor.createModel(E,v),modified:h.editor.createModel(A,v)})},[E,A,v,F]);var K=l(C),z=l(b),te={width:K,height:z};return y.a.createElement("div",{className:"my-diff-editor",ref:P,style:te})}},ZpRC:function(Ze,ce,ie){"use strict";function j(o){return typeof o=="object"&&o!=null&&o.nodeType===1}function k(o,d){return(!d||o!=="hidden")&&o!=="visible"&&o!=="clip"}function D(o,d){if(o.clientHeight<o.scrollHeight||o.clientWidth<o.scrollWidth){var s=getComputedStyle(o,null);return k(s.overflowY,d)||k(s.overflowX,d)||function(l){var r=function(n){if(!n.ownerDocument||!n.ownerDocument.defaultView)return null;try{return n.ownerDocument.defaultView.frameElement}catch(a){return null}}(l);return!!r&&(r.clientHeight<l.scrollHeight||r.clientWidth<l.scrollWidth)}(o)}return!1}function R(o,d,s,l,r,n,a,i){return n<o&&a>d||n>o&&a<d?0:n<=o&&i<=s||a>=d&&i>=s?n-o-l:a>d&&i<s||n<o&&i>s?a-d+r:0}var O=function(o,d){var s=window,l=d.scrollMode,r=d.block,n=d.inline,a=d.boundary,i=d.skipOverflowHiddenElements,h=typeof a=="function"?a:function(Ge){return Ge!==a};if(!j(o))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,w=[],m=o;j(m)&&h(m);){if((m=m.parentElement)===f){w.push(m);break}m!=null&&m===document.body&&D(m)&&!D(document.documentElement)||m!=null&&D(m,i)&&w.push(m)}for(var T=s.visualViewport?s.visualViewport.width:innerWidth,C=s.visualViewport?s.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,E=o.getBoundingClientRect(),A=E.height,v=E.width,M=E.top,I=E.right,P=E.bottom,B=E.left,H=r==="start"||r==="nearest"?M:r==="end"?P:M+A/2,F=n==="center"?B+v/2:n==="end"?I:B,W=[],U=0;U<w.length;U++){var K=w[U],z=K.getBoundingClientRect(),te=z.height,de=z.width,ge=z.top,Ue=z.right,Me=z.bottom,Le=z.left;if(l==="if-needed"&&M>=0&&B>=0&&P<=C&&I<=T&&M>=ge&&P<=Me&&B>=Le&&I<=Ue)return W;var Oe=getComputedStyle(K),Fe=parseInt(Oe.borderLeftWidth,10),ye=parseInt(Oe.borderTopWidth,10),Ae=parseInt(Oe.borderRightWidth,10),re=parseInt(Oe.borderBottomWidth,10),pe=0,ue=0,Ie="offsetWidth"in K?K.offsetWidth-K.clientWidth-Fe-Ae:0,Ke="offsetHeight"in K?K.offsetHeight-K.clientHeight-ye-re:0;if(f===K)pe=r==="start"?H:r==="end"?H-C:r==="nearest"?R(b,b+C,C,ye,re,b+H,b+H+A,A):H-C/2,ue=n==="start"?F:n==="center"?F-T/2:n==="end"?F-T:R(x,x+T,T,Fe,Ae,x+F,x+F+v,v),pe=Math.max(0,pe+b),ue=Math.max(0,ue+x);else{pe=r==="start"?H-ge-ye:r==="end"?H-Me+re+Ke:r==="nearest"?R(ge,Me,te,ye,re+Ke,H,H+A,A):H-(ge+te/2)+Ke/2,ue=n==="start"?F-Le-Fe:n==="center"?F-(Le+de/2)+Ie/2:n==="end"?F-Ue+Ae+Ie:R(Le,Ue,de,Fe,Ae+Ie,F,F+v,v);var Ne=K.scrollLeft,je=K.scrollTop;H+=je-(pe=Math.max(0,Math.min(je+pe,K.scrollHeight-te+Ke))),F+=Ne-(ue=Math.max(0,Math.min(Ne+ue,K.scrollWidth-de+Ie)))}W.push({el:K,top:pe,left:ue})}return W};function c(o){return o===Object(o)&&Object.keys(o).length!==0}function S(o,d){d===void 0&&(d="auto");var s="scrollBehavior"in document.body.style;o.forEach(function(l){var r=l.el,n=l.top,a=l.left;r.scroll&&s?r.scroll({top:n,left:a,behavior:d}):(r.scrollTop=n,r.scrollLeft=a)})}function y(o){return o===!1?{block:"end",inline:"nearest"}:c(o)?o:{block:"start",inline:"nearest"}}function p(o,d){var s=!o.ownerDocument.documentElement.contains(o);if(c(d)&&typeof d.behavior=="function")return d.behavior(s?[]:O(o,d));if(s)return;var l=y(d);return S(O(o,l),l.behavior)}var u=ce.a=p},Zss7:function(Ze,ce,ie){var j;(function(k){var D=/^\s+/,R=/\s+$/,O=0,c=k.round,S=k.min,y=k.max,p=k.random;function u(re,pe){if(re=re||"",pe=pe||{},re instanceof u)return re;if(!(this instanceof u))return new u(re,pe);var ue=o(re);this._originalInput=re,this._r=ue.r,this._g=ue.g,this._b=ue.b,this._a=ue.a,this._roundA=c(100*this._a)/100,this._format=pe.format||ue.format,this._gradientType=pe.gradientType,this._r<1&&(this._r=c(this._r)),this._g<1&&(this._g=c(this._g)),this._b<1&&(this._b=c(this._b)),this._ok=ue.ok,this._tc_id=O++}u.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 re=this.toRgb();return(re.r*299+re.g*587+re.b*114)/1e3},getLuminance:function(){var re=this.toRgb(),pe,ue,Ie,Ke,Ne,je;return pe=re.r/255,ue=re.g/255,Ie=re.b/255,pe<=.03928?Ke=pe/12.92:Ke=k.pow((pe+.055)/1.055,2.4),ue<=.03928?Ne=ue/12.92:Ne=k.pow((ue+.055)/1.055,2.4),Ie<=.03928?je=Ie/12.92:je=k.pow((Ie+.055)/1.055,2.4),.2126*Ke+.7152*Ne+.0722*je},setAlpha:function(re){return this._a=W(re),this._roundA=c(100*this._a)/100,this},toHsv:function(){var re=r(this._r,this._g,this._b);return{h:re.h*360,s:re.s,v:re.v,a:this._a}},toHsvString:function(){var re=r(this._r,this._g,this._b),pe=c(re.h*360),ue=c(re.s*100),Ie=c(re.v*100);return this._a==1?"hsv("+pe+", "+ue+"%, "+Ie+"%)":"hsva("+pe+", "+ue+"%, "+Ie+"%, "+this._roundA+")"},toHsl:function(){var re=s(this._r,this._g,this._b);return{h:re.h*360,s:re.s,l:re.l,a:this._a}},toHslString:function(){var re=s(this._r,this._g,this._b),pe=c(re.h*360),ue=c(re.s*100),Ie=c(re.l*100);return this._a==1?"hsl("+pe+", "+ue+"%, "+Ie+"%)":"hsla("+pe+", "+ue+"%, "+Ie+"%, "+this._roundA+")"},toHex:function(re){return a(this._r,this._g,this._b,re)},toHexString:function(re){return"#"+this.toHex(re)},toHex8:function(re){return i(this._r,this._g,this._b,this._a,re)},toHex8String:function(re){return"#"+this.toHex8(re)},toRgb:function(){return{r:c(this._r),g:c(this._g),b:c(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+c(this._r)+", "+c(this._g)+", "+c(this._b)+")":"rgba("+c(this._r)+", "+c(this._g)+", "+c(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:c(U(this._r,255)*100)+"%",g:c(U(this._g,255)*100)+"%",b:c(U(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+c(U(this._r,255)*100)+"%, "+c(U(this._g,255)*100)+"%, "+c(U(this._b,255)*100)+"%)":"rgba("+c(U(this._r,255)*100)+"%, "+c(U(this._g,255)*100)+"%, "+c(U(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:H[a(this._r,this._g,this._b,!0)]||!1},toFilter:function(re){var pe="#"+h(this._r,this._g,this._b,this._a),ue=pe,Ie=this._gradientType?"GradientType = 1, ":"";if(re){var Ke=u(re);ue="#"+h(Ke._r,Ke._g,Ke._b,Ke._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ie+"startColorstr="+pe+",endColorstr="+ue+")"},toString:function(re){var pe=!!re;re=re||this._format;var ue=!1,Ie=this._a<1&&this._a>=0,Ke=!pe&&Ie&&(re==="hex"||re==="hex6"||re==="hex3"||re==="hex4"||re==="hex8"||re==="name");return Ke?re==="name"&&this._a===0?this.toName():this.toRgbString():(re==="rgb"&&(ue=this.toRgbString()),re==="prgb"&&(ue=this.toPercentageRgbString()),(re==="hex"||re==="hex6")&&(ue=this.toHexString()),re==="hex3"&&(ue=this.toHexString(!0)),re==="hex4"&&(ue=this.toHex8String(!0)),re==="hex8"&&(ue=this.toHex8String()),re==="name"&&(ue=this.toName()),re==="hsl"&&(ue=this.toHslString()),re==="hsv"&&(ue=this.toHsvString()),ue||this.toHexString())},clone:function(){return u(this.toString())},_applyModification:function(re,pe){var ue=re.apply(null,[this].concat([].slice.call(pe)));return this._r=ue._r,this._g=ue._g,this._b=ue._b,this.setAlpha(ue._a),this},lighten:function(){return this._applyModification(T,arguments)},brighten:function(){return this._applyModification(C,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(f,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(re,pe){return re.apply(null,[this].concat([].slice.call(pe)))},analogous:function(){return this._applyCombination(I,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(P,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(A,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},u.fromRatio=function(re,pe){if(typeof re=="object"){var ue={};for(var Ie in re)re.hasOwnProperty(Ie)&&(Ie==="a"?ue[Ie]=re[Ie]:ue[Ie]=Ue(re[Ie]));re=ue}return u(re,pe)};function o(re){var pe={r:0,g:0,b:0},ue=1,Ie=null,Ke=null,Ne=null,je=!1,Ge=!1;return typeof re=="string"&&(re=ye(re)),typeof re=="object"&&(Fe(re.r)&&Fe(re.g)&&Fe(re.b)?(pe=d(re.r,re.g,re.b),je=!0,Ge=String(re.r).substr(-1)==="%"?"prgb":"rgb"):Fe(re.h)&&Fe(re.s)&&Fe(re.v)?(Ie=Ue(re.s),Ke=Ue(re.v),pe=n(re.h,Ie,Ke),je=!0,Ge="hsv"):Fe(re.h)&&Fe(re.s)&&Fe(re.l)&&(Ie=Ue(re.s),Ne=Ue(re.l),pe=l(re.h,Ie,Ne),je=!0,Ge="hsl"),re.hasOwnProperty("a")&&(ue=re.a)),ue=W(ue),{ok:je,format:re.format||Ge,r:S(255,y(pe.r,0)),g:S(255,y(pe.g,0)),b:S(255,y(pe.b,0)),a:ue}}function d(re,pe,ue){return{r:U(re,255)*255,g:U(pe,255)*255,b:U(ue,255)*255}}function s(re,pe,ue){re=U(re,255),pe=U(pe,255),ue=U(ue,255);var Ie=y(re,pe,ue),Ke=S(re,pe,ue),Ne,je,Ge=(Ie+Ke)/2;if(Ie==Ke)Ne=je=0;else{var ze=Ie-Ke;je=Ge>.5?ze/(2-Ie-Ke):ze/(Ie+Ke);switch(Ie){case re:Ne=(pe-ue)/ze+(pe<ue?6:0);break;case pe:Ne=(ue-re)/ze+2;break;case ue:Ne=(re-pe)/ze+4;break}Ne/=6}return{h:Ne,s:je,l:Ge}}function l(re,pe,ue){var Ie,Ke,Ne;re=U(re,360),pe=U(pe,100),ue=U(ue,100);function je(ke,xe,Ee){return Ee<0&&(Ee+=1),Ee>1&&(Ee-=1),Ee<1/6?ke+(xe-ke)*6*Ee:Ee<1/2?xe:Ee<2/3?ke+(xe-ke)*(2/3-Ee)*6:ke}if(pe===0)Ie=Ke=Ne=ue;else{var Ge=ue<.5?ue*(1+pe):ue+pe-ue*pe,ze=2*ue-Ge;Ie=je(ze,Ge,re+1/3),Ke=je(ze,Ge,re),Ne=je(ze,Ge,re-1/3)}return{r:Ie*255,g:Ke*255,b:Ne*255}}function r(re,pe,ue){re=U(re,255),pe=U(pe,255),ue=U(ue,255);var Ie=y(re,pe,ue),Ke=S(re,pe,ue),Ne,je,Ge=Ie,ze=Ie-Ke;if(je=Ie===0?0:ze/Ie,Ie==Ke)Ne=0;else{switch(Ie){case re:Ne=(pe-ue)/ze+(pe<ue?6:0);break;case pe:Ne=(ue-re)/ze+2;break;case ue:Ne=(re-pe)/ze+4;break}Ne/=6}return{h:Ne,s:je,v:Ge}}function n(re,pe,ue){re=U(re,360)*6,pe=U(pe,100),ue=U(ue,100);var Ie=k.floor(re),Ke=re-Ie,Ne=ue*(1-pe),je=ue*(1-Ke*pe),Ge=ue*(1-(1-Ke)*pe),ze=Ie%6,ke=[ue,je,Ne,Ne,Ge,ue][ze],xe=[Ge,ue,ue,je,Ne,Ne][ze],Ee=[Ne,Ne,Ge,ue,ue,je][ze];return{r:ke*255,g:xe*255,b:Ee*255}}function a(re,pe,ue,Ie){var Ke=[ge(c(re).toString(16)),ge(c(pe).toString(16)),ge(c(ue).toString(16))];return Ie&&Ke[0].charAt(0)==Ke[0].charAt(1)&&Ke[1].charAt(0)==Ke[1].charAt(1)&&Ke[2].charAt(0)==Ke[2].charAt(1)?Ke[0].charAt(0)+Ke[1].charAt(0)+Ke[2].charAt(0):Ke.join("")}function i(re,pe,ue,Ie,Ke){var Ne=[ge(c(re).toString(16)),ge(c(pe).toString(16)),ge(c(ue).toString(16)),ge(Me(Ie))];return Ke&&Ne[0].charAt(0)==Ne[0].charAt(1)&&Ne[1].charAt(0)==Ne[1].charAt(1)&&Ne[2].charAt(0)==Ne[2].charAt(1)&&Ne[3].charAt(0)==Ne[3].charAt(1)?Ne[0].charAt(0)+Ne[1].charAt(0)+Ne[2].charAt(0)+Ne[3].charAt(0):Ne.join("")}function h(re,pe,ue,Ie){var Ke=[ge(Me(Ie)),ge(c(re).toString(16)),ge(c(pe).toString(16)),ge(c(ue).toString(16))];return Ke.join("")}u.equals=function(re,pe){return!re||!pe?!1:u(re).toRgbString()==u(pe).toRgbString()},u.random=function(){return u.fromRatio({r:p(),g:p(),b:p()})};function f(re,pe){pe=pe===0?0:pe||10;var ue=u(re).toHsl();return ue.s-=pe/100,ue.s=K(ue.s),u(ue)}function w(re,pe){pe=pe===0?0:pe||10;var ue=u(re).toHsl();return ue.s+=pe/100,ue.s=K(ue.s),u(ue)}function m(re){return u(re).desaturate(100)}function T(re,pe){pe=pe===0?0:pe||10;var ue=u(re).toHsl();return ue.l+=pe/100,ue.l=K(ue.l),u(ue)}function C(re,pe){pe=pe===0?0:pe||10;var ue=u(re).toRgb();return ue.r=y(0,S(255,ue.r-c(255*-(pe/100)))),ue.g=y(0,S(255,ue.g-c(255*-(pe/100)))),ue.b=y(0,S(255,ue.b-c(255*-(pe/100)))),u(ue)}function x(re,pe){pe=pe===0?0:pe||10;var ue=u(re).toHsl();return ue.l-=pe/100,ue.l=K(ue.l),u(ue)}function b(re,pe){var ue=u(re).toHsl(),Ie=(ue.h+pe)%360;return ue.h=Ie<0?360+Ie:Ie,u(ue)}function E(re){var pe=u(re).toHsl();return pe.h=(pe.h+180)%360,u(pe)}function A(re){var pe=u(re).toHsl(),ue=pe.h;return[u(re),u({h:(ue+120)%360,s:pe.s,l:pe.l}),u({h:(ue+240)%360,s:pe.s,l:pe.l})]}function v(re){var pe=u(re).toHsl(),ue=pe.h;return[u(re),u({h:(ue+90)%360,s:pe.s,l:pe.l}),u({h:(ue+180)%360,s:pe.s,l:pe.l}),u({h:(ue+270)%360,s:pe.s,l:pe.l})]}function M(re){var pe=u(re).toHsl(),ue=pe.h;return[u(re),u({h:(ue+72)%360,s:pe.s,l:pe.l}),u({h:(ue+216)%360,s:pe.s,l:pe.l})]}function I(re,pe,ue){pe=pe||6,ue=ue||30;var Ie=u(re).toHsl(),Ke=360/ue,Ne=[u(re)];for(Ie.h=(Ie.h-(Ke*pe>>1)+720)%360;--pe;)Ie.h=(Ie.h+Ke)%360,Ne.push(u(Ie));return Ne}function P(re,pe){pe=pe||6;for(var ue=u(re).toHsv(),Ie=ue.h,Ke=ue.s,Ne=ue.v,je=[],Ge=1/pe;pe--;)je.push(u({h:Ie,s:Ke,v:Ne})),Ne=(Ne+Ge)%1;return je}u.mix=function(re,pe,ue){ue=ue===0?0:ue||50;var Ie=u(re).toRgb(),Ke=u(pe).toRgb(),Ne=ue/100,je={r:(Ke.r-Ie.r)*Ne+Ie.r,g:(Ke.g-Ie.g)*Ne+Ie.g,b:(Ke.b-Ie.b)*Ne+Ie.b,a:(Ke.a-Ie.a)*Ne+Ie.a};return u(je)},u.readability=function(re,pe){var ue=u(re),Ie=u(pe);return(k.max(ue.getLuminance(),Ie.getLuminance())+.05)/(k.min(ue.getLuminance(),Ie.getLuminance())+.05)},u.isReadable=function(re,pe,ue){var Ie=u.readability(re,pe),Ke,Ne;Ne=!1,Ke=Ae(ue);switch(Ke.level+Ke.size){case"AAsmall":case"AAAlarge":Ne=Ie>=4.5;break;case"AAlarge":Ne=Ie>=3;break;case"AAAsmall":Ne=Ie>=7;break}return Ne},u.mostReadable=function(re,pe,ue){var Ie=null,Ke=0,Ne,je,Ge,ze;ue=ue||{},je=ue.includeFallbackColors,Ge=ue.level,ze=ue.size;for(var ke=0;ke<pe.length;ke++)Ne=u.readability(re,pe[ke]),Ne>Ke&&(Ke=Ne,Ie=u(pe[ke]));return u.isReadable(re,Ie,{level:Ge,size:ze})||!je?Ie:(ue.includeFallbackColors=!1,u.mostReadable(re,["#fff","#000"],ue))};var B=u.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"},H=u.hexNames=F(B);function F(re){var pe={};for(var ue in re)re.hasOwnProperty(ue)&&(pe[re[ue]]=ue);return pe}function W(re){return re=parseFloat(re),(isNaN(re)||re<0||re>1)&&(re=1),re}function U(re,pe){te(re)&&(re="100%");var ue=de(re);return re=S(pe,y(0,parseFloat(re))),ue&&(re=parseInt(re*pe,10)/100),k.abs(re-pe)<1e-6?1:re%pe/parseFloat(pe)}function K(re){return S(1,y(0,re))}function z(re){return parseInt(re,16)}function te(re){return typeof re=="string"&&re.indexOf(".")!=-1&&parseFloat(re)===1}function de(re){return typeof re=="string"&&re.indexOf("%")!=-1}function ge(re){return re.length==1?"0"+re:""+re}function Ue(re){return re<=1&&(re=re*100+"%"),re}function Me(re){return k.round(parseFloat(re)*255).toString(16)}function Le(re){return z(re)/255}var Oe=function(){var re="[-\\+]?\\d+%?",pe="[-\\+]?\\d*\\.\\d+%?",ue="(?:"+pe+")|(?:"+re+")",Ie="[\\s|\\(]+("+ue+")[,|\\s]+("+ue+")[,|\\s]+("+ue+")\\s*\\)?",Ke="[\\s|\\(]+("+ue+")[,|\\s]+("+ue+")[,|\\s]+("+ue+")[,|\\s]+("+ue+")\\s*\\)?";return{CSS_UNIT:new RegExp(ue),rgb:new RegExp("rgb"+Ie),rgba:new RegExp("rgba"+Ke),hsl:new RegExp("hsl"+Ie),hsla:new RegExp("hsla"+Ke),hsv:new RegExp("hsv"+Ie),hsva:new RegExp("hsva"+Ke),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 Fe(re){return!!Oe.CSS_UNIT.exec(re)}function ye(re){re=re.replace(D,"").replace(R,"").toLowerCase();var pe=!1;if(B[re])re=B[re],pe=!0;else if(re=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ue;return(ue=Oe.rgb.exec(re))?{r:ue[1],g:ue[2],b:ue[3]}:(ue=Oe.rgba.exec(re))?{r:ue[1],g:ue[2],b:ue[3],a:ue[4]}:(ue=Oe.hsl.exec(re))?{h:ue[1],s:ue[2],l:ue[3]}:(ue=Oe.hsla.exec(re))?{h:ue[1],s:ue[2],l:ue[3],a:ue[4]}:(ue=Oe.hsv.exec(re))?{h:ue[1],s:ue[2],v:ue[3]}:(ue=Oe.hsva.exec(re))?{h:ue[1],s:ue[2],v:ue[3],a:ue[4]}:(ue=Oe.hex8.exec(re))?{r:z(ue[1]),g:z(ue[2]),b:z(ue[3]),a:Le(ue[4]),format:pe?"name":"hex8"}:(ue=Oe.hex6.exec(re))?{r:z(ue[1]),g:z(ue[2]),b:z(ue[3]),format:pe?"name":"hex"}:(ue=Oe.hex4.exec(re))?{r:z(ue[1]+""+ue[1]),g:z(ue[2]+""+ue[2]),b:z(ue[3]+""+ue[3]),a:Le(ue[4]+""+ue[4]),format:pe?"name":"hex8"}:(ue=Oe.hex3.exec(re))?{r:z(ue[1]+""+ue[1]),g:z(ue[2]+""+ue[2]),b:z(ue[3]+""+ue[3]),format:pe?"name":"hex"}:!1}function Ae(re){var pe,ue;return re=re||{level:"AA",size:"small"},pe=(re.level||"AA").toUpperCase(),ue=(re.size||"small").toLowerCase(),pe!=="AA"&&pe!=="AAA"&&(pe="AA"),ue!=="small"&&ue!=="large"&&(ue="small"),{level:pe,size:ue}}Ze.exports?Ze.exports=u:!(j=function(){return u}.call(ce,ie,ce,Ze),j!==void 0&&(Ze.exports=j))})(Math)},bT9E:function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return k});var j=ie("VTBJ");function k(D,R){var O=Object(j.a)({},D);return Array.isArray(R)&&R.forEach(function(c){delete O[c]}),O}},c5Ni:function(Ze,ce,ie){},c5fP:function(Ze,ce,ie){"use strict";function j(ne){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(Re){return typeof Re}:j=function(Re){return Re&&typeof Symbol=="function"&&Re.constructor===Symbol&&Re!==Symbol.prototype?"symbol":typeof Re},j(ne)}Object.defineProperty(ce,"__esModule",{value:!0}),ce._tr_init=Ce,ce._tr_stored_block=We,ce._tr_flush_block=Pe,ce._tr_tally=Je,ce._tr_align=Ve;var k=R(ie("6BzB"));function D(){if(typeof WeakMap!="function")return null;var ne=new WeakMap;return D=function(){return ne},ne}function R(ne){if(ne&&ne.__esModule)return ne;if(ne===null||j(ne)!=="object"&&typeof ne!="function")return{default:ne};var be=D();if(be&&be.has(ne))return be.get(ne);var Re={},le=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var se in ne)if(Object.prototype.hasOwnProperty.call(ne,se)){var he=le?Object.getOwnPropertyDescriptor(ne,se):null;he&&(he.get||he.set)?Object.defineProperty(Re,se,he):Re[se]=ne[se]}return Re.default=ne,be&&be.set(ne,Re),Re}var O=4,c=0,S=1,y=2;function p(ne){for(var be=ne.length;--be>=0;)ne[be]=0}var u=0,o=1,d=2,s=3,l=258,r=29,n=256,a=n+1+r,i=30,h=19,f=2*a+1,w=15,m=16,T=7,C=256,x=16,b=17,E=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],v=[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],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],P=512,B=new Array((a+2)*2);p(B);var H=new Array(i*2);p(H);var F=new Array(P);p(F);var W=new Array(l-s+1);p(W);var U=new Array(r);p(U);var K=new Array(i);p(K);function z(ne,be,Re,le,se){this.static_tree=ne,this.extra_bits=be,this.extra_base=Re,this.elems=le,this.max_length=se,this.has_stree=ne&&ne.length}var te,de,ge;function Ue(ne,be){this.dyn_tree=ne,this.max_code=0,this.stat_desc=be}function Me(ne){return ne<256?F[ne]:F[256+(ne>>>7)]}function Le(ne,be){ne.pending_buf[ne.pending++]=be&255,ne.pending_buf[ne.pending++]=be>>>8&255}function Oe(ne,be,Re){ne.bi_valid>m-Re?(ne.bi_buf|=be<<ne.bi_valid&65535,Le(ne,ne.bi_buf),ne.bi_buf=be>>m-ne.bi_valid,ne.bi_valid+=Re-m):(ne.bi_buf|=be<<ne.bi_valid&65535,ne.bi_valid+=Re)}function Fe(ne,be,Re){Oe(ne,Re[be*2],Re[be*2+1])}function ye(ne,be){var Re=0;do Re|=ne&1,ne>>>=1,Re<<=1;while(--be>0);return Re>>>1}function Ae(ne){ne.bi_valid===16?(Le(ne,ne.bi_buf),ne.bi_buf=0,ne.bi_valid=0):ne.bi_valid>=8&&(ne.pending_buf[ne.pending++]=ne.bi_buf&255,ne.bi_buf>>=8,ne.bi_valid-=8)}function re(ne,be){var Re=be.dyn_tree,le=be.max_code,se=be.stat_desc.static_tree,he=be.stat_desc.has_stree,Y=be.stat_desc.extra_bits,Z=be.stat_desc.extra_base,G=be.stat_desc.max_length,ae,Te,X,me,De,oe,ve=0;for(me=0;me<=w;me++)ne.bl_count[me]=0;for(Re[ne.heap[ne.heap_max]*2+1]=0,ae=ne.heap_max+1;ae<f;ae++){if(Te=ne.heap[ae],me=Re[Re[Te*2+1]*2+1]+1,me>G&&(me=G,ve++),Re[Te*2+1]=me,Te>le)continue;ne.bl_count[me]++,De=0,Te>=Z&&(De=Y[Te-Z]),oe=Re[Te*2],ne.opt_len+=oe*(me+De),he&&(ne.static_len+=oe*(se[Te*2+1]+De))}if(ve===0)return;do{for(me=G-1;ne.bl_count[me]===0;)me--;ne.bl_count[me]--,ne.bl_count[me+1]+=2,ne.bl_count[G]--,ve-=2}while(ve>0);for(me=G;me!==0;me--)for(Te=ne.bl_count[me];Te!==0;){if(X=ne.heap[--ae],X>le)continue;Re[X*2+1]!==me&&(ne.opt_len+=(me-Re[X*2+1])*Re[X*2],Re[X*2+1]=me),Te--}}function pe(ne,be,Re){var le=new Array(w+1),se=0,he,Y;for(he=1;he<=w;he++)le[he]=se=se+Re[he-1]<<1;for(Y=0;Y<=be;Y++){var Z=ne[Y*2+1];if(Z===0)continue;ne[Y*2]=ye(le[Z]++,Z)}}function ue(){var ne,be,Re,le,se,he=new Array(w+1);for(Re=0,le=0;le<r-1;le++)for(U[le]=Re,ne=0;ne<1<<A[le];ne++)W[Re++]=le;for(W[Re-1]=le,se=0,le=0;le<16;le++)for(K[le]=se,ne=0;ne<1<<v[le];ne++)F[se++]=le;for(se>>=7;le<i;le++)for(K[le]=se<<7,ne=0;ne<1<<v[le]-7;ne++)F[256+se++]=le;for(be=0;be<=w;be++)he[be]=0;for(ne=0;ne<=143;)B[ne*2+1]=8,ne++,he[8]++;for(;ne<=255;)B[ne*2+1]=9,ne++,he[9]++;for(;ne<=279;)B[ne*2+1]=7,ne++,he[7]++;for(;ne<=287;)B[ne*2+1]=8,ne++,he[8]++;for(pe(B,a+1,he),ne=0;ne<i;ne++)H[ne*2+1]=5,H[ne*2]=ye(ne,5);te=new z(B,A,n+1,a,w),de=new z(H,v,0,i,w),ge=new z(new Array(0),M,0,h,T)}function Ie(ne){var be;for(be=0;be<a;be++)ne.dyn_ltree[be*2]=0;for(be=0;be<i;be++)ne.dyn_dtree[be*2]=0;for(be=0;be<h;be++)ne.bl_tree[be*2]=0;ne.dyn_ltree[C*2]=1,ne.opt_len=ne.static_len=0,ne.last_lit=ne.matches=0}function Ke(ne){ne.bi_valid>8?Le(ne,ne.bi_buf):ne.bi_valid>0&&(ne.pending_buf[ne.pending++]=ne.bi_buf),ne.bi_buf=0,ne.bi_valid=0}function Ne(ne,be,Re,le){Ke(ne),le&&(Le(ne,Re),Le(ne,~Re)),k.arraySet(ne.pending_buf,ne.window,be,Re,ne.pending),ne.pending+=Re}function je(ne,be,Re,le){var se=be*2,he=Re*2;return ne[se]<ne[he]||ne[se]===ne[he]&&le[be]<=le[Re]}function Ge(ne,be,Re){for(var le=ne.heap[Re],se=Re<<1;se<=ne.heap_len&&!(se<ne.heap_len&&je(be,ne.heap[se+1],ne.heap[se],ne.depth)&&se++,je(be,le,ne.heap[se],ne.depth));)ne.heap[Re]=ne.heap[se],Re=se,se<<=1;ne.heap[Re]=le}function ze(ne,be,Re){var le,se,he=0,Y,Z;if(ne.last_lit!==0)do le=ne.pending_buf[ne.d_buf+he*2]<<8|ne.pending_buf[ne.d_buf+he*2+1],se=ne.pending_buf[ne.l_buf+he],he++,le===0?Fe(ne,se,be):(Y=W[se],Fe(ne,Y+n+1,be),Z=A[Y],Z!==0&&(se-=U[Y],Oe(ne,se,Z)),le--,Y=Me(le),Fe(ne,Y,Re),Z=v[Y],Z!==0&&(le-=K[Y],Oe(ne,le,Z)));while(he<ne.last_lit);Fe(ne,C,be)}function ke(ne,be){var Re=be.dyn_tree,le=be.stat_desc.static_tree,se=be.stat_desc.has_stree,he=be.stat_desc.elems,Y,Z,G=-1,ae;for(ne.heap_len=0,ne.heap_max=f,Y=0;Y<he;Y++)Re[Y*2]!==0?(ne.heap[++ne.heap_len]=G=Y,ne.depth[Y]=0):Re[Y*2+1]=0;for(;ne.heap_len<2;)ae=ne.heap[++ne.heap_len]=G<2?++G:0,Re[ae*2]=1,ne.depth[ae]=0,ne.opt_len--,se&&(ne.static_len-=le[ae*2+1]);for(be.max_code=G,Y=ne.heap_len>>1;Y>=1;Y--)Ge(ne,Re,Y);ae=he;do Y=ne.heap[1],ne.heap[1]=ne.heap[ne.heap_len--],Ge(ne,Re,1),Z=ne.heap[1],ne.heap[--ne.heap_max]=Y,ne.heap[--ne.heap_max]=Z,Re[ae*2]=Re[Y*2]+Re[Z*2],ne.depth[ae]=(ne.depth[Y]>=ne.depth[Z]?ne.depth[Y]:ne.depth[Z])+1,Re[Y*2+1]=Re[Z*2+1]=ae,ne.heap[1]=ae++,Ge(ne,Re,1);while(ne.heap_len>=2);ne.heap[--ne.heap_max]=ne.heap[1],re(ne,be),pe(Re,G,ne.bl_count)}function xe(ne,be,Re){var le,se=-1,he,Y=be[0*2+1],Z=0,G=7,ae=4;for(Y===0&&(G=138,ae=3),be[(Re+1)*2+1]=65535,le=0;le<=Re;le++){if(he=Y,Y=be[(le+1)*2+1],++Z<G&&he===Y)continue;Z<ae?ne.bl_tree[he*2]+=Z:he!==0?(he!==se&&ne.bl_tree[he*2]++,ne.bl_tree[x*2]++):Z<=10?ne.bl_tree[b*2]++:ne.bl_tree[E*2]++,Z=0,se=he,Y===0?(G=138,ae=3):he===Y?(G=6,ae=3):(G=7,ae=4)}}function Ee(ne,be,Re){var le,se=-1,he,Y=be[0*2+1],Z=0,G=7,ae=4;for(Y===0&&(G=138,ae=3),le=0;le<=Re;le++){if(he=Y,Y=be[(le+1)*2+1],++Z<G&&he===Y)continue;if(Z<ae)do Fe(ne,he,ne.bl_tree);while(--Z!==0);else he!==0?(he!==se&&(Fe(ne,he,ne.bl_tree),Z--),Fe(ne,x,ne.bl_tree),Oe(ne,Z-3,2)):Z<=10?(Fe(ne,b,ne.bl_tree),Oe(ne,Z-3,3)):(Fe(ne,E,ne.bl_tree),Oe(ne,Z-11,7));Z=0,se=he,Y===0?(G=138,ae=3):he===Y?(G=6,ae=3):(G=7,ae=4)}}function Se(ne){var be;for(xe(ne,ne.dyn_ltree,ne.l_desc.max_code),xe(ne,ne.dyn_dtree,ne.d_desc.max_code),ke(ne,ne.bl_desc),be=h-1;be>=3&&!(ne.bl_tree[I[be]*2+1]!==0);be--);return ne.opt_len+=3*(be+1)+5+5+4,be}function $(ne,be,Re,le){var se;for(Oe(ne,be-257,5),Oe(ne,Re-1,5),Oe(ne,le-4,4),se=0;se<le;se++)Oe(ne,ne.bl_tree[I[se]*2+1],3);Ee(ne,ne.dyn_ltree,be-1),Ee(ne,ne.dyn_dtree,Re-1)}function fe(ne){var be=4093624447,Re;for(Re=0;Re<=31;Re++,be>>>=1)if(be&1&&ne.dyn_ltree[Re*2]!==0)return c;if(ne.dyn_ltree[9*2]!==0||ne.dyn_ltree[10*2]!==0||ne.dyn_ltree[13*2]!==0)return S;for(Re=32;Re<n;Re++)if(ne.dyn_ltree[Re*2]!==0)return S;return c}var J=!1;function Ce(ne){J||(ue(),J=!0),ne.l_desc=new Ue(ne.dyn_ltree,te),ne.d_desc=new Ue(ne.dyn_dtree,de),ne.bl_desc=new Ue(ne.bl_tree,ge),ne.bi_buf=0,ne.bi_valid=0,Ie(ne)}function We(ne,be,Re,le){Oe(ne,(u<<1)+(le?1:0),3),Ne(ne,be,Re,!0)}function Ve(ne){Oe(ne,o<<1,3),Fe(ne,C,B),Ae(ne)}function Pe(ne,be,Re,le){var se,he,Y=0;ne.level>0?(ne.strm.data_type===y&&(ne.strm.data_type=fe(ne)),ke(ne,ne.l_desc),ke(ne,ne.d_desc),Y=Se(ne),se=ne.opt_len+3+7>>>3,he=ne.static_len+3+7>>>3,he<=se&&(se=he)):se=he=Re+5,Re+4<=se&&be!==-1?We(ne,be,Re,le):ne.strategy===O||he===se?(Oe(ne,(o<<1)+(le?1:0),3),ze(ne,B,H)):(Oe(ne,(d<<1)+(le?1:0),3),$(ne,ne.l_desc.max_code+1,ne.d_desc.max_code+1,Y+1),ze(ne,ne.dyn_ltree,ne.dyn_dtree)),Ie(ne),le&&Ke(ne)}function Je(ne,be,Re){return ne.pending_buf[ne.d_buf+ne.last_lit*2]=be>>>8&255,ne.pending_buf[ne.d_buf+ne.last_lit*2+1]=be&255,ne.pending_buf[ne.l_buf+ne.last_lit]=Re&255,ne.last_lit++,be===0?ne.dyn_ltree[Re*2]++:(ne.matches++,be--,ne.dyn_ltree[(W[Re]+n+1)*2]++,ne.dyn_dtree[Me(be)*2]++),ne.last_lit===ne.lit_bufsize-1}},dejd:function(Ze,ce,ie){},dmUQ:function(Ze,ce,ie){"use strict";var j=ie("Ff2n"),k=ie("rePB"),D=ie("1OyB"),R=ie("vuIU"),O=ie("Ji7U"),c=ie("md7G"),S=ie("foSv"),y=ie("q1tI"),p=ie.n(y),u=ie("TSYQ"),o=ie.n(u),d=ie("4IlW");function s(A,v){var M=Object.keys(A);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(A);v&&(I=I.filter(function(P){return Object.getOwnPropertyDescriptor(A,P).enumerable})),M.push.apply(M,I)}return M}function l(A){for(var v=1;v<arguments.length;v++){var M=arguments[v]!=null?arguments[v]:{};v%2?s(Object(M),!0).forEach(function(I){Object(k.a)(A,I,M[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(M)):s(Object(M)).forEach(function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(M,I))})}return A}function r(A){var v=n();return function(){var I=Object(S.a)(A),P;if(v){var B=Object(S.a)(this).constructor;P=Reflect.construct(I,arguments,B)}else P=I.apply(this,arguments);return Object(c.a)(this,P)}}function n(){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 a(){}function i(A){A.preventDefault()}var h=function(v){return v.replace(/[^\w.-]+/g,"")},f=200,w=600,m=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,T=function(v){return v!=null},C=function(v,M){return M===v||typeof M=="number"&&typeof v=="number"&&isNaN(M)&&isNaN(v)},x=function(A){Object(O.a)(M,A);var v=r(M);function M(I){var P;Object(D.a)(this,M),P=v.call(this,I),P.onKeyDown=function(F){var W=P.props,U=W.onKeyDown,K=W.onPressEnter;if(F.keyCode===d.a.UP){var z=P.getRatio(F);P.up(F,z,null),P.stop()}else if(F.keyCode===d.a.DOWN){var te=P.getRatio(F);P.down(F,te,null),P.stop()}else F.keyCode===d.a.ENTER&&K&&K(F);if(P.recordCursorPosition(),P.lastKeyCode=F.keyCode,U){for(var de=arguments.length,ge=new Array(de>1?de-1:0),Ue=1;Ue<de;Ue++)ge[Ue-1]=arguments[Ue];U.apply(void 0,[F].concat(ge))}},P.onKeyUp=function(F){var W=P.props.onKeyUp;if(P.stop(),P.recordCursorPosition(),W){for(var U=arguments.length,K=new Array(U>1?U-1:0),z=1;z<U;z++)K[z-1]=arguments[z];W.apply(void 0,[F].concat(K))}},P.onChange=function(F){var W=P.props.onChange;P.state.focused&&(P.inputting=!0),P.rawInput=P.props.parser(P.getValueFromEvent(F)),P.setState({inputValue:P.rawInput}),W(P.toNumber(P.rawInput))},P.onMouseUp=function(){var F=P.props.onMouseUp;P.recordCursorPosition(),F&&F.apply(void 0,arguments)},P.onFocus=function(){var F;P.setState({focused:!0}),(F=P.props).onFocus.apply(F,arguments)},P.onBlur=function(){var F=P.props.onBlur;P.inputting=!1,P.setState({focused:!1});var W=P.getCurrentValidValue(P.state.inputValue),U=P.setValue(W,a);if(F){var K=P.input.value,z=P.getInputDisplayValue({focus:!1,value:U});P.input.value=z&&Number(z),F.apply(void 0,arguments),P.input.value=K}},P.getRatio=function(F){var W=1;return F.metaKey||F.ctrlKey?W=.1:F.shiftKey&&(W=10),W},P.getFullNum=function(F){return isNaN(F)?F:/e/i.test(String(F))?Number(F).toFixed(18).replace(/\.?0+$/,""):F},P.getPrecision=function(F){if(T(P.props.precision))return P.props.precision;var W=String(F);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var U=0;return W.indexOf(".")>=0&&(U=W.length-W.indexOf(".")-1),U},P.getInputDisplayValue=function(F){var W=F||P.state,U=W.focused,K=W.inputValue,z=W.value,te;U?te=K:te=P.toPrecisionAsStep(z),te==null&&(te="");var de=P.formatWrapper(te);return T(P.props.decimalSeparator)&&(de=de.toString().replace(".",P.props.decimalSeparator)),de},P.recordCursorPosition=function(){try{P.cursorStart=P.input.selectionStart,P.cursorEnd=P.input.selectionEnd,P.currentValue=P.input.value,P.cursorBefore=P.input.value.substring(0,P.cursorStart),P.cursorAfter=P.input.value.substring(P.cursorEnd)}catch(F){}},P.restoreByAfter=function(F){if(F===void 0)return!1;var W=P.input.value,U=W.lastIndexOf(F);if(U===-1)return!1;var K=P.cursorBefore.length;return P.lastKeyCode===d.a.DELETE&&P.cursorBefore.charAt(K-1)===F[0]?(P.fixCaret(K,K),!0):U+F.length===W.length?(P.fixCaret(U,U),!0):!1},P.partRestoreByAfter=function(F){return F===void 0?!1:Array.prototype.some.call(F,function(W,U){var K=F.substring(U);return P.restoreByAfter(K)})},P.isNotCompleteNumber=function(F){return isNaN(F)||F===""||F===null||F&&F.toString().indexOf(".")===F.toString().length-1},P.stop=function(){P.autoStepTimer&&clearTimeout(P.autoStepTimer)},P.down=function(F,W,U){P.pressingUpOrDown=!0,P.step("down",F,W,U)},P.up=function(F,W,U){P.pressingUpOrDown=!0,P.step("up",F,W,U)},P.saveInput=function(F){P.input=F};var B=I.value;B===void 0&&(B=I.defaultValue),P.state={focused:I.autoFocus};var H=P.getValidValue(P.toNumber(B));return P.state=l(l({},P.state),{},{inputValue:P.toPrecisionAsStep(H),value:H}),P}return Object(R.a)(M,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(P){var B=this.props,H=B.value,F=B.onChange,W=B.max,U=B.min,K=this.state.focused;if(P){if(!C(P.value,H)||!C(P.max,W)||!C(P.min,U)){var z=K?H:this.getValidValue(H),te;this.pressingUpOrDown?te=z:this.inputting?te=this.rawInput:te=this.toPrecisionAsStep(z),this.setState({value:z,inputValue:te})}var de="value"in this.props?H:this.state.value;"max"in this.props&&P.max!==W&&typeof de=="number"&&de>W&&F&&F(W),"min"in this.props&&P.min!==U&&typeof de=="number"&&de<U&&F&&F(U)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ge=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===d.a.BACKSPACE?ge=this.cursorStart-1:this.lastKeyCode===d.a.DELETE&&(ge=this.cursorStart):ge=this.input.value.length,this.fixCaret(ge,ge)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case d.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case d.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ue){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(P){var B=P;return B===""?B="":this.isNotCompleteNumber(parseFloat(B))?B=this.state.value:B=this.getValidValue(B),this.toNumber(B)}},{key:"getValueFromEvent",value:function(P){var B=P.target.value.trim().replace(/。/g,".");return T(this.props.decimalSeparator)&&(B=B.replace(this.props.decimalSeparator,".")),B}},{key:"getValidValue",value:function(P){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,F=parseFloat(P);return isNaN(F)?P:(F<B&&(F=B),F>H&&(F=H),F)}},{key:"setValue",value:function(P,B){var H=this.props.precision,F=this.isNotCompleteNumber(parseFloat(P))?null:parseFloat(P),W=this.state.value,U=W===void 0?null:W,K=this.state.inputValue,z=K===void 0?null:K,te=typeof F=="number"?F.toFixed(H):"".concat(F),de=F!==U||te!=="".concat(z);return"value"in this.props?(z=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:z},B)):this.setState({value:F,inputValue:this.toPrecisionAsStep(P)},B),de&&this.props.onChange(F),F}},{key:"getMaxPrecision",value:function(P){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.props,F=H.precision,W=H.step;if(T(F))return F;var U=this.getPrecision(B),K=this.getPrecision(W),z=this.getPrecision(P);return P?Math.max(z,U+K):U+K}},{key:"getPrecisionFactor",value:function(P){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,H=this.getMaxPrecision(P,B);return Math.pow(10,H)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(P){return this.props.formatter?this.props.formatter(P):P}},{key:"toPrecisionAsStep",value:function(P){if(this.isNotCompleteNumber(P)||P==="")return P;var B=Math.abs(this.getMaxPrecision(P));return isNaN(B)?P.toString():Number(P).toFixed(B)}},{key:"toNumber",value:function(P){var B=this.props.precision,H=this.state.focused,F=P&&P.length>16&&H;return this.isNotCompleteNumber(P)||F?P:T(B)?Math.round(P*Math.pow(10,B))/Math.pow(10,B):Number(P)}},{key:"upStep",value:function(P,B){var H=this.props.step,F=this.getPrecisionFactor(P,B),W=Math.abs(this.getMaxPrecision(P,B)),U=((F*P+F*H*B)/F).toFixed(W);return this.toNumber(U)}},{key:"downStep",value:function(P,B){var H=this.props.step,F=this.getPrecisionFactor(P,B),W=Math.abs(this.getMaxPrecision(P,B)),U=((F*P-F*H*B)/F).toFixed(W);return this.toNumber(U)}},{key:"step",value:function(P,B){var H=this,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),B&&(B.persist(),B.preventDefault());var U=this.props;if(U.disabled)return;var K=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(K))return;var z=this["".concat(P,"Step")](K,F),te=z>U.max||z<U.min;if(z>U.max?z=U.max:z<U.min&&(z=U.min),this.setValue(z,null),this.setState({focused:!0},function(){H.pressingUpOrDown=!1}),te)return;this.autoStepTimer=setTimeout(function(){H[P](B,F,!0)},W?f:w)}},{key:"fixCaret",value:function(P,B){if(P===void 0||B===void 0||!this.input||!this.input.value)return;try{var H=this.input.selectionStart,F=this.input.selectionEnd;(P!==H||B!==F)&&this.input.setSelectionRange(P,B)}catch(W){}}},{key:"render",value:function(){var P,B=this.props,H=B.prefixCls,F=B.disabled,W=B.readOnly,U=B.useTouch,K=B.autoComplete,z=B.upHandler,te=B.downHandler,de=B.className,ge=B.max,Ue=B.min,Me=B.style,Le=B.title,Oe=B.onMouseEnter,Fe=B.onMouseLeave,ye=B.onMouseOver,Ae=B.onMouseOut,re=B.required,pe=B.onClick,ue=B.tabIndex,Ie=B.type,Ke=B.placeholder,Ne=B.id,je=B.inputMode,Ge=B.pattern,ze=B.step,ke=B.maxLength,xe=B.autoFocus,Ee=B.name,Se=B.onPaste,$=B.onInput,fe=Object(j.a)(B,["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"]),J=this.state,Ce=J.value,We=J.focused,Ve=o()(H,(P={},Object(k.a)(P,de,!!de),Object(k.a)(P,"".concat(H,"-disabled"),F),Object(k.a)(P,"".concat(H,"-focused"),We),P)),Pe={};Object.keys(fe).forEach(function(ae){(ae.substr(0,5)==="data-"||ae.substr(0,5)==="aria-"||ae==="role")&&(Pe[ae]=fe[ae])});var Je=!W&&!F,ne=this.getInputDisplayValue(null),be=(Ce||Ce===0)&&(isNaN(Ce)||Number(Ce)>=ge),Re=(Ce||Ce===0)&&(isNaN(Ce)||Number(Ce)<=Ue),le=be||F||W,se=Re||F||W,he=o()("".concat(H,"-handler"),"".concat(H,"-handler-up"),Object(k.a)({},"".concat(H,"-handler-up-disabled"),le)),Y=o()("".concat(H,"-handler"),"".concat(H,"-handler-down"),Object(k.a)({},"".concat(H,"-handler-down-disabled"),se)),Z=U?{onTouchStart:le?a:this.up,onTouchEnd:this.stop}:{onMouseDown:le?a:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},G=U?{onTouchStart:se?a:this.down,onTouchEnd:this.stop}:{onMouseDown:se?a:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return p.a.createElement("div",{className:Ve,style:Me,title:Le,onMouseEnter:Oe,onMouseLeave:Fe,onMouseOver:ye,onMouseOut:Ae,onFocus:function(){return null},onBlur:function(){return null}},p.a.createElement("div",{className:"".concat(H,"-handler-wrap")},p.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":le,className:he}),z||p.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-up-inner"),onClick:i})),p.a.createElement("span",Object.assign({unselectable:"on"},G,{role:"button","aria-label":"Decrease Value","aria-disabled":se,className:Y}),te||p.a.createElement("span",{unselectable:"on",className:"".concat(H,"-handler-down-inner"),onClick:i}))),p.a.createElement("div",{className:"".concat(H,"-input-wrap")},p.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ue,"aria-valuemax":ge,"aria-valuenow":Ce,required:re,type:Ie,placeholder:Ke,onPaste:Se,onClick:pe,onMouseUp:this.onMouseUp,className:"".concat(H,"-input"),tabIndex:ue,autoComplete:K,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Je?this.onKeyDown:a,onKeyUp:Je?this.onKeyUp:a,autoFocus:xe,maxLength:ke,readOnly:W,disabled:F,max:ge,min:Ue,step:ze,name:Ee,title:Le,id:Ne,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(ne),pattern:Ge,inputMode:je,onInput:$},Pe))))}}]),M}(p.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:m,min:-m,step:1,style:{},onChange:a,onKeyDown:a,onPressEnter:a,onFocus:a,onBlur:a,parser:h,required:!1,autoComplete:"off"};var b=x,E=ce.a=b},eP3c:function(Ze,ce,ie){"use strict";function j(Y){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(G){return typeof G}:j=function(G){return G&&typeof Symbol=="function"&&G.constructor===Symbol&&G!==Symbol.prototype?"symbol":typeof G},j(Y)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.inflateReset=$,ce.inflateReset2=fe,ce.inflateResetKeep=Se,ce.inflateInit=Ce,ce.inflateInit2=J,ce.inflate=be,ce.inflateEnd=Re,ce.inflateGetHeader=le,ce.inflateSetDictionary=se,ce.inflateInfo=ce.Z_DEFLATED=ce.Z_BUF_ERROR=ce.Z_MEM_ERROR=ce.Z_DATA_ERROR=ce.Z_STREAM_ERROR=ce.Z_NEED_DICT=ce.Z_STREAM_END=ce.Z_OK=ce.Z_TREES=ce.Z_BLOCK=ce.Z_FINISH=void 0;var k=p(ie("6BzB")),D=S(ie("xlC8")),R=S(ie("QV2g")),O=S(ie("sjKO")),c=S(ie("JSwD"));function S(Y){return Y&&Y.__esModule?Y:{default:Y}}function y(){if(typeof WeakMap!="function")return null;var Y=new WeakMap;return y=function(){return Y},Y}function p(Y){if(Y&&Y.__esModule)return Y;if(Y===null||j(Y)!=="object"&&typeof Y!="function")return{default:Y};var Z=y();if(Z&&Z.has(Y))return Z.get(Y);var G={},ae=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Te in Y)if(Object.prototype.hasOwnProperty.call(Y,Te)){var X=ae?Object.getOwnPropertyDescriptor(Y,Te):null;X&&(X.get||X.set)?Object.defineProperty(G,Te,X):G[Te]=Y[Te]}return G.default=Y,Z&&Z.set(Y,G),G}var u=0,o=1,d=2,s=4;ce.Z_FINISH=s;var l=5;ce.Z_BLOCK=l;var r=6;ce.Z_TREES=r;var n=0;ce.Z_OK=n;var a=1;ce.Z_STREAM_END=a;var i=2;ce.Z_NEED_DICT=i;var h=-2;ce.Z_STREAM_ERROR=h;var f=-3;ce.Z_DATA_ERROR=f;var w=-4;ce.Z_MEM_ERROR=w;var m=-5;ce.Z_BUF_ERROR=m;var T=8;ce.Z_DEFLATED=T;var C=1,x=2,b=3,E=4,A=5,v=6,M=7,I=8,P=9,B=10,H=11,F=12,W=13,U=14,K=15,z=16,te=17,de=18,ge=19,Ue=20,Me=21,Le=22,Oe=23,Fe=24,ye=25,Ae=26,re=27,pe=28,ue=29,Ie=30,Ke=31,Ne=32,je=852,Ge=592,ze=15,ke=ze;function xe(Y){return(Y>>>24&255)+(Y>>>8&65280)+((Y&65280)<<8)+((Y&255)<<24)}function Ee(){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 k.Buf16(320),this.work=new k.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Se(Y){var Z;return!Y||!Y.state?h:(Z=Y.state,Y.total_in=Y.total_out=Z.total=0,Y.msg="",Z.wrap&&(Y.adler=Z.wrap&1),Z.mode=C,Z.last=0,Z.havedict=0,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new k.Buf32(je),Z.distcode=Z.distdyn=new k.Buf32(Ge),Z.sane=1,Z.back=-1,n)}function $(Y){var Z;return!Y||!Y.state?h:(Z=Y.state,Z.wsize=0,Z.whave=0,Z.wnext=0,Se(Y))}function fe(Y,Z){var G,ae;return!Y||!Y.state?h:(ae=Y.state,Z<0?(G=0,Z=-Z):(G=(Z>>4)+1,Z<48&&(Z&=15)),Z&&(Z<8||Z>15)?h:(ae.window!==null&&ae.wbits!==Z&&(ae.window=null),ae.wrap=G,ae.wbits=Z,$(Y)))}function J(Y,Z){var G,ae;return Y?(ae=new Ee,Y.state=ae,ae.window=null,G=fe(Y,Z),G!==n&&(Y.state=null),G):h}function Ce(Y){return J(Y,ke)}var We=!0,Ve,Pe;function Je(Y){if(We){var Z;for(Ve=new k.Buf32(512),Pe=new k.Buf32(32),Z=0;Z<144;)Y.lens[Z++]=8;for(;Z<256;)Y.lens[Z++]=9;for(;Z<280;)Y.lens[Z++]=7;for(;Z<288;)Y.lens[Z++]=8;for((0,c.default)(o,Y.lens,0,288,Ve,0,Y.work,{bits:9}),Z=0;Z<32;)Y.lens[Z++]=5;(0,c.default)(d,Y.lens,0,32,Pe,0,Y.work,{bits:5}),We=!1}Y.lencode=Ve,Y.lenbits=9,Y.distcode=Pe,Y.distbits=5}function ne(Y,Z,G,ae){var Te,X=Y.state;return X.window===null&&(X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new k.Buf8(X.wsize)),ae>=X.wsize?(k.arraySet(X.window,Z,G-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize):(Te=X.wsize-X.wnext,Te>ae&&(Te=ae),k.arraySet(X.window,Z,G-ae,Te,X.wnext),ae-=Te,ae?(k.arraySet(X.window,Z,G-ae,ae,0),X.wnext=ae,X.whave=X.wsize):(X.wnext+=Te,X.wnext===X.wsize&&(X.wnext=0),X.whave<X.wsize&&(X.whave+=Te))),0}function be(Y,Z){var G,ae,Te,X,me,De,oe,ve,Be,tt,Qe,$e,st,mt,ct=0,nt,_t,St,Et,Xt,Kt,Rt,Ct,Lt=new k.Buf8(4),nr,wt,dt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Y||!Y.state||!Y.output||!Y.input&&Y.avail_in!==0)return h;G=Y.state,G.mode===F&&(G.mode=W),me=Y.next_out,Te=Y.output,oe=Y.avail_out,X=Y.next_in,ae=Y.input,De=Y.avail_in,ve=G.hold,Be=G.bits,tt=De,Qe=oe,Ct=n;e:for(;;)switch(G.mode){case C:if(G.wrap===0){G.mode=W;break}for(;Be<16;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(G.wrap&2&&ve===35615){G.check=0,Lt[0]=ve&255,Lt[1]=ve>>>8&255,G.check=(0,R.default)(G.check,Lt,2,0),ve=0,Be=0,G.mode=x;break}if(G.flags=0,G.head&&(G.head.done=!1),!(G.wrap&1)||(((ve&255)<<8)+(ve>>8))%31){Y.msg="incorrect header check",G.mode=Ie;break}if((ve&15)!==T){Y.msg="unknown compression method",G.mode=Ie;break}if(ve>>>=4,Be-=4,Rt=(ve&15)+8,G.wbits===0)G.wbits=Rt;else if(Rt>G.wbits){Y.msg="invalid window size",G.mode=Ie;break}G.dmax=1<<Rt,Y.adler=G.check=1,G.mode=ve&512?B:F,ve=0,Be=0;break;case x:for(;Be<16;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(G.flags=ve,(G.flags&255)!==T){Y.msg="unknown compression method",G.mode=Ie;break}if(G.flags&57344){Y.msg="unknown header flags set",G.mode=Ie;break}G.head&&(G.head.text=ve>>8&1),G.flags&512&&(Lt[0]=ve&255,Lt[1]=ve>>>8&255,G.check=(0,R.default)(G.check,Lt,2,0)),ve=0,Be=0,G.mode=b;case b:for(;Be<32;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.head&&(G.head.time=ve),G.flags&512&&(Lt[0]=ve&255,Lt[1]=ve>>>8&255,Lt[2]=ve>>>16&255,Lt[3]=ve>>>24&255,G.check=(0,R.default)(G.check,Lt,4,0)),ve=0,Be=0,G.mode=E;case E:for(;Be<16;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.head&&(G.head.xflags=ve&255,G.head.os=ve>>8),G.flags&512&&(Lt[0]=ve&255,Lt[1]=ve>>>8&255,G.check=(0,R.default)(G.check,Lt,2,0)),ve=0,Be=0,G.mode=A;case A:if(G.flags&1024){for(;Be<16;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.length=ve,G.head&&(G.head.extra_len=ve),G.flags&512&&(Lt[0]=ve&255,Lt[1]=ve>>>8&255,G.check=(0,R.default)(G.check,Lt,2,0)),ve=0,Be=0}else G.head&&(G.head.extra=null);G.mode=v;case v:if(G.flags&1024&&($e=G.length,$e>De&&($e=De),$e&&(G.head&&(Rt=G.head.extra_len-G.length,G.head.extra||(G.head.extra=new Array(G.head.extra_len)),k.arraySet(G.head.extra,ae,X,$e,Rt)),G.flags&512&&(G.check=(0,R.default)(G.check,ae,$e,X)),De-=$e,X+=$e,G.length-=$e),G.length))break e;G.length=0,G.mode=M;case M:if(G.flags&2048){if(De===0)break e;$e=0;do Rt=ae[X+$e++],G.head&&Rt&&G.length<65536&&(G.head.name+=String.fromCharCode(Rt));while(Rt&&$e<De);if(G.flags&512&&(G.check=(0,R.default)(G.check,ae,$e,X)),De-=$e,X+=$e,Rt)break e}else G.head&&(G.head.name=null);G.length=0,G.mode=I;case I:if(G.flags&4096){if(De===0)break e;$e=0;do Rt=ae[X+$e++],G.head&&Rt&&G.length<65536&&(G.head.comment+=String.fromCharCode(Rt));while(Rt&&$e<De);if(G.flags&512&&(G.check=(0,R.default)(G.check,ae,$e,X)),De-=$e,X+=$e,Rt)break e}else G.head&&(G.head.comment=null);G.mode=P;case P:if(G.flags&512){for(;Be<16;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(ve!==(G.check&65535)){Y.msg="header crc mismatch",G.mode=Ie;break}ve=0,Be=0}G.head&&(G.head.hcrc=G.flags>>9&1,G.head.done=!0),Y.adler=G.check=0,G.mode=F;break;case B:for(;Be<32;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}Y.adler=G.check=xe(ve),ve=0,Be=0,G.mode=H;case H:if(G.havedict===0)return Y.next_out=me,Y.avail_out=oe,Y.next_in=X,Y.avail_in=De,G.hold=ve,G.bits=Be,i;Y.adler=G.check=1,G.mode=F;case F:if(Z===l||Z===r)break e;case W:if(G.last){ve>>>=Be&7,Be-=Be&7,G.mode=re;break}for(;Be<3;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.last=ve&1,ve>>>=1,Be-=1;switch(ve&3){case 0:G.mode=U;break;case 1:if(Je(G),G.mode=Ue,Z===r){ve>>>=2,Be-=2;break e}break;case 2:G.mode=te;break;case 3:Y.msg="invalid block type",G.mode=Ie}ve>>>=2,Be-=2;break;case U:for(ve>>>=Be&7,Be-=Be&7;Be<32;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if((ve&65535)!==(ve>>>16^65535)){Y.msg="invalid stored block lengths",G.mode=Ie;break}if(G.length=ve&65535,ve=0,Be=0,G.mode=K,Z===r)break e;case K:G.mode=z;case z:if($e=G.length,$e){if($e>De&&($e=De),$e>oe&&($e=oe),$e===0)break e;k.arraySet(Te,ae,X,$e,me),De-=$e,X+=$e,oe-=$e,me+=$e,G.length-=$e;break}G.mode=F;break;case te:for(;Be<14;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(G.nlen=(ve&31)+257,ve>>>=5,Be-=5,G.ndist=(ve&31)+1,ve>>>=5,Be-=5,G.ncode=(ve&15)+4,ve>>>=4,Be-=4,G.nlen>286||G.ndist>30){Y.msg="too many length or distance symbols",G.mode=Ie;break}G.have=0,G.mode=de;case de:for(;G.have<G.ncode;){for(;Be<3;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.lens[dt[G.have++]]=ve&7,ve>>>=3,Be-=3}for(;G.have<19;)G.lens[dt[G.have++]]=0;if(G.lencode=G.lendyn,G.lenbits=7,nr={bits:G.lenbits},Ct=(0,c.default)(u,G.lens,0,19,G.lencode,0,G.work,nr),G.lenbits=nr.bits,Ct){Y.msg="invalid code lengths set",G.mode=Ie;break}G.have=0,G.mode=ge;case ge:for(;G.have<G.nlen+G.ndist;){for(;!(ct=G.lencode[ve&(1<<G.lenbits)-1],nt=ct>>>24,_t=ct>>>16&255,St=ct&65535,nt<=Be);){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(St<16)ve>>>=nt,Be-=nt,G.lens[G.have++]=St;else{if(St===16){for(wt=nt+2;Be<wt;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(ve>>>=nt,Be-=nt,G.have===0){Y.msg="invalid bit length repeat",G.mode=Ie;break}Rt=G.lens[G.have-1],$e=3+(ve&3),ve>>>=2,Be-=2}else if(St===17){for(wt=nt+3;Be<wt;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}ve>>>=nt,Be-=nt,Rt=0,$e=3+(ve&7),ve>>>=3,Be-=3}else{for(wt=nt+7;Be<wt;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}ve>>>=nt,Be-=nt,Rt=0,$e=11+(ve&127),ve>>>=7,Be-=7}if(G.have+$e>G.nlen+G.ndist){Y.msg="invalid bit length repeat",G.mode=Ie;break}for(;$e--;)G.lens[G.have++]=Rt}}if(G.mode===Ie)break;if(G.lens[256]===0){Y.msg="invalid code -- missing end-of-block",G.mode=Ie;break}if(G.lenbits=9,nr={bits:G.lenbits},Ct=(0,c.default)(o,G.lens,0,G.nlen,G.lencode,0,G.work,nr),G.lenbits=nr.bits,Ct){Y.msg="invalid literal/lengths set",G.mode=Ie;break}if(G.distbits=6,G.distcode=G.distdyn,nr={bits:G.distbits},Ct=(0,c.default)(d,G.lens,G.nlen,G.ndist,G.distcode,0,G.work,nr),G.distbits=nr.bits,Ct){Y.msg="invalid distances set",G.mode=Ie;break}if(G.mode=Ue,Z===r)break e;case Ue:G.mode=Me;case Me:if(De>=6&&oe>=258){Y.next_out=me,Y.avail_out=oe,Y.next_in=X,Y.avail_in=De,G.hold=ve,G.bits=Be,(0,O.default)(Y,Qe),me=Y.next_out,Te=Y.output,oe=Y.avail_out,X=Y.next_in,ae=Y.input,De=Y.avail_in,ve=G.hold,Be=G.bits,G.mode===F&&(G.back=-1);break}for(G.back=0;!(ct=G.lencode[ve&(1<<G.lenbits)-1],nt=ct>>>24,_t=ct>>>16&255,St=ct&65535,nt<=Be);){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(_t&&(_t&240)===0){for(Et=nt,Xt=_t,Kt=St;!(ct=G.lencode[Kt+((ve&(1<<Et+Xt)-1)>>Et)],nt=ct>>>24,_t=ct>>>16&255,St=ct&65535,Et+nt<=Be);){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}ve>>>=Et,Be-=Et,G.back+=Et}if(ve>>>=nt,Be-=nt,G.back+=nt,G.length=St,_t===0){G.mode=Ae;break}if(_t&32){G.back=-1,G.mode=F;break}if(_t&64){Y.msg="invalid literal/length code",G.mode=Ie;break}G.extra=_t&15,G.mode=Le;case Le:if(G.extra){for(wt=G.extra;Be<wt;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.length+=ve&(1<<G.extra)-1,ve>>>=G.extra,Be-=G.extra,G.back+=G.extra}G.was=G.length,G.mode=Oe;case Oe:for(;!(ct=G.distcode[ve&(1<<G.distbits)-1],nt=ct>>>24,_t=ct>>>16&255,St=ct&65535,nt<=Be);){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if((_t&240)===0){for(Et=nt,Xt=_t,Kt=St;!(ct=G.distcode[Kt+((ve&(1<<Et+Xt)-1)>>Et)],nt=ct>>>24,_t=ct>>>16&255,St=ct&65535,Et+nt<=Be);){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}ve>>>=Et,Be-=Et,G.back+=Et}if(ve>>>=nt,Be-=nt,G.back+=nt,_t&64){Y.msg="invalid distance code",G.mode=Ie;break}G.offset=St,G.extra=_t&15,G.mode=Fe;case Fe:if(G.extra){for(wt=G.extra;Be<wt;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}G.offset+=ve&(1<<G.extra)-1,ve>>>=G.extra,Be-=G.extra,G.back+=G.extra}if(G.offset>G.dmax){Y.msg="invalid distance too far back",G.mode=Ie;break}G.mode=ye;case ye:if(oe===0)break e;if($e=Qe-oe,G.offset>$e){if($e=G.offset-$e,$e>G.whave&&G.sane){Y.msg="invalid distance too far back",G.mode=Ie;break}$e>G.wnext?($e-=G.wnext,st=G.wsize-$e):st=G.wnext-$e,$e>G.length&&($e=G.length),mt=G.window}else mt=Te,st=me-G.offset,$e=G.length;$e>oe&&($e=oe),oe-=$e,G.length-=$e;do Te[me++]=mt[st++];while(--$e);G.length===0&&(G.mode=Me);break;case Ae:if(oe===0)break e;Te[me++]=G.length,oe--,G.mode=Me;break;case re:if(G.wrap){for(;Be<32;){if(De===0)break e;De--,ve|=ae[X++]<<Be,Be+=8}if(Qe-=oe,Y.total_out+=Qe,G.total+=Qe,Qe&&(Y.adler=G.check=G.flags?(0,R.default)(G.check,Te,Qe,me-Qe):(0,D.default)(G.check,Te,Qe,me-Qe)),Qe=oe,(G.flags?ve:xe(ve))!==G.check){Y.msg="incorrect data check",G.mode=Ie;break}ve=0,Be=0}G.mode=pe;case pe:if(G.wrap&&G.flags){for(;Be<32;){if(De===0)break e;De--,ve+=ae[X++]<<Be,Be+=8}if(ve!==(G.total&4294967295)){Y.msg="incorrect length check",G.mode=Ie;break}ve=0,Be=0}G.mode=ue;case ue:Ct=a;break e;case Ie:Ct=f;break e;case Ke:return w;case Ne:default:return h}return Y.next_out=me,Y.avail_out=oe,Y.next_in=X,Y.avail_in=De,G.hold=ve,G.bits=Be,(G.wsize||Qe!==Y.avail_out&&G.mode<Ie&&(G.mode<re||Z!==s))&&ne(Y,Y.output,Y.next_out,Qe-Y.avail_out)?(G.mode=Ke,w):(tt-=Y.avail_in,Qe-=Y.avail_out,Y.total_in+=tt,Y.total_out+=Qe,G.total+=Qe,G.wrap&&Qe&&(Y.adler=G.check=G.flags?(0,R.default)(G.check,Te,Qe,Y.next_out-Qe):(0,D.default)(G.check,Te,Qe,Y.next_out-Qe)),Y.data_type=G.bits+(G.last?64:0)+(G.mode===F?128:0)+(G.mode===Ue||G.mode===K?256:0),(tt===0&&Qe===0||Z===s)&&Ct===n&&(Ct=m),Ct)}function Re(Y){if(!Y||!Y.state)return h;var Z=Y.state;return Z.window&&(Z.window=null),Y.state=null,n}function le(Y,Z){var G;return!Y||!Y.state?h:(G=Y.state,(G.wrap&2)===0?h:(G.head=Z,Z.done=!1,n))}function se(Y,Z){var G=Z.length,ae,Te,X;return!Y||!Y.state?h:(ae=Y.state,ae.wrap!==0&&ae.mode!==H?h:ae.mode===H&&(Te=1,Te=(0,D.default)(Te,Z,G,0),Te!==ae.check)?f:(X=ne(Y,Z,G,G),X?(ae.mode=Ke,w):(ae.havedict=1,n)))}var he="pako inflate (from Nodeca project)";ce.inflateInfo=he},gIYZ:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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"};ce.default=j},h78n:function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return P});var j=ie("q1tI"),k=ie.n(j),D=ie("TSYQ"),R=ie.n(D),O={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},c=function(F){var W=F.map(function(){return Object(j.useRef)()}),U=Object(j.useRef)();return Object(j.useEffect)(function(){var K=Date.now(),z=!1;Object.keys(W).forEach(function(te){var de=W[te].current;if(!de)return;z=!0;var ge=de.style;ge.transitionDuration=".3s, .3s, .3s, .06s",U.current&&K-U.current<100&&(ge.transitionDuration="0s, 0s")}),z&&(U.current=Date.now())}),[W]};function S(){return S=Object.assign||function(H){for(var F=1;F<arguments.length;F++){var W=arguments[F];for(var U in W)Object.prototype.hasOwnProperty.call(W,U)&&(H[U]=W[U])}return H},S.apply(this,arguments)}function y(H,F){return s(H)||d(H,F)||u(H,F)||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 u(H,F){if(!H)return;if(typeof H=="string")return o(H,F);var W=Object.prototype.toString.call(H).slice(8,-1);if(W==="Object"&&H.constructor&&(W=H.constructor.name),W==="Map"||W==="Set")return Array.from(H);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return o(H,F)}function o(H,F){(F==null||F>H.length)&&(F=H.length);for(var W=0,U=new Array(F);W<F;W++)U[W]=H[W];return U}function d(H,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(H)))return;var W=[],U=!0,K=!1,z=void 0;try{for(var te=H[Symbol.iterator](),de;!(U=(de=te.next()).done)&&!(W.push(de.value),F&&W.length===F);U=!0);}catch(ge){K=!0,z=ge}finally{try{!U&&te.return!=null&&te.return()}finally{if(K)throw z}}return W}function s(H){if(Array.isArray(H))return H}function l(H,F){if(H==null)return{};var W=r(H,F),U,K;if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(H);for(K=0;K<z.length;K++){if(U=z[K],F.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(H,U))continue;W[U]=H[U]}}return W}function r(H,F){if(H==null)return{};var W={},U=Object.keys(H),K,z;for(z=0;z<U.length;z++){if(K=U[z],F.indexOf(K)>=0)continue;W[K]=H[K]}return W}var n=function(F){var W=F.className,U=F.percent,K=F.prefixCls,z=F.strokeColor,te=F.strokeLinecap,de=F.strokeWidth,ge=F.style,Ue=F.trailColor,Me=F.trailWidth,Le=F.transition,Oe=l(F,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Oe.gapPosition;var Fe=Array.isArray(U)?U:[U],ye=Array.isArray(z)?z:[z],Ae=c(Fe),re=y(Ae,1),pe=re[0],ue=de/2,Ie=100-de/2,Ke="M ".concat(te==="round"?ue:0,",").concat(ue,`
|
|
|
L `).concat(te==="round"?Ie:100,",").concat(ue),Ne="0 0 100 ".concat(de),je=0;return k.a.createElement("svg",S({className:R()("".concat(K,"-line"),W),viewBox:Ne,preserveAspectRatio:"none",style:ge},Oe),k.a.createElement("path",{className:"".concat(K,"-line-trail"),d:Ke,strokeLinecap:te,stroke:Ue,strokeWidth:Me||de,fillOpacity:"0"}),Fe.map(function(Ge,ze){var ke={strokeDasharray:"".concat(Ge,"px, 100px"),strokeDashoffset:"-".concat(je,"px"),transition:Le||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},xe=ye[ze]||ye[ye.length-1];return je+=Ge,k.a.createElement("path",{key:ze,className:"".concat(K,"-line-path"),d:Ke,strokeLinecap:te,stroke:xe,strokeWidth:de,fillOpacity:"0",ref:pe[ze],style:ke})}))};n.defaultProps=O;var a=n;function i(){return i=Object.assign||function(H){for(var F=1;F<arguments.length;F++){var W=arguments[F];for(var U in W)Object.prototype.hasOwnProperty.call(W,U)&&(H[U]=W[U])}return H},i.apply(this,arguments)}function h(H,F){return C(H)||T(H,F)||w(H,F)||f()}function f(){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 w(H,F){if(!H)return;if(typeof H=="string")return m(H,F);var W=Object.prototype.toString.call(H).slice(8,-1);if(W==="Object"&&H.constructor&&(W=H.constructor.name),W==="Map"||W==="Set")return Array.from(H);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return m(H,F)}function m(H,F){(F==null||F>H.length)&&(F=H.length);for(var W=0,U=new Array(F);W<F;W++)U[W]=H[W];return U}function T(H,F){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(H)))return;var W=[],U=!0,K=!1,z=void 0;try{for(var te=H[Symbol.iterator](),de;!(U=(de=te.next()).done)&&!(W.push(de.value),F&&W.length===F);U=!0);}catch(ge){K=!0,z=ge}finally{try{!U&&te.return!=null&&te.return()}finally{if(K)throw z}}return W}function C(H){if(Array.isArray(H))return H}function x(H,F){if(H==null)return{};var W=b(H,F),U,K;if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(H);for(K=0;K<z.length;K++){if(U=z[K],F.indexOf(U)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(H,U))continue;W[U]=H[U]}}return W}function b(H,F){if(H==null)return{};var W={},U=Object.keys(H),K,z;for(z=0;z<U.length;z++){if(K=U[z],F.indexOf(K)>=0)continue;W[K]=H[K]}return W}var E=0;function A(H){return+H.replace("%","")}function v(H){return Array.isArray(H)?H:[H]}function M(H,F,W,U){var K=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,z=arguments.length>5?arguments[5]:void 0,te=50-U/2,de=0,ge=-te,Ue=0,Me=-2*te;switch(z){case"left":de=-te,ge=0,Ue=2*te,Me=0;break;case"right":de=te,ge=0,Ue=-2*te,Me=0;break;case"bottom":ge=te,Me=2*te;break;default:}var Le="M 50,50 m ".concat(de,",").concat(ge,`
|
|
|
a `).concat(te,",").concat(te," 0 1 1 ").concat(Ue,",").concat(-Me,`
|
|
|
a `).concat(te,",").concat(te," 0 1 1 ").concat(-Ue,",").concat(Me),Oe=Math.PI*2*te,Fe={stroke:W,strokeDasharray:"".concat(F/100*(Oe-K),"px ").concat(Oe,"px"),strokeDashoffset:"-".concat(K/2+H/100*(Oe-K),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Le,pathStyle:Fe}}var I=function(F){var W=F.prefixCls,U=F.strokeWidth,K=F.trailWidth,z=F.gapDegree,te=F.gapPosition,de=F.trailColor,ge=F.strokeLinecap,Ue=F.style,Me=F.className,Le=F.strokeColor,Oe=F.percent,Fe=x(F,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ye=Object(j.useMemo)(function(){return E+=1,E},[]),Ae=M(0,100,de,U,z,te),re=Ae.pathString,pe=Ae.pathStyle,ue=v(Oe),Ie=v(Le),Ke=Ie.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),Ne=c(ue),je=h(Ne,1),Ge=je[0],ze=function(){var xe=0;return ue.map(function(Ee,Se){var $=Ie[Se]||Ie[Ie.length-1],fe=Object.prototype.toString.call($)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ye,")"):"",J=M(xe,Ee,$,U,z,te);return xe+=Ee,k.a.createElement("path",{key:Se,className:"".concat(W,"-circle-path"),d:J.pathString,stroke:fe,strokeLinecap:ge,strokeWidth:U,opacity:Ee===0?0:1,fillOpacity:"0",style:J.pathStyle,ref:Ge[Se]})})};return k.a.createElement("svg",i({className:R()("".concat(W,"-circle"),Me),viewBox:"0 0 100 100",style:Ue},Fe),Ke&&k.a.createElement("defs",null,k.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ye),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ke).sort(function(ke,xe){return A(ke)-A(xe)}).map(function(ke,xe){return k.a.createElement("stop",{key:xe,offset:ke,stopColor:Ke[ke]})}))),k.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:re,stroke:de,strokeLinecap:ge,strokeWidth:K||U,fillOpacity:"0",style:pe}),ze().reverse())};I.defaultProps=O;var P=I,B={Line:a,Circle:P}},hXwI:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(O,c){if(!(O instanceof c))throw new TypeError("Cannot call a class as a function")}function k(O,c){for(var S=0;S<c.length;S++){var y=c[S];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(O,y.key,y)}}function D(O,c,S){return c&&k(O.prototype,c),S&&k(O,S),O}var R=function(){function O(){j(this,O)}return D(O,[{key:"decodeRect",value:function(S,y,p,u,o,d,s){if(o.rQwait("COPYRECT",4))return!1;var l=o.rQshift16(),r=o.rQshift16();return d.copyImage(l,r,S,y,p,u),!0}}]),O}();ce.default=R},iJb0:function(Ze,ce,ie){"use strict";ie.r(ce);var j=ie("+L6B"),k=ie("2/Rp"),D=ie("miYZ"),R=ie("tsqr"),O=ie("14J3"),c=ie("BMrR"),S=ie("jCWc"),y=ie("kPKH"),p=ie("k1fw"),u=ie("9og8"),o=ie("2qtc"),d=ie("kLXV"),s=ie("tJVT"),l=ie("PpiC"),r=ie("aHsQ"),n=ie("sGsY"),a=ie("WmNS"),i=ie.n(a),h=ie("q1tI"),f=ie.n(h),w=ie("9kvl"),m=ie("Lmeb"),T=ie("Ot1p"),C=ie("Dqnf"),x=ie("dhSg"),b=ie("MXD1"),E=ie("CFYs"),A=ie("rAM+"),v=ie("IxHN"),M=ie("bdgK"),I=ie("M8RZ"),P=ie("Ty5D"),B=ie("1dTM"),H=ie.n(B),F=ie("HBuW"),W=ie("VaU+"),U=ie.n(W),K=ie("ye1Q"),z=f.a.createElement(K.a,{style:{fontSize:24},spin:!0});function te(re){return re.replace(/\\u([\dA-Za-z]{4})/g,function(pe,ue){return String.fromCharCode(parseInt("0x"+ue))})}function de(re){re||(re=window.location.search);var pe=re.substr(1),ue={};return pe.split("&").forEach(function(Ie){var Ke=Ie.split("=");ue[Ke[0]]=decodeURIComponent(Ke[1])}),ue}var ge={loading:!0,isLarge:!1,showClipBoardBox:!1,transferContent:"",mes:"\u5B9E\u9A8C\u73AF\u5883\u51C6\u5907\u4E2D"},Ue;(function(re){re[re.SET_LOADING=0]="SET_LOADING",re[re.SET_IS_LARGE=1]="SET_IS_LARGE",re[re.SET_MES=2]="SET_MES",re[re.SET_STATE=3]="SET_STATE",re[re.SHOW_CLIPBOARD_BOX=4]="SHOW_CLIPBOARD_BOX",re[re.SET_TRANSFER_CONTENT=5]="SET_TRANSFER_CONTENT"})(Ue||(Ue={}));function Me(re,pe){switch(pe.type){case Ue.SET_LOADING:return Object(p.a)(Object(p.a)({},re),{},{loading:pe.payload});case Ue.SET_IS_LARGE:return Object(p.a)(Object(p.a)({},re),{},{isLarge:pe.payload});case Ue.SET_MES:return Object(p.a)(Object(p.a)({},re),{},{mes:pe.payload});case Ue.SET_STATE:return Object(p.a)(Object(p.a)({},re),pe.payload);case Ue.SET_TRANSFER_CONTENT:return Object(p.a)(Object(p.a)({},re),{},{transferContent:pe.payload});case Ue.SHOW_CLIPBOARD_BOX:return Object(p.a)(Object(p.a)({},re),{},{showClipBoardBox:pe.payload});default:throw new Error}}var Le=function(re){var pe=re.vnc_url,ue=re.window_vnc_url,Ie=re.taskId,Ke=Object(h.useRef)(),Ne=Object(h.useRef)(),je=Object(h.useReducer)(Me,ge),Ge=Object(s.a)(je,2),ze=Ge[0],ke=Ge[1],xe=Object(h.useState)(0),Ee=Object(s.a)(xe,2),Se=Ee[0],$=Ee[1],fe=ze.mes,J=ze.loading,Ce=ze.showClipBoardBox,We=ze.isLarge,Ve=ze.transferContent,Pe=Object(h.useState)(0),Je=Object(s.a)(Pe,2),ne=Je[0],be=Je[1],Re,le=Object(h.useRef)(),se=Object(P.i)();function he(){ke({type:Ue.SHOW_CLIPBOARD_BOX,payload:!1})}function Y(){ke({type:Ue.SET_IS_LARGE,payload:!We})}function Z(X){var me;return Ke.current&&(me=new M.default(function(De){var oe=Object(A.a)(De),ve;try{for(oe.s();!(ve=oe.n()).done;){var Be=ve.value;(Be.target.offsetHeight>0||Be.target.offsetWidth>0)&&X._eventHandlers.windowResize()}}catch(tt){oe.e(tt)}finally{oe.f()}}),me.observe(Ke.current)),me}var G=function(){var X=Object(u.a)(i.a.mark(function me(){var De;return i.a.wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:return ve.next=2,Object(F.mb)(Object(p.a)({},se));case 2:if(De=ve.sent,!((De==null?void 0:De.status)===-3)){ve.next=5;break}return ve.abrupt("return",new Promise(function(){var Be=Object(u.a)(i.a.mark(function tt(Qe,$e){return i.a.wrap(function(mt){for(;;)switch(mt.prev=mt.next){case 0:d.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 ct=Object(u.a)(i.a.mark(function _t(){return i.a.wrap(function(Et){for(;;)switch(Et.prev=Et.next){case 0:return clearTimeout(Re),be(0),G(),Et.abrupt("return");case 4:case"end":return Et.stop()}},_t)}));function nt(){return ct.apply(this,arguments)}return nt}()});case 1:case"end":return mt.stop()}},tt)}));return function(tt,Qe){return Be.apply(this,arguments)}}()));case 5:if(!((De==null?void 0:De.status)===-1)){ve.next=7;break}throw new String(De==null?void 0:De.message);case 7:return x.a.publish("update-windows-time",De==null?void 0:De.data),ve.abrupt("return",De);case 9:case"end":return ve.stop()}},me)}));return function(){return X.apply(this,arguments)}}();Object(h.useEffect)(function(){return le.current=setTimeout(function(){d.a.confirm({title:f.a.createElement(f.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),$(Se+1)}})},1e3*60*60),function(){clearTimeout(le.current)}},[]),Object(h.useEffect)(function(){var X,me;function De($e){ue&&(R.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:Ue.SET_LOADING,payload:!0}),$(Se+1))}function oe(){clearTimeout(Re),be(100),setTimeout(function(){ke({type:Ue.SET_LOADING,payload:!1})},1300),x.a.subscribe("send-ctrl-alt-delete",function(){var $e;($e=X)===null||$e===void 0||$e.sendCtrlAltDel()})}function ve($e){var st=te($e.detail.text);ke({type:Ue.SET_TRANSFER_CONTENT,payload:st})}if((ue||pe)&&Ke.current){new Promise(Object(u.a)(i.a.mark(function $e(){var st,mt,ct,nt,_t,St,Et,Xt,Kt,Rt;return i.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return st=de(),mt="",Lt.next=4,G();case 4:nt=Lt.sent,ue?(ct="Edu123",mt=decodeURIComponent(nt==null||((_t=nt.data)===null||_t===void 0)?void 0:_t.vnc_url)):(Et=new URL(nt==null||((St=nt.data)===null||St===void 0)?void 0:St.vnc_url),Xt=Et.protocol,Kt=Et.searchParams,Rt=Et.host,ct=Kt.get("password"),mt="".concat(Xt==="https:"?"wss":"ws","://").concat(Rt,"/").concat(st.path||"websockify")),X=new H.a(Ke.current,mt,{credentials:{password:ct},wsProtocols:["binary"]}),me=Z(X),X.viewOnly=st.view_only||!1,ue?X.scaleViewport=!0:X.scaleViewport=st.scale||!1,X.scaleViewport=st.scale||!0,X.resizeSession=!0,Ne.current=X,X.addEventListener("disconnect",De),X.addEventListener("connect",oe),X.addEventListener("clipboard",ve);case 16:case"end":return Lt.stop()}},$e)})));var Be=x.a.subscribe("vnc-reseting",function(){ke({type:Ue.SET_STATE,payload:{loading:!0,mes:"\u5B9E\u9A8C\u73AF\u5883\u91CD\u7F6E\u4E2D"}})}),tt=x.a.subscribe("vnc-enlarge",function(){ke({type:Ue.SET_IS_LARGE,payload:!0})}),Qe=x.a.subscribe("show-clipboard-box",function(){ke({type:Ue.SHOW_CLIPBOARD_BOX,payload:!0})});return be(0),function(){var $e,st,mt,ct;($e=X)===null||$e===void 0||$e.removeEventListener("disconnect",De),(st=X)===null||st===void 0||st.removeEventListener("connect",oe),(mt=X)===null||mt===void 0||mt.removeEventListener("clipboard",ve),Be(),tt(),Qe(),(ct=me)===null||ct===void 0||ct.unobserve(Ke.current)}}},[pe,ue,Se]);function ae(X){var me;(me=Ne.current)===null||me===void 0||me.clipboardPasteFrom(X),ke({type:Ue.SET_TRANSFER_CONTENT,payload:X}),R.b.success("\u4FDD\u5B58\u6210\u529F\uFF01\u4F60\u53EF\u4EE5\u5728\u5B9E\u9A8C\u73AF\u5883\u4E2D\u7C98\u8D34\u8BE5\u5185\u5BB9"),he()}Object(h.useEffect)(function(){ne==0&&Te()},[ne]);var Te=function X(){ne>99?ne=99:(ne=ne+1,Re=setTimeout(function(){X()},1500)),ne<100&&be(ne)};return f.a.createElement(h.Fragment,null,f.a.createElement("div",{style:{backgroundColor:"#000"},className:"".concat(ue?"vnc-panel-wrapper-windows":"vnc-panel-wrapper"," ").concat(We?"full-screen":"")},f.a.createElement("a",{className:"btn-vnc-resize",onClick:Y},f.a.createElement("i",{className:"iconfont ".concat(We?"icon-tuichuquanping1":"icon-quanping1")})),J?f.a.createElement(v.a,{className:U.a.spin,message:fe,style:{color:"#0152d9"}},f.a.createElement("div",{className:"tc",style:{width:500,margin:"0 auto",color:"#FFF"}},f.a.createElement(E.a,{percent:ne,format:function(me){return f.a.createElement("span",{className:"c-white"},me,"%")}}))):null,f.a.createElement("div",{ref:Ke,className:"vnc-panel ".concat(J?"hide":"animated fadeIn")})),f.a.createElement(I.a,null))},Oe=ie("m3rI"),Fe=n.a.Countdown,ye=function(pe){var ue,Ie,Ke=pe.shixunsDetail,Ne=pe.globalSetting,je=pe.loading,Ge=pe.dispatch,ze=pe.user,ke=pe.history,xe=Object(l.a)(pe,["shixunsDetail","globalSetting","loading","dispatch","user","history"]),Ee=Object(h.useState)({}),Se=Object(s.a)(Ee,2),$=Se[0],fe=Se[1],J=Object(h.useState)(400),Ce=Object(s.a)(J,2),We=Ce[0],Ve=Ce[1],Pe=Object(h.useState)(!1),Je=Object(s.a)(Pe,2),ne=Je[0],be=Je[1],Re=Object(h.useState)(""),le=Object(s.a)(Re,2),se=le[0],he=le[1],Y=Object(h.useState)(Date.now()+1e3*60*60),Z=Object(s.a)(Y,2),G=Z[0],ae=Z[1],Te=xe.match.params,X=xe.location.query,me=Object(h.useState)(!1),De=Object(s.a)(me,2),oe=De[0],ve=De[1],Be=Ke.mirrorApplies,tt=Object(h.useRef)();Object(h.useEffect)(function(){return Ge({type:"globalSetting/headerFooterToggle",payload:!1}),$e(),st(),window.addEventListener("resize",$e),x.a.subscribe("delayed-time",function(){ae(Date.now()+1e3*60*60)}),function(){window.removeEventListener("resize",$e),clearTimeout(tt.current),Ge({type:"globalSetting/headerFooterToggle",payload:!0})}},[]),Object(h.useEffect)(function(){$.host&&setTimeout(function(){x.a.publish("create-socket",1)},1500)},[$]),Object(h.useEffect)(function(){Be.webssh&&(Qe(),tt.current=setTimeout(function(){d.a.confirm({title:f.a.createElement(f.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)),Be.id&&$e()},[Be]);var Qe=function(){var mt=Object(u.a)(i.a.mark(function ct(){var nt;return i.a.wrap(function(St){for(;;)switch(St.prev=St.next){case 0:return St.next=2,Object(F.nb)(Object(p.a)({},Te));case 2:nt=St.sent,fe(Object(p.a)({},nt));case 4:case"end":return St.stop()}},ct)}));return function(){return mt.apply(this,arguments)}}(),$e=function(){var ct=window.innerHeight;Ve(ct-(Be.audit_remark?400:270))},st=function(){var mt=Object(u.a)(i.a.mark(function ct(){return i.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:Ge({type:"shixunsDetail/getMirrorApplies",payload:Object(p.a)({},Te)});case 1:case"end":return _t.stop()}},ct)}));return function(){return mt.apply(this,arguments)}}();return console.log(ze==null?void 0:ze.userInfo),f.a.createElement("section",{className:U.a.wrp},f.a.createElement("header",{className:U.a.header},f.a.createElement(c.a,{align:"middle"},f.a.createElement(y.a,{flex:"1"},f.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"40",src:"".concat(Oe.a.IMG_SERVER,"/images/").concat(ze==null||((ue=ze.userInfo)===null||ue===void 0)?void 0:ue.image_url),width:"40",style:{borderRadius:"50%"}}),f.a.createElement("span",{className:"ml10"},ze==null||((Ie=ze.userInfo)===null||Ie===void 0)?void 0:Ie.real_name)),f.a.createElement(y.a,{flex:"1"},f.a.createElement("span",{className:"mr10 font18"},Be.name)),f.a.createElement(y.a,null,f.a.createElement("span",null,"\u5269\u4F59\u65F6\u957F:",f.a.createElement(Fe,{className:U.a.cuttDown,value:G,format:"mm:ss",valueStyle:{color:"#FFF"}})),f.a.createElement("span",{className:"icon-kaiguan font20 current ml60",onClick:function(){d.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 nt;ke.push("/users/".concat((nt=ze.userInfo)===null||nt===void 0?void 0:nt.login,"/experiment-img"))}})}})))),f.a.createElement("aside",{className:U.a.container},f.a.createElement(c.a,null,f.a.createElement(y.a,{style:{position:"relative",width:oe?"0%":"40%"}},f.a.createElement("section",{className:"".concat(U.a.info," ml40 mr40"),style:{display:oe?"none":"flex"}},f.a.createElement("aside",null,f.a.createElement(c.a,{align:"middle",style:{height:68,borderBottom:"1px solid #f1f1f1"}},f.a.createElement(y.a,{className:"font18"},"\u5B9E\u9A8C\u73AF\u5883\u8BF4\u660E ",f.a.createElement("span",{className:"font16 ml20 c-grey-999"},"\u8BF7\u6309\u6A21\u677F\u586B\u5199\u5B9E\u9A8C\u73AF\u5883\u8BF4\u660E"))),f.a.createElement("aside",{className:"mt30 flex1"},f.a.createElement(T.a,{height:We,defaultValue:Be.description||"",onChange:function(ct){return he(ct)}}),Be.audit_remark&&f.a.createElement("aside",{className:"mt10 font16 c-grey-999 mb10"},"\u5BA1\u6838\u4E0D\u901A\u8FC7\u539F\u56E0\uFF1A",f.a.createElement("span",{className:"c-red"},Be.audit_remark))),f.a.createElement("aside",{className:"mb20"},f.a.createElement(c.a,{justify:"center",gutter:[20,20],className:U.a.buttons},f.a.createElement(y.a,null,f.a.createElement(k.a,{type:"primary",size:"large",loading:ne,onClick:Object(u.a)(i.a.mark(function mt(){var ct;return i.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return be(!0),d.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(){}}),_t.next=4,Object(F.pb)(Object(p.a)(Object(p.a)({},Te),{},{description:se}));case 4:ct=_t.sent,(ct==null?void 0:ct.status)===0&&R.b.success("\u4FDD\u5B58\u6210\u529F"),be(!1);case 7:case"end":return _t.stop()}},mt)}))},"\u4FDD\u5B58")),f.a.createElement(y.a,null,f.a.createElement(k.a,{type:"primary",ghost:!0,size:"large",onClick:Object(u.a)(i.a.mark(function mt(){return i.a.wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:d.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 _t=Object(u.a)(i.a.mark(function Et(){var Xt,Kt;return i.a.wrap(function(Ct){for(;;)switch(Ct.prev=Ct.next){case 0:return Ct.next=2,Object(F.ob)(Object(p.a)(Object(p.a)({},Te),{},{description:se}));case 2:Xt=Ct.sent,(Xt==null?void 0:Xt.status)===0&&(ke.push("/users/".concat((Kt=ze.userInfo)===null||Kt===void 0?void 0:Kt.login,"/experiment-img")),R.b.success("\u7533\u8BF7\u53D1\u5E03\u6210\u529F"));case 4:case"end":return Ct.stop()}},Et)}));function St(){return _t.apply(this,arguments)}return St}()});case 1:case"end":return nt.stop()}},mt)}))},"\u7533\u8BF7\u53D1\u5E03")))))),f.a.createElement("div",{className:oe?U.a.elseShrink:U.a.shrink,onClick:function(){return ve(!oe)}},f.a.createElement("i",{className:"iconfont icon-cela"}))),f.a.createElement(y.a,{style:{background:"#000",width:oe?"100%":"60%"}},f.a.createElement("div",null,f.a.createElement("aside",{className:U.a.fullBtn},f.a.createElement("span",{className:"icon-quanping"})),Be.webssh&&f.a.createElement(C.a,{sshConfigData:$,sid:1}),((Be==null?void 0:Be.vnc)||(Be==null?void 0:Be.windows))&&f.a.createElement(Le,{taskId:Be.type==="windows"?"pcf9t4w6vrnz":"ijby95c82nsh",vnc_url:Be.vnc,window_vnc_url:Be.windows}))))))},Ae=ce.default=Object(w.b)(function(re){var pe=re.shixunsDetail,ue=re.loading,Ie=re.user,Ke=re.globalSetting;return{shixunsDetail:pe,globalSetting:Ke,user:Ie,loading:ue.models.shixunsDetail}})(ye)},iUHT:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;function j(m,T){if(!(m instanceof T))throw new TypeError("Cannot call a class as a function")}function k(m,T){for(var C=0;C<T.length;C++){var x=T[C];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(m,x.key,x)}}function D(m,T,C){return T&&k(m.prototype,T),C&&k(m,C),m}var R=[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],O=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=0,S,y,p,u,o,d;S=1<<16,y=1<<24,p=S|y,u=1<<2,o=1<<10,d=u|o;var s=[p|o,c|c,S|c,p|d,p|u,S|d,c|u,S|c,c|o,p|o,p|d,c|o,y|d,p|u,y|c,c|u,c|d,y|o,y|o,S|o,S|o,p|c,p|c,y|d,S|u,y|u,y|u,S|u,c|c,c|d,S|d,y|c,S|c,p|d,c|u,p|c,p|o,y|c,y|c,c|o,p|u,S|c,S|o,y|u,c|o,c|u,y|d,S|d,p|d,S|u,p|c,y|d,y|u,c|d,S|d,p|o,c|d,y|o,y|o,c|c,S|u,S|o,c|c,p|u];S=1<<20,y=1<<31,p=S|y,u=1<<5,o=1<<15,d=u|o;var l=[p|d,y|o,c|o,S|d,S|c,c|u,p|u,y|d,y|u,p|d,p|o,y|c,y|o,S|c,c|u,p|u,S|o,S|u,y|d,c|c,y|c,c|o,S|d,p|c,S|u,y|u,c|c,S|o,c|d,p|o,p|c,c|d,c|c,S|d,p|u,S|c,y|d,p|c,p|o,c|o,p|c,y|o,c|u,p|d,S|d,c|u,c|o,y|c,c|d,p|o,S|c,y|u,S|u,y|d,y|u,S|u,S|o,c|c,y|o,c|d,y|c,p|u,p|d,S|o];S=1<<17,y=1<<27,p=S|y,u=1<<3,o=1<<9,d=u|o;var r=[c|d,p|o,c|c,p|u,y|o,c|c,S|d,y|o,S|u,y|u,y|u,S|c,p|d,S|u,p|c,c|d,y|c,c|u,p|o,c|o,S|o,p|c,p|u,S|d,y|d,S|o,S|c,y|d,c|u,p|d,c|o,y|c,p|o,y|c,S|u,c|d,S|c,p|o,y|o,c|c,c|o,S|u,p|d,y|o,y|u,c|o,c|c,p|u,y|d,S|c,y|c,p|d,c|u,S|d,S|o,y|u,p|c,y|d,c|d,p|c,S|d,c|u,p|u,S|o];S=1<<13,y=1<<23,p=S|y,u=1<<0,o=1<<7,d=u|o;var n=[p|u,S|d,S|d,c|o,p|o,y|d,y|u,S|u,c|c,p|c,p|c,p|d,c|d,c|c,y|o,y|u,c|u,S|c,y|c,p|u,c|o,y|c,S|u,S|o,y|d,c|u,S|o,y|o,S|c,p|o,p|d,c|d,y|o,y|u,p|c,p|d,c|d,c|c,c|c,p|c,S|o,y|o,y|d,c|u,p|u,S|d,S|d,c|o,p|d,c|d,c|u,S|c,y|u,S|u,p|o,y|d,S|u,S|o,y|c,p|u,c|o,y|c,S|c,p|o];S=1<<25,y=1<<30,p=S|y,u=1<<8,o=1<<19,d=u|o;var a=[c|u,S|d,S|o,p|u,c|o,c|u,y|c,S|o,y|d,c|o,S|u,y|d,p|u,p|o,c|d,y|c,S|c,y|o,y|o,c|c,y|u,p|d,p|d,S|u,p|o,y|u,c|c,p|c,S|d,S|c,p|c,c|d,c|o,p|u,c|u,S|c,y|c,S|o,p|u,y|d,S|u,y|c,p|o,S|d,y|d,c|u,S|c,p|o,p|d,c|d,p|c,p|d,S|o,c|c,y|o,p|c,c|d,S|u,y|u,c|o,c|c,y|o,S|d,y|u];S=1<<22,y=1<<29,p=S|y,u=1<<4,o=1<<14,d=u|o;var i=[y|u,p|c,c|o,p|d,p|c,c|u,p|d,S|c,y|o,S|d,S|c,y|u,S|u,y|o,y|c,c|d,c|c,S|u,y|d,c|o,S|o,y|d,c|u,p|u,p|u,c|c,S|d,p|o,c|d,S|o,p|o,y|c,y|o,c|u,p|u,S|o,p|d,S|c,c|d,y|u,S|c,y|o,y|c,c|d,y|u,p|d,S|o,p|c,S|d,p|o,c|c,p|u,c|u,c|o,p|c,S|d,c|o,S|u,y|d,c|c,p|o,y|c,S|u,y|d];S=1<<21,y=1<<26,p=S|y,u=1<<1,o=1<<11,d=u|o;var h=[S|c,p|u,y|d,c|c,c|o,y|d,S|d,p|o,p|d,S|c,c|c,y|u,c|u,y|c,p|u,c|d,y|o,S|d,S|u,y|o,y|u,p|c,p|o,S|u,p|c,c|o,c|d,p|d,S|o,c|u,y|c,S|o,y|c,S|o,S|c,y|d,y|d,p|u,p|u,c|u,S|u,y|c,y|o,S|c,p|o,c|d,S|d,p|o,c|d,y|u,p|d,p|c,S|o,c|c,c|u,p|d,c|c,S|d,p|c,c|o,y|u,y|o,c|o,S|u];S=1<<18,y=1<<28,p=S|y,u=1<<6,o=1<<12,d=u|o;var f=[y|d,c|o,S|c,p|d,y|c,y|d,c|u,y|c,S|u,p|c,p|d,S|o,p|o,S|d,c|o,c|u,p|c,y|u,y|o,c|d,S|o,S|u,p|u,p|o,c|d,c|c,c|c,p|u,y|u,y|o,S|d,S|c,S|d,S|c,p|o,c|o,c|u,p|u,c|o,S|d,y|o,c|u,y|u,p|c,p|u,y|c,S|c,y|d,c|c,p|d,S|u,y|u,p|c,y|o,y|d,c|c,p|d,S|o,S|o,c|d,c|d,S|u,y|c,p|o],w=function(){function m(T){j(this,m),this.keys=[];for(var C=[],x=[],b=[],E=0,A=56;E<56;++E,A-=8){A+=A<-5?65:A<-3?31:A<-1?63:A===27?35:0;var v=A&7;C[E]=(T[A>>>3]&1<<v)!==0?1:0}for(var M=0;M<16;++M){var I=M<<1,P=I+1;b[I]=b[P]=0;for(var B=28;B<59;B+=28)for(var H=B-28;H<B;++H){var F=H+O[M];x[H]=F<B?C[F]:C[F-28]}for(var W=0;W<24;++W)x[R[W]]!==0&&(b[I]|=1<<23-W),x[R[W+24]]!==0&&(b[P]|=1<<23-W)}for(var U=0,K=0,z=0;U<16;++U){var te=b[K++],de=b[K++];this.keys[z]=(te&16515072)<<6,this.keys[z]|=(te&4032)<<10,this.keys[z]|=(de&16515072)>>>10,this.keys[z]|=(de&4032)>>>6,++z,this.keys[z]=(te&258048)<<12,this.keys[z]|=(te&63)<<16,this.keys[z]|=(de&258048)>>>4,this.keys[z]|=de&63,++z}}return D(m,[{key:"enc8",value:function(C){var x=C.slice(),b=0,E,A,v;E=x[b++]<<24|x[b++]<<16|x[b++]<<8|x[b++],A=x[b++]<<24|x[b++]<<16|x[b++]<<8|x[b++],v=(E>>>4^A)&252645135,A^=v,E^=v<<4,v=(E>>>16^A)&65535,A^=v,E^=v<<16,v=(A>>>2^E)&858993459,E^=v,A^=v<<2,v=(A>>>8^E)&16711935,E^=v,A^=v<<8,A=A<<1|A>>>31&1,v=(E^A)&2863311530,E^=v,A^=v,E=E<<1|E>>>31&1;for(var M=0,I=0;M<8;++M){v=A<<28|A>>>4,v^=this.keys[I++];var P=h[v&63];P|=a[v>>>8&63],P|=r[v>>>16&63],P|=s[v>>>24&63],v=A^this.keys[I++],P|=f[v&63],P|=i[v>>>8&63],P|=n[v>>>16&63],P|=l[v>>>24&63],E^=P,v=E<<28|E>>>4,v^=this.keys[I++],P=h[v&63],P|=a[v>>>8&63],P|=r[v>>>16&63],P|=s[v>>>24&63],v=E^this.keys[I++],P|=f[v&63],P|=i[v>>>8&63],P|=n[v>>>16&63],P|=l[v>>>24&63],A^=P}for(A=A<<31|A>>>1,v=(E^A)&2863311530,E^=v,A^=v,E=E<<31|E>>>1,v=(E>>>8^A)&16711935,A^=v,E^=v<<8,v=(E>>>2^A)&858993459,A^=v,E^=v<<2,v=(A>>>16^E)&65535,E^=v,A^=v<<16,v=(A>>>4^E)&252645135,E^=v,A^=v<<4,v=[A,E],b=0;b<8;b++)x[b]=(v[b>>>2]>>>8*(3-b%4))%256,x[b]<0&&(x[b]+=256);return x}},{key:"encrypt",value:function(C){return this.enc8(C.slice(0,8)).concat(this.enc8(C.slice(8,16)))}}]),m}();ce.default=w},kSUc:function(Ze,ce,ie){},lNSK:function(Ze,ce,ie){"use strict";function j(X){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?j=function(De){return typeof De}:j=function(De){return De&&typeof Symbol=="function"&&De.constructor===Symbol&&De!==Symbol.prototype?"symbol":typeof De},j(X)}Object.defineProperty(ce,"__esModule",{value:!0}),ce.deflateInit=Y,ce.deflateInit2=he,ce.deflateReset=le,ce.deflateResetKeep=Re,ce.deflateSetHeader=se,ce.deflate=Z,ce.deflateEnd=G,ce.deflateSetDictionary=ae,ce.deflateInfo=ce.Z_DEFLATED=ce.Z_UNKNOWN=ce.Z_DEFAULT_STRATEGY=ce.Z_FIXED=ce.Z_RLE=ce.Z_HUFFMAN_ONLY=ce.Z_FILTERED=ce.Z_DEFAULT_COMPRESSION=ce.Z_BUF_ERROR=ce.Z_DATA_ERROR=ce.Z_STREAM_ERROR=ce.Z_STREAM_END=ce.Z_OK=ce.Z_BLOCK=ce.Z_FINISH=ce.Z_FULL_FLUSH=ce.Z_PARTIAL_FLUSH=ce.Z_NO_FLUSH=void 0;var k=p(ie("6BzB")),D=p(ie("c5fP")),R=S(ie("xlC8")),O=S(ie("QV2g")),c=S(ie("xSIq"));function S(X){return X&&X.__esModule?X:{default:X}}function y(){if(typeof WeakMap!="function")return null;var X=new WeakMap;return y=function(){return X},X}function p(X){if(X&&X.__esModule)return X;if(X===null||j(X)!=="object"&&typeof X!="function")return{default:X};var me=y();if(me&&me.has(X))return me.get(X);var De={},oe=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var ve in X)if(Object.prototype.hasOwnProperty.call(X,ve)){var Be=oe?Object.getOwnPropertyDescriptor(X,ve):null;Be&&(Be.get||Be.set)?Object.defineProperty(De,ve,Be):De[ve]=X[ve]}return De.default=X,me&&me.set(X,De),De}var u=0;ce.Z_NO_FLUSH=u;var o=1;ce.Z_PARTIAL_FLUSH=o;var d=3;ce.Z_FULL_FLUSH=d;var s=4;ce.Z_FINISH=s;var l=5;ce.Z_BLOCK=l;var r=0;ce.Z_OK=r;var n=1;ce.Z_STREAM_END=n;var a=-2;ce.Z_STREAM_ERROR=a;var i=-3;ce.Z_DATA_ERROR=i;var h=-5;ce.Z_BUF_ERROR=h;var f=-1;ce.Z_DEFAULT_COMPRESSION=f;var w=1;ce.Z_FILTERED=w;var m=2;ce.Z_HUFFMAN_ONLY=m;var T=3;ce.Z_RLE=T;var C=4;ce.Z_FIXED=C;var x=0;ce.Z_DEFAULT_STRATEGY=x;var b=2;ce.Z_UNKNOWN=b;var E=8;ce.Z_DEFLATED=E;var A=9,v=15,M=8,I=29,P=256,B=P+1+I,H=30,F=19,W=2*B+1,U=15,K=3,z=258,te=z+K+1,de=32,ge=42,Ue=69,Me=73,Le=91,Oe=103,Fe=113,ye=666,Ae=1,re=2,pe=3,ue=4,Ie=3;function Ke(X,me){return X.msg=c.default[me],me}function Ne(X){return(X<<1)-(X>4?9:0)}function je(X){for(var me=X.length;--me>=0;)X[me]=0}function Ge(X){var me=X.state,De=me.pending;if(De>X.avail_out&&(De=X.avail_out),De===0)return;k.arraySet(X.output,me.pending_buf,me.pending_out,De,X.next_out),X.next_out+=De,me.pending_out+=De,X.total_out+=De,X.avail_out-=De,me.pending-=De,me.pending===0&&(me.pending_out=0)}function ze(X,me){D._tr_flush_block(X,X.block_start>=0?X.block_start:-1,X.strstart-X.block_start,me),X.block_start=X.strstart,Ge(X.strm)}function ke(X,me){X.pending_buf[X.pending++]=me}function xe(X,me){X.pending_buf[X.pending++]=me>>>8&255,X.pending_buf[X.pending++]=me&255}function Ee(X,me,De,oe){var ve=X.avail_in;return ve>oe&&(ve=oe),ve===0?0:(X.avail_in-=ve,k.arraySet(me,X.input,X.next_in,ve,De),X.state.wrap===1?X.adler=(0,R.default)(X.adler,me,ve,De):X.state.wrap===2&&(X.adler=(0,O.default)(X.adler,me,ve,De)),X.next_in+=ve,X.total_in+=ve,ve)}function Se(X,me){var De=X.max_chain_length,oe=X.strstart,ve,Be,tt=X.prev_length,Qe=X.nice_match,$e=X.strstart>X.w_size-te?X.strstart-(X.w_size-te):0,st=X.window,mt=X.w_mask,ct=X.prev,nt=X.strstart+z,_t=st[oe+tt-1],St=st[oe+tt];X.prev_length>=X.good_match&&(De>>=2),Qe>X.lookahead&&(Qe=X.lookahead);do{if(ve=me,st[ve+tt]!==St||st[ve+tt-1]!==_t||st[ve]!==st[oe]||st[++ve]!==st[oe+1])continue;oe+=2,ve++;do;while(st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&st[++oe]===st[++ve]&&oe<nt);if(Be=z-(nt-oe),oe=nt-z,Be>tt){if(X.match_start=me,tt=Be,Be>=Qe)break;_t=st[oe+tt-1],St=st[oe+tt]}}while((me=ct[me&mt])>$e&&--De!==0);return tt<=X.lookahead?tt:X.lookahead}function $(X){var me=X.w_size,De,oe,ve,Be,tt;do{if(Be=X.window_size-X.lookahead-X.strstart,X.strstart>=me+(me-te)){k.arraySet(X.window,X.window,me,me,0),X.match_start-=me,X.strstart-=me,X.block_start-=me,oe=X.hash_size,De=oe;do ve=X.head[--De],X.head[De]=ve>=me?ve-me:0;while(--oe);oe=me,De=oe;do ve=X.prev[--De],X.prev[De]=ve>=me?ve-me:0;while(--oe);Be+=me}if(X.strm.avail_in===0)break;if(oe=Ee(X.strm,X.window,X.strstart+X.lookahead,Be),X.lookahead+=oe,X.lookahead+X.insert>=K)for(tt=X.strstart-X.insert,X.ins_h=X.window[tt],X.ins_h=(X.ins_h<<X.hash_shift^X.window[tt+1])&X.hash_mask;X.insert&&!(X.ins_h=(X.ins_h<<X.hash_shift^X.window[tt+K-1])&X.hash_mask,X.prev[tt&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=tt,tt++,X.insert--,X.lookahead+X.insert<K););}while(X.lookahead<te&&X.strm.avail_in!==0)}function fe(X,me){var De=65535;for(De>X.pending_buf_size-5&&(De=X.pending_buf_size-5);;){if(X.lookahead<=1){if($(X),X.lookahead===0&&me===u)return Ae;if(X.lookahead===0)break}X.strstart+=X.lookahead,X.lookahead=0;var oe=X.block_start+De;if((X.strstart===0||X.strstart>=oe)&&(X.lookahead=X.strstart-oe,X.strstart=oe,ze(X,!1),X.strm.avail_out===0))return Ae;if(X.strstart-X.block_start>=X.w_size-te&&(ze(X,!1),X.strm.avail_out===0))return Ae}return X.insert=0,me===s?(ze(X,!0),X.strm.avail_out===0?pe:ue):(X.strstart>X.block_start&&(ze(X,!1),X.strm.avail_out===0),Ae)}function J(X,me){for(var De,oe;;){if(X.lookahead<te){if($(X),X.lookahead<te&&me===u)return Ae;if(X.lookahead===0)break}if(De=0,X.lookahead>=K&&(X.ins_h=(X.ins_h<<X.hash_shift^X.window[X.strstart+K-1])&X.hash_mask,De=X.prev[X.strstart&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=X.strstart),De!==0&&X.strstart-De<=X.w_size-te&&(X.match_length=Se(X,De)),X.match_length>=K)if(oe=D._tr_tally(X,X.strstart-X.match_start,X.match_length-K),X.lookahead-=X.match_length,X.match_length<=X.max_lazy_match&&X.lookahead>=K){X.match_length--;do X.strstart++,X.ins_h=(X.ins_h<<X.hash_shift^X.window[X.strstart+K-1])&X.hash_mask,De=X.prev[X.strstart&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=X.strstart;while(--X.match_length!==0);X.strstart++}else X.strstart+=X.match_length,X.match_length=0,X.ins_h=X.window[X.strstart],X.ins_h=(X.ins_h<<X.hash_shift^X.window[X.strstart+1])&X.hash_mask;else oe=D._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++;if(oe&&(ze(X,!1),X.strm.avail_out===0))return Ae}return X.insert=X.strstart<K-1?X.strstart:K-1,me===s?(ze(X,!0),X.strm.avail_out===0?pe:ue):X.last_lit&&(ze(X,!1),X.strm.avail_out===0)?Ae:re}function Ce(X,me){for(var De,oe,ve;;){if(X.lookahead<te){if($(X),X.lookahead<te&&me===u)return Ae;if(X.lookahead===0)break}if(De=0,X.lookahead>=K&&(X.ins_h=(X.ins_h<<X.hash_shift^X.window[X.strstart+K-1])&X.hash_mask,De=X.prev[X.strstart&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=X.strstart),X.prev_length=X.match_length,X.prev_match=X.match_start,X.match_length=K-1,De!==0&&X.prev_length<X.max_lazy_match&&X.strstart-De<=X.w_size-te&&(X.match_length=Se(X,De),X.match_length<=5&&(X.strategy===w||X.match_length===K&&X.strstart-X.match_start>4096)&&(X.match_length=K-1)),X.prev_length>=K&&X.match_length<=X.prev_length){ve=X.strstart+X.lookahead-K,oe=D._tr_tally(X,X.strstart-1-X.prev_match,X.prev_length-K),X.lookahead-=X.prev_length-1,X.prev_length-=2;do++X.strstart<=ve&&(X.ins_h=(X.ins_h<<X.hash_shift^X.window[X.strstart+K-1])&X.hash_mask,De=X.prev[X.strstart&X.w_mask]=X.head[X.ins_h],X.head[X.ins_h]=X.strstart);while(--X.prev_length!==0);if(X.match_available=0,X.match_length=K-1,X.strstart++,oe&&(ze(X,!1),X.strm.avail_out===0))return Ae}else if(X.match_available){if(oe=D._tr_tally(X,0,X.window[X.strstart-1]),oe&&ze(X,!1),X.strstart++,X.lookahead--,X.strm.avail_out===0)return Ae}else X.match_available=1,X.strstart++,X.lookahead--}return X.match_available&&(oe=D._tr_tally(X,0,X.window[X.strstart-1]),X.match_available=0),X.insert=X.strstart<K-1?X.strstart:K-1,me===s?(ze(X,!0),X.strm.avail_out===0?pe:ue):X.last_lit&&(ze(X,!1),X.strm.avail_out===0)?Ae:re}function We(X,me){for(var De,oe,ve,Be,tt=X.window;;){if(X.lookahead<=z){if($(X),X.lookahead<=z&&me===u)return Ae;if(X.lookahead===0)break}if(X.match_length=0,X.lookahead>=K&&X.strstart>0&&(ve=X.strstart-1,oe=tt[ve],oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve])){Be=X.strstart+z;do;while(oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&oe===tt[++ve]&&ve<Be);X.match_length=z-(Be-ve),X.match_length>X.lookahead&&(X.match_length=X.lookahead)}if(X.match_length>=K?(De=D._tr_tally(X,1,X.match_length-K),X.lookahead-=X.match_length,X.strstart+=X.match_length,X.match_length=0):(De=D._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++),De&&(ze(X,!1),X.strm.avail_out===0))return Ae}return X.insert=0,me===s?(ze(X,!0),X.strm.avail_out===0?pe:ue):X.last_lit&&(ze(X,!1),X.strm.avail_out===0)?Ae:re}function Ve(X,me){for(var De;;){if(X.lookahead===0&&($(X),X.lookahead===0)){if(me===u)return Ae;break}if(X.match_length=0,De=D._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++,De&&(ze(X,!1),X.strm.avail_out===0))return Ae}return X.insert=0,me===s?(ze(X,!0),X.strm.avail_out===0?pe:ue):X.last_lit&&(ze(X,!1),X.strm.avail_out===0)?Ae:re}function Pe(X,me,De,oe,ve){this.good_length=X,this.max_lazy=me,this.nice_length=De,this.max_chain=oe,this.func=ve}var Je;Je=[new Pe(0,0,0,0,fe),new Pe(4,4,8,4,J),new Pe(4,5,16,8,J),new Pe(4,6,32,32,J),new Pe(4,4,16,16,Ce),new Pe(8,16,32,32,Ce),new Pe(8,16,128,128,Ce),new Pe(8,32,128,256,Ce),new Pe(32,128,258,1024,Ce),new Pe(32,258,258,4096,Ce)];function ne(X){X.window_size=2*X.w_size,je(X.head),X.max_lazy_match=Je[X.level].max_lazy,X.good_match=Je[X.level].good_length,X.nice_match=Je[X.level].nice_length,X.max_chain_length=Je[X.level].max_chain,X.strstart=0,X.block_start=0,X.lookahead=0,X.insert=0,X.match_length=X.prev_length=K-1,X.match_available=0,X.ins_h=0}function be(){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=E,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 k.Buf16(W*2),this.dyn_dtree=new k.Buf16((2*H+1)*2),this.bl_tree=new k.Buf16((2*F+1)*2),je(this.dyn_ltree),je(this.dyn_dtree),je(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new k.Buf16(U+1),this.heap=new k.Buf16(2*B+1),je(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new k.Buf16(2*B+1),je(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 Re(X){var me;return!X||!X.state?Ke(X,a):(X.total_in=X.total_out=0,X.data_type=b,me=X.state,me.pending=0,me.pending_out=0,me.wrap<0&&(me.wrap=-me.wrap),me.status=me.wrap?ge:Fe,X.adler=me.wrap===2?0:1,me.last_flush=u,D._tr_init(me),r)}function le(X){var me=Re(X);return me===r&&ne(X.state),me}function se(X,me){return!X||!X.state||X.state.wrap!==2?a:(X.state.gzhead=me,r)}function he(X,me,De,oe,ve,Be){if(!X)return a;var tt=1;if(me===f&&(me=6),oe<0?(tt=0,oe=-oe):oe>15&&(tt=2,oe-=16),ve<1||ve>A||De!==E||oe<8||oe>15||me<0||me>9||Be<0||Be>C)return Ke(X,a);oe===8&&(oe=9);var Qe=new be;return X.state=Qe,Qe.strm=X,Qe.wrap=tt,Qe.gzhead=null,Qe.w_bits=oe,Qe.w_size=1<<Qe.w_bits,Qe.w_mask=Qe.w_size-1,Qe.hash_bits=ve+7,Qe.hash_size=1<<Qe.hash_bits,Qe.hash_mask=Qe.hash_size-1,Qe.hash_shift=~~((Qe.hash_bits+K-1)/K),Qe.window=new k.Buf8(Qe.w_size*2),Qe.head=new k.Buf16(Qe.hash_size),Qe.prev=new k.Buf16(Qe.w_size),Qe.lit_bufsize=1<<ve+6,Qe.pending_buf_size=Qe.lit_bufsize*4,Qe.pending_buf=new k.Buf8(Qe.pending_buf_size),Qe.d_buf=1*Qe.lit_bufsize,Qe.l_buf=(1+2)*Qe.lit_bufsize,Qe.level=me,Qe.strategy=Be,Qe.method=De,le(X)}function Y(X,me){return he(X,me,E,v,M,x)}function Z(X,me){var De,oe,ve,Be;if(!X||!X.state||me>l||me<0)return X?Ke(X,a):a;if(oe=X.state,!X.output||!X.input&&X.avail_in!==0||oe.status===ye&&me!==s)return Ke(X,X.avail_out===0?h:a);if(oe.strm=X,De=oe.last_flush,oe.last_flush=me,oe.status===ge)if(oe.wrap===2)X.adler=0,ke(oe,31),ke(oe,139),ke(oe,8),oe.gzhead?(ke(oe,(oe.gzhead.text?1:0)+(oe.gzhead.hcrc?2:0)+(oe.gzhead.extra?4:0)+(oe.gzhead.name?8:0)+(oe.gzhead.comment?16:0)),ke(oe,oe.gzhead.time&255),ke(oe,oe.gzhead.time>>8&255),ke(oe,oe.gzhead.time>>16&255),ke(oe,oe.gzhead.time>>24&255),ke(oe,oe.level===9?2:oe.strategy>=m||oe.level<2?4:0),ke(oe,oe.gzhead.os&255),oe.gzhead.extra&&oe.gzhead.extra.length&&(ke(oe,oe.gzhead.extra.length&255),ke(oe,oe.gzhead.extra.length>>8&255)),oe.gzhead.hcrc&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending,0)),oe.gzindex=0,oe.status=Ue):(ke(oe,0),ke(oe,0),ke(oe,0),ke(oe,0),ke(oe,0),ke(oe,oe.level===9?2:oe.strategy>=m||oe.level<2?4:0),ke(oe,Ie),oe.status=Fe);else{var tt=E+(oe.w_bits-8<<4)<<8,Qe=-1;oe.strategy>=m||oe.level<2?Qe=0:oe.level<6?Qe=1:oe.level===6?Qe=2:Qe=3,tt|=Qe<<6,oe.strstart!==0&&(tt|=de),tt+=31-tt%31,oe.status=Fe,xe(oe,tt),oe.strstart!==0&&(xe(oe,X.adler>>>16),xe(oe,X.adler&65535)),X.adler=1}if(oe.status===Ue)if(oe.gzhead.extra){for(ve=oe.pending;oe.gzindex<(oe.gzhead.extra.length&65535)&&!(oe.pending===oe.pending_buf_size&&(oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),Ge(X),ve=oe.pending,oe.pending===oe.pending_buf_size));)ke(oe,oe.gzhead.extra[oe.gzindex]&255),oe.gzindex++;oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),oe.gzindex===oe.gzhead.extra.length&&(oe.gzindex=0,oe.status=Me)}else oe.status=Me;if(oe.status===Me)if(oe.gzhead.name){ve=oe.pending;do{if(oe.pending===oe.pending_buf_size&&(oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),Ge(X),ve=oe.pending,oe.pending===oe.pending_buf_size)){Be=1;break}oe.gzindex<oe.gzhead.name.length?Be=oe.gzhead.name.charCodeAt(oe.gzindex++)&255:Be=0,ke(oe,Be)}while(Be!==0);oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),Be===0&&(oe.gzindex=0,oe.status=Le)}else oe.status=Le;if(oe.status===Le)if(oe.gzhead.comment){ve=oe.pending;do{if(oe.pending===oe.pending_buf_size&&(oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),Ge(X),ve=oe.pending,oe.pending===oe.pending_buf_size)){Be=1;break}oe.gzindex<oe.gzhead.comment.length?Be=oe.gzhead.comment.charCodeAt(oe.gzindex++)&255:Be=0,ke(oe,Be)}while(Be!==0);oe.gzhead.hcrc&&oe.pending>ve&&(X.adler=(0,O.default)(X.adler,oe.pending_buf,oe.pending-ve,ve)),Be===0&&(oe.status=Oe)}else oe.status=Oe;if(oe.status===Oe&&(oe.gzhead.hcrc?(oe.pending+2>oe.pending_buf_size&&Ge(X),oe.pending+2<=oe.pending_buf_size&&(ke(oe,X.adler&255),ke(oe,X.adler>>8&255),X.adler=0,oe.status=Fe)):oe.status=Fe),oe.pending!==0){if(Ge(X),X.avail_out===0)return oe.last_flush=-1,r}else if(X.avail_in===0&&Ne(me)<=Ne(De)&&me!==s)return Ke(X,h);if(oe.status===ye&&X.avail_in!==0)return Ke(X,h);if(X.avail_in!==0||oe.lookahead!==0||me!==u&&oe.status!==ye){var $e=oe.strategy===m?Ve(oe,me):oe.strategy===T?We(oe,me):Je[oe.level].func(oe,me);if(($e===pe||$e===ue)&&(oe.status=ye),$e===Ae||$e===pe)return X.avail_out===0&&(oe.last_flush=-1),r;if($e===re&&(me===o?D._tr_align(oe):me!==l&&(D._tr_stored_block(oe,0,0,!1),me===d&&(je(oe.head),oe.lookahead===0&&(oe.strstart=0,oe.block_start=0,oe.insert=0))),Ge(X),X.avail_out===0))return oe.last_flush=-1,r}return me!==s?r:oe.wrap<=0?n:(oe.wrap===2?(ke(oe,X.adler&255),ke(oe,X.adler>>8&255),ke(oe,X.adler>>16&255),ke(oe,X.adler>>24&255),ke(oe,X.total_in&255),ke(oe,X.total_in>>8&255),ke(oe,X.total_in>>16&255),ke(oe,X.total_in>>24&255)):(xe(oe,X.adler>>>16),xe(oe,X.adler&65535)),Ge(X),oe.wrap>0&&(oe.wrap=-oe.wrap),oe.pending!==0?r:n)}function G(X){var me;return!X||!X.state?a:(me=X.state.status,me!==ge&&me!==Ue&&me!==Me&&me!==Le&&me!==Oe&&me!==Fe&&me!==ye?Ke(X,a):(X.state=null,me===Fe?Ke(X,i):r))}function ae(X,me){var De=me.length,oe,ve,Be,tt,Qe,$e,st,mt;if(!X||!X.state)return a;if(oe=X.state,tt=oe.wrap,tt===2||tt===1&&oe.status!==ge||oe.lookahead)return a;for(tt===1&&(X.adler=(0,R.default)(X.adler,me,De,0)),oe.wrap=0,De>=oe.w_size&&(tt===0&&(je(oe.head),oe.strstart=0,oe.block_start=0,oe.insert=0),mt=new k.Buf8(oe.w_size),k.arraySet(mt,me,De-oe.w_size,oe.w_size,0),me=mt,De=oe.w_size),Qe=X.avail_in,$e=X.next_in,st=X.input,X.avail_in=De,X.next_in=0,X.input=me,$(oe);oe.lookahead>=K;){ve=oe.strstart,Be=oe.lookahead-(K-1);do oe.ins_h=(oe.ins_h<<oe.hash_shift^oe.window[ve+K-1])&oe.hash_mask,oe.prev[ve&oe.w_mask]=oe.head[oe.ins_h],oe.head[oe.ins_h]=ve,ve++;while(--Be);oe.strstart=ve,oe.lookahead=K-1,$(oe)}return oe.strstart+=oe.lookahead,oe.block_start=oe.strstart,oe.insert=oe.lookahead,oe.lookahead=0,oe.match_length=oe.prev_length=K-1,oe.match_available=0,X.next_in=$e,X.input=st,X.avail_in=Qe,oe.wrap=tt,r}var Te="pako deflate (from Nodeca project)";ce.deflateInfo=Te},lZu9:function(Ze,ce,ie){(function(j){j(ie("VrN/"),ie("1eCo"),ie("8EBN"))})(function(j){"use strict";j.defineMode("markdown",function(k,D){var R=j.getMode(k,"text/html"),O=R.name=="null";function c(U){if(j.findModeByName){var K=j.findModeByName(U);K&&(U=K.mime||K.mimes[0])}var z=j.getMode(k,U);return z.name=="null"?null:z}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 y in S)S.hasOwnProperty(y)&&D.tokenTypeOverrides[y]&&(S[y]=D.tokenTypeOverrides[y]);var p=/^([*\-_])(?:\s*\1){2,}\s*$/,u=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,o=/^\[(x| )\](?=\s)/i,d=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,s=/^ {0,3}(?:\={1,}|-{2,})\s*$/,l=/^[^#!\[\]*_\\<>` "'(~:]+/,r=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,n=/^\s*\[[^\]]+?\]:.*$/,a=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,i=" ";function h(U,K,z){return K.f=K.inline=z,z(U,K)}function f(U,K,z){return K.f=K.block=z,z(U,K)}function w(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==C){var K=O;if(!K){var z=j.innerMode(R,U.htmlState);K=z.mode.name=="xml"&&z.state.tagStart===null&&!z.state.context&&z.state.tokenize.isInText}K&&(U.f=A,U.block=T,U.htmlState=null)}return U.trailingSpace=0,U.trailingSpaceNewLine=!1,U.prevLine=U.thisLine,U.thisLine={stream:null},null}function T(U,K){var z=U.column()===K.indentation,te=w(K.prevLine.stream),de=K.indentedCode,ge=K.prevLine.hr,Ue=K.list!==!1,Me=(K.listStack[K.listStack.length-1]||0)+3;K.indentedCode=!1;var Le=K.indentation;if(K.indentationDiff===null&&(K.indentationDiff=K.indentation,Ue)){for(K.list=null;Le<K.listStack[K.listStack.length-1];)K.listStack.pop(),K.listStack.length?K.indentation=K.listStack[K.listStack.length-1]:K.list=!1;K.list!==!1&&(K.indentationDiff=Le-K.listStack[K.listStack.length-1])}var Oe=!te&&!ge&&!K.prevLine.header&&(!Ue||!de)&&!K.prevLine.fencedCodeEnd,Fe=(K.list===!1||ge||te)&&K.indentation<=Me&&U.match(p),ye=null;if(K.indentationDiff>=4&&(de||K.prevLine.fencedCodeEnd||K.prevLine.header||te))return U.skipToEnd(),K.indentedCode=!0,S.code;if(U.eatSpace())return null;if(z&&K.indentation<=Me&&(ye=U.match(d))&&ye[1].length<=6)return K.quote=0,K.header=ye[1].length,K.thisLine.header=!0,D.highlightFormatting&&(K.formatting="header"),K.f=K.inline,b(K);if(K.indentation<=Me&&U.eat(">"))return K.quote=z?1:K.quote+1,D.highlightFormatting&&(K.formatting="quote"),U.eatSpace(),b(K);if(!Fe&&!K.setext&&z&&K.indentation<=Me&&(ye=U.match(u))){var Ae=ye[1]?"ol":"ul";return K.indentation=Le+U.current().length,K.list=!0,K.quote=0,K.listStack.push(K.indentation),K.em=!1,K.strong=!1,K.code=!1,K.strikethrough=!1,D.taskLists&&U.match(o,!1)&&(K.taskList=!0),K.f=K.inline,D.highlightFormatting&&(K.formatting=["list","list-"+Ae]),b(K)}else{if(z&&K.indentation<=Me&&(ye=U.match(r,!0)))return K.quote=0,K.fencedEndRE=new RegExp(ye[1]+"+ *$"),K.localMode=D.fencedCodeBlockHighlighting&&c(ye[2]||D.fencedCodeBlockDefaultMode),K.localMode&&(K.localState=j.startState(K.localMode)),K.f=K.block=x,D.highlightFormatting&&(K.formatting="code-block"),K.code=-1,b(K);if(K.setext||(!Oe||!Ue)&&!K.quote&&K.list===!1&&!K.code&&!Fe&&!n.test(U.string)&&(ye=U.lookAhead(1))&&(ye=ye.match(s)))return K.setext?(K.header=K.setext,K.setext=0,U.skipToEnd(),D.highlightFormatting&&(K.formatting="header")):(K.header=ye[0].charAt(0)=="="?1:2,K.setext=K.header),K.thisLine.header=!0,K.f=K.inline,b(K);if(Fe)return U.skipToEnd(),K.hr=!0,K.thisLine.hr=!0,S.hr;if(U.peek()==="[")return h(U,K,B)}return h(U,K,K.inline)}function C(U,K){var z=R.token(U,K.htmlState);if(!O){var te=j.innerMode(R,K.htmlState);(te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText||K.md_inside&&U.current().indexOf(">")>-1)&&(K.f=A,K.block=T,K.htmlState=null)}return z}function x(U,K){var z=K.listStack[K.listStack.length-1]||0,te=K.indentation<z,de=z+3;if(K.fencedEndRE&&K.indentation<=de&&(te||U.match(K.fencedEndRE))){D.highlightFormatting&&(K.formatting="code-block");var ge;return te||(ge=b(K)),K.localMode=K.localState=null,K.block=T,K.f=A,K.fencedEndRE=null,K.code=0,K.thisLine.fencedCodeEnd=!0,te?f(U,K,K.block):ge}else return K.localMode?K.localMode.token(U,K.localState):(U.skipToEnd(),S.code)}function b(U){var K=[];if(U.formatting){K.push(S.formatting),typeof U.formatting=="string"&&(U.formatting=[U.formatting]);for(var z=0;z<U.formatting.length;z++)K.push(S.formatting+"-"+U.formatting[z]),U.formatting[z]==="header"&&K.push(S.formatting+"-"+U.formatting[z]+"-"+U.header),U.formatting[z]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?K.push(S.formatting+"-"+U.formatting[z]+"-"+U.quote):K.push("error"))}if(U.taskOpen)return K.push("meta"),K.length?K.join(" "):null;if(U.taskClosed)return K.push("property"),K.length?K.join(" "):null;if(U.linkHref?K.push(S.linkHref,"url"):(U.strong&&K.push(S.strong),U.em&&K.push(S.em),U.strikethrough&&K.push(S.strikethrough),U.emoji&&K.push(S.emoji),U.linkText&&K.push(S.linkText),U.code&&K.push(S.code),U.image&&K.push(S.image),U.imageAltText&&K.push(S.imageAltText,"link"),U.imageMarker&&K.push(S.imageMarker)),U.header&&K.push(S.header,S.header+"-"+U.header),U.quote&&(K.push(S.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=U.quote?K.push(S.quote+"-"+U.quote):K.push(S.quote+"-"+D.maxBlockquoteDepth)),U.list!==!1){var te=(U.listStack.length-1)%3;te?te===1?K.push(S.list2):K.push(S.list3):K.push(S.list1)}return U.trailingSpaceNewLine?K.push("trailing-space-new-line"):U.trailingSpace&&K.push("trailing-space-"+(U.trailingSpace%2?"a":"b")),K.length?K.join(" "):null}function E(U,K){return U.match(l,!0)?b(K):void 0}function A(U,K){var z=K.text(U,K);if(typeof z!="undefined")return z;if(K.list)return K.list=null,b(K);if(K.taskList){var te=U.match(o,!0)[1]===" ";return te?K.taskOpen=!0:K.taskClosed=!0,D.highlightFormatting&&(K.formatting="task"),K.taskList=!1,b(K)}if(K.taskOpen=!1,K.taskClosed=!1,K.header&&U.match(/^#+$/,!0))return D.highlightFormatting&&(K.formatting="header"),b(K);var de=U.next();if(K.linkTitle){K.linkTitle=!1;var ge=de;de==="("&&(ge=")"),ge=(ge+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ue="^\\s*(?:[^"+ge+"\\\\]+|\\\\\\\\|\\\\.)"+ge;if(U.match(new RegExp(Ue),!0))return S.linkHref}if(de==="`"){var Me=K.formatting;D.highlightFormatting&&(K.formatting="code"),U.eatWhile("`");var Le=U.current().length;if(K.code==0&&(!K.quote||Le==1))return K.code=Le,b(K);if(Le==K.code){var Oe=b(K);return K.code=0,Oe}else return K.formatting=Me,b(K)}else if(K.code)return b(K);if(de==="\\"&&(U.next(),D.highlightFormatting)){var Fe=b(K),ye=S.formatting+"-escape";return Fe?Fe+" "+ye:ye}if(de==="!"&&U.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return K.imageMarker=!0,K.image=!0,D.highlightFormatting&&(K.formatting="image"),b(K);if(de==="["&&K.imageMarker&&U.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return K.imageMarker=!1,K.imageAltText=!0,D.highlightFormatting&&(K.formatting="image"),b(K);if(de==="]"&&K.imageAltText){D.highlightFormatting&&(K.formatting="image");var Fe=b(K);return K.imageAltText=!1,K.image=!1,K.inline=K.f=M,Fe}if(de==="["&&!K.image)return K.linkText&&U.match(/^.*?\]/)||(K.linkText=!0,D.highlightFormatting&&(K.formatting="link")),b(K);if(de==="]"&&K.linkText){D.highlightFormatting&&(K.formatting="link");var Fe=b(K);return K.linkText=!1,K.inline=K.f=U.match(/\(.*?\)| ?\[.*?\]/,!1)?M:A,Fe}if(de==="<"&&U.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){K.f=K.inline=v,D.highlightFormatting&&(K.formatting="link");var Fe=b(K);return Fe?Fe+=" ":Fe="",Fe+S.linkInline}if(de==="<"&&U.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){K.f=K.inline=v,D.highlightFormatting&&(K.formatting="link");var Fe=b(K);return Fe?Fe+=" ":Fe="",Fe+S.linkEmail}if(D.xml&&de==="<"&&U.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var Ae=U.string.indexOf(">",U.pos);if(Ae!=-1){var re=U.string.substring(U.start,Ae);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(re)&&(K.md_inside=!0)}return U.backUp(1),K.htmlState=j.startState(R),f(U,K,C)}if(D.xml&&de==="<"&&U.match(/^\/\w*?>/))return K.md_inside=!1,"tag";if(de==="*"||de==="_"){for(var pe=1,ue=U.pos==1?" ":U.string.charAt(U.pos-2);pe<3&&U.eat(de);)pe++;var Ie=U.peek()||" ",Ke=!/\s/.test(Ie)&&(!a.test(Ie)||/\s/.test(ue)||a.test(ue)),Ne=!/\s/.test(ue)&&(!a.test(ue)||/\s/.test(Ie)||a.test(Ie)),je=null,Ge=null;if(pe%2&&(!K.em&&Ke&&(de==="*"||!Ne||a.test(ue))?je=!0:K.em==de&&Ne&&(de==="*"||!Ke||a.test(Ie))&&(je=!1)),pe>1&&(!K.strong&&Ke&&(de==="*"||!Ne||a.test(ue))?Ge=!0:K.strong==de&&Ne&&(de==="*"||!Ke||a.test(Ie))&&(Ge=!1)),Ge!=null||je!=null){D.highlightFormatting&&(K.formatting=je==null?"strong":Ge==null?"em":"strong em"),je===!0&&(K.em=de),Ge===!0&&(K.strong=de);var Oe=b(K);return je===!1&&(K.em=!1),Ge===!1&&(K.strong=!1),Oe}}else if(de===" "&&(U.eat("*")||U.eat("_"))){if(U.peek()===" ")return b(K);U.backUp(1)}if(D.strikethrough){if(de==="~"&&U.eatWhile(de)){if(K.strikethrough){D.highlightFormatting&&(K.formatting="strikethrough");var Oe=b(K);return K.strikethrough=!1,Oe}else if(U.match(/^[^\s]/,!1))return K.strikethrough=!0,D.highlightFormatting&&(K.formatting="strikethrough"),b(K)}else if(de===" "&&U.match(/^~~/,!0)){if(U.peek()===" ")return b(K);U.backUp(2)}}if(D.emoji&&de===":"&&U.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){K.emoji=!0,D.highlightFormatting&&(K.formatting="emoji");var ze=b(K);return K.emoji=!1,ze}return de===" "&&(U.match(/^ +$/,!1)?K.trailingSpace++:K.trailingSpace&&(K.trailingSpaceNewLine=!0)),b(K)}function v(U,K){var z=U.next();if(z===">"){K.f=K.inline=A,D.highlightFormatting&&(K.formatting="link");var te=b(K);return te?te+=" ":te="",te+S.linkInline}return U.match(/^[^>]+/,!0),S.linkInline}function M(U,K){if(U.eatSpace())return null;var z=U.next();return z==="("||z==="["?(K.f=K.inline=P(z==="("?")":"]"),D.highlightFormatting&&(K.formatting="link-string"),K.linkHref=!0,b(K)):"error"}var I={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function P(U){return function(K,z){var te=K.next();if(te===U){z.f=z.inline=A,D.highlightFormatting&&(z.formatting="link-string");var de=b(z);return z.linkHref=!1,de}return K.match(I[U]),z.linkHref=!0,b(z)}}function B(U,K){return U.match(/^([^\]\\]|\\.)*\]:/,!1)?(K.f=H,U.next(),D.highlightFormatting&&(K.formatting="link"),K.linkText=!0,b(K)):h(U,K,A)}function H(U,K){if(U.match(/^\]:/,!0)){K.f=K.inline=F,D.highlightFormatting&&(K.formatting="link");var z=b(K);return K.linkText=!1,z}return U.match(/^([^\]\\]|\\.)+/,!0),S.linkText}function F(U,K){return U.eatSpace()?null:(U.match(/^[^\s]+/,!0),U.peek()===void 0?K.linkTitle=!0:U.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),K.f=K.inline=A,S.linkHref+" url")}var W={startState:function(){return{f:T,prevLine:{stream:null},thisLine:{stream:null},block:T,htmlState:null,indentation:0,inline:A,text:E,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&&j.copyState(R,U.htmlState),indentation:U.indentation,localMode:U.localMode,localState:U.localMode?j.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,K){if(K.formatting=!1,U!=K.thisLine.stream){if(K.header=0,K.hr=!1,U.match(/^\s*$/,!0))return m(K),null;if(K.prevLine=K.thisLine,K.thisLine={stream:U},K.taskList=!1,K.trailingSpace=0,K.trailingSpaceNewLine=!1,!K.localState&&(K.f=K.block,K.f!=C)){var z=U.match(/^\s*/,!0)[0].replace(/\t/g,i).length;if(K.indentation=z,K.indentationDiff=null,z>0)return null}}return K.f(U,K)},innerMode:function(U){return U.block==C?{state:U.htmlState,mode:R}:U.localState?{state:U.localState,mode:U.localMode}:{state:U,mode:W}},indent:function(U,K,z){return U.block==C&&R.indent?R.indent(U.htmlState,K,z):U.localState&&U.localMode.indent?U.localMode.indent(U.localState,K,z):j.Pass},blankLine:m,getType:b,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),j.defineMIME("text/markdown","markdown"),j.defineMIME("text/x-markdown","markdown")})},mHUz:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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};ce.default=j},mTgk:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=k(ie("mHUz"));function k(y){return y&&y.__esModule?y:{default:y}}var D={};function R(y,p){if(p===void 0)throw new Error('Undefined keysym for key "'+y+'"');if(y in D)throw new Error('Duplicate entry for key "'+y+'"');D[y]=[p,p,p,p]}function O(y,p,u){if(p===void 0)throw new Error('Undefined keysym for key "'+y+'"');if(u===void 0)throw new Error('Undefined keysym for key "'+y+'"');if(y in D)throw new Error('Duplicate entry for key "'+y+'"');D[y]=[p,p,u,p]}function c(y,p,u){if(p===void 0)throw new Error('Undefined keysym for key "'+y+'"');if(u===void 0)throw new Error('Undefined keysym for key "'+y+'"');if(y in D)throw new Error('Duplicate entry for key "'+y+'"');D[y]=[p,p,p,u]}O("Alt",j.default.XK_Alt_L,j.default.XK_Alt_R),R("AltGraph",j.default.XK_ISO_Level3_Shift),R("CapsLock",j.default.XK_Caps_Lock),O("Control",j.default.XK_Control_L,j.default.XK_Control_R),O("Meta",j.default.XK_Super_L,j.default.XK_Super_R),R("NumLock",j.default.XK_Num_Lock),R("ScrollLock",j.default.XK_Scroll_Lock),O("Shift",j.default.XK_Shift_L,j.default.XK_Shift_R),c("Enter",j.default.XK_Return,j.default.XK_KP_Enter),R("Tab",j.default.XK_Tab),c(" ",j.default.XK_space,j.default.XK_KP_Space),c("ArrowDown",j.default.XK_Down,j.default.XK_KP_Down),c("ArrowUp",j.default.XK_Up,j.default.XK_KP_Up),c("ArrowLeft",j.default.XK_Left,j.default.XK_KP_Left),c("ArrowRight",j.default.XK_Right,j.default.XK_KP_Right),c("End",j.default.XK_End,j.default.XK_KP_End),c("Home",j.default.XK_Home,j.default.XK_KP_Home),c("PageDown",j.default.XK_Next,j.default.XK_KP_Next),c("PageUp",j.default.XK_Prior,j.default.XK_KP_Prior),R("Backspace",j.default.XK_BackSpace),c("Clear",j.default.XK_Clear,j.default.XK_KP_Begin),R("Copy",j.default.XF86XK_Copy),R("Cut",j.default.XF86XK_Cut),c("Delete",j.default.XK_Delete,j.default.XK_KP_Delete),c("Insert",j.default.XK_Insert,j.default.XK_KP_Insert),R("Paste",j.default.XF86XK_Paste),R("Redo",j.default.XK_Redo),R("Undo",j.default.XK_Undo),R("Cancel",j.default.XK_Cancel),R("ContextMenu",j.default.XK_Menu),R("Escape",j.default.XK_Escape),R("Execute",j.default.XK_Execute),R("Find",j.default.XK_Find),R("Help",j.default.XK_Help),R("Pause",j.default.XK_Pause),R("Select",j.default.XK_Select),R("ZoomIn",j.default.XF86XK_ZoomIn),R("ZoomOut",j.default.XF86XK_ZoomOut),R("BrightnessDown",j.default.XF86XK_MonBrightnessDown),R("BrightnessUp",j.default.XF86XK_MonBrightnessUp),R("Eject",j.default.XF86XK_Eject),R("LogOff",j.default.XF86XK_LogOff),R("Power",j.default.XF86XK_PowerOff),R("PowerOff",j.default.XF86XK_PowerDown),R("PrintScreen",j.default.XK_Print),R("Hibernate",j.default.XF86XK_Hibernate),R("Standby",j.default.XF86XK_Standby),R("WakeUp",j.default.XF86XK_WakeUp),R("AllCandidates",j.default.XK_MultipleCandidate),R("Alphanumeric",j.default.XK_Eisu_Shift),R("CodeInput",j.default.XK_Codeinput),R("Compose",j.default.XK_Multi_key),R("Convert",j.default.XK_Henkan),R("GroupFirst",j.default.XK_ISO_First_Group),R("GroupLast",j.default.XK_ISO_Last_Group),R("GroupNext",j.default.XK_ISO_Next_Group),R("GroupPrevious",j.default.XK_ISO_Prev_Group),R("NonConvert",j.default.XK_Muhenkan),R("PreviousCandidate",j.default.XK_PreviousCandidate),R("SingleCandidate",j.default.XK_SingleCandidate),R("HangulMode",j.default.XK_Hangul),R("HanjaMode",j.default.XK_Hangul_Hanja),R("JunjuaMode",j.default.XK_Hangul_Jeonja),R("Eisu",j.default.XK_Eisu_toggle),R("Hankaku",j.default.XK_Hankaku),R("Hiragana",j.default.XK_Hiragana),R("HiraganaKatakana",j.default.XK_Hiragana_Katakana),R("KanaMode",j.default.XK_Kana_Shift),R("KanjiMode",j.default.XK_Kanji),R("Katakana",j.default.XK_Katakana),R("Romaji",j.default.XK_Romaji),R("Zenkaku",j.default.XK_Zenkaku),R("ZenkakuHanaku",j.default.XK_Zenkaku_Hankaku),R("F1",j.default.XK_F1),R("F2",j.default.XK_F2),R("F3",j.default.XK_F3),R("F4",j.default.XK_F4),R("F5",j.default.XK_F5),R("F6",j.default.XK_F6),R("F7",j.default.XK_F7),R("F8",j.default.XK_F8),R("F9",j.default.XK_F9),R("F10",j.default.XK_F10),R("F11",j.default.XK_F11),R("F12",j.default.XK_F12),R("F13",j.default.XK_F13),R("F14",j.default.XK_F14),R("F15",j.default.XK_F15),R("F16",j.default.XK_F16),R("F17",j.default.XK_F17),R("F18",j.default.XK_F18),R("F19",j.default.XK_F19),R("F20",j.default.XK_F20),R("F21",j.default.XK_F21),R("F22",j.default.XK_F22),R("F23",j.default.XK_F23),R("F24",j.default.XK_F24),R("F25",j.default.XK_F25),R("F26",j.default.XK_F26),R("F27",j.default.XK_F27),R("F28",j.default.XK_F28),R("F29",j.default.XK_F29),R("F30",j.default.XK_F30),R("F31",j.default.XK_F31),R("F32",j.default.XK_F32),R("F33",j.default.XK_F33),R("F34",j.default.XK_F34),R("F35",j.default.XK_F35),R("Close",j.default.XF86XK_Close),R("MailForward",j.default.XF86XK_MailForward),R("MailReply",j.default.XF86XK_Reply),R("MailSend",j.default.XF86XK_Send),R("MediaFastForward",j.default.XF86XK_AudioForward),R("MediaPause",j.default.XF86XK_AudioPause),R("MediaPlay",j.default.XF86XK_AudioPlay),R("MediaRecord",j.default.XF86XK_AudioRecord),R("MediaRewind",j.default.XF86XK_AudioRewind),R("MediaStop",j.default.XF86XK_AudioStop),R("MediaTrackNext",j.default.XF86XK_AudioNext),R("MediaTrackPrevious",j.default.XF86XK_AudioPrev),R("New",j.default.XF86XK_New),R("Open",j.default.XF86XK_Open),R("Print",j.default.XK_Print),R("Save",j.default.XF86XK_Save),R("SpellCheck",j.default.XF86XK_Spell),R("AudioVolumeDown",j.default.XF86XK_AudioLowerVolume),R("AudioVolumeUp",j.default.XF86XK_AudioRaiseVolume),R("AudioVolumeMute",j.default.XF86XK_AudioMute),R("MicrophoneVolumeMute",j.default.XF86XK_AudioMicMute),R("LaunchApplication1",j.default.XF86XK_MyComputer),R("LaunchApplication2",j.default.XF86XK_Calculator),R("LaunchCalendar",j.default.XF86XK_Calendar),R("LaunchMail",j.default.XF86XK_Mail),R("LaunchMediaPlayer",j.default.XF86XK_AudioMedia),R("LaunchMusicPlayer",j.default.XF86XK_Music),R("LaunchPhone",j.default.XF86XK_Phone),R("LaunchScreenSaver",j.default.XF86XK_ScreenSaver),R("LaunchSpreadsheet",j.default.XF86XK_Excel),R("LaunchWebBrowser",j.default.XF86XK_WWW),R("LaunchWebCam",j.default.XF86XK_WebCam),R("LaunchWordProcessor",j.default.XF86XK_Word),R("BrowserBack",j.default.XF86XK_Back),R("BrowserFavorites",j.default.XF86XK_Favorites),R("BrowserForward",j.default.XF86XK_Forward),R("BrowserHome",j.default.XF86XK_HomePage),R("BrowserRefresh",j.default.XF86XK_Refresh),R("BrowserSearch",j.default.XF86XK_Search),R("BrowserStop",j.default.XF86XK_Stop),R("Dimmer",j.default.XF86XK_BrightnessAdjust),R("MediaAudioTrack",j.default.XF86XK_AudioCycleTrack),R("RandomToggle",j.default.XF86XK_AudioRandomPlay),R("SplitScreenToggle",j.default.XF86XK_SplitScreen),R("Subtitle",j.default.XF86XK_Subtitle),R("VideoModeNext",j.default.XF86XK_Next_VMode),c("=",j.default.XK_equal,j.default.XK_KP_Equal),c("+",j.default.XK_plus,j.default.XK_KP_Add),c("-",j.default.XK_minus,j.default.XK_KP_Subtract),c("*",j.default.XK_asterisk,j.default.XK_KP_Multiply),c("/",j.default.XK_slash,j.default.XK_KP_Divide),c(".",j.default.XK_period,j.default.XK_KP_Decimal),c(",",j.default.XK_comma,j.default.XK_KP_Separator),c("0",j.default.XK_0,j.default.XK_KP_0),c("1",j.default.XK_1,j.default.XK_KP_1),c("2",j.default.XK_2,j.default.XK_KP_2),c("3",j.default.XK_3,j.default.XK_KP_3),c("4",j.default.XK_4,j.default.XK_KP_4),c("5",j.default.XK_5,j.default.XK_KP_5),c("6",j.default.XK_6,j.default.XK_KP_6),c("7",j.default.XK_7,j.default.XK_KP_7),c("8",j.default.XK_8,j.default.XK_KP_8),c("9",j.default.XK_9,j.default.XK_KP_9);var S=D;ce.default=S},mdZa:function(Ze,ce,ie){"use strict";typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(k,D){"use strict";if(k==null)throw new TypeError("Cannot convert undefined or null to object");for(var R=Object(k),O=1;O<arguments.length;O++){var c=arguments[O];if(c!=null)for(var S in c)Object.prototype.hasOwnProperty.call(c,S)&&(R[S]=c[S])}return R},writable:!0,configurable:!0}),function(){function j(k,D){D=D||{bubbles:!1,cancelable:!1,detail:void 0};var R=document.createEvent("CustomEvent");return R.initCustomEvent(k,D.bubbles,D.cancelable,D.detail),R}j.prototype=window.Event.prototype,typeof window.CustomEvent!="function"&&(window.CustomEvent=j)}(),Number.isInteger=Number.isInteger||function(k){return typeof k=="number"&&isFinite(k)&&Math.floor(k)===k}},osHv:function(Ze,ce,ie){(function(j){j(ie("VrN/"))})(function(j){"use strict";var k=j.Pos;function D(a,i){return a.line-i.line||a.ch-i.ch}var R="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",O=R+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",c=new RegExp("<(/?)(["+R+"]["+O+"]*)","g");function S(a,i,h,f){this.line=i,this.ch=h,this.cm=a,this.text=a.getLine(i),this.min=f?Math.max(f.from,a.firstLine()):a.firstLine(),this.max=f?Math.min(f.to-1,a.lastLine()):a.lastLine()}function y(a,i){var h=a.cm.getTokenTypeAt(k(a.line,i));return h&&/\btag\b/.test(h)}function p(a){return a.line>=a.max?void 0:(a.ch=0,a.text=a.cm.getLine(++a.line),!0)}function u(a){return a.line<=a.min?void 0:(a.text=a.cm.getLine(--a.line),a.ch=a.text.length,!0)}function o(a){for(;;){var i=a.text.indexOf(">",a.ch);if(i==-1){if(p(a))continue;return}if(!y(a,i+1)){a.ch=i+1;continue}var h=a.text.lastIndexOf("/",i),f=h>-1&&!/\S/.test(a.text.slice(h+1,i));return a.ch=i+1,f?"selfClose":"regular"}}function d(a){for(;;){var i=a.ch?a.text.lastIndexOf("<",a.ch-1):-1;if(i==-1){if(u(a))continue;return}if(!y(a,i+1)){a.ch=i;continue}c.lastIndex=i,a.ch=i;var h=c.exec(a.text);if(h&&h.index==i)return h}}function s(a){for(;;){c.lastIndex=a.ch;var i=c.exec(a.text);if(!i){if(p(a))continue;return}if(!y(a,i.index+1)){a.ch=i.index+1;continue}return a.ch=i.index+i[0].length,i}}function l(a){for(;;){var i=a.ch?a.text.lastIndexOf(">",a.ch-1):-1;if(i==-1){if(u(a))continue;return}if(!y(a,i+1)){a.ch=i;continue}var h=a.text.lastIndexOf("/",i),f=h>-1&&!/\S/.test(a.text.slice(h+1,i));return a.ch=i+1,f?"selfClose":"regular"}}function r(a,i){for(var h=[];;){var f=s(a),w,m=a.line,T=a.ch-(f?f[0].length:0);if(!f||!(w=o(a)))return;if(w=="selfClose")continue;if(f[1]){for(var C=h.length-1;C>=0;--C)if(h[C]==f[2]){h.length=C;break}if(C<0&&(!i||i==f[2]))return{tag:f[2],from:k(m,T),to:k(a.line,a.ch)}}else h.push(f[2])}}function n(a,i){for(var h=[];;){var f=l(a);if(!f)return;if(f=="selfClose"){d(a);continue}var w=a.line,m=a.ch,T=d(a);if(!T)return;if(T[1])h.push(T[2]);else{for(var C=h.length-1;C>=0;--C)if(h[C]==T[2]){h.length=C;break}if(C<0&&(!i||i==T[2]))return{tag:T[2],from:k(a.line,a.ch),to:k(w,m)}}}}j.registerHelper("fold","xml",function(a,i){for(var h=new S(a,i.line,0);;){var f=s(h);if(!f||h.line!=i.line)return;var w=o(h);if(!w)return;if(!f[1]&&w!="selfClose"){var m=k(h.line,h.ch),T=r(h,f[2]);return T&&D(T.from,m)>0?{from:m,to:T.from}:null}}}),j.findMatchingTag=function(a,i,h){var f=new S(a,i.line,i.ch,h);if(f.text.indexOf(">")==-1&&f.text.indexOf("<")==-1)return;var w=o(f),m=w&&k(f.line,f.ch),T=w&&d(f);if(!w||!T||D(f,i)>0)return;var C={from:k(f.line,f.ch),to:m,tag:T[2]};return w=="selfClose"?{open:C,close:null,at:"open"}:T[1]?{open:n(f,T[2]),close:C,at:"close"}:(f=new S(a,m.line,m.ch,h),{open:C,close:r(f,T[2]),at:"open"})},j.findEnclosingTag=function(a,i,h,f){for(var w=new S(a,i.line,i.ch,h);;){var m=n(w,f);if(!m)break;var T=new S(a,i.line,i.ch,h),C=r(T,m.tag);if(C)return{open:m,close:C}}},j.scanForClosingTag=function(a,i,h,f){var w=new S(a,i.line,i.ch,f?{from:0,to:f}:null);return r(w,h)}})},p5ED:function(Ze,ce,ie){"use strict";var j=ie("+L6B"),k=ie("2/Rp"),D=ie("5Dmo"),R=ie("3S7+"),O=ie("k1fw"),c=ie("tJVT"),S=ie("q1tI"),y=ie.n(S),p=ie("vHTk"),u=ie.n(p),o=ie("yEEn"),d=ie("ZW9T"),s=ie("1vsH");ce.a=function(l){var r=l.name,n=l.data,a=l.theme,i=l.type,h=l.filename,f=l.monacoEditor,w=l.className,m=l.style,T=l.close,C=l.onClose,x=l.hasMask,b=Object(S.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),E=Object(c.a)(b,2),A=E[0],v=E[1],M=Object(S.useState)(""),I=Object(c.a)(M,2),P=I[0],B=I[1],H=Object(S.useRef)();h&&(f.filename=h),Object(S.useEffect)(function(){var U,K,z=(U=document.cookie)===null||U===void 0||((K=U.replace(/\s/g,""))===null||K===void 0)?void 0:K.split(";");z==null||z.map(function(te){var de=te.split("=");de[0]==="_educoder_session"&&B(de[1])})},[]);var F=function(){if(n.startsWith("http")||n.startsWith("/")){W();return}Object(s.x)(h||"educoder",n,h)},W=function(){Object(s.v)(h||r,n)};return y.a.createElement("div",{style:Object(O.a)({},m||{}),className:"".concat(x&&u.a.bgBlack," ").concat(i?u.a.wrp:"hide")},T&&y.a.createElement("div",{className:u.a.close,ref:H},y.a.createElement(R.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return H.current}},y.a.createElement("span",{onClick:W},y.a.createElement("i",{className:"icon-quxiaozhiding"}))),y.a.createElement(R.a,{title:"\u5173\u95ED",getPopupContainer:function(){return H.current}},y.a.createElement("span",{className:"",onClick:C},y.a.createElement("i",{className:"icon-guanbi1"})))),y.a.createElement("div",{className:"".concat(u.a[w]," ").concat(w," ").concat(u.a.monaco," ").concat(i==="txt"?"show":"hide")},i==="txt"&&y.a.createElement(d.b,f)),i==="audio"&&y.a.createElement("audio",{src:"".concat(n!=null&&n.startsWith("/")||(n==null?void 0:n.indexOf("https://"))>-1?n:"data:audio/mp3;base64,").concat(n),autoPlay:!0}),i==="video"&&y.a.createElement(y.a.Fragment,null,n!=null&&n.startsWith("/")?y.a.createElement("video",{controls:!0,src:"".concat(n),autoPlay:!0}):y.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(n),autoPlay:!0})),i==="pdf"&&y.a.createElement("embed",{className:u.a.embed,src:n}),i==="image"&&y.a.createElement(y.a.Fragment,null,y.a.createElement("img",{src:"".concat(n!=null&&n.startsWith("/")||(n==null?void 0:n.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(n)})),i==="other"&&y.a.createElement("div",null,y.a.createElement(k.a,{type:"primary",size:"large",onClick:F},y.a.createElement(o.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(i==="download"||i==="office")&&y.a.createElement(k.a,{type:"primary",size:"large",onClick:F},y.a.createElement(o.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(Ze,ce,ie){},q7KB:function(Ze,ce,ie){},"rAM+":function(Ze,ce,ie){"use strict";ie.d(ce,"a",function(){return k});var j=ie("Qw5x");function k(D,R){var O;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(O=Object(j.a)(D))||R&&D&&typeof D.length=="number"){O&&(D=O);var c=0,S=function(){};return{s:S,n:function(){return c>=D.length?{done:!0}:{done:!1,value:D[c++]}},e:function(d){throw d},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 y=!0,p=!1,u;return{s:function(){O=D[Symbol.iterator]()},n:function(){var d=O.next();return y=d.done,d},e:function(d){p=!0,u=d},f:function(){try{!y&&O.return!=null&&O.return()}finally{if(p)throw u}}}}},rUJ1:function(Ze,ce){const ie=/[&<>"']/,j=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,R={"&":"&","<":"<",">":">",'"':""","'":"'"},O=x=>R[x];function c(x,b){if(b){if(ie.test(x))return x.replace(j,O)}else if(k.test(x))return x.replace(D,O);return x}const S=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function y(x){return x.replace(S,(b,E)=>(E=E.toLowerCase(),E==="colon"?":":E.charAt(0)==="#"?E.charAt(1)==="x"?String.fromCharCode(parseInt(E.substring(2),16)):String.fromCharCode(+E.substring(1)):""))}const p=/(^|[^\[])\^/g;function u(x,b){x=x.source||x,b=b||"";const E={replace:(A,v)=>(v=v.source||v,v=v.replace(p,"$1"),x=x.replace(A,v),E),getRegex:()=>new RegExp(x,b)};return E}const o=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function s(x,b,E){if(x){let A;try{A=decodeURIComponent(y(E)).replace(o,"").toLowerCase()}catch(v){return null}if(A.indexOf("javascript:")===0||A.indexOf("vbscript:")===0||A.indexOf("data:")===0)return null}b&&!d.test(E)&&(E=i(b,E));try{E=encodeURI(E).replace(/%25/g,"%")}catch(A){return null}return E}const l={},r=/^[^:]+:\/*[^/]*$/,n=/^([^:]+:)[\s\S]*$/,a=/^([^:]+:\/*[^/]*)[\s\S]*$/;function i(x,b){l[" "+x]||(r.test(x)?l[" "+x]=x+"/":l[" "+x]=m(x,"/",!0)),x=l[" "+x];const E=x.indexOf(":")===-1;return b.substring(0,2)==="//"?E?b:x.replace(n,"$1")+b:b.charAt(0)==="/"?E?b:x.replace(a,"$1")+b:x+b}const h={exec:function(){}};function f(x){let b=1,E,A;for(;b<arguments.length;b++){E=arguments[b];for(A in E)Object.prototype.hasOwnProperty.call(E,A)&&(x[A]=E[A])}return x}function w(x,b){const E=x.replace(/\|/g,(M,I,P)=>{let B=!1,H=I;for(;--H>=0&&P[H]==="\\";)B=!B;return B?"|":" |"}),A=E.split(/ \|/);let v=0;if(A.length>b)A.splice(b);else for(;A.length<b;)A.push("");for(;v<A.length;v++)A[v]=A[v].trim().replace(/\\\|/g,"|");return A}function m(x,b,E){const A=x.length;if(A===0)return"";let v=0;for(;v<A;){const M=x.charAt(A-v-1);if(M===b&&!E)v++;else if(M!==b&&E)v++;else break}return x.substr(0,A-v)}function T(x,b){if(x.indexOf(b[1])===-1)return-1;const E=x.length;let A=0,v=0;for(;v<E;v++)if(x[v]==="\\")v++;else if(x[v]===b[0])A++;else if(x[v]===b[1]&&(A--,A<0))return v;return-1}function C(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")}Ze.exports={escape:c,unescape:y,edit:u,cleanUrl:s,resolveUrl:i,noopTest:h,merge:f,splitCells:w,rtrim:m,findClosingBracket:T,checkSanitizeDeprecation:C}},rwxt:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=ie("GdRQ");function k(S,y){if(!(S instanceof y))throw new TypeError("Cannot call a class as a function")}function D(S,y){for(var p=0;p<y.length;p++){var u=y[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(S,u.key,u)}}function R(S,y,p){return y&&D(S.prototype,y),p&&D(S,p),S}var O=!j.supportsCursorURIs||j.isTouchDevice,c=function(){function S(){k(this,S),this._target=null,this._canvas=document.createElement("canvas"),O&&(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 R(S,[{key:"attach",value:function(p){if(this._target&&this.detach(),this._target=p,O){document.body.appendChild(this._canvas);var u={capture:!0,passive:!0};this._target.addEventListener("mouseover",this._eventHandlers.mouseover,u),this._target.addEventListener("mouseleave",this._eventHandlers.mouseleave,u),this._target.addEventListener("mousemove",this._eventHandlers.mousemove,u),this._target.addEventListener("mouseup",this._eventHandlers.mouseup,u)}this.clear()}},{key:"detach",value:function(){if(!this._target)return;if(O){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,u,o,d,s){if(d===0||s===0){this.clear();return}this._position.x=this._position.x+this._hotSpot.x-u,this._position.y=this._position.y+this._hotSpot.y-o,this._hotSpot.x=u,this._hotSpot.y=o;var l=this._canvas.getContext("2d");this._canvas.width=d,this._canvas.height=s;var r;try{r=new ImageData(new Uint8ClampedArray(p),d,s)}catch(a){r=l.createImageData(d,s),r.data.set(new Uint8ClampedArray(p))}if(l.clearRect(0,0,d,s),l.putImageData(r,0,0),O)this._updatePosition();else{var n=this._canvas.toDataURL();this._target.style.cursor="url("+n+")"+u+" "+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,u){if(!O)return;window.visualViewport?(this._position.x=p+window.visualViewport.offsetLeft,this._position.y=u+window.visualViewport.offsetTop):(this._position.x=p,this._position.y=u),this._updatePosition();var o=document.elementFromPoint(p,u);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 u=this,o=document.elementFromPoint(p.clientX,p.clientY);this._updateVisibility(o),this._captureIsActive()&&window.setTimeout(function(){if(!u._target)return;o=document.elementFromPoint(p.clientX,p.clientY),u._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}();ce.default=c},sjKO:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=D;var j=30,k=12;function D(R,O){var c,S,y,p,u,o,d,s,l,r,n,a,i,h,f,w,m,T,C,x,b,E,A,v,M;c=R.state,S=R.next_in,v=R.input,y=S+(R.avail_in-5),p=R.next_out,M=R.output,u=p-(O-R.avail_out),o=p+(R.avail_out-257),d=c.dmax,s=c.wsize,l=c.whave,r=c.wnext,n=c.window,a=c.hold,i=c.bits,h=c.lencode,f=c.distcode,w=(1<<c.lenbits)-1,m=(1<<c.distbits)-1;e:do{i<15&&(a+=v[S++]<<i,i+=8,a+=v[S++]<<i,i+=8),T=h[a&w];t:for(;;){if(C=T>>>24,a>>>=C,i-=C,C=T>>>16&255,C===0)M[p++]=T&65535;else if(C&16){x=T&65535,C&=15,C&&(i<C&&(a+=v[S++]<<i,i+=8),x+=a&(1<<C)-1,a>>>=C,i-=C),i<15&&(a+=v[S++]<<i,i+=8,a+=v[S++]<<i,i+=8),T=f[a&m];r:for(;;){if(C=T>>>24,a>>>=C,i-=C,C=T>>>16&255,C&16){if(b=T&65535,C&=15,i<C&&(a+=v[S++]<<i,i+=8,i<C&&(a+=v[S++]<<i,i+=8)),b+=a&(1<<C)-1,b>d){R.msg="invalid distance too far back",c.mode=j;break e}if(a>>>=C,i-=C,C=p-u,b>C){if(C=b-C,C>l&&c.sane){R.msg="invalid distance too far back",c.mode=j;break e}if(E=0,A=n,r===0){if(E+=s-C,C<x){x-=C;do M[p++]=n[E++];while(--C);E=p-b,A=M}}else if(r<C){if(E+=s+r-C,C-=r,C<x){x-=C;do M[p++]=n[E++];while(--C);if(E=0,r<x){C=r,x-=C;do M[p++]=n[E++];while(--C);E=p-b,A=M}}}else if(E+=r-C,C<x){x-=C;do M[p++]=n[E++];while(--C);E=p-b,A=M}for(;x>2;)M[p++]=A[E++],M[p++]=A[E++],M[p++]=A[E++],x-=3;x&&(M[p++]=A[E++],x>1&&(M[p++]=A[E++]))}else{E=p-b;do M[p++]=M[E++],M[p++]=M[E++],M[p++]=M[E++],x-=3;while(x>2);x&&(M[p++]=M[E++],x>1&&(M[p++]=M[E++]))}}else if((C&64)===0){T=f[(T&65535)+(a&(1<<C)-1)];continue r}else{R.msg="invalid distance code",c.mode=j;break e}break}}else if((C&64)===0){T=h[(T&65535)+(a&(1<<C)-1)];continue t}else if(C&32){c.mode=k;break e}else{R.msg="invalid literal/length code",c.mode=j;break e}break}}while(S<y&&p<o);x=i>>3,S-=x,i-=x<<3,a&=(1<<i)-1,R.next_in=S,R.next_out=p,R.avail_in=S<y?5+(y-S):5-(S-y),R.avail_out=p<o?257+(o-p):257-(p-o),c.hold=a,c.bits=i;return}},ulZh:function(Ze,ce,ie){typeof window!="undefined"&&function(k,D){Ze.exports=D()}(this,function(){return function(j){var k={};function D(R){if(k[R])return k[R].exports;var O=k[R]={i:R,l:!1,exports:{}};return j[R].call(O.exports,O,O.exports,D),O.l=!0,O.exports}return D.m=j,D.c=k,D.d=function(R,O,c){D.o(R,O)||Object.defineProperty(R,O,{enumerable:!0,get:c})},D.r=function(R){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(R,"__esModule",{value:!0})},D.t=function(R,O){if(O&1&&(R=D(R)),O&8)return R;if(O&4&&typeof R=="object"&&R&&R.__esModule)return R;var c=Object.create(null);if(D.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:R}),O&2&&typeof R!="string")for(var S in R)D.d(c,S,function(y){return R[y]}.bind(null,S));return c},D.n=function(R){var O=R&&R.__esModule?function(){return R.default}:function(){return R};return D.d(O,"a",O),O},D.o=function(R,O){return Object.prototype.hasOwnProperty.call(R,O)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(j,k,D){"use strict";var R=Object.prototype.hasOwnProperty,O="~";function c(){}Object.create&&(c.prototype=Object.create(null),new c().__proto__||(O=!1));function S(o,d,s){this.fn=o,this.context=d,this.once=s||!1}function y(o,d,s,l,r){if(typeof s!="function")throw new TypeError("The listener must be a function");var n=new S(s,l||o,r),a=O?O+d:d;return o._events[a]?o._events[a].fn?o._events[a]=[o._events[a],n]:o._events[a].push(n):(o._events[a]=n,o._eventsCount++),o}function p(o,d){--o._eventsCount===0?o._events=new c:delete o._events[d]}function u(){this._events=new c,this._eventsCount=0}u.prototype.eventNames=function(){var d=[],s,l;if(this._eventsCount===0)return d;for(l in s=this._events)R.call(s,l)&&d.push(O?l.slice(1):l);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(s)):d},u.prototype.listeners=function(d){var s=O?O+d:d,l=this._events[s];if(!l)return[];if(l.fn)return[l.fn];for(var r=0,n=l.length,a=new Array(n);r<n;r++)a[r]=l[r].fn;return a},u.prototype.listenerCount=function(d){var s=O?O+d:d,l=this._events[s];return l?l.fn?1:l.length:0},u.prototype.emit=function(d,s,l,r,n,a){var i=O?O+d:d;if(!this._events[i])return!1;var h=this._events[i],f=arguments.length,w,m;if(h.fn){h.once&&this.removeListener(d,h.fn,void 0,!0);switch(f){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,r),!0;case 5:return h.fn.call(h.context,s,l,r,n),!0;case 6:return h.fn.call(h.context,s,l,r,n,a),!0}for(m=1,w=new Array(f-1);m<f;m++)w[m-1]=arguments[m];h.fn.apply(h.context,w)}else{var T=h.length,C;for(m=0;m<T;m++){h[m].once&&this.removeListener(d,h[m].fn,void 0,!0);switch(f){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,r);break;default:if(!w)for(C=1,w=new Array(f-1);C<f;C++)w[C-1]=arguments[C];h[m].fn.apply(h[m].context,w)}}}return!0},u.prototype.on=function(d,s,l){return y(this,d,s,l,!1)},u.prototype.once=function(d,s,l){return y(this,d,s,l,!0)},u.prototype.removeListener=function(d,s,l,r){var n=O?O+d:d;if(!this._events[n])return this;if(!s)return p(this,n),this;var a=this._events[n];if(a.fn)a.fn===s&&(!r||a.once)&&(!l||a.context===l)&&p(this,n);else{for(var i=0,h=[],f=a.length;i<f;i++)(a[i].fn!==s||r&&!a[i].once||l&&a[i].context!==l)&&h.push(a[i]);h.length?this._events[n]=h.length===1?h[0]:h:p(this,n)}return this},u.prototype.removeAllListeners=function(d){var s;return d?(s=O?O+d:d,this._events[s]&&p(this,s)):(this._events=new c,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=O,u.EventEmitter=u,j.exports=u},"./node_modules/url-toolkit/src/url-toolkit.js":function(j,k,D){(function(R){var O=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,c=/^([^\/?#]*)([^]*)$/,S=/(?:\/|^)\.(?=\/)/g,y=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,p={buildAbsoluteURL:function(u,o,d){if(d=d||{},u=u.trim(),o=o.trim(),!o){if(!d.alwaysNormalize)return u;var s=p.parseURL(u);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 d.alwaysNormalize?(l.path=p.normalizePath(l.path),p.buildURLFromParts(l)):o;var r=p.parseURL(u);if(!r)throw new Error("Error trying to parse base URL.");if(!r.netLoc&&r.path&&r.path[0]!=="/"){var n=c.exec(r.path);r.netLoc=n[1],r.path=n[2]}r.netLoc&&!r.path&&(r.path="/");var a={scheme:r.scheme,netLoc:l.netLoc,path:null,params:l.params,query:l.query,fragment:l.fragment};if(!l.netLoc&&(a.netLoc=r.netLoc,l.path[0]!=="/"))if(!l.path)a.path=r.path,l.params||(a.params=r.params,l.query||(a.query=r.query));else{var i=r.path,h=i.substring(0,i.lastIndexOf("/")+1)+l.path;a.path=p.normalizePath(h)}return a.path===null&&(a.path=d.alwaysNormalize?p.normalizePath(l.path):l.path),p.buildURLFromParts(a)},parseURL:function(u){var o=O.exec(u);return o?{scheme:o[1]||"",netLoc:o[2]||"",path:o[3]||"",params:o[4]||"",query:o[5]||"",fragment:o[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(S,"");u.length!==(u=u.replace(y,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}};j.exports=p})(this)},"./node_modules/webworkify-webpack/index.js":function(j,k,D){function R(d){var s={};function l(n){if(s[n])return s[n].exports;var a=s[n]={i:n,l:!1,exports:{}};return d[n].call(a.exports,a,a.exports,l),a.l=!0,a.exports}l.m=d,l.c=s,l.i=function(n){return n},l.d=function(n,a,i){l.o(n,a)||Object.defineProperty(n,a,{configurable:!1,enumerable:!0,get:i})},l.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},l.n=function(n){var a=n&&n.__esModule?function(){return n.default}:function(){return n};return l.d(a,"a",a),a},l.o=function(n,a){return Object.prototype.hasOwnProperty.call(n,a)},l.p="/",l.oe=function(n){throw console.error(n),n};var r=l(l.s=ENTRY_MODULE);return r.default||r}var O="[\\.|\\-|\\+|\\w|/|@]+",c="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+O+").*?\\)";function S(d){return(d+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function y(d){return!isNaN(1*d)}function p(d,s,l){var r={};r[l]=[];var n=s.toString(),a=n.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!a)return r;for(var i=a[1],h=new RegExp("(\\\\n|\\W)"+S(i)+c,"g"),f;f=h.exec(n);){if(f[3]==="dll-reference")continue;r[l].push(f[3])}for(h=new RegExp("\\("+S(i)+'\\("(dll-reference\\s('+O+'))"\\)\\)'+c,"g");f=h.exec(n);)d[f[2]]||(r[l].push(f[1]),d[f[2]]=D(f[1]).m),r[f[2]]=r[f[2]]||[],r[f[2]].push(f[4]);for(var w=Object.keys(r),m=0;m<w.length;m++)for(var T=0;T<r[w[m]].length;T++)y(r[w[m]][T])&&(r[w[m]][T]=1*r[w[m]][T]);return r}function u(d){var s=Object.keys(d);return s.reduce(function(l,r){return l||d[r].length>0},!1)}function o(d,s){for(var l={main:[s]},r={main:[]},n={main:{}};u(l);)for(var a=Object.keys(l),i=0;i<a.length;i++){var h=a[i],f=l[h],w=f.pop();if(n[h]=n[h]||{},n[h][w]||!d[h][w])continue;n[h][w]=!0,r[h]=r[h]||[],r[h].push(w);for(var m=p(d,d[h][w],h),T=Object.keys(m),C=0;C<T.length;C++)l[T[C]]=l[T[C]]||[],l[T[C]]=l[T[C]].concat(m[T[C]])}return r}j.exports=function(d,s){s=s||{};var l={main:D.m},r=s.all?{main:Object.keys(l.main)}:o(l,d),n="";Object.keys(r).filter(function(w){return w!=="main"}).forEach(function(w){for(var m=0;r[w][m];)m++;r[w].push(m),l[w][m]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",n=n+"var "+w+" = ("+R.toString().replace("ENTRY_MODULE",JSON.stringify(m))+")({"+r[w].map(function(T){return""+JSON.stringify(T)+": "+l[w][T].toString()}).join(",")+`});
|
|
|
`}),n=n+"new (("+R.toString().replace("ENTRY_MODULE",JSON.stringify(d))+")({"+r.main.map(function(w){return""+JSON.stringify(w)+": "+l.main[w].toString()}).join(",")+"}))(self);";var a=new window.Blob([n],{type:"text/javascript"});if(s.bare)return a;var i=window.URL||window.webkitURL||window.mozURL||window.msURL,h=i.createObjectURL(a),f=new window.Worker(h);return f.objectURL=h,f}},"./src/config.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"hlsDefaultConfig",function(){return C}),D.d(k,"mergeConfig",function(){return b}),D.d(k,"enableStreamingMode",function(){return E});var R=D("./src/controller/abr-controller.ts"),O=D("./src/controller/audio-stream-controller.ts"),c=D("./src/controller/audio-track-controller.ts"),S=D("./src/controller/subtitle-stream-controller.ts"),y=D("./src/controller/subtitle-track-controller.ts"),p=D("./src/controller/buffer-controller.ts"),u=D("./src/controller/timeline-controller.ts"),o=D("./src/controller/cap-level-controller.ts"),d=D("./src/controller/fps-controller.ts"),s=D("./src/controller/eme-controller.ts"),l=D("./src/controller/cmcd-controller.ts"),r=D("./src/utils/xhr-loader.ts"),n=D("./src/utils/fetch-loader.ts"),a=D("./src/utils/cues.ts"),i=D("./src/utils/mediakeys-helper.ts"),h=D("./src/utils/logger.ts");function f(){return f=Object.assign||function(A){for(var v=1;v<arguments.length;v++){var M=arguments[v];for(var I in M)Object.prototype.hasOwnProperty.call(M,I)&&(A[I]=M[I])}return A},f.apply(this,arguments)}function w(A,v){var M=Object.keys(A);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(A);v&&(I=I.filter(function(P){return Object.getOwnPropertyDescriptor(A,P).enumerable})),M.push.apply(M,I)}return M}function m(A){for(var v=1;v<arguments.length;v++){var M=arguments[v]!=null?arguments[v]:{};v%2?w(Object(M),!0).forEach(function(I){T(A,I,M[I])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(M)):w(Object(M)).forEach(function(I){Object.defineProperty(A,I,Object.getOwnPropertyDescriptor(M,I))})}return A}function T(A,v,M){return v in A?Object.defineProperty(A,v,{value:M,enumerable:!0,configurable:!0,writable:!0}):A[v]=M,A}var C=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:r.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:R.default,bufferController:p.default,capLevelController:o.default,fpsController:d.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:i.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:S.SubtitleStreamController,subtitleTrackController:y.default,timelineController:u.TimelineController,audioStreamController:O.default,audioTrackController:c.default,emeController:s.default,cmcdController:l.default});function x(){return{cueHandler:a.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 b(A,v){if((v.liveSyncDurationCount||v.liveMaxLatencyDurationCount)&&(v.liveSyncDuration||v.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(v.liveMaxLatencyDurationCount!==void 0&&(v.liveSyncDurationCount===void 0||v.liveMaxLatencyDurationCount<=v.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(v.liveMaxLatencyDuration!==void 0&&(v.liveSyncDuration===void 0||v.liveMaxLatencyDuration<=v.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return f({},A,v)}function E(A){var v=A.loader;if(v!==n.default&&v!==r.default)h.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),A.progressive=!1;else{var M=Object(n.fetchSupported)();M&&(A.loader=n.default,A.progressive=!0,A.enableSoftwareAES=!0,h.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/polyfills/number.ts"),O=D("./src/utils/ewma-bandwidth-estimator.ts"),c=D("./src/events.ts"),S=D("./src/utils/buffer-helper.ts"),y=D("./src/errors.ts"),p=D("./src/types/loader.ts"),u=D("./src/utils/logger.ts");function o(l,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function d(l,r,n){return r&&o(l.prototype,r),n&&o(l,n),l}var s=function(){function l(n){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=n;var a=n.config;this.bwEstimator=new O.default(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate),this.registerListeners()}var r=l.prototype;return r.registerListeners=function(){var a=this.hls;a.on(c.Events.FRAG_LOADING,this.onFragLoading,this),a.on(c.Events.FRAG_LOADED,this.onFragLoaded,this),a.on(c.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.on(c.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.on(c.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var a=this.hls;a.off(c.Events.FRAG_LOADING,this.onFragLoading,this),a.off(c.Events.FRAG_LOADED,this.onFragLoaded,this),a.off(c.Events.FRAG_BUFFERED,this.onFragBuffered,this),a.off(c.Events.LEVEL_LOADED,this.onLevelLoaded,this),a.off(c.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},r.onFragLoading=function(a,i){var h=i.frag;if(h.type===p.PlaylistLevelType.MAIN&&!this.timer){var f;this.fragCurrent=h,this.partCurrent=(f=i.part)!=null?f:null,this.timer=self.setInterval(this.onCheck,100)}},r.onLevelLoaded=function(a,i){var h=this.hls.config;i.details.live?this.bwEstimator.update(h.abrEwmaSlowLive,h.abrEwmaFastLive):this.bwEstimator.update(h.abrEwmaSlowVoD,h.abrEwmaFastVoD)},r._abandonRulesCheck=function(){var a=this.fragCurrent,i=this.partCurrent,h=this.hls,f=h.autoLevelEnabled,w=h.config,m=h.media;if(!a||!m)return;var T=i?i.stats:a.stats,C=i?i.duration:a.duration;if(T.aborted){u.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!f||m.paused||!m.playbackRate||!m.readyState)return;var x=performance.now()-T.loading.start,b=Math.abs(m.playbackRate);if(x<=500*C/b)return;var E=h.levels,A=h.minAutoLevel,v=E[a.level],M=T.total||Math.max(T.loaded,Math.round(C*v.maxBitrate/8)),I=Math.max(1,T.bwEstimate?T.bwEstimate/8:T.loaded*1e3/x),P=(M-T.loaded)/I,B=m.currentTime,H=(S.BufferHelper.bufferInfo(m,B,w.maxBufferHole).end-B)/b;if(H>=2*C/b||P<=H)return;var F=Number.POSITIVE_INFINITY,W;for(W=a.level-1;W>A;W--){var U=E[W].maxBitrate;if(F=C*U/(8*.8*I),F<H)break}if(F>=P)return;var K=this.bwEstimator.getEstimate();u.logger.warn("Fragment "+a.sn+(i?" part "+i.index:"")+" of level "+a.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
|
Current BW estimate: `+(Object(R.isFiniteNumber)(K)?(K/1024).toFixed(3):"Unknown")+` Kb/s
|
|
|
Estimated load time for current fragment: `+P.toFixed(3)+` s
|
|
|
Estimated load time for the next fragment: `+F.toFixed(3)+` s
|
|
|
Time to underbuffer: `+H.toFixed(3)+" s"),h.nextLoadLevel=W,this.bwEstimator.sample(x,T.loaded),this.clearTimer(),a.loader&&(this.fragCurrent=this.partCurrent=null,a.loader.abort()),h.trigger(c.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:a,part:i,stats:T})},r.onFragLoaded=function(a,i){var h=i.frag,f=i.part;if(h.type===p.PlaylistLevelType.MAIN&&Object(R.isFiniteNumber)(h.sn)){var w=f?f.stats:h.stats,m=f?f.duration:h.duration;if(this.clearTimer(),this.lastLoadedFragLevel=h.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var T=this.hls.levels[h.level],C=(T.loaded?T.loaded.bytes:0)+w.loaded,x=(T.loaded?T.loaded.duration:0)+m;T.loaded={bytes:C,duration:x},T.realBitrate=Math.round(8*C/x)}if(h.bitrateTest){var b={stats:w,frag:h,part:f,id:h.type};this.onFragBuffered(c.Events.FRAG_BUFFERED,b),h.bitrateTest=!1}}},r.onFragBuffered=function(a,i){var h=i.frag,f=i.part,w=f?f.stats:h.stats;if(w.aborted)return;if(h.type!==p.PlaylistLevelType.MAIN||h.sn==="initSegment")return;var m=w.parsing.end-w.loading.start;this.bwEstimator.sample(m,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),h.bitrateTest?this.bitrateTestDelay=m/1e3:this.bitrateTestDelay=0},r.onError=function(a,i){switch(i.details){case y.ErrorDetails.FRAG_LOAD_ERROR:case y.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},r.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},r.getNextABRAutoLevel=function(){var a=this.fragCurrent,i=this.partCurrent,h=this.hls,f=h.maxAutoLevel,w=h.config,m=h.minAutoLevel,T=h.media,C=i?i.duration:a?a.duration:0,x=T?T.currentTime:0,b=T&&T.playbackRate!==0?Math.abs(T.playbackRate):1,E=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,A=(S.BufferHelper.bufferInfo(T,x,w.maxBufferHole).end-x)/b,v=this.findBestLevel(E,m,f,A,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(v>=0)return v;u.logger.trace((A?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var M=C?Math.min(C,w.maxStarvationDelay):w.maxStarvationDelay,I=w.abrBandWidthFactor,P=w.abrBandWidthUpFactor;if(!A){var B=this.bitrateTestDelay;if(B){var H=C?Math.min(C,w.maxLoadingDelay):w.maxLoadingDelay;M=H-B,u.logger.trace("bitrate test took "+Math.round(1e3*B)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*M)+" ms"),I=P=1}}return v=this.findBestLevel(E,m,f,A+M,I,P),Math.max(v,0)},r.findBestLevel=function(a,i,h,f,w,m){for(var T,C=this.fragCurrent,x=this.partCurrent,b=this.lastLoadedFragLevel,E=this.hls.levels,A=E[b],v=!!(A!=null&&(T=A.details)!==null&&T!==void 0&&T.live),M=A==null?void 0:A.codecSet,I=x?x.duration:C?C.duration:0,P=h;P>=i;P--){var B=E[P];if(!B||M&&B.codecSet!==M)continue;var H=B.details,F=(x?H==null?void 0:H.partTarget:H==null?void 0:H.averagetargetduration)||I,W=void 0;P<=b?W=w*a:W=m*a;var U=E[P].maxBitrate,K=U*F/W;if(u.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+P+"/"+Math.round(W)+"/"+U+"/"+F+"/"+f+"/"+K),W>U&&(!K||v&&!this.bitrateTestDelay||K<f))return P}return-1},d(l,[{key:"nextAutoLevel",get:function(){var a=this._nextAutoLevel,i=this.bwEstimator;if(a!==-1&&(!i||!i.canEstimate()))return a;var h=this.getNextABRAutoLevel();return a!==-1&&(h=Math.min(a,h)),h},set:function(a){this._nextAutoLevel=a}}]),l}();k.default=s},"./src/controller/audio-stream-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/polyfills/number.ts"),O=D("./src/controller/base-stream-controller.ts"),c=D("./src/events.ts"),S=D("./src/utils/buffer-helper.ts"),y=D("./src/controller/fragment-tracker.ts"),p=D("./src/types/level.ts"),u=D("./src/types/loader.ts"),o=D("./src/loader/fragment.ts"),d=D("./src/demux/chunk-cache.ts"),s=D("./src/demux/transmuxer-interface.ts"),l=D("./src/types/transmuxer.ts"),r=D("./src/controller/fragment-finders.ts"),n=D("./src/utils/discontinuities.ts"),a=D("./src/errors.ts"),i=D("./src/utils/logger.ts");function h(){return h=Object.assign||function(C){for(var x=1;x<arguments.length;x++){var b=arguments[x];for(var E in b)Object.prototype.hasOwnProperty.call(b,E)&&(C[E]=b[E])}return C},h.apply(this,arguments)}function f(C,x){C.prototype=Object.create(x.prototype),C.prototype.constructor=C,w(C,x)}function w(C,x){return w=Object.setPrototypeOf||function(E,A){return E.__proto__=A,E},w(C,x)}var m=100,T=function(C){f(x,C);function x(E,A){var v;return v=C.call(this,E,A,"[audio-stream-controller]")||this,v.videoBuffer=null,v.videoTrackCC=-1,v.waitingVideoCC=-1,v.audioSwitch=!1,v.trackId=-1,v.waitingData=null,v.mainDetails=null,v.bufferFlushed=!1,v._registerListeners(),v}var b=x.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var A=this.hls;A.on(c.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(c.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(c.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(c.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(c.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),A.on(c.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.on(c.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),A.on(c.Events.ERROR,this.onError,this),A.on(c.Events.BUFFER_RESET,this.onBufferReset,this),A.on(c.Events.BUFFER_CREATED,this.onBufferCreated,this),A.on(c.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.on(c.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),A.on(c.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b._unregisterListeners=function(){var A=this.hls;A.off(c.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(c.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(c.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(c.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(c.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),A.off(c.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),A.off(c.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),A.off(c.Events.ERROR,this.onError,this),A.off(c.Events.BUFFER_RESET,this.onBufferReset,this),A.off(c.Events.BUFFER_CREATED,this.onBufferCreated,this),A.off(c.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),A.off(c.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),A.off(c.Events.FRAG_BUFFERED,this.onFragBuffered,this)},b.onInitPtsFound=function(A,v){var M=v.frag,I=v.id,P=v.initPTS;if(I==="main"){var B=M.cc;this.initPTS[M.cc]=P,this.log("InitPTS for cc: "+B+" found from main: "+P),this.videoTrackCC=B,this.state===O.State.WAITING_INIT_PTS&&this.tick()}},b.startLoad=function(A){if(!this.levels){this.startPosition=A,this.state=O.State.STOPPED;return}var v=this.lastCurrentTime;this.stopLoad(),this.setInterval(m),this.fragLoadError=0,v>0&&A===-1?(this.log("Override startPosition with lastCurrentTime @"+v.toFixed(3)),this.state=O.State.IDLE):(this.loadedmetadata=!1,this.state=O.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=A,this.tick()},b.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_TRACK:{var A,v=this.levels,M=this.trackId,I=v==null||((A=v[M])===null||A===void 0)?void 0:A.details;if(I){if(this.waitForCdnTuneIn(I))break;this.state=O.State.WAITING_INIT_PTS}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var P,B=performance.now(),H=this.retryDate;(!H||B>=H||(P=this.media)!==null&&P!==void 0&&P.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=O.State.IDLE);break}case O.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var W=F.frag,U=F.part,K=F.cache,z=F.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.FRAG_LOADING;var te=K.flush(),de={frag:W,part:U,payload:te,networkDetails:null};this._handleFragmentLoadProgress(de),z&&C.prototype._handleFragmentLoadComplete.call(this,de)}else if(this.videoTrackCC!==this.waitingVideoCC)i.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ge=this.getLoadPosition(),Ue=S.BufferHelper.bufferInfo(this.mediaBuffer,ge,this.config.maxBufferHole),Me=Object(r.fragmentWithinToleranceTest)(Ue.end,this.config.maxFragLookUpTolerance,W);Me<0&&(i.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ue.end+" is needed"),this.clearWaitingFragment())}}else this.state=O.State.IDLE}}this.onTickEnd()},b.clearWaitingFragment=function(){var A=this.waitingData;A&&(this.fragmentTracker.removeFragment(A.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=O.State.IDLE)},b.onTickEnd=function(){var A=this.media;if(!A||!A.readyState)return;var v=this.mediaBuffer?this.mediaBuffer:A,M=v.buffered;!this.loadedmetadata&&M.length&&(this.loadedmetadata=!0),this.lastCurrentTime=A.currentTime},b.doTickIdle=function(){var A,v,M=this.hls,I=this.levels,P=this.media,B=this.trackId,H=M.config;if(!I||!I[B])return;if(!P&&(this.startFragRequested||!H.startFragPrefetch))return;var F=I[B],W=F.details;if(!W||W.live&&this.levelLastLoaded!==B||this.waitForCdnTuneIn(W)){this.state=O.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,o.ElementaryStreamTypes.AUDIO,u.PlaylistLevelType.AUDIO));var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,u.PlaylistLevelType.AUDIO);if(U===null)return;var K=U.len,z=this.getMaxBufferLength(),te=this.audioSwitch;if(K>=z&&!te)return;if(!te&&this._streamEnded(U,W)){M.trigger(c.Events.BUFFER_EOS,{type:"audio"}),this.state=O.State.ENDED;return}var de=W.fragments,ge=de[0].start,Ue=U.end;if(te){var Me=this.getLoadPosition();Ue=Me,W.PTSKnown&&Me<ge&&((U.end>ge||U.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),P.currentTime=ge+.05))}var Le=this.getNextFragment(Ue,W);if(!Le){this.bufferFlushed=!0;return}((A=Le.decryptdata)===null||A===void 0?void 0:A.keyFormat)==="identity"&&!((v=Le.decryptdata)!==null&&v!==void 0&&v.key)?this.loadKey(Le,W):this.loadFragment(Le,W,Ue)},b.getMaxBufferLength=function(){var A=C.prototype.getMaxBufferLength.call(this),v=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,u.PlaylistLevelType.MAIN);return v===null?A:Math.max(A,v.len)},b.onMediaDetaching=function(){this.videoBuffer=null,C.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(A,v){var M=v.audioTracks;this.resetTransmuxer(),this.levels=M.map(function(I){return new p.Level(I)})},b.onAudioTrackSwitching=function(A,v){var M=!!v.url;this.trackId=v.id;var I=this.fragCurrent;I!=null&&I.loader&&I.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),M?this.setInterval(m):this.resetTransmuxer(),M?(this.audioSwitch=!0,this.state=O.State.IDLE):this.state=O.State.STOPPED,this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},b.onLevelLoaded=function(A,v){this.mainDetails=v.details},b.onAudioTrackLoaded=function(A,v){var M,I=this.levels,P=v.details,B=v.id;if(!I){this.warn("Audio tracks were reset while loading level "+B);return}this.log("Track "+B+" loaded ["+P.startSN+","+P.endSN+"],duration:"+P.totalduration);var H=I[B],F=0;if(P.live||(M=H.details)!==null&&M!==void 0&&M.live){var W=this.mainDetails;if(P.fragments[0]||(P.deltaUpdateFailed=!0),P.deltaUpdateFailed||!W)return;!H.details&&P.hasProgramDateTime&&W.hasProgramDateTime?(Object(n.alignMediaPlaylistByPDT)(P,W),F=P.fragments[0].start):F=this.alignPlaylists(P,H.details)}H.details=P,this.levelLastLoaded=B,!this.startFragRequested&&(this.mainDetails||!P.live)&&this.setStartPosition(H.details,F),this.state===O.State.WAITING_TRACK&&!this.waitForCdnTuneIn(P)&&(this.state=O.State.IDLE),this.tick()},b._handleFragmentLoadProgress=function(A){var v,M=A.frag,I=A.part,P=A.payload,B=this.config,H=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+M.sn+" of level "+M.level+" will not be buffered");return}var W=F[H];console.assert(W,"Audio track is defined on fragment load progress");var U=W.details;console.assert(U,"Audio track details are defined on fragment load progress");var K=B.defaultAudioCodec||W.audioCodec||"mp4a.40.2",z=this.transmuxer;z||(z=this.transmuxer=new s.default(this.hls,u.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var te=this.initPTS[M.cc],de=(v=M.initSegment)===null||v===void 0?void 0:v.data;if(te!==void 0){var ge=!1,Ue=I?I.index:-1,Me=Ue!==-1,Le=new l.ChunkMetadata(M.level,M.sn,M.stats.chunkCount,P.byteLength,Ue,Me);z.push(P,de,K,"",M,I,U.totalduration,ge,Le,te)}else{i.logger.log("Unknown video PTS for cc "+M.cc+", waiting for video PTS before demuxing audio frag "+M.sn+" of ["+U.startSN+" ,"+U.endSN+"],track "+H);var Oe=this.waitingData=this.waitingData||{frag:M,part:I,cache:new d.default,complete:!1},Fe=Oe.cache;Fe.push(new Uint8Array(P)),this.waitingVideoCC=this.videoTrackCC,this.state=O.State.WAITING_INIT_PTS}},b._handleFragmentLoadComplete=function(A){if(this.waitingData){this.waitingData.complete=!0;return}C.prototype._handleFragmentLoadComplete.call(this,A)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(A,v){var M=v.tracks.audio;M&&(this.mediaBuffer=M.buffer),v.tracks.video&&(this.videoBuffer=v.tracks.video.buffer)},b.onFragBuffered=function(A,v){var M=v.frag,I=v.part;if(M.type!==u.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(M)){this.warn("Fragment "+M.sn+(I?" p: "+I.index:"")+" of level "+M.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}M.sn!=="initSegment"&&(this.fragPrevious=M,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(c.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(M,I)},b.onError=function(A,v){switch(v.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.AUDIO,v);break;case a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==O.State.ERROR&&this.state!==O.State.STOPPED&&(this.state=v.fatal?O.State.ERROR:O.State.IDLE,this.warn(v.details+" while loading frag, switching to "+this.state+" state"));break;case a.ErrorDetails.BUFFER_FULL_ERROR:if(v.parent==="audio"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var M=!0,I=this.getFwdBufferInfo(this.mediaBuffer,u.PlaylistLevelType.AUDIO);I&&I.len>.5&&(M=!this.reduceMaxBufferLength(I.len)),M&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},b.onBufferFlushed=function(A,v){var M=v.type;M===o.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},b._handleTransmuxComplete=function(A){var v,M="audio",I=this.hls,P=A.remuxResult,B=A.chunkMeta,H=this.getCurrentContext(B);if(!H){this.warn("The loading context changed while buffering fragment "+B.sn+" of level "+B.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(B.level);return}var F=H.frag,W=H.part,U=P.audio,K=P.text,z=P.id3,te=P.initSegment;if(this.fragContextChanged(F))return;if(this.state=O.State.PARSING,this.audioSwitch&&U&&this.completeAudioSwitch(),te!=null&&te.tracks&&(this._bufferInitSegment(te.tracks,F,B),I.trigger(c.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:M,tracks:te.tracks})),U){var de=U.startPTS,ge=U.endPTS,Ue=U.startDTS,Me=U.endDTS;W&&(W.elementaryStreams[o.ElementaryStreamTypes.AUDIO]={startPTS:de,endPTS:ge,startDTS:Ue,endDTS:Me}),F.setElementaryStreamInfo(o.ElementaryStreamTypes.AUDIO,de,ge,Ue,Me),this.bufferFragmentData(U,F,W,B)}if(z!=null&&(v=z.samples)!==null&&v!==void 0&&v.length){var Le=h({frag:F,id:M},z);I.trigger(c.Events.FRAG_PARSING_METADATA,Le)}if(K){var Oe=h({frag:F,id:M},K);I.trigger(c.Events.FRAG_PARSING_USERDATA,Oe)}},b._bufferInitSegment=function(A,v,M){if(this.state!==O.State.PARSING)return;A.video&&delete A.video;var I=A.audio;if(!I)return;I.levelCodec=I.codec,I.id="audio",this.log("Init audio buffer, container:"+I.container+", codecs[parsed]=["+I.codec+"]"),this.hls.trigger(c.Events.BUFFER_CODECS,A);var P=I.initSegment;if(P!=null&&P.byteLength){var B={type:"audio",frag:v,part:null,chunkMeta:M,parent:v.type,data:P};this.hls.trigger(c.Events.BUFFER_APPENDING,B)}this.tick()},b.loadFragment=function(A,v,M){var I=this.fragmentTracker.getState(A);this.fragCurrent=A,(this.audioSwitch||I===y.FragmentState.NOT_LOADED||I===y.FragmentState.PARTIAL)&&(A.sn==="initSegment"?this._loadInitSegment(A):v.live&&!Object(R.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=O.State.WAITING_INIT_PTS):(this.startFragRequested=!0,C.prototype.loadFragment.call(this,A,v,M)))},b.completeAudioSwitch=function(){var A=this.hls,v=this.media,M=this.trackId;v&&(this.log("Switching audio track : flushing all audio"),C.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,A.trigger(c.Events.AUDIO_TRACK_SWITCHED,{id:M})},x}(O.default);k.default=T},"./src/controller/audio-track-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts"),O=D("./src/errors.ts"),c=D("./src/controller/base-playlist-controller.ts"),S=D("./src/types/loader.ts");function y(s,l){for(var r=0;r<l.length;r++){var n=l[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,n.key,n)}}function p(s,l,r){return l&&y(s.prototype,l),r&&y(s,r),s}function u(s,l){s.prototype=Object.create(l.prototype),s.prototype.constructor=s,o(s,l)}function o(s,l){return o=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},o(s,l)}var d=function(s){u(l,s);function l(n){var a;return a=s.call(this,n,"[audio-track-controller]")||this,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.trackName="",a.selectDefaultTrack=!0,a.registerListeners(),a}var r=l.prototype;return r.registerListeners=function(){var a=this.hls;a.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(R.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(R.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(R.Events.ERROR,this.onError,this)},r.unregisterListeners=function(){var a=this.hls;a.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(R.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(R.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(R.Events.ERROR,this.onError,this)},r.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,s.prototype.destroy.call(this)},r.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},r.onManifestParsed=function(a,i){this.tracks=i.audioTracks||[]},r.onAudioTrackLoaded=function(a,i){var h=i.id,f=i.details,w=this.tracksInGroup[h];if(!w){this.warn("Invalid audio track id "+h);return}var m=w.details;w.details=i.details,this.log("audioTrack "+h+" loaded ["+f.startSN+"-"+f.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,i,m))},r.onLevelLoading=function(a,i){this.switchLevel(i.level)},r.onLevelSwitching=function(a,i){this.switchLevel(i.level)},r.switchLevel=function(a){var i=this.hls.levels[a];if(!(i!=null&&i.audioGroupIds))return;var h=i.audioGroupIds[i.urlId];if(this.groupId!==h){this.groupId=h;var f=this.tracks.filter(function(m){return!h||m.groupId===h});this.selectDefaultTrack&&!f.some(function(m){return m.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=f;var w={audioTracks:f};this.log("Updating audio tracks, "+f.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(R.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},r.onError=function(a,i){if(s.prototype.onError.call(this,a,i),i.fatal||!i.context)return;i.context.type===S.PlaylistContextType.AUDIO_TRACK&&i.context.id===this.trackId&&i.context.groupId===this.groupId&&this.retryLoadingOrFail(i)},r.setAudioTrack=function(a){var i=this.tracksInGroup;if(a<0||a>=i.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var h=i[this.trackId];this.log("Now switching to audio-track index "+a);var f=i[a],w=f.id,m=f.groupId,T=m===void 0?"":m,C=f.name,x=f.type,b=f.url;if(this.trackId=a,this.trackName=C,this.selectDefaultTrack=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:T,name:C,type:x,url:b}),f.details&&!f.details.live)return;var E=this.switchParams(f.url,h==null?void 0:h.details);this.loadPlaylist(E)},r.selectInitialTrack=function(){var a=this.tracksInGroup;console.assert(a.length,"Initial audio track should be selected when tracks are known");var i=this.trackName,h=this.findTrackId(i)||this.findTrackId();h!==-1?this.setAudioTrack(h):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},r.findTrackId=function(a){for(var i=this.tracksInGroup,h=0;h<i.length;h++){var f=i[h];if((!this.selectDefaultTrack||f.default)&&(!a||a===f.name))return f.id}return-1},r.loadPlaylist=function(a){var i=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(i)){var h=i.id,f=i.groupId,w=i.url;if(a)try{w=a.addDirectives(w)}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(R.Events.AUDIO_TRACK_LOADING,{url:w,id:h,groupId:f,deliveryDirectives:a||null})}},p(l,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}}]),l}(c.default);k.default=d},"./src/controller/base-playlist-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return p});var R=D("./src/polyfills/number.ts"),O=D("./src/types/level.ts"),c=D("./src/controller/level-helper.ts"),S=D("./src/utils/logger.ts"),y=D("./src/errors.ts"),p=function(){function u(d,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=d}var o=u.prototype;return o.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},o.onError=function(s,l){l.fatal&&l.type===y.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 r=l==null?void 0:l.renditionReports;if(r)for(var n=0;n<r.length;n++){var a=r[n],i=""+a.URI;if(i===s.substr(-i.length)){var h=parseInt(a["LAST-MSN"]),f=parseInt(a["LAST-PART"]);if(l&&this.hls.config.lowLatencyMode){var w=Math.min(l.age-l.partTarget,l.targetduration);f!==void 0&&w>l.partTarget&&(f+=1)}if(Object(R.isFiniteNumber)(h))return new O.HlsUrlParameters(h,Object(R.isFiniteNumber)(f)?f:void 0,O.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,r){var n=this,a=l.details,i=l.stats,h=i.loading.end?Math.max(0,self.performance.now()-i.loading.end):0;if(a.advancedDateTime=Date.now()-h,a.live||r!=null&&r.live){if(a.reloaded(r),r&&this.log("live playlist "+s+" "+(a.advanced?"REFRESHED "+a.lastPartSn+"-"+a.lastPartIndex:"MISSED")),r&&a.fragments.length>0&&Object(c.mergeDetails)(r,a),!this.canLoad||!a.live)return;var f,w=void 0,m=void 0;if(a.canBlockReload&&a.endSN&&a.advanced){var T=this.hls.config.lowLatencyMode,C=a.lastPartSn,x=a.endSN,b=a.lastPartIndex,E=b!==-1,A=C===x,v=T?0:b;E?(w=A?x+1:C,m=A?v:b+1):w=x+1;var M=a.age,I=M+a.ageHeader,P=Math.min(I-a.partTarget,a.targetduration*1.5);if(P>0){if(r&&P>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+P+" with playlist age: "+a.age),P=0;else{var B=Math.floor(P/a.targetduration);if(w+=B,m!==void 0){var H=Math.round(P%a.targetduration/a.partTarget);m+=H}this.log("CDN Tune-in age: "+a.ageHeader+"s last advanced "+M.toFixed(2)+"s goal: "+P+" skip sn "+B+" to part "+m)}a.tuneInGoal=P}if(f=this.getDeliveryDirectives(a,l.deliveryDirectives,w,m),T||!A){this.loadPlaylist(f);return}}else f=this.getDeliveryDirectives(a,l.deliveryDirectives,w,m);var F=Object(c.computeReloadInterval)(a,i);w!==void 0&&a.canBlockReload&&(F-=a.partTarget||1),this.log("reload live playlist "+s+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return n.loadPlaylist(f)},F)}else this.clearTimer()},o.getDeliveryDirectives=function(s,l,r,n){var a=Object(O.getSkipValue)(s,r);return l!=null&&l.skip&&s.deltaUpdateFailed&&(r=l.msn,n=l.part,a=O.HlsSkip.No),new O.HlsUrlParameters(r,n,a)},o.retryLoadingOrFail=function(s){var l=this,r=this.hls.config,n=this.retryCount<r.levelLoadingMaxRetry;if(n){var a;if(this.retryCount++,s.details.indexOf("LoadTimeOut")>-1&&(a=s.context)!==null&&a!==void 0&&a.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+s.details+'"'),this.loadPlaylist();else{var i=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return l.loadPlaylist()},i),this.warn("retry playlist loading #"+this.retryCount+" in "+i+' ms after "'+s.details+'"')}}else this.warn('cannot recover from error "'+s.details+'"'),this.clearTimer(),s.fatal=!0;return n},u}()},"./src/controller/base-stream-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"State",function(){return x}),D.d(k,"default",function(){return b});var R=D("./src/polyfills/number.ts"),O=D("./src/task-loop.ts"),c=D("./src/controller/fragment-tracker.ts"),S=D("./src/utils/buffer-helper.ts"),y=D("./src/utils/logger.ts"),p=D("./src/events.ts"),u=D("./src/errors.ts"),o=D("./src/types/transmuxer.ts"),d=D("./src/utils/mp4-tools.ts"),s=D("./src/utils/discontinuities.ts"),l=D("./src/controller/fragment-finders.ts"),r=D("./src/controller/level-helper.ts"),n=D("./src/loader/fragment-loader.ts"),a=D("./src/crypt/decrypter.ts"),i=D("./src/utils/time-ranges.ts"),h=D("./src/types/loader.ts");function f(E,A){for(var v=0;v<A.length;v++){var M=A[v];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(E,M.key,M)}}function w(E,A,v){return A&&f(E.prototype,A),v&&f(E,v),E}function m(E){if(E===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return E}function T(E,A){E.prototype=Object.create(A.prototype),E.prototype.constructor=E,C(E,A)}function C(E,A){return C=Object.setPrototypeOf||function(M,I){return M.__proto__=I,M},C(E,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"},b=function(E){T(A,E);function A(M,I,P){var B;return B=E.call(this)||this,B.hls=void 0,B.fragPrevious=null,B.fragCurrent=null,B.fragmentTracker=void 0,B.transmuxer=null,B._state=x.STOPPED,B.media=void 0,B.mediaBuffer=void 0,B.config=void 0,B.bitrateTest=!1,B.lastCurrentTime=0,B.nextLoadPosition=0,B.startPosition=0,B.loadedmetadata=!1,B.fragLoadError=0,B.retryDate=0,B.levels=null,B.fragmentLoader=void 0,B.levelLastLoaded=null,B.startFragRequested=!1,B.decrypter=void 0,B.initPTS=[],B.onvseeking=null,B.onvended=null,B.logPrefix="",B.log=void 0,B.warn=void 0,B.logPrefix=P,B.log=y.logger.log.bind(y.logger,P+":"),B.warn=y.logger.warn.bind(y.logger,P+":"),B.hls=M,B.fragmentLoader=new n.default(M.config),B.fragmentTracker=I,B.config=M.config,B.decrypter=new a.default(M,M.config),M.on(p.Events.KEY_LOADED,B.onKeyLoaded,m(B)),B}var v=A.prototype;return v.doTick=function(){this.onTickEnd()},v.onTickEnd=function(){},v.startLoad=function(I){},v.stopLoad=function(){this.fragmentLoader.abort();var I=this.fragCurrent;I&&this.fragmentTracker.removeFragment(I),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},v._streamEnded=function(I,P){var B=this.fragCurrent,H=this.fragmentTracker;if(!P.live&&B&&B.sn===P.endSN&&!I.nextStart){var F=H.getState(B);return F===c.FragmentState.PARTIAL||F===c.FragmentState.OK}return!1},v.onMediaAttached=function(I,P){var B=this.media=this.mediaBuffer=P.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),B.addEventListener("seeking",this.onvseeking),B.addEventListener("ended",this.onvended);var H=this.config;this.levels&&H.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(H.startPosition)},v.onMediaDetaching=function(){var I=this.media;I!=null&&I.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),I&&(I.removeEventListener("seeking",this.onvseeking),I.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},v.onMediaSeeking=function(){var I=this.config,P=this.fragCurrent,B=this.media,H=this.mediaBuffer,F=this.state,W=B?B.currentTime:0,U=S.BufferHelper.bufferInfo(H||B,W,I.maxBufferHole);if(this.log("media seeking to "+(Object(R.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+F),F===x.ENDED)this.resetLoadingState();else if(P&&!U.len){var K=I.maxFragLookUpTolerance,z=P.start-K,te=P.start+P.duration+K,de=W>te;(W<z||de)&&(de&&P.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),P.loader.abort()),this.resetLoadingState())}B&&(this.lastCurrentTime=W),!this.loadedmetadata&&!U.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},v.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},v.onKeyLoaded=function(I,P){if(this.state!==x.KEY_LOADING||P.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var B=this.levels[P.frag.level].details;B&&this.loadFragment(P.frag,B,P.frag.start)},v.onHandlerDestroying=function(){this.stopLoad(),E.prototype.onHandlerDestroying.call(this)},v.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,E.prototype.onHandlerDestroyed.call(this)},v.loadKey=function(I,P){this.log("Loading key for "+I.sn+" of ["+P.startSN+"-"+P.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+I.level),this.state=x.KEY_LOADING,this.fragCurrent=I,this.hls.trigger(p.Events.KEY_LOADING,{frag:I})},v.loadFragment=function(I,P,B){this._loadFragForPlayback(I,P,B)},v._loadFragForPlayback=function(I,P,B){var H=this,F=function(U){if(H.fragContextChanged(I)){H.warn("Fragment "+I.sn+(U.part?" p: "+U.part.index:"")+" of level "+I.level+" was dropped during download."),H.fragmentTracker.removeFragment(I);return}I.stats.chunkCount++,H._handleFragmentLoadProgress(U)};this._doFragLoad(I,P,B,F).then(function(W){if(!W)return;H.fragLoadError=0;var U=H.state;if(H.fragContextChanged(I)){(U===x.FRAG_LOADING||U===x.BACKTRACKING||!H.fragCurrent&&U===x.PARSING)&&(H.fragmentTracker.removeFragment(I),H.state=x.IDLE);return}if("payload"in W&&(H.log("Loaded fragment "+I.sn+" of level "+I.level),H.hls.trigger(p.Events.FRAG_LOADED,W),H.state===x.BACKTRACKING)){H.fragmentTracker.backtrack(I,W),H.resetFragmentLoading(I);return}H._handleFragmentLoadComplete(W)}).catch(function(W){H.warn(W),H.resetFragmentLoading(I)})},v.flushMainBuffer=function(I,P,B){if(B===void 0&&(B=null),!(I-P))return;var H={startOffset:I,endOffset:P,type:B};this.fragLoadError=0,this.hls.trigger(p.Events.BUFFER_FLUSHING,H)},v._loadInitSegment=function(I){var P=this;this._doFragLoad(I).then(function(B){if(!B||P.fragContextChanged(I)||!P.levels)throw new Error("init load aborted");return B}).then(function(B){var H=P.hls,F=B.payload,W=I.decryptdata;if(F&&F.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var U=self.performance.now();return P.decrypter.webCryptoDecrypt(new Uint8Array(F),W.key.buffer,W.iv.buffer).then(function(K){var z=self.performance.now();return H.trigger(p.Events.FRAG_DECRYPTED,{frag:I,payload:K,stats:{tstart:U,tdecrypt:z}}),B.payload=K,B})}return B}).then(function(B){var H=P.fragCurrent,F=P.hls,W=P.levels;if(!W)throw new Error("init load aborted, missing levels");var U=W[I.level].details;console.assert(U,"Level details are defined when init segment is loaded");var K=I.stats;P.state=x.IDLE,P.fragLoadError=0,I.data=new Uint8Array(B.payload),K.parsing.start=K.buffering.start=self.performance.now(),K.parsing.end=K.buffering.end=self.performance.now(),B.frag===H&&F.trigger(p.Events.FRAG_BUFFERED,{stats:K,frag:H,part:null,id:I.type}),P.tick()}).catch(function(B){P.warn(B),P.resetFragmentLoading(I)})},v.fragContextChanged=function(I){var P=this.fragCurrent;return!I||!P||I.level!==P.level||I.sn!==P.sn||I.urlId!==P.urlId},v.fragBufferedComplete=function(I,P){var B=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+I.type+" sn: "+I.sn+(P?" part: "+P.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+I.level+" "+i.default.toString(S.BufferHelper.getBuffered(B))),this.state=x.IDLE,this.tick()},v._handleFragmentLoadComplete=function(I){var P=this.transmuxer;if(!P)return;var B=I.frag,H=I.part,F=I.partsLoaded,W=!F||F.length===0||F.some(function(K){return!K}),U=new o.ChunkMetadata(B.level,B.sn,B.stats.chunkCount+1,0,H?H.index:-1,!W);P.flush(U)},v._handleFragmentLoadProgress=function(I){},v._doFragLoad=function(I,P,B,H){var F=this;if(B===void 0&&(B=null),!this.levels)throw new Error("frag load aborted, missing levels");if(B=Math.max(I.start,B||0),this.config.lowLatencyMode&&P){var W=P.partList;if(W&&H){B>I.end&&P.fragmentHint&&(I=P.fragmentHint);var U=this.getNextPart(W,I,B);if(U>-1){var K=W[U];return this.log("Loading part sn: "+I.sn+" p: "+K.index+" cc: "+I.cc+" of playlist ["+P.startSN+"-"+P.endSN+"] parts [0-"+U+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+I.level+", target: "+parseFloat(B.toFixed(3))),this.nextLoadPosition=K.start+K.duration,this.state=x.FRAG_LOADING,this.hls.trigger(p.Events.FRAG_LOADING,{frag:I,part:W[U],targetBufferTime:B}),this.doFragPartsLoad(I,W,U,H).catch(function(z){return F.handleFragLoadError(z)})}else if(!I.url||this.loadedEndOfParts(W,B))return Promise.resolve(null)}}return this.log("Loading fragment "+I.sn+" cc: "+I.cc+" "+(P?"of ["+P.startSN+"-"+P.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+I.level+", target: "+parseFloat(B.toFixed(3))),Object(R.isFiniteNumber)(I.sn)&&!this.bitrateTest&&(this.nextLoadPosition=I.start+I.duration),this.state=x.FRAG_LOADING,this.hls.trigger(p.Events.FRAG_LOADING,{frag:I,targetBufferTime:B}),this.fragmentLoader.load(I,H).catch(function(z){return F.handleFragLoadError(z)})},v.doFragPartsLoad=function(I,P,B,H){var F=this;return new Promise(function(W,U){var K=[],z=function te(de){var ge=P[de];F.fragmentLoader.loadPart(I,ge,H).then(function(Ue){K[ge.index]=Ue;var Me=Ue.part;F.hls.trigger(p.Events.FRAG_LOADED,Ue);var Le=P[de+1];if(Le&&Le.fragment===I)te(de+1);else return W({frag:I,part:Me,partsLoaded:K})}).catch(U)};z(B)})},v.handleFragLoadError=function(I){var P=I.data;return P&&P.details===u.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(P.frag,P.part):this.hls.trigger(p.Events.ERROR,P),null},v._handleTransmuxerFlush=function(I){var P=this.getCurrentContext(I);if(!P||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var B=P.frag,H=P.part,F=P.level,W=self.performance.now();B.stats.parsing.end=W,H&&(H.stats.parsing.end=W),this.updateLevelTiming(B,H,F,I.partial)},v.getCurrentContext=function(I){var P=this.levels,B=I.level,H=I.sn,F=I.part;if(!P||!P[B])return this.warn("Levels object was unset while buffering fragment "+H+" of level "+B+". The current chunk will not be buffered."),null;var W=P[B],U=F>-1?Object(r.getPartWith)(W,H,F):null,K=U?U.fragment:Object(r.getFragmentWithSN)(W,H,this.fragCurrent);return K?{frag:K,part:U,level:W}:null},v.bufferFragmentData=function(I,P,B,H){if(!I||this.state!==x.PARSING)return;var F=I.data1,W=I.data2,U=F;if(F&&W&&(U=Object(d.appendUint8Array)(F,W)),!U||!U.length)return;var K={type:I.type,frag:P,part:B,chunkMeta:H,parent:P.type,data:U};this.hls.trigger(p.Events.BUFFER_APPENDING,K),I.dropped&&I.independent&&!B&&this.flushBufferGap(P)},v.flushBufferGap=function(I){var P=this.media;if(!P)return;if(!S.BufferHelper.isBuffered(P,P.currentTime)){this.flushMainBuffer(0,I.start);return}var B=P.currentTime,H=S.BufferHelper.bufferInfo(P,B,0),F=I.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),U=Math.max(Math.min(I.start-W,H.end-W),B+W);I.start-U>W&&this.flushMainBuffer(U,I.start)},v.getFwdBufferInfo=function(I,P){var B=this.config,H=this.getLoadPosition();if(!Object(R.isFiniteNumber)(H))return null;var F=S.BufferHelper.bufferInfo(I,H,B.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(H,P);if(W&&F.nextStart<W.end)return S.BufferHelper.bufferInfo(I,H,Math.max(F.nextStart,B.maxBufferHole))}return F},v.getMaxBufferLength=function(I){var P=this.config,B;return I?B=Math.max(8*P.maxBufferSize/I,P.maxBufferLength):B=P.maxBufferLength,Math.min(B,P.maxMaxBufferLength)},v.reduceMaxBufferLength=function(I){var P=this.config,B=I||P.maxBufferLength;return P.maxMaxBufferLength>=B?(P.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+P.maxMaxBufferLength+"s"),!0):!1},v.getNextFragment=function(I,P){var B,H,F=P.fragments,W=F.length;if(!W)return null;var U=this.config,K=F[0].start,z;if(P.live){var te=U.initialLiveManifestSize;if(W<te)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+te+")"),null;!P.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(z=this.getInitialLiveFragment(P,F),this.startPosition=z?this.hls.liveSyncPosition||z.start:I)}else I<=K&&(z=F[0]);if(!z){var de=U.lowLatencyMode?P.partEnd:P.fragmentEnd;z=this.getFragmentAtPosition(I,de,P)}return(B=z)!==null&&B!==void 0&&B.initSegment&&!((H=z)!==null&&H!==void 0&&H.initSegment.data)&&!this.bitrateTest&&(z=z.initSegment),z},v.getNextPart=function(I,P,B){for(var H=-1,F=!1,W=!0,U=0,K=I.length;U<K;U++){var z=I[U];if(W=W&&!z.independent,H>-1&&B<z.start)break;var te=z.loaded;!te&&(F||z.independent||W)&&z.fragment===P&&(H=U),F=te}return H},v.loadedEndOfParts=function(I,P){var B=I[I.length-1];return B&&P>B.start&&B.loaded},v.getInitialLiveFragment=function(I,P){var B=this.fragPrevious,H=null;if(B){if(I.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+B.programDateTime),H=Object(l.findFragmentByPDT)(P,B.endProgramDateTime,this.config.maxFragLookUpTolerance)),!H){var F=B.sn+1;if(F>=I.startSN&&F<=I.endSN){var W=P[F-I.startSN];B.cc===W.cc&&(H=W,this.log("Live playlist, switching playlist, load frag with next SN: "+H.sn))}H||(H=Object(l.findFragWithCC)(P,B.cc),H&&this.log("Live playlist, switching playlist, load frag with same CC: "+H.sn))}}else{var U=this.hls.liveSyncPosition;U!==null&&(H=this.getFragmentAtPosition(U,this.bitrateTest?I.fragmentEnd:I.edge,I))}return H},v.getFragmentAtPosition=function(I,P,B){var H=this.config,F=this.fragPrevious,W=B.fragments,U=B.endSN,K=B.fragmentHint,z=H.maxFragLookUpTolerance,te=!!(H.lowLatencyMode&&B.partList&&K);te&&K&&!this.bitrateTest&&(W=W.concat(K),U=K.sn);var de;if(I<P){var ge=I>P-z?0:z;de=Object(l.findFragmentByPTS)(F,W,I,ge)}else de=W[W.length-1];if(de){var Ue=de.sn-B.startSN,Me=F&&de.level===F.level,Le=W[Ue+1],Oe=this.fragmentTracker.getState(de);if(Oe===c.FragmentState.BACKTRACKED){de=null;for(var Fe=Ue;W[Fe]&&this.fragmentTracker.getState(W[Fe])===c.FragmentState.BACKTRACKED;)F?de=W[Fe--]:de=W[--Fe];de||(de=Le)}else F&&de.sn===F.sn&&!te&&(Me&&(de.sn<U&&this.fragmentTracker.getState(Le)!==c.FragmentState.OK?(this.log("SN "+de.sn+" just loaded, load next one: "+Le.sn),de=Le):de=null))}return de},v.synchronizeToLiveEdge=function(I){var P=this.config,B=this.media;if(!B)return;var H=this.hls.liveSyncPosition,F=B.currentTime,W=I.fragments[0].start,U=I.edge,K=F>=W-P.maxFragLookUpTolerance&&F<=U;if(H!==null&&B.duration>H&&(F<H||!K)){var z=P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:P.liveMaxLatencyDurationCount*I.targetduration;(!K&&B.readyState<4||F<U-z)&&(this.loadedmetadata||(this.nextLoadPosition=H),B.readyState&&(this.warn("Playback: "+F.toFixed(3)+" is located too far from the end of live sliding playlist: "+U+", reset currentTime to : "+H.toFixed(3)),B.currentTime=H))}},v.alignPlaylists=function(I,P){var B=this.levels,H=this.levelLastLoaded,F=this.fragPrevious,W=H!==null?B[H]:null,U=I.fragments.length;if(!U)return this.warn("No fragments in live playlist"),0;var K=I.fragments[0].start,z=!P,te=I.alignedSliding&&Object(R.isFiniteNumber)(K);if(z||!te&&!K){Object(s.alignStream)(F,W,I);var de=I.fragments[0].start;return this.log("Live playlist sliding: "+de.toFixed(2)+" start-sn: "+(P?P.startSN:"na")+"->"+I.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+U),de}return K},v.waitForCdnTuneIn=function(I){var P=3;return I.live&&I.canBlockReload&&I.tuneInGoal>Math.max(I.partHoldBack,I.partTarget*P)},v.setStartPosition=function(I,P){var B=this.startPosition;if(B<P&&(B=-1),B===-1||this.lastCurrentTime===-1){var H=I.startTimeOffset;Object(R.isFiniteNumber)(H)?(B=P+H,H<0&&(B+=I.totalduration),B=Math.min(Math.max(P,B),P+I.totalduration),this.log("Start time offset "+H+" found in playlist, adjust startPosition to "+B),this.startPosition=B):I.live?B=this.hls.liveSyncPosition||P:this.startPosition=B=0,this.lastCurrentTime=B}this.nextLoadPosition=B},v.getLoadPosition=function(){var I=this.media,P=0;return this.loadedmetadata&&I?P=I.currentTime:this.nextLoadPosition&&(P=this.nextLoadPosition),P},v.handleFragLoadAborted=function(I,P){this.transmuxer&&I.sn!=="initSegment"&&I.stats.aborted&&(this.warn("Fragment "+I.sn+(P?" part"+P.index:"")+" of level "+I.level+" was aborted"),this.resetFragmentLoading(I))},v.resetFragmentLoading=function(I){(!this.fragCurrent||!this.fragContextChanged(I))&&(this.state=x.IDLE)},v.onFragmentOrKeyLoadError=function(I,P){if(P.fatal)return;var B=P.frag;if(!B||B.type!==I)return;var H=this.fragCurrent;console.assert(H&&B.sn===H.sn&&B.level===H.level&&B.urlId===H.urlId,"Frag load error must match current frag to retry");var F=this.config;if(this.fragLoadError+1<=F.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(B.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*F.fragLoadingRetryDelay,F.fragLoadingMaxRetryTimeout);this.warn("Fragment "+B.sn+" of "+I+" "+B.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else P.levelRetry?(I===h.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(y.logger.error(P.details+" reaches max retry, redispatch as fatal ..."),P.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},v.afterBufferFlushed=function(I,P,B){if(!I)return;var H=S.BufferHelper.getBuffered(I);this.fragmentTracker.detectEvictedFragments(P,H,B),this.state===x.ENDED&&this.resetLoadingState()},v.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},v.resetLiveStartWhenNotLoaded=function(I){if(!this.loadedmetadata){this.startFragRequested=!1;var P=this.levels?this.levels[I].details:null;if(P!=null&&P.live)return this.startPosition=-1,this.setStartPosition(P,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},v.updateLevelTiming=function(I,P,B,H){var F=this,W=B.details;console.assert(!!W,"level.details must be defined");var U=Object.keys(I.elementaryStreams).reduce(function(K,z){var te=I.elementaryStreams[z];if(te){var de=te.endPTS-te.startPTS;if(de<=0)return F.warn("Could not parse fragment "+I.sn+" "+z+" duration reliably ("+de+") resetting transmuxer to fallback to playlist timing"),F.resetTransmuxer(),K||!1;var ge=H?0:Object(r.updateFragPTSDTS)(W,I,te.startPTS,te.endPTS,te.startDTS,te.endDTS);return F.hls.trigger(p.Events.LEVEL_PTS_UPDATED,{details:W,level:B,drift:ge,type:z,frag:I,start:te.startPTS,end:te.endPTS}),!0}return K},!1);U?(this.state=x.PARSED,this.hls.trigger(p.Events.FRAG_PARSED,{frag:I,part:P})):this.resetLoadingState()},v.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(A,[{key:"state",get:function(){return this._state},set:function(I){var P=this._state;P!==I&&(this._state=I,this.log(P+"->"+I))}}]),A}(O.default)},"./src/controller/buffer-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return l});var R=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),c=D("./src/utils/logger.ts"),S=D("./src/errors.ts"),y=D("./src/utils/buffer-helper.ts"),p=D("./src/utils/mediasource-helper.ts"),u=D("./src/loader/fragment.ts"),o=D("./src/controller/buffer-operation-queue.ts"),d=Object(p.getMediaSource)(),s=/([ha]vc.)(?:\.[^.,]+)+/,l=function(){function r(a){var i=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=i.hls,f=i.media,w=i.mediaSource;c.logger.log("[buffer-controller]: Media source opened"),f&&(i.updateMediaElementDuration(),h.trigger(O.Events.MEDIA_ATTACHED,{media:f})),w&&w.removeEventListener("sourceopen",i._onMediaSourceOpen),i.checkPendingTracks()},this._onMediaSourceClose=function(){c.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){c.logger.log("[buffer-controller]: Media source ended")},this.hls=a,this._initSourceBuffer(),this.registerListeners()}var n=r.prototype;return n.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},n.destroy=function(){this.unregisterListeners(),this.details=null},n.registerListeners=function(){var i=this.hls;i.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(O.Events.BUFFER_RESET,this.onBufferReset,this),i.on(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.on(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.on(O.Events.BUFFER_EOS,this.onBufferEos,this),i.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.on(O.Events.FRAG_PARSED,this.onFragParsed,this),i.on(O.Events.FRAG_CHANGED,this.onFragChanged,this)},n.unregisterListeners=function(){var i=this.hls;i.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),i.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(O.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(O.Events.BUFFER_RESET,this.onBufferReset,this),i.off(O.Events.BUFFER_APPENDING,this.onBufferAppending,this),i.off(O.Events.BUFFER_CODECS,this.onBufferCodecs,this),i.off(O.Events.BUFFER_EOS,this.onBufferEos,this),i.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),i.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),i.off(O.Events.FRAG_PARSED,this.onFragParsed,this),i.off(O.Events.FRAG_CHANGED,this.onFragChanged,this)},n._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new o.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},n.onManifestParsed=function(i,h){var f=2;(h.audio&&!h.video||!h.altAudio)&&(f=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=f,this.details=null,c.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},n.onMediaAttaching=function(i,h){var f=this.media=h.media;if(f&&d){var w=this.mediaSource=new d;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),f.src=self.URL.createObjectURL(w),this._objectUrl=f.src}},n.onMediaDetaching=function(){var i=this.media,h=this.mediaSource,f=this._objectUrl;if(h){if(c.logger.log("[buffer-controller]: media source detaching"),h.readyState==="open")try{h.endOfStream()}catch(w){c.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),h.removeEventListener("sourceopen",this._onMediaSourceOpen),h.removeEventListener("sourceended",this._onMediaSourceEnded),h.removeEventListener("sourceclose",this._onMediaSourceClose),i&&(f&&self.URL.revokeObjectURL(f),i.src===f?(i.removeAttribute("src"),i.load()):c.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(O.Events.MEDIA_DETACHED,void 0)},n.onBufferReset=function(){var i=this;this.getSourceBufferTypes().forEach(function(h){var f=i.sourceBuffer[h];try{f&&(i.removeBufferListeners(h),i.mediaSource&&i.mediaSource.removeSourceBuffer(f),i.sourceBuffer[h]=void 0)}catch(w){c.logger.warn("[buffer-controller]: Failed to reset the "+h+" buffer",w)}}),this._initSourceBuffer()},n.onBufferCodecs=function(i,h){var f=this,w=this.getSourceBufferTypes().length;if(Object.keys(h).forEach(function(m){if(w){var T=f.tracks[m];if(T&&typeof T.buffer.changeType=="function"){var C=h[m],x=C.codec,b=C.levelCodec,E=C.container,A=(T.levelCodec||T.codec).replace(s,"$1"),v=(b||x).replace(s,"$1");if(A!==v){var M=E+";codecs="+(b||x);f.appendChangeType(m,M)}}}else f.pendingTracks[m]=h[m]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},n.appendChangeType=function(i,h){var f=this,w=this.operationQueue,m={execute:function(){var C=f.sourceBuffer[i];C&&(c.logger.log("[buffer-controller]: changing "+i+" sourceBuffer type to "+h),C.changeType(h)),w.shiftAndExecuteNext(i)},onStart:function(){},onComplete:function(){},onError:function(C){c.logger.warn("[buffer-controller]: Failed to change "+i+" SourceBuffer type",C)}};w.append(m,i)},n.onBufferAppending=function(i,h){var f=this,w=this.hls,m=this.operationQueue,T=this.tracks,C=h.data,x=h.type,b=h.frag,E=h.part,A=h.chunkMeta,v=A.buffering[x],M=self.performance.now();v.start=M;var I=b.stats.buffering,P=E?E.stats.buffering:null;I.start===0&&(I.start=M),P&&P.start===0&&(P.start=M);var B=T.audio,H=x==="audio"&&A.id===1&&(B==null?void 0:B.container)==="audio/mpeg",F={execute:function(){if(v.executeStart=self.performance.now(),H){var U=f.sourceBuffer[x];if(U){var K=b.start-U.timestampOffset;Math.abs(K)>=.1&&(c.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+b.start+" (delta: "+K+") sn: "+b.sn+")"),U.timestampOffset=b.start)}}f.appendExecutor(C,x)},onStart:function(){},onComplete:function(){var U=self.performance.now();v.executeEnd=v.end=U,I.first===0&&(I.first=U),P&&P.first===0&&(P.first=U);var K=f.sourceBuffer,z={};for(var te in K)z[te]=y.BufferHelper.getBuffered(K[te]);f.appendError=0,f.hls.trigger(O.Events.BUFFER_APPENDED,{type:x,frag:b,part:E,chunkMeta:A,parent:b.type,timeRanges:z})},onError:function(U){c.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",U);var K={type:S.ErrorTypes.MEDIA_ERROR,parent:b.type,details:S.ErrorDetails.BUFFER_APPEND_ERROR,err:U,fatal:!1};U.code===DOMException.QUOTA_EXCEEDED_ERR?K.details=S.ErrorDetails.BUFFER_FULL_ERROR:(f.appendError++,K.details=S.ErrorDetails.BUFFER_APPEND_ERROR,f.appendError>w.config.appendErrorMaxRetry&&(c.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),K.fatal=!0)),w.trigger(O.Events.ERROR,K)}};m.append(F,x)},n.onBufferFlushing=function(i,h){var f=this,w=this.operationQueue,m=function(C){return{execute:f.removeExecutor.bind(f,C,h.startOffset,h.endOffset),onStart:function(){},onComplete:function(){f.hls.trigger(O.Events.BUFFER_FLUSHED,{type:C})},onError:function(b){c.logger.warn("[buffer-controller]: Failed to remove from "+C+" SourceBuffer",b)}}};h.type?w.append(m(h.type),h.type):this.getSourceBufferTypes().forEach(function(T){w.append(m(T),T)})},n.onFragParsed=function(i,h){var f=this,w=h.frag,m=h.part,T=[],C=m?m.elementaryStreams:w.elementaryStreams;C[u.ElementaryStreamTypes.AUDIOVIDEO]?T.push("audiovideo"):(C[u.ElementaryStreamTypes.AUDIO]&&T.push("audio"),C[u.ElementaryStreamTypes.VIDEO]&&T.push("video"));var x=function(){var E=self.performance.now();w.stats.buffering.end=E,m&&(m.stats.buffering.end=E);var A=m?m.stats:w.stats;f.hls.trigger(O.Events.FRAG_BUFFERED,{frag:w,part:m,stats:A,id:w.type})};T.length===0&&c.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(x,T)},n.onFragChanged=function(i,h){this.flushBackBuffer()},n.onBufferEos=function(i,h){var f=this,w=this.getSourceBufferTypes().reduce(function(m,T){var C=f.sourceBuffer[T];return(!h.type||h.type===T)&&(C&&!C.ended&&(C.ended=!0,c.logger.log("[buffer-controller]: "+T+" sourceBuffer now EOS"))),m&&!!(!C||C.ended)},!0);w&&this.blockBuffers(function(){var m=f.mediaSource;if(!m||m.readyState!=="open")return;m.endOfStream()})},n.onLevelUpdated=function(i,h){var f=h.details;if(!f.fragments.length)return;this.details=f,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},n.flushBackBuffer=function(){var i=this.hls,h=this.details,f=this.media,w=this.sourceBuffer;if(!f||h===null)return;var m=this.getSourceBufferTypes();if(!m.length)return;var T=h.live&&i.config.liveBackBufferLength!==null?i.config.liveBackBufferLength:i.config.backBufferLength;if(!Object(R.isFiniteNumber)(T)||T<0)return;var C=f.currentTime,x=h.levelTargetDuration,b=Math.max(T,x),E=Math.floor(C/x)*x-b;m.forEach(function(A){var v=w[A];if(v){var M=y.BufferHelper.getBuffered(v);M.length>0&&E>M.start(0)&&(i.trigger(O.Events.BACK_BUFFER_REACHED,{bufferEnd:E}),h.live&&i.trigger(O.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E}),i.trigger(O.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:A}))}})},n.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var i=this.details,h=this.hls,f=this.media,w=this.mediaSource,m=i.fragments[0].start+i.totalduration,T=f.duration,C=Object(R.isFiniteNumber)(w.duration)?w.duration:0;i.live&&h.config.liveDurationInfinity?(c.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(i)):(m>C&&m>T||!Object(R.isFiniteNumber)(T))&&(c.logger.log("[buffer-controller]: Updating Media Source duration to "+m.toFixed(3)),w.duration=m)},n.updateSeekableRange=function(i){var h=this.mediaSource,f=i.fragments,w=f.length;if(w&&i.live&&h!==null&&h!==void 0&&h.setLiveSeekableRange){var m=Math.max(0,f[0].start),T=Math.max(m,m+i.totalduration);h.setLiveSeekableRange(m,T)}},n.checkPendingTracks=function(){var i=this.bufferCodecEventsExpected,h=this.operationQueue,f=this.pendingTracks,w=Object.keys(f).length;if(w&&!i||w===2){this.createSourceBuffers(f),this.pendingTracks={};var m=this.getSourceBufferTypes();if(m.length===0){this.hls.trigger(O.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(T){h.executeNext(T)})}},n.createSourceBuffers=function(i){var h=this.sourceBuffer,f=this.mediaSource;if(!f)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var m in i)if(!h[m]){var T=i[m];if(!T)throw Error("source buffer exists for track "+m+", however track does not");var C=T.levelCodec||T.codec,x=T.container+";codecs="+C;c.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var b=h[m]=f.addSourceBuffer(x),E=m;this.addBufferListener(E,"updatestart",this._onSBUpdateStart),this.addBufferListener(E,"updateend",this._onSBUpdateEnd),this.addBufferListener(E,"error",this._onSBUpdateError),this.tracks[m]={buffer:b,codec:C,container:T.container,levelCodec:T.levelCodec,id:T.id},w++}catch(A){c.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+A.message),this.hls.trigger(O.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:A,mimeType:x})}}w&&this.hls.trigger(O.Events.BUFFER_CREATED,{tracks:this.tracks})},n._onSBUpdateStart=function(i){var h=this.operationQueue,f=h.current(i);f.onStart()},n._onSBUpdateEnd=function(i){var h=this.operationQueue,f=h.current(i);f.onComplete(),h.shiftAndExecuteNext(i)},n._onSBUpdateError=function(i,h){c.logger.error("[buffer-controller]: "+i+" SourceBuffer error",h),this.hls.trigger(O.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var f=this.operationQueue.current(i);f&&f.onError(h)},n.removeExecutor=function(i,h,f){var w=this.media,m=this.mediaSource,T=this.operationQueue,C=this.sourceBuffer,x=C[i];if(!w||!m||!x){c.logger.warn("[buffer-controller]: Attempting to remove from the "+i+" SourceBuffer, but it does not exist"),T.shiftAndExecuteNext(i);return}var b=Object(R.isFiniteNumber)(w.duration)?w.duration:Infinity,E=Object(R.isFiniteNumber)(m.duration)?m.duration:Infinity,A=Math.max(0,h),v=Math.min(f,b,E);v>A?(c.logger.log("[buffer-controller]: Removing ["+A+","+v+"] from the "+i+" SourceBuffer"),console.assert(!x.updating,i+" sourceBuffer must not be updating"),x.remove(A,v)):T.shiftAndExecuteNext(i)},n.appendExecutor=function(i,h){var f=this.operationQueue,w=this.sourceBuffer,m=w[h];if(!m){c.logger.warn("[buffer-controller]: Attempting to append to the "+h+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(h);return}m.ended=!1,console.assert(!m.updating,h+" sourceBuffer must not be updating"),m.appendBuffer(i)},n.blockBuffers=function(i,h){var f=this;if(h===void 0&&(h=this.getSourceBufferTypes()),!h.length){c.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(i);return}var w=this.operationQueue,m=h.map(function(T){return w.appendBlocker(T)});Promise.all(m).then(function(){i(),h.forEach(function(T){var C=f.sourceBuffer[T];(!C||!C.updating)&&w.shiftAndExecuteNext(T)})})},n.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},n.addBufferListener=function(i,h,f){var w=this.sourceBuffer[i];if(!w)return;var m=f.bind(this,i);this.listeners[i].push({event:h,listener:m}),w.addEventListener(h,m)},n.removeBufferListeners=function(i){var h=this.sourceBuffer[i];if(!h)return;this.listeners[i].forEach(function(f){h.removeEventListener(f.event,f.listener)})},r}()},"./src/controller/buffer-operation-queue.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return O});var R=D("./src/utils/logger.ts"),O=function(){function c(y){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=y}var S=c.prototype;return S.append=function(p,u){var o=this.queues[u];o.push(p),o.length===1&&this.buffers[u]&&this.executeNext(u)},S.insertAbort=function(p,u){var o=this.queues[u];o.unshift(p),this.executeNext(u)},S.appendBlocker=function(p){var u,o=new Promise(function(s){u=s}),d={execute:u,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(d,p),o},S.executeNext=function(p){var u=this.buffers,o=this.queues,d=u[p],s=o[p];if(s.length){var l=s[0];try{l.execute()}catch(r){R.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),l.onError(r),(!d||!d.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]},c}()},"./src/controller/cap-level-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts");function O(y,p){for(var u=0;u<p.length;u++){var o=p[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}function c(y,p,u){return p&&O(y.prototype,p),u&&O(y,u),y}var S=function(){function y(u){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=u,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var p=y.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(R.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),o.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},p.unregisterListener=function(){var o=this.hls;o.off(R.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),o.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(R.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},p.onFpsDropLevelCapping=function(o,d){y.isLevelAllowed(d.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(d.droppedLevel)},p.onMediaAttaching=function(o,d){this.media=d.media instanceof HTMLVideoElement?d.media:null},p.onManifestParsed=function(o,d){var s=this.hls;this.restrictedLevels=[],this.firstLevel=d.firstLevel,s.config.capLevelToPlayerSize&&d.video&&this.startCapping()},p.onBufferCodecs=function(o,d){var s=this.hls;s.config.capLevelToPlayerSize&&d.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 d=this.hls;d.autoLevelCapping=this.getMaxLevel(o.length-1),d.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=d.autoLevelCapping}}},p.getMaxLevel=function(o){var d=this,s=this.hls.levels;if(!s.length)return-1;var l=s.filter(function(r,n){return y.isLevelAllowed(n,d.restrictedLevels)&&n<=o});return this.clientRect=null,y.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,d={width:0,height:0};if(o){var s=o.getBoundingClientRect();d.width=s.width,d.height=s.height,!d.width&&!d.height&&(d.width=s.right-s.left||o.width||0,d.height=s.bottom-s.top||o.height||0)}return this.clientRect=d,d},y.isLevelAllowed=function(o,d){return d===void 0&&(d=[]),d.indexOf(o)===-1},y.getMaxLevelByMediaSize=function(o,d,s){if(!o||!o.length)return-1;for(var l=function(h,f){return f?h.width!==f.width||h.height!==f.height:!0},r=o.length-1,n=0;n<o.length;n+=1){var a=o[n];if((a.width>=d||a.height>=s)&&l(a,o[n+1])){r=n;break}}return r},c(y,[{key:"mediaWidth",get:function(){return this.getDimensions().width*y.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*y.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var o=1;try{o=self.devicePixelRatio}catch(d){}return o}}]),y}();k.default=S},"./src/controller/cmcd-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return l});var R=D("./src/events.ts"),O=D("./src/types/cmcd.ts"),c=D("./src/utils/buffer-helper.ts"),S=D("./src/utils/logger.ts");function y(r,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function p(r,n,a){return n&&y(r.prototype,n),a&&y(r,a),r}function u(r,n){var a=typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=o(r))||n&&r&&typeof r.length=="number"){a&&(r=a);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}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(r,n){if(!r)return;if(typeof r=="string")return d(r,n);var a=Object.prototype.toString.call(r).slice(8,-1);if(a==="Object"&&r.constructor&&(a=r.constructor.name),a==="Map"||a==="Set")return Array.from(r);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return d(r,n)}function d(r,n){(n==null||n>r.length)&&(n=r.length);for(var a=0,i=new Array(n);a<n;a++)i[a]=r[a];return i}function s(){return s=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var a=arguments[n];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(r[i]=a[i])}return r},s.apply(this,arguments)}var l=function(){function r(a){var i=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(){i.initialized&&(i.starved=!0),i.buffering=!0},this.onPlaying=function(){i.initialized||(i.initialized=!0),i.buffering=!1},this.applyPlaylistData=function(w){try{i.apply(w,{ot:O.CMCDObjectType.MANIFEST,su:!i.initialized})}catch(m){S.logger.warn("Could not generate manifest CMCD data.",m)}},this.applyFragmentData=function(w){try{var m=w.frag,T=i.hls.levels[m.level],C=i.getObjectType(m),x={d:m.duration*1e3,ot:C};(C===O.CMCDObjectType.VIDEO||C===O.CMCDObjectType.AUDIO||C==O.CMCDObjectType.MUXED)&&(x.br=T.bitrate/1e3,x.tb=i.getTopBandwidth(C),x.bl=i.getBufferLength(C)),i.apply(w,x)}catch(b){S.logger.warn("Could not generate segment CMCD data.",b)}},this.hls=a;var h=this.config=a.config,f=h.cmcd;f!=null&&(h.pLoader=this.createPlaylistLoader(),h.fLoader=this.createFragmentLoader(),this.sid=f.sessionId||r.uuid(),this.cid=f.contentId,this.useHeaders=f.useHeaders===!0,this.registerListeners())}var n=r.prototype;return n.registerListeners=function(){var i=this.hls;i.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(R.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this)},n.unregisterListeners=function(){var i=this.hls;i.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(R.Events.MEDIA_DETACHED,this.onMediaDetached,this),i.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},n.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},n.onMediaAttached=function(i,h){this.media=h.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},n.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},n.onBufferCreated=function(i,h){var f,w;this.audioBuffer=(f=h.tracks.audio)===null||f===void 0?void 0:f.buffer,this.videoBuffer=(w=h.tracks.video)===null||w===void 0?void 0:w.buffer},n.createData=function(){var i;return{v:O.CMCDVersion,sf:O.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(i=this.media)===null||i===void 0?void 0:i.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},n.apply=function(i,h){h===void 0&&(h={}),s(h,this.createData());var f=h.ot===O.CMCDObjectType.INIT||h.ot===O.CMCDObjectType.VIDEO||h.ot===O.CMCDObjectType.MUXED;if(this.starved&&f&&(h.bs=!0,h.su=!0,this.starved=!1),h.su==null&&(h.su=this.buffering),this.useHeaders){var w=r.toHeaders(h);if(!Object.keys(w).length)return;i.headers||(i.headers={}),s(i.headers,w)}else{var m=r.toQuery(h);if(!m)return;i.url=r.appendQueryToUri(i.url,m)}},n.getObjectType=function(i){var h=i.type;return h==="subtitle"?O.CMCDObjectType.TIMED_TEXT:i.sn==="initSegment"?O.CMCDObjectType.INIT:h==="audio"?O.CMCDObjectType.AUDIO:h==="main"?this.hls.audioTracks.length?O.CMCDObjectType.VIDEO:O.CMCDObjectType.MUXED:void 0},n.getTopBandwidth=function(i){for(var h=0,f=i===O.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=u(f),m;!(m=w()).done;){var T=m.value;T.bitrate>h&&(h=T.bitrate)}return h>0?h:NaN},n.getBufferLength=function(i){var h=this.hls.media,f=i===O.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!f||!h)return NaN;var w=c.BufferHelper.bufferInfo(f,h.currentTime,this.config.maxBufferHole);return w.len*1e3},n.createPlaylistLoader=function(){var i=this.config.pLoader,h=this.applyPlaylistData,f=i||this.config.loader;return function(){function w(T){this.loader=void 0,this.loader=new f(T)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(C,x,b){h(C),this.loader.load(C,x,b)},p(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},n.createFragmentLoader=function(){var i=this.config.fLoader,h=this.applyFragmentData,f=i||this.config.loader;return function(){function w(T){this.loader=void 0,this.loader=new f(T)}var m=w.prototype;return m.destroy=function(){this.loader.destroy()},m.abort=function(){this.loader.abort()},m.load=function(C,x,b){h(C),this.loader.load(C,x,b)},p(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},r.uuid=function(){var i=URL.createObjectURL(new Blob),h=i.toString();return URL.revokeObjectURL(i),h.substr(h.lastIndexOf("/")+1)},r.serialize=function(i){for(var h=[],f=function(H){return!Number.isNaN(H)&&H!=null&&H!==""&&H!==!1},w=function(H){return Math.round(H)},m=function(H){return w(H/100)*100},T=function(H){return encodeURIComponent(H)},C={br:w,d:w,bl:m,dl:m,mtp:m,nor:T,rtp:m,tb:w},x=Object.keys(i||{}).sort(),b=u(x),E;!(E=b()).done;){var A=E.value,v=i[A];if(!f(v))continue;if(A==="v"&&v===1)continue;if(A=="pr"&&v===1)continue;var M=C[A];M&&(v=M(v));var I=typeof v,P=void 0;A==="ot"||A==="sf"||A==="st"?P=A+"="+v:I==="boolean"?P=A:I==="number"?P=A+"="+v:P=A+"="+JSON.stringify(v),h.push(P)}return h.join(",")},r.toHeaders=function(i){for(var h=Object.keys(i),f={},w=["Object","Request","Session","Status"],m=[{},{},{},{}],T={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},C=0,x=h;C<x.length;C++){var b=x[C],E=T[b]!=null?T[b]:1;m[E][b]=i[b]}for(var A=0;A<m.length;A++){var v=r.serialize(m[A]);v&&(f["CMCD-"+w[A]]=v)}return f},r.toQuery=function(i){return"CMCD="+encodeURIComponent(r.serialize(i))},r.appendQueryToUri=function(i,h){if(!h)return i;var f=i.includes("?")?"&":"?";return""+i+f+h},r}()},"./src/controller/eme-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts"),O=D("./src/errors.ts"),c=D("./src/utils/logger.ts"),S=D("./src/utils/mediakeys-helper.ts");function y(l,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function p(l,r,n){return r&&y(l.prototype,r),n&&y(l,n),l}var u=3,o=function(r,n,a){var i={audioCapabilities:[],videoCapabilities:[]};return r.forEach(function(h){i.audioCapabilities.push({contentType:'audio/mp4; codecs="'+h+'"',robustness:a.audioRobustness||""})}),n.forEach(function(h){i.videoCapabilities.push({contentType:'video/mp4; codecs="'+h+'"',robustness:a.videoRobustness||""})}),[i]},d=function(r,n,a,i){switch(r){case S.KeySystems.WIDEVINE:return o(n,a,i);default:throw new Error("Unknown key-system: "+r)}},s=function(){function l(n){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=n,this._config=n.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 r=l.prototype;return r.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},r._registerListeners=function(){this.hls.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(R.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r._unregisterListeners=function(){this.hls.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(R.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this)},r.getLicenseServerUrl=function(a){switch(a){case S.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+a+'"')},r._attemptKeySystemAccess=function(a,i,h){var f=this,w=d(a,i,h,this._drmSystemOptions);c.logger.log("Requesting encrypted media key-system access");var m=this.requestMediaKeySystemAccess(a,w);this.mediaKeysPromise=m.then(function(T){return f._onMediaKeySystemAccessObtained(a,T)}),m.catch(function(T){c.logger.error('Failed to obtain key-system "'+a+'" access:',T)})},r._onMediaKeySystemAccessObtained=function(a,i){var h=this;c.logger.log('Access for key-system "'+a+'" obtained');var f={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:i,mediaKeySystemDomain:a};this._mediaKeysList.push(f);var w=Promise.resolve().then(function(){return i.createMediaKeys()}).then(function(m){return f.mediaKeys=m,c.logger.log('Media-keys created for key-system "'+a+'"'),h._onMediaKeysCreated(),m});return w.catch(function(m){c.logger.error("Failed to create media-keys:",m)}),w},r._onMediaKeysCreated=function(){var a=this;this._mediaKeysList.forEach(function(i){i.mediaKeysSession||(i.mediaKeysSession=i.mediaKeys.createSession(),a._onNewMediaKeySession(i.mediaKeysSession))})},r._onNewMediaKeySession=function(a){var i=this;c.logger.log("New key-system session "+a.sessionId),a.addEventListener("message",function(h){i._onKeySessionMessage(a,h.message)},!1)},r._onKeySessionMessage=function(a,i){c.logger.log("Got EME message event, creating license request"),this._requestLicense(i,function(h){c.logger.log("Received license data (length: "+(h&&h.byteLength)+"), updating key-session"),a.update(h)})},r.onMediaEncrypted=function(a){var i=this;if(c.logger.log('Media is encrypted using "'+a.initDataType+'" init data type'),!this.mediaKeysPromise){c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var h=function(w){if(!i._media)return;i._attemptSetMediaKeys(w),i._generateRequestWithPreferredKeySession(a.initDataType,a.initData)};this.mediaKeysPromise.then(h).catch(h)},r._attemptSetMediaKeys=function(a){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var i=this._mediaKeysList[0];if(!i||!i.mediaKeys){c.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}c.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(i.mediaKeys),this._hasSetMediaKeys=!0}},r._generateRequestWithPreferredKeySession=function(a,i){var h=this,f=this._mediaKeysList[0];if(!f){c.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(f.mediaKeysSessionInitialized){c.logger.warn("Key-Session already initialized but requested again");return}var w=f.mediaKeysSession;if(!w){c.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!i){c.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}c.logger.log('Generating key-session request for "'+a+'" init data type'),f.mediaKeysSessionInitialized=!0,w.generateRequest(a,i).then(function(){c.logger.debug("Key-session generation succeeded")}).catch(function(m){c.logger.error("Error generating key-session request:",m),h.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},r._createLicenseXhr=function(a,i,h){var f=new XMLHttpRequest;f.responseType="arraybuffer",f.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,f,a,i,h);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,f,a),w=void 0}catch(m){c.logger.error(m)}try{f.readyState||f.open("POST",a,!0),w&&w.call(this.hls,f,a)}catch(m){throw new Error("issue setting up KeySystem license XHR "+m)}return f},r._onLicenseRequestReadyStageChange=function(a,i,h,f){switch(a.readyState){case 4:if(a.status===200){this._requestLicenseFailureCount=0,c.logger.log("License request succeeded");var w=a.response,m=this._licenseResponseCallback;if(m)try{w=m.call(this.hls,a,i)}catch(C){c.logger.error(C)}f(w)}else{if(c.logger.error("License Request XHR failed ("+i+"). Status: "+a.status+" ("+a.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u){this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var T=u-this._requestLicenseFailureCount+1;c.logger.warn("Retrying license request, "+T+" attempts left"),this._requestLicense(h,f)}break}},r._generateLicenseRequestChallenge=function(a,i){switch(a.mediaKeySystemDomain){case S.KeySystems.WIDEVINE:return i}throw new Error("unsupported key-system: "+a.mediaKeySystemDomain)},r._requestLicense=function(a,i){c.logger.log("Requesting content license for key-system");var h=this._mediaKeysList[0];if(!h){c.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var f=this.getLicenseServerUrl(h.mediaKeySystemDomain),w=this._createLicenseXhr(f,a,i);c.logger.log("Sending license request to URL: "+f);var m=this._generateLicenseRequestChallenge(h,a);w.send(m)}catch(T){c.logger.error("Failure requesting DRM license: "+T),this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.KEY_SYSTEM_ERROR,details:O.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},r.onMediaAttached=function(a,i){if(!this._emeEnabled)return;var h=i.media;this._media=h,h.addEventListener("encrypted",this._onMediaEncrypted)},r.onMediaDetached=function(){var a=this._media,i=this._mediaKeysList;if(!a)return;a.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(i.map(function(h){if(h.mediaKeysSession)return h.mediaKeysSession.close().catch(function(){})})).then(function(){return a.setMediaKeys(null)}).catch(function(){})},r.onManifestParsed=function(a,i){if(!this._emeEnabled)return;var h=i.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),f=i.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(S.KeySystems.WIDEVINE,h,f)},p(l,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),l}();k.default=s},"./src/controller/fps-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts"),O=D("./src/utils/logger.ts"),c=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 y=S.prototype;return y.setStreamController=function(u){this.streamController=u},y.registerListeners=function(){this.hls.on(R.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},y.unregisterListeners=function(){this.hls.off(R.Events.MEDIA_ATTACHING,this.onMediaAttaching)},y.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},y.onMediaAttaching=function(u,o){var d=this.hls.config;if(d.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),d.fpsDroppedMonitoringPeriod)}},y.checkFPS=function(u,o,d){var s=performance.now();if(o){if(this.lastTime){var l=s-this.lastTime,r=d-this.lastDroppedFrames,n=o-this.lastDecodedFrames,a=1e3*r/l,i=this.hls;if(i.trigger(R.Events.FPS_DROP,{currentDropped:r,currentDecoded:n,totalDroppedFrames:d}),a>0&&r>i.config.fpsDroppedMonitoringThreshold*n){var h=i.currentLevel;O.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(i.autoLevelCapping===-1||i.autoLevelCapping>=h)&&(h=h-1,i.trigger(R.Events.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:i.currentLevel}),i.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=d,this.lastDecodedFrames=o}},y.checkFPSInterval=function(){var u=this.media;if(u)if(this.isVideoPlaybackQualityAvailable){var o=u.getVideoPlaybackQuality();this.checkFPS(u,o.totalVideoFrames,o.droppedVideoFrames)}else this.checkFPS(u,u.webkitDecodedFrameCount,u.webkitDroppedFrameCount)},S}();k.default=c},"./src/controller/fragment-finders.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"findFragmentByPDT",function(){return c}),D.d(k,"findFragmentByPTS",function(){return S}),D.d(k,"fragmentWithinToleranceTest",function(){return y}),D.d(k,"pdtWithinToleranceTest",function(){return p}),D.d(k,"findFragWithCC",function(){return u});var R=D("./src/polyfills/number.ts"),O=D("./src/utils/binary-search.ts");function c(o,d,s){if(d===null||!Array.isArray(o)||!o.length||!Object(R.isFiniteNumber)(d))return null;var l=o[0].programDateTime;if(d<(l||0))return null;var r=o[o.length-1].endProgramDateTime;if(d>=(r||0))return null;s=s||0;for(var n=0;n<o.length;++n){var a=o[n];if(p(d,s,a))return a}return null}function S(o,d,s,l){s===void 0&&(s=0),l===void 0&&(l=0);var r=null;if(o?r=d[o.sn-d[0].sn+1]||null:s===0&&d[0].start===0&&(r=d[0]),r&&y(s,l,r)===0)return r;var n=O.default.search(d,y.bind(null,s,l));return n||r}function y(o,d,s){o===void 0&&(o=0),d===void 0&&(d=0);var l=Math.min(d,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,d,s){var l=Math.min(d,s.duration+(s.deltaPTS?s.deltaPTS:0))*1e3,r=s.endProgramDateTime||0;return r-l>o}function u(o,d){return O.default.search(o,function(s){return s.cc<d?1:s.cc>d?-1:0})}},"./src/controller/fragment-tracker.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"FragmentState",function(){return c}),D.d(k,"FragmentTracker",function(){return S});var R=D("./src/events.ts"),O=D("./src/types/loader.ts"),c;(function(u){u.NOT_LOADED="NOT_LOADED",u.BACKTRACKED="BACKTRACKED",u.APPENDING="APPENDING",u.PARTIAL="PARTIAL",u.OK="OK"})(c||(c={}));var S=function(){function u(d){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=d,this._registerListeners()}var o=u.prototype;return o._registerListeners=function(){var s=this.hls;s.on(R.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(R.Events.FRAG_LOADED,this.onFragLoaded,this)},o._unregisterListeners=function(){var s=this.hls;s.off(R.Events.BUFFER_APPENDED,this.onBufferAppended,this),s.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(R.Events.FRAG_LOADED,this.onFragLoaded,this)},o.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},o.getAppendedFrag=function(s,l){if(l===O.PlaylistLevelType.MAIN){var r=this.activeFragment,n=this.activeParts;if(!r)return null;if(n)for(var a=n.length;a--;){var i=n[a],h=i?i.end:r.appendedPTS;if(i.start<=s&&h!==void 0&&s<=h)return a>9&&(this.activeParts=n.slice(a-9)),i}else if(r.start<=s&&r.appendedPTS!==void 0&&s<=r.appendedPTS)return r}return this.getBufferedFrag(s,l)},o.getBufferedFrag=function(s,l){for(var r=this.fragments,n=Object.keys(r),a=n.length;a--;){var i=r[n[a]];if((i==null?void 0:i.body.type)===l&&i.buffered){var h=i.body;if(h.start<=s&&s<=h.end)return h}}return null},o.detectEvictedFragments=function(s,l,r){var n=this;Object.keys(this.fragments).forEach(function(a){var i=n.fragments[a];if(!i)return;if(!i.buffered){i.body.type===r&&n.removeFragment(i.body);return}var h=i.range[s];if(!h)return;h.time.some(function(f){var w=!n.isTimeBuffered(f.startPTS,f.endPTS,l);return w&&n.removeFragment(i.body),w})})},o.detectPartialFragments=function(s){var l=this,r=this.timeRanges,n=s.frag,a=s.part;if(!r||n.sn==="initSegment")return;var i=p(n),h=this.fragments[i];if(!h)return;Object.keys(r).forEach(function(f){var w=n.elementaryStreams[f];if(!w)return;var m=r[f],T=a!==null||w.partial===!0;h.range[f]=l.getBufferedTimes(n,a,T,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),r=this.fragments[l];r&&(r.backtrack=r.loaded=null,r.buffered=!0)},o.getBufferedTimes=function(s,l,r,n){for(var a={time:[],partial:r},i=l?l.start:s.start,h=l?l.end:s.end,f=s.minEndPTS||h,w=s.maxStartPTS||i,m=0;m<n.length;m++){var T=n.start(m)-this.bufferPadding,C=n.end(m)+this.bufferPadding;if(w>=T&&f<=C){a.time.push({startPTS:Math.max(i,n.start(m)),endPTS:Math.min(h,n.end(m))});break}else if(i<C&&h>T)a.partial=!0,a.time.push({startPTS:Math.max(i,n.start(m)),endPTS:Math.min(h,n.end(m))});else if(h<=T)break}return a},o.getPartialFragment=function(s){var l=null,r,n,a,i=0,h=this.bufferPadding,f=this.fragments;return Object.keys(f).forEach(function(w){var m=f[w];if(!m)return;y(m)&&(n=m.body.start-h,a=m.body.end+h,s>=n&&s<=a&&(r=Math.min(s-n,a-s),i<=r&&(l=m.body,i=r)))}),l},o.getState=function(s){var l=p(s),r=this.fragments[l];return r?r.buffered?y(r)?c.PARTIAL:c.OK:r.backtrack?c.BACKTRACKED:c.APPENDING:c.NOT_LOADED},o.backtrack=function(s,l){var r=p(s),n=this.fragments[r];if(!n||n.backtrack)return null;var a=n.backtrack=l||n.loaded;return n.loaded=null,a},o.getBacktrackData=function(s){var l=p(s),r=this.fragments[l];if(r){var n,a=r.backtrack;if(a!=null&&(n=a.payload)!==null&&n!==void 0&&n.byteLength)return a;this.removeFragment(s)}return null},o.isTimeBuffered=function(s,l,r){for(var n,a,i=0;i<r.length;i++){if(n=r.start(i)-this.bufferPadding,a=r.end(i)+this.bufferPadding,s>=n&&l<=a)return!0;if(l<=n)return!1}return!1},o.onFragLoaded=function(s,l){var r=l.frag,n=l.part;if(r.sn==="initSegment"||r.bitrateTest||n)return;var a=p(r);this.fragments[a]={body:r,loaded:l,backtrack:null,buffered:!1,range:Object.create(null)}},o.onBufferAppended=function(s,l){var r=this,n=l.frag,a=l.part,i=l.timeRanges;if(n.type===O.PlaylistLevelType.MAIN)if(this.activeFragment=n,a){var h=this.activeParts;h||(this.activeParts=h=[]),h.push(a)}else this.activeParts=null;this.timeRanges=i,Object.keys(i).forEach(function(f){var w=i[f];if(r.detectEvictedFragments(f,w),!a)for(var m=0;m<w.length;m++)n.appendedPTS=Math.max(w.end(m),n.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,r){var n=this;Object.keys(this.fragments).forEach(function(a){var i=n.fragments[a];if(!i)return;if(i.buffered){var h=i.body;h.type===r&&h.start<l&&h.end>s&&n.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},u}();function y(u){var o,d;return u.buffered&&(((o=u.range.video)===null||o===void 0?void 0:o.partial)||((d=u.range.audio)===null||d===void 0?void 0:d.partial))}function p(u){return u.type+"_"+u.level+"_"+u.urlId+"_"+u.sn}},"./src/controller/gap-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"STALL_MINIMUM_DURATION_MS",function(){return y}),D.d(k,"MAX_START_GAP_JUMP",function(){return p}),D.d(k,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return u}),D.d(k,"SKIP_BUFFER_RANGE_START",function(){return o}),D.d(k,"default",function(){return d});var R=D("./src/utils/buffer-helper.ts"),O=D("./src/errors.ts"),c=D("./src/events.ts"),S=D("./src/utils/logger.ts"),y=250,p=2,u=.1,o=.05,d=function(){function s(r,n,a,i){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=r,this.media=n,this.fragmentTracker=a,this.hls=i}var l=s.prototype;return l.destroy=function(){this.hls=this.fragmentTracker=this.media=null},l.poll=function(n){var a=this.config,i=this.media,h=this.stalled,f=i.currentTime,w=i.seeking,m=this.seeking&&!w,T=!this.seeking&&w;if(this.seeking=w,f!==n){if(this.moved=!0,h!==null){if(this.stallReported){var C=self.performance.now()-h;S.logger.warn("playback not stuck anymore @"+f+", after "+Math.round(C)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((T||m)&&(this.stalled=null),i.paused||i.ended||i.playbackRate===0||!R.BufferHelper.getBuffered(i).length)return;var x=R.BufferHelper.bufferInfo(i,f,0),b=x.len>0,E=x.nextStart||0;if(!b&&!E)return;if(w){var A=x.len>p,v=!E||E-f>p&&!this.fragmentTracker.getPartialFragment(f);if(A||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var M,I=Math.max(E,x.start||0)-f,P=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,B=P==null||((M=P.details)===null||M===void 0)?void 0:M.live,H=B?P.details.targetduration*2:p;if(I>0&&I<=H){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(h===null){this.stalled=F;return}var W=F-h;!w&&W>=y&&this._reportStall(x.len);var U=R.BufferHelper.bufferInfo(i,f,a.maxBufferHole);this._tryFixBufferStall(U,W)},l._tryFixBufferStall=function(n,a){var i=this.config,h=this.fragmentTracker,f=this.media,w=f.currentTime,m=h.getPartialFragment(w);if(m){var T=this._trySkipBufferHole(m);if(T)return}n.len>i.maxBufferHole&&a>i.highBufferWatchdogPeriod*1e3&&(S.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},l._reportStall=function(n){var a=this.hls,i=this.media,h=this.stallReported;h||(this.stallReported=!0,S.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+n+")"),a.trigger(c.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:n}))},l._trySkipBufferHole=function(n){for(var a=this.config,i=this.hls,h=this.media,f=h.currentTime,w=0,m=R.BufferHelper.getBuffered(h),T=0;T<m.length;T++){var C=m.start(T);if(f+a.maxBufferHole>=w&&f<C){var x=Math.max(C+o,h.currentTime+u);return S.logger.warn("skipping hole, adjusting currentTime from "+f+" to "+x),this.moved=!0,this.stalled=null,h.currentTime=x,n&&i.trigger(c.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+f+" to "+x,frag:n}),x}w=m.end(T)}return 0},l._tryNudgeBuffer=function(){var n=this.config,a=this.hls,i=this.media,h=i.currentTime,f=(this.nudgeRetry||0)+1;if(this.nudgeRetry=f,f<n.nudgeMaxRetry){var w=h+f*n.nudgeOffset;S.logger.warn("Nudging 'currentTime' from "+h+" to "+w),i.currentTime=w,a.trigger(c.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else S.logger.error("Playhead still not moving while enough data buffered @"+h+" after "+n.nudgeMaxRetry+" nudges"),a.trigger(c.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},s}()},"./src/controller/id3-track-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts"),O=D("./src/utils/texttrack-utils.ts"),c=D("./src/demux/id3.ts"),S=.25,y=function(){function p(o){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=o,this._registerListeners()}var u=p.prototype;return u.destroy=function(){this._unregisterListeners()},u._registerListeners=function(){var d=this.hls;d.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(R.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),d.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},u._unregisterListeners=function(){var d=this.hls;d.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(R.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),d.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},u.onMediaAttached=function(d,s){this.media=s.media},u.onMediaDetaching=function(){if(!this.id3Track)return;Object(O.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},u.getID3Track=function(d){if(!this.media)return;for(var s=0;s<d.length;s++){var l=d[s];if(l.kind==="metadata"&&l.label==="id3")return Object(O.sendAddTrackEvent)(l,this.media),l}return this.media.addTextTrack("metadata","id3")},u.onFragParsingMetadata=function(d,s){if(!this.media)return;var l=s.frag,r=s.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var n=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var i=c.getID3Frames(r[a].data);if(i){var h=r[a].pts,f=a<r.length-1?r[a+1].pts:l.end,w=f-h;w<=0&&(f=h+S);for(var m=0;m<i.length;m++){var T=i[m];if(!c.isTimeStampFrame(T)){var C=new n(h,f,"");C.value=T,this.id3Track.addCue(C)}}}}},u.onBufferFlushing=function(d,s){var l=s.startOffset,r=s.endOffset,n=s.type;if(!n||n==="audio"){var a=this.id3Track;a&&Object(O.removeCuesInRange)(a,l,r)}},p}();k.default=y},"./src/controller/latency-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return p});var R=D("./src/errors.ts"),O=D("./src/events.ts"),c=D("./src/utils/logger.ts");function S(u,o){for(var d=0;d<o.length;d++){var s=o[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function y(u,o,d){return o&&S(u.prototype,o),d&&S(u,d),u}var p=function(){function u(d){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=d,this.config=d.config,this.registerListeners()}var o=u.prototype;return o.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},o.registerListeners=function(){this.hls.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(O.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(O.Events.ERROR,this.onError,this)},o.unregisterListeners=function(){this.hls.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(O.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(O.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(O.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 r=l.details;this.levelDetails=r,r.advanced&&this.timeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},o.onError=function(s,l){if(l.details!==R.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,c.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 r=this.computeLatency();if(r===null)return;this._latency=r;var n=this.config,a=n.lowLatencyMode,i=n.maxLiveSyncPlaybackRate;if(!a||i===1)return;var h=this.targetLatency;if(h===null)return;var f=r-h,w=Math.min(this.maxLatency,h+l.targetduration),m=f<w;if(l.live&&m&&f>.05&&this.forwardBufferLength>1){var T=Math.min(2,Math.max(1,i)),C=Math.round(2/(1+Math.exp(-.75*f-this.edgeStalled))*20)/20;s.playbackRate=Math.min(T,Math.max(1,C))}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},y(u,[{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,r=s.partHoldBack,n=s.targetduration,a=this.config,i=a.liveSyncDuration,h=a.liveSyncDurationCount,f=a.lowLatencyMode,w=this.hls.userConfig,m=f&&r||l;(w.liveSyncDuration||w.liveSyncDurationCount||m===0)&&(m=i!==void 0?i:h*n);var T=n,C=1;return m+Math.min(this.stallCount*C,T)}},{key:"liveSyncPosition",get:function(){var s=this.estimateLiveEdge(),l=this.targetLatency,r=this.levelDetails;if(s===null||l===null||r===null)return null;var n=r.edge,a=s-l-this.edgeStalled,i=n-r.totalduration,h=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(i,a),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 r=s.buffered.length;return r?s.buffered.end(r-1):l.edge-this.currentTime}}]),u}()},"./src/controller/level-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return a});var R=D("./src/types/level.ts"),O=D("./src/events.ts"),c=D("./src/errors.ts"),S=D("./src/utils/codecs.ts"),y=D("./src/controller/level-helper.ts"),p=D("./src/controller/base-playlist-controller.ts"),u=D("./src/types/loader.ts");function o(){return o=Object.assign||function(i){for(var h=1;h<arguments.length;h++){var f=arguments[h];for(var w in f)Object.prototype.hasOwnProperty.call(f,w)&&(i[w]=f[w])}return i},o.apply(this,arguments)}function d(i,h){for(var f=0;f<h.length;f++){var w=h[f];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(i,w.key,w)}}function s(i,h,f){return h&&d(i.prototype,h),f&&d(i,f),i}function l(i,h){i.prototype=Object.create(h.prototype),i.prototype.constructor=i,r(i,h)}function r(i,h){return r=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},r(i,h)}var n=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),a=function(i){l(h,i);function h(w){var m;return m=i.call(this,w,"[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 f=h.prototype;return f._registerListeners=function(){var m=this.hls;m.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),m.on(O.Events.ERROR,this.onError,this)},f._unregisterListeners=function(){var m=this.hls;m.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),m.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(O.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),m.off(O.Events.ERROR,this.onError,this)},f.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,i.prototype.destroy.call(this)},f.startLoad=function(){var m=this._levels;m.forEach(function(T){T.loadError=0}),i.prototype.startLoad.call(this)},f.onManifestLoaded=function(m,T){var C=[],x=[],b=[],E,A={},v,M=!1,I=!1,P=!1;if(T.levels.forEach(function(W){var U=W.attrs;M=M||!!(W.width&&W.height),I=I||!!W.videoCodec,P=P||!!W.audioCodec,n&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var K=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;v=A[K],v?v.url.push(W.url):(v=new R.Level(W),A[K]=v,C.push(v)),U&&(U.AUDIO&&Object(y.addGroupId)(v,"audio",U.AUDIO),U.SUBTITLES&&Object(y.addGroupId)(v,"text",U.SUBTITLES))}),(M||I)&&P&&(C=C.filter(function(W){var U=W.videoCodec,K=W.width,z=W.height;return!!U||!!(K&&z)})),C=C.filter(function(W){var U=W.audioCodec,K=W.videoCodec;return(!U||Object(S.isCodecSupportedInMp4)(U,"audio"))&&(!K||Object(S.isCodecSupportedInMp4)(K,"video"))}),T.audioTracks&&(x=T.audioTracks.filter(function(W){return!W.audioCodec||Object(S.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(y.assignTrackIdsByGroup)(x)),T.subtitles&&(b=T.subtitles,Object(y.assignTrackIdsByGroup)(b)),C.length>0){E=C[0].bitrate,C.sort(function(W,U){return W.bitrate-U.bitrate}),this._levels=C;for(var B=0;B<C.length;B++)if(C[B].bitrate===E){this._firstLevel=B,this.log("manifest loaded, "+C.length+" level(s) found, first bitrate: "+E);break}var H=P&&!I,F={levels:C,audioTracks:x,subtitleTracks:b,firstLevel:this._firstLevel,stats:T.stats,audio:P,video:I,altAudio:!H&&x.some(function(W){return!!W.url})};this.hls.trigger(O.Events.MANIFEST_PARSED,F),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(O.Events.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:T.url,reason:"no level with compatible codecs found in manifest"})},f.onError=function(m,T){if(i.prototype.onError.call(this,m,T),T.fatal)return;var C=T.context,x=this._levels[this.currentLevelIndex];if(C&&(C.type===u.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&C.groupId===x.audioGroupIds[x.urlId]||C.type===u.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&C.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var b=!1,E=!0,A;switch(T.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:if(T.frag){var v=this._levels[T.frag.level];v?(v.fragmentError++,v.fragmentError>this.hls.config.fragLoadingMaxRetry&&(A=T.frag.level)):A=T.frag.level}break;case c.ErrorDetails.LEVEL_LOAD_ERROR:case c.ErrorDetails.LEVEL_LOAD_TIMEOUT:C&&(C.deliveryDirectives&&(E=!1),A=C.level),b=!0;break;case c.ErrorDetails.REMUX_ALLOC_ERROR:A=T.level,b=!0;break}A!==void 0&&this.recoverLevel(T,A,b,E)},f.recoverLevel=function(m,T,C,x){var b=m.details,E=this._levels[T];if(E.loadError++,C){var A=this.retryLoadingOrFail(m);if(A)m.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var v=E.url.length;if(v>1&&E.loadError<v)m.levelRetry=!0,this.redundantFailover(T);else if(this.manualLevelIndex===-1){var M=T===0?this._levels.length-1:T-1;this.currentLevelIndex!==M&&this._levels[M].loadError===0&&(this.warn(b+": switch to "+M),m.levelRetry=!0,this.hls.nextAutoLevel=M)}}},f.redundantFailover=function(m){var T=this._levels[m],C=T.url.length;if(C>1){var x=(T.urlId+1)%C;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(b){b.urlId=x}),this.level=m}},f.onFragLoaded=function(m,T){var C=T.frag;if(C!==void 0&&C.type===u.PlaylistLevelType.MAIN){var x=this._levels[C.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},f.onLevelLoaded=function(m,T){var C,x=T.level,b=T.details,E=this._levels[x];if(!E){var A;this.warn("Invalid level index "+x),(A=T.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(b.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(E.fragmentError===0&&(E.loadError=0,this.retryCount=0),this.playlistLoaded(x,T,E.details)):(C=T.deliveryDirectives)!==null&&C!==void 0&&C.skip&&(b.deltaUpdateFailed=!0)},f.onAudioTrackSwitched=function(m,T){var C=this.hls.levels[this.currentLevelIndex];if(!C)return;if(C.audioGroupIds){for(var x=-1,b=this.hls.audioTracks[T.id].groupId,E=0;E<C.audioGroupIds.length;E++)if(C.audioGroupIds[E]===b){x=E;break}x!==C.urlId&&(C.urlId=x,this.startLoad())}},f.loadPlaylist=function(m){var T=this.currentLevelIndex,C=this._levels[T];if(this.canLoad&&C&&C.url.length>0){var x=C.urlId,b=C.url[x];if(m)try{b=m.addDirectives(b)}catch(E){this.warn("Could not construct new URL with HLS Delivery Directives: "+E)}this.log("Attempt loading level index "+T+(m?" at sn "+m.msn+" part "+m.part:"")+" with URL-id "+x+" "+b),this.clearTimer(),this.hls.trigger(O.Events.LEVEL_LOADING,{url:b,level:T,id:x,deliveryDirectives:m||null})}},f.removeLevel=function(m,T){var C=function(E,A){return A!==T},x=this._levels.filter(function(b,E){return E!==m?!0:b.url.length>1&&T!==void 0?(b.url=b.url.filter(C),b.audioGroupIds&&(b.audioGroupIds=b.audioGroupIds.filter(C)),b.textGroupIds&&(b.textGroupIds=b.textGroupIds.filter(C)),b.urlId=0,!0):!1}).map(function(b,E){var A=b.details;return A!=null&&A.fragments&&A.fragments.forEach(function(v){v.level=E}),b});this._levels=x,this.hls.trigger(O.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 T,C=this._levels;if(C.length===0)return;if(this.currentLevelIndex===m&&(T=C[m])!==null&&T!==void 0&&T.details)return;if(m<0||m>=C.length){var x=m<0;if(this.hls.trigger(O.Events.ERROR,{type:c.ErrorTypes.OTHER_ERROR,details:c.ErrorDetails.LEVEL_SWITCH_ERROR,level:m,fatal:x,reason:"invalid level idx"}),x)return;m=Math.min(m,C.length-1)}this.clearTimer();var b=this.currentLevelIndex,E=C[b],A=C[m];this.log("switching to level "+m+" from "+b),this.currentLevelIndex=m;var v=o({},A,{level:m,maxBitrate:A.maxBitrate,uri:A.uri,urlId:A.urlId});delete v._urlId,this.hls.trigger(O.Events.LEVEL_SWITCHING,v);var M=A.details;if(!M||M.live){var I=this.switchParams(A.uri,E==null?void 0:E.details);this.loadPlaylist(I)}}},{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(j,k,D){"use strict";D.r(k),D.d(k,"addGroupId",function(){return c}),D.d(k,"assignTrackIdsByGroup",function(){return S}),D.d(k,"updatePTS",function(){return y}),D.d(k,"updateFragPTSDTS",function(){return u}),D.d(k,"mergeDetails",function(){return o}),D.d(k,"mapPartIntersection",function(){return d}),D.d(k,"mapFragmentIntersection",function(){return s}),D.d(k,"adjustSliding",function(){return l}),D.d(k,"addSliding",function(){return r}),D.d(k,"computeReloadInterval",function(){return n}),D.d(k,"getFragmentWithSN",function(){return a}),D.d(k,"getPartWith",function(){return i});var R=D("./src/polyfills/number.ts"),O=D("./src/utils/logger.ts");function c(h,f,w){switch(f){case"audio":h.audioGroupIds||(h.audioGroupIds=[]),h.audioGroupIds.push(w);break;case"text":h.textGroupIds||(h.textGroupIds=[]),h.textGroupIds.push(w);break}}function S(h){var f={};h.forEach(function(w){var m=w.groupId||"";w.id=f[m]=f[m]||0,f[m]++})}function y(h,f,w){var m=h[f],T=h[w];p(m,T)}function p(h,f){var w=f.startPTS;if(Object(R.isFiniteNumber)(w)){var m=0,T;f.sn>h.sn?(m=w-h.start,T=h):(m=h.start-w,T=f),T.duration!==m&&(T.duration=m)}else if(f.sn>h.sn){var C=h.cc===f.cc;C&&h.minEndPTS?f.start=h.start+(h.minEndPTS-h.start):f.start=h.start+h.duration}else f.start=Math.max(h.start-f.duration,0)}function u(h,f,w,m,T,C){var x=m-w;x<=0&&(O.logger.warn("Fragment should have a positive duration",f),m=w+f.duration,C=T+f.duration);var b=w,E=m,A=f.startPTS,v=f.endPTS;if(Object(R.isFiniteNumber)(A)){var M=Math.abs(A-w);Object(R.isFiniteNumber)(f.deltaPTS)?f.deltaPTS=Math.max(M,f.deltaPTS):f.deltaPTS=M,b=Math.max(w,A),w=Math.min(w,A),T=Math.min(T,f.startDTS),E=Math.min(m,v),m=Math.max(m,v),C=Math.max(C,f.endDTS)}f.duration=m-w;var I=w-f.start;f.appendedPTS=m,f.start=f.startPTS=w,f.maxStartPTS=b,f.startDTS=T,f.endPTS=m,f.minEndPTS=E,f.endDTS=C;var P=f.sn;if(!h||P<h.startSN||P>h.endSN)return 0;var B,H=P-h.startSN,F=h.fragments;for(F[H]=f,B=H;B>0;B--)p(F[B],F[B-1]);for(B=H;B<F.length-1;B++)p(F[B],F[B+1]);return h.fragmentHint&&p(F[F.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,I}function o(h,f){for(var w=null,m=h.fragments,T=m.length-1;T>=0;T--){var C=m[T].initSegment;if(C){w=C;break}}h.fragmentHint&&delete h.fragmentHint.endPTS;var x=0,b;if(s(h,f,function(B,H){B.relurl&&(x=B.cc-H.cc),Object(R.isFiniteNumber)(B.startPTS)&&Object(R.isFiniteNumber)(B.endPTS)&&(H.start=H.startPTS=B.startPTS,H.startDTS=B.startDTS,H.appendedPTS=B.appendedPTS,H.maxStartPTS=B.maxStartPTS,H.endPTS=B.endPTS,H.endDTS=B.endDTS,H.minEndPTS=B.minEndPTS,H.duration=B.endPTS-B.startPTS,H.duration&&(b=H),f.PTSKnown=f.alignedSliding=!0),H.elementaryStreams=B.elementaryStreams,H.loader=B.loader,H.stats=B.stats,H.urlId=B.urlId,B.initSegment&&(H.initSegment=B.initSegment,w=B.initSegment)}),w){var E=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments;E.forEach(function(B){var H;(!B.initSegment||B.initSegment.relurl===((H=w)===null||H===void 0?void 0:H.relurl))&&(B.initSegment=w)})}if(f.skippedSegments&&(f.deltaUpdateFailed=f.fragments.some(function(B){return!B}),f.deltaUpdateFailed)){O.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var A=f.skippedSegments;A--;)f.fragments.shift();f.startSN=f.fragments[0].sn,f.startCC=f.fragments[0].cc}var v=f.fragments;if(x){O.logger.warn("discontinuity sliding from playlist, take drift into account");for(var M=0;M<v.length;M++)v[M].cc+=x}f.skippedSegments&&(f.startCC=f.fragments[0].cc),d(h.partList,f.partList,function(B,H){H.elementaryStreams=B.elementaryStreams,H.stats=B.stats}),b?u(f,b,b.startPTS,b.endPTS,b.startDTS,b.endDTS):l(h,f),v.length&&(f.totalduration=f.edge-v[0].start),f.driftStartTime=h.driftStartTime,f.driftStart=h.driftStart;var I=f.advancedDateTime;if(f.advanced&&I){var P=f.edge;f.driftStart||(f.driftStartTime=I,f.driftStart=P),f.driftEndTime=I,f.driftEnd=P}else f.driftEndTime=h.driftEndTime,f.driftEnd=h.driftEnd,f.advancedDateTime=h.advancedDateTime}function d(h,f,w){if(h&&f)for(var m=0,T=0,C=h.length;T<=C;T++){var x=h[T],b=f[T+m];x&&b&&x.index===b.index&&x.fragment.sn===b.fragment.sn?w(x,b):m--}}function s(h,f,w){for(var m=f.skippedSegments,T=Math.max(h.startSN,f.startSN)-f.startSN,C=(h.fragmentHint?1:0)+(m?f.endSN:Math.min(h.endSN,f.endSN))-f.startSN,x=f.startSN-h.startSN,b=f.fragmentHint?f.fragments.concat(f.fragmentHint):f.fragments,E=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,A=T;A<=C;A++){var v=E[x+A],M=b[A];m&&!M&&A<m&&(M=f.fragments[A]=v),v&&M&&w(v,M)}}function l(h,f){var w=f.startSN+f.skippedSegments-h.startSN,m=h.fragments;if(w<0||w>=m.length)return;r(f,m[w].start)}function r(h,f){if(f){for(var w=h.fragments,m=h.skippedSegments;m<w.length;m++)w[m].start+=f;h.fragmentHint&&(h.fragmentHint.start+=f)}}function n(h,f){var w=1e3*h.levelTargetDuration,m=w/2,T=h.age,C=T>0&&T<w*3,x=f.loading.end-f.loading.start,b,E=h.availabilityDelay;if(h.updated===!1)if(C){var A=333*h.misses;b=Math.max(Math.min(m,x*2),A),h.availabilityDelay=(h.availabilityDelay||0)+b}else b=m;else C?(E=Math.min(E||w/2,T),h.availabilityDelay=E,b=E+w-T):b=w-x;return Math.round(b)}function a(h,f,w){if(!h||!h.details)return null;var m=h.details,T=m.fragments[f-m.startSN];return T||(T=m.fragmentHint,T&&T.sn===f?T:f<m.startSN&&w&&w.sn===f?w:null)}function i(h,f,w){if(!h||!h.details)return null;var m=h.details.partList;if(m)for(var T=m.length;T--;){var C=m[T];if(C.index===w&&C.fragment.sn===f)return C}return null}},"./src/controller/stream-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return m});var R=D("./src/polyfills/number.ts"),O=D("./src/controller/base-stream-controller.ts"),c=D("./src/is-supported.ts"),S=D("./src/events.ts"),y=D("./src/utils/buffer-helper.ts"),p=D("./src/controller/fragment-tracker.ts"),u=D("./src/types/loader.ts"),o=D("./src/loader/fragment.ts"),d=D("./src/demux/transmuxer-interface.ts"),s=D("./src/types/transmuxer.ts"),l=D("./src/controller/gap-controller.ts"),r=D("./src/errors.ts"),n=D("./src/utils/logger.ts");function a(T,C){for(var x=0;x<C.length;x++){var b=C[x];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function i(T,C,x){return C&&a(T.prototype,C),x&&a(T,x),T}function h(T,C){T.prototype=Object.create(C.prototype),T.prototype.constructor=T,f(T,C)}function f(T,C){return f=Object.setPrototypeOf||function(b,E){return b.__proto__=E,b},f(T,C)}var w=100,m=function(T){h(C,T);function C(b,E){var A;return A=T.call(this,b,E,"[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=C.prototype;return x._registerListeners=function(){var E=this.hls;E.on(S.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.on(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.on(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.on(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.on(S.Events.LEVEL_LOADING,this.onLevelLoading,this),E.on(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.on(S.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.on(S.Events.ERROR,this.onError,this),E.on(S.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.on(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.on(S.Events.BUFFER_CREATED,this.onBufferCreated,this),E.on(S.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.on(S.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.on(S.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var E=this.hls;E.off(S.Events.MEDIA_ATTACHED,this.onMediaAttached,this),E.off(S.Events.MEDIA_DETACHING,this.onMediaDetaching,this),E.off(S.Events.MANIFEST_LOADING,this.onManifestLoading,this),E.off(S.Events.MANIFEST_PARSED,this.onManifestParsed,this),E.off(S.Events.LEVEL_LOADED,this.onLevelLoaded,this),E.off(S.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),E.off(S.Events.ERROR,this.onError,this),E.off(S.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),E.off(S.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),E.off(S.Events.BUFFER_CREATED,this.onBufferCreated,this),E.off(S.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),E.off(S.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),E.off(S.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(E){if(this.levels){var A=this.lastCurrentTime,v=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var M=v.startLevel;M===-1&&(v.config.testBandwidth?(M=0,this.bitrateTest=!0):M=v.nextAutoLevel),this.level=v.nextLoadLevel=M,this.loadedmetadata=!1}A>0&&E===-1&&(this.log("Override startPosition with lastCurrentTime @"+A.toFixed(3)),E=A),this.state=O.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=E,this.tick()}else this._forceStartLoad=!0,this.state=O.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,T.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case O.State.IDLE:this.doTickIdle();break;case O.State.WAITING_LEVEL:{var E,A=this.levels,v=this.level,M=A==null||((E=A[v])===null||E===void 0)?void 0:E.details;if(M&&(!M.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(M))break;this.state=O.State.IDLE;break}break}case O.State.FRAG_LOADING_WAITING_RETRY:{var I,P=self.performance.now(),B=this.retryDate;(!B||P>=B||(I=this.media)!==null&&I!==void 0&&I.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=O.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){T.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var E,A,v=this.hls,M=this.levelLastLoaded,I=this.levels,P=this.media,B=v.config,H=v.nextLoadLevel;if(M===null||!P&&(this.startFragRequested||!B.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!I||!I[H])return;var F=I[H];this.level=v.nextLoadLevel=H;var W=F.details;if(!W||this.state===O.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==H){this.state=O.State.WAITING_LEVEL;return}var U=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:P,u.PlaylistLevelType.MAIN);if(U===null)return;var K=U.len,z=this.getMaxBufferLength(F.maxBitrate);if(K>=z)return;if(this._streamEnded(U,W)){var te={};this.altAudio&&(te.type="video"),this.hls.trigger(S.Events.BUFFER_EOS,te),this.state=O.State.ENDED;return}var de=U.end,ge=this.getNextFragment(de,W);if(this.couldBacktrack&&!this.fragPrevious&&ge&&ge.sn!=="initSegment"){var Ue=ge.sn-W.startSN;Ue>1&&(ge=W.fragments[Ue-1],this.fragmentTracker.removeFragment(ge))}if(ge&&this.fragmentTracker.getState(ge)===p.FragmentState.OK&&this.nextLoadPosition>de){var Me=this.audioOnly&&!this.altAudio?o.ElementaryStreamTypes.AUDIO:o.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(P,Me,u.PlaylistLevelType.MAIN),ge=this.getNextFragment(this.nextLoadPosition,W)}if(!ge)return;ge.initSegment&&!ge.initSegment.data&&!this.bitrateTest&&(ge=ge.initSegment),((E=ge.decryptdata)===null||E===void 0?void 0:E.keyFormat)==="identity"&&!((A=ge.decryptdata)!==null&&A!==void 0&&A.key)?this.loadKey(ge,W):this.loadFragment(ge,W,de)},x.loadFragment=function(E,A,v){var M,I=this.fragmentTracker.getState(E);if(this.fragCurrent=E,I===p.FragmentState.BACKTRACKED){var P=this.fragmentTracker.getBacktrackData(E);if(P){this._handleFragmentLoadProgress(P),this._handleFragmentLoadComplete(P);return}else I=p.FragmentState.NOT_LOADED}I===p.FragmentState.NOT_LOADED||I===p.FragmentState.PARTIAL?E.sn==="initSegment"?this._loadInitSegment(E):this.bitrateTest?(E.bitrateTest=!0,this.log("Fragment "+E.sn+" of level "+E.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(E)):(this.startFragRequested=!0,T.prototype.loadFragment.call(this,E,A,v)):I===p.FragmentState.APPENDING?this.reduceMaxBufferLength(E.duration)&&this.fragmentTracker.removeFragment(E):((M=this.media)===null||M===void 0?void 0:M.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(E){var A=this.fragmentTracker.getAppendedFrag(E,u.PlaylistLevelType.MAIN);return A&&"fragment"in A?A.fragment:A},x.getBufferedFrag=function(E){return this.fragmentTracker.getBufferedFrag(E,u.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(E){return E?this.getBufferedFrag(E.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var E=this.levels,A=this.media;if(A!=null&&A.readyState){var v,M=this.getAppendedFrag(A.currentTime);if(M&&M.start>1&&this.flushMainBuffer(0,M.start-1),!A.paused&&E){var I=this.hls.nextLoadLevel,P=E[I],B=this.fragLastKbps;B&&this.fragCurrent?v=this.fragCurrent.duration*P.maxBitrate/(1e3*B)+1:v=0}else v=0;var H=this.getBufferedFrag(A.currentTime+v);if(H){var F=this.followingBufferedFrag(H);if(F){this.abortCurrentFrag();var W=F.maxStartPTS?F.maxStartPTS:F.start,U=F.duration,K=Math.max(H.end,W+Math.min(Math.max(U-this.config.maxFragLookUpTolerance,U*.5),U*.75));this.flushMainBuffer(K,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var E=this.fragCurrent;this.fragCurrent=null,E!=null&&E.loader&&E.loader.abort(),this.state===O.State.KEY_LOADING&&(this.state=O.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(E,A){T.prototype.flushMainBuffer.call(this,E,A,this.altAudio?"video":null)},x.onMediaAttached=function(E,A){T.prototype.onMediaAttached.call(this,E,A);var v=A.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),v.addEventListener("playing",this.onvplaying),v.addEventListener("seeked",this.onvseeked),this.gapController=new l.default(this.config,v,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var E=this.media;E&&(E.removeEventListener("playing",this.onvplaying),E.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),T.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var E=this.media,A=E?E.currentTime:null;Object(R.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(E,A){var v=!1,M=!1,I;A.levels.forEach(function(P){I=P.audioCodec,I&&(I.indexOf("mp4a.40.2")!==-1&&(v=!0),I.indexOf("mp4a.40.5")!==-1&&(M=!0))}),this.audioCodecSwitch=v&&M&&!Object(c.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(E,A){var v=this.levels;if(!v||this.state!==O.State.IDLE)return;var M=v[A.level];(!M.details||M.details.live&&this.levelLastLoaded!==A.level||this.waitForCdnTuneIn(M.details))&&(this.state=O.State.WAITING_LEVEL)},x.onLevelLoaded=function(E,A){var v,M=this.levels,I=A.level,P=A.details,B=P.totalduration;if(!M){this.warn("Levels were reset while loading level "+I);return}this.log("Level "+I+" loaded ["+P.startSN+","+P.endSN+"], cc ["+P.startCC+", "+P.endCC+"] duration:"+B);var H=this.fragCurrent;H&&(this.state===O.State.FRAG_LOADING||this.state===O.State.FRAG_LOADING_WAITING_RETRY)&&(H.level!==A.level&&H.loader&&(this.state=O.State.IDLE,H.loader.abort()));var F=M[I],W=0;if(P.live||(v=F.details)!==null&&v!==void 0&&v.live){if(P.fragments[0]||(P.deltaUpdateFailed=!0),P.deltaUpdateFailed)return;W=this.alignPlaylists(P,F.details)}if(F.details=P,this.levelLastLoaded=I,this.hls.trigger(S.Events.LEVEL_UPDATED,{details:P,level:I}),this.state===O.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(P))return;this.state=O.State.IDLE}this.startFragRequested?P.live&&this.synchronizeToLiveEdge(P):this.setStartPosition(P,W),this.tick()},x._handleFragmentLoadProgress=function(E){var A,v=E.frag,M=E.part,I=E.payload,P=this.levels;if(!P){this.warn("Levels were reset while fragment load was in progress. Fragment "+v.sn+" of level "+v.level+" will not be buffered");return}var B=P[v.level],H=B.details;if(!H){this.warn("Dropping fragment "+v.sn+" of level "+v.level+" after level details were reset");return}var F=B.videoCodec,W=H.PTSKnown||!H.live,U=(A=v.initSegment)===null||A===void 0?void 0:A.data,K=this._getAudioCodec(B),z=this.transmuxer=this.transmuxer||new d.default(this.hls,u.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),te=M?M.index:-1,de=te!==-1,ge=new s.ChunkMetadata(v.level,v.sn,v.stats.chunkCount,I.byteLength,te,de),Ue=this.initPTS[v.cc];z.push(I,U,K,F,v,M,H.totalduration,W,ge,Ue)},x.onAudioTrackSwitching=function(E,A){var v=this.altAudio,M=!!A.url,I=A.id;if(!M){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var P=this.fragCurrent;P!=null&&P.loader&&(this.log("Switching to main audio track, cancel main fragment load"),P.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var B=this.hls;v&&B.trigger(S.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),B.trigger(S.Events.AUDIO_TRACK_SWITCHED,{id:I})}},x.onAudioTrackSwitched=function(E,A){var v=A.id,M=!!this.hls.audioTracks[v].url;if(M){var I=this.videoBuffer;I&&this.mediaBuffer!==I&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=I)}this.altAudio=M,this.tick()},x.onBufferCreated=function(E,A){var v=A.tracks,M,I,P=!1;for(var B in v){var H=v[B];if(H.id==="main"){if(I=B,M=H,B==="video"){var F=v[B];F&&(this.videoBuffer=F.buffer)}}else P=!0}P&&M?(this.log("Alternate track found, use "+I+".buffered to schedule main fragment loading"),this.mediaBuffer=M.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(E,A){var v=A.frag,M=A.part;if(v&&v.type!==u.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(v)){this.warn("Fragment "+v.sn+(M?" p: "+M.index:"")+" of level "+v.level+" finished buffering, but was aborted. state: "+this.state),this.state===O.State.PARSED&&(this.state=O.State.IDLE);return}var I=M?M.stats:v.stats;this.fragLastKbps=Math.round(8*I.total/(I.buffering.end-I.loading.first)),v.sn!=="initSegment"&&(this.fragPrevious=v),this.fragBufferedComplete(v,M)},x.onError=function(E,A){switch(A.details){case r.ErrorDetails.FRAG_LOAD_ERROR:case r.ErrorDetails.FRAG_LOAD_TIMEOUT:case r.ErrorDetails.KEY_LOAD_ERROR:case r.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.MAIN,A);break;case r.ErrorDetails.LEVEL_LOAD_ERROR:case r.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==O.State.ERROR&&(A.fatal?(this.warn(""+A.details),this.state=O.State.ERROR):!A.levelRetry&&this.state===O.State.WAITING_LEVEL&&(this.state=O.State.IDLE));break;case r.ErrorDetails.BUFFER_FULL_ERROR:if(A.parent==="main"&&(this.state===O.State.PARSING||this.state===O.State.PARSED)){var v=!0,M=this.getFwdBufferInfo(this.media,u.PlaylistLevelType.MAIN);M&&M.len>.5&&(v=!this.reduceMaxBufferLength(M.len)),v&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var E=this.media,A=this.gapController;if(!E||!A||!E.readyState)return;var v=y.BufferHelper.getBuffered(E);!this.loadedmetadata&&v.length?(this.loadedmetadata=!0,this.seekToStartPos()):A.poll(this.lastCurrentTime),this.lastCurrentTime=E.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=O.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(E,A){var v=A.type;if(v!==o.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var M=(v===o.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(M,v,u.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(E,A){this.levels=A.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var E=this.media,A=E.currentTime,v=this.startPosition;if(v>=0&&A<v){if(E.seeking){n.logger.log("could not seek to "+v+", already seeking at "+A);return}var M=y.BufferHelper.getBuffered(E),I=M.length?M.start(0):0,P=I-v;P>0&&(P<this.config.maxBufferHole||P<this.config.maxFragLookUpTolerance)&&(n.logger.log("adjusting start position by "+P+" to match buffer start"),v+=P,this.startPosition=v),this.log("seek to target start position "+v+" from current time "+A),E.currentTime=v}},x._getAudioCodec=function(E){var A=this.config.defaultAudioCodec||E.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(E){var A=this;this._doFragLoad(E).then(function(v){var M=A.hls;if(!v||M.nextLoadLevel||A.fragContextChanged(E))return;A.fragLoadError=0,A.state=O.State.IDLE,A.startFragRequested=!1,A.bitrateTest=!1;var I=E.stats;I.parsing.start=I.parsing.end=I.buffering.start=I.buffering.end=self.performance.now(),M.trigger(S.Events.FRAG_LOADED,v)})},x._handleTransmuxComplete=function(E){var A,v="main",M=this.hls,I=E.remuxResult,P=E.chunkMeta,B=this.getCurrentContext(P);if(!B){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var H=B.frag,F=B.part,W=B.level,U=I.video,K=I.text,z=I.id3,te=I.initSegment,de=this.altAudio?void 0:I.audio;if(this.fragContextChanged(H))return;if(this.state=O.State.PARSING,te){te.tracks&&(this._bufferInitSegment(W,te.tracks,H,P),M.trigger(S.Events.FRAG_PARSING_INIT_SEGMENT,{frag:H,id:v,tracks:te.tracks}));var ge=te.initPTS,Ue=te.timescale;Object(R.isFiniteNumber)(ge)&&(this.initPTS[H.cc]=ge,M.trigger(S.Events.INIT_PTS_FOUND,{frag:H,id:v,initPTS:ge,timescale:Ue}))}if(U&&I.independent!==!1){if(W.details){var Me=U.startPTS,Le=U.endPTS,Oe=U.startDTS,Fe=U.endDTS;if(F)F.elementaryStreams[U.type]={startPTS:Me,endPTS:Le,startDTS:Oe,endDTS:Fe};else if(U.firstKeyFrame&&U.independent&&(this.couldBacktrack=!0),U.dropped&&U.independent){var ye=this.getLoadPosition()+this.config.maxBufferHole;if(ye<Me){this.backtrack(H);return}H.setElementaryStreamInfo(U.type,H.start,Le,H.start,Fe,!0)}H.setElementaryStreamInfo(U.type,Me,Le,Oe,Fe),this.bufferFragmentData(U,H,F,P)}}else if(I.independent===!1){this.backtrack(H);return}if(de){var Ae=de.startPTS,re=de.endPTS,pe=de.startDTS,ue=de.endDTS;F&&(F.elementaryStreams[o.ElementaryStreamTypes.AUDIO]={startPTS:Ae,endPTS:re,startDTS:pe,endDTS:ue}),H.setElementaryStreamInfo(o.ElementaryStreamTypes.AUDIO,Ae,re,pe,ue),this.bufferFragmentData(de,H,F,P)}if(z!=null&&(A=z.samples)!==null&&A!==void 0&&A.length){var Ie={frag:H,id:v,samples:z.samples};M.trigger(S.Events.FRAG_PARSING_METADATA,Ie)}if(K){var Ke={frag:H,id:v,samples:K.samples};M.trigger(S.Events.FRAG_PARSING_USERDATA,Ke)}},x._bufferInitSegment=function(E,A,v,M){var I=this;if(this.state!==O.State.PARSING)return;this.audioOnly=!!A.audio&&!A.video,this.altAudio&&!this.audioOnly&&delete A.audio;var P=A.audio,B=A.video,H=A.audiovideo;if(P){var F=E.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(F&&(F.indexOf("mp4a.40.5")!==-1?F="mp4a.40.2":F="mp4a.40.5"),P.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(F="mp4a.40.5")),W.indexOf("android")!==-1&&P.container!=="audio/mpeg"&&(F="mp4a.40.2",this.log("Android: force audio codec to "+F)),E.audioCodec&&E.audioCodec!==F&&this.log('Swapping manifest audio codec "'+E.audioCodec+'" for "'+F+'"'),P.levelCodec=F,P.id="main",this.log("Init audio buffer, container:"+P.container+", codecs[selected/level/parsed]=["+(F||"")+"/"+(E.audioCodec||"")+"/"+P.codec+"]")}B&&(B.levelCodec=E.videoCodec,B.id="main",this.log("Init video buffer, container:"+B.container+", codecs[level/parsed]=["+(E.videoCodec||"")+"/"+B.codec+"]")),H&&this.log("Init audiovideo buffer, container:"+H.container+", codecs[level/parsed]=["+(E.attrs.CODECS||"")+"/"+H.codec+"]"),this.hls.trigger(S.Events.BUFFER_CODECS,A),Object.keys(A).forEach(function(U){var K=A[U],z=K.initSegment;z!=null&&z.byteLength&&I.hls.trigger(S.Events.BUFFER_APPENDING,{type:U,data:z,frag:v,part:null,chunkMeta:M,parent:v.type})}),this.tick()},x.backtrack=function(E){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(E);var A=this.fragmentTracker.backtrack(E);this.fragPrevious=null,this.nextLoadPosition=E.start,A?this.resetFragmentLoading(E):this.state=O.State.BACKTRACKING},x.checkFragmentChanged=function(){var E=this.media,A=null;if(E&&E.readyState>1&&E.seeking===!1){var v=E.currentTime;if(y.BufferHelper.isBuffered(E,v)?A=this.getAppendedFrag(v):y.BufferHelper.isBuffered(E,v+.1)&&(A=this.getAppendedFrag(v+.1)),A){var M=this.fragPlaying,I=A.level;(!M||A.sn!==M.sn||M.level!==I||A.urlId!==M.urlId)&&(this.hls.trigger(S.Events.FRAG_CHANGED,{frag:A}),(!M||M.level!==I)&&this.hls.trigger(S.Events.LEVEL_SWITCHED,{level:I}),this.fragPlaying=A)}}},i(C,[{key:"nextLevel",get:function(){var E=this.nextBufferedFrag;return E?E.level:-1}},{key:"currentLevel",get:function(){var E=this.media;if(E){var A=this.getAppendedFrag(E.currentTime);if(A)return A.level}return-1}},{key:"nextBufferedFrag",get:function(){var E=this.media;if(E){var A=this.getAppendedFrag(E.currentTime);return this.followingBufferedFrag(A)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),C}(O.default)},"./src/controller/subtitle-stream-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"SubtitleStreamController",function(){return h});var R=D("./src/events.ts"),O=D("./src/utils/logger.ts"),c=D("./src/utils/buffer-helper.ts"),S=D("./src/controller/fragment-finders.ts"),y=D("./src/utils/discontinuities.ts"),p=D("./src/controller/level-helper.ts"),u=D("./src/controller/fragment-tracker.ts"),o=D("./src/controller/base-stream-controller.ts"),d=D("./src/types/loader.ts"),s=D("./src/types/level.ts");function l(f,w){for(var m=0;m<w.length;m++){var T=w[m];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(f,T.key,T)}}function r(f,w,m){return w&&l(f.prototype,w),m&&l(f,m),f}function n(f,w){f.prototype=Object.create(w.prototype),f.prototype.constructor=f,a(f,w)}function a(f,w){return a=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},a(f,w)}var i=500,h=function(f){n(w,f);function w(T,C){var x;return x=f.call(this,T,C,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var m=w.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var C=this.hls;C.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.on(R.Events.ERROR,this.onError,this),C.on(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.on(R.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.on(R.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.on(R.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.on(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var C=this.hls;C.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),C.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),C.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),C.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),C.off(R.Events.ERROR,this.onError,this),C.off(R.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),C.off(R.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),C.off(R.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),C.off(R.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),C.off(R.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=o.State.IDLE,this.setInterval(i),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(C,x){this.mainDetails=x.details},m.onSubtitleFragProcessed=function(C,x){var b=x.frag,E=x.success;if(this.fragPrevious=b,this.state=o.State.IDLE,!E)return;var A=this.tracksBuffered[this.currentTrackId];if(!A)return;for(var v,M=b.start,I=0;I<A.length;I++)if(M>=A[I].start&&M<=A[I].end){v=A[I];break}var P=b.start+b.duration;v?v.end=P:(v={start:M,end:P},A.push(v)),this.fragmentTracker.fragBuffered(b)},m.onBufferFlushing=function(C,x){var b=x.startOffset,E=x.endOffset;if(b===0&&E!==Number.POSITIVE_INFINITY){var A=this.currentTrackId,v=this.levels;if(!v.length||!v[A]||!v[A].details)return;var M=v[A].details,I=M.targetduration,P=E-I;if(P<=0)return;x.endOffsetSubtitles=Math.max(0,P),this.tracksBuffered.forEach(function(B){for(var H=0;H<B.length;){if(B[H].end<=P){B.shift();continue}else if(B[H].start<P)B[H].start=P;else break;H++}}),this.fragmentTracker.removeFragmentsInRange(b,P,d.PlaylistLevelType.SUBTITLE)}},m.onError=function(C,x){var b,E=x.frag;if(!E||E.type!==d.PlaylistLevelType.SUBTITLE)return;(b=this.fragCurrent)!==null&&b!==void 0&&b.loader&&this.fragCurrent.loader.abort(),this.state=o.State.IDLE},m.onSubtitleTracksUpdated=function(C,x){var b=this,E=x.subtitleTracks;this.tracksBuffered=[],this.levels=E.map(function(A){return new s.Level(A)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(A){b.tracksBuffered[A.id]=[]}),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(C,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var b=this.levels[this.currentTrackId];b!=null&&b.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,b&&this.setInterval(i)},m.onSubtitleTrackLoaded=function(C,x){var b,E=x.details,A=x.id,v=this.currentTrackId,M=this.levels;if(!M.length)return;var I=M[v];if(A>=M.length||A!==v||!I)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,E.live||(b=I.details)!==null&&b!==void 0&&b.live){var P=this.mainDetails;if(E.deltaUpdateFailed||!P)return;var B=P.fragments[0];if(!I.details)E.hasProgramDateTime&&P.hasProgramDateTime?Object(y.alignMediaPlaylistByPDT)(E,P):B&&Object(p.addSliding)(E,B.start);else{var H=this.alignPlaylists(E,I.details);H===0&&B&&Object(p.addSliding)(E,B.start)}}if(I.details=E,this.levelLastLoaded=A,this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===o.State.IDLE){var F=Object(S.findFragmentByPTS)(null,E.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),I.details=void 0)}},m._handleFragmentLoadComplete=function(C){var x=C.frag,b=C.payload,E=x.decryptdata,A=this.hls;if(this.fragContextChanged(x))return;if(b&&b.byteLength>0&&E&&E.key&&E.iv&&E.method==="AES-128"){var v=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(b),E.key.buffer,E.iv.buffer).then(function(M){var I=performance.now();A.trigger(R.Events.FRAG_DECRYPTED,{frag:x,payload:M,stats:{tstart:v,tdecrypt:I}})})}},m.doTick=function(){if(!this.media){this.state=o.State.IDLE;return}if(this.state===o.State.IDLE){var C,x=this.currentTrackId,b=this.levels;if(!b.length||!b[x]||!b[x].details)return;var E=b[x].details,A=E.targetduration,v=this.config,M=this.media,I=c.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,M.currentTime-A,v.maxBufferHole),P=I.end,B=I.len,H=this.getMaxBufferLength()+A;if(B>H)return;console.assert(E,"Subtitle track details are defined on idle subtitle stream controller tick");var F=E.fragments,W=F.length,U=E.edge,K,z=this.fragPrevious;if(P<U){var te=v.maxFragLookUpTolerance;z&&E.hasProgramDateTime&&(K=Object(S.findFragmentByPDT)(F,z.endProgramDateTime,te)),K||(K=Object(S.findFragmentByPTS)(z,F,P,te),!K&&z&&z.start<F[0].start&&(K=F[0]))}else K=F[W-1];(C=K)!==null&&C!==void 0&&C.encrypted?(O.logger.log("Loading key for "+K.sn),this.state=o.State.KEY_LOADING,this.hls.trigger(R.Events.KEY_LOADING,{frag:K})):K&&this.fragmentTracker.getState(K)===u.FragmentState.NOT_LOADED&&this.loadFragment(K,E,P)}},m.loadFragment=function(C,x,b){this.fragCurrent=C,f.prototype.loadFragment.call(this,C,x,b)},r(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(o.default)},"./src/controller/subtitle-track-controller.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/events.ts"),O=D("./src/utils/texttrack-utils.ts"),c=D("./src/controller/base-playlist-controller.ts"),S=D("./src/types/loader.ts");function y(l,r){for(var n=0;n<r.length;n++){var a=r[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(l,a.key,a)}}function p(l,r,n){return r&&y(l.prototype,r),n&&y(l,n),l}function u(l,r){l.prototype=Object.create(r.prototype),l.prototype.constructor=l,o(l,r)}function o(l,r){return o=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},o(l,r)}var d=function(l){u(r,l);function r(a){var i;return i=l.call(this,a,"[subtitle-track-controller]")||this,i.media=null,i.tracks=[],i.groupId=null,i.tracksInGroup=[],i.trackId=-1,i.selectDefaultTrack=!0,i.queuedDefaultTrack=-1,i.trackChangeListener=function(){return i.onTextTracksChanged()},i.asyncPollTrackChange=function(){return i.pollTrackChange(0)},i.useTextTrackPolling=!1,i.subtitlePollingInterval=-1,i.subtitleDisplay=!0,i.registerListeners(),i}var n=r.prototype;return n.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,l.prototype.destroy.call(this)},n.registerListeners=function(){var i=this.hls;i.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.on(R.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(R.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.on(R.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.on(R.Events.ERROR,this.onError,this)},n.unregisterListeners=function(){var i=this.hls;i.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),i.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),i.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(R.Events.MANIFEST_PARSED,this.onManifestParsed,this),i.off(R.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(R.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),i.off(R.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),i.off(R.Events.ERROR,this.onError,this)},n.onMediaAttached=function(i,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)},n.pollTrackChange=function(i){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,i)},n.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 i=s(this.media.textTracks);i.forEach(function(h){Object(O.clearCurrentCues)(h)}),this.subtitleTrack=-1,this.media=null},n.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},n.onManifestParsed=function(i,h){this.tracks=h.subtitleTracks},n.onSubtitleTrackLoaded=function(i,h){var f=h.id,w=h.details,m=this.trackId,T=this.tracksInGroup[m];if(!T){this.warn("Invalid subtitle track id "+f);return}var C=T.details;T.details=h.details,this.log("subtitle track "+f+" loaded ["+w.startSN+"-"+w.endSN+"]"),f===this.trackId&&(this.retryCount=0,this.playlistLoaded(f,h,C))},n.onLevelLoading=function(i,h){this.switchLevel(h.level)},n.onLevelSwitching=function(i,h){this.switchLevel(h.level)},n.switchLevel=function(i){var h=this.hls.levels[i];if(!(h!=null&&h.textGroupIds))return;var f=h.textGroupIds[h.urlId];if(this.groupId!==f){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,m=this.tracks.filter(function(x){return!f||x.groupId===f});this.tracksInGroup=m;var T=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=f;var C={subtitleTracks:m};this.log("Updating subtitle tracks, "+m.length+' track(s) found in "'+f+'" group-id'),this.hls.trigger(R.Events.SUBTITLE_TRACKS_UPDATED,C),T!==-1&&this.setSubtitleTrack(T,w)}},n.findTrackId=function(i){for(var h=this.tracksInGroup,f=0;f<h.length;f++){var w=h[f];if((!this.selectDefaultTrack||w.default)&&(!i||i===w.name))return w.id}return-1},n.onError=function(i,h){if(l.prototype.onError.call(this,i,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)},n.loadPlaylist=function(i){var h=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(h)){var f=h.id,w=h.groupId,m=h.url;if(i)try{m=i.addDirectives(m)}catch(T){this.warn("Could not construct new URL with HLS Delivery Directives: "+T)}this.log("Loading subtitle playlist for id "+f),this.hls.trigger(R.Events.SUBTITLE_TRACK_LOADING,{url:m,id:f,groupId:w,deliveryDirectives:i||null})}},n.toggleTrackModes=function(i){var h=this,f=this.media,w=this.subtitleDisplay,m=this.trackId;if(!f)return;var T=s(f.textTracks),C=T.filter(function(E){return E.groupId===h.groupId});if(i===-1)[].slice.call(T).forEach(function(E){E.mode="disabled"});else{var x=C[m];x&&(x.mode="disabled")}var b=C[i];b&&(b.mode=w?"showing":"hidden")},n.setSubtitleTrack=function(i,h){var f,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=i;return}if(this.trackId!==i&&this.toggleTrackModes(i),this.trackId===i&&(i===-1||(f=w[i])!==null&&f!==void 0&&f.details)||i<-1||i>=w.length)return;this.clearTimer();var m=w[i];if(this.log("Switching to subtitle track "+i),this.trackId=i,m){var T=m.id,C=m.groupId,x=C===void 0?"":C,b=m.name,E=m.type,A=m.url;this.hls.trigger(R.Events.SUBTITLE_TRACK_SWITCH,{id:T,groupId:x,name:b,type:E,url:A});var v=this.switchParams(m.url,h==null?void 0:h.details);this.loadPlaylist(v)}else this.hls.trigger(R.Events.SUBTITLE_TRACK_SWITCH,{id:i})},n.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var i=-1,h=s(this.media.textTracks),f=0;f<h.length;f++)if(h[f].mode==="hidden")i=f;else if(h[f].mode==="showing"){i=f;break}this.subtitleTrack!==i&&(this.subtitleTrack=i)},p(r,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(i){this.selectDefaultTrack=!1;var h=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(i,h)}}]),r}(c.default);function s(l){for(var r=[],n=0;n<l.length;n++){var a=l[n];a.kind==="subtitles"&&a.label&&r.push(l[n])}return r}k.default=d},"./src/controller/timeline-controller.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"TimelineController",function(){return s});var R=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),c=D("./src/utils/cea-608-parser.ts"),S=D("./src/utils/output-filter.ts"),y=D("./src/utils/webvtt-parser.ts"),p=D("./src/utils/texttrack-utils.ts"),u=D("./src/utils/imsc1-ttml-parser.ts"),o=D("./src/types/loader.ts"),d=D("./src/utils/logger.ts"),s=function(){function a(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=n(),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 f=new S.default(this,"textTrack1"),w=new S.default(this,"textTrack2"),m=new S.default(this,"textTrack3"),T=new S.default(this,"textTrack4");this.cea608Parser1=new c.default(1,f,w),this.cea608Parser2=new c.default(3,m,T)}h.on(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.on(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.on(O.Events.FRAG_LOADING,this.onFragLoading,this),h.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.on(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.on(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var i=a.prototype;return i.destroy=function(){var f=this.hls;f.off(O.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),f.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),f.off(O.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(O.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),f.off(O.Events.FRAG_LOADING,this.onFragLoading,this),f.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(O.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),f.off(O.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),f.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),f.off(O.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),f.off(O.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},i.addCues=function(f,w,m,T,C){for(var x=!1,b=C.length;b--;){var E=C[b],A=r(E[0],E[1],w,m);if(A>=0&&(E[0]=Math.min(E[0],w),E[1]=Math.max(E[1],m),x=!0,A/(m-w)>.5))return}if(x||C.push([w,m]),this.config.renderTextTracksNatively){var v=this.captionsTracks[f];this.Cues.newCue(v,w,m,T)}else{var M=this.Cues.newCue(null,w,m,T);this.hls.trigger(O.Events.CUES_PARSED,{type:"captions",cues:M,track:f})}},i.onInitPtsFound=function(f,w){var m=this,T=w.frag,C=w.id,x=w.initPTS,b=w.timescale,E=this.unparsedVttFrags;C==="main"&&(this.initPTS[T.cc]=x,this.timescale[T.cc]=b),E.length&&(this.unparsedVttFrags=[],E.forEach(function(A){m.onFragLoaded(O.Events.FRAG_LOADED,A)}))},i.getExistingTrack=function(f){var w=this.media;if(w)for(var m=0;m<w.textTracks.length;m++){var T=w.textTracks[m];if(T[f])return T}return null},i.createCaptionsTrack=function(f){this.config.renderTextTracksNatively?this.createNativeTrack(f):this.createNonNativeTrack(f)},i.createNativeTrack=function(f){if(this.captionsTracks[f])return;var w=this.captionsProperties,m=this.captionsTracks,T=this.media,C=w[f],x=C.label,b=C.languageCode,E=this.getExistingTrack(f);if(E)m[f]=E,Object(p.clearCurrentCues)(m[f]),Object(p.sendAddTrackEvent)(m[f],T);else{var A=this.createTextTrack("captions",x,b);A&&(A[f]=!0,m[f]=A)}},i.createNonNativeTrack=function(f){if(this.nonNativeCaptionsTracks[f])return;var w=this.captionsProperties[f];if(!w)return;var m=w.label,T={_id:f,label:m,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[f]=T,this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[T]})},i.createTextTrack=function(f,w,m){var T=this.media;return T?T.addTextTrack(f,w,m):void 0},i.onMediaAttaching=function(f,w){this.media=w.media,this._cleanTracks()},i.onMediaDetaching=function(){var f=this.captionsTracks;Object.keys(f).forEach(function(w){Object(p.clearCurrentCues)(f[w]),delete f[w]}),this.nonNativeCaptionsTracks={}},i.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=n(),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())},i._cleanTracks=function(){var f=this.media;if(!f)return;var w=f.textTracks;if(w)for(var m=0;m<w.length;m++)Object(p.clearCurrentCues)(w[m])},i.onSubtitleTracksUpdated=function(f,w){var m=this;this.textTracks=[];var T=w.subtitleTracks||[],C=T.some(function(A){return A.textCodec===u.IMSC1_CODEC});if(this.config.enableWebVTT||C&&this.config.enableIMSC1){var x=this.tracks&&T&&this.tracks.length===T.length;if(this.tracks=T||[],this.config.renderTextTracksNatively){var b=this.media?this.media.textTracks:[];this.tracks.forEach(function(A,v){var M;if(v<b.length){for(var I=null,P=0;P<b.length;P++)if(l(b[P],A)){I=b[P];break}I&&(M=I)}M?Object(p.clearCurrentCues)(M):(M=m.createTextTrack("subtitles",A.name,A.lang),M&&(M.mode="disabled")),M&&(M.groupId=A.groupId,m.textTracks.push(M))})}else if(!x&&this.tracks&&this.tracks.length){var E=this.tracks.map(function(A){return{label:A.name,kind:A.type.toLowerCase(),default:A.default,subtitleTrack:A}});this.hls.trigger(O.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:E})}}},i.onManifestLoaded=function(f,w){var m=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(T){var C=/(?:CC|SERVICE)([1-4])/.exec(T.instreamId);if(!C)return;var x="textTrack"+C[1],b=m.captionsProperties[x];if(!b)return;b.label=T.name,T.lang&&(b.languageCode=T.lang),b.media=T})},i.onFragLoading=function(f,w){var m=this.cea608Parser1,T=this.cea608Parser2,C=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(m&&T))return;if(w.frag.type===o.PlaylistLevelType.MAIN){var b,E,A=w.frag.sn,v=(b=w==null||((E=w.part)===null||E===void 0)?void 0:E.index)!=null?b:-1;A===C+1||A===C&&v===x+1||(m.reset(),T.reset()),this.lastSn=A,this.lastPartIndex=v}},i.onFragLoaded=function(f,w){var m=w.frag,T=w.payload,C=this.initPTS,x=this.unparsedVttFrags;if(m.type===o.PlaylistLevelType.SUBTITLE)if(T.byteLength){if(!Object(R.isFiniteNumber)(C[m.cc])){x.push(w),C.length&&this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Missing initial subtitle PTS")});return}var b=m.decryptdata;if(b==null||b.key==null||b.method!=="AES-128"){var E=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),E&&E.textCodec===u.IMSC1_CODEC?this._parseIMSC1(m,T):this._parseVTTs(m,T,A)}}else this.hls.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:m,error:new Error("Empty subtitle payload")})},i._parseIMSC1=function(f,w){var m=this,T=this.hls;Object(u.parseIMSC1)(w,this.initPTS[f.cc],this.timescale[f.cc],function(C){m._appendCues(C,f.level),T.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(C){d.logger.log("Failed to parse IMSC1: "+C),T.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:C})})},i._parseVTTs=function(f,w,m){var T=this,C=this.hls;Object(y.parseWebVTT)(w,this.initPTS[f.cc],this.timescale[f.cc],m,f.cc,f.start,function(x){T._appendCues(x,f.level),C.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:f})},function(x){T._fallbackToIMSC1(f,w),d.logger.log("Failed to parse VTT cue: "+x),C.trigger(O.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:x})})},i._fallbackToIMSC1=function(f,w){var m=this,T=this.tracks[f.level];T.textCodec||Object(u.parseIMSC1)(w,this.initPTS[f.cc],this.timescale[f.cc],function(){T.textCodec=u.IMSC1_CODEC,m._parseIMSC1(f,w)},function(){T.textCodec="wvtt"})},i._appendCues=function(f,w){var m=this.hls;if(this.config.renderTextTracksNatively){var T=this.textTracks[w];if(T.mode==="disabled")return;f.forEach(function(b){return Object(p.addCueToTrack)(T,b)})}else{var C=this.tracks[w],x=C.default?"default":"subtitles"+w;m.trigger(O.Events.CUES_PARSED,{type:"subtitles",cues:f,track:x})}},i.onFragDecrypted=function(f,w){var m=w.frag;if(m.type===o.PlaylistLevelType.SUBTITLE){if(!Object(R.isFiniteNumber)(this.initPTS[m.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(O.Events.FRAG_LOADED,w)}},i.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},i.onFragParsingUserdata=function(f,w){var m=this.cea608Parser1,T=this.cea608Parser2;if(!this.enabled||!(m&&T))return;for(var C=0;C<w.samples.length;C++){var x=w.samples[C].bytes;if(x){var b=this.extractCea608Data(x);m.addData(w.samples[C].pts,b[0]),T.addData(w.samples[C].pts,b[1])}}},i.onBufferFlushing=function(f,w){var m=w.startOffset,T=w.endOffset,C=w.endOffsetSubtitles,x=w.type,b=this.media;if(!b||b.currentTime<T)return;if(!x||x==="video"){var E=this.captionsTracks;Object.keys(E).forEach(function(v){return Object(p.removeCuesInRange)(E[v],m,T)})}if(this.config.renderTextTracksNatively&&(m===0&&C!==void 0)){var A=this.textTracks;Object.keys(A).forEach(function(v){return Object(p.removeCuesInRange)(A[v],m,C)})}},i.extractCea608Data=function(f){for(var w=f[0]&31,m=2,T=[[],[]],C=0;C<w;C++){var x=f[m++],b=127&f[m++],E=127&f[m++],A=(4&x)!==0,v=3&x;if(b===0&&E===0)continue;A&&((v===0||v===1)&&(T[v].push(b),T[v].push(E)))}return T},a}();function l(a,i){return a&&a.label===i.name&&!(a.textTrack1||a.textTrack2)}function r(a,i,h,f){return Math.min(i,f)-Math.max(a,h)}function n(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return R});var R=function(){function O(S,y){this.subtle=void 0,this.aesIV=void 0,this.subtle=S,this.aesIV=y}var c=O.prototype;return c.decrypt=function(y,p){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},p,y)},O}()},"./src/crypt/aes-decryptor.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"removePadding",function(){return O}),D.d(k,"default",function(){return c});var R=D("./src/utils/typed-array.ts");function O(S){var y=S.byteLength,p=y&&new DataView(S.buffer).getUint8(y-1);return p?Object(R.sliceUint8)(S,0,y-p):S}var c=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 y=S.prototype;return y.uint8ArrayToUint32Array_=function(u){for(var o=new DataView(u),d=new Uint32Array(4),s=0;s<4;s++)d[s]=o.getUint32(s*4);return d},y.initTable=function(){var u=this.sBox,o=this.invSBox,d=this.subMix,s=d[0],l=d[1],r=d[2],n=d[3],a=this.invSubMix,i=a[0],h=a[1],f=a[2],w=a[3],m=new Uint32Array(256),T=0,C=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 b=C^C<<1^C<<2^C<<3^C<<4;b=b>>>8^b&255^99,u[T]=b,o[b]=T;var E=m[T],A=m[E],v=m[A],M=m[b]*257^b*16843008;s[T]=M<<24|M>>>8,l[T]=M<<16|M>>>16,r[T]=M<<8|M>>>24,n[T]=M,M=v*16843009^A*65537^E*257^T*16843008,i[b]=M<<24|M>>>8,h[b]=M<<16|M>>>16,f[b]=M<<8|M>>>24,w[b]=M,T?(T=E^m[m[m[v^E]]],C^=m[m[C]]):T=C=1}},y.expandKey=function(u){for(var o=this.uint8ArrayToUint32Array_(u),d=!0,s=0;s<o.length&&d;)d=o[s]===this.key[s],s++;if(d)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 r=this.ksRows=(l+6+1)*4,n,a,i=this.keySchedule=new Uint32Array(r),h=this.invKeySchedule=new Uint32Array(r),f=this.sBox,w=this.rcon,m=this.invSubMix,T=m[0],C=m[1],x=m[2],b=m[3],E,A;for(n=0;n<r;n++){if(n<l){E=i[n]=o[n];continue}A=E,n%l===0?(A=A<<8|A>>>24,A=f[A>>>24]<<24|f[A>>>16&255]<<16|f[A>>>8&255]<<8|f[A&255],A^=w[n/l|0]<<24):l>6&&n%l===4&&(A=f[A>>>24]<<24|f[A>>>16&255]<<16|f[A>>>8&255]<<8|f[A&255]),i[n]=E=(i[n-l]^A)>>>0}for(a=0;a<r;a++)n=r-a,a&3?A=i[n]:A=i[n-4],a<4||n<=4?h[a]=A:h[a]=T[f[A>>>24]]^C[f[A>>>16&255]]^x[f[A>>>8&255]]^b[f[A&255]],h[a]=h[a]>>>0},y.networkToHostOrderSwap=function(u){return u<<24|(u&65280)<<8|(u&16711680)>>8|u>>>24},y.decrypt=function(u,o,d){for(var s=this.keySize+6,l=this.invKeySchedule,r=this.invSBox,n=this.invSubMix,a=n[0],i=n[1],h=n[2],f=n[3],w=this.uint8ArrayToUint32Array_(d),m=w[0],T=w[1],C=w[2],x=w[3],b=new Int32Array(u),E=new Int32Array(b.length),A,v,M,I,P,B,H,F,W,U,K,z,te,de,ge=this.networkToHostOrderSwap;o<b.length;){for(W=ge(b[o]),U=ge(b[o+1]),K=ge(b[o+2]),z=ge(b[o+3]),P=W^l[0],B=z^l[1],H=K^l[2],F=U^l[3],te=4,de=1;de<s;de++)A=a[P>>>24]^i[B>>16&255]^h[H>>8&255]^f[F&255]^l[te],v=a[B>>>24]^i[H>>16&255]^h[F>>8&255]^f[P&255]^l[te+1],M=a[H>>>24]^i[F>>16&255]^h[P>>8&255]^f[B&255]^l[te+2],I=a[F>>>24]^i[P>>16&255]^h[B>>8&255]^f[H&255]^l[te+3],P=A,B=v,H=M,F=I,te=te+4;A=r[P>>>24]<<24^r[B>>16&255]<<16^r[H>>8&255]<<8^r[F&255]^l[te],v=r[B>>>24]<<24^r[H>>16&255]<<16^r[F>>8&255]<<8^r[P&255]^l[te+1],M=r[H>>>24]<<24^r[F>>16&255]<<16^r[P>>8&255]<<8^r[B&255]^l[te+2],I=r[F>>>24]<<24^r[P>>16&255]<<16^r[B>>8&255]<<8^r[H&255]^l[te+3],E[o]=ge(A^m),E[o+1]=ge(I^T),E[o+2]=ge(M^C),E[o+3]=ge(v^x),m=W,T=U,C=K,x=z,o=o+4}return E.buffer},S}()},"./src/crypt/decrypter.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return o});var R=D("./src/crypt/aes-crypto.ts"),O=D("./src/crypt/fast-aes-key.ts"),c=D("./src/crypt/aes-decryptor.ts"),S=D("./src/utils/logger.ts"),y=D("./src/utils/mp4-tools.ts"),p=D("./src/utils/typed-array.ts"),u=16,o=function(){function d(l,r,n){var a=n===void 0?{}:n,i=a.removePKCS7Padding,h=i===void 0?!0:i;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=r,this.removePKCS7Padding=h,h)try{var f=self.crypto;f&&(this.subtle=f.subtle||f.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var s=d.prototype;return s.destroy=function(){this.observer=null},s.isSync=function(){return this.config.enableSoftwareAES},s.flush=function(){var r=this.currentResult;if(!r){this.reset();return}var n=new Uint8Array(r);return this.reset(),this.removePKCS7Padding?Object(c.removePadding)(n):n},s.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},s.decrypt=function(r,n,a,i){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(r),n,a);var h=this.flush();h&&i(h.buffer)}else this.webCryptoDecrypt(new Uint8Array(r),n,a).then(i)},s.softwareDecrypt=function(r,n,a){var i=this.currentIV,h=this.currentResult,f=this.remainderData;this.logOnce("JS AES decrypt"),f&&(r=Object(y.appendUint8Array)(f,r),this.remainderData=null);var w=this.getValidChunk(r);if(!w.length)return null;i&&(a=i);var m=this.softwareDecrypter;m||(m=this.softwareDecrypter=new c.default),m.expandKey(n);var T=h;return this.currentResult=m.decrypt(w.buffer,0,a),this.currentIV=Object(p.sliceUint8)(w,-16).buffer,T||null},s.webCryptoDecrypt=function(r,n,a){var i=this,h=this.subtle;return(this.key!==n||!this.fastAesKey)&&(this.key=n,this.fastAesKey=new O.default(h,n)),this.fastAesKey.expandKey().then(function(f){if(!h)return Promise.reject(new Error("web crypto not initialized"));var w=new R.default(h,a);return w.decrypt(r.buffer,f)}).catch(function(f){return i.onWebCryptoError(f,r,n,a)})},s.onWebCryptoError=function(r,n,a,i){return S.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",r),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(n,a,i)},s.getValidChunk=function(r){var n=r,a=r.length-r.length%u;return a!==r.length&&(n=Object(p.sliceUint8)(r,0,a),this.remainderData=Object(p.sliceUint8)(r,a)),n},s.logOnce=function(r){if(!this.logEnabled)return;S.logger.log("[decrypter.ts]: "+r),this.logEnabled=!1},d}()},"./src/crypt/fast-aes-key.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return R});var R=function(){function O(S,y){this.subtle=void 0,this.key=void 0,this.subtle=S,this.key=y}var c=O.prototype;return c.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},O}()},"./src/demux/aacdemuxer.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/demux/base-audio-demuxer.ts"),O=D("./src/demux/adts.ts"),c=D("./src/utils/logger.ts"),S=D("./src/demux/id3.ts");function y(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,p(o,d)}function p(o,d){return p=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},p(o,d)}var u=function(o){y(d,o);function d(l,r){var n;return n=o.call(this)||this,n.observer=void 0,n.config=void 0,n.observer=l,n.config=r,n}var s=d.prototype;return s.resetInitSegment=function(r,n,a){o.prototype.resetInitSegment.call(this,r,n,a),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},d.probe=function(r){if(!r)return!1;for(var n=S.getID3Data(r,0)||[],a=n.length,i=r.length;a<i;a++)if(O.probe(r,a))return c.logger.log("ADTS sync word found !"),!0;return!1},s.canParse=function(r,n){return O.canParse(r,n)},s.appendFrame=function(r,n,a){O.initTrackConfig(r,this.observer,n,a,r.manifestCodec);var i=O.appendFrame(r,n,a,this.initPTS,this.frameIndex);if(i&&i.missing===0)return i},d}(R.default);u.minProbeByteLength=9,k.default=u},"./src/demux/adts.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"getAudioConfig",function(){return S}),D.d(k,"isHeaderPattern",function(){return y}),D.d(k,"getHeaderLength",function(){return p}),D.d(k,"getFullFrameLength",function(){return u}),D.d(k,"canGetFrameLength",function(){return o}),D.d(k,"isHeader",function(){return d}),D.d(k,"canParse",function(){return s}),D.d(k,"probe",function(){return l}),D.d(k,"initTrackConfig",function(){return r}),D.d(k,"getFrameDuration",function(){return n}),D.d(k,"parseFrameHeader",function(){return a}),D.d(k,"appendFrame",function(){return i});var R=D("./src/utils/logger.ts"),O=D("./src/errors.ts"),c=D("./src/events.ts");function S(h,f,w,m){var T,C,x,b,E=navigator.userAgent.toLowerCase(),A=m,v=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];T=((f[w+2]&192)>>>6)+1;var M=(f[w+2]&60)>>>2;if(M>v.length-1){h.trigger(c.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+M});return}return x=(f[w+2]&1)<<2,x|=(f[w+3]&192)>>>6,R.logger.log("manifest codec:"+m+", ADTS type:"+T+", samplingIndex:"+M),/firefox/i.test(E)?M>=6?(T=5,b=new Array(4),C=M-3):(T=2,b=new Array(2),C=M):E.indexOf("android")!==-1?(T=2,b=new Array(2),C=M):(T=5,b=new Array(4),m&&(m.indexOf("mp4a.40.29")!==-1||m.indexOf("mp4a.40.5")!==-1)||!m&&M>=6?C=M-3:((m&&m.indexOf("mp4a.40.2")!==-1&&(M>=6&&x===1||/vivaldi/i.test(E))||!m&&x===1)&&(T=2,b=new Array(2)),C=M)),b[0]=T<<3,b[0]|=(M&14)>>1,b[1]|=(M&1)<<7,b[1]|=x<<3,T===5&&(b[1]|=(C&14)>>1,b[2]=(C&1)<<7,b[2]|=2<<2,b[3]=0),{config:b,samplerate:v[M],channelCount:x,codec:"mp4a.40."+T,manifestCodec:A}}function y(h,f){return h[f]===255&&(h[f+1]&246)===240}function p(h,f){return h[f+1]&1?7:9}function u(h,f){return(h[f+3]&3)<<11|h[f+4]<<3|(h[f+5]&224)>>>5}function o(h,f){return f+5<h.length}function d(h,f){return f+1<h.length&&y(h,f)}function s(h,f){return o(h,f)&&y(h,f)&&u(h,f)<=h.length-f}function l(h,f){if(d(h,f)){var w=p(h,f);if(f+w>=h.length)return!1;var m=u(h,f);if(m<=w)return!1;var T=f+m;return T===h.length||d(h,T)}return!1}function r(h,f,w,m,T){if(!h.samplerate){var C=S(f,w,m,T);if(!C)return;h.config=C.config,h.samplerate=C.samplerate,h.channelCount=C.channelCount,h.codec=C.codec,h.manifestCodec=C.manifestCodec,R.logger.log("parsed codec:"+h.codec+", rate:"+C.samplerate+", channels:"+C.channelCount)}}function n(h){return 1024*9e4/h}function a(h,f,w,m,T){var C=p(h,f),x=u(h,f);if(x-=C,x>0){var b=w+m*T;return{headerLength:C,frameLength:x,stamp:b}}}function i(h,f,w,m,T){var C=n(h.samplerate),x=a(f,w,m,T,C);if(x){var b=x.frameLength,E=x.headerLength,A=x.stamp,v=E+b,M=Math.max(0,w+v-f.length),I;M?(I=new Uint8Array(v-E),I.set(f.subarray(w+E,f.length),0)):I=f.subarray(w+E,w+v);var P={unit:I,pts:A};return M||h.samples.push(P),{sample:P,length:v,missing:M}}}},"./src/demux/base-audio-demuxer.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"initPTSFn",function(){return u});var R=D("./src/polyfills/number.ts"),O=D("./src/demux/id3.ts"),c=D("./src/demux/dummy-demuxed-track.ts"),S=D("./src/utils/mp4-tools.ts"),y=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 d=o.prototype;return d.resetInitSegment=function(l,r,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},d.resetTimeStamp=function(){},d.resetContiguity=function(){},d.canParse=function(l,r){return!1},d.appendFrame=function(l,r,n){},d.demux=function(l,r){this.cachedData&&(l=Object(S.appendUint8Array)(this.cachedData,l),this.cachedData=null);var n=O.getID3Data(l,0),a=n?n.length:0,i,h,f=this._audioTrack,w=this._id3Track,m=n?O.getTimeStamp(n):void 0,T=l.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=u(m,r)),n&&n.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:n}),h=this.initPTS;a<T;){if(this.canParse(l,a)){var C=this.appendFrame(f,l,a);C?(this.frameIndex++,h=C.sample.pts,a+=C.length,i=a):a=T}else O.canParse(l,a)?(n=O.getID3Data(l,a),w.samples.push({pts:h,dts:h,data:n}),a+=n.length,i=a):a++;if(a===T&&i!==T){var x=Object(y.sliceUint8)(l,i);this.cachedData?this.cachedData=Object(S.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:f,avcTrack:Object(c.dummyTrack)(),id3Track:w,textTrack:Object(c.dummyTrack)()}},d.demuxSampleAes=function(l,r,n){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},d.flush=function(l){var r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(c.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(c.dummyTrack)()}},d.destroy=function(){},o}(),u=function(d,s){return Object(R.isFiniteNumber)(d)?d*90:s*9e4};k.default=p},"./src/demux/chunk-cache.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return R});var R=function(){function c(){this.chunks=[],this.dataLength=0}var S=c.prototype;return S.push=function(p){this.chunks.push(p),this.dataLength+=p.length},S.flush=function(){var p=this.chunks,u=this.dataLength,o;if(p.length)p.length===1?o=p[0]:o=O(p,u);else return new Uint8Array(0);return this.reset(),o},S.reset=function(){this.chunks.length=0,this.dataLength=0},c}();function O(c,S){for(var y=new Uint8Array(S),p=0,u=0;u<c.length;u++){var o=c[u];y.set(o,p),p+=o.length}return y}},"./src/demux/dummy-demuxed-track.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"dummyTrack",function(){return R});function R(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/utils/logger.ts"),O=function(){function c(y){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=y,this.bytesAvailable=y.byteLength,this.word=0,this.bitsAvailable=0}var S=c.prototype;return S.loadWord=function(){var p=this.data,u=this.bytesAvailable,o=p.byteLength-u,d=new Uint8Array(4),s=Math.min(4,u);if(s===0)throw new Error("no bytes available");d.set(p.subarray(o,o+s)),this.word=new DataView(d.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s},S.skipBits=function(p){var u;this.bitsAvailable>p?(this.word<<=p,this.bitsAvailable-=p):(p-=this.bitsAvailable,u=p>>3,p-=u>>3,this.bytesAvailable-=u,this.loadWord(),this.word<<=p,this.bitsAvailable-=p)},S.readBits=function(p){var u=Math.min(this.bitsAvailable,p),o=this.word>>>32-u;return p>32&&R.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=u,this.bitsAvailable>0?this.word<<=u:this.bytesAvailable>0&&this.loadWord(),u=p-u,u>0&&this.bitsAvailable?o<<u|this.readBits(u):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 u=8,o=8,d,s=0;s<p;s++)o!==0&&(d=this.readEG(),o=(u+d+256)%256),u=o===0?u:o},S.readSPS=function(){var p=0,u=0,o=0,d=0,s,l,r,n=this.readUByte.bind(this),a=this.readBits.bind(this),i=this.readUEG.bind(this),h=this.readBoolean.bind(this),f=this.skipBits.bind(this),w=this.skipEG.bind(this),m=this.skipUEG.bind(this),T=this.skipScalingList.bind(this);n();var C=n();if(a(5),f(3),n(),m(),C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128){var x=i();if(x===3&&f(1),m(),m(),f(1),h())for(l=x!==3?8:12,r=0;r<l;r++)h()&&(r<6?T(16):T(64))}m();var b=i();if(b===0)i();else if(b===1)for(f(1),w(),w(),s=i(),r=0;r<s;r++)w();m(),f(1);var E=i(),A=i(),v=a(1);v===0&&f(1),f(1),h()&&(p=i(),u=i(),o=i(),d=i());var M=[1,1];if(h()&&h()){var I=n();switch(I){case 1:M=[1,1];break;case 2:M=[12,11];break;case 3:M=[10,11];break;case 4:M=[16,11];break;case 5:M=[40,33];break;case 6:M=[24,11];break;case 7:M=[20,11];break;case 8:M=[32,11];break;case 9:M=[80,33];break;case 10:M=[18,11];break;case 11:M=[15,11];break;case 12:M=[64,33];break;case 13:M=[160,99];break;case 14:M=[4,3];break;case 15:M=[3,2];break;case 16:M=[2,1];break;case 255:{M=[n()<<8|n(),n()<<8|n()];break}}}return{width:Math.ceil((E+1)*16-p*2-u*2),height:(2-v)*(A+1)*16-(v?2:4)*(o+d),pixelRatio:M}},S.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},c}();k.default=O},"./src/demux/id3.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"isHeader",function(){return R}),D.d(k,"isFooter",function(){return O}),D.d(k,"getID3Data",function(){return c}),D.d(k,"canParse",function(){return y}),D.d(k,"getTimeStamp",function(){return p}),D.d(k,"isTimeStampFrame",function(){return u}),D.d(k,"getID3Frames",function(){return d}),D.d(k,"decodeFrame",function(){return s}),D.d(k,"utf8ArrayToStr",function(){return i}),D.d(k,"testables",function(){return h});var R=function(T,C){return C+10<=T.length&&(T[C]===73&&T[C+1]===68&&T[C+2]===51&&(T[C+3]<255&&T[C+4]<255&&(T[C+6]<128&&T[C+7]<128&&T[C+8]<128&&T[C+9]<128)))},O=function(T,C){return C+10<=T.length&&(T[C]===51&&T[C+1]===68&&T[C+2]===73&&(T[C+3]<255&&T[C+4]<255&&(T[C+6]<128&&T[C+7]<128&&T[C+8]<128&&T[C+9]<128)))},c=function(T,C){for(var x=C,b=0;R(T,C);){b+=10;var E=S(T,C+6);b+=E,O(T,C+10)&&(b+=10),C+=b}return b>0?T.subarray(x,x+b):void 0},S=function(T,C){var x=0;return x=(T[C]&127)<<21,x|=(T[C+1]&127)<<14,x|=(T[C+2]&127)<<7,x|=T[C+3]&127,x},y=function(T,C){return R(T,C)&&S(T,C+6)+10<=T.length-C},p=function(T){for(var C=d(T),x=0;x<C.length;x++){var b=C[x];if(u(b))return a(b)}return},u=function(T){return T&&T.key==="PRIV"&&T.info==="com.apple.streaming.transportStreamTimestamp"},o=function(T){var C=String.fromCharCode(T[0],T[1],T[2],T[3]),x=S(T,4),b=10;return{type:C,size:x,data:T.subarray(b,b+x)}},d=function(T){for(var C=0,x=[];R(T,C);){var b=S(T,C+6);C+=10;for(var E=C+b;C+8<E;){var A=o(T.subarray(C)),v=s(A);v&&x.push(v),C+=A.size+10}O(T,C)&&(C+=10)}return x},s=function(T){return T.type==="PRIV"?l(T):T.type[0]==="W"?n(T):r(T)},l=function(T){if(T.size<2)return;var C=i(T.data,!0),x=new Uint8Array(T.data.subarray(C.length+1));return{key:T.type,info:C,data:x.buffer}},r=function(T){if(T.size<2)return;if(T.type==="TXXX"){var C=1,x=i(T.data.subarray(C),!0);C+=x.length+1;var b=i(T.data.subarray(C));return{key:T.type,info:x,data:b}}var E=i(T.data.subarray(1));return{key:T.type,data:E}},n=function(T){if(T.type==="WXXX"){if(T.size<2)return;var C=1,x=i(T.data.subarray(C),!0);C+=x.length+1;var b=i(T.data.subarray(C));return{key:T.type,info:x,data:b}}var E=i(T.data);return{key:T.type,data:E}},a=function(T){if(T.data.byteLength===8){var C=new Uint8Array(T.data),x=C[3]&1,b=(C[4]<<23)+(C[5]<<15)+(C[6]<<7)+C[7];return b/=45,x&&(b+=4772185884e-2),Math.round(b)}return},i=function(T,C){C===void 0&&(C=!1);var x=w();if(x){var b=x.decode(T);if(C){var E=b.indexOf("\0");return E!==-1?b.substring(0,E):b}return b.replace(/\0/g,"")}for(var A=T.length,v,M,I,P="",B=0;B<A;){if(v=T[B++],v===0&&C)return P;if(v===0||v===3)continue;switch(v>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:P+=String.fromCharCode(v);break;case 12:case 13:M=T[B++],P+=String.fromCharCode((v&31)<<6|M&63);break;case 14:M=T[B++],I=T[B++],P+=String.fromCharCode((v&15)<<12|(M&63)<<6|(I&63)<<0);break;default:}}return P},h={decodeTextFrame:r},f;function w(){return!f&&typeof self.TextDecoder!="undefined"&&(f=new self.TextDecoder("utf-8")),f}},"./src/demux/mp3demuxer.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/demux/base-audio-demuxer.ts"),O=D("./src/demux/id3.ts"),c=D("./src/utils/logger.ts"),S=D("./src/demux/mpegaudio.ts");function y(o,d){o.prototype=Object.create(d.prototype),o.prototype.constructor=o,p(o,d)}function p(o,d){return p=Object.setPrototypeOf||function(l,r){return l.__proto__=r,l},p(o,d)}var u=function(o){y(d,o);function d(){return o.apply(this,arguments)||this}var s=d.prototype;return s.resetInitSegment=function(r,n,a){o.prototype.resetInitSegment.call(this,r,n,a),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:r,duration:a,inputTimeScale:9e4,dropped:0}},d.probe=function(r){if(!r)return!1;for(var n=O.getID3Data(r,0)||[],a=n.length,i=r.length;a<i;a++)if(S.probe(r,a))return c.logger.log("MPEG Audio sync word found !"),!0;return!1},s.canParse=function(r,n){return S.canParse(r,n)},s.appendFrame=function(r,n,a){return this.initPTS===null?void 0:S.appendFrame(r,n,a,this.initPTS,this.frameIndex)},d}(R.default);u.minProbeByteLength=4,k.default=u},"./src/demux/mp4demuxer.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/utils/mp4-tools.ts"),O=D("./src/demux/dummy-demuxed-track.ts"),c=function(){function S(p,u){this.remainderData=null,this.config=void 0,this.config=u}var y=S.prototype;return y.resetTimeStamp=function(){},y.resetInitSegment=function(){},y.resetContiguity=function(){},S.probe=function(u){return Object(R.findBox)({data:u,start:0,end:Math.min(u.length,16384)},["moof"]).length>0},y.demux=function(u){var o=u,d=Object(O.dummyTrack)();if(this.config.progressive){this.remainderData&&(o=Object(R.appendUint8Array)(this.remainderData,u));var s=Object(R.segmentValidRange)(o);this.remainderData=s.remainder,d.samples=s.valid||new Uint8Array}else d.samples=o;return{audioTrack:Object(O.dummyTrack)(),avcTrack:d,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},y.flush=function(){var u=Object(O.dummyTrack)();return u.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(O.dummyTrack)(),avcTrack:u,id3Track:Object(O.dummyTrack)(),textTrack:Object(O.dummyTrack)()}},y.demuxSampleAes=function(u,o,d){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},y.destroy=function(){},S}();c.minProbeByteLength=1024,k.default=c},"./src/demux/mpegaudio.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"appendFrame",function(){return p}),D.d(k,"parseHeader",function(){return u}),D.d(k,"isHeaderPattern",function(){return o}),D.d(k,"isHeader",function(){return d}),D.d(k,"canParse",function(){return s}),D.d(k,"probe",function(){return l});var R=null,O=[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],c=[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]],y=[0,1,1,4];function p(r,n,a,i,h){if(a+24>n.length)return;var f=u(n,a);if(f&&a+f.frameLength<=n.length){var w=f.samplesPerFrame*9e4/f.sampleRate,m=i+h*w,T={unit:n.subarray(a,a+f.frameLength),pts:m,dts:m};return r.config=[],r.channelCount=f.channelCount,r.samplerate=f.sampleRate,r.samples.push(T),{sample:T,length:f.frameLength,missing:0}}}function u(r,n){var a=r[n+1]>>3&3,i=r[n+1]>>1&3,h=r[n+2]>>4&15,f=r[n+2]>>2&3;if(a!==1&&h!==0&&h!==15&&f!==3){var w=r[n+2]>>1&1,m=r[n+3]>>6,T=a===3?3-i:i===3?3:4,C=O[T*14+h-1]*1e3,x=a===3?0:a===2?1:2,b=c[x*3+f],E=m===3?1:2,A=S[a][i],v=y[i],M=A*8*v,I=Math.floor(A*C/b+w)*v;if(R===null){var P=navigator.userAgent||"",B=P.match(/Chrome\/(\d+)/i);R=B?parseInt(B[1]):0}var H=!!R&&R<=87;return H&&i===2&&C>=224e3&&m===0&&(r[n+3]=r[n+3]|128),{sampleRate:b,channelCount:E,frameLength:I,samplesPerFrame:M}}}function o(r,n){return r[n]===255&&(r[n+1]&224)===224&&(r[n+1]&6)!==0}function d(r,n){return n+1<r.length&&o(r,n)}function s(r,n){var a=4;return o(r,n)&&a<=r.length-n}function l(r,n){if(n+1<r.length&&o(r,n)){var a=4,i=u(r,n),h=a;i!=null&&i.frameLength&&(h=i.frameLength);var f=n+h;return f===r.length||d(r,f)}return!1}},"./src/demux/sample-aes.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/crypt/decrypter.ts"),O=D("./src/demux/tsdemuxer.ts"),c=function(){function S(p,u,o){this.keyData=void 0,this.decrypter=void 0,this.keyData=o,this.decrypter=new R.default(p,u,{removePKCS7Padding:!1})}var y=S.prototype;return y.decryptBuffer=function(u,o){this.decrypter.decrypt(u,this.keyData.key.buffer,this.keyData.iv.buffer,o)},y.decryptAacSample=function(u,o,d,s){var l=u[o].unit,r=l.subarray(16,l.length-l.length%16),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.length),a=this;this.decryptBuffer(n,function(i){var h=new Uint8Array(i);l.set(h,16),s||a.decryptAacSamples(u,o+1,d)})},y.decryptAacSamples=function(u,o,d){for(;;o++){if(o>=u.length){d();return}if(u[o].unit.length<32)continue;var s=this.decrypter.isSync();if(this.decryptAacSample(u,o,d,s),!s)return}},y.getAvcEncryptedData=function(u){for(var o=Math.floor((u.length-48)/160)*16+16,d=new Int8Array(o),s=0,l=32;l<=u.length-16;l+=160,s+=16)d.set(u.subarray(l,l+16),s);return d},y.getAvcDecryptedUnit=function(u,o){for(var d=new Uint8Array(o),s=0,l=32;l<=u.length-16;l+=160,s+=16)u.set(d.subarray(s,s+16),l);return u},y.decryptAvcSample=function(u,o,d,s,l,r){var n=Object(O.discardEPB)(l.data),a=this.getAvcEncryptedData(n),i=this;this.decryptBuffer(a.buffer,function(h){l.data=i.getAvcDecryptedUnit(n,h),r||i.decryptAvcSamples(u,o,d+1,s)})},y.decryptAvcSamples=function(u,o,d,s){if(u instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;o++,d=0){if(o>=u.length){s();return}for(var l=u[o].units;!(d>=l.length);d++){var r=l[d];if(r.data.length<=48||r.type!==1&&r.type!==5)continue;var n=this.decrypter.isSync();if(this.decryptAvcSample(u,o,d,s,r,n),!n)return}}},S}();k.default=c},"./src/demux/transmuxer-interface.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return l});var R=D("./node_modules/webworkify-webpack/index.js"),O=D.n(R),c=D("./src/events.ts"),S=D("./src/demux/transmuxer.ts"),y=D("./src/utils/logger.ts"),p=D("./src/errors.ts"),u=D("./src/utils/mediasource-helper.ts"),o=D("./node_modules/eventemitter3/index.js"),d=D.n(o),s=Object(u.getMediaSource)()||{isTypeSupported:function(){return!1}},l=function(){function r(a,i,h,f){var w=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=a,this.id=i,this.onTransmuxComplete=h,this.onFlush=f;var m=a.config,T=function(A,v){v=v||{},v.frag=w.frag,v.id=w.id,a.trigger(A,v)};this.observer=new o.EventEmitter,this.observer.on(c.Events.FRAG_DECRYPTED,T),this.observer.on(c.Events.ERROR,T);var C={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"){y.logger.log("demuxing in webworker");var b;try{b=this.worker=R("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),b.addEventListener("message",this.onwmsg),b.onerror=function(E){a.trigger(c.Events.ERROR,{type:p.ErrorTypes.OTHER_ERROR,details:p.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(E.message+" ("+E.filename+":"+E.lineno+")")})},b.postMessage({cmd:"init",typeSupported:C,vendor:x,id:i,config:JSON.stringify(m)})}catch(E){y.logger.warn("Error in worker:",E),y.logger.error("Error while initializing DemuxerWorker, fallback to inline"),b&&self.URL.revokeObjectURL(b.objectURL),this.transmuxer=new S.default(this.observer,C,m,x,i),this.worker=null}}else this.transmuxer=new S.default(this.observer,C,m,x,i)}var n=r.prototype;return n.destroy=function(){var i=this.worker;if(i)i.removeEventListener("message",this.onwmsg),i.terminate(),this.worker=null;else{var h=this.transmuxer;h&&(h.destroy(),this.transmuxer=null)}var f=this.observer;f&&f.removeAllListeners(),this.observer=null},n.push=function(i,h,f,w,m,T,C,x,b,E){var A=this;b.transmuxing.start=self.performance.now();var v=this.transmuxer,M=this.worker,I=T?T.start:m.start,P=m.decryptdata,B=this.frag,H=!(B&&m.cc===B.cc),F=!(B&&b.level===B.level),W=B?b.sn-B.sn:-1,U=this.part?b.part-this.part.index:1,K=!F&&(W===1||W===0&&U===1),z=self.performance.now();(F||W||m.stats.parsing.start===0)&&(m.stats.parsing.start=z),T&&(U||!K)&&(T.stats.parsing.start=z);var te=new S.TransmuxState(H,K,x,F,I);if(!K||H){y.logger.log("[transmuxer-interface, "+m.type+"]: Starting new transmux session for sn: "+b.sn+" p: "+b.part+" level: "+b.level+" id: "+b.id+`
|
|
|
discontinuity: `+H+`
|
|
|
trackSwitch: `+F+`
|
|
|
contiguous: `+K+`
|
|
|
accurateTimeOffset: `+x+`
|
|
|
timeOffset: `+I);var de=new S.TransmuxConfig(f,w,h,C,E);this.configureTransmuxer(de)}if(this.frag=m,this.part=T,M)M.postMessage({cmd:"demux",data:i,decryptdata:P,chunkMeta:b,state:te},i instanceof ArrayBuffer?[i]:[]);else if(v){var ge=v.push(i,P,b,te);Object(S.isPromise)(ge)?ge.then(function(Ue){A.handleTransmuxComplete(Ue)}):this.handleTransmuxComplete(ge)}},n.flush=function(i){var h=this;i.transmuxing.start=self.performance.now();var f=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:i});else if(f){var m=f.flush(i);Object(S.isPromise)(m)?m.then(function(T){h.handleFlushResult(T,i)}):this.handleFlushResult(m,i)}},n.handleFlushResult=function(i,h){var f=this;i.forEach(function(w){f.handleTransmuxComplete(w)}),this.onFlush(h)},n.onWorkerMessage=function(i){var h=i.data,f=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,f.trigger(h.event,h.data);break}}},n.configureTransmuxer=function(i){var h=this.worker,f=this.transmuxer;h?h.postMessage({cmd:"configure",config:i}):f&&f.configure(i)},n.handleTransmuxComplete=function(i){i.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(i)},r}()},"./src/demux/transmuxer-worker.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return p});var R=D("./src/demux/transmuxer.ts"),O=D("./src/events.ts"),c=D("./src/utils/logger.ts"),S=D("./node_modules/eventemitter3/index.js"),y=D.n(S);function p(l){var r=new S.EventEmitter,n=function(i,h){l.postMessage({event:i,data:h})};r.on(O.Events.FRAG_DECRYPTED,n),r.on(O.Events.ERROR,n),l.addEventListener("message",function(a){var i=a.data;switch(i.cmd){case"init":{var h=JSON.parse(i.config);l.transmuxer=new R.default(r,i.typeSupported,h,i.vendor,i.id),Object(c.enableLogs)(h.debug),n("init",null);break}case"configure":{l.transmuxer.configure(i.config);break}case"demux":{var f=l.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Object(R.isPromise)(f)?f.then(function(T){u(l,T)}):u(l,f);break}case"flush":{var w=i.chunkMeta,m=l.transmuxer.flush(w);Object(R.isPromise)(m)?m.then(function(T){d(l,T,w)}):d(l,m,w);break}default:break}})}function u(l,r){if(s(r.remuxResult))return;var n=[],a=r.remuxResult,i=a.audio,h=a.video;i&&o(n,i),h&&o(n,h),l.postMessage({event:"transmuxComplete",data:r},n)}function o(l,r){r.data1&&l.push(r.data1.buffer),r.data2&&l.push(r.data2.buffer)}function d(l,r,n){r.forEach(function(a){u(l,a)}),l.postMessage({event:"flush",data:n})}function s(l){return!l.audio&&!l.video&&!l.text&&!l.id3&&!l.initSegment}},"./src/demux/transmuxer.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return h}),D.d(k,"isPromise",function(){return m}),D.d(k,"TransmuxConfig",function(){return T}),D.d(k,"TransmuxState",function(){return C});var R=D("./src/events.ts"),O=D("./src/errors.ts"),c=D("./src/crypt/decrypter.ts"),S=D("./src/demux/aacdemuxer.ts"),y=D("./src/demux/mp4demuxer.ts"),p=D("./src/demux/tsdemuxer.ts"),u=D("./src/demux/mp3demuxer.ts"),o=D("./src/remux/mp4-remuxer.ts"),d=D("./src/remux/passthrough-remuxer.ts"),s=D("./src/demux/chunk-cache.ts"),l=D("./src/utils/mp4-tools.ts"),r=D("./src/utils/logger.ts"),n;try{n=self.performance.now.bind(self.performance)}catch(x){r.logger.debug("Unable to use Performance API on this environment"),n=self.Date.now}var a=[{demux:p.default,remux:o.default},{demux:y.default,remux:d.default},{demux:S.default,remux:o.default},{demux:u.default,remux:o.default}],i=1024;a.forEach(function(x){var b=x.demux;i=Math.max(i,b.minProbeByteLength)});var h=function(){function x(E,A,v,M,I){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=E,this.typeSupported=A,this.config=v,this.vendor=M,this.id=I}var b=x.prototype;return b.configure=function(A){this.transmuxConfig=A,this.decrypter&&this.decrypter.reset()},b.push=function(A,v,M,I){var P=this,B=M.transmuxing;B.executeStart=n();var H=new Uint8Array(A),F=this.cache,W=this.config,U=this.currentTransmuxState,K=this.transmuxConfig;I&&(this.currentTransmuxState=I);var z=f(H,v);if(z&&z.method==="AES-128"){var te=this.getDecrypter();if(W.enableSoftwareAES){var de=te.softwareDecrypt(H,z.key.buffer,z.iv.buffer);if(!de)return B.executeEnd=n(),w(M);H=new Uint8Array(de)}else return this.decryptionPromise=te.webCryptoDecrypt(H,z.key.buffer,z.iv.buffer).then(function(je){var Ge=P.push(je,null,M);return P.decryptionPromise=null,Ge}),this.decryptionPromise}var ge=I||U,Ue=ge.contiguous,Me=ge.discontinuity,Le=ge.trackSwitch,Oe=ge.accurateTimeOffset,Fe=ge.timeOffset,ye=K.audioCodec,Ae=K.videoCodec,re=K.defaultInitPts,pe=K.duration,ue=K.initSegmentData;if((Me||Le)&&this.resetInitSegment(ue,ye,Ae,pe),Me&&this.resetInitialTimestamp(re),Ue||this.resetContiguity(),this.needsProbing(H,Me,Le)){if(F.dataLength){var Ie=F.flush();H=Object(l.appendUint8Array)(Ie,H)}this.configureTransmuxer(H,K)}var Ke=this.transmux(H,z,Fe,Oe,M),Ne=this.currentTransmuxState;return Ne.contiguous=!0,Ne.discontinuity=!1,Ne.trackSwitch=!1,B.executeEnd=n(),Ke},b.flush=function(A){var v=this,M=A.transmuxing;M.executeStart=n();var I=this.decrypter,P=this.cache,B=this.currentTransmuxState,H=this.decryptionPromise;if(H)return H.then(function(){return v.flush(A)});var F=[],W=B.timeOffset;if(I){var U=I.flush();U&&F.push(this.push(U,null,A))}var K=P.dataLength;P.reset();var z=this.demuxer,te=this.remuxer;if(!z||!te)return K>=i&&this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),M.executeEnd=n(),[w(A)];var de=z.flush(W);return m(de)?de.then(function(ge){return v.flushRemux(F,ge,A),F}):(this.flushRemux(F,de,A),F)},b.flushRemux=function(A,v,M){var I=v.audioTrack,P=v.avcTrack,B=v.id3Track,H=v.textTrack,F=this.currentTransmuxState,W=F.accurateTimeOffset,U=F.timeOffset;r.logger.log("[transmuxer.ts]: Flushed fragment "+M.sn+(M.part>-1?" p: "+M.part:"")+" of level "+M.level);var K=this.remuxer.remux(I,P,B,H,U,W,!0,this.id);A.push({remuxResult:K,chunkMeta:M}),M.transmuxing.executeEnd=n()},b.resetInitialTimestamp=function(A){var v=this.demuxer,M=this.remuxer;if(!v||!M)return;v.resetTimeStamp(A),M.resetTimeStamp(A)},b.resetContiguity=function(){var A=this.demuxer,v=this.remuxer;if(!A||!v)return;A.resetContiguity(),v.resetNextTimestamp()},b.resetInitSegment=function(A,v,M,I){var P=this.demuxer,B=this.remuxer;if(!P||!B)return;P.resetInitSegment(v,M,I),B.resetInitSegment(A,v,M)},b.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},b.transmux=function(A,v,M,I,P){var B;return v&&v.method==="SAMPLE-AES"?B=this.transmuxSampleAes(A,v,M,I,P):B=this.transmuxUnencrypted(A,M,I,P),B},b.transmuxUnencrypted=function(A,v,M,I){var P=this.demuxer.demux(A,v,!1,!this.config.progressive),B=P.audioTrack,H=P.avcTrack,F=P.id3Track,W=P.textTrack,U=this.remuxer.remux(B,H,F,W,v,M,!1,this.id);return{remuxResult:U,chunkMeta:I}},b.transmuxSampleAes=function(A,v,M,I,P){var B=this;return this.demuxer.demuxSampleAes(A,v,M).then(function(H){var F=B.remuxer.remux(H.audioTrack,H.avcTrack,H.id3Track,H.textTrack,M,I,!1,B.id);return{remuxResult:F,chunkMeta:P}})},b.configureTransmuxer=function(A,v){for(var M=this.config,I=this.observer,P=this.typeSupported,B=this.vendor,H=v.audioCodec,F=v.defaultInitPts,W=v.duration,U=v.initSegmentData,K=v.videoCodec,z,te=0,de=a.length;te<de;te++)if(a[te].demux.probe(A)){z=a[te];break}z||(r.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),z={demux:y.default,remux:d.default});var ge=this.demuxer,Ue=this.remuxer,Me=z.remux,Le=z.demux;(!Ue||!(Ue instanceof Me))&&(this.remuxer=new Me(I,M,P,B)),(!ge||!(ge instanceof Le))&&(this.demuxer=new Le(I,M,P),this.probe=Le.probe),this.resetInitSegment(U,H,K,W),this.resetInitialTimestamp(F)},b.needsProbing=function(A,v,M){return!this.demuxer||!this.remuxer||v||M},b.getDecrypter=function(){var A=this.decrypter;return A||(A=this.decrypter=new c.default(this.observer,this.config)),A},x}();function f(x,b){var E=null;return x.byteLength>0&&b!=null&&b.key!=null&&b.iv!==null&&b.method!=null&&(E=b),E}var w=function(b){return{remuxResult:{},chunkMeta:b}};function m(x){return"then"in x&&x.then instanceof Function}var T=function(b,E,A,v,M){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=b,this.videoCodec=E,this.initSegmentData=A,this.duration=v,this.defaultInitPts=M},C=function(b,E,A,v,M){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=b,this.contiguous=E,this.accurateTimeOffset=A,this.trackSwitch=v,this.timeOffset=M}},"./src/demux/tsdemuxer.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"discardEPB",function(){return w});var R=D("./src/demux/adts.ts"),O=D("./src/demux/mpegaudio.ts"),c=D("./src/demux/exp-golomb.ts"),S=D("./src/demux/id3.ts"),y=D("./src/demux/sample-aes.ts"),p=D("./src/events.ts"),u=D("./src/utils/mp4-tools.ts"),o=D("./src/utils/logger.ts"),d=D("./src/errors.ts"),s={video:1,audio:2,id3:3,text:4},l=function(){function m(C,x,b){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=C,this.config=x,this.typeSupported=b}m.probe=function(x){var b=m.syncOffset(x);return b<0?!1:(b&&o.logger.warn("MPEG2-TS detected but first sync word found @ offset "+b+", junk ahead ?"),!0)},m.syncOffset=function(x){for(var b=Math.min(1e3,x.length-3*188),E=0;E<b;){if(x[E]===71&&x[E+188]===71&&x[E+2*188]===71)return E;E++}return-1},m.createTrack=function(x,b){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"?b:void 0}};var T=m.prototype;return T.resetInitSegment=function(x,b,E){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=m.createTrack("video",E),this._audioTrack=m.createTrack("audio",E),this._id3Track=m.createTrack("id3",E),this._txtTrack=m.createTrack("text",E),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=b,this._duration=E},T.resetTimeStamp=function(){},T.resetContiguity=function(){var x=this._audioTrack,b=this._avcTrack,E=this._id3Track;x&&(x.pesData=null),b&&(b.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},T.demux=function(x,b,E,A){E===void 0&&(E=!1),A===void 0&&(A=!1),E||(this.sampleAes=null);var v,M=this._avcTrack,I=this._audioTrack,P=this._id3Track,B=M.pid,H=M.pesData,F=I.pid,W=P.pid,U=I.pesData,K=P.pesData,z=!1,te=this.pmtParsed,de=this._pmtId,ge=x.length;if(this.remainderData&&(x=Object(u.appendUint8Array)(this.remainderData,x),ge=x.length,this.remainderData=null),ge<188&&!A)return this.remainderData=x,{audioTrack:I,avcTrack:M,id3Track:P,textTrack:this._txtTrack};var Ue=Math.max(0,m.syncOffset(x));ge-=(ge+Ue)%188,ge<x.byteLength&&!A&&(this.remainderData=new Uint8Array(x.buffer,ge,x.buffer.byteLength-ge));for(var Me=Ue;Me<ge;Me+=188)if(x[Me]===71){var Le=!!(x[Me+1]&64),Oe=((x[Me+1]&31)<<8)+x[Me+2],Fe=(x[Me+3]&48)>>4,ye=void 0;if(Fe>1){if(ye=Me+5+x[Me+4],ye===Me+188)continue}else ye=Me+4;switch(Oe){case B:Le&&(H&&(v=i(H))&&this.parseAVCPES(v,!1),H={data:[],size:0}),H&&(H.data.push(x.subarray(ye,Me+188)),H.size+=Me+188-ye);break;case F:Le&&(U&&(v=i(U))&&(I.isAAC?this.parseAACPES(v):this.parseMPEGPES(v)),U={data:[],size:0}),U&&(U.data.push(x.subarray(ye,Me+188)),U.size+=Me+188-ye);break;case W:Le&&(K&&(v=i(K))&&this.parseID3PES(v),K={data:[],size:0}),K&&(K.data.push(x.subarray(ye,Me+188)),K.size+=Me+188-ye);break;case 0:Le&&(ye+=x[ye]+1),de=this._pmtId=n(x,ye);break;case de:{Le&&(ye+=x[ye]+1);var Ae=a(x,ye,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,E);B=Ae.avc,B>0&&(M.pid=B),F=Ae.audio,F>0&&(I.pid=F,I.isAAC=Ae.isAAC),W=Ae.id3,W>0&&(P.pid=W),z&&!te&&(o.logger.log("reparse from beginning"),z=!1,Me=Ue-188),te=this.pmtParsed=!0;break}case 17:case 8191:break;default:z=!0;break}}else this.observer.emit(p.Events.ERROR,p.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});M.pesData=H,I.pesData=U,P.pesData=K;var re={audioTrack:I,avcTrack:M,id3Track:P,textTrack:this._txtTrack};return A&&this.extractRemainingSamples(re),re},T.flush=function(){var x=this.remainderData;this.remainderData=null;var b;return x?b=this.demux(x,-1,!1,!0):b={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(b),this.sampleAes?this.decrypt(b,this.sampleAes):b},T.extractRemainingSamples=function(x){var b=x.audioTrack,E=x.avcTrack,A=x.id3Track,v=E.pesData,M=b.pesData,I=A.pesData,P;v&&(P=i(v))?(this.parseAVCPES(P,!0),E.pesData=null):E.pesData=v,M&&(P=i(M))?(b.isAAC?this.parseAACPES(P):this.parseMPEGPES(P),b.pesData=null):(M!=null&&M.size&&o.logger.log("last AAC PES packet truncated,might overlap between fragments"),b.pesData=M),I&&(P=i(I))?(this.parseID3PES(P),A.pesData=null):A.pesData=I},T.demuxSampleAes=function(x,b,E){var A=this.demux(x,E,!0,!this.config.progressive),v=this.sampleAes=new y.default(this.observer,this.config,b);return this.decrypt(A,v)},T.decrypt=function(x,b){return new Promise(function(E){var A=x.audioTrack,v=x.avcTrack;A.samples&&A.isAAC?b.decryptAacSamples(A.samples,0,function(){v.samples?b.decryptAvcSamples(v.samples,0,0,function(){E(x)}):E(x)}):v.samples&&b.decryptAvcSamples(v.samples,0,0,function(){E(x)})})},T.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},T.parseAVCPES=function(x,b){var E=this,A=this._avcTrack,v=this.parseAVCNALu(x.data),M=!1,I=this.avcSample,P,B=!1;x.data=null,I&&v.length&&!A.audFound&&(h(I,A),I=this.avcSample=r(!1,x.pts,x.dts,"")),v.forEach(function(H){switch(H.type){case 1:{P=!0,I||(I=E.avcSample=r(!0,x.pts,x.dts,"")),M&&(I.debug+="NDR "),I.frame=!0;var F=H.data;if(B&&F.length>4){var W=new c.default(F).readSliceType();(W===2||W===4||W===7||W===9)&&(I.key=!0)}break}case 5:P=!0,I||(I=E.avcSample=r(!0,x.pts,x.dts,"")),M&&(I.debug+="IDR "),I.key=!0,I.frame=!0;break;case 6:{P=!0,M&&I&&(I.debug+="SEI ");var U=new c.default(w(H.data));U.readUByte();for(var K=0,z=0,te=!1,de=0;!te&&U.bytesAvailable>1;){K=0;do de=U.readUByte(),K+=de;while(de===255);z=0;do de=U.readUByte(),z+=de;while(de===255);if(K===4&&U.bytesAvailable!==0){te=!0;var ge=U.readUByte();if(ge===181){var Ue=U.readUShort();if(Ue===49){var Me=U.readUInt();if(Me===1195456820){var Le=U.readUByte();if(Le===3){for(var Oe=U.readUByte(),Fe=U.readUByte(),ye=31&Oe,Ae=[Oe,Fe],re=0;re<ye;re++)Ae.push(U.readUByte()),Ae.push(U.readUByte()),Ae.push(U.readUByte());f(E._txtTrack.samples,{type:3,pts:x.pts,bytes:Ae})}}}}}else if(K===5&&U.bytesAvailable!==0){if(te=!0,z>16){for(var pe=[],ue=0;ue<16;ue++)pe.push(U.readUByte().toString(16)),(ue===3||ue===5||ue===7||ue===9)&&pe.push("-");for(var Ie=z-16,Ke=new Uint8Array(Ie),Ne=0;Ne<Ie;Ne++)Ke[Ne]=U.readUByte();f(E._txtTrack.samples,{pts:x.pts,payloadType:K,uuid:pe.join(""),userData:Object(S.utf8ArrayToStr)(Ke),userDataBytes:Ke})}}else if(z<U.bytesAvailable)for(var je=0;je<z;je++)U.readUByte()}break}case 7:if(P=!0,B=!0,M&&I&&(I.debug+="SPS "),!A.sps){var Ge=new c.default(H.data),ze=Ge.readSPS();A.width=ze.width,A.height=ze.height,A.pixelRatio=ze.pixelRatio,A.sps=[H.data],A.duration=E._duration;for(var ke=H.data.subarray(1,4),xe="avc1.",Ee=0;Ee<3;Ee++){var Se=ke[Ee].toString(16);Se.length<2&&(Se="0"+Se),xe+=Se}A.codec=xe}break;case 8:P=!0,M&&I&&(I.debug+="PPS "),A.pps||(A.pps=[H.data]);break;case 9:P=!1,A.audFound=!0,I&&h(I,A),I=E.avcSample=r(!1,x.pts,x.dts,M?"AUD ":"");break;case 12:P=!1;break;default:P=!1,I&&(I.debug+="unknown NAL "+H.type+" ");break}if(I&&P){var $=I.units;$.push(H)}}),b&&I&&(h(I,A),this.avcSample=null)},T.getLastNalUnit=function(){var x,b=this.avcSample,E;if(!b||b.units.length===0){var A=this._avcTrack.samples;b=A[A.length-1]}if((x=b)!==null&&x!==void 0&&x.units){var v=b.units;E=v[v.length-1]}return E},T.parseAVCNALu=function(x){var b=x.byteLength,E=this._avcTrack,A=E.naluState||0,v=A,M=[],I=0,P,B,H,F=-1,W=0;for(A===-1&&(F=0,W=x[0]&31,A=0,I=1);I<b;){if(P=x[I++],!A){A=P?0:1;continue}if(A===1){A=P?0:2;continue}if(!P)A=3;else if(P===1){if(F>=0){var U={data:x.subarray(F,I-A-1),type:W};M.push(U)}else{var K=this.getLastNalUnit();if(K&&(v&&I<=4-v&&(K.state&&(K.data=K.data.subarray(0,K.data.byteLength-v))),B=I-A-1,B>0)){var z=new Uint8Array(K.data.byteLength+B);z.set(K.data,0),z.set(x.subarray(0,B),K.data.byteLength),K.data=z,K.state=0}}I<b?(H=x[I]&31,F=I,W=H,A=0):A=-1}else A=0}if(F>=0&&A>=0){var te={data:x.subarray(F,b),type:W,state:A};M.push(te)}if(M.length===0){var de=this.getLastNalUnit();if(de){var ge=new Uint8Array(de.data.byteLength+x.byteLength);ge.set(de.data,0),ge.set(x,de.data.byteLength),de.data=ge}}return E.naluState=A,M},T.parseAACPES=function(x){var b=0,E=this._audioTrack,A=this.aacOverFlow,v=x.data;if(A){this.aacOverFlow=null;var M=A.sample.unit.byteLength,I=Math.min(A.missing,M),P=M-I;A.sample.unit.set(v.subarray(0,I),P),E.samples.push(A.sample),b=A.missing}var B,H;for(B=b,H=v.length;B<H-1&&!R.isHeader(v,B);B++);if(B!==b){var F,W;if(B<H-1?(F="AAC PES did not start with ADTS header,offset:"+B,W=!1):(F="no ADTS header found in AAC PES",W=!0),o.logger.warn("parsing error:"+F),this.observer.emit(p.Events.ERROR,p.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:F}),W)return}R.initTrackConfig(E,this.observer,v,B,this.audioCodec);var U;if(x.pts!==void 0)U=x.pts;else if(A){var K=R.getFrameDuration(E.samplerate);U=A.sample.pts+K}else{o.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var z=0;B<H;)if(R.isHeader(v,B)){if(B+5<H){var te=R.appendFrame(E,v,B,U,z);if(te)if(te.missing)this.aacOverFlow=te;else{B+=te.length,z++;continue}}break}else B++},T.parseMPEGPES=function(x){var b=x.data,E=b.length,A=0,v=0,M=x.pts;if(M===void 0){o.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;v<E;)if(O.isHeader(b,v)){var I=O.appendFrame(this._audioTrack,b,v,M,A);if(I)v+=I.length,A++;else break}else v++},T.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 r(m,T,C,x){return{key:m,frame:!1,pts:T,dts:C,units:[],debug:x,length:0}}function n(m,T){return(m[T+10]&31)<<8|m[T+11]}function a(m,T,C,x){var b={audio:-1,avc:-1,id3:-1,isAAC:!0},E=(m[T+1]&15)<<8|m[T+2],A=T+3+E-4,v=(m[T+10]&15)<<8|m[T+11];for(T+=12+v;T<A;){var M=(m[T+1]&31)<<8|m[T+2];switch(m[T]){case 207:if(!x){o.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:b.audio===-1&&(b.audio=M);break;case 21:b.id3===-1&&(b.id3=M);break;case 219:if(!x){o.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:b.avc===-1&&(b.avc=M);break;case 3:case 4:C?b.audio===-1&&(b.audio=M,b.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}T+=((m[T+3]&15)<<8|m[T+4])+5}return b}function i(m){var T=0,C,x,b,E,A,v=m.data;if(!m||m.size===0)return null;for(;v[0].length<19&&v.length>1;){var M=new Uint8Array(v[0].length+v[1].length);M.set(v[0]),M.set(v[1],v[0].length),v[0]=M,v.splice(1,1)}C=v[0];var I=(C[0]<<16)+(C[1]<<8)+C[2];if(I===1){if(x=(C[4]<<8)+C[5],x&&x>m.size-6)return null;var P=C[7];P&192&&(E=(C[9]&14)*536870912+(C[10]&255)*4194304+(C[11]&254)*16384+(C[12]&255)*128+(C[13]&254)/2,P&64?(A=(C[14]&14)*536870912+(C[15]&255)*4194304+(C[16]&254)*16384+(C[17]&255)*128+(C[18]&254)/2,E-A>60*9e4&&(o.logger.warn(Math.round((E-A)/9e4)+"s delta between PTS and DTS, align them"),E=A)):A=E),b=C[8];var B=b+9;if(m.size<=B)return null;m.size-=B;for(var H=new Uint8Array(m.size),F=0,W=v.length;F<W;F++){C=v[F];var U=C.byteLength;if(B)if(B>U){B-=U;continue}else C=C.subarray(B),U-=B,B=0;H.set(C,T),T+=U}return x&&(x-=b+3),{data:H,pts:E,dts:A,len:x}}return null}function h(m,T){if(m.units.length&&m.frame){if(m.pts===void 0){var C=T.samples,x=C.length;if(x){var b=C[x-1];m.pts=b.pts,m.dts=b.dts}else{T.dropped++;return}}T.samples.push(m)}m.debug.length&&o.logger.log(m.pts+"/"+m.dts+":"+m.debug)}function f(m,T){var C=m.length;if(C>0){if(T.pts>=m[C-1].pts)m.push(T);else for(var x=C-1;x>=0;x--)if(T.pts<m[x].pts){m.splice(x,0,T);break}}else m.push(T)}function w(m){for(var T=m.byteLength,C=[],x=1;x<T-2;)m[x]===0&&m[x+1]===0&&m[x+2]===3?(C.push(x+2),x+=2):x++;if(C.length===0)return m;var b=T-C.length,E=new Uint8Array(b),A=0;for(x=0;x<b;A++,x++)A===C[0]&&(A++,C.shift()),E[x]=m[A];return E}k.default=l},"./src/errors.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"ErrorTypes",function(){return R}),D.d(k,"ErrorDetails",function(){return O});var R;(function(c){c.NETWORK_ERROR="networkError",c.MEDIA_ERROR="mediaError",c.KEY_SYSTEM_ERROR="keySystemError",c.MUX_ERROR="muxError",c.OTHER_ERROR="otherError"})(R||(R={}));var O;(function(c){c.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",c.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",c.KEY_SYSTEM_NO_SESSION="keySystemNoSession",c.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",c.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",c.MANIFEST_LOAD_ERROR="manifestLoadError",c.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",c.MANIFEST_PARSING_ERROR="manifestParsingError",c.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",c.LEVEL_EMPTY_ERROR="levelEmptyError",c.LEVEL_LOAD_ERROR="levelLoadError",c.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",c.LEVEL_SWITCH_ERROR="levelSwitchError",c.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",c.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",c.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",c.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",c.FRAG_LOAD_ERROR="fragLoadError",c.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",c.FRAG_DECRYPT_ERROR="fragDecryptError",c.FRAG_PARSING_ERROR="fragParsingError",c.REMUX_ALLOC_ERROR="remuxAllocError",c.KEY_LOAD_ERROR="keyLoadError",c.KEY_LOAD_TIMEOUT="keyLoadTimeOut",c.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",c.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",c.BUFFER_APPEND_ERROR="bufferAppendError",c.BUFFER_APPENDING_ERROR="bufferAppendingError",c.BUFFER_STALLED_ERROR="bufferStalledError",c.BUFFER_FULL_ERROR="bufferFullError",c.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",c.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",c.INTERNAL_EXCEPTION="internalException",c.INTERNAL_ABORTED="aborted",c.UNKNOWN="unknown"})(O||(O={}))},"./src/events.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"Events",function(){return R});var R;(function(O){O.MEDIA_ATTACHING="hlsMediaAttaching",O.MEDIA_ATTACHED="hlsMediaAttached",O.MEDIA_DETACHING="hlsMediaDetaching",O.MEDIA_DETACHED="hlsMediaDetached",O.BUFFER_RESET="hlsBufferReset",O.BUFFER_CODECS="hlsBufferCodecs",O.BUFFER_CREATED="hlsBufferCreated",O.BUFFER_APPENDING="hlsBufferAppending",O.BUFFER_APPENDED="hlsBufferAppended",O.BUFFER_EOS="hlsBufferEos",O.BUFFER_FLUSHING="hlsBufferFlushing",O.BUFFER_FLUSHED="hlsBufferFlushed",O.MANIFEST_LOADING="hlsManifestLoading",O.MANIFEST_LOADED="hlsManifestLoaded",O.MANIFEST_PARSED="hlsManifestParsed",O.LEVEL_SWITCHING="hlsLevelSwitching",O.LEVEL_SWITCHED="hlsLevelSwitched",O.LEVEL_LOADING="hlsLevelLoading",O.LEVEL_LOADED="hlsLevelLoaded",O.LEVEL_UPDATED="hlsLevelUpdated",O.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",O.LEVELS_UPDATED="hlsLevelsUpdated",O.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",O.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",O.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",O.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",O.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",O.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",O.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",O.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",O.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",O.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",O.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",O.CUES_PARSED="hlsCuesParsed",O.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",O.INIT_PTS_FOUND="hlsInitPtsFound",O.FRAG_LOADING="hlsFragLoading",O.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",O.FRAG_LOADED="hlsFragLoaded",O.FRAG_DECRYPTED="hlsFragDecrypted",O.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",O.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",O.FRAG_PARSING_METADATA="hlsFragParsingMetadata",O.FRAG_PARSED="hlsFragParsed",O.FRAG_BUFFERED="hlsFragBuffered",O.FRAG_CHANGED="hlsFragChanged",O.FPS_DROP="hlsFpsDrop",O.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",O.ERROR="hlsError",O.DESTROYING="hlsDestroying",O.KEY_LOADING="hlsKeyLoading",O.KEY_LOADED="hlsKeyLoaded",O.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",O.BACK_BUFFER_REACHED="hlsBackBufferReached"})(R||(R={}))},"./src/hls.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return m});var R=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(R),c=D("./src/loader/playlist-loader.ts"),S=D("./src/loader/key-loader.ts"),y=D("./src/controller/id3-track-controller.ts"),p=D("./src/controller/latency-controller.ts"),u=D("./src/controller/level-controller.ts"),o=D("./src/controller/fragment-tracker.ts"),d=D("./src/controller/stream-controller.ts"),s=D("./src/is-supported.ts"),l=D("./src/utils/logger.ts"),r=D("./src/config.ts"),n=D("./node_modules/eventemitter3/index.js"),a=D.n(n),i=D("./src/events.ts"),h=D("./src/errors.ts");function f(T,C){for(var x=0;x<C.length;x++){var b=C[x];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(T,b.key,b)}}function w(T,C,x){return C&&f(T.prototype,C),x&&f(T,x),T}var m=function(){T.isSupported=function(){return Object(s.isSupported)()};function T(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new n.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 b=this.config=Object(r.mergeConfig)(T.DefaultConfig,x);this.userConfig=x,Object(l.enableLogs)(b.debug),this._autoLevelCapping=-1,b.progressive&&Object(r.enableStreamingMode)(b);var E=b.abrController,A=b.bufferController,v=b.capLevelController,M=b.fpsController,I=this.abrController=new E(this),P=this.bufferController=new A(this),B=this.capLevelController=new v(this),H=new M(this),F=new c.default(this),W=new S.default(this),U=new y.default(this),K=this.levelController=new u.default(this),z=new o.FragmentTracker(this),te=this.streamController=new d.default(this,z);B.setStreamController(te),H.setStreamController(te);var de=[K,te];this.networkControllers=de;var ge=[F,W,I,P,B,H,U,z];this.audioTrackController=this.createController(b.audioTrackController,null,de),this.createController(b.audioStreamController,z,de),this.subtitleTrackController=this.createController(b.subtitleTrackController,null,de),this.createController(b.subtitleStreamController,z,de),this.createController(b.timelineController,null,ge),this.emeController=this.createController(b.emeController,null,ge),this.cmcdController=this.createController(b.cmcdController,null,ge),this.latencyController=this.createController(p.default,null,ge),this.coreComponents=ge}var C=T.prototype;return C.createController=function(b,E,A){if(b){var v=E?new b(this,E):new b(this);return A&&A.push(v),v}return null},C.on=function(b,E,A){A===void 0&&(A=this),this._emitter.on(b,E,A)},C.once=function(b,E,A){A===void 0&&(A=this),this._emitter.once(b,E,A)},C.removeAllListeners=function(b){this._emitter.removeAllListeners(b)},C.off=function(b,E,A,v){A===void 0&&(A=this),this._emitter.off(b,E,A,v)},C.listeners=function(b){return this._emitter.listeners(b)},C.emit=function(b,E,A){return this._emitter.emit(b,E,A)},C.trigger=function(b,E){if(this.config.debug)return this.emit(b,b,E);try{return this.emit(b,b,E)}catch(A){l.logger.error("An internal error happened while handling event "+b+'. Error message: "'+A.message+'". Here is a stacktrace:',A),this.trigger(i.Events.ERROR,{type:h.ErrorTypes.OTHER_ERROR,details:h.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:b,error:A})}return!1},C.listenerCount=function(b){return this._emitter.listenerCount(b)},C.destroy=function(){l.logger.log("destroy"),this.trigger(i.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(b){return b.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(b){return b.destroy()}),this.coreComponents.length=0},C.attachMedia=function(b){l.logger.log("attachMedia"),this._media=b,this.trigger(i.Events.MEDIA_ATTACHING,{media:b})},C.detachMedia=function(){l.logger.log("detachMedia"),this.trigger(i.Events.MEDIA_DETACHING,void 0),this._media=null},C.loadSource=function(b){this.stopLoad();var E=this.media,A=this.url,v=this.url=R.buildAbsoluteURL(self.location.href,b,{alwaysNormalize:!0});l.logger.log("loadSource:"+v),E&&A&&A!==v&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(E)),this.trigger(i.Events.MANIFEST_LOADING,{url:b})},C.startLoad=function(b){b===void 0&&(b=-1),l.logger.log("startLoad("+b+")"),this.networkControllers.forEach(function(E){E.startLoad(b)})},C.stopLoad=function(){l.logger.log("stopLoad"),this.networkControllers.forEach(function(b){b.stopLoad()})},C.swapAudioCodec=function(){l.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},C.recoverMediaError=function(){l.logger.log("recoverMediaError");var b=this._media;this.detachMedia(),b&&this.attachMedia(b)},C.removeLevel=function(b,E){E===void 0&&(E=0),this.levelController.removeLevel(b,E)},w(T,[{key:"levels",get:function(){var b=this.levelController.levels;return b||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(b){l.logger.log("set currentLevel:"+b),this.loadLevel=b,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(b){l.logger.log("set nextLevel:"+b),this.levelController.manualLevel=b,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(b){l.logger.log("set loadLevel:"+b),this.levelController.manualLevel=b}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(b){this.levelController.nextLoadLevel=b}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(b){l.logger.log("set firstLevel:"+b),this.levelController.firstLevel=b}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(b){l.logger.log("set startLevel:"+b),b!==-1&&(b=Math.max(b,this.minAutoLevel)),this.levelController.startLevel=b}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(b){var E=!!b;E!==this.config.capLevelToPlayerSize&&(E?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=E)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(b){this._autoLevelCapping!==b&&(l.logger.log("set autoLevelCapping:"+b),this._autoLevelCapping=b)}},{key:"bandwidthEstimate",get:function(){var b=this.abrController.bwEstimator;return b?b.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var b=this.levels,E=this.config.minAutoBitrate;if(!b)return 0;for(var A=b.length,v=0;v<A;v++)if(b[v].maxBitrate>E)return v;return 0}},{key:"maxAutoLevel",get:function(){var b=this.levels,E=this.autoLevelCapping,A;return E===-1&&b&&b.length?A=b.length-1:A=E,A}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(b){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,b)}},{key:"audioTracks",get:function(){var b=this.audioTrackController;return b?b.audioTracks:[]}},{key:"audioTrack",get:function(){var b=this.audioTrackController;return b?b.audioTrack:-1},set:function(b){var E=this.audioTrackController;E&&(E.audioTrack=b)}},{key:"subtitleTracks",get:function(){var b=this.subtitleTrackController;return b?b.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var b=this.subtitleTrackController;return b?b.subtitleTrack:-1},set:function(b){var E=this.subtitleTrackController;E&&(E.subtitleTrack=b)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var b=this.subtitleTrackController;return b?b.subtitleDisplay:!1},set:function(b){var E=this.subtitleTrackController;E&&(E.subtitleDisplay=b)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(b){this.config.lowLatencyMode=b}},{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 i.Events}},{key:"ErrorTypes",get:function(){return h.ErrorTypes}},{key:"ErrorDetails",get:function(){return h.ErrorDetails}},{key:"DefaultConfig",get:function(){return T.defaultConfig?T.defaultConfig:r.hlsDefaultConfig},set:function(b){T.defaultConfig=b}}]),T}();m.defaultConfig=void 0},"./src/is-supported.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"isSupported",function(){return c}),D.d(k,"changeTypeSupported",function(){return S});var R=D("./src/utils/mediasource-helper.ts");function O(){return self.SourceBuffer||self.WebKitSourceBuffer}function c(){var y=Object(R.getMediaSource)();if(!y)return!1;var p=O(),u=y&&typeof y.isTypeSupported=="function"&&y.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),o=!p||p.prototype&&typeof p.prototype.appendBuffer=="function"&&typeof p.prototype.remove=="function";return!!u&&!!o}function S(){var y,p=O();return typeof(p==null||((y=p.prototype)===null||y===void 0)?void 0:y.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return l}),D.d(k,"LoadError",function(){return n});var R=D("./src/polyfills/number.ts"),O=D("./src/errors.ts");function c(a,i){a.prototype=Object.create(i.prototype),a.prototype.constructor=a,o(a,i)}function S(a){var i=typeof Map=="function"?new Map:void 0;return S=function(f){if(f===null||!u(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof i!="undefined"){if(i.has(f))return i.get(f);i.set(f,w)}function w(){return y(f,arguments,d(this).constructor)}return w.prototype=Object.create(f.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),o(w,f)},S(a)}function y(a,i,h){return p()?y=Reflect.construct:y=function(w,m,T){var C=[null];C.push.apply(C,m);var x=Function.bind.apply(w,C),b=new x;return T&&o(b,T.prototype),b},y.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(a){return!1}}function u(a){return Function.toString.call(a).indexOf("[native code]")!==-1}function o(a,i){return o=Object.setPrototypeOf||function(f,w){return f.__proto__=w,f},o(a,i)}function d(a){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(h){return h.__proto__||Object.getPrototypeOf(h)},d(a)}var s=Math.pow(2,17),l=function(){function a(h){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=h}var i=a.prototype;return i.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},i.abort=function(){this.loader&&this.loader.abort()},i.load=function(f,w){var m=this,T=f.url;if(!T)return Promise.reject(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,networkDetails:null},"Fragment does not have a "+(T?"part list":"url")));this.abort();var C=this.config,x=C.fLoader,b=C.loader;return new Promise(function(E,A){m.loader&&m.loader.destroy();var v=m.loader=f.loader=x?new x(C):new b(C),M=r(f),I={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:s};f.stats=v.stats,v.load(M,I,{onSuccess:function(B,H,F,W){m.resetLoader(f,v),E({frag:f,part:null,payload:B.data,networkDetails:W})},onError:function(B,H,F){m.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,response:B,networkDetails:F}))},onAbort:function(B,H,F){m.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,networkDetails:F}))},onTimeout:function(B,H,F){m.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,networkDetails:F}))},onProgress:function(B,H,F,W){w&&w({frag:f,part:null,payload:F,networkDetails:W})}})})},i.loadPart=function(f,w,m){var T=this;this.abort();var C=this.config,x=C.fLoader,b=C.loader;return new Promise(function(E,A){T.loader&&T.loader.destroy();var v=T.loader=f.loader=x?new x(C):new b(C),M=r(f,w),I={timeout:C.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:C.fragLoadingMaxRetryTimeout,highWaterMark:s};w.stats=v.stats,v.load(M,I,{onSuccess:function(B,H,F,W){T.resetLoader(f,v),T.updateStatsFromPart(f,w);var U={frag:f,part:w,payload:B.data,networkDetails:W};m(U),E(U)},onError:function(B,H,F){T.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:f,part:w,response:B,networkDetails:F}))},onAbort:function(B,H,F){f.stats.aborted=w.stats.aborted,T.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:f,part:w,networkDetails:F}))},onTimeout:function(B,H,F){T.resetLoader(f,v),A(new n({type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:f,part:w,networkDetails:F}))}})})},i.updateStatsFromPart=function(f,w){var m=f.stats,T=w.stats,C=T.total;if(m.loaded+=T.loaded,C){var x=Math.round(f.duration/w.duration),b=Math.min(Math.round(m.loaded/C),x),E=x-b,A=E*Math.round(m.loaded/b);m.total=m.loaded+A}else m.total=Math.max(m.loaded,m.total);var v=m.loading,M=T.loading;v.start?v.first+=M.first-M.start:(v.start=M.start,v.first=M.first),v.end=M.end},i.resetLoader=function(f,w){f.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},a}();function r(a,i){i===void 0&&(i=null);var h=i||a,f={frag:a,part:i,responseType:"arraybuffer",url:h.url,headers:{},rangeStart:0,rangeEnd:0},w=h.byteRangeStartOffset,m=h.byteRangeEndOffset;return Object(R.isFiniteNumber)(w)&&Object(R.isFiniteNumber)(m)&&(f.rangeStart=w,f.rangeEnd=m),f}var n=function(a){c(i,a);function i(h){for(var f,w=arguments.length,m=new Array(w>1?w-1:0),T=1;T<w;T++)m[T-1]=arguments[T];return f=a.call.apply(a,[this].concat(m))||this,f.data=void 0,f.data=h,f}return i}(S(Error))},"./src/loader/fragment.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"ElementaryStreamTypes",function(){return l}),D.d(k,"BaseSegment",function(){return r}),D.d(k,"Fragment",function(){return n}),D.d(k,"Part",function(){return a});var R=D("./src/polyfills/number.ts"),O=D("./node_modules/url-toolkit/src/url-toolkit.js"),c=D.n(O),S=D("./src/utils/logger.ts"),y=D("./src/loader/level-key.ts"),p=D("./src/loader/load-stats.ts");function u(i,h){i.prototype=Object.create(h.prototype),i.prototype.constructor=i,o(i,h)}function o(i,h){return o=Object.setPrototypeOf||function(w,m){return w.__proto__=m,w},o(i,h)}function d(i,h){for(var f=0;f<h.length;f++){var w=h[f];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(i,w.key,w)}}function s(i,h,f){return h&&d(i.prototype,h),f&&d(i,f),i}var l;(function(i){i.AUDIO="audio",i.VIDEO="video",i.AUDIOVIDEO="audiovideo"})(l||(l={}));var r=function(){function i(f){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[l.AUDIO]=null,w[l.VIDEO]=null,w[l.AUDIOVIDEO]=null,w),this.baseurl=f}var h=i.prototype;return h.setByteRange=function(w,m){var T=w.split("@",2),C=[];T.length===1?C[0]=m?m.byteRangeEndOffset:0:C[0]=parseInt(T[1]),C[1]=parseInt(T[0])+C[0],this._byteRange=C},s(i,[{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(O.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),i}(),n=function(i){u(h,i);function h(w,m){var T;return T=i.call(this,m)||this,T._decryptdata=null,T.rawProgramDateTime=null,T.programDateTime=null,T.tagList=[],T.duration=0,T.sn=0,T.levelkey=void 0,T.type=void 0,T.loader=null,T.level=-1,T.cc=0,T.startPTS=void 0,T.endPTS=void 0,T.appendedPTS=void 0,T.startDTS=void 0,T.endDTS=void 0,T.start=0,T.deltaPTS=void 0,T.maxStartPTS=void 0,T.minEndPTS=void 0,T.stats=new p.LoadStats,T.urlId=0,T.data=void 0,T.bitrateTest=!1,T.title=null,T.initSegment=null,T.type=w,T}var f=h.prototype;return f.createInitializationVector=function(m){for(var T=new Uint8Array(16),C=12;C<16;C++)T[C]=m>>8*(15-C)&255;return T},f.setDecryptDataFromLevelKey=function(m,T){var C=m;return(m==null?void 0:m.method)==="AES-128"&&m.uri&&!m.iv&&(C=y.LevelKey.fromURI(m.uri),C.method=m.method,C.iv=this.createInitializationVector(T),C.keyFormat="identity"),C},f.setElementaryStreamInfo=function(m,T,C,x,b,E){E===void 0&&(E=!1);var A=this.elementaryStreams,v=A[m];if(!v){A[m]={startPTS:T,endPTS:C,startDTS:x,endDTS:b,partial:E};return}v.startPTS=Math.min(v.startPTS,T),v.endPTS=Math.max(v.endPTS,C),v.startDTS=Math.min(v.startDTS,x),v.endDTS=Math.max(v.endDTS,b)},f.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(R.isFiniteNumber)(this.programDateTime))return null;var m=Object(R.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}(r),a=function(i){u(h,i);function h(f,w,m,T,C){var x;x=i.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=f.decimalFloatingPoint("DURATION"),x.gap=f.bool("GAP"),x.independent=f.bool("INDEPENDENT"),x.relurl=f.enumeratedString("URI"),x.fragment=w,x.index=T;var b=f.enumeratedString("BYTERANGE");return b&&x.setByteRange(b,C),C&&(x.fragOffset=C.fragOffset+C.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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),h}(r)},"./src/loader/key-loader.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return S});var R=D("./src/events.ts"),O=D("./src/errors.ts"),c=D("./src/utils/logger.ts"),S=function(){function y(u){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=u,this._registerListeners()}var p=y.prototype;return p._registerListeners=function(){this.hls.on(R.Events.KEY_LOADING,this.onKeyLoading,this)},p._unregisterListeners=function(){this.hls.off(R.Events.KEY_LOADING,this.onKeyLoading)},p.destroy=function(){this._unregisterListeners();for(var o in this.loaders){var d=this.loaders[o];d&&d.destroy()}this.loaders={}},p.onKeyLoading=function(o,d){var s=d.frag,l=s.type,r=this.loaders[l];if(!s.decryptdata){c.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var n=s.decryptdata.uri;if(n!==this.decrypturl||this.decryptkey===null){var a=this.hls.config;if(r&&(c.logger.warn("abort previous key loader for type:"+l),r.abort()),!n){c.logger.warn("key uri is falsy");return}var i=a.loader,h=s.loader=this.loaders[l]=new i(a);this.decrypturl=n,this.decryptkey=null;var f={url:n,frag:s,responseType:"arraybuffer"},w={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:0},m={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};h.load(f,w,m)}else this.decryptkey&&(s.decryptdata.key=this.decryptkey,this.hls.trigger(R.Events.KEY_LOADED,{frag:s}))},p.loadsuccess=function(o,d,s){var l=s.frag;if(!l.decryptdata){c.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(R.Events.KEY_LOADED,{frag:l})},p.loaderror=function(o,d){var s=d.frag,l=s.loader;l&&l.abort(),delete this.loaders[s.type],this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:s,response:o})},p.loadtimeout=function(o,d){var s=d.frag,l=s.loader;l&&l.abort(),delete this.loaders[s.type],this.hls.trigger(R.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:s})},y}()},"./src/loader/level-details.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"LevelDetails",function(){return y});var R=D("./src/polyfills/number.ts");function O(p,u){for(var o=0;o<u.length;o++){var d=u[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function c(p,u,o){return u&&O(p.prototype,u),o&&O(p,o),p}var S=10,y=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 u=p.prototype;return u.reloaded=function(d){if(!d){this.advanced=!0,this.updated=!0;return}var s=this.lastPartSn-d.lastPartSn,l=this.lastPartIndex-d.lastPartIndex;this.updated=this.endSN!==d.endSN||!!l||!!s,this.advanced=this.endSN>d.endSN||s>0||s===0&&l>0,this.updated||this.advanced?this.misses=Math.floor(d.misses*.6):this.misses=d.misses+1,this.availabilityDelay=d.availabilityDelay},c(p,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(R.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||S}},{key:"drift",get:function(){var d=this.driftEndTime-this.driftStartTime;if(d>0){var s=this.driftEnd-this.driftStart;return s*1e3/d}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var d;return(d=this.partList)!==null&&d!==void 0&&d.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var d;return(d=this.fragments)!==null&&d!==void 0&&d.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 d;return(d=this.partList)!==null&&d!==void 0&&d.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var d;return(d=this.partList)!==null&&d!==void 0&&d.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),p}()},"./src/loader/level-key.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"LevelKey",function(){return y});var R=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(R);function c(p,u){for(var o=0;o<u.length;o++){var d=u[o];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(p,d.key,d)}}function S(p,u,o){return u&&c(p.prototype,u),o&&c(p,o),p}var y=function(){p.fromURL=function(o,d){return new p(o,d)},p.fromURI=function(o){return new p(o)};function p(u,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(R.buildAbsoluteURL)(u,o,{alwaysNormalize:!0}):this._uri=u}return S(p,[{key:"uri",get:function(){return this._uri}}]),p}()},"./src/loader/load-stats.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"LoadStats",function(){return R});var R=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(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return h});var R=D("./src/polyfills/number.ts"),O=D("./node_modules/url-toolkit/src/url-toolkit.js"),c=D.n(O),S=D("./src/loader/fragment.ts"),y=D("./src/loader/level-details.ts"),p=D("./src/loader/level-key.ts"),u=D("./src/utils/attr-list.ts"),o=D("./src/utils/logger.ts"),d=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,r=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),n=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("|")),a=/\.(mp4|m4s|m4v|m4a)$/i;function i(C){var x,b;return a.test((x=(b=O.parseURL(C))===null||b===void 0?void 0:b.path)!=null?x:"")}var h=function(){function C(){}return C.findGroup=function(b,E){for(var A=0;A<b.length;A++){var v=b[A];if(v.id===E)return v}},C.convertAVC1ToAVCOTI=function(b){var E=b.split(".");if(E.length>2){var A=E.shift()+".";return A+=parseInt(E.shift()).toString(16),A+=("000"+parseInt(E.shift()).toString(16)).substr(-4),A}return b},C.resolve=function(b,E){return O.buildAbsoluteURL(E,b,{alwaysNormalize:!0})},C.parseMasterPlaylist=function(b,E){var A=[],v={},M=!1;s.lastIndex=0;for(var I;(I=s.exec(b))!=null;)if(I[1]){var P=new u.AttrList(I[1]),B={attrs:P,bitrate:P.decimalInteger("AVERAGE-BANDWIDTH")||P.decimalInteger("BANDWIDTH"),name:P.NAME,url:C.resolve(I[2],E)},H=P.decimalResolution("RESOLUTION");H&&(B.width=H.width,B.height=H.height),f((P.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),B),B.videoCodec&&B.videoCodec.indexOf("avc1")!==-1&&(B.videoCodec=C.convertAVC1ToAVCOTI(B.videoCodec)),A.push(B)}else if(I[3]){var F=new u.AttrList(I[3]);F["DATA-ID"]&&(M=!0,v[F["DATA-ID"]]=F)}return{levels:A,sessionData:M?v:null}},C.parseMasterPlaylistMedia=function(b,E,A,v){v===void 0&&(v=[]);var M,I=[],P=0;for(l.lastIndex=0;(M=l.exec(b))!==null;){var B=new u.AttrList(M[1]);if(B.TYPE===A){var H={attrs:B,bitrate:0,id:P++,groupId:B["GROUP-ID"],instreamId:B["INSTREAM-ID"],name:B.NAME||B.LANGUAGE||"",type:A,default:B.bool("DEFAULT"),autoselect:B.bool("AUTOSELECT"),forced:B.bool("FORCED"),lang:B.LANGUAGE,url:B.URI?C.resolve(B.URI,E):""};if(v.length){var F=C.findGroup(v,H.groupId)||v[0];w(H,F,"audioCodec"),w(H,F,"textCodec")}I.push(H)}}return I},C.parseLevelPlaylist=function(b,E,A,v,M){var I=new y.LevelDetails(E),P=I.fragments,B=null,H=0,F=0,W=0,U=0,K=null,z=new S.Fragment(v,E),te,de,ge,Ue=-1,Me=!1;for(r.lastIndex=0,I.m3u8=b;(te=r.exec(b))!==null;){Me&&(Me=!1,z=new S.Fragment(v,E),z.start=W,z.sn=H,z.cc=U,z.level=A,B&&(z.initSegment=B,z.rawProgramDateTime=B.rawProgramDateTime));var Le=te[1];if(Le){z.duration=parseFloat(Le);var Oe=(" "+te[2]).slice(1);z.title=Oe||null,z.tagList.push(Oe?["INF",Le,Oe]:["INF",Le])}else if(te[3])Object(R.isFiniteNumber)(z.duration)&&(z.start=W,ge&&(z.levelkey=ge),z.sn=H,z.level=A,z.cc=U,z.urlId=M,P.push(z),z.relurl=(" "+te[3]).slice(1),T(z,K),K=z,W+=z.duration,H++,F=0,Me=!0);else if(te[4]){var Fe=(" "+te[4]).slice(1);K?z.setByteRange(Fe,K):z.setByteRange(Fe)}else if(te[5])z.rawProgramDateTime=(" "+te[5]).slice(1),z.tagList.push(["PROGRAM-DATE-TIME",z.rawProgramDateTime]),Ue===-1&&(Ue=P.length);else{if(te=te[0].match(n),!te){o.logger.warn("No matches on slow regex match for level playlist!");continue}for(de=1;de<te.length&&!(typeof te[de]!="undefined");de++);var ye=(" "+te[de]).slice(1),Ae=(" "+te[de+1]).slice(1),re=te[de+2]?(" "+te[de+2]).slice(1):"";switch(ye){case"PLAYLIST-TYPE":I.type=Ae.toUpperCase();break;case"MEDIA-SEQUENCE":H=I.startSN=parseInt(Ae);break;case"SKIP":{var pe=new u.AttrList(Ae),ue=pe.decimalInteger("SKIPPED-SEGMENTS");if(Object(R.isFiniteNumber)(ue)){I.skippedSegments=ue;for(var Ie=ue;Ie--;)P.unshift(null);H+=ue}var Ke=pe.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ke&&(I.recentlyRemovedDateranges=Ke.split(" "));break}case"TARGETDURATION":I.targetduration=parseFloat(Ae);break;case"VERSION":I.version=parseInt(Ae);break;case"EXTM3U":break;case"ENDLIST":I.live=!1;break;case"#":(Ae||re)&&z.tagList.push(re?[Ae,re]:[Ae]);break;case"DIS":U++;case"GAP":z.tagList.push([ye]);break;case"BITRATE":z.tagList.push([ye,Ae]);break;case"DISCONTINUITY-SEQ":U=parseInt(Ae);break;case"KEY":{var Ne,je=new u.AttrList(Ae),Ge=je.enumeratedString("METHOD"),ze=je.URI,ke=je.hexadecimalInteger("IV"),xe=je.enumeratedString("KEYFORMATVERSIONS"),Ee=je.enumeratedString("KEYID"),Se=(Ne=je.enumeratedString("KEYFORMAT"))!=null?Ne:"identity",$=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if($.indexOf(Se)>-1){o.logger.warn("Keyformat "+Se+" is not supported from the manifest");continue}else if(Se!=="identity")continue;Ge&&(ge=p.LevelKey.fromURL(E,ze),ze&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ge)>=0&&(ge.method=Ge,ge.keyFormat=Se,Ee&&(ge.keyID=Ee),xe&&(ge.keyFormatVersions=xe),ge.iv=ke));break}case"START":{var fe=new u.AttrList(Ae),J=fe.decimalFloatingPoint("TIME-OFFSET");Object(R.isFiniteNumber)(J)&&(I.startTimeOffset=J);break}case"MAP":{var Ce=new u.AttrList(Ae);z.relurl=Ce.URI,Ce.BYTERANGE&&z.setByteRange(Ce.BYTERANGE),z.level=A,z.sn="initSegment",ge&&(z.levelkey=ge),z.initSegment=null,B=z,Me=!0;break}case"SERVER-CONTROL":{var We=new u.AttrList(Ae);I.canBlockReload=We.bool("CAN-BLOCK-RELOAD"),I.canSkipUntil=We.optionalFloat("CAN-SKIP-UNTIL",0),I.canSkipDateRanges=I.canSkipUntil>0&&We.bool("CAN-SKIP-DATERANGES"),I.partHoldBack=We.optionalFloat("PART-HOLD-BACK",0),I.holdBack=We.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Ve=new u.AttrList(Ae);I.partTarget=Ve.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Pe=I.partList;Pe||(Pe=I.partList=[]);var Je=F>0?Pe[Pe.length-1]:void 0,ne=F++,be=new S.Part(new u.AttrList(Ae),z,E,ne,Je);Pe.push(be),z.duration+=be.duration;break}case"PRELOAD-HINT":{var Re=new u.AttrList(Ae);I.preloadHint=Re;break}case"RENDITION-REPORT":{var le=new u.AttrList(Ae);I.renditionReports=I.renditionReports||[],I.renditionReports.push(le);break}default:o.logger.warn("line parsed but not handled: "+te);break}}}K&&!K.relurl?(P.pop(),W-=K.duration,I.partList&&(I.fragmentHint=K)):I.partList&&(T(z,K),z.cc=U,I.fragmentHint=z);var se=P.length,he=P[0],Y=P[se-1];if(W+=I.skippedSegments*I.targetduration,W>0&&se&&Y){I.averagetargetduration=W/se;var Z=Y.sn;I.endSN=Z!=="initSegment"?Z:0,he&&(I.startCC=he.cc,he.initSegment||I.fragments.every(function(G){return G.relurl&&i(G.relurl)})&&(o.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),z=new S.Fragment(v,E),z.relurl=Y.relurl,z.level=A,z.sn="initSegment",he.initSegment=z,I.needSidxRanges=!0))}else I.endSN=0,I.startCC=0;return I.fragmentHint&&(W+=I.fragmentHint.duration),I.totalduration=W,I.endCC=U,Ue>0&&m(P,Ue),I},C}();function f(C,x){["video","audio","text"].forEach(function(b){var E=C.filter(function(v){return Object(d.isCodecType)(v,b)});if(E.length){var A=E.filter(function(v){return v.lastIndexOf("avc1",0)===0||v.lastIndexOf("mp4a",0)===0});x[b+"Codec"]=A.length>0?A[0]:E[0],C=C.filter(function(v){return E.indexOf(v)===-1})}}),x.unknownCodecs=C}function w(C,x,b){var E=x[b];E&&(C[b]=E)}function m(C,x){for(var b=C[x],E=x;E--;){var A=C[E];if(!A)return;A.programDateTime=b.programDateTime-A.duration*1e3,b=A}}function T(C,x){C.rawProgramDateTime?C.programDateTime=Date.parse(C.rawProgramDateTime):x!=null&&x.programDateTime&&(C.programDateTime=x.endProgramDateTime),Object(R.isFiniteNumber)(C.programDateTime)||(C.programDateTime=null,C.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/polyfills/number.ts"),O=D("./src/events.ts"),c=D("./src/errors.ts"),S=D("./src/utils/logger.ts"),y=D("./src/utils/mp4-tools.ts"),p=D("./src/loader/m3u8-parser.ts"),u=D("./src/types/loader.ts"),o=D("./src/utils/attr-list.ts");function d(r){var n=r.type;switch(n){case u.PlaylistContextType.AUDIO_TRACK:return u.PlaylistLevelType.AUDIO;case u.PlaylistContextType.SUBTITLE_TRACK:return u.PlaylistLevelType.SUBTITLE;default:return u.PlaylistLevelType.MAIN}}function s(r,n){var a=r.url;return(a===void 0||a.indexOf("data:")===0)&&(a=n.url),a}var l=function(){function r(a){this.hls=void 0,this.loaders=Object.create(null),this.hls=a,this.registerListeners()}var n=r.prototype;return n.registerListeners=function(){var i=this.hls;i.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.on(O.Events.LEVEL_LOADING,this.onLevelLoading,this),i.on(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.on(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},n.unregisterListeners=function(){var i=this.hls;i.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),i.off(O.Events.LEVEL_LOADING,this.onLevelLoading,this),i.off(O.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),i.off(O.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},n.createInternalLoader=function(i){var h=this.hls.config,f=h.pLoader,w=h.loader,m=f||w,T=new m(h);return i.loader=T,this.loaders[i.type]=T,T},n.getInternalLoader=function(i){return this.loaders[i.type]},n.resetInternalLoader=function(i){this.loaders[i]&&delete this.loaders[i]},n.destroyInternalLoaders=function(){for(var i in this.loaders){var h=this.loaders[i];h&&h.destroy(),this.resetInternalLoader(i)}},n.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},n.onManifestLoading=function(i,h){var f=h.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:u.PlaylistContextType.MANIFEST,url:f,deliveryDirectives:null})},n.onLevelLoading=function(i,h){var f=h.id,w=h.level,m=h.url,T=h.deliveryDirectives;this.load({id:f,groupId:null,level:w,responseType:"text",type:u.PlaylistContextType.LEVEL,url:m,deliveryDirectives:T})},n.onAudioTrackLoading=function(i,h){var f=h.id,w=h.groupId,m=h.url,T=h.deliveryDirectives;this.load({id:f,groupId:w,level:null,responseType:"text",type:u.PlaylistContextType.AUDIO_TRACK,url:m,deliveryDirectives:T})},n.onSubtitleTrackLoading=function(i,h){var f=h.id,w=h.groupId,m=h.url,T=h.deliveryDirectives;this.load({id:f,groupId:w,level:null,responseType:"text",type:u.PlaylistContextType.SUBTITLE_TRACK,url:m,deliveryDirectives:T})},n.load=function(i){var h,f=this.hls.config,w=this.getInternalLoader(i);if(w){var m=w.context;if(m&&m.url===i.url){S.logger.trace("[playlist-loader]: playlist request ongoing");return}S.logger.log("[playlist-loader]: aborting previous loader for type: "+i.type),w.abort()}var T,C,x,b;switch(i.type){case u.PlaylistContextType.MANIFEST:T=f.manifestLoadingMaxRetry,C=f.manifestLoadingTimeOut,x=f.manifestLoadingRetryDelay,b=f.manifestLoadingMaxRetryTimeout;break;case u.PlaylistContextType.LEVEL:case u.PlaylistContextType.AUDIO_TRACK:case u.PlaylistContextType.SUBTITLE_TRACK:T=0,C=f.levelLoadingTimeOut;break;default:T=f.levelLoadingMaxRetry,C=f.levelLoadingTimeOut,x=f.levelLoadingRetryDelay,b=f.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(i),(h=i.deliveryDirectives)!==null&&h!==void 0&&h.part){var E;if(i.type===u.PlaylistContextType.LEVEL&&i.level!==null?E=this.hls.levels[i.level].details:i.type===u.PlaylistContextType.AUDIO_TRACK&&i.id!==null?E=this.hls.audioTracks[i.id].details:i.type===u.PlaylistContextType.SUBTITLE_TRACK&&i.id!==null&&(E=this.hls.subtitleTracks[i.id].details),E){var A=E.partTarget,v=E.targetduration;A&&v&&(C=Math.min(Math.max(A*3,v*.8)*1e3,C))}}var M={timeout:C,maxRetry:T,retryDelay:x,maxRetryDelay:b,highWaterMark:0},I={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(i,M,I)},n.loadsuccess=function(i,h,f,w){if(w===void 0&&(w=null),f.isSidxRequest){this.handleSidxRequest(i,f),this.handlePlaylistLoaded(i,h,f,w);return}this.resetInternalLoader(f.type);var m=i.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(i,f,"no EXTM3U delimiter",w);return}h.parsing.start=performance.now(),m.indexOf("#EXTINF:")>0||m.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(i,h,f,w):this.handleMasterPlaylist(i,h,f,w)},n.loaderror=function(i,h,f){f===void 0&&(f=null),this.handleNetworkError(h,f,!1,i)},n.loadtimeout=function(i,h,f){f===void 0&&(f=null),this.handleNetworkError(h,f,!0)},n.handleMasterPlaylist=function(i,h,f,w){var m=this.hls,T=i.data,C=s(i,f),x=p.default.parseMasterPlaylist(T,C),b=x.levels,E=x.sessionData;if(!b.length){this.handleManifestParsingError(i,f,"no level found in manifest",w);return}var A=b.map(function(H){return{id:H.attrs.AUDIO,audioCodec:H.audioCodec}}),v=b.map(function(H){return{id:H.attrs.SUBTITLES,textCodec:H.textCodec}}),M=p.default.parseMasterPlaylistMedia(T,C,"AUDIO",A),I=p.default.parseMasterPlaylistMedia(T,C,"SUBTITLES",v),P=p.default.parseMasterPlaylistMedia(T,C,"CLOSED-CAPTIONS");if(M.length){var B=M.some(function(H){return!H.url});!B&&b[0].audioCodec&&!b[0].attrs.AUDIO&&(S.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),M.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new o.AttrList({}),bitrate:0,url:""}))}m.trigger(O.Events.MANIFEST_LOADED,{levels:b,audioTracks:M,subtitles:I,captions:P,url:C,stats:h,networkDetails:w,sessionData:E})},n.handleTrackOrLevelPlaylist=function(i,h,f,w){var m=this.hls,T=f.id,C=f.level,x=f.type,b=s(i,f),E=Object(R.isFiniteNumber)(T)?T:0,A=Object(R.isFiniteNumber)(C)?C:E,v=d(f),M=p.default.parseLevelPlaylist(i.data,b,A,v,E);if(!M.fragments.length){m.trigger(O.Events.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:b,reason:"no fragments found in level",level:typeof f.level=="number"?f.level:void 0});return}if(x===u.PlaylistContextType.MANIFEST){var I={attrs:new o.AttrList({}),bitrate:0,details:M,name:"",url:b};m.trigger(O.Events.MANIFEST_LOADED,{levels:[I],audioTracks:[],url:b,stats:h,networkDetails:w,sessionData:null})}if(h.parsing.end=performance.now(),M.needSidxRanges){var P,B=(P=M.fragments[0].initSegment)===null||P===void 0?void 0:P.url;this.load({url:B,isSidxRequest:!0,type:x,level:C,levelDetails:M,id:T,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}f.levelDetails=M,this.handlePlaylistLoaded(i,h,f,w)},n.handleSidxRequest=function(i,h){var f=Object(y.parseSegmentIndex)(new Uint8Array(i.data));if(!f)return;var w=f.references,m=h.levelDetails;w.forEach(function(T,C){var x=T.info,b=m.fragments[C];b.byteRange.length===0&&b.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),b.initSegment&&b.initSegment.setByteRange(String(f.moovEndOffset)+"@0")})},n.handleManifestParsingError=function(i,h,f,w){this.hls.trigger(O.Events.ERROR,{type:c.ErrorTypes.NETWORK_ERROR,details:c.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:h.type===u.PlaylistContextType.MANIFEST,url:i.url,reason:f,response:i,context:h,networkDetails:w})},n.handleNetworkError=function(i,h,f,w){f===void 0&&(f=!1),S.logger.warn("[playlist-loader]: A network "+(f?"timeout":"error")+" occurred while loading "+i.type+" level: "+i.level+" id: "+i.id+' group-id: "'+i.groupId+'"');var m=c.ErrorDetails.UNKNOWN,T=!1,C=this.getInternalLoader(i);switch(i.type){case u.PlaylistContextType.MANIFEST:m=f?c.ErrorDetails.MANIFEST_LOAD_TIMEOUT:c.ErrorDetails.MANIFEST_LOAD_ERROR,T=!0;break;case u.PlaylistContextType.LEVEL:m=f?c.ErrorDetails.LEVEL_LOAD_TIMEOUT:c.ErrorDetails.LEVEL_LOAD_ERROR,T=!1;break;case u.PlaylistContextType.AUDIO_TRACK:m=f?c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case u.PlaylistContextType.SUBTITLE_TRACK:m=f?c.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:c.ErrorDetails.SUBTITLE_LOAD_ERROR,T=!1;break}C&&this.resetInternalLoader(i.type);var x={type:c.ErrorTypes.NETWORK_ERROR,details:m,fatal:T,url:i.url,loader:C,context:i,networkDetails:h};w&&(x.response=w),this.hls.trigger(O.Events.ERROR,x)},n.handlePlaylistLoaded=function(i,h,f,w){var m=f.type,T=f.level,C=f.id,x=f.groupId,b=f.loader,E=f.levelDetails,A=f.deliveryDirectives;if(!(E!=null&&E.targetduration)){this.handleManifestParsingError(i,f,"invalid target duration",w);return}if(!b)return;E.live&&(b.getCacheAge&&(E.ageHeader=b.getCacheAge()||0),(!b.getCacheAge||isNaN(E.ageHeader))&&(E.ageHeader=0));switch(m){case u.PlaylistContextType.MANIFEST:case u.PlaylistContextType.LEVEL:this.hls.trigger(O.Events.LEVEL_LOADED,{details:E,level:T||0,id:C||0,stats:h,networkDetails:w,deliveryDirectives:A});break;case u.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(O.Events.AUDIO_TRACK_LOADED,{details:E,id:C||0,groupId:x||"",stats:h,networkDetails:w,deliveryDirectives:A});break;case u.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(O.Events.SUBTITLE_TRACK_LOADED,{details:E,id:C||0,groupId:x||"",stats:h,networkDetails:w,deliveryDirectives:A});break}},r}();k.default=l},"./src/polyfills/number.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"isFiniteNumber",function(){return R}),D.d(k,"MAX_SAFE_INTEGER",function(){return O});var R=Number.isFinite||function(c){return typeof c=="number"&&isFinite(c)},O=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(j,k,D){"use strict";D.r(k);var R=function(){function O(){}return O.getSilentFrame=function(S,y){switch(S){case"mp4a.40.2":if(y===1)return new Uint8Array([0,200,0,128,35,128]);if(y===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(y===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(y===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(y===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(y===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(y===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(y===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(y===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},O}();k.default=R},"./src/remux/mp4-generator.ts":function(j,k,D){"use strict";D.r(k);var R=Math.pow(2,32)-1,O=function(){function c(){}return c.init=function(){c.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 y;for(y in c.types)c.types.hasOwnProperty(y)&&(c.types[y]=[y.charCodeAt(0),y.charCodeAt(1),y.charCodeAt(2),y.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]),u=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]);c.HDLR_TYPES={video:p,audio:u};var o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),d=new Uint8Array([0,0,0,0,0,0,0,0]);c.STTS=c.STSC=c.STCO=d,c.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),c.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),c.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),c.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]),r=new Uint8Array([0,0,0,1]);c.FTYP=c.box(c.types.ftyp,s,r,s,l),c.DINF=c.box(c.types.dinf,c.box(c.types.dref,o))},c.box=function(y){for(var p=8,u=arguments.length,o=new Array(u>1?u-1:0),d=1;d<u;d++)o[d-1]=arguments[d];for(var s=o.length,l=s;s--;)p+=o[s].byteLength;var r=new Uint8Array(p);for(r[0]=p>>24&255,r[1]=p>>16&255,r[2]=p>>8&255,r[3]=p&255,r.set(y,4),s=0,p=8;s<l;s++)r.set(o[s],p),p+=o[s].byteLength;return r},c.hdlr=function(y){return c.box(c.types.hdlr,c.HDLR_TYPES[y])},c.mdat=function(y){return c.box(c.types.mdat,y)},c.mdhd=function(y,p){p*=y;var u=Math.floor(p/(R+1)),o=Math.floor(p%(R+1));return c.box(c.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,y>>24&255,y>>16&255,y>>8&255,y&255,u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255,85,196,0,0]))},c.mdia=function(y){return c.box(c.types.mdia,c.mdhd(y.timescale,y.duration),c.hdlr(y.type),c.minf(y))},c.mfhd=function(y){return c.box(c.types.mfhd,new Uint8Array([0,0,0,0,y>>24,y>>16&255,y>>8&255,y&255]))},c.minf=function(y){return y.type==="audio"?c.box(c.types.minf,c.box(c.types.smhd,c.SMHD),c.DINF,c.stbl(y)):c.box(c.types.minf,c.box(c.types.vmhd,c.VMHD),c.DINF,c.stbl(y))},c.moof=function(y,p,u){return c.box(c.types.moof,c.mfhd(y),c.traf(u,p))},c.moov=function(y){for(var p=y.length,u=[];p--;)u[p]=c.trak(y[p]);return c.box.apply(null,[c.types.moov,c.mvhd(y[0].timescale,y[0].duration)].concat(u).concat(c.mvex(y)))},c.mvex=function(y){for(var p=y.length,u=[];p--;)u[p]=c.trex(y[p]);return c.box.apply(null,[c.types.mvex].concat(u))},c.mvhd=function(y,p){p*=y;var u=Math.floor(p/(R+1)),o=Math.floor(p%(R+1)),d=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,y>>24&255,y>>16&255,y>>8&255,y&255,u>>24,u>>16&255,u>>8&255,u&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 c.box(c.types.mvhd,d)},c.sdtp=function(y){var p=y.samples||[],u=new Uint8Array(4+p.length),o,d;for(o=0;o<p.length;o++)d=p[o].flags,u[o+4]=d.dependsOn<<4|d.isDependedOn<<2|d.hasRedundancy;return c.box(c.types.sdtp,u)},c.stbl=function(y){return c.box(c.types.stbl,c.stsd(y),c.box(c.types.stts,c.STTS),c.box(c.types.stsc,c.STSC),c.box(c.types.stsz,c.STSZ),c.box(c.types.stco,c.STCO))},c.avc1=function(y){var p=[],u=[],o,d,s;for(o=0;o<y.sps.length;o++)d=y.sps[o],s=d.byteLength,p.push(s>>>8&255),p.push(s&255),p=p.concat(Array.prototype.slice.call(d));for(o=0;o<y.pps.length;o++)d=y.pps[o],s=d.byteLength,u.push(s>>>8&255),u.push(s&255),u=u.concat(Array.prototype.slice.call(d));var l=c.box(c.types.avcC,new Uint8Array([1,p[3],p[4],p[5],252|3,224|y.sps.length].concat(p).concat([y.pps.length]).concat(u))),r=y.width,n=y.height,a=y.pixelRatio[0],i=y.pixelRatio[1];return c.box(c.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,r>>8&255,r&255,n>>8&255,n&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,c.box(c.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),c.box(c.types.pasp,new Uint8Array([a>>24,a>>16&255,a>>8&255,a&255,i>>24,i>>16&255,i>>8&255,i&255])))},c.esds=function(y){var p=y.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(y.config).concat([6,1,2]))},c.mp4a=function(y){var p=y.samplerate;return c.box(c.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,y.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]),c.box(c.types.esds,c.esds(y)))},c.mp3=function(y){var p=y.samplerate;return c.box(c.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,y.channelCount,0,16,0,0,0,0,p>>8&255,p&255,0,0]))},c.stsd=function(y){return y.type==="audio"?!y.isAAC&&y.codec==="mp3"?c.box(c.types.stsd,c.STSD,c.mp3(y)):c.box(c.types.stsd,c.STSD,c.mp4a(y)):c.box(c.types.stsd,c.STSD,c.avc1(y))},c.tkhd=function(y){var p=y.id,u=y.duration*y.timescale,o=y.width,d=y.height,s=Math.floor(u/(R+1)),l=Math.floor(u%(R+1));return c.box(c.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,d>>8&255,d&255,0,0]))},c.traf=function(y,p){var u=c.sdtp(y),o=y.id,d=Math.floor(p/(R+1)),s=Math.floor(p%(R+1));return c.box(c.types.traf,c.box(c.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255])),c.box(c.types.tfdt,new Uint8Array([1,0,0,0,d>>24,d>>16&255,d>>8&255,d&255,s>>24,s>>16&255,s>>8&255,s&255])),c.trun(y,u.length+16+20+8+16+8+8),u)},c.trak=function(y){return y.duration=y.duration||4294967295,c.box(c.types.trak,c.tkhd(y),c.mdia(y))},c.trex=function(y){var p=y.id;return c.box(c.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]))},c.trun=function(y,p){var u=y.samples||[],o=u.length,d=12+16*o,s=new Uint8Array(d),l,r,n,a,i,h;for(p+=8+d,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++)r=u[l],n=r.duration,a=r.size,i=r.flags,h=r.cts,s.set([n>>>24&255,n>>>16&255,n>>>8&255,n&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,i.isLeading<<2|i.dependsOn,i.isDependedOn<<6|i.hasRedundancy<<4|i.paddingValue<<1|i.isNonSync,i.degradPrio&240<<8,i.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*l);return c.box(c.types.trun,s)},c.initSegment=function(y){c.types||c.init();var p=c.moov(y),u=new Uint8Array(c.FTYP.byteLength+p.byteLength);return u.set(c.FTYP),u.set(p,c.FTYP.byteLength),u},c}();O.types=void 0,O.HDLR_TYPES=void 0,O.STTS=void 0,O.STSC=void 0,O.STCO=void 0,O.STSZ=void 0,O.VMHD=void 0,O.SMHD=void 0,O.STSD=void 0,O.FTYP=void 0,O.DINF=void 0,k.default=O},"./src/remux/mp4-remuxer.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return h}),D.d(k,"normalizePts",function(){return f});var R=D("./src/polyfills/number.ts"),O=D("./src/remux/aac-helper.ts"),c=D("./src/remux/mp4-generator.ts"),S=D("./src/events.ts"),y=D("./src/errors.ts"),p=D("./src/utils/logger.ts"),u=D("./src/types/loader.ts"),o=D("./src/utils/timescale-conversion.ts");function d(){return d=Object.assign||function(C){for(var x=1;x<arguments.length;x++){var b=arguments[x];for(var E in b)Object.prototype.hasOwnProperty.call(b,E)&&(C[E]=b[E])}return C},d.apply(this,arguments)}var s=10*1e3,l=1024,r=1152,n=null,a=null,i=!1,h=function(){function C(b,E,A,v){if(v===void 0&&(v=""),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=b,this.config=E,this.typeSupported=A,this.ISGenerated=!1,n===null){var M=navigator.userAgent||"",I=M.match(/Chrome\/(\d+)/i);n=I?parseInt(I[1]):0}if(a===null){var P=navigator.userAgent.match(/Safari\/(\d+)/i);a=P?parseInt(P[1]):0}i=!!n&&n<75||!!a&&a<600}var x=C.prototype;return x.destroy=function(){},x.resetTimeStamp=function(E){p.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=E},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(E){var A=!1,v=E.reduce(function(M,I){var P=I.pts-M;return P<-4294967296?(A=!0,f(M,I.pts)):P>0?M:I.pts},E[0].pts);return A&&p.logger.debug("PTS rollover detected"),v},x.remux=function(E,A,v,M,I,P,B,H){var F,W,U,K,z,te,de=I,ge=I,Ue=E.pid>-1,Me=A.pid>-1,Le=A.samples.length,Oe=E.samples.length>0,Fe=Le>1,ye=(!Ue||Oe)&&(!Me||Fe)||this.ISGenerated||B;if(ye){this.ISGenerated||(U=this.generateIS(E,A,I));var Ae=this.isVideoContiguous,re=-1;if(Fe&&(re=w(A.samples),!Ae&&this.config.forceKeyFrameOnDiscontinuity))if(te=!0,re>0){p.logger.warn("[mp4-remuxer]: Dropped "+re+" out of "+Le+" video samples due to a missing keyframe");var pe=this.getVideoStartPts(A.samples);A.samples=A.samples.slice(re),A.dropped+=re,ge+=(A.samples[0].pts-pe)/(A.timescale||9e4)}else re===-1&&(p.logger.warn("[mp4-remuxer]: No keyframe found out of "+Le+" video samples"),te=!1);if(this.ISGenerated){if(Oe&&Fe){var ue=this.getVideoStartPts(A.samples),Ie=f(E.samples[0].pts,ue)-ue,Ke=Ie/A.inputTimeScale;de+=Math.max(0,Ke),ge+=Math.max(0,-Ke)}if(Oe){if(E.samplerate||(p.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),U=this.generateIS(E,A,I)),W=this.remuxAudio(E,de,this.isAudioContiguous,P,Me||Fe||H===u.PlaylistLevelType.AUDIO?ge:void 0),Fe){var Ne=W?W.endPTS-W.startPTS:0;A.inputTimeScale||(p.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),U=this.generateIS(E,A,I)),F=this.remuxVideo(A,ge,Ae,Ne)}}else Fe&&(F=this.remuxVideo(A,ge,Ae,0));F&&(F.firstKeyFrame=re,F.independent=re!==-1)}}return this.ISGenerated&&(v.samples.length&&(z=this.remuxID3(v,I)),M.samples.length&&(K=this.remuxText(M,I))),{audio:W,video:F,initSegment:U,independent:te,text:K,id3:z}},x.generateIS=function(E,A,v){var M=E.samples,I=A.samples,P=this.typeSupported,B={},H=!Object(R.isFiniteNumber)(this._initPTS),F="audio/mp4",W,U,K;if(H&&(W=U=Infinity),E.config&&M.length&&(E.timescale=E.samplerate,E.isAAC||(P.mpeg?(F="audio/mpeg",E.codec=""):P.mp3&&(E.codec="mp3")),B.audio={id:"audio",container:F,codec:E.codec,initSegment:!E.isAAC&&P.mpeg?new Uint8Array(0):c.default.initSegment([E]),metadata:{channelCount:E.channelCount}},H&&(K=E.inputTimeScale,W=U=M[0].pts-Math.round(K*v))),A.sps&&A.pps&&I.length&&(A.timescale=A.inputTimeScale,B.video={id:"main",container:"video/mp4",codec:A.codec,initSegment:c.default.initSegment([A]),metadata:{width:A.width,height:A.height}},H)){K=A.inputTimeScale;var z=this.getVideoStartPts(I),te=Math.round(K*v);U=Math.min(U,f(I[0].dts,z)-te),W=Math.min(W,z-te)}if(Object.keys(B).length)return this.ISGenerated=!0,H&&(this._initPTS=W,this._initDTS=U),{tracks:B,initPTS:W,timescale:K}},x.remuxVideo=function(E,A,v,M){var I=E.inputTimeScale,P=E.samples,B=[],H=P.length,F=this._initPTS,W=this.nextAvcDts,U=8,K,z,te,de=Number.POSITIVE_INFINITY,ge=Number.NEGATIVE_INFINITY,Ue=0,Me=!1;if(!v||W===null){var Le=A*I,Oe=P[0].pts-f(P[0].dts,P[0].pts);W=Le-Oe}for(var Fe=0;Fe<H;Fe++){var ye=P[Fe];if(ye.pts=f(ye.pts-F,W),ye.dts=f(ye.dts-F,W),ye.dts>ye.pts){var Ae=9e4*.2;Ue=Math.max(Math.min(Ue,ye.pts-ye.dts),-1*Ae)}ye.dts<P[Fe>0?Fe-1:Fe].dts&&(Me=!0)}Me&&P.sort(function(Be,tt){var Qe=Be.dts-tt.dts,$e=Be.pts-tt.pts;return Qe||$e}),z=P[0].dts,te=P[P.length-1].dts;var re=Math.round((te-z)/(H-1));if(Ue<0){if(Ue<re*-2){p.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(o.toMsFromMpegTsClock)(-re,!0)+" ms");for(var pe=Ue,ue=0;ue<H;ue++)P[ue].dts=pe=Math.max(pe,P[ue].pts-re),P[ue].pts=Math.max(pe,P[ue].pts)}else{p.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(o.toMsFromMpegTsClock)(Ue,!0)+" ms to overcome this issue");for(var Ie=0;Ie<H;Ie++)P[Ie].dts=P[Ie].dts+Ue}z=P[0].dts}if(v){var Ke=z-W,Ne=Ke>re,je=Ke<-1;if(Ne||je){Ne?p.logger.warn("AVC: "+Object(o.toMsFromMpegTsClock)(Ke,!0)+" ms ("+Ke+"dts) hole between fragments detected, filling it"):p.logger.warn("AVC: "+Object(o.toMsFromMpegTsClock)(-Ke,!0)+" ms ("+Ke+"dts) overlapping between fragments detected"),z=W;var Ge=P[0].pts-Ke;P[0].dts=z,P[0].pts=Ge,p.logger.log("Video: First PTS/DTS adjusted: "+Object(o.toMsFromMpegTsClock)(Ge,!0)+"/"+Object(o.toMsFromMpegTsClock)(z,!0)+", delta: "+Object(o.toMsFromMpegTsClock)(Ke,!0)+" ms")}}i&&(z=Math.max(0,z));for(var ze=0,ke=0,xe=0;xe<H;xe++){for(var Ee=P[xe],Se=Ee.units,$=Se.length,fe=0,J=0;J<$;J++)fe+=Se[J].data.length;ke+=fe,ze+=$,Ee.length=fe,Ee.dts=Math.max(Ee.dts,z),Ee.pts=Math.max(Ee.pts,Ee.dts,0),de=Math.min(Ee.pts,de),ge=Math.max(Ee.pts,ge)}te=P[H-1].dts;var Ce=ke+4*ze+8,We;try{We=new Uint8Array(Ce)}catch(Be){this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:y.ErrorTypes.MUX_ERROR,details:y.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ce,reason:"fail allocating video mdat "+Ce});return}var Ve=new DataView(We.buffer);Ve.setUint32(0,Ce),We.set(c.default.types.mdat,4);for(var Pe=0;Pe<H;Pe++){for(var Je=P[Pe],ne=Je.units,be=0,Re=0,le=ne.length;Re<le;Re++){var se=ne[Re],he=se.data,Y=se.data.byteLength;Ve.setUint32(U,Y),U+=4,We.set(he,U),U+=Y,be+=4+Y}if(Pe<H-1)K=P[Pe+1].dts-Je.dts;else{var Z=this.config,G=Je.dts-P[Pe>0?Pe-1:Pe].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var ae=Math.floor(Z.maxBufferHole*I),Te=(M?de+M*I:this.nextAudioPts)-Je.pts;Te>ae?(K=Te-G,K<0&&(K=G),p.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+K/90+" ms for the last video frame.")):K=G}else K=G}var X=Math.round(Je.pts-Je.dts);B.push(new m(Je.key,K,be,X))}if(B.length&&n&&n<70){var me=B[0].flags;me.dependsOn=2,me.isNonSync=0}console.assert(K!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=te+K,this.isVideoContiguous=!0;var De=c.default.moof(E.sequenceNumber++,z,d({},E,{samples:B})),oe="video",ve={data1:De,data2:We,startPTS:de/I,endPTS:(ge+K)/I,startDTS:z/I,endDTS:W/I,type:oe,hasAudio:!1,hasVideo:!0,nb:B.length,dropped:E.dropped};return E.samples=[],E.dropped=0,console.assert(We.length,"MDAT length must not be zero"),ve},x.remuxAudio=function(E,A,v,M,I){var P=E.inputTimeScale,B=E.samplerate?E.samplerate:P,H=P/B,F=E.isAAC?l:r,W=F*H,U=this._initPTS,K=!E.isAAC&&this.typeSupported.mpeg,z=[],te=E.samples,de=K?0:8,ge=this.nextAudioPts||-1,Ue=A*P;if(this.isAudioContiguous=v=v||te.length&&ge>0&&(M&&Math.abs(Ue-ge)<9e3||Math.abs(f(te[0].pts-U,Ue)-ge)<20*W),te.forEach(function(he){he.pts=f(he.pts-U,Ue)}),!v||ge<0){if(te=te.filter(function(he){return he.pts>=0}),!te.length)return;I===0?ge=0:M?ge=Math.max(0,Ue):ge=te[0].pts}if(E.isAAC)for(var Me=I!==void 0,Le=this.config.maxAudioFramesDrift,Oe=0,Fe=ge;Oe<te.length;Oe++){var ye=te[Oe],Ae=ye.pts,re=Ae-Fe,pe=Math.abs(1e3*re/P);if(re<=-Le*W&&Me)Oe===0&&(p.logger.warn("Audio frame @ "+(Ae/P).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*re/P)+" ms."),this.nextAudioPts=ge=Fe=Ae);else if(re>=Le*W&&pe<s&&Me){var ue=Math.round(re/W);Fe=Ae-ue*W,Fe<0&&(ue--,Fe+=W),Oe===0&&(this.nextAudioPts=ge=Fe),p.logger.warn("[mp4-remuxer]: Injecting "+ue+" audio frame @ "+(Fe/P).toFixed(3)+"s due to "+Math.round(1e3*re/P)+" ms gap.");for(var Ie=0;Ie<ue;Ie++){var Ke=Math.max(Fe,0),Ne=O.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);Ne||(p.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ne=ye.unit.subarray()),te.splice(Oe,0,{unit:Ne,pts:Ke}),Fe+=W,Oe++}}ye.pts=Fe,Fe+=W}for(var je=null,Ge=null,ze,ke=0,xe=te.length;xe--;)ke+=te[xe].unit.byteLength;for(var Ee=0,Se=te.length;Ee<Se;Ee++){var $=te[Ee],fe=$.unit,J=$.pts;if(Ge!==null){var Ce=z[Ee-1];Ce.duration=Math.round((J-Ge)/H)}else if(v&&E.isAAC&&(J=ge),je=J,ke>0){ke+=de;try{ze=new Uint8Array(ke)}catch(he){this.observer.emit(S.Events.ERROR,S.Events.ERROR,{type:y.ErrorTypes.MUX_ERROR,details:y.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!K){var We=new DataView(ze.buffer);We.setUint32(0,ke),ze.set(c.default.types.mdat,4)}}else return;ze.set(fe,de);var Ve=fe.byteLength;de+=Ve,z.push(new m(!0,F,Ve,0)),Ge=J}var Pe=z.length;if(!Pe)return;var Je=z[z.length-1];this.nextAudioPts=ge=Ge+H*Je.duration;var ne=K?new Uint8Array(0):c.default.moof(E.sequenceNumber++,je/H,d({},E,{samples:z}));E.samples=[];var be=je/P,Re=ge/P,le="audio",se={data1:ne,data2:ze,startPTS:be,endPTS:Re,startDTS:be,endDTS:Re,type:le,hasAudio:!0,hasVideo:!1,nb:Pe};return this.isAudioContiguous=!0,console.assert(ze.length,"MDAT length must not be zero"),se},x.remuxEmptyAudio=function(E,A,v,M){var I=E.inputTimeScale,P=E.samplerate?E.samplerate:I,B=I/P,H=this.nextAudioPts,F=(H!==null?H:M.startDTS*I)+this._initDTS,W=M.endDTS*I+this._initDTS,U=B*l,K=Math.ceil((W-F)/U),z=O.default.getSilentFrame(E.manifestCodec||E.codec,E.channelCount);if(p.logger.warn("[mp4-remuxer]: remux empty Audio"),!z){p.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var te=[],de=0;de<K;de++){var ge=F+de*U;te.push({unit:z,pts:ge,dts:ge})}return E.samples=te,this.remuxAudio(E,A,v,!1)},x.remuxID3=function(E,A){var v=E.samples.length;if(!v)return;for(var M=E.inputTimeScale,I=this._initPTS,P=this._initDTS,B=0;B<v;B++){var H=E.samples[B];H.pts=f(H.pts-I,A*M)/M,H.dts=f(H.dts-P,A*M)/M}var F=E.samples;return E.samples=[],{samples:F}},x.remuxText=function(E,A){var v=E.samples.length;if(!v)return;for(var M=E.inputTimeScale,I=this._initPTS,P=0;P<v;P++){var B=E.samples[P];B.pts=f(B.pts-I,A*M)/M}E.samples.sort(function(F,W){return F.pts-W.pts});var H=E.samples;return E.samples=[],{samples:H}},C}();function f(C,x){var b;if(x===null)return C;for(x<C?b=-8589934592:b=8589934592;Math.abs(C-x)>4294967296;)C+=b;return C}function w(C){for(var x=0;x<C.length;x++)if(C[x].key)return x;return-1}var m=function(x,b,E,A){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=b,this.size=E,this.cts=A,this.flags=new T(x)},T=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(j,k,D){"use strict";D.r(k);var R=D("./src/polyfills/number.ts"),O=D("./src/utils/mp4-tools.ts"),c=D("./src/loader/fragment.ts"),S=D("./src/utils/logger.ts"),y=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 d=o.prototype;return d.destroy=function(){},d.resetTimeStamp=function(l){this.initPTS=l,this.lastEndDTS=null},d.resetNextTimestamp=function(){this.lastEndDTS=null},d.resetInitSegment=function(l,r,n){this.audioCodec=r,this.videoCodec=n,this.generateInitSegment(l),this.emitInitSegment=!0},d.generateInitSegment=function(l){var r=this.audioCodec,n=this.videoCodec;if(!l||!l.byteLength){this.initTracks=void 0,this.initData=void 0;return}var a=this.initData=Object(O.parseInitSegment)(l);r||(r=u(a.audio,c.ElementaryStreamTypes.AUDIO)),n||(n=u(a.video,c.ElementaryStreamTypes.VIDEO));var i={};a.audio&&a.video?i.audiovideo={container:"video/mp4",codec:r+","+n,initSegment:l,id:"main"}:a.audio?i.audio={container:"audio/mp4",codec:r,initSegment:l,id:"audio"}:a.video?i.video={container:"video/mp4",codec:n,initSegment:l,id:"main"}:S.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},d.remux=function(l,r,n,a,i){var h=this.initPTS,f=this.lastEndDTS,w={audio:void 0,video:void 0,text:a,id3:n,initSegment:void 0};Object(R.isFiniteNumber)(f)||(f=this.lastEndDTS=i||0);var m=r.samples;if(!m||!m.length)return w;var T={initPTS:void 0,timescale:1},C=this.initData;if((!C||!C.length)&&(this.generateInitSegment(m),C=this.initData),!C||!C.length)return S.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1),Object(R.isFiniteNumber)(h)||(this.initPTS=T.initPTS=h=p(C,m,f));var x=Object(O.getDuration)(m,C),b=f,E=x+b;Object(O.offsetStartDTS)(C,m,h),x>0?this.lastEndDTS=E:(S.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var A=!!C.audio,v=!!C.video,M="";A&&(M+="audio"),v&&(M+="video");var I={data1:m,startPTS:b,startDTS:b,endPTS:E,endDTS:E,type:M,hasAudio:A,hasVideo:v,nb:1,dropped:0};return w.audio=I.type==="audio"?I:void 0,w.video=I.type!=="audio"?I:void 0,w.text=a,w.id3=n,w.initSegment=T,w},o}(),p=function(d,s,l){return Object(O.getStartDTS)(d,s)-l};function u(o,d){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"||d===c.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}k.default=y},"./src/task-loop.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return R});var R=function(){function O(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var c=O.prototype;return c.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},c.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},c.onHandlerDestroyed=function(){},c.hasInterval=function(){return!!this._tickInterval},c.hasNextTick=function(){return!!this._tickTimer},c.setInterval=function(y){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,y),!0)},c.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},c.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},c.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},c.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},c.doTick=function(){},O}()},"./src/types/cmcd.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"CMCDVersion",function(){return R}),D.d(k,"CMCDObjectType",function(){return O}),D.d(k,"CMCDStreamingFormat",function(){return c}),D.d(k,"CMCDStreamType",function(){return S});var R=1,O;(function(y){y.MANIFEST="m",y.AUDIO="a",y.VIDEO="v",y.MUXED="av",y.INIT="i",y.CAPTION="c",y.TIMED_TEXT="tt",y.KEY="k",y.OTHER="o"})(O||(O={}));var c;(function(y){y.DASH="d",y.HLS="h",y.SMOOTH="s",y.OTHER="o"})(c||(c={}));var S;(function(y){y.VOD="v",y.LIVE="l"})(S||(S={}))},"./src/types/level.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"HlsSkip",function(){return c}),D.d(k,"getSkipValue",function(){return S}),D.d(k,"HlsUrlParameters",function(){return y}),D.d(k,"Level",function(){return p});function R(u,o){for(var d=0;d<o.length;d++){var s=o[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(u,s.key,s)}}function O(u,o,d){return o&&R(u.prototype,o),d&&R(u,d),u}var c;(function(u){u.No="",u.Yes="YES",u.v2="v2"})(c||(c={}));function S(u,o){var d=u.canSkipUntil,s=u.canSkipDateRanges,l=u.endSN,r=o!==void 0?o-l:0;return d&&r<d?s?c.v2:c.Yes:c.No}var y=function(){function u(d,s,l){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=d,this.part=s,this.skip=l}var o=u.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()},u}(),p=function(){function u(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(d){return d}).join(",").replace(/\.[^.,]+/g,"")}return O(u,[{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(d){var s=d%this.url.length;this._urlId!==s&&(this.details=void 0,this._urlId=s)}}]),u}()},"./src/types/loader.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"PlaylistContextType",function(){return R}),D.d(k,"PlaylistLevelType",function(){return O});var R;(function(c){c.MANIFEST="manifest",c.LEVEL="level",c.AUDIO_TRACK="audioTrack",c.SUBTITLE_TRACK="subtitleTrack"})(R||(R={}));var O;(function(c){c.MAIN="main",c.AUDIO="audio",c.SUBTITLE="subtitle"})(O||(O={}))},"./src/types/transmuxer.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"ChunkMetadata",function(){return R});var R=function(S,y,p,u,o,d){u===void 0&&(u=0),o===void 0&&(o=-1),d===void 0&&(d=!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=O(),this.buffering={audio:O(),video:O(),audiovideo:O()},this.level=S,this.sn=y,this.id=p,this.size=u,this.part=o,this.partial=d};function O(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"AttrList",function(){return c});var R=/^(\d+)x(\d+)$/,O=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,c=function(){function S(p){typeof p=="string"&&(p=S.parseAttrList(p));for(var u in p)p.hasOwnProperty(u)&&(this[u]=p[u])}var y=S.prototype;return y.decimalInteger=function(u){var o=parseInt(this[u],10);return o>Number.MAX_SAFE_INTEGER?Infinity:o},y.hexadecimalInteger=function(u){if(this[u]){var o=(this[u]||"0x").slice(2);o=(o.length&1?"0":"")+o;for(var d=new Uint8Array(o.length/2),s=0;s<o.length/2;s++)d[s]=parseInt(o.slice(s*2,s*2+2),16);return d}else return null},y.hexadecimalIntegerAsNumber=function(u){var o=parseInt(this[u],16);return o>Number.MAX_SAFE_INTEGER?Infinity:o},y.decimalFloatingPoint=function(u){return parseFloat(this[u])},y.optionalFloat=function(u,o){var d=this[u];return d?parseFloat(d):o},y.enumeratedString=function(u){return this[u]},y.bool=function(u){return this[u]==="YES"},y.decimalResolution=function(u){var o=R.exec(this[u]);return o===null?void 0:{width:parseInt(o[1],10),height:parseInt(o[2],10)}},S.parseAttrList=function(u){var o,d={},s='"';for(O.lastIndex=0;(o=O.exec(u))!==null;){var l=o[2];l.indexOf(s)===0&&l.lastIndexOf(s)===l.length-1&&(l=l.slice(1,-1)),d[o[1]]=l}return d},S}()},"./src/utils/binary-search.ts":function(j,k,D){"use strict";D.r(k);var R={search:function(c,S){for(var y=0,p=c.length-1,u=null,o=null;y<=p;){u=(y+p)/2|0,o=c[u];var d=S(o);if(d>0)y=u+1;else if(d<0)p=u-1;else return o}return null}};k.default=R},"./src/utils/buffer-helper.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"BufferHelper",function(){return c});var R=D("./src/utils/logger.ts"),O={length:0,start:function(){return 0},end:function(){return 0}},c=function(){function S(){}return S.isBuffered=function(p,u){try{if(p){for(var o=S.getBuffered(p),d=0;d<o.length;d++)if(u>=o.start(d)&&u<=o.end(d))return!0}}catch(s){}return!1},S.bufferInfo=function(p,u,o){try{if(p){var d=S.getBuffered(p),s=[],l;for(l=0;l<d.length;l++)s.push({start:d.start(l),end:d.end(l)});return this.bufferedInfo(s,u,o)}}catch(r){}return{len:0,start:u,end:u,nextStart:void 0}},S.bufferedInfo=function(p,u,o){u=Math.max(0,u),p.sort(function(T,C){var x=T.start-C.start;return x||C.end-T.end});var d=[];if(o)for(var s=0;s<p.length;s++){var l=d.length;if(l){var r=d[l-1].end;p[s].start-r<o?p[s].end>r&&(d[l-1].end=p[s].end):d.push(p[s])}else d.push(p[s])}else d=p;for(var n=0,a,i=u,h=u,f=0;f<d.length;f++){var w=d[f].start,m=d[f].end;if(u+o>=w&&u<m)i=w,h=m,n=h-u;else if(u+o<w){a=w;break}}return{len:n,start:i||0,end:h||0,nextStart:a}},S.getBuffered=function(p){try{return p.buffered}catch(u){return R.logger.log("failed to get media.buffered",u),O}},S}()},"./src/utils/cea-608-parser.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"Row",function(){return h}),D.d(k,"CaptionScreen",function(){return f});var R=D("./src/utils/logger.ts"),O={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},c=function(E){var A=E;return O.hasOwnProperty(E)&&(A=O[E]),String.fromCharCode(A)},S=15,y=100,p={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={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},d={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(b){b[b.ERROR=0]="ERROR",b[b.TEXT=1]="TEXT",b[b.WARNING=2]="WARNING",b[b.INFO=2]="INFO",b[b.DEBUG=3]="DEBUG",b[b.DATA=3]="DATA"})(l||(l={}));var r=function(){function b(){this.time=null,this.verboseLevel=l.ERROR}var E=b.prototype;return E.log=function(v,M){this.verboseLevel>=v&&R.logger.log(this.time+" ["+v+"] "+M)},b}(),n=function(E){for(var A=[],v=0;v<E.length;v++)A.push(E[v].toString(16));return A},a=function(){function b(A,v,M,I,P){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=v||!1,this.italics=M||!1,this.background=I||"black",this.flash=P||!1}var E=b.prototype;return E.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},E.setStyles=function(v){for(var M=["foreground","underline","italics","background","flash"],I=0;I<M.length;I++){var P=M[I];v.hasOwnProperty(P)&&(this[P]=v[P])}},E.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},E.equals=function(v){return this.foreground===v.foreground&&this.underline===v.underline&&this.italics===v.italics&&this.background===v.background&&this.flash===v.flash},E.copy=function(v){this.foreground=v.foreground,this.underline=v.underline,this.italics=v.italics,this.background=v.background,this.flash=v.flash},E.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},b}(),i=function(){function b(A,v,M,I,P,B){this.uchar=void 0,this.penState=void 0,this.uchar=A||" ",this.penState=new a(v,M,I,P,B)}var E=b.prototype;return E.reset=function(){this.uchar=" ",this.penState.reset()},E.setChar=function(v,M){this.uchar=v,this.penState.copy(M)},E.setPenState=function(v){this.penState.copy(v)},E.equals=function(v){return this.uchar===v.uchar&&this.penState.equals(v.penState)},E.copy=function(v){this.uchar=v.uchar,this.penState.copy(v.penState)},E.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},b}(),h=function(){function b(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 v=0;v<y;v++)this.chars.push(new i);this.logger=A,this.pos=0,this.currPenState=new a}var E=b.prototype;return E.equals=function(v){for(var M=!0,I=0;I<y;I++)if(!this.chars[I].equals(v.chars[I])){M=!1;break}return M},E.copy=function(v){for(var M=0;M<y;M++)this.chars[M].copy(v.chars[M])},E.isEmpty=function(){for(var v=!0,M=0;M<y;M++)if(!this.chars[M].isEmpty()){v=!1;break}return v},E.setCursor=function(v){this.pos!==v&&(this.pos=v),this.pos<0?(this.logger.log(l.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>y&&(this.logger.log(l.DEBUG,"Too large cursor position "+this.pos),this.pos=y)},E.moveCursor=function(v){var M=this.pos+v;if(v>1)for(var I=this.pos+1;I<M+1;I++)this.chars[I].setPenState(this.currPenState);this.setCursor(M)},E.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},E.insertChar=function(v){v>=144&&this.backSpace();var M=c(v);if(this.pos>=y){this.logger.log(l.ERROR,"Cannot insert "+v.toString(16)+" ("+M+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(M,this.currPenState),this.moveCursor(1)},E.clearFromPos=function(v){var M;for(M=v;M<y;M++)this.chars[M].reset()},E.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},E.clearToEndOfRow=function(){this.clearFromPos(this.pos)},E.getTextString=function(){for(var v=[],M=!0,I=0;I<y;I++){var P=this.chars[I].uchar;P!==" "&&(M=!1),v.push(P)}return M?"":v.join("")},E.setPenStyles=function(v){this.currPenState.setStyles(v);var M=this.chars[this.pos];M.setPenState(this.currPenState)},b}(),f=function(){function b(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 v=0;v<S;v++)this.rows.push(new h(A));this.logger=A,this.currRow=S-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var E=b.prototype;return E.reset=function(){for(var v=0;v<S;v++)this.rows[v].clear();this.currRow=S-1},E.equals=function(v){for(var M=!0,I=0;I<S;I++)if(!this.rows[I].equals(v.rows[I])){M=!1;break}return M},E.copy=function(v){for(var M=0;M<S;M++)this.rows[M].copy(v.rows[M])},E.isEmpty=function(){for(var v=!0,M=0;M<S;M++)if(!this.rows[M].isEmpty()){v=!1;break}return v},E.backSpace=function(){var v=this.rows[this.currRow];v.backSpace()},E.clearToEndOfRow=function(){var v=this.rows[this.currRow];v.clearToEndOfRow()},E.insertChar=function(v){var M=this.rows[this.currRow];M.insertChar(v)},E.setPen=function(v){var M=this.rows[this.currRow];M.setPenStyles(v)},E.moveCursor=function(v){var M=this.rows[this.currRow];M.moveCursor(v)},E.setCursor=function(v){this.logger.log(l.INFO,"setCursor: "+v);var M=this.rows[this.currRow];M.setCursor(v)},E.setPAC=function(v){this.logger.log(l.INFO,"pacData = "+JSON.stringify(v));var M=v.row-1;if(this.nrRollUpRows&&M<this.nrRollUpRows-1&&(M=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==M){for(var I=0;I<S;I++)this.rows[I].clear();var P=this.currRow+1-this.nrRollUpRows,B=this.lastOutputScreen;if(B){var H=B.rows[P].cueStartTime,F=this.logger.time;if(H&&F!==null&&H<F)for(var W=0;W<this.nrRollUpRows;W++)this.rows[M-this.nrRollUpRows+W+1].copy(B.rows[P+W])}}this.currRow=M;var U=this.rows[this.currRow];if(v.indent!==null){var K=v.indent,z=Math.max(K-1,0);U.setCursor(v.indent),v.color=U.chars[z].penState.foreground}var te={foreground:v.color,underline:v.underline,italics:v.italics,background:"black",flash:!1};this.setPen(te)},E.setBkgData=function(v){this.logger.log(l.INFO,"bkgData = "+JSON.stringify(v)),this.backSpace(),this.setPen(v),this.insertChar(32)},E.setRollUpRows=function(v){this.nrRollUpRows=v},E.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 v=this.currRow+1-this.nrRollUpRows,M=this.rows.splice(v,1)[0];M.clear(),this.rows.splice(this.currRow,0,M),this.logger.log(l.INFO,"Rolling up")},E.getDisplayText=function(v){v=v||!1;for(var M=[],I="",P=-1,B=0;B<S;B++){var H=this.rows[B].getTextString();H&&(P=B+1,v?M.push("Row "+P+": '"+H+"'"):M.push(H.trim()))}return M.length>0&&(v?I="["+M.join(" | ")+"]":I=M.join(`
|
|
|
`)),I},E.getTextAndFormat=function(){return this.rows},b}(),w=function(){function b(A,v,M){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=A,this.outputFilter=v,this.mode=null,this.verbose=0,this.displayedMemory=new f(M),this.nonDisplayedMemory=new f(M),this.lastOutputScreen=new f(M),this.currRollUpRow=this.displayedMemory.rows[S-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=M}var E=b.prototype;return E.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},E.getHandler=function(){return this.outputFilter},E.setHandler=function(v){this.outputFilter=v},E.setPAC=function(v){this.writeScreen.setPAC(v)},E.setBkgData=function(v){this.writeScreen.setBkgData(v)},E.setMode=function(v){if(v===this.mode)return;this.mode=v,this.logger.log(l.INFO,"MODE="+v),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=v},E.insertChars=function(v){for(var M=0;M<v.length;M++)this.writeScreen.insertChar(v[M]);var I=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(l.INFO,I+": "+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())},E.ccRCL=function(){this.logger.log(l.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},E.ccBS=function(){if(this.logger.log(l.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},E.ccAOF=function(){},E.ccAON=function(){},E.ccDER=function(){this.logger.log(l.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},E.ccRU=function(v){this.logger.log(l.INFO,"RU("+v+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(v)},E.ccFON=function(){this.logger.log(l.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},E.ccRDC=function(){this.logger.log(l.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},E.ccTR=function(){this.logger.log(l.INFO,"TR"),this.setMode("MODE_TEXT")},E.ccRTD=function(){this.logger.log(l.INFO,"RTD"),this.setMode("MODE_TEXT")},E.ccEDM=function(){this.logger.log(l.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},E.ccCR=function(){this.logger.log(l.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},E.ccENM=function(){this.logger.log(l.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},E.ccEOC=function(){if(this.logger.log(l.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var v=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=v,this.writeScreen=this.nonDisplayedMemory,this.logger.log(l.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},E.ccTO=function(v){this.logger.log(l.INFO,"TO("+v+") - Tab Offset"),this.writeScreen.moveCursor(v)},E.ccMIDROW=function(v){var M={flash:!1};if(M.underline=v%2===1,M.italics=v>=46,M.italics)M.foreground="white";else{var I=Math.floor(v/2)-16,P=["white","green","blue","cyan","red","yellow","magenta"];M.foreground=P[I]}this.logger.log(l.INFO,"MIDROW: "+JSON.stringify(M)),this.writeScreen.setPen(M)},E.outputDataUpdate=function(v){v===void 0&&(v=!1);var M=this.logger.time;if(M===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=M:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,M,this.lastOutputScreen),v&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:M),this.lastOutputScreen.copy(this.displayedMemory))},E.cueSplitAtTime=function(v){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,v,this.displayedMemory),this.cueStartTime=v))},b}(),m=function(){function b(A,v,M){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var I=new r;this.channels=[null,new w(A,v,I),new w(A+1,M,I)],this.cmdHistory=x(),this.logger=I}var E=b.prototype;return E.getHandler=function(v){return this.channels[v].getHandler()},E.setHandler=function(v,M){this.channels[v].setHandler(M)},E.addData=function(v,M){var I,P,B,H=!1;this.logger.time=v;for(var F=0;F<M.length;F+=2){if(P=M[F]&127,B=M[F+1]&127,P===0&&B===0)continue;if(this.logger.log(l.DATA,"["+n([M[F],M[F+1]])+"] -> ("+n([P,B])+")"),I=this.parseCmd(P,B),I||(I=this.parseMidrow(P,B)),I||(I=this.parsePAC(P,B)),I||(I=this.parseBackgroundAttributes(P,B)),!I&&(H=this.parseChars(P,B),H)){var W=this.currentChannel;if(W&&W>0){var U=this.channels[W];U.insertChars(H)}else this.logger.log(l.WARNING,"No channel found yet. TEXT-MODE?")}!I&&!H&&this.logger.log(l.WARNING,"Couldn't parse cleaned data "+n([P,B])+" orig: "+n([M[F],M[F+1]]))}},E.parseCmd=function(v,M){var I=this.cmdHistory,P=(v===20||v===28||v===21||v===29)&&M>=32&&M<=47,B=(v===23||v===31)&&M>=33&&M<=35;if(!(P||B))return!1;if(C(v,M,I))return T(null,null,I),this.logger.log(l.DEBUG,"Repeated command ("+n([v,M])+") is dropped"),!0;var H=v===20||v===21||v===23?1:2,F=this.channels[H];return v===20||v===21||v===28||v===29?M===32?F.ccRCL():M===33?F.ccBS():M===34?F.ccAOF():M===35?F.ccAON():M===36?F.ccDER():M===37?F.ccRU(2):M===38?F.ccRU(3):M===39?F.ccRU(4):M===40?F.ccFON():M===41?F.ccRDC():M===42?F.ccTR():M===43?F.ccRTD():M===44?F.ccEDM():M===45?F.ccCR():M===46?F.ccENM():M===47&&F.ccEOC():F.ccTO(M-32),T(v,M,I),this.currentChannel=H,!0},E.parseMidrow=function(v,M){var I=0;if((v===17||v===25)&&M>=32&&M<=47){if(v===17?I=1:I=2,I!==this.currentChannel)return this.logger.log(l.ERROR,"Mismatch channel in midrow parsing"),!1;var P=this.channels[I];return P?(P.ccMIDROW(M),this.logger.log(l.DEBUG,"MIDROW ("+n([v,M])+")"),!0):!1}return!1},E.parsePAC=function(v,M){var I,P=this.cmdHistory,B=(v>=17&&v<=23||v>=25&&v<=31)&&M>=64&&M<=127,H=(v===16||v===24)&&M>=64&&M<=95;if(!(B||H))return!1;if(C(v,M,P))return T(null,null,P),!0;var F=v<=23?1:2;M>=64&&M<=95?I=F===1?p[v]:o[v]:I=F===1?u[v]:d[v];var W=this.channels[F];return W?(W.setPAC(this.interpretPAC(I,M)),T(v,M,P),this.currentChannel=F,!0):!1},E.interpretPAC=function(v,M){var I,P={color:null,italics:!1,indent:null,underline:!1,row:v};return M>95?I=M-96:I=M-64,P.underline=(I&1)===1,I<=13?P.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(I/2)]:I<=15?(P.italics=!0,P.color="white"):P.indent=Math.floor((I-16)/2)*4,P},E.parseChars=function(v,M){var I,P=null,B=null;if(v>=25?(I=2,B=v-8):(I=1,B=v),B>=17&&B<=19){var H;B===17?H=M+80:B===18?H=M+112:H=M+144,this.logger.log(l.INFO,"Special char '"+c(H)+"' in channel "+I),P=[H]}else v>=32&&v<=127&&(P=M===0?[v]:[v,M]);if(P){var F=n(P);this.logger.log(l.DEBUG,"Char codes = "+F.join(",")),T(v,M,this.cmdHistory)}return P},E.parseBackgroundAttributes=function(v,M){var I=(v===16||v===24)&&M>=32&&M<=47,P=(v===23||v===31)&&M>=45&&M<=47;if(!(I||P))return!1;var B,H={};v===16||v===24?(B=Math.floor((M-32)/2),H.background=s[B],M%2===1&&(H.background=H.background+"_semi")):M===45?H.background="transparent":(H.foreground="black",M===47&&(H.underline=!0));var F=v<=23?1:2,W=this.channels[F];return W.setBkgData(H),T(v,M,this.cmdHistory),!0},E.reset=function(){for(var v=0;v<Object.keys(this.channels).length;v++){var M=this.channels[v];M&&M.reset()}this.cmdHistory=x()},E.cueSplitAtTime=function(v){for(var M=0;M<this.channels.length;M++){var I=this.channels[M];I&&I.cueSplitAtTime(v)}},b}();function T(b,E,A){A.a=b,A.b=E}function C(b,E,A){return A.a===b&&A.b===E}function x(){return{a:null,b:null}}k.default=m},"./src/utils/codecs.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"isCodecType",function(){return O}),D.d(k,"isCodecSupportedInMp4",function(){return c});var R={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 O(S,y){var p=R[y];return!!p&&p[S.slice(0,4)]===!0}function c(S,y){return MediaSource.isTypeSupported((y||"video")+'/mp4;codecs="'+S+'"')}},"./src/utils/cues.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/utils/vttparser.ts"),O=D("./src/utils/webvtt-parser.ts"),c=D("./src/utils/texttrack-utils.ts"),S=/\s/,y={newCue:function(u,o,d,s){for(var l=[],r,n,a,i,h,f=self.VTTCue||self.TextTrackCue,w=0;w<s.rows.length;w++)if(r=s.rows[w],a=!0,i=0,h="",!r.isEmpty()){for(var m=0;m<r.chars.length;m++)S.test(r.chars[m].uchar)&&a?i++:(h+=r.chars[m].uchar,a=!1);r.cueStartTime=o,o===d&&(d+=1e-4),i>=16?i--:i++;var T=Object(R.fixLineBreaks)(h.trim()),C=Object(O.generateCueId)(o,d,T);(!u||!u.cues||!u.cues.getCueById(C))&&(n=new f(o,d,T),n.id=C,n.line=w+1,n.align="left",n.position=10+Math.min(80,Math.floor(i*8/32)*10),l.push(n))}return u&&l.length&&(l.sort(function(x,b){return x.line==="auto"||b.line==="auto"?0:x.line>8&&b.line>8?b.line-x.line:x.line-b.line}),l.forEach(function(x){return Object(c.addCueToTrack)(u,x)})),l}};k.default=y},"./src/utils/discontinuities.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"findFirstFragWithCC",function(){return S}),D.d(k,"shouldAlignOnDiscontinuities",function(){return y}),D.d(k,"findDiscontinuousReferenceFrag",function(){return p}),D.d(k,"adjustSlidingStart",function(){return o}),D.d(k,"alignStream",function(){return d}),D.d(k,"alignPDT",function(){return l}),D.d(k,"alignFragmentByPDTDelta",function(){return r}),D.d(k,"alignMediaPlaylistByPDT",function(){return n});var R=D("./src/polyfills/number.ts"),O=D("./src/utils/logger.ts"),c=D("./src/controller/level-helper.ts");function S(a,i){for(var h=null,f=0,w=a.length;f<w;f++){var m=a[f];if(m&&m.cc===i){h=m;break}}return h}function y(a,i,h){return!!(i.details&&(h.endCC>h.startCC||a&&a.cc<h.startCC))}function p(a,i){var h=a.fragments,f=i.fragments;if(!f.length||!h.length){O.logger.log("No fragments to align");return}var w=S(h,f[0].cc);if(!w||w&&!w.startPTS){O.logger.log("No frag in previous level to align on");return}return w}function u(a,i){if(a){var h=a.start+i;a.start=a.startPTS=h,a.endPTS=h+a.duration}}function o(a,i){for(var h=i.fragments,f=0,w=h.length;f<w;f++)u(h[f],a);i.fragmentHint&&u(i.fragmentHint,a),i.alignedSliding=!0}function d(a,i,h){if(!i)return;s(a,h,i),!h.alignedSliding&&i.details&&l(h,i.details),!h.alignedSliding&&i.details&&!h.skippedSegments&&Object(c.adjustSliding)(i.details,h)}function s(a,i,h){if(y(a,h,i)){var f=p(h.details,i);f&&Object(R.isFiniteNumber)(f.start)&&(O.logger.log("Adjusting PTS using last level due to CC increase within current level "+i.url),o(f.start,i))}}function l(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var h=i.fragments[0].programDateTime,f=a.fragments[0].programDateTime,w=(f-h)/1e3+i.fragments[0].start;w&&Object(R.isFiniteNumber)(w)&&(O.logger.log("Adjusting PTS using programDateTime delta "+(f-h)+"ms, sliding:"+w.toFixed(3)+" "+a.url+" "),o(w,a))}function r(a,i){var h=a.programDateTime;if(!h)return;var f=(h-i)/1e3;a.start=a.startPTS=f,a.endPTS=f+a.duration}function n(a,i){if(!i.fragments.length||!a.hasProgramDateTime||!i.hasProgramDateTime)return;var h=i.fragments[0].programDateTime,f=i.fragments[0].start,w=h-f*1e3;a.fragments.forEach(function(m){r(m,w)}),a.fragmentHint&&r(a.fragmentHint,w),a.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/utils/ewma.ts"),O=function(){function c(y,p,u){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=u,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new R.default(y),this.fast_=new R.default(p)}var S=c.prototype;return S.update=function(p,u){var o=this.slow_,d=this.fast_;this.slow_.halfLife!==p&&(this.slow_=new R.default(p,o.getEstimate(),o.getTotalWeight())),this.fast_.halfLife!==u&&(this.fast_=new R.default(u,d.getEstimate(),d.getTotalWeight()))},S.sample=function(p,u){p=Math.max(p,this.minDelayMs_);var o=8*u,d=p/1e3,s=o/d;this.fast_.sample(d,s),this.slow_.sample(d,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(){},c}();k.default=O},"./src/utils/ewma.ts":function(j,k,D){"use strict";D.r(k);var R=function(){function O(S,y,p){y===void 0&&(y=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_=y,this.totalWeight_=p}var c=O.prototype;return c.sample=function(y,p){var u=Math.pow(this.alpha_,y);this.estimate_=p*(1-u)+u*this.estimate_,this.totalWeight_+=y},c.getTotalWeight=function(){return this.totalWeight_},c.getEstimate=function(){if(this.alpha_){var y=1-Math.pow(this.alpha_,this.totalWeight_);if(y)return this.estimate_/y}return this.estimate_},O}();k.default=R},"./src/utils/fetch-loader.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"fetchSupported",function(){return r});var R=D("./src/polyfills/number.ts"),O=D("./src/loader/load-stats.ts"),c=D("./src/demux/chunk-cache.ts");function S(f,w){f.prototype=Object.create(w.prototype),f.prototype.constructor=f,d(f,w)}function y(f){var w=typeof Map=="function"?new Map:void 0;return y=function(T){if(T===null||!o(T))return T;if(typeof T!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(T))return w.get(T);w.set(T,C)}function C(){return p(T,arguments,s(this).constructor)}return C.prototype=Object.create(T.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),d(C,T)},y(f)}function p(f,w,m){return u()?p=Reflect.construct:p=function(C,x,b){var E=[null];E.push.apply(E,x);var A=Function.bind.apply(C,E),v=new A;return b&&d(v,b.prototype),v},p.apply(null,arguments)}function u(){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(f){return!1}}function o(f){return Function.toString.call(f).indexOf("[native code]")!==-1}function d(f,w){return d=Object.setPrototypeOf||function(T,C){return T.__proto__=C,T},d(f,w)}function s(f){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(m){return m.__proto__||Object.getPrototypeOf(m)},s(f)}function l(){return l=Object.assign||function(f){for(var w=1;w<arguments.length;w++){var m=arguments[w];for(var T in m)Object.prototype.hasOwnProperty.call(m,T)&&(f[T]=m[T])}return f},l.apply(this,arguments)}function r(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(f){}return!1}var n=function(){function f(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||i,this.controller=new self.AbortController,this.stats=new O.LoadStats}var w=f.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var T=this.response;(!T||!T.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var T;this.abortInternal(),(T=this.callbacks)!==null&&T!==void 0&&T.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(T,C,x){var b=this,E=this.stats;if(E.loading.start)throw new Error("Loader can only be used once.");E.loading.start=self.performance.now();var A=a(T,this.controller.signal),v=x.onProgress,M=T.responseType==="arraybuffer",I=M?"byteLength":"length";this.context=T,this.config=C,this.callbacks=x,this.request=this.fetchSetup(T,A),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){b.abortInternal(),x.onTimeout(E,T,b.response)},C.timeout),self.fetch(this.request).then(function(P){if(b.response=b.loader=P,!P.ok){var B=P.status,H=P.statusText;throw new h(H||"fetch, bad network response",B,P)}return E.loading.first=Math.max(self.performance.now(),E.loading.start),E.total=parseInt(P.headers.get("Content-Length")||"0"),v&&Object(R.isFiniteNumber)(C.highWaterMark)?b.loadProgressively(P,E,T,C.highWaterMark,v):M?P.arrayBuffer():P.text()}).then(function(P){var B=b.response;self.clearTimeout(b.requestTimeout),E.loading.end=Math.max(self.performance.now(),E.loading.first),E.loaded=E.total=P[I];var H={url:B.url,data:P};v&&!Object(R.isFiniteNumber)(C.highWaterMark)&&v(E,T,P,B),x.onSuccess(H,E,T,B)}).catch(function(P){if(self.clearTimeout(b.requestTimeout),E.aborted)return;var B=P.code||0;x.onError({code:B,text:P.message},T,P.details)})},w.getCacheAge=function(){var T=null;if(this.response){var C=this.response.headers.get("age");T=C?parseFloat(C):null}return T},w.loadProgressively=function(T,C,x,b,E){b===void 0&&(b=0);var A=new c.default,v=T.body.getReader(),M=function I(){return v.read().then(function(P){if(P.done)return A.dataLength&&E(C,x,A.flush(),T),Promise.resolve(new ArrayBuffer(0));var B=P.value,H=B.length;return C.loaded+=H,H<b||A.dataLength?(A.push(B),A.dataLength>=b&&E(C,x,A.flush(),T)):E(C,x,B,T),I()}).catch(function(){return Promise.reject()})};return M()},f}();function a(f,w){var m={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(l({},f.headers))};return f.rangeEnd&&m.headers.set("Range","bytes="+f.rangeStart+"-"+String(f.rangeEnd-1)),m}function i(f,w){return new self.Request(f.url,w)}var h=function(f){S(w,f);function w(m,T,C){var x;return x=f.call(this,m)||this,x.code=void 0,x.details=void 0,x.code=T,x.details=C,x}return w}(y(Error));k.default=n},"./src/utils/imsc1-ttml-parser.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"IMSC1_CODEC",function(){return o}),D.d(k,"parseIMSC1",function(){return r});var R=D("./src/utils/mp4-tools.ts"),O=D("./src/utils/vttparser.ts"),c=D("./src/utils/vttcue.ts"),S=D("./src/demux/id3.ts"),y=D("./src/utils/timescale-conversion.ts"),p=D("./src/utils/webvtt-parser.ts");function u(){return u=Object.assign||function(b){for(var E=1;E<arguments.length;E++){var A=arguments[E];for(var v in A)Object.prototype.hasOwnProperty.call(A,v)&&(b[v]=A[v])}return b},u.apply(this,arguments)}var o="stpp.ttml.im1t",d=/^(\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 r(b,E,A,v,M){var I=Object(R.findBox)(new Uint8Array(b),["mdat"]);if(I.length===0){M(new Error("Could not parse IMSC1 mdat"));return}var P=I[0],B=Object(S.utf8ArrayToStr)(new Uint8Array(b,P.start,P.end-P.start)),H=Object(y.toTimescaleFromScale)(E,1,A);try{v(n(B,H))}catch(F){M(F)}}function n(b,E){var A=new DOMParser,v=A.parseFromString(b,"text/xml"),M=v.getElementsByTagName("tt")[0];if(!M)throw new Error("Invalid ttml");var I={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},P=Object.keys(I).reduce(function(U,K){return U[K]=M.getAttribute("ttp:"+K)||I[K],U},{}),B=M.getAttribute("xml:space")!=="preserve",H=i(a(M,"styling","style")),F=i(a(M,"layout","region")),W=a(M,"body","[begin]");return[].map.call(W,function(U){var K=h(U,B);if(!K||!U.hasAttribute("begin"))return null;var z=T(U.getAttribute("begin"),P),te=T(U.getAttribute("dur"),P),de=T(U.getAttribute("end"),P);if(z===null)throw m(U);if(de===null){if(te===null)throw m(U);de=z+te}var ge=new c.default(z-E,de-E,K);ge.id=Object(p.generateCueId)(ge.startTime,ge.endTime,ge.text);var Ue=F[U.getAttribute("region")],Me=H[U.getAttribute("style")];ge.position=10,ge.size=80;var Le=f(Ue,Me),Oe=Le.textAlign;if(Oe){var Fe=l[Oe];Fe&&(ge.lineAlign=Fe),ge.align=Oe}return u(ge,Le),ge}).filter(function(U){return U!==null})}function a(b,E,A){var v=b.getElementsByTagName(E)[0];return v?[].slice.call(v.querySelectorAll(A)):[]}function i(b){return b.reduce(function(E,A){var v=A.getAttribute("xml:id");return v&&(E[v]=A),E},{})}function h(b,E){return[].slice.call(b.childNodes).reduce(function(A,v,M){var I;return v.nodeName==="br"&&M?A+`
|
|
|
`:(I=v.childNodes)!==null&&I!==void 0&&I.length?h(v,E):E?A+v.textContent.trim().replace(/\s+/g," "):A+v.textContent},"")}function f(b,E){var A="http://www.w3.org/ns/ttml#styling",v=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return v.reduce(function(M,I){var P=w(E,A,I)||w(b,A,I);return P&&(M[I]=P),M},{})}function w(b,E,A){return b.hasAttributeNS(E,A)?b.getAttributeNS(E,A):null}function m(b){return new Error("Could not parse ttml timestamp "+b)}function T(b,E){if(!b)return null;var A=Object(O.parseTimeStamp)(b);return A===null&&(d.test(b)?A=C(b,E):s.test(b)&&(A=x(b,E))),A}function C(b,E){var A=d.exec(b),v=(A[4]|0)+(A[5]|0)/E.subFrameRate;return(A[1]|0)*3600+(A[2]|0)*60+(A[3]|0)+v/E.frameRate}function x(b,E){var A=s.exec(b),v=Number(A[1]),M=A[2];switch(M){case"h":return v*3600;case"m":return v*60;case"ms":return v*1e3;case"f":return v/E.frameRate;case"t":return v/E.tickRate}return v}},"./src/utils/logger.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"enableLogs",function(){return p}),D.d(k,"logger",function(){return u});var R=function(){},O={trace:R,debug:R,log:R,warn:R,info:R,error:R},c=O;function S(o){var d=self.console[o];return d?d.bind(self.console,"["+o+"] >"):R}function y(o){for(var d=arguments.length,s=new Array(d>1?d-1:0),l=1;l<d;l++)s[l-1]=arguments[l];s.forEach(function(r){c[r]=o[r]?o[r].bind(o):S(r)})}function p(o){if(self.console&&o===!0||typeof o=="object"){y(o,"debug","log","info","warn","error");try{c.log()}catch(d){c=O}}else c=O}var u=c},"./src/utils/mediakeys-helper.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"KeySystems",function(){return R}),D.d(k,"requestMediaKeySystemAccess",function(){return O});var R;(function(c){c.WIDEVINE="com.widevine.alpha",c.PLAYREADY="com.microsoft.playready"})(R||(R={}));var O=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"getMediaSource",function(){return R});function R(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"bin2str",function(){return y}),D.d(k,"readUint16",function(){return p}),D.d(k,"readUint32",function(){return u}),D.d(k,"writeUint32",function(){return o}),D.d(k,"findBox",function(){return d}),D.d(k,"parseSegmentIndex",function(){return s}),D.d(k,"parseInitSegment",function(){return l}),D.d(k,"getStartDTS",function(){return r}),D.d(k,"getDuration",function(){return n}),D.d(k,"computeRawDurationFromSamples",function(){return a}),D.d(k,"offsetStartDTS",function(){return i}),D.d(k,"segmentValidRange",function(){return h}),D.d(k,"appendUint8Array",function(){return f});var R=D("./src/utils/typed-array.ts"),O=D("./src/loader/fragment.ts"),c=Math.pow(2,32)-1,S=[].push;function y(w){return String.fromCharCode.apply(null,w)}function p(w,m){"data"in w&&(m+=w.start,w=w.data);var T=w[m]<<8|w[m+1];return T<0?65536+T:T}function u(w,m){"data"in w&&(m+=w.start,w=w.data);var T=w[m]<<24|w[m+1]<<16|w[m+2]<<8|w[m+3];return T<0?4294967296+T:T}function o(w,m,T){"data"in w&&(m+=w.start,w=w.data),w[m]=T>>24,w[m+1]=T>>16&255,w[m+2]=T>>8&255,w[m+3]=T&255}function d(w,m){var T=[];if(!m.length)return T;var C,x,b;"data"in w?(C=w.data,x=w.start,b=w.end):(C=w,x=0,b=C.byteLength);for(var E=x;E<b;){var A=u(C,E),v=y(C.subarray(E+4,E+8)),M=A>1?E+A:b;if(v===m[0])if(m.length===1)T.push({data:C,start:E+8,end:M});else{var I=d({data:C,start:E+8,end:M},m.slice(1));I.length&&S.apply(T,I)}E=M}return T}function s(w){var m=d(w,["moov"]),T=m[0],C=T?T.end:null,x=d(w,["sidx"]);if(!x||!x[0])return null;var b=[],E=x[0],A=E.data[0],v=A===0?8:16,M=u(E,v);v+=4;var I=0,P=0;A===0?v+=8:v+=16,v+=2;var B=E.end+P,H=p(E,v);v+=2;for(var F=0;F<H;F++){var W=v,U=u(E,W);W+=4;var K=U&2147483647,z=(U&2147483648)>>>31;if(z===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var te=u(E,W);W+=4,b.push({referenceSize:K,subsegmentDuration:te,info:{duration:te/M,start:B,end:B+K-1}}),B+=K,W+=4,v=W}return{earliestPresentationTime:I,timescale:M,version:A,referencesCount:H,references:b,moovEndOffset:C}}function l(w){for(var m=[],T=d(w,["moov","trak"]),C=0;C<T.length;C++){var x=T[C],b=d(x,["tkhd"])[0];if(b){var E=b.data[b.start],A=E===0?12:20,v=u(b,A),M=d(x,["mdia","mdhd"])[0];if(M){E=M.data[M.start],A=E===0?12:20;var I=u(M,A),P=d(x,["mdia","hdlr"])[0];if(P){var B=y(P.data.subarray(P.start+8,P.start+12)),H={soun:O.ElementaryStreamTypes.AUDIO,vide:O.ElementaryStreamTypes.VIDEO}[B];if(H){var F=d(x,["mdia","minf","stbl","stsd"])[0],W=void 0;F&&(W=y(F.data.subarray(F.start+12,F.start+16))),m[v]={timescale:I,type:H},m[H]={timescale:I,id:v,codec:W}}}}}}var U=d(w,["moov","mvex","trex"]);return U.forEach(function(K){var z=u(K,4),te=m[z];te&&(te.default={duration:u(K,12),flags:u(K,20)})}),m}function r(w,m){return d(m,["moof","traf"]).reduce(function(T,C){var x=d(C,["tfdt"])[0],b=x.data[x.start],E=d(C,["tfhd"]).reduce(function(A,v){var M=u(v,4),I=w[M];if(I){var P=u(x,4);b===1&&(P*=Math.pow(2,32),P+=u(x,8));var B=I.timescale||9e4,H=P/B;if(isFinite(H)&&(A===null||H<A))return H}return A},null);return E!==null&&isFinite(E)&&(T===null||E<T)?E:T},null)||0}function n(w,m){for(var T=0,C=0,x=0,b=d(w,["moof","traf"]),E=0;E<b.length;E++){var A=b[E],v=d(A,["tfhd"])[0],M=u(v,4),I=m[M];if(!I)continue;var P=I.default,B=u(v,0)|(P==null?void 0:P.flags),H=P==null?void 0:P.duration;B&8&&(B&2?H=u(v,12):H=u(v,8));for(var F=I.timescale||9e4,W=d(A,["trun"]),U=0;U<W.length;U++){if(H){var K=u(W[U],4);T=H*K}else T=a(W[U]);I.type===O.ElementaryStreamTypes.VIDEO?C+=T/F:I.type===O.ElementaryStreamTypes.AUDIO&&(x+=T/F)}}if(C===0&&x===0){var z=s(w);if(z!=null&&z.references)return z.references.reduce(function(te,de){return te+de.info.duration||0},0)}return C||x}function a(w){var m=u(w,0),T=8;m&1&&(T+=4),m&4&&(T+=4);for(var C=0,x=u(w,4),b=0;b<x;b++){if(m&256){var E=u(w,T);C+=E,T+=4}m&512&&(T+=4),m&1024&&(T+=4),m&2048&&(T+=4)}return C}function i(w,m,T){d(m,["moof","traf"]).forEach(function(C){d(C,["tfhd"]).forEach(function(x){var b=u(x,4),E=w[b];if(!E)return;var A=E.timescale||9e4;d(C,["tfdt"]).forEach(function(v){var M=v.data[v.start],I=u(v,4);if(M===0)o(v,4,I-T*A);else{I*=Math.pow(2,32),I+=u(v,8),I-=T*A,I=Math.max(I,0);var P=Math.floor(I/(c+1)),B=Math.floor(I%(c+1));o(v,4,P),o(v,8,B)}})})})}function h(w){var m={valid:null,remainder:null},T=d(w,["moof"]);if(T){if(T.length<2)return m.remainder=w,m}else return m;var C=T[T.length-1];return m.valid=Object(R.sliceUint8)(w,0,C.start-8),m.remainder=Object(R.sliceUint8)(w,C.start-8),m}function f(w,m){var T=new Uint8Array(w.length+m.length);return T.set(w),T.set(m,w.length),T}},"./src/utils/output-filter.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"default",function(){return R});var R=function(){function O(S,y){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=S,this.trackName=y}var c=O.prototype;return c.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},c.newCue=function(y,p,u){(this.startTime===null||this.startTime>y)&&(this.startTime=y),this.endTime=p,this.screen=u,this.timelineController.createCaptionsTrack(this.trackName)},c.reset=function(){this.cueRanges=[]},O}()},"./src/utils/texttrack-utils.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"sendAddTrackEvent",function(){return O}),D.d(k,"addCueToTrack",function(){return c}),D.d(k,"clearCurrentCues",function(){return S}),D.d(k,"removeCuesInRange",function(){return y}),D.d(k,"getCuesInRange",function(){return u});var R=D("./src/utils/logger.ts");function O(o,d){var s;try{s=new Event("addtrack")}catch(l){s=document.createEvent("Event"),s.initEvent("addtrack",!1,!1)}s.track=o,d.dispatchEvent(s)}function c(o,d){var s=o.mode;if(s==="disabled"&&(o.mode="hidden"),o.cues&&!o.cues.getCueById(d.id))try{if(o.addCue(d),!o.cues.getCueById(d.id))throw new Error("addCue is failed for: "+d)}catch(r){R.logger.debug("[texttrack-utils]: "+r);var l=new self.TextTrackCue(d.startTime,d.endTime,d.text);l.id=d.id,o.addCue(l)}s==="disabled"&&(o.mode=s)}function S(o){var d=o.mode;if(d==="disabled"&&(o.mode="hidden"),o.cues)for(var s=o.cues.length;s--;)o.removeCue(o.cues[s]);d==="disabled"&&(o.mode=d)}function y(o,d,s){var l=o.mode;if(l==="disabled"&&(o.mode="hidden"),o.cues&&o.cues.length>0)for(var r=u(o.cues,d,s),n=0;n<r.length;n++)o.removeCue(r[n]);l==="disabled"&&(o.mode=l)}function p(o,d){if(d<o[0].startTime)return 0;var s=o.length-1;if(d>o[s].endTime)return-1;for(var l=0,r=s;l<=r;){var n=Math.floor((r+l)/2);if(d<o[n].startTime)r=n-1;else if(d>o[n].startTime&&l<s)l=n+1;else return n}return o[l].startTime-d<d-o[r].startTime?l:r}function u(o,d,s){var l=[],r=p(o,d);if(r>-1)for(var n=r,a=o.length;n<a;n++){var i=o[n];if(i.startTime>=d&&i.endTime<=s)l.push(i);else if(i.startTime>s)return l}return l}},"./src/utils/time-ranges.ts":function(j,k,D){"use strict";D.r(k);var R={toString:function(c){for(var S="",y=c.length,p=0;p<y;p++)S+="["+c.start(p).toFixed(3)+","+c.end(p).toFixed(3)+"]";return S}};k.default=R},"./src/utils/timescale-conversion.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"toTimescaleFromBase",function(){return O}),D.d(k,"toTimescaleFromScale",function(){return c}),D.d(k,"toMsFromMpegTsClock",function(){return S}),D.d(k,"toMpegTsClockFromTimescale",function(){return y});var R=9e4;function O(p,u,o,d){o===void 0&&(o=1),d===void 0&&(d=!1);var s=p*u*o;return d?Math.round(s):s}function c(p,u,o,d){return o===void 0&&(o=1),d===void 0&&(d=!1),O(p,u,1/o,d)}function S(p,u){return u===void 0&&(u=!1),O(p,1e3,1/R,u)}function y(p,u){return u===void 0&&(u=1),O(p,R,1/u)}},"./src/utils/typed-array.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"sliceUint8",function(){return R});function R(O,c,S){return Uint8Array.prototype.slice?O.slice(c,S):new Uint8Array(Array.prototype.slice.call(O,c,S))}},"./src/utils/vttcue.ts":function(j,k,D){"use strict";D.r(k),k.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var R=["","lr","rl"],O=["start","middle","end","left","right"];function c(o,d){if(typeof d!="string")return!1;if(!Array.isArray(o))return!1;var s=d.toLowerCase();return~o.indexOf(s)?s:!1}function S(o){return c(R,o)}function y(o){return c(O,o)}function p(o){for(var d=arguments.length,s=new Array(d>1?d-1:0),l=1;l<d;l++)s[l-1]=arguments[l];for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var a in n)o[a]=n[a]}return o}function u(o,d,s){var l=this,r={enumerable:!0};l.hasBeenReset=!1;var n="",a=!1,i=o,h=d,f=s,w=null,m="",T=!0,C="auto",x="start",b=50,E="middle",A=50,v="middle";Object.defineProperty(l,"id",p({},r,{get:function(){return n},set:function(I){n=""+I}})),Object.defineProperty(l,"pauseOnExit",p({},r,{get:function(){return a},set:function(I){a=!!I}})),Object.defineProperty(l,"startTime",p({},r,{get:function(){return i},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");i=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"endTime",p({},r,{get:function(){return h},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");h=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"text",p({},r,{get:function(){return f},set:function(I){f=""+I,this.hasBeenReset=!0}})),Object.defineProperty(l,"region",p({},r,{get:function(){return w},set:function(I){w=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"vertical",p({},r,{get:function(){return m},set:function(I){var P=S(I);if(P===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=P,this.hasBeenReset=!0}})),Object.defineProperty(l,"snapToLines",p({},r,{get:function(){return T},set:function(I){T=!!I,this.hasBeenReset=!0}})),Object.defineProperty(l,"line",p({},r,{get:function(){return C},set:function(I){if(typeof I!="number"&&I!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");C=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"lineAlign",p({},r,{get:function(){return x},set:function(I){var P=y(I);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");x=P,this.hasBeenReset=!0}})),Object.defineProperty(l,"position",p({},r,{get:function(){return b},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");b=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"positionAlign",p({},r,{get:function(){return E},set:function(I){var P=y(I);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");E=P,this.hasBeenReset=!0}})),Object.defineProperty(l,"size",p({},r,{get:function(){return A},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");A=I,this.hasBeenReset=!0}})),Object.defineProperty(l,"align",p({},r,{get:function(){return v},set:function(I){var P=y(I);if(!P)throw new SyntaxError("An invalid or illegal string was specified.");v=P,this.hasBeenReset=!0}})),l.displayState=void 0}return u.prototype.getCueAsHTML=function(){var o=self.WebVTT;return o.convertCueToDOMTree(self,this.text)},u}()},"./src/utils/vttparser.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"parseTimeStamp",function(){return c}),D.d(k,"fixLineBreaks",function(){return d}),D.d(k,"VTTParser",function(){return s});var R=D("./src/utils/vttcue.ts"),O=function(){function l(){}var r=l.prototype;return r.decode=function(a,i){if(!a)return"";if(typeof a!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))},l}();function c(l){function r(a,i,h,f){return(a|0)*3600+(i|0)*60+(h|0)+parseFloat(f||0)}var n=l.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?r(n[2],n[3],0,n[4]):r(n[1],n[2],n[3],n[4]):null}var S=function(){function l(){this.values=Object.create(null)}var r=l.prototype;return r.set=function(a,i){!this.get(a)&&i!==""&&(this.values[a]=i)},r.get=function(a,i,h){return h?this.has(a)?this.values[a]:i[h]:this.has(a)?this.values[a]:i},r.has=function(a){return a in this.values},r.alt=function(a,i,h){for(var f=0;f<h.length;++f)if(i===h[f]){this.set(a,i);break}},r.integer=function(a,i){/^-?\d+$/.test(i)&&this.set(a,parseInt(i,10))},r.percent=function(a,i){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(i)){var h=parseFloat(i);if(h>=0&&h<=100)return this.set(a,h),!0}return!1},l}();function y(l,r,n,a){var i=a?l.split(a):[l];for(var h in i){if(typeof i[h]!="string")continue;var f=i[h].split(n);if(f.length!==2)continue;var w=f[0],m=f[1];r(w,m)}}var p=new R.default(0,0,""),u=p.align==="middle"?"middle":"center";function o(l,r,n){var a=l;function i(){var w=c(l);if(w===null)throw new Error("Malformed timestamp: "+a);return l=l.replace(/^[^\sa-zA-Z-]+/,""),w}function h(w,m){var T=new S;y(w,function(b,E){var A;switch(b){case"region":for(var v=n.length-1;v>=0;v--)if(n[v].id===E){T.set(b,n[v].region);break}break;case"vertical":T.alt(b,E,["rl","lr"]);break;case"line":A=E.split(","),T.integer(b,A[0]),T.percent(b,A[0])&&T.set("snapToLines",!1),T.alt(b,A[0],["auto"]),A.length===2&&T.alt("lineAlign",A[1],["start",u,"end"]);break;case"position":A=E.split(","),T.percent(b,A[0]),A.length===2&&T.alt("positionAlign",A[1],["start",u,"end","line-left","line-right","auto"]);break;case"size":T.percent(b,E);break;case"align":T.alt(b,E,["start",u,"end","left","right"]);break}},/:/,/\s/),m.region=T.get("region",null),m.vertical=T.get("vertical","");var C=T.get("line","auto");C==="auto"&&p.line===-1&&(C=-1),m.line=C,m.lineAlign=T.get("lineAlign","start"),m.snapToLines=T.get("snapToLines",!0),m.size=T.get("size",100),m.align=T.get("align",u);var x=T.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 f(){l=l.replace(/^\s+/,"")}if(f(),r.startTime=i(),f(),l.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+a);l=l.substr(3),f(),r.endTime=i(),f(),h(l,r)}function d(l){return l.replace(/<br(?: \/)?>/gi,`
|
|
|
`)}var s=function(){function l(){this.state="INITIAL",this.buffer="",this.decoder=new O,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var r=l.prototype;return r.parse=function(a){var i=this;a&&(i.buffer+=i.decoder.decode(a,{stream:!0}));function h(){var x=i.buffer,b=0;for(x=d(x);b<x.length&&x[b]!=="\r"&&x[b]!==`
|
|
|
`;)++b;var E=x.substr(0,b);return x[b]==="\r"&&++b,x[b]===`
|
|
|
`&&++b,i.buffer=x.substr(b),E}function f(x){y(x,function(b,E){},/:/)}try{var w="";if(i.state==="INITIAL"){if(!/\r\n|\n/.test(i.buffer))return this;w=h();var m=w.match(/^()?WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new Error("Malformed WebVTT signature.");i.state="HEADER"}for(var T=!1;i.buffer;){if(!/\r\n|\n/.test(i.buffer))return this;T?T=!1:w=h();switch(i.state){case"HEADER":/:/.test(w)?f(w):w||(i.state="ID");continue;case"NOTE":w||(i.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){i.state="NOTE";break}if(!w)continue;if(i.cue=new R.default(0,0,""),i.state="CUE",w.indexOf("-->")===-1){i.cue.id=w;continue}case"CUE":if(!i.cue){i.state="BADCUE";continue}try{o(w,i.cue,i.regionList)}catch(x){i.cue=null,i.state="BADCUE";continue}i.state="CUETEXT";continue;case"CUETEXT":{var C=w.indexOf("-->")!==-1;if(!w||C&&(T=!0)){i.oncue&&i.cue&&i.oncue(i.cue),i.cue=null,i.state="ID";continue}if(i.cue===null)continue;i.cue.text&&(i.cue.text+=`
|
|
|
`),i.cue.text+=w}continue;case"BADCUE":w||(i.state="ID")}}}catch(x){i.state==="CUETEXT"&&i.cue&&i.oncue&&i.oncue(i.cue),i.cue=null,i.state=i.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},r.flush=function(){var a=this;try{if((a.cue||a.state==="HEADER")&&(a.buffer+=`
|
|
|
|
|
|
`,a.parse()),a.state==="INITIAL"||a.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(i){a.onparsingerror&&a.onparsingerror(i)}return a.onflush&&a.onflush(),this},l}()},"./src/utils/webvtt-parser.ts":function(j,k,D){"use strict";D.r(k),D.d(k,"generateCueId",function(){return s}),D.d(k,"parseWebVTT",function(){return r});var R=D("./src/polyfills/number.ts"),O=D("./src/utils/vttparser.ts"),c=D("./src/demux/id3.ts"),S=D("./src/utils/timescale-conversion.ts"),y=D("./src/remux/mp4-remuxer.ts"),p=/\r\n|\n\r|\n|\r/g,u=function(a,i,h){return h===void 0&&(h=0),a.substr(h,i.length)===i},o=function(a){var i=parseInt(a.substr(-3)),h=parseInt(a.substr(-6,2)),f=parseInt(a.substr(-9,2)),w=a.length>9?parseInt(a.substr(0,a.indexOf(":"))):0;if(!Object(R.isFiniteNumber)(i)||!Object(R.isFiniteNumber)(h)||!Object(R.isFiniteNumber)(f)||!Object(R.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+a);return i+=1e3*h,i+=60*1e3*f,i+=60*60*1e3*w,i},d=function(a){for(var i=5381,h=a.length;h;)i=i*33^a.charCodeAt(--h);return(i>>>0).toString()};function s(n,a,i){return d(n.toString())+d(a.toString())+d(i)}var l=function(a,i,h){var f=a[i],w=a[f.prevCC];if(!w||!w.new&&f.new){a.ccOffset=a.presentationOffset=f.start,f.new=!1;return}for(;(m=w)!==null&&m!==void 0&&m.new;){var m;a.ccOffset+=f.start-w.start,f.new=!1,f=w,w=a[f.prevCC]}a.presentationOffset=h};function r(n,a,i,h,f,w,m,T){var C=new O.VTTParser,x=Object(c.utf8ArrayToStr)(new Uint8Array(n)).trim().replace(p,`
|
|
|
`).split(`
|
|
|
`),b=[],E=Object(S.toMpegTsClockFromTimescale)(a,i),A="00:00.000",v=0,M=0,I,P=!0,B=!1;C.oncue=function(H){var F=h[f],W=h.ccOffset,U=(v-E)/9e4;if(F!=null&&F.new&&(M!==void 0?W=h.ccOffset=F.start:l(h,f,U)),U&&(W=U-h.presentationOffset),B){var K=H.endTime-H.startTime,z=Object(y.normalizePts)((H.startTime+W-M)*9e4,w*9e4)/9e4;H.startTime=z,H.endTime=z+K}var te=H.text.trim();H.text=decodeURIComponent(encodeURIComponent(te)),H.id||(H.id=s(H.startTime,H.endTime,te)),H.endTime>0&&b.push(H)},C.onparsingerror=function(H){I=H},C.onflush=function(){if(I){T(I);return}m(b)},x.forEach(function(H){if(P)if(u(H,"X-TIMESTAMP-MAP=")){P=!1,B=!0,H.substr(16).split(",").forEach(function(F){u(F,"LOCAL:")?A=F.substr(6):u(F,"MPEGTS:")&&(v=parseInt(F.substr(7)))});try{M=o(A)/1e3}catch(F){B=!1,I=F}return}else H===""&&(P=!1);C.parse(H+`
|
|
|
`)}),C.flush()}},"./src/utils/xhr-loader.ts":function(j,k,D){"use strict";D.r(k);var R=D("./src/utils/logger.ts"),O=D("./src/loader/load-stats.ts"),c=/^age:\s*[\d.]+\s*$/m,S=function(){function y(u){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=u?u.xhrSetup:null,this.stats=new O.LoadStats,this.retryDelay=0}var p=y.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,d,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=d,this.callbacks=s,this.retryDelay=d.retryDelay,this.loadInternal()},p.loadInternal=function(){var o=this.config,d=this.context;if(!o)return;var s=this.loader=new self.XMLHttpRequest,l=this.stats;l.loading.first=0,l.loaded=0;var r=this.xhrSetup;try{if(r)try{r(s,d.url)}catch(i){s.open("GET",d.url,!0),r(s,d.url)}s.readyState||s.open("GET",d.url,!0);var n=this.context.headers;if(n)for(var a in n)s.setRequestHeader(a,n[a])}catch(i){this.callbacks.onError({code:s.status,text:i.message},d,s);return}d.rangeEnd&&s.setRequestHeader("Range","bytes="+d.rangeStart+"-"+(d.rangeEnd-1)),s.onreadystatechange=this.readystatechange.bind(this),s.onprogress=this.loadprogress.bind(this),s.responseType=d.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout),s.send()},p.readystatechange=function(){var o=this.context,d=this.loader,s=this.stats;if(!o||!d)return;var l=d.readyState,r=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){d.onreadystatechange=null,d.onprogress=null;var n=d.status;if(n>=200&&n<300){s.loading.end=Math.max(self.performance.now(),s.loading.first);var a,i;if(o.responseType==="arraybuffer"?(a=d.response,i=a.byteLength):(a=d.responseText,i=a.length),s.loaded=s.total=i,!this.callbacks)return;var h=this.callbacks.onProgress;if(h&&h(s,o,a,d),!this.callbacks)return;var f={url:d.responseURL,data:a};this.callbacks.onSuccess(f,s,o,d)}else s.retry>=r.maxRetry||n>=400&&n<499?(R.logger.error(n+" while loading "+o.url),this.callbacks.onError({code:n,text:d.statusText},o,d)):(R.logger.warn(n+" 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,r.maxRetryDelay),s.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout)},p.loadtimeout=function(){R.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 d=this.stats;d.loaded=o.loaded,o.lengthComputable&&(d.total=o.total)},p.getCacheAge=function(){var o=null;if(this.loader&&c.test(this.loader.getAllResponseHeaders())){var d=this.loader.getResponseHeader("age");o=d?parseFloat(d):null}return o},y}();k.default=S}}).default})},vHTk:function(Ze,ce,ie){Ze.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},vewr:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.getPointerEvent=j,ce.stopEvent=k,ce.setCapture=y,ce.releaseCapture=p;function j(u){return u.changedTouches?u.changedTouches[0]:u.touches?u.touches[0]:u}function k(u){u.stopPropagation(),u.preventDefault()}var D=!1,R=null;document.captureElement=null;function O(u){if(D)return;var o=new u.constructor(u.type,u);D=!0,document.captureElement?document.captureElement.dispatchEvent(o):R.dispatchEvent(o),D=!1,u.stopPropagation(),o.defaultPrevented&&u.preventDefault(),u.type==="mouseup"&&p()}function c(){var u=document.getElementById("noVNC_mouse_capture_elem");u.style.cursor=window.getComputedStyle(document.captureElement).cursor}var S=new MutationObserver(c);function y(u){if(u.setCapture)u.setCapture(),document.captureElement=u,u.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",O),o.addEventListener("mousemove",O),o.addEventListener("mouseup",O)),document.captureElement=u,S.observe(u,{attributes:!0}),c(),o.style.display="",window.addEventListener("mousemove",O),window.addEventListener("mouseup",O)}}function p(){if(document.releaseCapture)document.releaseCapture(),document.captureElement=null;else{if(!document.captureElement)return;R=document.captureElement,document.captureElement=null,S.disconnect();var u=document.getElementById("noVNC_mouse_capture_elem");u.style.display="none",window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",O)}}},whVF:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=ie("lNSK"),k=D(ie("1q3G"));function D(y){return y&&y.__esModule?y:{default:y}}function R(y,p){if(!(y instanceof p))throw new TypeError("Cannot call a class as a function")}function O(y,p){for(var u=0;u<p.length;u++){var o=p[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}function c(y,p,u){return p&&O(y.prototype,p),u&&O(y,u),y}var S=function(){function y(){R(this,y),this.strm=new k.default,this.chunkSize=1024*10*10,this.outputBuffer=new Uint8Array(this.chunkSize),this.windowBits=5,(0,j.deflateInit)(this.strm,this.windowBits)}return c(y,[{key:"deflate",value:function(u){this.strm.input=u,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,j.deflate)(this.strm,j.Z_FULL_FLUSH),d=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=[d],l=d.length;do{if(this.strm.output=new Uint8Array(this.chunkSize),this.strm.next_out=0,this.strm.avail_out=this.chunkSize,o=(0,j.deflate)(this.strm,j.Z_FULL_FLUSH),o<0)throw new Error("zlib deflate failed");var r=new Uint8Array(this.strm.output.buffer,0,this.strm.next_out);l+=r.length,s.push(r)}while(this.strm.avail_in>0);for(var n=new Uint8Array(l),a=0,i=0;i<s.length;i++)n.set(s[i],a),a+=s[i].length;d=n}return this.strm.input=null,this.strm.avail_in=0,this.strm.next_in=0,d}}]),y}();ce.default=S},xO64:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j=k(ie("8K/p"));function k(r){return r&&r.__esModule?r:{default:r}}function D(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?D=function(a){return typeof a}:D=function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},D(r)}function R(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function O(r,n){for(var a=0;a<n.length;a++){var i=n[a];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function c(r,n,a){return n&&O(r.prototype,n),a&&O(r,a),r}function S(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),n&&y(r,n)}function y(r,n){return y=Object.setPrototypeOf||function(i,h){return i.__proto__=h,i},y(r,n)}function p(r){var n=d();return function(){var i=s(r),h;if(n){var f=s(this).constructor;h=Reflect.construct(i,arguments,f)}else h=i.apply(this,arguments);return u(this,h)}}function u(r,n){return n&&(D(n)==="object"||typeof n=="function")?n:o(r)}function o(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function d(){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(r){return!1}}function s(r){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},s(r)}var l=function(r){S(a,r);var n=p(a);function a(){return R(this,a),n.apply(this,arguments)}return c(a,[{key:"_pngRect",value:function(h,f,w,m,T,C,x){var b=this._readData(T);return b===null?!1:(C.imageRect(h,f,w,m,"image/png",b),!0)}},{key:"_basicRect",value:function(h,f,w,m,T,C,x,b){throw new Error("BasicCompression received in TightPNG rect")}}]),a}(j.default);ce.default=l},xSIq:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=void 0;var j={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"};ce.default=j},xlC8:function(Ze,ce,ie){"use strict";Object.defineProperty(ce,"__esModule",{value:!0}),ce.default=j;function j(k,D,R,O){for(var c=k&65535|0,S=k>>>16&65535|0,y=0;R!==0;){y=R>2e3?2e3:R,R-=y;do c=c+D[O++]|0,S=S+c|0;while(--y);c%=65521,S%=65521}return c|S<<16|0}}}]);
|