(window.webpackJsonp=window.webpackJsonp||[]).push([[231,5,6,7,19],{"+NIl":
/*!***************************************************!*\
!*** ./node_modules/codemirror/mode/stex/stex.js ***!
\***************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";e.defineMode("stex",(function(e,t){function i(e,t){e.cmdState.push(t)}function r(e){return e.cmdState.length>0?e.cmdState[e.cmdState.length-1]:null}function n(e,t,i){return function(){this.name=e,this.bracketNo=0,this.style=t,this.styles=i,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var s={};function o(e,t){e.f=t}function a(e,t){var n;if(e.match(/^\\[a-zA-Z@]+/)){var a=e.current().slice(1);return i(t,n=new(n=s.hasOwnProperty(a)?s[a]:s.DEFAULT)),o(t,c),n.style}if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/\\]/))return"tag";if(e.match("\\["))return o(t,(function(e,t){return l(e,t,"\\]")})),"keyword";if(e.match("\\("))return o(t,(function(e,t){return l(e,t,"\\)")})),"keyword";if(e.match("$$"))return o(t,(function(e,t){return l(e,t,"$$")})),"keyword";if(e.match("$"))return o(t,(function(e,t){return l(e,t,"$")})),"keyword";var u=e.next();return"%"==u?(e.skipToEnd(),"comment"):"}"==u||"]"==u?(n=r(t))?(n.closeBracket(u),o(t,c),"bracket"):"error":"{"==u||"["==u?(i(t,n=new(n=s.DEFAULT)),"bracket"):/\d/.test(u)?(e.eatWhile(/[\w.%]/),"atom"):(e.eatWhile(/[\w\-_]/),"begin"==(n=function(e){for(var t=e.cmdState,i=t.length-1;i>=0;i--){var r=t[i];if("DEFAULT"!=r.name)return r}return{styleIdentifier:function(){return null}}}(t)).name&&(n.argument=e.current()),n.styleIdentifier())}function l(e,t,i){if(e.eatSpace())return null;if(i&&e.match(i))return o(t,a),"keyword";if(e.match(/^\\[a-zA-Z@]+/))return"tag";if(e.match(/^[a-zA-Z]+/))return"variable-2";if(e.match(/^\\[$&%#{}_]/))return"tag";if(e.match(/^\\[,;!\/]/))return"tag";if(e.match(/^[\^_&]/))return"tag";if(e.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(e.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var r=e.next();return"{"==r||"}"==r||"["==r||"]"==r||"("==r||")"==r?"bracket":"%"==r?(e.skipToEnd(),"comment"):"error"}function c(e,t){var i=e.peek();return"{"==i||"["==i?(r(t).openBracket(i),e.eat(i),o(t,a),"bracket"):/[ \t\r]/.test(i)?(e.eat(i),null):(o(t,a),function(e){var t=e.cmdState.pop();t&&t.closeBracket()}(t),a(e,t))}return s.importmodule=n("importmodule","tag",["string","builtin"]),s.documentclass=n("documentclass","tag",["","atom"]),s.usepackage=n("usepackage","tag",["atom"]),s.begin=n("begin","tag",["atom"]),s.end=n("end","tag",["atom"]),s.label=n("label","tag",["atom"]),s.ref=n("ref","tag",["atom"]),s.eqref=n("eqref","tag",["atom"]),s.cite=n("cite","tag",["atom"]),s.bibitem=n("bibitem","tag",["atom"]),s.Bibitem=n("Bibitem","tag",["atom"]),s.RBibitem=n("RBibitem","tag",["atom"]),s.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}},{startState:function(){return{cmdState:[],f:t.inMathMode?function(e,t){return l(e,t)}:a}},copyState:function(e){return{cmdState:e.cmdState.slice(),f:e.f}},token:function(e,t){return t.f(e,t)},blankLine:function(e){e.f=a,e.cmdState.length=0},lineComment:"%"}})),e.defineMIME("text/x-stex","stex"),e.defineMIME("text/x-latex","stex")}(i(/*! ../../lib/codemirror */"VrN/"))},"/POA":
/*!*****************************************!*\
!*** ./node_modules/xterm/lib/xterm.js ***!
\*****************************************/
/*! no static exports found */
/*! exports used: Terminal */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){window,e.exports=function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=34)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0;var r=function(){function e(){this._listeners=[],this._disposed=!1}return Object.defineProperty(e.prototype,"event",{get:function(){var e=this;return this._event||(this._event=function(t){return e._listeners.push(t),{dispose:function(){if(!e._disposed)for(var i=0;i>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?s.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[o.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[o.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[o.CHAR_DATA_CHAR_INDEX].length){var i=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){var r=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(i-55296)+r-56320+65536|e[o.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[o.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[o.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[o.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(a.AttributeData);t.CellData=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var r=i(14);t.ICharSizeService=r.createDecorator("CharSizeService"),t.ICoreBrowserService=r.createDecorator("CoreBrowserService"),t.IMouseService=r.createDecorator("MouseService"),t.IRenderService=r.createDecorator("RenderService"),t.ISelectionService=r.createDecorator("SelectionService"),t.ISoundService=r.createDecorator("SoundService")},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;var r=function(){function e(){this.fg=0,this.bg=0,this.extended=new n}return e.toColorRGB=function(e){return[e>>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.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()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=r;var n=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,i,r){e.addEventListener(t,i,r);var n=!1;return{dispose:function(){n||(n=!0,e.removeEventListener(t,i,r))}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=e.length);for(var r="",n=t;n65535?(s-=65536,r+=String.fromCharCode(55296+(s>>10))+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r};var r=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var r=0,n=0;this._interim&&(56320<=(a=e.charCodeAt(n++))&&a<=57343?t[r++]=1024*(this._interim-55296)+a-56320+65536:(t[r++]=this._interim,t[r++]=a),this._interim=0);for(var s=n;s=i)return this._interim=o,r;var a;56320<=(a=e.charCodeAt(s))&&a<=57343?t[r++]=1024*(o-55296)+a-56320+65536:(t[r++]=o,t[r++]=a)}else t[r++]=o}return r},e}();t.StringToUtf32=r;var n=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var i=e.length;if(!i)return 0;var r,n,s,o,a=0,l=0,c=0;if(this.interim[0]){var u=!1,h=this.interim[0];h&=192==(224&h)?31:224==(240&h)?15:7;for(var d=0,f=void 0;(f=63&this.interim[++d])&&d<4;)h<<=6,h|=f;for(var p=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,g=p-d;c=i)return 0;if(128!=(192&(f=e[c++]))){c--,u=!0;break}this.interim[d++]=f,h<<=6,h|=63&f}u||(2===p?h<128?c--:t[a++]=h:3===p?h<2048||h>=55296&&h<=57343||(t[a++]=h):h<65536||h>1114111||(t[a++]=h)),this.interim.fill(0)}for(var v=i-4,m=c;m=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if((l=(31&r)<<6|63&n)<128){m--;continue}t[a++]=l}else if(224==(240&r)){if(m>=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,a;if(128!=(192&(s=e[m++]))){m--;continue}if((l=(15&r)<<12|(63&n)<<6|63&s)<2048||l>=55296&&l<=57343)continue;t[a++]=l}else if(240==(248&r)){if(m>=i)return this.interim[0]=r,a;if(128!=(192&(n=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,a;if(128!=(192&(s=e[m++]))){m--;continue}if(m>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=s,a;if(128!=(192&(o=e[m++]))){m--;continue}if((l=(7&r)<<18|(63&n)<<12|(63&s)<<6|63&o)<65536||l>1114111)continue;t[a++]=l}}return a},e}();t.Utf8ToUtf32=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR_ATLAS_CELL_SPACING=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0,t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.CHAR_ATLAS_CELL_SPACING=1},function(e,t,i){"use strict";var r,n,s,o;function a(e){var t=e.toString(16);return t.length<2?"0"+t:t}function l(e,t){return e>>0}}(r=t.channels||(t.channels={})),(n=t.color||(t.color={})).blend=function(e,t){var i=(255&t.rgba)/255;if(1===i)return{css:t.css,rgba:t.rgba};var n=t.rgba>>24&255,s=t.rgba>>16&255,o=t.rgba>>8&255,a=e.rgba>>24&255,l=e.rgba>>16&255,c=e.rgba>>8&255,u=a+Math.round((n-a)*i),h=l+Math.round((s-l)*i),d=c+Math.round((o-c)*i);return{css:r.toCss(u,h,d),rgba:r.toRgba(u,h,d)}},n.isOpaque=function(e){return 255==(255&e.rgba)},n.ensureContrastRatio=function(e,t,i){var r=o.ensureContrastRatio(e.rgba,t.rgba,i);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},n.opaque=function(e){var t=(255|e.rgba)>>>0,i=o.toChannels(t),n=i[0],s=i[1],a=i[2];return{css:r.toCss(n,s,a),rgba:t}},n.opacity=function(e,t){var i=Math.round(255*t),n=o.toChannels(e.rgba),s=n[0],a=n[1],l=n[2];return{css:r.toCss(s,a,l,i),rgba:r.toRgba(s,a,l,i)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,i){var r=e/255,n=t/255,s=i/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*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(s=t.rgb||(t.rgb={})),function(e){function t(e,t,i){for(var r=e>>24&255,n=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));h0||c>0||u>0);)a-=Math.max(0,Math.ceil(.1*a)),c-=Math.max(0,Math.ceil(.1*c)),u-=Math.max(0,Math.ceil(.1*u)),h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));return(a<<24|c<<16|u<<8|255)>>>0}function i(e,t,i){for(var r=e>>24&255,n=e>>16&255,o=e>>8&255,a=t>>24&255,c=t>>16&255,u=t>>8&255,h=l(s.relativeLuminance2(a,u,c),s.relativeLuminance2(r,n,o));h>>0}e.ensureContrastRatio=function(e,r,n){var o=s.relativeLuminance(e>>8),a=s.relativeLuminance(r>>8);if(l(o,a)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,i){return{css:r.toCss(e,t,i),rgba:r.toRgba(e,t,i)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=a,t.contrastRatio=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.isSafari=t.isFirefox=void 0;var r="undefined"==typeof navigator,n=r?"node":navigator.userAgent,s=r?"node":navigator.platform;function o(e,t){return e.indexOf(t)>=0}t.isFirefox=!!~n.indexOf("Firefox"),t.isSafari=/^((?!chrome|android).)*safari/i.test(n),t.isMac=o(["Macintosh","MacIntel","MacPPC","Mac68K"],s),t.isIpad="iPad"===s,t.isIphone="iPhone"===s,t.isWindows=o(["Windows","Win16","Win32","WinCE"],s),t.isLinux=s.indexOf("Linux")>=0},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,function(e){e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="",e.BS="\b",e.HT="\t",e.LF="\n",e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""}(t.C0||(t.C0={})),function(e){e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""}(t.C1||(t.C1={}))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var r=i(3),n=i(9),s=i(25),o=i(6),a=i(28),l=i(10),c=i(17),u=function(){function e(e,t,i,r,n,s,o,a){this._container=e,this._alpha=r,this._colors=n,this._rendererId=s,this._bufferService=o,this._optionsService=a,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-"+t+"-layer"),this._canvas.style.zIndex=i.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;c.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=a.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,i){void 0===i&&(i=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=s.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,i,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,i){void 0===i&&(i=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,i*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,i){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*i,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,i,r){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,i*this._scaledCellWidth-window.devicePixelRatio,r*this._scaledCellHeight-window.devicePixelRatio)},e.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))},e.prototype._clearCells=function(e,t,i,r){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,i*this._scaledCellWidth,r*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,i){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(i),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,i){var s,o,a=this._getContrastColor(e);a||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,i,a):(e.isInverse()?(s=e.isBgDefault()?n.INVERTED_DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?n.INVERTED_DEFAULT_COLOR:e.getFgColor()):(o=e.isBgDefault()?r.DEFAULT_COLOR:e.getBgColor(),s=e.isFgDefault()?r.DEFAULT_COLOR:e.getFgColor()),s+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||r.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||r.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=o,this._currentGlyphIdentifier.fg=s,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,i))},e.prototype._drawUncachedChars=function(e,t,i,r){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(r)this._ctx.fillStyle=r.css;else if(e.isBgDefault())this._ctx.fillStyle=l.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var s=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8&&(s+=8),this._ctx.fillStyle=this._colors.ansi[s].css}else if(r)this._ctx.fillStyle=r.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+o.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var a=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&a<8&&(a+=8),this._ctx.fillStyle=this._colors.ansi[a].css}this._clipRow(i),e.isDim()&&(this._ctx.globalAlpha=n.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var i=e.getFgColor(),r=e.getFgColorMode(),n=e.getBgColor(),s=e.getBgColorMode(),o=!!e.isInverse(),a=!!e.isInverse();if(o){var c=i;i=n,n=c;var u=r;r=s,s=u}var h=this._resolveBackgroundRgba(s,n,o),d=this._resolveForegroundRgba(r,i,o,a),f=l.rgba.ensureContrastRatio(h,d,this._optionsService.options.minimumContrastRatio);if(f){var p={css:l.channels.toCss(f>>24&255,f>>16&255,f>>8&255),rgba:f};return this._colors.contrastCache.setColor(e.bg,e.fg,p),p}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,i){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return i?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,i,r){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return i?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=u},function(e,t,i){"use strict";function r(e,t,i){t.di$target===t?t.di$dependencies.push({id:e,index:i}):(t.di$dependencies=[{id:e,index:i}],t.di$target=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0,t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e.di$dependencies||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);var i=function(e,t,n){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");r(i,e,n)};return i.toString=function(){return e},t.serviceRegistry.set(e,i),i}},function(e,t,i){"use strict";function r(e,t,i,r){if(void 0===i&&(i=0),void 0===r&&(r=e.length),i>=e.length)return e;i=(e.length+i)%e.length,r=r>=e.length?e.length:(e.length+r)%e.length;for(var n=i;n>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):i]},e.prototype.set=function(e,t){this._data[3*e+1]=t[n.CHAR_DATA_ATTR_INDEX],t[n.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[n.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[n.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[n.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?r.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var i=3*e;return t.content=this._data[i+0],t.fg=this._data[i+1],t.bg=this._data[i+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,i,r,n,s){268435456&n&&(this._extendedAttrs[e]=s),this._data[3*e+0]=t|i<<22,this._data[3*e+1]=r,this._data[3*e+2]=n},e.prototype.addCodepointToCell=function(e,t){var i=this._data[3*e+0];2097152&i?this._combined[e]+=r.stringFromCodePoint(t):(2097151&i?(this._combined[e]=r.stringFromCodePoint(2097151&i)+r.stringFromCodePoint(t),i&=-2097152,i|=2097152):i=t|1<<22,this._data[3*e+0]=i)},e.prototype.insertCells=function(e,t,i,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new o.ExtendedAttrs),t=0;--a)this.setCell(e+t+a,this.loadCell(e+a,n));for(a=0;athis.length){var i=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,i,r,n){var s=e._data;if(n)for(var o=r-1;o>=0;o--)for(var a=0;a<3;a++)this._data[3*(i+o)+a]=s[3*(t+o)+a];else for(o=0;o=t&&(this._combined[c-t+i]=e._combined[c])}},e.prototype.translateToString=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===i&&(i=this.length),e&&(i=Math.min(i,this.getTrimmedLength()));for(var s="";t>22||1}return s},e}();t.BufferLine=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],i=0;i24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(s=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var S=function(){function e(e,t,i,r){this._bufferService=e,this._coreService=t,this._logService=i,this._optionsService=r,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,i){this._data=u.concat(this._data,e.subarray(t,i))},e.prototype.unhook=function(e){if(e){var t=h.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r0"q'+o.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(o.C0.ESC+'P1$r61;1"p'+o.C0.ESC+"\\");case"r":var i=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+i+o.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(o.C0.ESC+"P1$r0m"+o.C0.ESC+"\\");case" q":var r={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return r-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(o.C0.ESC+"P1$r"+r+" q"+o.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(o.C0.ESC+"P0$r"+o.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},e}(),C=function(e){function t(t,i,r,n,s,c,u,p,v){void 0===v&&(v=new l.EscapeSequenceParser);var y=e.call(this)||this;y._bufferService=t,y._charsetService=i,y._coreService=r,y._dirtyRowService=n,y._logService=s,y._optionsService=c,y._coreMouseService=u,y._unicodeService=p,y._parser=v,y._parseBuffer=new Uint32Array(4096),y._stringDecoder=new h.StringToUtf32,y._utf8Decoder=new h.Utf8ToUtf32,y._workCell=new g.CellData,y._windowTitle="",y._iconName="",y._windowTitleStack=[],y._iconNameStack=[],y._curAttrData=d.DEFAULT_ATTR_DATA.clone(),y._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),y._onRequestBell=new f.EventEmitter,y._onRequestRefreshRows=new f.EventEmitter,y._onRequestReset=new f.EventEmitter,y._onRequestScroll=new f.EventEmitter,y._onRequestSyncScrollBar=new f.EventEmitter,y._onRequestWindowsOptionsReport=new f.EventEmitter,y._onA11yChar=new f.EventEmitter,y._onA11yTab=new f.EventEmitter,y._onCursorMove=new f.EventEmitter,y._onLineFeed=new f.EventEmitter,y._onScroll=new f.EventEmitter,y._onTitleChange=new f.EventEmitter,y.register(y._parser),y._parser.setCsiHandlerFallback((function(e,t){y._logService.debug("Unknown CSI code: ",{identifier:y._parser.identToString(e),params:t.toArray()})})),y._parser.setEscHandlerFallback((function(e){y._logService.debug("Unknown ESC code: ",{identifier:y._parser.identToString(e)})})),y._parser.setExecuteHandlerFallback((function(e){y._logService.debug("Unknown EXECUTE code: ",{code:e})})),y._parser.setOscHandlerFallback((function(e,t,i){y._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:i})})),y._parser.setDcsHandlerFallback((function(e,t,i){"HOOK"===t&&(i=i.toArray()),y._logService.debug("Unknown DCS code: ",{identifier:y._parser.identToString(e),action:t,payload:i})})),y._parser.setPrintHandler((function(e,t,i){return y.print(e,t,i)})),y._parser.setCsiHandler({final:"@"},(function(e){return y.insertChars(e)})),y._parser.setCsiHandler({intermediates:" ",final:"@"},(function(e){return y.scrollLeft(e)})),y._parser.setCsiHandler({final:"A"},(function(e){return y.cursorUp(e)})),y._parser.setCsiHandler({intermediates:" ",final:"A"},(function(e){return y.scrollRight(e)})),y._parser.setCsiHandler({final:"B"},(function(e){return y.cursorDown(e)})),y._parser.setCsiHandler({final:"C"},(function(e){return y.cursorForward(e)})),y._parser.setCsiHandler({final:"D"},(function(e){return y.cursorBackward(e)})),y._parser.setCsiHandler({final:"E"},(function(e){return y.cursorNextLine(e)})),y._parser.setCsiHandler({final:"F"},(function(e){return y.cursorPrecedingLine(e)})),y._parser.setCsiHandler({final:"G"},(function(e){return y.cursorCharAbsolute(e)})),y._parser.setCsiHandler({final:"H"},(function(e){return y.cursorPosition(e)})),y._parser.setCsiHandler({final:"I"},(function(e){return y.cursorForwardTab(e)})),y._parser.setCsiHandler({final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.setCsiHandler({prefix:"?",final:"J"},(function(e){return y.eraseInDisplay(e)})),y._parser.setCsiHandler({final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.setCsiHandler({prefix:"?",final:"K"},(function(e){return y.eraseInLine(e)})),y._parser.setCsiHandler({final:"L"},(function(e){return y.insertLines(e)})),y._parser.setCsiHandler({final:"M"},(function(e){return y.deleteLines(e)})),y._parser.setCsiHandler({final:"P"},(function(e){return y.deleteChars(e)})),y._parser.setCsiHandler({final:"S"},(function(e){return y.scrollUp(e)})),y._parser.setCsiHandler({final:"T"},(function(e){return y.scrollDown(e)})),y._parser.setCsiHandler({final:"X"},(function(e){return y.eraseChars(e)})),y._parser.setCsiHandler({final:"Z"},(function(e){return y.cursorBackwardTab(e)})),y._parser.setCsiHandler({final:"`"},(function(e){return y.charPosAbsolute(e)})),y._parser.setCsiHandler({final:"a"},(function(e){return y.hPositionRelative(e)})),y._parser.setCsiHandler({final:"b"},(function(e){return y.repeatPrecedingCharacter(e)})),y._parser.setCsiHandler({final:"c"},(function(e){return y.sendDeviceAttributesPrimary(e)})),y._parser.setCsiHandler({prefix:">",final:"c"},(function(e){return y.sendDeviceAttributesSecondary(e)})),y._parser.setCsiHandler({final:"d"},(function(e){return y.linePosAbsolute(e)})),y._parser.setCsiHandler({final:"e"},(function(e){return y.vPositionRelative(e)})),y._parser.setCsiHandler({final:"f"},(function(e){return y.hVPosition(e)})),y._parser.setCsiHandler({final:"g"},(function(e){return y.tabClear(e)})),y._parser.setCsiHandler({final:"h"},(function(e){return y.setMode(e)})),y._parser.setCsiHandler({prefix:"?",final:"h"},(function(e){return y.setModePrivate(e)})),y._parser.setCsiHandler({final:"l"},(function(e){return y.resetMode(e)})),y._parser.setCsiHandler({prefix:"?",final:"l"},(function(e){return y.resetModePrivate(e)})),y._parser.setCsiHandler({final:"m"},(function(e){return y.charAttributes(e)})),y._parser.setCsiHandler({final:"n"},(function(e){return y.deviceStatus(e)})),y._parser.setCsiHandler({prefix:"?",final:"n"},(function(e){return y.deviceStatusPrivate(e)})),y._parser.setCsiHandler({intermediates:"!",final:"p"},(function(e){return y.softReset(e)})),y._parser.setCsiHandler({intermediates:" ",final:"q"},(function(e){return y.setCursorStyle(e)})),y._parser.setCsiHandler({final:"r"},(function(e){return y.setScrollRegion(e)})),y._parser.setCsiHandler({final:"s"},(function(e){return y.saveCursor(e)})),y._parser.setCsiHandler({final:"t"},(function(e){return y.windowOptions(e)})),y._parser.setCsiHandler({final:"u"},(function(e){return y.restoreCursor(e)})),y._parser.setCsiHandler({intermediates:"'",final:"}"},(function(e){return y.insertColumns(e)})),y._parser.setCsiHandler({intermediates:"'",final:"~"},(function(e){return y.deleteColumns(e)})),y._parser.setExecuteHandler(o.C0.BEL,(function(){return y.bell()})),y._parser.setExecuteHandler(o.C0.LF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.VT,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.FF,(function(){return y.lineFeed()})),y._parser.setExecuteHandler(o.C0.CR,(function(){return y.carriageReturn()})),y._parser.setExecuteHandler(o.C0.BS,(function(){return y.backspace()})),y._parser.setExecuteHandler(o.C0.HT,(function(){return y.tab()})),y._parser.setExecuteHandler(o.C0.SO,(function(){return y.shiftOut()})),y._parser.setExecuteHandler(o.C0.SI,(function(){return y.shiftIn()})),y._parser.setExecuteHandler(o.C1.IND,(function(){return y.index()})),y._parser.setExecuteHandler(o.C1.NEL,(function(){return y.nextLine()})),y._parser.setExecuteHandler(o.C1.HTS,(function(){return y.tabSet()})),y._parser.setOscHandler(0,new m.OscHandler((function(e){y.setTitle(e),y.setIconName(e)}))),y._parser.setOscHandler(1,new m.OscHandler((function(e){return y.setIconName(e)}))),y._parser.setOscHandler(2,new m.OscHandler((function(e){return y.setTitle(e)}))),y._parser.setEscHandler({final:"7"},(function(){return y.saveCursor()})),y._parser.setEscHandler({final:"8"},(function(){return y.restoreCursor()})),y._parser.setEscHandler({final:"D"},(function(){return y.index()})),y._parser.setEscHandler({final:"E"},(function(){return y.nextLine()})),y._parser.setEscHandler({final:"H"},(function(){return y.tabSet()})),y._parser.setEscHandler({final:"M"},(function(){return y.reverseIndex()})),y._parser.setEscHandler({final:"="},(function(){return y.keypadApplicationMode()})),y._parser.setEscHandler({final:">"},(function(){return y.keypadNumericMode()})),y._parser.setEscHandler({final:"c"},(function(){return y.fullReset()})),y._parser.setEscHandler({final:"n"},(function(){return y.setgLevel(2)})),y._parser.setEscHandler({final:"o"},(function(){return y.setgLevel(3)})),y._parser.setEscHandler({final:"|"},(function(){return y.setgLevel(3)})),y._parser.setEscHandler({final:"}"},(function(){return y.setgLevel(2)})),y._parser.setEscHandler({final:"~"},(function(){return y.setgLevel(1)})),y._parser.setEscHandler({intermediates:"%",final:"@"},(function(){return y.selectDefaultCharset()})),y._parser.setEscHandler({intermediates:"%",final:"G"},(function(){return y.selectDefaultCharset()}));var _=function(e){b._parser.setEscHandler({intermediates:"(",final:e},(function(){return y.selectCharset("("+e)})),b._parser.setEscHandler({intermediates:")",final:e},(function(){return y.selectCharset(")"+e)})),b._parser.setEscHandler({intermediates:"*",final:e},(function(){return y.selectCharset("*"+e)})),b._parser.setEscHandler({intermediates:"+",final:e},(function(){return y.selectCharset("+"+e)})),b._parser.setEscHandler({intermediates:"-",final:e},(function(){return y.selectCharset("-"+e)})),b._parser.setEscHandler({intermediates:".",final:e},(function(){return y.selectCharset("."+e)})),b._parser.setEscHandler({intermediates:"/",final:e},(function(){return y.selectCharset("/"+e)}))},b=this;for(var C in a.CHARSETS)_(C);return y._parser.setEscHandler({intermediates:"#",final:"8"},(function(){return y.screenAlignmentPattern()})),y._parser.setErrorHandler((function(e){return y._logService.error("Parsing error: ",e),e})),y._parser.setDcsHandler({intermediates:"$",final:"q"},new S(y._bufferService,y._coreService,y._logService,y._optionsService)),y}return n(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,i=t.x,r=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.length131072)for(var n=0;n0&&2===f.getWidth(s.x-1)&&f.setCellFromCodePoint(s.x-1,0,1,d.fg,d.bg,d.extended);for(var g=t;g=l)if(c){for(;s.x=this._bufferService.rows&&(s.y=this._bufferService.rows-1),s.lines.get(s.ybase+s.y).isWrapped=!0),f=s.lines.get(s.ybase+s.y)}else if(s.x=l-1,2===n)continue;if(u&&(f.insertCells(s.x,n,s.getNullCell(d),d),2===f.getWidth(l-1)&&f.setCellFromCodePoint(l-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),f.setCellFromCodePoint(s.x++,r,n,d.fg,d.bg,d.extended),n>0)for(;--n;)f.setCellFromCodePoint(s.x++,0,0,d.fg,d.bg,d.extended)}else f.getWidth(s.x-1)?f.addCodepointToCell(s.x-1,r):f.addCodepointToCell(s.x-2,r)}i-t>0&&(f.loadCell(s.x-1,this._workCell),2===this._workCell.getWidth()||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),s.x0&&0===f.getWidth(s.x)&&!f.hasContent(s.x)&&f.setCellFromCodePoint(s.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowService.markDirty(s.y)},t.prototype.addCsiHandler=function(e,t){var i=this;return"t"!==e.final||e.prefix||e.intermediates?this._parser.addCsiHandler(e,t):this._parser.addCsiHandler(e,(function(e){return!b(e.params[0],i._optionsService.options.windowOptions)||t(e)}))},t.prototype.addDcsHandler=function(e,t){return this._parser.addDcsHandler(e,new y.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.addEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.addOscHandler(e,new m.OscHandler(t))},t.prototype.bell=function(){this._onRequestBell.fire()},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire()},t.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(t.x>0&&t.x--);if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var i=t.lines.get(t.ybase+t.y);i.hasWidth(t.x)&&!i.hasContent(t.x)&&t.x--}this._restrictCursor()},t.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var e=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e)}},t.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},t.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1))},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1)},t.prototype.cursorForward=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.cursorBackward=function(e){this._moveCursor(-(e.params[0]||1),0)},t.prototype.cursorNextLine=function(e){this.cursorDown(e),this._bufferService.buffer.x=0},t.prototype.cursorPrecedingLine=function(e){this.cursorUp(e),this._bufferService.buffer.x=0},t.prototype.cursorCharAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.cursorPosition=function(e){this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1)},t.prototype.charPosAbsolute=function(e){this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y)},t.prototype.hPositionRelative=function(e){this._moveCursor(e.params[0]||1,0)},t.prototype.linePosAbsolute=function(e){this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1)},t.prototype.vPositionRelative=function(e){this._moveCursor(0,e.params[0]||1)},t.prototype.hVPosition=function(e){this.cursorPosition(e)},t.prototype.tabClear=function(e){var t=e.params[0];0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={})},t.prototype.cursorForwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},t.prototype.cursorBackwardTab=function(e){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var t=e.params[0]||1,i=this._bufferService.buffer;t--;)i.x=i.prevStop()},t.prototype._eraseInBufferLine=function(e,t,i,r){void 0===r&&(r=!1);var n=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);n.replaceCells(t,i,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r&&(n.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(t=this._bufferService.buffer.y,this._dirtyRowService.markDirty(t),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(t=this._bufferService.rows,this._dirtyRowService.markDirty(t-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var i=this._bufferService.buffer.lines.length-this._bufferService.rows;i>0&&(this._bufferService.buffer.lines.trimStart(i),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-i,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-i,0),this._onScroll.fire(0))}},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,i=this._bufferService.buffer;if(!(i.y>i.scrollBottom||i.yi.scrollBottom||i.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c"))},t.prototype.sendDeviceAttributesSecondary=function(e){e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c"))},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===r[1]&&s+n>=5)break;r[1]&&(n=1)}while(++s+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg);for(var t,i=e.length,r=this._curAttrData,n=0;n=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777224|t-90):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777224|t-100):0===t?(r.fg=d.DEFAULT_ATTR_DATA.fg,r.bg=d.DEFAULT_ATTR_DATA.bg):1===t?r.fg|=134217728:3===t?r.bg|=67108864:4===t?(r.fg|=268435456,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,r)):5===t?r.fg|=536870912:7===t?r.fg|=67108864:8===t?r.fg|=1073741824:2===t?r.bg|=134217728:21===t?this._processUnderline(2,r):22===t?(r.fg&=-134217729,r.bg&=-134217729):23===t?r.bg&=-67108865:24===t?r.fg&=-268435457:25===t?r.fg&=-536870913:27===t?r.fg&=-67108865:28===t?r.fg&=-1073741825:39===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):49===t?(r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?n+=this._extractColor(e,n,r):59===t?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t)},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(o.C0.ESC+"[0n");break;case 6:var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"["+t+";"+i+"R")}},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:var t=this._bufferService.buffer.y+1,i=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(o.C0.ESC+"[?"+t+";"+i+"R")}},t.prototype.softReset=function(e){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.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},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){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 i=t%2==1;this._optionsService.options.cursorBlink=i},t.prototype.setScrollRegion=function(e){var t,i=e.params[0]||1;(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>i&&(this._bufferService.buffer.scrollTop=i-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0))},t.prototype.windowOptions=function(e){if(b(e.params[0],this._optionsService.options.windowOptions)){var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(s.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(s.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(o.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},t.prototype.saveCursor=function(e){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},t.prototype.restoreCursor=function(e){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},t.prototype.setTitle=function(e){this._windowTitle=e,this._onTitleChange.fire(e)},t.prototype.setIconName=function(e){this._iconName=e},t.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},t.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},t.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},t.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,a.DEFAULT_CHARSET)},t.prototype.selectCharset=function(e){2===e.length?"/"!==e[0]&&this._charsetService.setgCharset(_[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET):this.selectDefaultCharset()},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor()},t.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;if(e.y===e.scrollTop){var t=e.scrollBottom-e.scrollTop;e.lines.shiftElements(e.ybase+e.y,t,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)}else e.y--,this._restrictCursor()},t.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},t.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){this._charsetService.setgLevel(e)},t.prototype.screenAlignmentPattern=function(){var e=new g.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var i=0;i256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var i=new e;if(!t.length)return i;for(var r=t[0]instanceof Array?1:0;r>8,r=255&this._subParamsIdx[t];r-i>0&&e.push(Array.prototype.slice.call(this._subParams,i,r))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>2147483647?2147483647:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>2147483647?2147483647:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,i=255&this._subParamsIdx[e];return i-t>0?this._subParams.subarray(t,i):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,r=255&this._subParamsIdx[t];r-i>0&&(e[t]=this._subParams.slice(i,r))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var i=this._digitIsSub?this._subParams:this.params,r=i[t-1];i[t-1]=~r?Math.min(10*r+e,2147483647):e}},e}();t.Params=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;var r=i(23),n=i(8),s=function(){function e(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.reset=function(){2===this._state&&this.end(!1),this._id=-1,this._state=0},e.prototype._start=function(){var e=this._handlers[this._id];if(e)for(var t=e.length-1;t>=0;t--)e[t].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,i){var r=this._handlers[this._id];if(r)for(var s=r.length-1;s>=0;s--)r[s].put(e,t,i);else this._handlerFb(this._id,"PUT",n.utf32ToString(e,t,i))},e.prototype._end=function(e){var t=this._handlers[this._id];if(t){for(var i=t.length-1;i>=0&&!1===t[i].end(e);i--);for(i--;i>=0;i--)t[i].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._id=-1,this._state=1},e.prototype.put=function(e,t,i){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,i)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._id=-1,this._state=0)},e}();t.OscParser=s;var o=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=n.utf32ToString(e,t,i),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var r=i(8),n=i(21),s=i(23),o=[],a=function(){function e(){this._handlers=Object.create(null),this._active=o,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},e.prototype.addHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var i=this._handlers[e];return i.push(t),{dispose:function(){var e=i.indexOf(t);-1!==e&&i.splice(e,1)}}},e.prototype.setHandler=function(e,t){this._handlers[e]=[t]},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=o,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||o,this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,i){if(this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i);else this._handlerFb(this._ident,"PUT",r.utf32ToString(e,t,i))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!1===this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=o,this._ident=0},e}();t.DcsParser=a;var l=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.clone(),this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,i){this._hitLimit||(this._data+=r.utf32ToString(e,t,i),this._data.length>s.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params||new n.Params)),this._params=void 0,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var r=i(26),n=i(43),s=[];t.acquireCharAtlas=function(e,t,i,o,a){for(var l=r.generateConfig(o,a,e,i),c=0;c=0){if(r.configEquals(h.config,l))return h.atlas;1===h.ownedBy.length?(h.atlas.dispose(),s.splice(c,1)):h.ownedBy.splice(u,1);break}}for(c=0;c1)for(var h=this._getJoinedRanges(r,a,s,t,n),d=0;d1)for(h=this._getJoinedRanges(r,a,s,t,n),d=0;d=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)},e.prototype.translateToString=function(e,t,i){return this._line.translateToString(e,t,i)},e}(),d=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,(function(e){return t(e.toArray())}))},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,(function(e,i){return t(e,i.toArray())}))},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),f=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;var s=i(36),o=i(37),a=i(38),l=i(12),c=i(19),u=i(40),h=i(50),d=i(51),f=i(11),p=i(7),g=i(18),v=i(54),m=i(55),y=i(56),_=i(57),b=i(59),S=i(0),C=i(16),w=i(27),k=i(60),x=i(5),E=i(61),T=i(62),L=i(63),A=i(64),R=i(65),D="undefined"!=typeof window?window.document:null,O=function(e){function t(t){void 0===t&&(t={});var i=e.call(this,t)||this;return i.browser=f,i._keyDownHandled=!1,i._onCursorMove=new S.EventEmitter,i._onKey=new S.EventEmitter,i._onRender=new S.EventEmitter,i._onSelectionChange=new S.EventEmitter,i._onTitleChange=new S.EventEmitter,i._onFocus=new S.EventEmitter,i._onBlur=new S.EventEmitter,i._onA11yCharEmitter=new S.EventEmitter,i._onA11yTabEmitter=new S.EventEmitter,i._setup(),i.linkifier=i._instantiationService.createInstance(h.Linkifier),i.linkifier2=i.register(i._instantiationService.createInstance(L.Linkifier2)),i.register(i._inputHandler.onRequestBell((function(){return i.bell()}))),i.register(i._inputHandler.onRequestRefreshRows((function(e,t){return i.refresh(e,t)}))),i.register(i._inputHandler.onRequestReset((function(){return i.reset()}))),i.register(i._inputHandler.onRequestScroll((function(e,t){return i.scroll(e,t||void 0)}))),i.register(i._inputHandler.onRequestWindowsOptionsReport((function(e){return i._reportWindowsOptions(e)}))),i.register(S.forwardEvent(i._inputHandler.onCursorMove,i._onCursorMove)),i.register(S.forwardEvent(i._inputHandler.onTitleChange,i._onTitleChange)),i.register(S.forwardEvent(i._inputHandler.onA11yChar,i._onA11yCharEmitter)),i.register(S.forwardEvent(i._inputHandler.onA11yTab,i._onA11yTabEmitter)),i.register(i._bufferService.onResize((function(e){return i._afterResize(e.cols,e.rows)}))),i}return n(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){var t,i,r;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._renderService)||void 0===t||t.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},null===(r=null===(i=this.element)||void 0===i?void 0:i.parentNode)||void 0===r||r.removeChild(this.element))},t.prototype._setup=function(){e.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty(t.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),t.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},t.prototype._updateOptions=function(t){var i,r,n,s;switch(e.prototype._updateOptions.call(this,t),t){case"fontFamily":case"fontSize":null===(i=this._renderService)||void 0===i||i.clear(),null===(r=this._charSizeService)||void 0===r||r.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":null===(n=this.viewport)||void 0===n||n.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)):(null===(s=this._accessibilityManager)||void 0===s||s.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},t.prototype._onTextAreaFocus=function(e){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},t.prototype.blur=function(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()},t.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(l.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},t.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var e=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),t=this._bufferService.buffer.y*e,i=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=i+"px",this.textarea.style.top=t+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=e+"px",this.textarea.style.lineHeight=e+"px",this.textarea.style.zIndex="-5"}},t.prototype._initGlobal=function(){var e=this;this._bindKeys(),this.register(p.addDisposableDomListener(this.element,"copy",(function(t){e.hasSelection()&&a.copyHandler(t,e._selectionService)})));var t=function(t){return a.handlePasteEvent(t,e.textarea,e._coreService)};this.register(p.addDisposableDomListener(this.textarea,"paste",t)),this.register(p.addDisposableDomListener(this.element,"paste",t)),f.isFirefox?this.register(p.addDisposableDomListener(this.element,"mousedown",(function(t){2===t.button&&a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))):this.register(p.addDisposableDomListener(this.element,"contextmenu",(function(t){a.rightClickHandler(t,e.textarea,e.screenElement,e._selectionService,e.options.rightClickSelectsWord)}))),f.isLinux&&this.register(p.addDisposableDomListener(this.element,"auxclick",(function(t){1===t.button&&a.moveTextAreaUnderMouseCursor(t,e.textarea,e.screenElement)})))},t.prototype._bindKeys=function(){var e=this;this.register(p.addDisposableDomListener(this.textarea,"keyup",(function(t){return e._keyUp(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keydown",(function(t){return e._keyDown(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"keypress",(function(t){return e._keyPress(t)}),!0)),this.register(p.addDisposableDomListener(this.textarea,"compositionstart",(function(){return e._compositionHelper.compositionstart()}))),this.register(p.addDisposableDomListener(this.textarea,"compositionupdate",(function(t){return e._compositionHelper.compositionupdate(t)}))),this.register(p.addDisposableDomListener(this.textarea,"compositionend",(function(){return e._compositionHelper.compositionend()}))),this.register(this.onRender((function(){return e._compositionHelper.updateCompositionElements()}))),this.register(this.onRender((function(t){return e._queueLinkification(t.start,t.end)})))},t.prototype.open=function(e){var t=this;if(!e)throw new Error("Terminal requires a parent element.");D.body.contains(e)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.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"),e.appendChild(this.element);var i=D.createDocumentFragment();this._viewportElement=D.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this._viewportScrollArea=D.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=D.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=D.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement),this.textarea=D.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.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(p.addDisposableDomListener(this.textarea,"focus",(function(e){return t._onTextAreaFocus(e)}))),this.register(p.addDisposableDomListener(this.textarea,"blur",(function(){return t._onTextAreaBlur()}))),this._helperContainer.appendChild(this.textarea);var r=this._instantiationService.createInstance(A.CoreBrowserService,this.textarea);this._instantiationService.setService(x.ICoreBrowserService,r),this._charSizeService=this._instantiationService.createInstance(E.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(x.ICharSizeService,this._charSizeService),this._compositionView=D.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(s.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(i),this._theme=this.options.theme||this._theme,this._colorManager=new w.ColorManager(D,this.options.allowTransparency),this.register(this.optionsService.onOptionChange((function(e){return t._colorManager.onOptionsChange(e)}))),this._colorManager.setTheme(this._theme);var n=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(k.RenderService,n,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange((function(e){return t._onRender.fire(e)}))),this.onResize((function(e){return t._renderService.resize(e.cols,e.rows)})),this._soundService=this._instantiationService.createInstance(v.SoundService),this._instantiationService.setService(x.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(x.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(o.Viewport,(function(e,i){return t.scrollLines(e,i)}),this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar((function(){return t.viewport.syncScrollArea()}))),this.register(this.viewport),this.register(this.onCursorMove((function(){t._renderService.onCursorMove(),t._syncTextArea()}))),this.register(this.onResize((function(){return t._renderService.onResize(t.cols,t.rows)}))),this.register(this.onBlur((function(){return t._renderService.onBlur()}))),this.register(this.onFocus((function(){return t._renderService.onFocus()}))),this.register(this._renderService.onDimensionsChange((function(){return t.viewport.syncScrollArea()}))),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((function(e){return t.scrollLines(e.amount,e.suppressScrollEvent)}))),this.register(this._selectionService.onSelectionChange((function(){return t._onSelectionChange.fire()}))),this.register(this._selectionService.onRequestRedraw((function(e){return t._renderService.onSelectionChanged(e.start,e.end,e.columnSelectMode)}))),this.register(this._selectionService.onLinuxMouseSelection((function(e){t.textarea.value=e,t.textarea.focus(),t.textarea.select()}))),this.register(this.onScroll((function(){t.viewport.syncScrollArea(),t._selectionService.refresh()}))),this.register(p.addDisposableDomListener(this._viewportElement,"scroll",(function(){return t._selectionService.refresh()}))),this._mouseZoneManager=this._instantiationService.createInstance(m.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll((function(){return t._mouseZoneManager.clearAll()}))),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(p.addDisposableDomListener(this.element,"mousedown",(function(e){return t._selectionService.onMouseDown(e)}))),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new y.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},t.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(u.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(_.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},t.prototype._setTheme=function(e){var t,i,r;this._theme=e,null===(t=this._colorManager)||void 0===t||t.setTheme(e),null===(i=this._renderService)||void 0===i||i.setColors(this._colorManager.colors),null===(r=this.viewport)||void 0===r||r.onThemeChange(this._colorManager.colors)},t.prototype.bindMouse=function(){var e=this,t=this,i=this.element;function r(e){var i,r,n=t._mouseService.getRawByteCoords(e,t.screenElement,t.cols,t.rows);if(!n)return!1;switch(e.overrideType||e.type){case"mousemove":r=32,void 0===e.buttons?(i=3,void 0!==e.button&&(i=e.button<3?e.button:3)):i=1&e.buttons?0:4&e.buttons?1:2&e.buttons?2:3;break;case"mouseup":r=0,i=e.button<3?e.button:3;break;case"mousedown":r=1,i=e.button<3?e.button:3;break;case"wheel":0!==e.deltaY&&(r=e.deltaY<0?0:1),i=4;break;default:return!1}return!(void 0===r||void 0===i||i>4)&&t._coreMouseService.triggerMouseEvent({col:n.x-33,row:n.y-33,button:i,action:r,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s=function(t){return r(t),t.buttons||(e._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.removeEventListener("mousemove",n.mousedrag)),e.cancel(t)},o=function(t){return r(t),t.preventDefault(),e.cancel(t)},a=function(e){e.buttons&&r(e)},c=function(e){e.buttons||r(e)};this.register(this._coreMouseService.onProtocolChange((function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?n.mousemove||(i.addEventListener("mousemove",c),n.mousemove=c):(i.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&t?n.wheel||(i.addEventListener("wheel",o,{passive:!1}),n.wheel=o):(i.removeEventListener("wheel",n.wheel),n.wheel=null),2&t?n.mouseup||(n.mouseup=s):(e._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&t?n.mousedrag||(n.mousedrag=a):(e._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)}))),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(p.addDisposableDomListener(i,"mousedown",(function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return r(t),n.mouseup&&e._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&e._document.addEventListener("mousemove",n.mousedrag),e.cancel(t)}))),this.register(p.addDisposableDomListener(i,"wheel",(function(t){if(n.wheel);else if(!e.buffer.hasScrollback){var i=e.viewport.getLinesScrolled(t);if(0===i)return;for(var r=l.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),s="",o=0;o47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,i){t!==this.cols||i!==this.rows?e.prototype.resize.call(this,t,i):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var i,r;null===(i=this._charSizeService)||void 0===i||i.measure(),null===(r=this.viewport)||void 0===r||r.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){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 e=1;e=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var s=i(5),o=i(1),a=function(){function e(e,t,i,r,n,s){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._charSizeService=n,this._coreService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout((function(){t._compositionPosition.end=t._textarea.value.length}),0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((function(){var e;t._isSendingComposition&&(t._isSendingComposition=!1,e=t._isComposing?t._textarea.value.substring(i.start,i.end):t._textarea.value.substring(i.start),t._coreService.triggerDataEvent(e,!0))}),0)}else{this._isSendingComposition=!1;var r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout((function(){if(!e._isComposing){var i=e._textarea.value.replace(t,"");i.length>0&&e._coreService.triggerDataEvent(i,!0)}}),0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var i=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),r=this._bufferService.buffer.y*i,n=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var s=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=s.width+"px",this._textarea.style.height=s.height+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout((function(){return t.updateCompositionElements(!0)}),0)}},r([n(2,o.IBufferService),n(3,o.IOptionsService),n(4,s.ICharSizeService),n(5,o.ICoreService)],e)}();t.CompositionHelper=a},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,r,n,s,o,a){var c=e.call(this)||this;return c._scrollLines=t,c._viewportElement=i,c._scrollArea=r,c._bufferService=n,c._optionsService=s,c._charSizeService=o,c._renderService=a,c.scrollBarWidth=0,c._currentRowHeight=0,c._lastRecordedBufferLength=0,c._lastRecordedViewportHeight=0,c._lastRecordedBufferHeight=0,c._lastTouchY=0,c._lastScrollTop=0,c._wheelPartialScroll=0,c._refreshAnimationFrame=null,c._ignoreNextScrollEvent=!1,c.scrollBarWidth=c._viewportElement.offsetWidth-c._scrollArea.offsetWidth||15,c.register(l.addDisposableDomListener(c._viewportElement,"scroll",c._onScroll.bind(c))),setTimeout((function(){return c.syncScrollArea()}),0),c}return n(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame((function(){return t._innerRefresh()})))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===t&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)}else this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){var i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&i0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var i=this._optionsService.options.fastScrollModifier;return"alt"===i&&t.altKey||"ctrl"===i&&t.ctrlKey||"shift"===i&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},s([o(3,u.IBufferService),o(4,u.IOptionsService),o(5,c.ICharSizeService),o(6,c.IRenderService)],t)}(a.Disposable);t.Viewport=h},function(e,t,i){"use strict";function r(e){return e.replace(/\r?\n/g,"\r")}function n(e,t){return t?"[200~"+e+"[201~":e}function s(e,t,i){e=n(e=r(e),i.decPrivateModes.bracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,i){var r=i.getBoundingClientRect(),n=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=n+"px",t.style.top=s+"px",t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=n,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,i){e.stopPropagation(),e.clipboardData&&s(e.clipboardData.getData("text/plain"),t,i)},t.paste=s,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,i,r,n){o(e,t,i),n&&!r.isClickInSelection(e)&&r.selectWordAtCursor(e),t.value=r.selectionText,t.select()}},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var s=i(2),o=i(15),a=i(21),l=i(22),c=i(24),u=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){o.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,i,r){this.table[t<<8|e]=i<<4|r},e.prototype.addMany=function(e,t,i,r){for(var n=0;n1)throw new Error("only one byte as prefix supported");if((i=e.prefix.charCodeAt(0))&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var r=0;rn||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");var s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(i<<=8)|s},i.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},i.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},i.prototype.setPrintHandler=function(e){this._printHandler=e},i.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},i.prototype.addEscHandler=function(e,t){var i=this._identifier(e,[48,126]);void 0===this._escHandlers[i]&&(this._escHandlers[i]=[]);var r=this._escHandlers[i];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},i.prototype.setEscHandler=function(e,t){this._escHandlers[this._identifier(e,[48,126])]=[t]},i.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},i.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},i.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},i.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},i.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},i.prototype.addCsiHandler=function(e,t){var i=this._identifier(e);void 0===this._csiHandlers[i]&&(this._csiHandlers[i]=[]);var r=this._csiHandlers[i];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},i.prototype.setCsiHandler=function(e,t){this._csiHandlers[this._identifier(e)]=[t]},i.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},i.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},i.prototype.addDcsHandler=function(e,t){return this._dcsParser.addHandler(this._identifier(e),t)},i.prototype.setDcsHandler=function(e,t){this._dcsParser.setHandler(this._identifier(e),t)},i.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},i.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},i.prototype.addOscHandler=function(e,t){return this._oscParser.addHandler(e,t)},i.prototype.setOscHandler=function(e,t){this._oscParser.setHandler(e,t)},i.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},i.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},i.prototype.setErrorHandler=function(e){this._errorHandler=e},i.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},i.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},i.prototype.parse=function(e,t){for(var i=0,r=0,n=this.currentState,s=this._oscParser,o=this._dcsParser,a=this._collect,l=this._params,c=this._transitions.table,u=0;u>4){case 2:for(var h=u+1;;++h){if(h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}if(++h>=t||(i=e[h])<32||i>126&&i<160){this._printHandler(e,u,h),u=h-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:i,currentState:n,collect:a,params:l,abort:!1}).abort)return;break;case 7:for(var d=this._csiHandlers[a<<8|i],f=d?d.length-1:-1;f>=0&&!1===d[f](l);f--);f<0&&this._csiHandlerFb(a<<8|i,l),this.precedingCodepoint=0;break;case 8:do{switch(i){case 59:l.addParam(0);break;case 58:l.addSubParam(-1);break;default:l.addDigit(i-48)}}while(++u47&&i<60);u--;break;case 9:a<<=8,a|=i;break;case 10:for(var p=this._escHandlers[a<<8|i],g=p?p.length-1:-1;g>=0&&!1===p[g]();g--);g<0&&this._escHandlerFb(a<<8|i),this.precedingCodepoint=0;break;case 11:l.reset(),l.addParam(0),a=0;break;case 12:o.hook(a<<8|i,l);break;case 13:for(var v=u+1;;++v)if(v>=t||24===(i=e[v])||26===i||27===i||i>127&&i<160){o.put(e,u,v),u=v-1;break}break;case 14:o.unhook(24!==i&&26!==i),27===i&&(r|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0;break;case 4:s.start();break;case 5:for(var m=u+1;;m++)if(m>=t||(i=e[m])<32||i>127&&i<=159){s.put(e,u,m),u=m-1;break}break;case 6:s.end(24!==i&&26!==i),27===i&&(r|=1),l.reset(),l.addParam(0),a=0,this.precedingCodepoint=0}n=15&r}this._collect=a,this.currentState=n},i}(s.Disposable);t.EscapeSequenceParser=h},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var a=i(41),l=i(47),c=i(48),u=i(49),h=i(29),d=i(2),f=i(5),p=i(1),g=i(25),v=i(0),m=1,y=function(e){function t(t,i,r,n,s,o,d,f,p){var g=e.call(this)||this;g._colors=t,g._screenElement=i,g._bufferService=s,g._charSizeService=o,g._optionsService=d,g._id=m++,g._onRequestRedraw=new v.EventEmitter;var y=g._optionsService.options.allowTransparency;return g._characterJoinerRegistry=new h.CharacterJoinerRegistry(g._bufferService),g._renderLayers=[new a.TextRenderLayer(g._screenElement,0,g._colors,g._characterJoinerRegistry,y,g._id,g._bufferService,d),new l.SelectionRenderLayer(g._screenElement,1,g._colors,g._id,g._bufferService,d),new u.LinkRenderLayer(g._screenElement,2,g._colors,g._id,r,n,g._bufferService,d),new c.CursorRenderLayer(g._screenElement,3,g._colors,g._id,g._onRequestRedraw,g._bufferService,d,f,p)],g.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},g._devicePixelRatio=window.devicePixelRatio,g._updateDimensions(),g.onOptionsChanged(),g}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,i=this._renderLayers;t0&&u===a[0][0]){d=!0;var p=a.shift();h=new c.JoinedCellData(this._workCell,o.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1}!d&&this._isOverlapping(h)&&fthis._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=i,i},t}(o.BaseRenderLayer);t.TextRenderLayer=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var r=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var i=0;i>>24,n=t.rgba>>>16&255,s=t.rgba>>>8&255,o=0;o=this.capacity)i=this._head,this._unlinkNode(i),delete this._map[i.key],i.key=e,i.value=t,this._map[e]=i;else{var r=this._nodePool;r.length>0?((i=r.pop()).key=e,i.value=t):i={prev:null,next:null,key:e,value:t},this._map[e]=i,this.size++}this._appendNode(i)},e}();t.LRUMap=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionRenderLayer=void 0;var s=function(e){function t(t,i,r,n,s,o){var a=e.call(this,t,"selection",i,!0,r,n,s,o)||this;return a._clearState(),a}return n(t,e),t.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._clearState()},t.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},t.prototype.onSelectionChanged=function(e,t,i){if(this._didStateChange(e,t,i,this._bufferService.buffer.ydisp))if(this._clearAll(),e&&t){var r=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,s=Math.max(r,0),o=Math.min(n,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){if(this._ctx.fillStyle=this._colors.selectionTransparent.css,i){var a=e[0],l=t[0]-a,c=o-s+1;this._fillCells(a,s,l,c)}else{a=r===s?e[0]:0;var u=s===o?t[0]:this._bufferService.cols;this._fillCells(a,s,u-a,1);var h=Math.max(o-s-1,0);if(this._fillCells(0,s+1,this._bufferService.cols,h),s!==o){var d=n===o?t[0]:this._bufferService.cols;this._fillCells(0,o,d,1)}}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=i,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,i,r){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||i!==this._state.columnSelectMode||r!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(i(13).BaseRenderLayer);t.SelectionRenderLayer=s},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CursorRenderLayer=void 0;var s=i(13),o=i(4),a=function(e){function t(t,i,r,n,s,a,l,c,u){var h=e.call(this,t,"cursor",i,!0,r,n,a,l)||this;return h._onRequestRedraw=s,h._coreService=c,h._coreBrowserService=u,h._cell=new o.CellData,h._state={x:0,y:0,isFocused:!1,style:"",width:0},h._cursorRenderers={bar:h._renderBarCursor.bind(h),block:h._renderBlockCursor.bind(h),underline:h._renderUnderlineCursor.bind(h)},h}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},t.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},t.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onOptionsChanged=function(){var e,t=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new l(this._coreBrowserService.isFocused,(function(){t._render(!0)}))):(null===(e=this._cursorBlinkStateManager)||void 0===e||e.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRedraw.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},t.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype.onGridChanged=function(e,t){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},t.prototype._render=function(e){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var t=this._bufferService.buffer.ybase+this._bufferService.buffer.y,i=t-this._bufferService.buffer.ydisp;if(i<0||i>=this._bufferService.rows)this._clearCursor();else{var r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(r,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var n=this._optionsService.options.cursorStyle;return n&&"block"!==n?this._cursorRenderers[n](r,i,this._cell):this._renderBlurCursor(r,i,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=i,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===i&&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,i,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=i,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.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})},t.prototype._renderBarCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,i.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(i,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,i){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,i){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,i.getWidth(),1),this._ctx.restore()},t}(s.BaseRenderLayer);t.CursorRenderLayer=a;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.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)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame((function(){e._renderCallback(),e._animationFrame=void 0}))))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0})),t._blinkInterval=window.setInterval((function(){if(t._animationTimeRestarted){var e=600-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame((function(){t._renderCallback(),t._animationFrame=void 0}))}),600)}),e)},e.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)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;var s=i(13),o=i(9),a=i(26),l=function(e){function t(t,i,r,n,s,o,a,l){var c=e.call(this,t,"link",i,!0,r,n,a,l)||this;return s.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),s.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),o.onShowLinkUnderline((function(e){return c._onShowLinkUnderline(e)})),o.onHideLinkUnderline((function(e){return c._onHideLinkUnderline(e)})),c}return n(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t),this._state=void 0},t.prototype.reset=function(){this._clearCurrentLink()},t.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(e.fg===o.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:e.fg&&a.is256Color(e.fg)?this._ctx.fillStyle=this._colors.ansi[e.fg].css:this._ctx.fillStyle=this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var s=i(0),o=i(1),a=function(){function e(e,t,i){this._bufferService=e,this._logService=t,this._unicodeService=i,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new s.EventEmitter,this._onHideLinkUnderline=new s.EventEmitter,this._onLinkTooltip=new s.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,i){var r=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=i):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,i)),this._mouseZoneManager.clearAll(t,i),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout((function(){return r._linkifyRows()}),e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var i=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,r=Math.ceil(2e3/this._bufferService.cols),n=this._bufferService.buffer.iterator(!1,t,i,r,r);n.hasNext();)for(var s=n.next(),o=0;o=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;i.validationCallback?i.validationCallback(a,(function(e){n._rowsTimeoutId||e&&n._addLink(c[1],c[0]-n._bufferService.buffer.ydisp,a,i,d)})):l._addLink(c[1],c[0]-l._bufferService.buffer.ydisp,a,i,d)},l=this;null!==(r=s.exec(t))&&"break"!==a(););},e.prototype._addLink=function(e,t,i,r,n){var s=this;if(this._mouseZoneManager&&this._element){var o=this._unicodeService.getStringCellWidth(i),a=e%this._bufferService.cols,c=t+Math.floor(e/this._bufferService.cols),u=(a+o)%this._bufferService.cols,h=c+Math.floor((a+o)/this._bufferService.cols);0===u&&(u=this._bufferService.cols,h--),this._mouseZoneManager.add(new l(a+1,c+1,u+1,h+1,(function(e){if(r.handler)return r.handler(e,i);var t=window.open();t?(t.opener=null,t.location.href=i):console.warn("Opening link blocked as opener could not be cleared")}),(function(){s._onShowLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,n)),s._element.classList.add("xterm-cursor-pointer")}),(function(e){s._onLinkTooltip.fire(s._createLinkHoverEvent(a,c,u,h,n)),r.hoverTooltipCallback&&r.hoverTooltipCallback(e,i,{start:{x:a,y:c},end:{x:u,y:h}})}),(function(){s._onHideLinkUnderline.fire(s._createLinkHoverEvent(a,c,u,h,n)),s._element.classList.remove("xterm-cursor-pointer"),r.hoverLeaveCallback&&r.hoverLeaveCallback()}),(function(e){return!r.willLinkActivate||r.willLinkActivate(e,i)})))}},e.prototype._createLinkHoverEvent=function(e,t,i,r,n){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:n}},e._timeBeforeLatency=200,e=r([n(0,o.IBufferService),n(1,o.ILogService),n(2,o.IUnicodeService)],e)}();t.Linkifier=a;var l=function(e,t,i,r,n,s,o,a,l){this.x1=e,this.y1=t,this.x2=i,this.y2=r,this.clickCallback=n,this.hoverCallback=s,this.tooltipCallback=o,this.leaveCallback=a,this.willLinkActivate=l};t.MouseZone=l},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var a=i(11),l=i(52),c=i(4),u=i(0),h=i(5),d=i(1),f=i(30),p=i(53),g=i(2),v=String.fromCharCode(160),m=new RegExp(v,"g"),y=function(e){function t(t,i,r,n,s,o,a){var h=e.call(this)||this;return h._element=t,h._screenElement=i,h._bufferService=r,h._coreService=n,h._mouseService=s,h._optionsService=o,h._renderService=a,h._dragScrollAmount=0,h._enabled=!0,h._workCell=new c.CellData,h._mouseDownTimeStamp=0,h._onLinuxMouseSelection=h.register(new u.EventEmitter),h._onRedrawRequest=h.register(new u.EventEmitter),h._onSelectionChange=h.register(new u.EventEmitter),h._onRequestScrollLines=h.register(new u.EventEmitter),h._mouseMoveListener=function(e){return h._onMouseMove(e)},h._mouseUpListener=function(e){return h._onMouseUp(e)},h._coreService.onUserInput((function(){h.hasSelection&&h.clearSelection()})),h._trimListener=h._bufferService.buffer.lines.onTrim((function(e){return h._onTrim(e)})),h.register(h._bufferService.buffers.onBufferActivate((function(e){return h._onBufferActivate(e)}))),h.enable(),h._model=new l.SelectionModel(h._bufferService),h._activeSelectionMode=0,h}return n(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var i=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var n=e[1];n<=t[1];n++){var s=i.translateBufferLineToString(n,!0,e[0],t[0]);r.push(s)}}else{var o=e[1]===t[1]?t[0]:void 0;for(r.push(i.translateBufferLineToString(e[1],!0,e[0],o)),n=e[1]+1;n<=t[1]-1;n++){var l=i.lines.get(n);s=i.translateBufferLineToString(n,!0),l&&l.isWrapped?r[r.length-1]+=s:r.push(s)}e[1]!==t[1]&&(l=i.lines.get(t[1]),s=i.translateBufferLineToString(t[1],!0,0,t[0]),l&&l.isWrapped?r[r.length-1]+=s:r.push(s))}return r.map((function(e){return e.replace(m," ")})).join(a.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame((function(){return t._refresh()}))),a.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype.isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(i&&r&&t)&&this._areCoordsInSelection(t,i,r)},t.prototype._areCoordsInSelection=function(e,t,i){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype.selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=f.getCoordsRelativeToElement(e,this._screenElement)[1],i=this._renderService.dimensions.canvasHeight;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return a.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval((function(){return e._dragScroll()}),50)},t.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},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),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]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(a.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var i=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){var r=p.moveToCellSequence(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((function(e){return t._onTrim(e)}))},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var i=t[0],r=0;t[0]>=r;r++){var n=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?i--:n>1&&t[0]!==r&&(i+=n-1)}return i},t.prototype.setSelection=function(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh()},t.prototype._getWordAt=function(e,t,i,r){if(void 0===i&&(i=!0),void 0===r&&(r=!0),!(e[0]>=this._bufferService.cols)){var n=this._bufferService.buffer,s=n.lines.get(e[1]);if(s){var o=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e),l=a,c=e[0]-a,u=0,h=0,d=0,f=0;if(" "===o.charAt(a)){for(;a>0&&" "===o.charAt(a-1);)a--;for(;l1&&(f+=v-1,l+=v-1);p>0&&a>0&&!this._isCharWordSeparator(s.loadCell(p-1,this._workCell));){s.loadCell(p-1,this._workCell);var m=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,p--):m>1&&(d+=m-1,a-=m-1),a--,p--}for(;g1&&(f+=y-1,l+=y-1),l++,g++}}l++;var _=a+c-u+d,b=Math.min(this._bufferService.cols,l-a+u+h-d-f);if(t||""!==o.slice(a,l).trim()){if(i&&0===_&&32!==s.getCodePoint(0)){var S=n.lines.get(e[1]-1);if(S&&s.isWrapped&&32!==S.getCodePoint(this._bufferService.cols-1)){var C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){var w=this._bufferService.cols-C.start;_-=w,b+=w}}}if(r&&_+b===this._bufferService.cols&&32!==s.getCodePoint(this._bufferService.cols-1)){var k=n.lines.get(e[1]+1);if(k&&k.isWrapped&&32!==k.getCodePoint(0)){var x=this._getWordAt([0,e[1]+1],!1,!1,!0);x&&(b+=x.length)}}return{start:_,length:b}}}}},t.prototype._selectWordAt=function(e,t){var i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var i=e[1];t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},s([o(2,d.IBufferService),o(3,d.ICoreService),o(4,h.IMouseService),o(5,d.IOptionsService),o(6,h.IRenderService)],t)}(g.Disposable);t.SelectionService=y},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0;var r=function(){function e(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}return e.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(e.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(e.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 e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,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}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var r=i(12);function n(e,t,i,r){var n=e-s(i,e),a=t-s(i,t);return c(Math.abs(n-a)-function(e,t,i){for(var r=0,n=e-s(i,e),a=t-s(i,t),l=0;l=0&&tt?"A":"B"}function a(e,t,i,r,n,s){for(var o=e,a=t,l="";o!==i||a!==r;)o+=n?1:-1,n&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!n&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),e=o=s.cols-1,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function l(e,t){var i=t?"O":"[";return r.C0.ESC+i+e}function c(e,t){e=Math.floor(e);for(var i="",r=0;r0?r-s(o,r):t;var d=r,f=function(e,t,i,r,o,a){var l;return l=n(i,r,o,a).length>0?r-s(o,r):t,e=i&&le?"D":"C",c(Math.abs(u-e),l(o,r));o=h>t?"D":"C";var d=Math.abs(h-t);return c(function(e,t){return t.cols-e}(h>t?e:u,i)+(d-1)*i.cols+1+((h>t?u:e)-1),l(o,r))}},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var s=i(1),o=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var i=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),(function(e){i.buffer=e,i.connect(t.destination),i.start(0)}))}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),i=t.length,r=new Uint8Array(i),n=0;n=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var a=i(2),l=i(7),c=i(5),u=i(1),h=function(e){function t(t,i,r,n,s,o){var a=e.call(this)||this;return a._element=t,a._screenElement=i,a._bufferService=r,a._mouseService=n,a._selectionService=s,a._optionsService=o,a._zones=[],a._areZonesActive=!1,a._lastHoverCoords=[void 0,void 0],a._initialSelectionLength=0,a.register(l.addDisposableDomListener(a._element,"mousedown",(function(e){return a._onMouseDown(e)}))),a._mouseMoveListener=function(e){return a._onMouseMove(e)},a._mouseLeaveListener=function(e){return a._onMouseLeave(e)},a._clickListener=function(e){return a._onClick(e)},a}return n(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var i=0;ie&&r.y1<=t+1||r.y2>e&&r.y2<=t+1||r.y1t+1)&&(this._currentZone&&this._currentZone===r&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(i--,1))}0===this._zones.length&&this._deactivate()}},t.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))},t.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))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,i=this._findZoneEventAt(e);i!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),i&&(this._currentZone=i,i.hoverCallback&&i.hoverCallback(e),this._tooltipTimeout=window.setTimeout((function(){return t._onTooltip(e)}),this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),i=this._getSelectionLength();t&&i===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var i=t[0],r=t[1],n=0;n=s.x1&&i=s.x1||r===s.y2&&is.y1&&re;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=s.tooMuchOutput)),o.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout((function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)}),0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,o.isMac&&h.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var i=this._terminal.buffer,r=i.lines.length.toString(),n=e;n<=t;n++){var s=i.translateBufferLineToString(i.ydisp+n,!0),o=(i.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===s.length?a.innerHTML=" ":a.textContent=s,a.setAttribute("aria-posinset",o),a.setAttribute("aria-setsize",r))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var a=i(58),l=i(9),c=i(2),u=i(5),h=i(1),d=i(0),f=i(10),p=i(17),g=1,v=function(e){function t(t,i,r,n,s,o,l,c,u){var h=e.call(this)||this;return h._colors=t,h._element=i,h._screenElement=r,h._viewportElement=n,h._linkifier=s,h._linkifier2=o,h._charSizeService=l,h._optionsService=c,h._bufferService=u,h._terminalClass=g++,h._rowElements=[],h._rowContainer=document.createElement("div"),h._rowContainer.classList.add("xterm-rows"),h._rowContainer.style.lineHeight="normal",h._rowContainer.setAttribute("aria-hidden","true"),h._refreshRowElements(h._bufferService.cols,h._bufferService.rows),h._selectionContainer=document.createElement("div"),h._selectionContainer.classList.add("xterm-selection"),h._selectionContainer.setAttribute("aria-hidden","true"),h.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},h._updateDimensions(),h._injectCss(),h._rowFactory=new a.DomRendererRowFactory(document,h._optionsService,h._colors),h._element.classList.add("xterm-dom-renderer-owner-"+h._terminalClass),h._screenElement.appendChild(h._rowContainer),h._screenElement.appendChild(h._selectionContainer),h._linkifier.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h._linkifier2.onShowLinkUnderline((function(e){return h._onLinkHover(e)})),h._linkifier2.onHideLinkUnderline((function(e){return h._onLinkLeave(e)})),h}return n(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new d.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),p.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.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 e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},t.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},t.prototype.onSelectionChanged=function(e,t,i){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var r=e[1]-this._bufferService.buffer.ydisp,n=t[1]-this._bufferService.buffer.ydisp,s=Math.max(r,0),o=Math.min(n,this._bufferService.rows-1);if(!(s>=this._bufferService.rows||o<0)){var a=document.createDocumentFragment();if(i)a.appendChild(this._createSelectionElement(s,e[0],t[0],o-s+1));else{var l=r===s?e[0]:0,c=s===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));var u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){var h=n===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,h))}}this._selectionContainer.appendChild(a)}}},t.prototype._createSelectionElement=function(e,t,i,r){void 0===r&&(r=1);var n=document.createElement("div");return n.style.height=r*this.dimensions.actualCellHeight+"px",n.style.top=e*this.dimensions.actualCellHeight+"px",n.style.left=t*this.dimensions.actualCellWidth+"px",n.style.width=this.dimensions.actualCellWidth*(i-t)+"px",n},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=n&&(e=0,i++)}},s([o(6,u.ICharSizeService),o(7,h.IOptionsService),o(8,h.IBufferService)],t)}(c.Disposable);t.DomRenderer=v},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var r=i(9),n=i(3),s=i(4),o=i(10);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var a=function(){function e(e,t,i){this._document=e,this._optionsService=t,this._colors=i,this._workCell=new s.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,i,s,a,c,u,h){for(var d=this._document.createDocumentFragment(),f=0,p=Math.min(e.length,h)-1;p>=0;p--)if(e.loadCell(p,this._workCell).getCode()!==n.NULL_CELL_CODE||i&&p===a){f=p+1;break}for(p=0;p1&&(v.style.width=u*g+"px"),i&&p===a)switch(v.classList.add(t.CURSOR_CLASS),c&&v.classList.add(t.CURSOR_BLINK_CLASS),s){case"bar":v.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":v.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:v.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&v.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&v.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&v.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&v.classList.add(t.UNDERLINE_CLASS),this._workCell.isInvisible()?v.textContent=n.WHITESPACE_CELL_CHAR:v.textContent=this._workCell.getChars()||n.WHITESPACE_CELL_CHAR;var m=this._workCell.getFgColor(),y=this._workCell.getFgColorMode(),_=this._workCell.getBgColor(),b=this._workCell.getBgColorMode(),S=!!this._workCell.isInverse();if(S){var C=m;m=_,_=C;var w=y;y=b,b=w}switch(y){case 16777216:case 33554432:this._workCell.isBold()&&m<8&&this._optionsService.options.drawBoldTextInBrightColors&&(m+=8),this._applyMinimumContrast(v,this._colors.background,this._colors.ansi[m])||v.classList.add("xterm-fg-"+m);break;case 50331648:var k=o.rgba.toColor(m>>16&255,m>>8&255,255&m);this._applyMinimumContrast(v,this._colors.background,k)||this._addStyle(v,"color:#"+l(m.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(v,this._colors.background,this._colors.foreground)||S&&v.classList.add("xterm-fg-"+r.INVERTED_DEFAULT_COLOR)}switch(b){case 16777216:case 33554432:v.classList.add("xterm-bg-"+_);break;case 50331648:this._addStyle(v,"background-color:#"+l(_.toString(16),"0",6));break;case 0:default:S&&v.classList.add("xterm-bg-"+r.INVERTED_DEFAULT_COLOR)}d.appendChild(v)}}return d},e.prototype._applyMinimumContrast=function(e,t,i){if(1===this._optionsService.options.minimumContrastRatio)return!1;var r=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===r&&(r=o.color.ensureContrastRatio(t,i,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=r?r:null)),!!r&&(this._addStyle(e,"color:"+r.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function l(e,t,i){for(;e.length"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,i,s){var o={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?o.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?o.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?o.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(o.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B");break;case 8:if(e.shiftKey){o.key=r.C0.BS;break}if(e.altKey){o.key=r.C0.ESC+r.C0.DEL;break}o.key=r.C0.DEL;break;case 9:if(e.shiftKey){o.key=r.C0.ESC+"[Z";break}o.key=r.C0.HT,o.cancel=!0;break;case 13:o.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,o.cancel=!0;break;case 27:o.key=r.C0.ESC,e.altKey&&(o.key=r.C0.ESC+r.C0.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"D",o.key===r.C0.ESC+"[1;3D"&&(o.key=r.C0.ESC+(i?"b":"[1;5D"))):o.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D";break;case 39:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"C",o.key===r.C0.ESC+"[1;3C"&&(o.key=r.C0.ESC+(i?"f":"[1;5C"))):o.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C";break;case 38:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"A",i||o.key!==r.C0.ESC+"[1;3A"||(o.key=r.C0.ESC+"[1;5A")):o.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A";break;case 40:if(e.metaKey)break;a?(o.key=r.C0.ESC+"[1;"+(a+1)+"B",i||o.key!==r.C0.ESC+"[1;3B"||(o.key=r.C0.ESC+"[1;5B")):o.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(o.key=r.C0.ESC+"[2~");break;case 46:o.key=a?r.C0.ESC+"[3;"+(a+1)+"~":r.C0.ESC+"[3~";break;case 36:o.key=a?r.C0.ESC+"[1;"+(a+1)+"H":t?r.C0.ESC+"OH":r.C0.ESC+"[H";break;case 35:o.key=a?r.C0.ESC+"[1;"+(a+1)+"F":t?r.C0.ESC+"OF":r.C0.ESC+"[F";break;case 33:e.shiftKey?o.type=2:o.key=r.C0.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:o.key=r.C0.ESC+"[6~";break;case 112:o.key=a?r.C0.ESC+"[1;"+(a+1)+"P":r.C0.ESC+"OP";break;case 113:o.key=a?r.C0.ESC+"[1;"+(a+1)+"Q":r.C0.ESC+"OQ";break;case 114:o.key=a?r.C0.ESC+"[1;"+(a+1)+"R":r.C0.ESC+"OR";break;case 115:o.key=a?r.C0.ESC+"[1;"+(a+1)+"S":r.C0.ESC+"OS";break;case 116:o.key=a?r.C0.ESC+"[15;"+(a+1)+"~":r.C0.ESC+"[15~";break;case 117:o.key=a?r.C0.ESC+"[17;"+(a+1)+"~":r.C0.ESC+"[17~";break;case 118:o.key=a?r.C0.ESC+"[18;"+(a+1)+"~":r.C0.ESC+"[18~";break;case 119:o.key=a?r.C0.ESC+"[19;"+(a+1)+"~":r.C0.ESC+"[19~";break;case 120:o.key=a?r.C0.ESC+"[20;"+(a+1)+"~":r.C0.ESC+"[20~";break;case 121:o.key=a?r.C0.ESC+"[21;"+(a+1)+"~":r.C0.ESC+"[21~";break;case 122:o.key=a?r.C0.ESC+"[23;"+(a+1)+"~":r.C0.ESC+"[23~";break;case 123:o.key=a?r.C0.ESC+"[24;"+(a+1)+"~":r.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(i&&!s||!e.altKey||e.metaKey)i&&!e.altKey&&!e.ctrlKey&&e.metaKey?65===e.keyCode&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?o.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(o.key=r.C0.US);else{var l=n[e.keyCode],c=l&&l[e.shiftKey?1:0];if(c)o.key=r.C0.ESC+c;else if(e.keyCode>=65&&e.keyCode<=90){var u=e.ctrlKey?e.keyCode-64:e.keyCode+32;o.key=r.C0.ESC+String.fromCharCode(u)}}else e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?o.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?o.key=r.C0.DEL:219===e.keyCode?o.key=r.C0.ESC:220===e.keyCode?o.key=r.C0.FS:221===e.keyCode&&(o.key=r.C0.GS)}return o}},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var a=i(31),l=i(0),c=i(2),u=i(32),h=i(7),d=i(1),f=i(5),p=function(e){function t(t,i,r,n,s,o){var c=e.call(this)||this;if(c._renderer=t,c._rowCount=i,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 l.EventEmitter,c._onRender=new l.EventEmitter,c._onRefreshRequest=new l.EventEmitter,c.register({dispose:function(){return c._renderer.dispose()}}),c._renderDebouncer=new a.RenderDebouncer((function(e,t){return c._renderRows(e,t)})),c.register(c._renderDebouncer),c._screenDprMonitor=new u.ScreenDprMonitor,c._screenDprMonitor.setListener((function(){return c.onDevicePixelRatioChange()})),c.register(c._screenDprMonitor),c.register(o.onResize((function(e){return c._fullRefresh()}))),c.register(n.onOptionChange((function(){return c._renderer.onOptionsChanged()}))),c.register(s.onCharSizeChange((function(){return c.onCharSizeChanged()}))),c._renderer.onRequestRedraw((function(e){return c.refreshRows(e.start,e.end,!0)})),c.register(h.addDisposableDomListener(window,"resize",(function(){return c.onDevicePixelRatioChange()}))),"IntersectionObserver"in window){var d=new IntersectionObserver((function(e){return c._onIntersectionChange(e[e.length-1])}),{threshold:0});d.observe(r),c.register({dispose:function(){return d.disconnect()}})}return c}return n(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=0===e.intersectionRatio,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,i){void 0===i&&(i=!1),this._isPaused?this._needsFullRefresh=!0:(i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw((function(e){return t.refreshRows(e.start,e.end,!0)})),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.onSelectionChanged(e,t,i)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},s([o(3,d.IOptionsService),o(4,f.ICharSizeService),o(5,d.IBufferService)],t)}(c.Disposable);t.RenderService=p},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var s=i(1),o=i(0),a=function(){function e(e,t,i){this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=new o.EventEmitter,this._measureStrategy=new l(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},r([n(2,s.IOptionsService)],e)}();t.CharSizeService=a;var l=function(){function e(e,t,i){this._document=e,this._parentElement=t,this._optionsService=i,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 e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var s=i(5),o=i(30),a=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,i,r,n){return o.getCoords(e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,n)},e.prototype.getRawByteCoords=function(e,t,i,r){var n=this.getCoords(e,t,i,r);return o.getRawByteCoords(n)},r([n(0,s.IRenderService),n(1,s.ICharSizeService)],e)}();t.MouseService=a},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var a=i(1),l=i(0),c=i(2),u=i(7),h=function(e){function t(t){var i=e.call(this)||this;return i._bufferService=t,i._linkProviders=[],i._linkCacheDisposables=[],i._isMouseOut=!0,i._activeLine=-1,i._onShowLinkUnderline=i.register(new l.EventEmitter),i._onHideLinkUnderline=i.register(new l.EventEmitter),i.register(c.getDisposeArrayDisposable(i._linkCacheDisposables)),i}return n(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var i=t._linkProviders.indexOf(e);-1!==i&&t._linkProviders.splice(i,1)}}},t.prototype.attachToDom=function(e,t,i){var r=this;this._element=e,this._mouseService=t,this._renderService=i,this.register(u.addDisposableDomListener(this._element,"mouseleave",(function(){r._isMouseOut=!0,r._clearCurrentLink()}))),this.register(u.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(u.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var i=e.composedPath(),r=0;re?this._bufferService.cols:o.link.range.end.x,c=a;c<=l;c++){if(i.has(c)){n.splice(s--,1);break}i.add(c)}}},t.prototype._checkLinkProviderResult=function(e,t,i){var r,n=this;if(!this._activeProviderReplies)return i;for(var s=this._activeProviderReplies.get(e),o=!1,a=0;a=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,c.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.pointerCursor},set:function(e){var i,r;(null===(i=t._currentLink)||void 0===i?void 0:i.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(r=t._element)||void 0===r||r.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,i;return null===(i=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===i?void 0:i.decorations.underline},set:function(i){var r,n,s;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&(null===(s=null===(n=t._currentLink)||void 0===n?void 0:n.state)||void 0===s?void 0:s.decorations.underline)!==i&&(t._currentLink.state.decorations.underline=i,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,i))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange((function(e){var i=0===e.start?0:e.start+1+t._bufferService.buffer.ydisp;t._clearCurrentLink(i,e.end+1+t._bufferService.buffer.ydisp)}))))}},t.prototype._linkHover=function(e,t,i){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var i=e.range,r=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)},t.prototype._linkLeave=function(e,t,i){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)},t.prototype._linkAtPosition=function(e,t){var i=e.range.start.y===e.range.end.y,r=e.range.start.yt.y;return(i&&e.range.start.x<=t.x&&e.range.end.x>=t.x||r&&e.range.end.x>=t.x||n&&e.range.start.x<=t.x||r&&n)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,i){var r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,i,r,n){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:n}},s([o(0,a.IBufferService)],t)}(c.Disposable);t.Linkifier2=h},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var r=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;var s=i(2),o=i(1),a=i(66),l=i(67),c=i(68),u=i(74),h=i(75),d=i(0),f=i(76),p=i(77),g=i(78),v=i(80),m=i(81),y=i(19),_=i(82),b=function(e){function t(t){var i=e.call(this)||this;return i._onBinary=new d.EventEmitter,i._onData=new d.EventEmitter,i._onLineFeed=new d.EventEmitter,i._onResize=new d.EventEmitter,i._onScroll=new d.EventEmitter,i._instantiationService=new a.InstantiationService,i.optionsService=new u.OptionsService(t),i._instantiationService.setService(o.IOptionsService,i.optionsService),i._bufferService=i.register(i._instantiationService.createInstance(c.BufferService)),i._instantiationService.setService(o.IBufferService,i._bufferService),i._logService=i._instantiationService.createInstance(l.LogService),i._instantiationService.setService(o.ILogService,i._logService),i._coreService=i.register(i._instantiationService.createInstance(h.CoreService,(function(){return i.scrollToBottom()}))),i._instantiationService.setService(o.ICoreService,i._coreService),i._coreMouseService=i._instantiationService.createInstance(f.CoreMouseService),i._instantiationService.setService(o.ICoreMouseService,i._coreMouseService),i._dirtyRowService=i._instantiationService.createInstance(p.DirtyRowService),i._instantiationService.setService(o.IDirtyRowService,i._dirtyRowService),i.unicodeService=i._instantiationService.createInstance(g.UnicodeService),i._instantiationService.setService(o.IUnicodeService,i.unicodeService),i._charsetService=i._instantiationService.createInstance(v.CharsetService),i._instantiationService.setService(o.ICharsetService,i._charsetService),i._inputHandler=new y.InputHandler(i._bufferService,i._charsetService,i._coreService,i._dirtyRowService,i._logService,i.optionsService,i._coreMouseService,i.unicodeService),i.register(d.forwardEvent(i._inputHandler.onLineFeed,i._onLineFeed)),i.register(i._inputHandler),i.register(d.forwardEvent(i._bufferService.onResize,i._onResize)),i.register(d.forwardEvent(i._coreService.onData,i._onData)),i.register(d.forwardEvent(i._coreService.onBinary,i._onBinary)),i.register(i.optionsService.onOptionChange((function(e){return i._updateOptions(e)}))),i._writeBuffer=new _.WriteBuffer((function(e){return i._inputHandler.parse(e)})),i}return n(t,e),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 t;this._isDisposed||(e.prototype.dispose.call(this),null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)},t.prototype.write=function(e,t){this._writeBuffer.write(e,t)},t.prototype.writeSync=function(e){this._writeBuffer.writeSync(e)},t.prototype.resize=function(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,c.MINIMUM_COLS),t=Math.max(t,c.MINIMUM_ROWS),this._bufferService.resize(e,t))},t.prototype.scroll=function(e,t){void 0===t&&(t=!1);var i,r=this._bufferService.buffer;(i=this._cachedBlankLine)&&i.length===this.cols&&i.getFg(0)===e.fg&&i.getBg(0)===e.bg||(i=r.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;var n=r.ybase+r.scrollTop,s=r.ybase+r.scrollBottom;if(0===r.scrollTop){var o=r.lines.isFull;s===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(s+1,0,i.clone()),o?this._bufferService.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this._bufferService.isUserScrolling||r.ydisp++)}else{var a=s-n+1;r.lines.shiftElements(n+1,a-1,-1),r.lines.set(s,i.clone())}this._bufferService.isUserScrolling||(r.ydisp=r.ybase),this._dirtyRowService.markRangeDirty(r.scrollTop,r.scrollBottom),this._onScroll.fire(r.ydisp)},t.prototype.scrollLines=function(e,t){var i=this._bufferService.buffer;if(e<0){if(0===i.ydisp)return;this._bufferService.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this._bufferService.isUserScrolling=!1);var r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(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(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},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(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(m.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},(function(){return m.updateWindowsModeWrappedState(e._bufferService),!1}))),this._windowsMode={dispose:function(){for(var e=0,i=t;e0?n[0].index:t.length;if(t.length!==h)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(h+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,r([void 0],r(t,o))))},e}();t.InstantiationService=a},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,i=arguments.length;t=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var a=i(1),l=i(69),c=i(0),u=i(2);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var h=function(e){function i(i){var r=e.call(this)||this;return r._optionsService=i,r.isUserScrolling=!1,r._onResize=new c.EventEmitter,r.cols=Math.max(i.options.cols,t.MINIMUM_COLS),r.rows=Math.max(i.options.rows,t.MINIMUM_ROWS),r.buffers=new l.BufferSet(i,r),r}return n(i,e),Object.defineProperty(i.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),i.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},i.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},i.prototype.reset=function(){this.buffers.dispose(),this.buffers=new l.BufferSet(this._optionsService,this),this.isUserScrolling=!1},s([o(0,a.IOptionsService)],i)}(u.Disposable);t.BufferService=h},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var s=i(70),o=i(0),a=function(e){function t(t,i){var r=e.call(this)||this;return r._onBufferActivate=r.register(new o.EventEmitter),r._normal=new s.Buffer(!0,t,i),r._normal.fillViewportRows(),r._alt=new s.Buffer(!1,t,i),r._activeBuffer=r._normal,r.setupTabStops(),r}return n(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.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}))},t.prototype.activateAltBuffer=function(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(i(2).Disposable);t.BufferSet=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var r=i(71),n=i(16),s=i(4),o=i(3),a=i(72),l=i(73),c=i(20),u=i(6);t.MAX_BUFFER_SIZE=4294967295;var h=function(){function e(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=n.DEFAULT_ATTR_DATA.clone(),this.savedCharset=c.DEFAULT_CHARSET,this.markers=[],this._nullCell=s.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]),this._whitespaceCell=s.CellData.fromCharData([0,o.WHITESPACE_CELL_CHAR,o.WHITESPACE_CELL_WIDTH,o.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 e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new n.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:i},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=n.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.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()},e.prototype.resize=function(e,t){var i=this.getNullCell(n.DEFAULT_ATTR_DATA),r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new n.BufferLine(e,i)));else for(a=this._rows;a>t;a--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(s=0;sthis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var i=a.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(n.DEFAULT_ATTR_DATA));if(i.length>0){var r=a.reflowLargerCreateNewLayout(this.lines,i);a.reflowLargerApplyNewLayout(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,i){for(var r=this.getNullCell(n.DEFAULT_ATTR_DATA),s=i;s-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;o--){var l=this.lines.get(o);if(!(!l||!l.isWrapped&&l.getTrimmedLength()<=e)){for(var c=[l];l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);var u=this.ybase+this.y;if(!(u>=o&&u0&&(r.push({start:o+c.length+s,newLines:g}),s+=g.length),c.push.apply(c,g);var y=f.length-1,_=f[y];0===_&&(_=f[--y]);for(var b=c.length-p-1,S=d;b>=0;){var C=Math.min(S,_);if(c[y].copyCellsFrom(c[b],S-C,_-C,C,!0),0==(_-=C)&&(_=f[--y]),0==(S-=C)){b--;var w=Math.max(b,0);S=a.getWrappedLineTrimmedLength(c,w,this._cols)}}for(v=0;v0;)0===this.ybase?this.y0){var x=[],E=[];for(v=0;v=0;v--)if(R&&R.start>L+D){for(var O=R.newLines.length-1;O>=0;O--)this.lines.set(v--,R.newLines[O]);v++,x.push({index:L+1,amount:R.newLines.length}),D+=R.newLines.length,R=r[++A]}else this.lines.set(v,E[L--]);var M=0;for(v=x.length-1;v>=0;v--)x[v].index+=M,this.lines.onInsertEmitter.fire(x[v]),M+=x[v].amount;var I=Math.max(0,T+s-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}},e.prototype.stringIndexToBufferIndex=function(e,t,i){for(void 0===i&&(i=!1);t;){var r=this.lines.get(e);if(!r)return[-1,-1];for(var n=i?r.getTrimmedLength():r.length,s=0;s0&&this.lines.get(t).isWrapped;)t--;for(;i+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,i=new l.Marker(e);return this.markers.push(i),i.register(this.lines.onTrim((function(e){i.line-=e,i.line<0&&i.dispose()}))),i.register(this.lines.onInsert((function(e){i.line>=e.index&&(i.line+=e.amount)}))),i.register(this.lines.onDelete((function(e){i.line>=e.index&&i.linee.index&&(i.line-=e.amount)}))),i.register(i.onDispose((function(){return t._removeMarker(i)}))),i},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,i,r,n){return new d(this,e,t,i,r,n)},e}();t.Buffer=h;var d=function(){function e(e,t,i,r,n,s){void 0===i&&(i=0),void 0===r&&(r=e.lines.length),void 0===n&&(n=0),void 0===s&&(s=0),this._buffer=e,this._trimRight=t,this._startIndex=i,this._endIndex=r,this._startOverscan=n,this._endOverscan=s,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",i=e.first;i<=e.last;++i)t+=this._buffer.translateBufferLineToString(i,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=d},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;var r=i(0),n=function(){function e(e){this._maxLength=e,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(e.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxLength",{get:function(){return this._maxLength},set:function(e){if(this._maxLength!==e){for(var t=new Array(e),i=0;ithis._length)for(var t=this._length;t=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(n=0;nthis._maxLength){var s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(var r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));var n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(r=0;r=a&&n0&&(b>h||0===u[b].getTrimmedLength());b--)_++;_>0&&(o.push(a+u.length-_),o.push(_)),a+=u.length-1}}}return o},t.reflowLargerCreateNewLayout=function(e,t){for(var i=[],r=0,n=t[r],s=0,o=0;oc&&(o-=c,a++);var u=2===e[a].getWidth(o-1);u&&o--;var h=u?i-1:i;n.push(h),l+=h}return n},t.getWrappedLineTrimmedLength=r},function(e,t,i){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var s=i(0),o=function(e){function t(i){var r=e.call(this)||this;return r.line=i,r._id=t._nextId++,r.isDisposed=!1,r._onDispose=new s.EventEmitter,r}return n(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},t._nextId=1,t}(i(2).Disposable);t.Marker=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=t.DEFAULT_BELL_SOUND=void 0;var r=i(0),n=i(11),s=i(33);t.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",t.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:t.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:n.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var o=["cols","rows"],a=function(){function e(e){this._onOptionChange=new r.EventEmitter,this.options=s.clone(t.DEFAULT_OPTIONS);for(var i=0,n=Object.keys(e);i=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},o=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var a=i(1),l=i(0),c=i(33),u=i(2),h=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=function(e){function t(t,i,r,n){var s=e.call(this)||this;return s._bufferService=i,s._logService=r,s._optionsService=n,s.isCursorInitialized=!1,s.isCursorHidden=!1,s._onData=s.register(new l.EventEmitter),s._onUserInput=s.register(new l.EventEmitter),s._onBinary=s.register(new l.EventEmitter),s._scrollToBottom=t,s.register({dispose:function(){return s._scrollToBottom=void 0}}),s.modes=c.clone(h),s.decPrivateModes=c.clone(d),s}return n(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=c.clone(h),this.decPrivateModes=c.clone(d)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var i=this._bufferService.buffer;i.ybase!==i.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',(function(){return e.split("").map((function(e){return e.charCodeAt(0)}))})),this._onBinary.fire(e))},s([o(1,a.IBufferService),o(2,a.ILogService),o(3,a.IOptionsService)],t)}(u.Disposable);t.CoreService=f},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var s=i(1),o=i(0),a={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function l(e,t){var i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(i|=64,i|=e.action):(i|=3&e.button,4&e.button&&(i|=64),8&e.button&&(i|=128),32===e.action?i|=32:0!==e.action||t||(i|=3)),i}var c=String.fromCharCode,u={DEFAULT:function(e){var t=[l(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":"[M"+c(t[0])+c(t[1])+c(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"[<"+l(e,!0)+";"+e.col+";"+e.row+t}},h=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new o.EventEmitter,this._lastEvent=null;for(var i=0,r=Object.keys(a);i=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},r([n(0,s.IBufferService),n(1,s.ICoreService)],e)}();t.CoreMouseService=h},function(e,t,i){"use strict";var r=this&&this.__decorate||function(e,t,i,r){var n,s=arguments.length,o=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,i,o):n(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},n=this&&this.__param||function(e,t){return function(i,r){t(i,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var s=i(1),o=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var i=e;e=t,t=i}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},r([n(0,s.IBufferService)],e)}();t.DirtyRowService=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;var r=i(0),n=i(79),s=function(){function e(){this._providers=Object.create(null),this._active="",this._onChange=new r.EventEmitter;var e=new n.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}return Object.defineProperty(e.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._active},set:function(e){if(!this._providers[e])throw new Error('unknown Unicode version "'+e+'"');this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)},enumerable:!1,configurable:!0}),e.prototype.register=function(e){this._providers[e.version]=e},e.prototype.wcwidth=function(e){return this._activeProvider.wcwidth(e)},e.prototype.getStringCellWidth=function(e){for(var t=0,i=e.length,r=0;r=i)return t+this.wcwidth(n);var s=e.charCodeAt(r);56320<=s&&s<=57343?n=1024*(n-55296)+s-56320+65536:t+=this.wcwidth(s)}t+=this.wcwidth(n)}return t},e}();t.UnicodeService=s},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var r,n=i(15),s=[[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]],o=[[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]],a=function(){function e(){if(this.version="6",!r){r=new Uint8Array(65536),n.fill(r,1),r[0]=0,n.fill(r,0,1,32),n.fill(r,0,127,160),n.fill(r,2,4352,4448),r[9001]=2,r[9002]=2,n.fill(r,2,11904,42192),r[12351]=1,n.fill(r,2,44032,55204),n.fill(r,2,63744,64256),n.fill(r,2,65040,65050),n.fill(r,2,65072,65136),n.fill(r,2,65280,65377),n.fill(r,2,65504,65511);for(var e=0;et[n][1])return!1;for(;n>=r;)if(e>t[i=r+n>>1][1])r=i+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var r=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;var r=i(3);t.updateWindowsModeWrappedState=function(e){var t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),i=null==t?void 0:t.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=i[r.CHAR_DATA_CODE_INDEX]!==r.NULL_CELL_CODE&&i[r.CHAR_DATA_CODE_INDEX]!==r.WHITESPACE_CELL_CODE)}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var r=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout((function(){return i._innerWrite()}))),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var i=this._writeBuffer[this._bufferOffset],r=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(i),this._pendingData-=i.length,r&&r(),Date.now()-t>=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 e._innerWrite()}),0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var r=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var i=this,r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=function(){return i._wrappedAddonDispose(r)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,i=0;i> RFB.constructor"),r._screen=document.createElement("div"),r._screen.style.display="flex",r._screen.style.width="100%",r._screen.style.height="100%",r._screen.style.overflow="auto",r._screen.style.background="rgb(40, 40, 40)",r._canvas=document.createElement("canvas"),r._canvas.style.margin="auto",r._canvas.style.outline="none",r._canvas.style.flexShrink="0",r._canvas.width=0,r._canvas.height=0,r._canvas.tabIndex=-1,r._screen.appendChild(r._canvas),r._cursor=new g.default,r._cursorImage=T.cursors.none,r._decoders[b.encodings.encodingRaw]=new S.default,r._decoders[b.encodings.encodingCopyRect]=new C.default,r._decoders[b.encodings.encodingRRE]=new w.default,r._decoders[b.encodings.encodingHextile]=new k.default,r._decoders[b.encodings.encodingTight]=new x.default,r._decoders[b.encodings.encodingTightPNG]=new E.default;try{r._display=new u.default(r._canvas)}catch(e){throw n.Error("Display exception: "+e),e}return r._display.onflush=r._onFlush.bind(I(r)),r._keyboard=new f.default(r._canvas),r._keyboard.onkeyevent=r._handleKeyEvent.bind(I(r)),r._gestures=new p.default,r._sock=new v.default,r._sock.on("message",(function(){r._handleMessage()})),r._sock.on("open",(function(){"connecting"===r._rfbConnectionState&&""===r._rfbInitState?(r._rfbInitState="ProtocolVersion",n.Debug("Starting VNC handshake")):r._fail("Unexpected server connection while "+r._rfbConnectionState)})),r._sock.on("close",(function(e){n.Debug("WebSocket on-close event");var t="";switch(e.code&&(t="(code: "+e.code,e.reason&&(t+=", reason: "+e.reason),t+=")"),r._rfbConnectionState){case"connecting":r._fail("Connection closed "+t);break;case"connected":r._updateConnectionState("disconnecting"),r._updateConnectionState("disconnected");break;case"disconnecting":r._updateConnectionState("disconnected");break;case"disconnected":r._fail("Unexpected server disconnect when already disconnected "+t);break;default:r._fail("Unexpected server disconnect before connecting "+t)}r._sock.off("close")})),r._sock.on("error",(function(e){return n.Warn("WebSocket on-error event")})),setTimeout(r._updateConnectionState.bind(I(r),"connecting")),n.Debug("<< RFB.constructor"),r.dragViewport=!1,r.focusOnClick=!0,r._viewOnly=!1,r._clipViewport=!1,r._scaleViewport=!1,r._resizeSession=!1,r._showDotCursor=!1,void 0!==i.showDotCursor&&(n.Warn("Specifying showDotCursor as a RFB constructor argument is deprecated"),r._showDotCursor=i.showDotCursor),r._qualityLevel=6,r._compressionLevel=2,r}return t=T,c=[{key:"genDES",value:function(e,t){var i=e.split("").map((function(e){return e.charCodeAt(0)}));return new m.default(i).encrypt(t)}}],(i=[{key:"disconnect",value:function(){this._updateConnectionState("disconnecting"),this._sock.off("error"),this._sock.off("message"),this._sock.off("open")}},{key:"sendCredentials",value:function(e){this._rfbCredentials=e,setTimeout(this._initMsg.bind(this),0)}},{key:"sendCtrlAltDel",value:function(){"connected"!==this._rfbConnectionState||this._viewOnly||(n.Info("Sending Ctrl-Alt-Del"),this.sendKey(y.default.XK_Control_L,"ControlLeft",!0),this.sendKey(y.default.XK_Alt_L,"AltLeft",!0),this.sendKey(y.default.XK_Delete,"Delete",!0),this.sendKey(y.default.XK_Delete,"Delete",!1),this.sendKey(y.default.XK_Alt_L,"AltLeft",!1),this.sendKey(y.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(e,t,i){if("connected"===this._rfbConnectionState&&!this._viewOnly){if(void 0===i)return this.sendKey(e,t,!0),void this.sendKey(e,t,!1);var r=_.default[t];if(this._qemuExtKeyEventSupported&&r)e=e||0,n.Info("Sending key ("+(i?"down":"up")+"): keysym "+e+", scancode "+r),T.messages.QEMUExtendedKeyEvent(this._sock,e,i,r);else{if(!e)return;n.Info("Sending keysym ("+(i?"down":"up")+"): "+e),T.messages.keyEvent(this._sock,e,i?1:0)}}}},{key:"focus",value:function(){this._canvas.focus()}},{key:"blur",value:function(){this._canvas.blur()}},{key:"clipboardPasteFrom",value:function(e){if("connected"===this._rfbConnectionState&&!this._viewOnly)if(this._clipboardServerCapabilitiesFormats[1]&&this._clipboardServerCapabilitiesActions[1<<27])this._clipboardText=e,T.messages.extendedClipboardNotify(this._sock,[1]);else{for(var t=new Uint8Array(e.length),i=0;i> RFB.connect"),n.Info("connecting to "+this._url);try{this._sock.open(this._url,this._wsProtocols)}catch(e){"SyntaxError"===e.name?this._fail("Invalid host or port ("+e+")"):this._fail("Error when opening socket ("+e+")")}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),n.Debug("<< RFB.connect")}},{key:"_disconnect",value:function(){n.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(e){if("NotFoundError"!==e.name)throw e}clearTimeout(this._resizeTimeout),clearTimeout(this._mouseMoveTimer),n.Debug("<< RFB.disconnect")}},{key:"_focusCanvas",value:function(e){this.focusOnClick&&this.focus()}},{key:"_setDesktopName",value:function(e){this._fbName=e,this.dispatchEvent(new CustomEvent("desktopname",{detail:{name:this._fbName}}))}},{key:"_windowResize",value:function(e){var t=this;window.requestAnimationFrame((function(){t._updateClip(),t._updateScale()})),this._resizeSession&&(clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(this._requestRemoteResize.bind(this),500))}},{key:"_updateClip",value:function(){var e=this._display.clipViewport,t=this._clipViewport;if(this._scaleViewport&&(t=!1),e!==t&&(this._display.clipViewport=t),t){var i=this._screenSize();this._display.viewportChangeSize(i.w,i.h),this._fixScrollbars()}}},{key:"_updateScale",value:function(){if(this._scaleViewport){var e=this._screenSize();this._display.autoscale(e.w,e.h)}else this._display.scale=1;this._fixScrollbars()}},{key:"_requestRemoteResize",value:function(){if(clearTimeout(this._resizeTimeout),this._resizeTimeout=null,this._resizeSession&&!this._viewOnly&&this._supportsSetDesktopSize){var e=this._screenSize();T.messages.setDesktopSize(this._sock,Math.floor(e.w),Math.floor(e.h),this._screenID,this._screenFlags),n.Debug("Requested new desktop size: "+e.w+"x"+e.h)}}},{key:"_screenSize",value:function(){var e=this._screen.getBoundingClientRect();return{w:e.width,h:e.height}}},{key:"_fixScrollbars",value:function(){var e=this._screen.style.overflow;this._screen.style.overflow="hidden",this._screen.getBoundingClientRect(),this._screen.style.overflow=e}},{key:"_updateConnectionState",value:function(e){var t=this,i=this._rfbConnectionState;if(e!==i)if("disconnected"!==i){switch(e){case"connected":if("connecting"!==i)return void n.Error("Bad transition to connected state, previous connection state: "+i);break;case"disconnected":if("disconnecting"!==i)return void n.Error("Bad transition to disconnected state, previous connection state: "+i);break;case"connecting":if(""!==i)return void n.Error("Bad transition to connecting state, previous connection state: "+i);break;case"disconnecting":if("connected"!==i&&"connecting"!==i)return void n.Error("Bad transition to disconnecting state, previous connection state: "+i);break;default:return void n.Error("Unknown connection state: "+e)}switch(this._rfbConnectionState=e,n.Debug("New state '"+e+"', was '"+i+"'."),this._disconnTimer&&"disconnecting"!==e&&(n.Debug("Clearing disconnect timer"),clearTimeout(this._disconnTimer),this._disconnTimer=null,this._sock.off("close")),e){case"connecting":this._connect();break;case"connected":this.dispatchEvent(new CustomEvent("connect",{detail:{}}));break;case"disconnecting":this._disconnect(),this._disconnTimer=setTimeout((function(){n.Error("Disconnection timed out."),t._updateConnectionState("disconnected")}),3e3);break;case"disconnected":this.dispatchEvent(new CustomEvent("disconnect",{detail:{clean:this._rfbCleanDisconnect}}))}}else n.Error("Tried changing state of a disconnected RFB object");else n.Debug("Already in state '"+e+"', ignoring")}},{key:"_fail",value:function(e){switch(this._rfbConnectionState){case"disconnecting":n.Error("Failed when disconnecting: "+e);break;case"connected":n.Error("Failed while connected: "+e);break;case"connecting":n.Error("Failed when connecting: "+e);break;default:n.Error("RFB failure: "+e)}return this._rfbCleanDisconnect=!1,this._updateConnectionState("disconnecting"),this._updateConnectionState("disconnected"),!1}},{key:"_setCapability",value:function(e,t){this._capabilities[e]=t,this.dispatchEvent(new CustomEvent("capabilities",{detail:{capabilities:this._capabilities}}))}},{key:"_handleMessage",value:function(){if(0!==this._sock.rQlen)switch(this._rfbConnectionState){case"disconnected":n.Error("Got data while disconnected");break;case"connected":for(;!this._flushing&&this._normalMsg()&&0!==this._sock.rQlen;);break;default:this._initMsg()}else n.Warn("handleMessage called on an empty receive queue")}},{key:"_handleKeyEvent",value:function(e,t,i){this.sendKey(e,t,i)}},{key:"_handleMouse",value:function(e){if(("click"!==e.type||e.target===this._canvas)&&(e.stopPropagation(),e.preventDefault(),"click"!==e.type&&"contextmenu"!==e.type)){var t=(0,a.clientToElement)(e.clientX,e.clientY,this._canvas);switch(e.type){case"mousedown":(0,l.setCapture)(this._canvas),this._handleMouseButton(t.x,t.y,!0,1<o.dragThreshold||Math.abs(n)>o.dragThreshold)&&(this._viewportHasMoved=!0,this._viewportDragPos={x:e,y:t},this._display.viewportChangePos(r,n))}else if(this._mousePos={x:e,y:t},null==this._mouseMoveTimer){var s=Date.now()-this._mouseLastMoveTime;s>17?(this._sendMouse(e,t,this._mouseButtonMask),this._mouseLastMoveTime=Date.now()):this._mouseMoveTimer=setTimeout((function(){i._handleDelayedMouseMove()}),17-s)}}},{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(e,t,i){"connected"===this._rfbConnectionState&&(this._viewOnly||T.messages.pointerEvent(this._sock,this._display.absX(e),this._display.absY(t),i))}},{key:"_handleWheel",value:function(e){if("connected"===this._rfbConnectionState&&!this._viewOnly){e.stopPropagation(),e.preventDefault();var t=(0,a.clientToElement)(e.clientX,e.clientY,this._canvas),i=e.deltaX,r=e.deltaY;0!==e.deltaMode&&(i*=19,r*=19),this._accumulatedWheelDeltaX+=i,this._accumulatedWheelDeltaY+=r,Math.abs(this._accumulatedWheelDeltaX)>=50&&(this._accumulatedWheelDeltaX<0?(this._handleMouseButton(t.x,t.y,!0,32),this._handleMouseButton(t.x,t.y,!1,32)):this._accumulatedWheelDeltaX>0&&(this._handleMouseButton(t.x,t.y,!0,64),this._handleMouseButton(t.x,t.y,!1,64)),this._accumulatedWheelDeltaX=0),Math.abs(this._accumulatedWheelDeltaY)>=50&&(this._accumulatedWheelDeltaY<0?(this._handleMouseButton(t.x,t.y,!0,8),this._handleMouseButton(t.x,t.y,!1,8)):this._accumulatedWheelDeltaY>0&&(this._handleMouseButton(t.x,t.y,!0,16),this._handleMouseButton(t.x,t.y,!1,16)),this._accumulatedWheelDeltaY=0)}}},{key:"_fakeMouseMove",value:function(e,t,i){this._handleMouseMove(t,i),this._cursor.move(e.detail.clientX,e.detail.clientY)}},{key:"_handleTapEvent",value:function(e,t){var i=(0,a.clientToElement)(e.detail.clientX,e.detail.clientY,this._canvas);if(null!==this._gestureLastTapTime&&Date.now()-this._gestureLastTapTime<1e3&&this._gestureFirstDoubleTapEv.detail.type===e.detail.type){var r=this._gestureFirstDoubleTapEv.detail.clientX-e.detail.clientX,n=this._gestureFirstDoubleTapEv.detail.clientY-e.detail.clientY;Math.hypot(r,n)<50?i=(0,a.clientToElement)(this._gestureFirstDoubleTapEv.detail.clientX,this._gestureFirstDoubleTapEv.detail.clientY,this._canvas):this._gestureFirstDoubleTapEv=e}else this._gestureFirstDoubleTapEv=e;this._gestureLastTapTime=Date.now(),this._fakeMouseMove(this._gestureFirstDoubleTapEv,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,t),this._handleMouseButton(i.x,i.y,!1,t)}},{key:"_handleGesture",value:function(e){var t,i=(0,a.clientToElement)(e.detail.clientX,e.detail.clientY,this._canvas);switch(e.type){case"gesturestart":switch(e.detail.type){case"onetap":this._handleTapEvent(e,1);break;case"twotap":this._handleTapEvent(e,4);break;case"threetap":this._handleTapEvent(e,2);break;case"drag":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,1);break;case"longpress":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!0,4);break;case"twodrag":this._gestureLastMagnitudeX=e.detail.magnitudeX,this._gestureLastMagnitudeY=e.detail.magnitudeY,this._fakeMouseMove(e,i.x,i.y);break;case"pinch":this._gestureLastMagnitudeX=Math.hypot(e.detail.magnitudeX,e.detail.magnitudeY),this._fakeMouseMove(e,i.x,i.y)}break;case"gesturemove":switch(e.detail.type){case"onetap":case"twotap":case"threetap":break;case"drag":case"longpress":this._fakeMouseMove(e,i.x,i.y);break;case"twodrag":for(this._fakeMouseMove(e,i.x,i.y);e.detail.magnitudeY-this._gestureLastMagnitudeY>50;)this._handleMouseButton(i.x,i.y,!0,8),this._handleMouseButton(i.x,i.y,!1,8),this._gestureLastMagnitudeY+=50;for(;e.detail.magnitudeY-this._gestureLastMagnitudeY<-50;)this._handleMouseButton(i.x,i.y,!0,16),this._handleMouseButton(i.x,i.y,!1,16),this._gestureLastMagnitudeY-=50;for(;e.detail.magnitudeX-this._gestureLastMagnitudeX>50;)this._handleMouseButton(i.x,i.y,!0,32),this._handleMouseButton(i.x,i.y,!1,32),this._gestureLastMagnitudeX+=50;for(;e.detail.magnitudeX-this._gestureLastMagnitudeX<-50;)this._handleMouseButton(i.x,i.y,!0,64),this._handleMouseButton(i.x,i.y,!1,64),this._gestureLastMagnitudeX-=50;break;case"pinch":if(this._fakeMouseMove(e,i.x,i.y),t=Math.hypot(e.detail.magnitudeX,e.detail.magnitudeY),Math.abs(t-this._gestureLastMagnitudeX)>75){for(this._handleKeyEvent(y.default.XK_Control_L,"ControlLeft",!0);t-this._gestureLastMagnitudeX>75;)this._handleMouseButton(i.x,i.y,!0,8),this._handleMouseButton(i.x,i.y,!1,8),this._gestureLastMagnitudeX+=75;for(;t-this._gestureLastMagnitudeX<-75;)this._handleMouseButton(i.x,i.y,!0,16),this._handleMouseButton(i.x,i.y,!1,16),this._gestureLastMagnitudeX-=75}this._handleKeyEvent(y.default.XK_Control_L,"ControlLeft",!1)}break;case"gestureend":switch(e.detail.type){case"onetap":case"twotap":case"threetap":case"pinch":case"twodrag":break;case"drag":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!1,1);break;case"longpress":this._fakeMouseMove(e,i.x,i.y),this._handleMouseButton(i.x,i.y,!1,4)}}}},{key:"_negotiateProtocolVersion",value:function(){if(this._sock.rQwait("version",12))return!1;var e=this._sock.rQshiftStr(12).substr(4,7);n.Info("Server ProtocolVersion: "+e);var t=0;switch(e){case"000.000":t=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 "+e)}if(t){for(var i="ID:"+this._repeaterID;i.length<250;)i+="\0";return this._sock.sendString(i),!0}this._rfbVersion>this._rfbMaxVersion&&(this._rfbVersion=this._rfbMaxVersion);var r="00"+parseInt(this._rfbVersion,10)+".00"+10*this._rfbVersion%10;this._sock.sendString("RFB "+r+"\n"),n.Debug("Sent ProtocolVersion: "+r),this._rfbInitState="Security"}},{key:"_negotiateSecurity",value:function(){function e(e,t){for(var i=0;i=3.7){var t=this._sock.rQshift8();if(this._sock.rQwait("security type",t,1))return!1;if(0===t)return this._rfbInitState="SecurityReason",this._securityContext="no security types",this._securityStatus=1,this._initMsg();var i=this._sock.rQshiftBytes(t);if(n.Debug("Server security types: "+i),e(1,i))this._rfbAuthScheme=1;else if(e(22,i))this._rfbAuthScheme=22;else if(e(16,i))this._rfbAuthScheme=16;else if(e(2,i))this._rfbAuthScheme=2;else{if(!e(19,i))return this._fail("Unsupported security types (types: "+i+")");this._rfbAuthScheme=19}this._sock.send([this._rfbAuthScheme])}else{if(this._sock.rQwait("security scheme",4))return!1;if(this._rfbAuthScheme=this._sock.rQshift32(),0==this._rfbAuthScheme)return this._rfbInitState="SecurityReason",this._securityContext="authentication scheme",this._securityStatus=1,this._initMsg()}return this._rfbInitState="Authentication",n.Debug("Authenticating using scheme: "+this._rfbAuthScheme),this._initMsg()}},{key:"_handleSecurityReason",value:function(){if(this._sock.rQwait("reason length",4))return!1;var e=this._sock.rQshift32(),t="";if(e>0){if(this._sock.rQwait("reason",e,4))return!1;t=this._sock.rQshiftStr(e)}return""!==t?(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus,reason:t}})),this._fail("Security negotiation failed on "+this._securityContext+" (reason: "+t+")")):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:this._securityStatus}})),this._fail("Security negotiation failed on "+this._securityContext))}},{key:"_negotiateXvpAuth",value:function(){if(void 0===this._rfbCredentials.username||void 0===this._rfbCredentials.password||void 0===this._rfbCredentials.target)return this.dispatchEvent(new CustomEvent("credentialsrequired",{detail:{types:["username","password","target"]}})),!1;var e=String.fromCharCode(this._rfbCredentials.username.length)+String.fromCharCode(this._rfbCredentials.target.length)+this._rfbCredentials.username+this._rfbCredentials.target;return this._sock.sendString(e),this._rfbAuthScheme=2,this._negotiateAuthentication()}},{key:"_negotiateVeNCryptAuth",value:function(){if(0==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt version",2))return!1;var e=this._sock.rQshift8(),t=this._sock.rQshift8();if(0!=e||2!=t)return this._fail("Unsupported VeNCrypt version "+e+"."+t);this._sock.send([0,2]),this._rfbVeNCryptState=1}if(1==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt ack",1))return!1;var i=this._sock.rQshift8();if(0!=i)return this._fail("VeNCrypt failure "+i);this._rfbVeNCryptState=2}if(2==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes length",1))return!1;var r=this._sock.rQshift8();if(r<1)return this._fail("VeNCrypt subtypes empty");this._rfbVeNCryptSubtypesLength=r,this._rfbVeNCryptState=3}if(3==this._rfbVeNCryptState){if(this._sock.rQwait("vencrypt subtypes",4*this._rfbVeNCryptSubtypesLength))return!1;for(var n=[],o=0;o0&&this._sock.rQwait("tunnel capabilities",16*e,4))return!1;if(this._rfbTightVNC=!0,e>0)return this._negotiateTightTunnels(e),!1}if(this._sock.rQwait("sub auth count",4))return!1;var t=this._sock.rQshift32();if(0===t)return this._rfbInitState="SecurityResult",!0;if(this._sock.rQwait("sub auth capabilities",16*t,4))return!1;for(var i={STDVNOAUTH__:1,STDVVNCAUTH_:2,TGHTULGNAUTH:129},r=[],s=0;s=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 e=this._sock.rQshift32();return 0===e?(this._rfbInitState="ClientInitialisation",n.Debug("Authentication OK"),this._initMsg()):this._rfbVersion>=3.8?(this._rfbInitState="SecurityReason",this._securityContext="security result",this._securityStatus=e,this._initMsg()):(this.dispatchEvent(new CustomEvent("securityfailure",{detail:{status:e}})),this._fail("Security handshake failed"))}},{key:"_negotiateServerInit",value:function(){if(this._sock.rQwait("server initialization",24))return!1;var e=this._sock.rQshift16(),t=this._sock.rQshift16(),i=this._sock.rQshift8(),r=this._sock.rQshift8(),o=this._sock.rQshift8(),a=this._sock.rQshift8(),l=this._sock.rQshift16(),c=this._sock.rQshift16(),u=this._sock.rQshift16(),h=this._sock.rQshift8(),d=this._sock.rQshift8(),f=this._sock.rQshift8();this._sock.rQskipBytes(3);var p=this._sock.rQshift32();if(this._sock.rQwait("server init name",p,24))return!1;var g=this._sock.rQshiftStr(p);if(g=(0,s.decodeUTF8)(g,!0),this._rfbTightVNC){if(this._sock.rQwait("TightVNC extended server init header",8,24+p))return!1;var v=this._sock.rQshift16(),m=this._sock.rQshift16(),y=this._sock.rQshift16();this._sock.rQskipBytes(2);var _=16*(v+m+y);if(this._sock.rQwait("TightVNC extended server init header",_,32+p))return!1;this._sock.rQskipBytes(16*v),this._sock.rQskipBytes(16*m),this._sock.rQskipBytes(16*y)}return n.Info("Screen: "+e+"x"+t+", bpp: "+i+", depth: "+r+", bigEndian: "+o+", trueColor: "+a+", redMax: "+l+", greenMax: "+c+", blueMax: "+u+", redShift: "+h+", greenShift: "+d+", blueShift: "+f),this._setDesktopName(g),this._resize(e,t),this._viewOnly||this._keyboard.grab(),this._fbDepth=24,"Intel(r) AMT KVM"===this._fbName&&(n.Warn("Intel AMT KVM only supports 8/16 bit depths. Using low color mode."),this._fbDepth=8),T.messages.pixelFormat(this._sock,this._fbDepth,!0),this._sendEncodings(),T.messages.fbUpdateRequest(this._sock,!1,0,0,this._fbWidth,this._fbHeight),this._updateConnectionState("connected"),!0}},{key:"_sendEncodings",value:function(){var e=[];e.push(b.encodings.encodingCopyRect),24==this._fbDepth&&(e.push(b.encodings.encodingTight),e.push(b.encodings.encodingTightPNG),e.push(b.encodings.encodingHextile),e.push(b.encodings.encodingRRE)),e.push(b.encodings.encodingRaw),e.push(b.encodings.pseudoEncodingQualityLevel0+this._qualityLevel),e.push(b.encodings.pseudoEncodingCompressLevel0+this._compressionLevel),e.push(b.encodings.pseudoEncodingDesktopSize),e.push(b.encodings.pseudoEncodingLastRect),e.push(b.encodings.pseudoEncodingQEMUExtendedKeyEvent),e.push(b.encodings.pseudoEncodingExtendedDesktopSize),e.push(b.encodings.pseudoEncodingXvp),e.push(b.encodings.pseudoEncodingFence),e.push(b.encodings.pseudoEncodingContinuousUpdates),e.push(b.encodings.pseudoEncodingDesktopName),e.push(b.encodings.pseudoEncodingExtendedClipboard),24==this._fbDepth&&(e.push(b.encodings.pseudoEncodingVMwareCursor),e.push(b.encodings.pseudoEncodingCursor)),T.messages.clientEncodings(this._sock,e)}},{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 n.Debug("SetColorMapEntries"),this._fail("Unexpected SetColorMapEntries message")}},{key:"_handleServerCutText",value:function(){if(n.Debug("ServerCutText"),this._sock.rQwait("ServerCutText header",7,1))return!1;this._sock.rQskipBytes(3);var e=this._sock.rQshift32();if(e=(0,r.toSigned32bit)(e),this._sock.rQwait("ServerCutText content",Math.abs(e),8))return!1;if(e>=0){var t=this._sock.rQshiftStr(e);if(this._viewOnly)return!0;this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:t}}))}else{e=Math.abs(e);var i=this._sock.rQshift32(),o=65535&i,a=4278190080&i;if(a&1<<24){this._clipboardServerCapabilitiesFormats={},this._clipboardServerCapabilitiesActions={};for(var l=0;l<=15;l++){var c=1<0&&"\0"===v.charAt(v.length-1)&&(v=v.slice(0,-1)),v=v.replace("\r\n","\n"),this.dispatchEvent(new CustomEvent("clipboard",{detail:{text:v}}))}}}return!0}},{key:"_handleServerFenceMsg",value:function(){if(this._sock.rQwait("ServerFence header",8,1))return!1;this._sock.rQskipBytes(3);var e=this._sock.rQshift32(),t=this._sock.rQshift8();if(this._sock.rQwait("ServerFence payload",t,9))return!1;t>64&&(n.Warn("Bad payload length ("+t+") in fence response"),t=64);var i=this._sock.rQshiftStr(t);return this._supportsFence=!0,e&1<<31?(e&=3,T.messages.clientFence(this._sock,e,i),!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 e=this._sock.rQshift8(),t=this._sock.rQshift8();switch(t){case 0:n.Error("XVP Operation Failed");break;case 1:this._rfbXvpVer=e,n.Info("XVP extensions enabled (version "+this._rfbXvpVer+")"),this._setCapability("power",!0);break;default:this._fail("Illegal server XVP message (msg: "+t+")")}return!0}},{key:"_normalMsg",value:function(){var e,t,i;switch(e=this._FBU.rects>0?0:this._sock.rQshift8()){case 0:return(i=this._framebufferUpdate())&&!this._enabledContinuousUpdates&&T.messages.fbUpdateRequest(this._sock,!0,0,0,this._fbWidth,this._fbHeight),i;case 1:return this._handleSetColourMapMsg();case 2:return n.Debug("Bell"),this.dispatchEvent(new CustomEvent("bell",{detail:{}})),!0;case 3:return this._handleServerCutText();case 150:return t=!this._supportsContinuousUpdates,this._supportsContinuousUpdates=!0,this._enabledContinuousUpdates=!1,t&&(this._enabledContinuousUpdates=!0,this._updateContinuousUpdates(),n.Info("Enabling continuous updates.")),!0;case 248:return this._handleServerFenceMsg();case 250:return this._handleXvpMsg();default:return this._fail("Unexpected server message (type "+e+")"),n.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(0===this._FBU.rects){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(null===this._FBU.encoding){if(this._sock.rQwait("rect header",12))return!1;var e=this._sock.rQshiftBytes(12);this._FBU.x=(e[0]<<8)+e[1],this._FBU.y=(e[2]<<8)+e[3],this._FBU.width=(e[4]<<8)+e[5],this._FBU.height=(e[6]<<8)+e[7],this._FBU.encoding=parseInt((e[8]<<24)+(e[9]<<16)+(e[10]<<8)+e[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 b.encodings.pseudoEncodingLastRect:return this._FBU.rects=1,!0;case b.encodings.pseudoEncodingVMwareCursor:return this._handleVMwareCursor();case b.encodings.pseudoEncodingCursor:return this._handleCursor();case b.encodings.pseudoEncodingQEMUExtendedKeyEvent:try{void 0!==document.createEvent("keyboardEvent").code&&(this._qemuExtKeyEventSupported=!0)}catch(e){}return!0;case b.encodings.pseudoEncodingDesktopName:return this._handleDesktopName();case b.encodings.pseudoEncodingDesktopSize:return this._resize(this._FBU.width,this._FBU.height),!0;case b.encodings.pseudoEncodingExtendedDesktopSize:return this._handleExtendedDesktopSize();default:return this._handleDataRect()}}},{key:"_handleVMwareCursor",value:function(){var e=this._FBU.x,t=this._FBU.y,i=this._FBU.width,r=this._FBU.height;if(this._sock.rQwait("VMware cursor encoding",1))return!1;var s,o=this._sock.rQshift8();if(this._sock.rQshift8(),0==o){if(s=new Array(i*r*4),this._sock.rQwait("VMware cursor classic encoding",i*r*4*2,2))return!1;for(var a=new Array(i*r),l=0;l>8&255,p=d>>16&255,g=d>>24&255;s[4*h]=f,s[4*h+1]=p,s[4*h+2]=g,s[4*h+3]=255}else-256==(-256&a[h])?0==c[h]?(s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=0):(c[h],s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=255):(s[4*h]=0,s[4*h+1]=0,s[4*h+2]=0,s[4*h+3]=255)}else{if(1!=o)return n.Warn("The given cursor type is not supported: "+o+" given."),!1;if(this._sock.rQwait("VMware cursor alpha encoding",i*r*4,2))return!1;s=new Array(i*r*4);for(var v=0;v>24&255,s[4*v+1]=m>>16&255,s[4*v+2]=m>>8&255,s[4*v+3]=255&m}}return this._updateCursor(s,e,t,i,r),!0}},{key:"_handleCursor",value:function(){var e=this._FBU.x,t=this._FBU.y,i=this._FBU.width,r=this._FBU.height,n=i*r*4,s=Math.ceil(i/8)*r,o=n+s;if(this._sock.rQwait("cursor encoding",o))return!1;for(var a=this._sock.rQshiftBytes(n),l=this._sock.rQshiftBytes(s),c=new Uint8Array(i*r*4),u=0,h=0;h9?n.Error("qualityLevel must be an integer between 0 and 9"):this._qualityLevel!==e&&(this._qualityLevel=e,"connected"===this._rfbConnectionState&&this._sendEncodings())}},{key:"compressionLevel",get:function(){return this._compressionLevel},set:function(e){!Number.isInteger(e)||e<0||e>9?n.Error("compressionLevel must be an integer between 0 and 9"):this._compressionLevel!==e&&(this._compressionLevel=e,"connected"===this._rfbConnectionState&&this._sendEncodings())}}])&&R(t.prototype,i),c&&R(t,c),T}(c.default);t.default=F,F.messages={keyEvent:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=4,r[n+1]=i,r[n+2]=0,r[n+3]=0,r[n+4]=t>>24,r[n+5]=t>>16,r[n+6]=t>>8,r[n+7]=t,e._sQlen+=8,e.flush()},QEMUExtendedKeyEvent:function(e,t,i,r){var n=e._sQ,s=e._sQlen;n[s]=255,n[s+1]=0,n[s+2]=i>>8,n[s+3]=i,n[s+4]=t>>24,n[s+5]=t>>16,n[s+6]=t>>8,n[s+7]=t;var o,a,l=(o=r,a=255&r,224==r>>8&&a<127?128|a:o);n[s+8]=l>>24,n[s+9]=l>>16,n[s+10]=l>>8,n[s+11]=l,e._sQlen+=12,e.flush()},pointerEvent:function(e,t,i,r){var n=e._sQ,s=e._sQlen;n[s]=5,n[s+1]=r,n[s+2]=t>>8,n[s+3]=t,n[s+4]=i>>8,n[s+5]=i,e._sQlen+=6,e.flush()},_buildExtendedClipboardFlags:function(e,t){for(var i=new Uint8Array(4),r=0,n=0,s=0;s>24,i[1]=0,i[2]=0,i[3]=r,i},extendedClipboardProvide:function(e,t,i){for(var r=new d.default,n=[],o=0;o>24&255,a.length>>16&255,a.length>>8&255,255&a.length);for(var l=0;l>24,n[s+1]=i[r[o]]>>16,n[s+2]=i[r[o]]>>8,n[s+3]=i[r[o]]>>0,s+=4,n[3]|=1<2&&void 0!==arguments[2]&&arguments[2],s=e._sQ,o=e._sQlen;s[o]=6,s[o+1]=0,s[o+2]=0,s[o+3]=0,i=n?(0,r.toUnsigned32bit)(-t.length):t.length,s[o+4]=i>>24,s[o+5]=i>>16,s[o+6]=i>>8,s[o+7]=i,e._sQlen+=8;for(var a=0,l=t.length;l>0;){for(var c=Math.min(l,e._sQbufferSize-e._sQlen),u=0;u>8,s[o+3]=t,s[o+4]=i>>8,s[o+5]=i,s[o+6]=1,s[o+7]=0,s[o+8]=r>>24,s[o+9]=r>>16,s[o+10]=r>>8,s[o+11]=r,s[o+12]=0,s[o+13]=0,s[o+14]=0,s[o+15]=0,s[o+16]=t>>8,s[o+17]=t,s[o+18]=i>>8,s[o+19]=i,s[o+20]=n>>24,s[o+21]=n>>16,s[o+22]=n>>8,s[o+23]=n,e._sQlen+=24,e.flush()},clientFence:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=248,r[n+1]=0,r[n+2]=0,r[n+3]=0,r[n+4]=t>>24,r[n+5]=t>>16,r[n+6]=t>>8,r[n+7]=t;var s=i.length;r[n+8]=s;for(var o=0;o>8,o[a+3]=i,o[a+4]=r>>8,o[a+5]=r,o[a+6]=n>>8,o[a+7]=n,o[a+8]=s>>8,o[a+9]=s,e._sQlen+=10,e.flush()},pixelFormat:function(e,t,i){var r,n=e._sQ,s=e._sQlen;r=t>16?32:t>8?16:8;var o=Math.floor(t/3);n[s]=0,n[s+1]=0,n[s+2]=0,n[s+3]=0,n[s+4]=r,n[s+5]=t,n[s+6]=0,n[s+7]=i?1:0,n[s+8]=0,n[s+9]=(1<>8,i[r+3]=t.length;for(var n=r+4,s=0;s>24,i[n+1]=o>>16,i[n+2]=o>>8,i[n+3]=o,n+=4}e._sQlen+=n-r,e.flush()},fbUpdateRequest:function(e,t,i,r,n,s){var o=e._sQ,a=e._sQlen;void 0===i&&(i=0),void 0===r&&(r=0),o[a]=3,o[a+1]=t?1:0,o[a+2]=i>>8&255,o[a+3]=255&i,o[a+4]=r>>8&255,o[a+5]=255&r,o[a+6]=n>>8&255,o[a+7]=255&n,o[a+8]=s>>8&255,o[a+9]=255&s,e._sQlen+=10,e.flush()},xvpOp:function(e,t,i){var r=e._sQ,n=e._sQlen;r[n]=250,r[n+1]=0,r[n+2]=t,r[n+3]=i,e._sQlen+=4,e.flush()}},F.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":
/*!*************************************************!*\
!*** ./node_modules/codemirror/mode/xml/xml.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";var t={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},i={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};e.defineMode("xml",(function(r,n){var s,o,a=r.indentUnit,l={},c=n.htmlMode?t:i;for(var u in c)l[u]=c[u];for(var u in n)l[u]=n[u];function h(e,t){function i(i){return t.tokenize=i,i(e,t)}var r=e.next();return"<"==r?e.eat("!")?e.eat("[")?e.match("CDATA[")?i(f("atom","]]>")):null:e.match("--")?i(f("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),i(function e(t){return function(i,r){for(var n;null!=(n=i.next());){if("<"==n)return r.tokenize=e(t+1),r.tokenize(i,r);if(">"==n){if(1==t){r.tokenize=h;break}return r.tokenize=e(t-1),r.tokenize(i,r)}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=f("meta","?>"),"meta"):(s=e.eat("/")?"closeTag":"openTag",t.tokenize=d,"tag bracket"):"&"==r?(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error":(e.eatWhile(/[^&<]/),null)}function d(e,t){var i,r,n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=h,s=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return s="equals",null;if("<"==n){t.tokenize=h,t.state=m,t.tagName=t.tagStart=null;var o=t.tokenize(e,t);return o?o+" tag error":"tag error"}return/[\'\"]/.test(n)?(t.tokenize=(i=n,(r=function(e,t){for(;!e.eol();)if(e.next()==i){t.tokenize=d;break}return"string"}).isInAttribute=!0,r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function f(e,t){return function(i,r){for(;!i.eol();){if(i.match(t)){r.tokenize=h;break}i.next()}return e}}function p(e,t,i){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=i,(l.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function g(e){e.context&&(e.context=e.context.prev)}function v(e,t){for(var i;;){if(!e.context)return;if(i=e.context.tagName,!l.contextGrabbers.hasOwnProperty(i)||!l.contextGrabbers[i].hasOwnProperty(t))return;g(e)}}function m(e,t,i){return"openTag"==e?(i.tagStart=t.column(),y):"closeTag"==e?_:m}function y(e,t,i){return"word"==e?(i.tagName=t.current(),o="tag",C):l.allowMissingTagName&&"endTag"==e?(o="tag bracket",C(e,0,i)):(o="error",y)}function _(e,t,i){if("word"==e){var r=t.current();return i.context&&i.context.tagName!=r&&l.implicitlyClosed.hasOwnProperty(i.context.tagName)&&g(i),i.context&&i.context.tagName==r||!1===l.matchClosing?(o="tag",b):(o="tag error",S)}return l.allowMissingTagName&&"endTag"==e?(o="tag bracket",b(e,0,i)):(o="error",S)}function b(e,t,i){return"endTag"!=e?(o="error",b):(g(i),m)}function S(e,t,i){return o="error",b(e,0,i)}function C(e,t,i){if("word"==e)return o="attribute",w;if("endTag"==e||"selfcloseTag"==e){var r=i.tagName,n=i.tagStart;return i.tagName=i.tagStart=null,"selfcloseTag"==e||l.autoSelfClosers.hasOwnProperty(r)?v(i,r):(v(i,r),i.context=new p(i,r,n==i.indented)),m}return o="error",C}function w(e,t,i){return"equals"==e?k:(l.allowMissing||(o="error"),C(e,0,i))}function k(e,t,i){return"string"==e?x:"word"==e&&l.allowUnquoted?(o="string",C):(o="error",C(e,0,i))}function x(e,t,i){return"string"==e?x:C(e,0,i)}return h.isInText=!0,{startState:function(e){var t={tokenize:h,state:m,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;s=null;var i=t.tokenize(e,t);return(i||s)&&"comment"!=i&&(o=null,t.state=t.state(s||i,e,t),o&&(i="error"==o?i+" error":o)),i},indent:function(t,i,r){var n=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+a;if(n&&n.noIndent)return e.Pass;if(t.tokenize!=d&&t.tokenize!=h)return r?r.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==l.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+a*(l.multilineTagIndentFactor||1);if(l.alignCDATA&&/$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:l.htmlMode?"html":"xml",helperType:l.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=C)},xmlCurrentTag:function(e){return e.tagName?{name:e.tagName,close:"closeTag"==e.type}:null},xmlCurrentContext:function(e){for(var t=[],i=e.context;i;i=i.prev)i.tagName&&t.push(i.tagName);return t.reverse()}}})),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}(i(/*! ../../lib/codemirror */"VrN/"))},"1q3G":
/*!***********************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/zstream.js ***!
\***********************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){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":
/*!*******************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/decoders/raw.js ***!
\*******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i>0&3)/3,f[4*p+1]=255*(u[h+p]>>2&3)/3,f[4*p+2]=255*(u[h+p]>>4&3)/3,f[4*p+4]=0;u=f,h=0}return s.blitImage(e,l,i,c,u,h),n.rQskipBytes(c*a),this._lines-=c,!(this._lines>0)}}])&&r(t.prototype,i),n&&r(t,n),e}();t.default=n},3690:
/*!***********************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/decoders/hextile.js ***!
\***********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e,t){for(var i=0;i0;){var l=1;if(s.rQwait("HEXTILE",l))return!1;var c=s.rQ,u=s.rQi,h=c[u];if(h>30)throw new Error("Illegal hextile subencoding (subencoding: "+h+")");var d=this._totalTiles-this._tiles,f=e+d%this._tilesX*16,p=t+16*Math.floor(d/this._tilesX),g=Math.min(16,e+i-f),v=Math.min(16,t+r-p);if(1&h)l+=g*v*4;else if(2&h&&(l+=4),4&h&&(l+=4),8&h){if(l++,s.rQwait("HEXTILE",l))return!1;var m=c[u+l-1];l+=16&h?6*m:2*m}if(s.rQwait("HEXTILE",l))return!1;if(u++,0===h)1&this._lastsubencoding?n.Debug(" Ignoring blank after RAW"):o.fillRect(f,p,g,v,this._background);else if(1&h)o.blitImage(f,p,g,v,c,u),u+=l-1;else{if(2&h&&(this._background=[c[u],c[u+1],c[u+2],c[u+3]],u+=4),4&h&&(this._foreground=[c[u],c[u+1],c[u+2],c[u+3]],u+=4),o.startTile(f,p,g,v,this._background),8&h){var y=c[u];u++;for(var _=0;_>4,w=15&S,k=c[++u];u++;var x=1+(k>>4),E=1+(15&k);o.subTile(C,w,x,E,b)}}o.finishTile()}s.rQi=u,this._lastsubencoding=h,this._tiles--}return!0}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},"6BzB":
/*!***********************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/utils/common.js ***!
\***********************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shrinkBuf=function(e,t){if(e.length===t)return e;if(e.subarray)return e.subarray(0,t);return e.length=t,e},t.arraySet=function(e,t,i,r,n){if(t.subarray&&e.subarray)return void e.set(t.subarray(i,i+r),n);for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:0,i=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!a(i))throw TypeError("Stringified UUID is invalid");return i};t.a=function(e,t,i){var r=(e=e||{}).random||(e.rng||s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return u(r)}},"7ahc":
/*!*************************************************************!*\
!*** ./src/components/markdown-editor/code-block/index.tsx ***!
\*************************************************************/
/*! exports provided: default, MyCodeMirror */
/*! exports used: MyCodeMirror, default */function(e,t,i){"use strict";i.d(t,"a",(function(){return v}));var r=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),n=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),s=(i(/*! antd/es/button/style */"+L6B"),i(/*! antd/es/button */"2/Rp")),o=(i(/*! antd/es/form/style */"y8nQ"),i(/*! antd/es/form */"Vl3Y")),a=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),l=(i(/*! antd/es/select/style */"OaEy"),i(/*! antd/es/select */"2fM7")),c=i(/*! react */"q1tI"),u=i.n(c),h=i(/*! codemirror */"VrN/"),d=i.n(h),f=(i(/*! codemirror/lib/codemirror.css */"p77/"),i(/*! codemirror/theme/blackboard.css */"c5Ni"),l.a.Option),p={labelCol:{span:4},wrapperCol:{span:20}},g={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"]};function v(e){var t=e.value,i=e.onChange,n=e.mode,s=e.options,o=void 0===s?{}:s,l=Object(c.useRef)(),h=Object(c.useState)(),f=Object(a.a)(h,2),p=f[0],g=f[1];return Object(c.useEffect)((function(){if(p){function e(e){var t=e.getValue();i&&i(t)}return p.on("change",e),function(){p.off("change",e)}}}),[p,i]),Object(c.useEffect)((function(){p&&p.setOption("mode",n)}),[p,n]),Object(c.useEffect)((function(){p&&(t===p.getValue()&&""!==t||setTimeout((function(){p.setValue(t||" ")}),300))}),[p,t]),Object(c.useEffect)((function(){if(l.current&&!p){var e=d.a.fromTextArea(l.current,Object(r.a)({mode:n,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},o));g(e)}}),[l.current,p]),u.a.createElement("div",{className:"my-codemirror-container"},u.a.createElement("textarea",{ref:l}))}t.b=function(e){var t=e.callback,i=e.onCancel,r=Object(c.useState)("python"),h=Object(a.a)(r,2),d=h[0],m=h[1];return u.a.createElement(o.a,Object(n.a)({},p,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)}}),u.a.createElement(o.a.Item,{label:"代码语言",name:"language"},u.a.createElement(l.a,{onChange:function(e){m(g[e][1])}},Object.keys(g).map((function(e){return u.a.createElement(f,{key:e,value:e},g[e][0])})))),u.a.createElement(o.a.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}]},u.a.createElement(v,{mode:d})),u.a.createElement("div",{className:"flex-container flex-end"},u.a.createElement(s.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"确定"),u.a.createElement(s.a,{type:"ghost",onClick:i},"取消")))}},"7ixt":
/*!**************************************************!*\
!*** ./node_modules/rc-tooltip/es/placements.js ***!
\**************************************************/
/*! exports provided: placements, default */
/*! exports used: placements */function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var r={adjustX:1,adjustY:1},n=[0,0],s={left:{points:["cr","cl"],overflow:r,offset:[-4,0],targetOffset:n},right:{points:["cl","cr"],overflow:r,offset:[4,0],targetOffset:n},top:{points:["bc","tc"],overflow:r,offset:[0,-4],targetOffset:n},bottom:{points:["tc","bc"],overflow:r,offset:[0,4],targetOffset:n},topLeft:{points:["bl","tl"],overflow:r,offset:[0,-4],targetOffset:n},leftTop:{points:["tr","tl"],overflow:r,offset:[-4,0],targetOffset:n},topRight:{points:["br","tr"],overflow:r,offset:[0,-4],targetOffset:n},rightTop:{points:["tl","tr"],overflow:r,offset:[4,0],targetOffset:n},bottomRight:{points:["tr","br"],overflow:r,offset:[0,4],targetOffset:n},rightBottom:{points:["bl","br"],overflow:r,offset:[4,0],targetOffset:n},bottomLeft:{points:["tl","bl"],overflow:r,offset:[0,4],targetOffset:n},leftBottom:{points:["br","bl"],overflow:r,offset:[-4,0],targetOffset:n}}},"8+yF":
/*!**********************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/input/keysymdef.js ***!
\**********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={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},n={lookup:function(e){if(e>=32&&e<=255)return e;var t=r[e];return void 0!==t?t:16777216|e}};t.default=n},"8CQX":
/*!*****************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/input/util.js ***!
\*****************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.getKeycode=d,t.getKey=f,t.getKeysym=function(e){var t=f(e);if("Unidentified"===t)return null;if(t in l.default){var i=e.location;if("Meta"===t&&0===i&&(i=2),"Clear"===t&&3===i)"NumLock"===d(e)&&(i=0);if((void 0===i||i>3)&&(i=0),"Meta"===t){var r=d(e);if("AltLeft"===r)return n.default.XK_Meta_L;if("AltRight"===r)return n.default.XK_Meta_R}if("Clear"===t)if("NumLock"===d(e))return n.default.XK_Num_Lock;return l.default[t][i]}if(1!==t.length)return null;var o=t.charCodeAt();if(o)return s.default.lookup(o);return null};var n=h(i(/*! ./keysym.js */"mHUz")),s=h(i(/*! ./keysymdef.js */"8+yF")),o=h(i(/*! ./vkeys.js */"6Qwc")),a=h(i(/*! ./fixedkeys.js */"gIYZ")),l=h(i(/*! ./domkeytable.js */"mTgk")),c=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../util/browser.js */"GdRQ"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function h(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e.code){switch(e.code){case"OSLeft":return"MetaLeft";case"OSRight":return"MetaRight"}return e.code}if("keypress"!==e.type&&e.keyCode in o.default){var t=o.default[e.keyCode];if(c.isMac()&&"ContextMenu"===t&&(t="MetaRight"),2===e.location)switch(t){case"ShiftLeft":return"ShiftRight";case"ControlLeft":return"ControlRight";case"AltLeft":return"AltRight"}if(3===e.location)switch(t){case"Delete":return"NumpadDecimal";case"Insert":return"Numpad0";case"End":return"Numpad1";case"ArrowDown":return"Numpad2";case"PageDown":return"Numpad3";case"ArrowLeft":return"Numpad4";case"ArrowRight":return"Numpad6";case"Home":return"Numpad7";case"ArrowUp":return"Numpad8";case"PageUp":return"Numpad9";case"Enter":return"NumpadEnter"}return t}return"Unidentified"}function f(e){if(void 0!==e.key){switch(e.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 e.char}switch(e.key){case"OS":return"Meta";case"LaunchMyComputer":return"LaunchApplication1";case"LaunchCalculator":return"LaunchApplication2"}switch(e.key){case"UIKeyInputUpArrow":return"ArrowUp";case"UIKeyInputDownArrow":return"ArrowDown";case"UIKeyInputLeftArrow":return"ArrowLeft";case"UIKeyInputRightArrow":return"ArrowRight";case"UIKeyInputEscape":return"Escape"}if("\0"===e.key&&"NumpadDecimal"===e.code)return"Delete";if(!c.isIE()&&!c.isEdge())return e.key;if(1!==e.key.length&&"Unidentified"!==e.key)return e.key}var t=d(e);return t in a.default?a.default[t]:e.charCode?String.fromCharCode(e.charCode):"Unidentified"}},"8EBN":
/*!**********************************************!*\
!*** ./node_modules/codemirror/mode/meta.js ***!
\**********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){"use strict";e.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 t=0;t-1&&t.substring(n+1,t.length);if(s)return e.findModeByExtension(s)},e.findModeByName=function(t){t=t.toLowerCase();for(var i=0;i>l&1&&(this._zlibs[l].reset(),s.Info("Reset zlib stream "+l));this._ctl=this._ctl>>4}var c;if(8===this._ctl)c=this._fillRect(e,t,i,r,n,o,a);else if(9===this._ctl)c=this._jpegRect(e,t,i,r,n,o,a);else if(10===this._ctl)c=this._pngRect(e,t,i,r,n,o,a);else{if(0!=(128&this._ctl))throw new Error("Illegal tight compression received (ctl: "+this._ctl+")");c=this._basicRect(this._ctl,e,t,i,r,n,o,a)}return c&&(this._ctl=null),c}},{key:"_fillRect",value:function(e,t,i,r,n,s,o){if(n.rQwait("TIGHT",3))return!1;var a=n.rQi,l=n.rQ;return s.fillRect(e,t,i,r,[l[a+2],l[a+1],l[a]],!1),n.rQskipBytes(3),!0}},{key:"_jpegRect",value:function(e,t,i,r,n,s,o){var a=this._readData(n);return null!==a&&(s.imageRect(e,t,i,r,"image/jpeg",a),!0)}},{key:"_pngRect",value:function(e,t,i,r,n,s,o){throw new Error("PNG received in standard Tight rect")}},{key:"_basicRect",value:function(e,t,i,r,n,s,o,a){if(null===this._filter)if(4&e){if(s.rQwait("TIGHT",1))return!1;this._filter=s.rQshift8()}else this._filter=0;var l,c=3&e;switch(this._filter){case 0:l=this._copyFilter(c,t,i,r,n,s,o,a);break;case 1:l=this._paletteFilter(c,t,i,r,n,s,o,a);break;case 2:l=this._gradientFilter(c,t,i,r,n,s,o,a);break;default:throw new Error("Illegal tight filter received (ctl: "+this._filter+")")}return l&&(this._filter=null),l}},{key:"_copyFilter",value:function(e,t,i,r,n,s,o,a){var l,c=r*n*3;if(c<12){if(s.rQwait("TIGHT",c))return!1;l=s.rQshiftBytes(c)}else{if(null===(l=this._readData(s)))return!1;this._zlibs[e].setInput(l),l=this._zlibs[e].inflate(c),this._zlibs[e].setInput(null)}return o.blitRgbImage(t,i,r,n,l,0,!1),!0}},{key:"_paletteFilter",value:function(e,t,i,r,n,s,o,a){if(0===this._numColors){if(s.rQwait("TIGHT palette",1))return!1;var l=s.rQpeek8()+1,c=3*l;if(s.rQwait("TIGHT palette",1+c))return!1;this._numColors=l,s.rQskipBytes(1),s.rQshiftTo(this._palette,c)}var u,h=this._numColors<=2?1:8,d=Math.floor((r*h+7)/8)*n;if(d<12){if(s.rQwait("TIGHT",d))return!1;u=s.rQshiftBytes(d)}else{if(null===(u=this._readData(s)))return!1;this._zlibs[e].setInput(u),u=this._zlibs[e].inflate(d),this._zlibs[e].setInput(null)}return 2==this._numColors?this._monoRect(t,i,r,n,u,this._palette,o):this._paletteRect(t,i,r,n,u,this._palette,o),this._numColors=0,!0}},{key:"_monoRect",value:function(e,t,i,r,n,s,o){for(var a=this._getScratchBuffer(i*r*4),l=Math.floor((i+7)/8),c=Math.floor(i/8),u=0;u=0;p--)h=4*(u*i+8*f+7-p),d=3*(n[u*l+f]>>p&1),a[h]=s[d],a[h+1]=s[d+1],a[h+2]=s[d+2],a[h+3]=255;for(var g=7;g>=8-i%8;g--)h=4*(u*i+8*f+7-g),d=3*(n[u*l+f]>>g&1),a[h]=s[d],a[h+1]=s[d+1],a[h+2]=s[d+2],a[h+3]=255}o.blitRgbxImage(e,t,i,r,a,0,!1)}},{key:"_paletteRect",value:function(e,t,i,r,n,s,o){for(var a=this._getScratchBuffer(i*r*4),l=i*r*4,c=0,u=0;c"],m=new f.a.Renderer,y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function _(){g.length=0,v=[""]}var b={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function S(){return function e(t,i,r,n){if(i>=t.length||t[i].level<=r)return i;var s=t[i];n.push("- "+s.text+"");var o=[];return i=e(t,++i,s.level,o),o.length>0&&(n.push("
"),o.forEach((function(e){n.push(e)})),n.push("
")),n.push(" "),i=e(t,i,r,n)}(g,0,0,v),v.push("
"),v.join("")}var C={heading:function(e){var t=y.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},fences:function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],r=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var r=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:Object(a.a)(t,1)[0].length>=r.length?e.slice(r.length):e})).join("\n")}(i,t[3]||""),n=t[2]?t[2].trim():t[2];if(["latex","katex","math"].indexOf(n)>=0){var s=x(),o=r;r=s,E[s]={type:"block",expression:o}}return{type:"code",raw:i,lang:n,text:r}}}},w=/(?:\${2})([^\n`]+?)(?:\${2})/gi,k=0,x=function(){return"__special_katext_id_".concat(k++,"__")},E={};function T(){k=0,E={}}function L(e){return e=e.replace(w,(function(e,t){var i=x();return E[i]={type:"inline",expression:t},i}))}var A=m.listitem;m.listitem=function(e){return A(L(e))};var R=m.paragraph;m.paragraph=function(e){return R(L(e))};var D=m.tablecell;m.tablecell=function(e,t){return D(L(e),t)},m.code=function(e,t,i){var r=(t||"").match(/\S*/)[0];return r?["latex","katex","math"].indexOf(r)>=0?"".concat(e,"
"):'').concat(i?e:Object(p.escape)(e,!0),"
\n"):''+(i?e:Object(p.escape)(e,!0))+"
"},m.heading=function(e,t,i){var r=this.options.headerPrefix+i.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return g.push({anchor:r,level:t,text:e}),"'+e+""},f.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),f.a.use({tokenizer:C,renderer:m});var O=f.a,M=(i("SJMd"),i("ulZh")),I=i.n(M),P=i("m3rI"),F=i("Oy/b"),B=i("p5ED"),N=i("ErOA"),H=function(e,t){return(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};function j(e,t){function i(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function U(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function K(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]',"select"),this.addActionButton(i,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(i,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(i,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(i,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(i,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(i,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(i,'',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach((function(e){var i=document.createElement("div");i.className=""+t.toolbarButtonStyleClass.name,i.setAttribute("data-type-name",e.typeName),i.innerHTML=e.icon,i.addEventListener("click",(function(){t.markerToolbarButtonClicked(i,e)})),t.buttons.push(i),t.markerButtons.push(i)})),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var r=document.createElement("div");r.className=this.toolbarBlockStyleClass.name,r.style.whiteSpace="nowrap",r.style.display=!1!==this.uiStyleSettings.resultButtonBlockVisible?"":"none",this.uiContainer.appendChild(r),this.addActionButton(r,'',"render"),this.addActionButton(r,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},e.prototype.addButtonClickListener=function(e){this.buttonClickListeners.push(e)},e.prototype.removeButtonClickListener=function(e){this.buttonClickListeners.indexOf(e)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(e),1)},e.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},e.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var e=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var t=0;t0&&this.buttonClickListeners.forEach((function(e){return e("marker",t)})),this.markerButtonOverflowBlock.style.display="none"},e.prototype.actionToolbarButtonClicked=function(e,t){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach((function(e){return e("action",t)})),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},e.prototype.setActiveButton=function(e){this.resetButtonStyles(),e.className=e.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),e.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},e.prototype.setActiveMarkerButton=function(e){var t=this.markerButtons.find((function(t){return t.getAttribute("data-type-name")===e}));t&&this.setActiveButton(t)},e.prototype.setCurrentMarker=function(e){var t=this;this.currentMarker=e,this.buttons.filter((function(e){return/delete|notes/.test(e.getAttribute("data-action"))})).forEach((function(e){void 0===t.currentMarker?(e.style.fillOpacity="0.4",e.style.pointerEvents="none"):(e.style.fillOpacity="1",e.style.pointerEvents="all")}))},e}(),$=function(){function e(e,t,i,r){this.panels=[],this.panelButtons=[],this.markerjsContainer=e,this.displayMode=t,this.uiStyleSettings=i,this.styles=r,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return e.prototype.addStyles=function(){var e;this.toolboxStyleClass=this.styles.addClass(new Y("toolbox","\n width: 100%;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n font-family: sans-serif;\n "+("popup"===this.displayMode?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+"\n box-sizing: content-box;\n "+("popup"===this.displayMode?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+"\n "+("inline"===this.displayMode?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n "+("inline"===this.displayMode?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+"\n overflow: hidden;\n ")),this.toolboxStyleColorsClass=this.styles.addClass(new Y("toolbox_colors","\n color: "+this.uiStyleSettings.toolboxColor+";\n "));var t=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Y("toolbox-button-row","\n display: flex;\n cursor: default;\n box-sizing: content-box;\n ")),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Y("toolbox-button-row_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundColor+";\n ")),this.toolboxPanelRowStyleClass=this.styles.addClass(new Y("toolbox-panel-row","\n display: flex;\n "+("inline"===this.displayMode?"position: absolute;":"")+"\n "+("inline"===this.displayMode?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+"\n cursor: default;\n height: "+1.5*this.uiStyleSettings.toolbarHeight+"px;\n "+("inline"===this.displayMode?"width: 100%;":"")+"\n box-sizing: content-box;\n ")),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new Y("toolbox-panel-row_colors","\n background-color: "+(null!==(e=this.uiStyleSettings.toolboxBackgroundColor)&&void 0!==e?e:this.uiStyleSettings.toolbarBackgroundHoverColor)+";\n ")),this.toolboxButtonStyleClass=this.styles.addClass(new Y("toolbox_button","\n display: inline-block;\n width: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n height: "+(this.uiStyleSettings.toolbarHeight-2*t)+"px;\n padding: "+t+"px;\n box-sizing: content-box;\n ")),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Y("toolbox-button_colors","\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Y("toolbox-active-button_colors","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+";\n fill: "+this.uiStyleSettings.toolbarColor+";\n ")),this.styles.addRule(new Q("."+this.toolboxButtonStyleColorsClass.name+":hover","\n background-color: "+this.uiStyleSettings.toolbarBackgroundHoverColor+"\n ")),this.styles.addRule(new Q("."+this.toolboxButtonStyleClass.name+" svg","\n height: "+this.uiStyleSettings.toolbarHeight/2+"px;\n "))},e.prototype.show=function(e){var t;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=e,this.uiContainer.className=this.toolboxStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxStyleColorsClassName)&&void 0!==t?t:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},e.prototype.setPanelButtons=function(e){var t,i,r=this;this.panels=e,void 0!==this.uiContainer&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+(null!==(t=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)&&void 0!==t?t:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+(null!==(i=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)&&void 0!==i?i:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach((function(e){var t;e.uiStyleSettings=r.uiStyleSettings;var i=document.createElement("div");i.className=r.toolboxButtonStyleClass.name+" "+(null!==(t=r.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==t?t:r.toolboxButtonStyleColorsClass.name),i.innerHTML=e.icon,i.title=e.title,i.addEventListener("click",(function(){r.panelButtonClick(e)})),r.panelButtons.push(i),r.buttonRow.appendChild(i)})),"inline"===this.displayMode?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},e.prototype.panelButtonClick=function(e){var t=this,i=-1;if(e!==this.activePanel){i=this.panels.indexOf(e),this.panelRow.innerHTML="";var r=e.getUi();r.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(r),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=e}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout((function(){"inline"===t.displayMode?t.panelRow.style.display="none":t.panelRow.style.visibility="hidden"}),200);this.panelButtons.forEach((function(e,r){var n,s;e.className=t.toolboxButtonStyleClass.name+" "+(r===i?""+(null!==(n=t.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)&&void 0!==n?n:t.toolboxActiveButtonStyleColorsClass.name):""+(null!==(s=t.uiStyleSettings.toolboxButtonStyleColorsClassName)&&void 0!==s?s:t.toolboxButtonStyleColorsClass.name))}))},e}(),J=function(e,t){this.title=e,this.icon=t},ee=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.colors=[],s.addTransparent=!1,s.colorBoxes=[],s.colors=i,s.currentColor=r,s.setCurrentColor=s.setCurrentColor.bind(s),s.getColorBox=s.getColorBox.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.whiteSpace="nowrap",this.colors.forEach((function(i){var r=e.getColorBox(i);t.appendChild(r),e.colorBoxes.push(r)})),t},t.prototype.getColorBox=function(e){var t=this,i=this.uiStyleSettings.toolbarHeight/4,r=this.uiStyleSettings.toolbarHeight-i,n=document.createElement("div");n.style.display="inline-block",n.style.boxSizing="content-box",n.style.width=r-2+"px",n.style.height=r-2+"px",n.style.padding="1px",n.style.marginRight="2px",n.style.marginBottom="2px",n.style.borderWidth="2px",n.style.borderStyle="solid",n.style.borderRadius=(r+2)/2+"px",n.style.borderColor=e===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",n.addEventListener("click",(function(){t.setCurrentColor(e,n)}));var s=document.createElement("div");return s.style.display="inline-block",s.style.width=r-2+"px",s.style.height=r-2+"px",s.style.backgroundColor=e,s.style.borderRadius=r/2+"px","transparent"===e&&(s.style.fill=this.uiStyleSettings.toolboxAccentColor,s.innerHTML=''),n.appendChild(s),n},t.prototype.setCurrentColor=function(e,t){var i=this;this.currentColor=e,this.colorBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onColorChanged&&this.onColorChanged(e)},t}(J),te=function(){function e(e,t,i){this._state="new",this._isSelected=!1,this._container=e,this._overlayContainer=t,this.globalSettings=i,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(e.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),e.prototype.ownsTarget=function(e){return!1},Object.defineProperty(e.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),e.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},e.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},e.prototype.pointerDown=function(e,t){},e.prototype.dblClick=function(e,t){},e.prototype.manipulate=function(e){},e.prototype.pointerUp=function(e){this.stateChanged()},e.prototype.dispose=function(){},e.prototype.addMarkerVisualToContainer=function(e){this.container.childNodes.length>0?this.container.insertBefore(e,this.container.childNodes[0]):this.container.appendChild(e)},e.prototype.getState=function(){return{typeName:e.typeName,state:this.state,notes:this.notes}},e.prototype.restoreState=function(e){this._state=e.state,this.notes=e.notes},e.prototype.scale=function(e,t){},e.prototype.colorChanged=function(e){this.onColorChanged&&this.onColorChanged(e),this.stateChanged()},e.prototype.fillColorChanged=function(e){this.onFillColorChanged&&this.onFillColorChanged(e),this.stateChanged()},e.prototype.stateChanged=function(){if(this.onStateChanged&&"creating"!==this.state&&"new"!==this.state){var e=this.getState();void 0!==this.manipulationStartState&&(this.manipulationStartState.state="select"),e.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(e)&&this.onStateChanged(this)}},e.typeName="MarkerBase",e}(),ie=function(){function e(){this.findGripByVisual=this.findGripByVisual.bind(this)}return e.prototype.findGripByVisual=function(e){return this.topLeft.ownsTarget(e)?this.topLeft:this.topCenter.ownsTarget(e)?this.topCenter:this.topRight.ownsTarget(e)?this.topRight:this.centerLeft.ownsTarget(e)?this.centerLeft:this.centerRight.ownsTarget(e)?this.centerRight:this.bottomLeft.ownsTarget(e)?this.bottomLeft:this.bottomCenter.ownsTarget(e)?this.bottomCenter:this.bottomRight.ownsTarget(e)?this.bottomRight:void 0},e}(),re=function(){function e(){this.GRIP_SIZE=10,this.visual=W.createGroup(),this.visual.appendChild(W.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(W.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e}(),ne=function(){function e(){}return e.toITransformMatrix=function(e){return{a:e.a,b:e.b,c:e.c,d:e.d,e:e.e,f:e.f}},e.toSVGMatrix=function(e,t){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.e=t.e,e.f=t.f,e},e}(),se=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.left=0,n.top=0,n.width=0,n.height=0,n.defaultSize={x:50,y:20},n.offsetX=0,n.offsetY=0,n.rotationAngle=0,n.CB_DISTANCE=10,n._suppressMarkerCreateEvent=!1,n.container.transform.baseVal.appendItem(W.createTransform()),n.setupControlBox(),n}return j(t,e),Object.defineProperty(t.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"visual",{get:function(){return this._visual},set:function(e){this._visual=e;var t=W.createTransform();this._visual.transform.baseVal.appendItem(t)},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!!(void 0!==this.controlGrips.findGripByVisual(t)||void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(t))},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.left=t.x,this.top=t.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var r=this.unrotatePoint(t);if(this.manipulationStartX=r.x,this.manipulationStartY=r.y,this.offsetX=r.x-this.left,this.offsetY=r.y-this.top,"new"!==this.state)if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(i),void 0!==this.activeGrip)this._state="resize";else if(void 0!==this.rotatorGrip&&this.rotatorGrip.ownsTarget(i)){this.activeGrip=this.rotatorGrip;var n=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=n.x-this.width/2,this.top=n.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var s=this.container.transform.baseVal.getItem(0);s.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(s,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},t.prototype.pointerUp=function(t){var i=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(t),this._state="select","creating"===i&&this.onMarkerCreated&&!1===this._suppressMarkerCreateEvent&&this.onMarkerCreated(this)},t.prototype.moveVisual=function(e){this.visual.style.transform="translate("+e.x+"px, "+e.y+"px)"},t.prototype.manipulate=function(e){var t=this.unrotatePoint(e);"creating"===this.state?this.resize(e):"move"===this.state?(this.left=this.manipulationStartLeft+(t.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(t.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):"resize"===this.state?this.resize(t):"rotate"===this.state&&this.rotate(e)},t.prototype.resize=function(e){var t=this.manipulationStartLeft,i=this.manipulationStartWidth,r=this.manipulationStartTop,n=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:t=this.manipulationStartLeft+e.x-this.manipulationStartX,i=this.manipulationStartWidth+this.manipulationStartLeft-t;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:i=this.manipulationStartWidth+e.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:r=this.manipulationStartTop+e.y-this.manipulationStartY,n=this.manipulationStartHeight+this.manipulationStartTop-r;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:n=this.manipulationStartHeight+e.y-this.manipulationStartY}i>=0?(this.left=t,this.width=i):(this.left=t+i,this.width=-i),n>=0?(this.top=r,this.height=n):(this.top=r+n,this.height=-n),this.setSize()},t.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},t.prototype.rotate=function(e){if(Math.abs(e.x-this.centerX)>.1){var t=Math.sign(e.x-this.centerX);this.rotationAngle=180*Math.atan((e.y-this.centerY)/(e.x-this.centerX))/Math.PI+90*t,this.applyRotation()}},t.prototype.applyRotation=function(){var e=this.container.transform.baseVal.getItem(0);e.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(e,0)},t.prototype.rotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM(),i=W.createPoint(e.x,e.y);return{x:(i=i.matrixTransform(t)).x,y:i.y}},t.prototype.unrotatePoint=function(e){if(0===this.rotationAngle)return e;var t=this.container.getCTM();t=t.inverse();var i=W.createPoint(e.x,e.y);return{x:(i=i.matrixTransform(t)).x,y:i.y}},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=W.createGroup();var e=W.createTransform();e.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(e),this.container.appendChild(this.controlBox),this.controlRect=W.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),!0!==this.globalSettings.disableRotation&&(this.rotatorGripLine=W.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new ie,this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){var e=this.controlBox.transform.baseVal.getItem(0);e.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(e,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),void 0!==this.rotatorGripLine&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},t.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),!0!==this.globalSettings.disableRotation&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},t.prototype.createGrip=function(){var e=new re;return e.visual.transform.baseVal.appendItem(W.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.controlGrips.topLeft.GRIP_SIZE,t=-e/2,i=t,r=(this.width+this.CB_DISTANCE)/2-e/2,n=(this.height+this.CB_DISTANCE)/2-e/2,s=this.height+this.CB_DISTANCE-e/2,o=this.width+this.CB_DISTANCE-e/2;this.positionGrip(this.controlGrips.topLeft.visual,t,i),this.positionGrip(this.controlGrips.topCenter.visual,r,i),this.positionGrip(this.controlGrips.topRight.visual,o,i),this.positionGrip(this.controlGrips.centerLeft.visual,t,n),this.positionGrip(this.controlGrips.centerRight.visual,o,n),this.positionGrip(this.controlGrips.bottomLeft.visual,t,s),this.positionGrip(this.controlGrips.bottomCenter.visual,r,s),this.positionGrip(this.controlGrips.bottomRight.visual,o,s),void 0!==this.rotatorGrip&&this.positionGrip(this.rotatorGrip.visual,r,i-3*this.CB_DISTANCE)},t.prototype.positionGrip=function(e,t,i){var r=e.transform.baseVal.getItem(0);r.setTranslate(t,i),e.transform.baseVal.replaceItem(r,0)},t.prototype.hideControlBox=function(){this.controlBox.style.display="none"},t.prototype.showControlBox=function(){this.controlBox.style.display=""},t.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ne.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ne.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.left=i.left,this.top=i.top,this.width=i.width,this.height=i.height,this.rotationAngle=i.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,i.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ne.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,i.containerTransformMatrix))},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i);var r=this.rotatePoint({x:this.left,y:this.top}),n=this.unrotatePoint({x:r.x*t,y:r.y*i});this.left=n.x,this.top=n.y,this.width=this.width*t,this.height=this.height*i,this.adjustControlBox()},t}(te),oe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.fillColor="transparent",n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.opacity=1,n.setStrokeColor=n.setStrokeColor.bind(n),n.setFillColor=n.setFillColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.createVisual=n.createVisual.bind(n),n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual)},t.prototype.createVisual=function(){this.visual=W.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.setSize()},t.prototype.setSize=function(){e.prototype.setSize.call(this),W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){e.prototype.pointerUp.call(this,t),this.setSize()},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.visual&&W.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(e),this.stateChanged()},t.prototype.setFillColor=function(e){this.fillColor=e,this.visual&&W.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.visual&&W.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.visual&&W.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},t.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){var i=t;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setSize()},t.title="Rectangle marker",t}(se),ae=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.widths=[],s.widthBoxes=[],s.widths=i,s.currentWidth=r,s.setCurrentWidth=s.setCurrentWidth.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.widths.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.flexGrow="2",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===e.currentWidth?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentWidth(i,r)})),t.appendChild(r);var n=document.createElement("div");n.innerText=i.toString(),n.style.marginRight="5px",r.appendChild(n);var s=document.createElement("div");s.style.minHeight="20px",s.style.flexGrow="2",s.style.display="flex",s.style.alignItems="center";var o=document.createElement("hr");o.style.minWidth="20px",o.style.border="0px",o.style.borderTop=i+"px solid "+e.uiStyleSettings.toolboxColor,o.style.flexGrow="2",s.appendChild(o),r.appendChild(s),e.widthBoxes.push(r)})),t},t.prototype.setCurrentWidth=function(e,t){var i=this;this.currentWidth=e,this.widthBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},t}(J),le=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.styles=[],s.styleBoxes=[],s.styles=i,s.currentStyle=r,s.setCurrentStyle=s.setCurrentStyle.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",this.styles.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/e.styles.length-5+"%",r.style.borderColor=i===e.currentStyle?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentStyle(i,r)})),t.appendChild(r);var n=document.createElement("div");n.style.minHeight="20px",n.style.flexGrow="2",n.style.overflow="hidden";var s='";n.innerHTML=s,r.appendChild(n),e.styleBoxes.push(r)})),t},t.prototype.setCurrentStyle=function(e,t){var i=this;this.currentStyle=e,this.styleBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},t}(J),ce=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="FrameMarker",t.title="Frame marker",t.icon='',t}(oe),ue=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},he=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.x1=0,n.y1=0,n.x2=0,n.y2=0,n.defaultLength=50,n.manipulationStartX=0,n.manipulationStartY=0,n.manipulationStartX1=0,n.manipulationStartY1=0,n.manipulationStartX2=0,n.manipulationStartY2=0,n.setupControlBox(),n}return j(t,e),t.prototype.ownsTarget=function(t){return!!e.prototype.ownsTarget.call(this,t)||!(!this.grip1.ownsTarget(t)&&!this.grip2.ownsTarget(t))},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.manipulationStartX=t.x,this.manipulationStartY=t.y,"new"===this.state&&(this.x1=t.x,this.y1=t.y,this.x2=t.x,this.y2=t.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,"new"!==this.state&&(this.select(),this.grip1.ownsTarget(i)?this.activeGrip=this.grip1:this.grip2.ownsTarget(i)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},t.prototype.pointerUp=function(t){var i=this.state;e.prototype.pointerUp.call(this,t),"creating"===this.state&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(t),this._state="select","creating"===i&&this.onMarkerCreated&&this.onMarkerCreated(this)},t.prototype.adjustVisual=function(){},t.prototype.manipulate=function(e){"creating"===this.state?this.resize(e):"move"===this.state?(this.x1=this.manipulationStartX1+e.x-this.manipulationStartX,this.y1=this.manipulationStartY1+e.y-this.manipulationStartY,this.x2=this.manipulationStartX2+e.x-this.manipulationStartX,this.y2=this.manipulationStartY2+e.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):"resize"===this.state&&this.resize(e)},t.prototype.resize=function(e){switch(this.activeGrip){case this.grip1:this.x1=e.x,this.y1=e.y;break;case this.grip2:case void 0:this.x2=e.x,this.y2=e.y}this.adjustVisual(),this.adjustControlBox()},t.prototype.select=function(){e.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},t.prototype.deselect=function(){e.prototype.deselect.call(this),this.controlBox.style.display="none"},t.prototype.setupControlBox=function(){this.controlBox=W.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},t.prototype.adjustControlBox=function(){this.positionGrips()},t.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},t.prototype.createGrip=function(){var e=new re;return e.visual.transform.baseVal.appendItem(W.createTransform()),this.controlBox.appendChild(e.visual),e},t.prototype.positionGrips=function(){var e=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-e/2,this.y1-e/2),this.positionGrip(this.grip2.visual,this.x2-e/2,this.y2-e/2)},t.prototype.positionGrip=function(e,t,i){var r=e.transform.baseVal.getItem(0);r.setTranslate(t,i),e.transform.baseVal.replaceItem(r,0)},t.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},e.prototype.getState.call(this))},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.x1=i.x1,this.y1=i.y1,this.x2=i.x2,this.y2=i.y2},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.x1=this.x1*t,this.y1=this.y1*i,this.x2=this.x2*t,this.y2=this.y2*i,this.adjustVisual(),this.adjustControlBox()},t}(te),de=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorLine&&t!==this.visibleLine)},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.selectorLine=W.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=W.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.createVisual(),this.adjustVisual(),this._state="creating")},t.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),W.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),W.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),W.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.createVisual(),this.adjustVisual()},t.typeName="LineMarker",t.title="Line marker",t.icon='',t}(he),fe=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.fonts=[],s.fontBoxes=[],s.fonts=i,s.currentFont=r,s.setCurrentFont=s.setCurrentFont.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.overflow="hidden",t.style.flexGrow="2",this.fonts.forEach((function(i){var r=document.createElement("div");r.style.display="inline-block",r.style.alignItems="center",r.style.justifyContent="space-between",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.overflow="hidden",r.style.maxWidth=100/e.fonts.length-5+"%",r.style.borderColor=i===e.currentFont?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentFont(i,r)})),t.appendChild(r);var n=document.createElement("div");n.style.display="flex",n.style.minHeight="20px",n.style.flexGrow="2",n.style.fontFamily=i,n.style.overflow="hidden";var s=document.createElement("div");s.style.whiteSpace="nowrap",s.style.overflow="hidden",s.style.textOverflow="ellipsis",s.innerHTML="The quick brown fox jumps over the lazy dog",n.appendChild(s),r.appendChild(n),e.fontBoxes.push(r)})),t},t.prototype.setCurrentFont=function(e,t){var i=this;this.currentFont=e,this.fontBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onFontChanged&&this.onFontChanged(this.currentFont)},t}(J),pe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.color="transparent",n.padding=5,n.DEFAULT_TEXT="your text here",n.text=n.DEFAULT_TEXT,n.isMoved=!1,n.color=r.defaultColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setColor=n.setColor.bind(n),n.setFont=n.setFont.bind(n),n.renderText=n.renderText.bind(n),n.sizeText=n.sizeText.bind(n),n.textEditDivClicked=n.textEditDivClicked.bind(n),n.showTextEditor=n.showTextEditor.bind(n),n.setSize=n.setSize.bind(n),n.positionTextEditor=n.positionTextEditor.bind(n),n.colorPanel=new ee("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.fontFamilyPanel=new fe("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n}return j(t,e),t.prototype.ownsTarget=function(t){if(e.prototype.ownsTarget.call(this,t)||t===this.visual||t===this.textElement||t===this.bgRectangle)return!0;var i=!1;return this.textElement.childNodes.forEach((function(e){e===t&&(i=!0)})),i},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.bgRectangle=W.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=W.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(W.createTransform()),this.textElement.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.isMoved=!1,this.pointerDownPoint=t,this.pointerDownTimestamp=Date.now(),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.renderText=function(){var e=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach((function(t){e.textElement.appendChild(W.createTSpan(""===t.trim()?" ":t.trim(),[["x","0"],["dy","1.2em"]]))})),setTimeout(this.sizeText,10)}},t.prototype.getTextScale=function(){var e=this.textElement.getBBox(),t=1;if(e.width>0&&e.height>0){var i=(1*this.width-this.width*this.padding*2/100)/e.width,r=(1*this.height-this.height*this.padding*2/100)/e.height;t=Math.min(i,r)}return t},t.prototype.getTextPosition=function(e){var t=this.textElement.getBBox(),i=0,r=0;return t.width>0&&t.height>0&&(i=(this.width-t.width*e)/2,r=this.height/2-t.height*e/2),{x:i,y:r}},t.prototype.sizeText=function(){var e=this.textElement.getBBox(),t=this.getTextScale(),i=this.getTextPosition(t);i.y-=e.y*t,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+i.x+"px, "+i.y+"px) scale("+t+", "+t+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(i.x,i.y),this.textElement.transform.baseVal.getItem(1).setScale(t,t))},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t),void 0!==this.pointerDownPoint&&(this.isMoved=Math.abs(t.x-this.pointerDownPoint.x)>5||Math.abs(t.y-this.pointerDownPoint.y)>5)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.isMoved=!0,this.setSize(),this.sizeText()},t.prototype.setSize=function(){e.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},t.prototype.pointerUp=function(t){var i=this.state;"creating"===i&&(this._suppressMarkerCreateEvent=!0),e.prototype.pointerUp.call(this,t),this.setSize(),("creating"===i||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},t.prototype.showTextEditor=function(){var e=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",(function(e){e.stopPropagation()})),this.textEditor.addEventListener("input",(function(){for(var t=Number.parseFloat(e.textEditor.style.fontSize);e.textEditor.clientWidth>=Number.parseInt(e.textEditor.style.maxWidth)&&t>.9;)t-=.1,e.textEditor.style.fontSize=Math.max(t,.9)+"em"})),this.textEditor.addEventListener("keyup",(function(e){e.cancelBubble=!0})),this.textEditor.addEventListener("paste",(function(e){if(e.clipboardData){var t=e.clipboardData.getData("text"),i=window.getSelection();if(!i.rangeCount)return!1;i.deleteFromDocument(),i.getRangeAt(0).insertNode(document.createTextNode(t)),e.preventDefault()}})),this.textEditDiv.addEventListener("pointerup",(function(){e.textEditDivClicked(e.textEditor.innerText)})),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},t.prototype.positionTextEditor=function(){if("edit"===this.state)if(void 0===this.textEditor)this.showTextEditor();else{this.textElement.style.display="";var e=this.getTextScale(),t=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),i=this.textElement.getBBox(),r={x:i.width*e,y:i.height*e};t.x-=r.x/2,t.y-=r.y/2,this.textEditor.style.top=t.y+"px",this.textEditor.style.left=t.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-t.x+"px",this.textEditor.style.fontSize=Math.max(16*e,12)+"px",this.textElement.style.display="none"}},t.prototype.textEditDivClicked=function(e){this.text=e.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},t.prototype.select=function(){e.prototype.select.call(this),"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText)},t.prototype.deselect=function(){"edit"===this.state&&this.textEditDivClicked(this.textEditor.innerText),e.prototype.deselect.call(this)},t.prototype.dblClick=function(t,i){e.prototype.dblClick.call(this,t,i),this.showTextEditor()},t.prototype.setColor=function(e){this.textElement&&W.setAttributes(this.textElement,[["fill",e]]),this.color=e,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(e)},t.prototype.setFont=function(e){this.textElement&&W.setAttributes(this.textElement,[["font-family",e]]),this.fontFamily=e,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},t.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},t.prototype.showVisual=function(){"edit"===this.state&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){var i=t;this.color=i.color,this.fontFamily=i.fontFamily,this.padding=i.padding,this.text=i.text,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setSize(),this.sizeText(),this.positionTextEditor()},t.typeName="TextMarker",t.title="Text marker",t.icon='',t}(se),ge=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.color="transparent",n.lineWidth=3,n.drawing=!1,n.pixelRatio=1,n.color=r.defaultColor,n.lineWidth=r.defaultStrokeWidth,n.pixelRatio=r.freehandPixelRatio,n.setColor=n.setColor.bind(n),n.addCanvas=n.addCanvas.bind(n),n.finishCreation=n.finishCreation.bind(n),n.setLineWidth=n.setLineWidth.bind(n),n.colorPanel=new ee("Color",r.defaultColorSet,r.defaultColor),n.colorPanel.onColorChanged=n.setColor,n.lineWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.lineWidthPanel.onWidthChanged=n.setLineWidth,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.drawingImage)},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.drawingImage=W.createImage(),this.visual.appendChild(this.drawingImage);var e=W.createTransform();this.visual.transform.baseVal.appendItem(e),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){"new"===this.state&&(this.addCanvas(),this.createVisual(),this._state="creating"),"creating"===this.state?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(t.x,t.y),this.drawing=!0):e.prototype.pointerDown.call(this,t,i)},t.prototype.manipulate=function(t){"creating"===this.state?this.drawing&&(this.canvasContext.lineTo(t.x,t.y),this.canvasContext.stroke()):e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),W.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},t.prototype.pointerUp=function(t){"creating"===this._state?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):e.prototype.pointerUp.call(this,t)},t.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},t.prototype.select=function(){"creating"===this.state&&this.finishCreation(),e.prototype.select.call(this)},t.prototype.deselect=function(){"creating"===this.state&&this.finishCreation(),e.prototype.deselect.call(this)},t.prototype.finishCreation=function(){for(var e=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),t=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],i=t[0],r=t[1],n=t[2],s=t[3],o=!1,a=0;a0&&(o=!0,as&&(s=a),l>n&&(n=l));if(o){this.left=i/this.pixelRatio,this.top=r/this.pixelRatio,this.width=(n-i)/this.pixelRatio,this.height=(s-r)/this.pixelRatio;var c=document.createElement("canvas");c.width=n-i,c.height=s-r,c.getContext("2d").putImageData(this.canvasContext.getImageData(i,r,n-i,s-r),0,0),this.drawingImgUrl=c.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},t.prototype.setDrawingImage=function(){W.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),W.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},t.prototype.setColor=function(e){this.color=e,this.colorChanged(e)},t.prototype.setLineWidth=function(e){this.lineWidth=e},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return"new"===this.state||"creating"===this.state?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({drawingImgUrl:this.drawingImgUrl},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){this.createVisual(),e.prototype.restoreState.call(this,t),this.drawingImgUrl=t.drawingImgUrl,this.setDrawingImage()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setDrawingImage()},t.typeName="FreehandMarker",t.title="Freehand marker",t.icon='',t}(se),ve=function(e){function t(t,i,r){var n=e.call(this,t,r||'')||this;return n.typeBoxes=[],n.currentType=i,n.setCurrentType=n.setCurrentType.bind(n),n}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2";for(var i=function(i){var n="both";switch(i){case 0:n="both";break;case 1:n="start";break;case 2:n="end";break;case 3:n="none"}var s=document.createElement("div");if(s.style.display="flex",s.style.flexGrow="2",s.style.alignItems="center",s.style.justifyContent="space-between",s.style.padding="5px",s.style.borderWidth="2px",s.style.borderStyle="solid",s.style.borderColor=n===r.currentType?r.uiStyleSettings.toolboxAccentColor:"transparent",s.addEventListener("click",(function(){e.setCurrentType(n,s)})),t.appendChild(s),"both"===n||"start"===n){var o=document.createElement("div");o.style.display="flex",o.style.alignItems="center",o.style.minHeight="20px",o.innerHTML='',o.style.marginLeft="5px",s.appendChild(o)}var a=document.createElement("div");a.style.display="flex",a.style.alignItems="center",a.style.minHeight="20px",a.style.flexGrow="2";var l=document.createElement("hr");if(l.style.minWidth="20px",l.style.border="0px",l.style.borderTop="3px solid "+(void 0!==r.uiStyleSettings?r.uiStyleSettings.toolboxColor:"#eeeeee"),l.style.flexGrow="2",a.appendChild(l),s.appendChild(a),"both"===n||"end"===n){var c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.minHeight="20px",c.innerHTML='',c.style.marginRight="5px",s.appendChild(c)}r.typeBoxes.push(s)},r=this,n=0;n<4;n++)i(n);return t},t.prototype.setCurrentType=function(e,t){var i=this;this.currentType=e,this.typeBoxes.forEach((function(e){e.style.borderColor=e===t?void 0!==i.uiStyleSettings?i.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"})),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},t}(J),me=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.arrowType="end",n.arrowBaseHeight=10,n.arrowBaseWidth=10,n.getArrowPoints=n.getArrowPoints.bind(n),n.setArrowType=n.setArrowType.bind(n),n.arrowTypePanel=new ve("Arrow type","end"),n.arrowTypePanel.onArrowTypeChanged=n.setArrowType,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.arrow1&&t!==this.arrow2)},t.prototype.getArrowPoints=function(e,t){var i=this.arrowBaseWidth+2*this.strokeWidth,r=this.arrowBaseHeight+2*this.strokeWidth;return e-i/2+","+(t+r/2)+" "+e+","+(t-r/2)+" "+(e+i/2)+","+(t+r/2)},t.prototype.createTips=function(){this.arrow1=W.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=W.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.arrow2)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"creating"===this.state&&this.createTips()},t.prototype.adjustVisual=function(){if(e.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display="both"===this.arrowType||"start"===this.arrowType?"":"none",this.arrow2.style.display="both"===this.arrowType||"end"===this.arrowType?"":"none",W.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),W.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var t=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),i=this.arrow1.transform.baseVal.getItem(0);i.setRotate(t,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(i,0);var r=this.arrow2.transform.baseVal.getItem(0);r.setRotate(t+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(r,0)}},t.prototype.setArrowType=function(e){this.arrowType=e,this.adjustVisual(),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({arrowType:this.arrowType},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.arrowType=i.arrowType,this.createTips(),this.adjustVisual()},t.typeName="ArrowMarker",t.title="Arrow marker",t.icon='',t}(de),ye=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.fillColor=r.defaultFillColor,n.strokeWidth=0,n.fillPanel=new ee("Color",r.defaultColorSet,r.defaultFillColor),n.fillPanel.onColorChanged=n.setFillColor,n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="CoverMarker",t.title="Cover marker",t.icon='',t}(oe),_e=function(e){function t(t,i,r,n){var s=e.call(this,t,n||'')||this;return s.opacities=[],s.opacityBoxes=[],s.opacities=i,s.currentOpacity=r,s.setCurrentOpacity=s.setCurrentOpacity.bind(s),s}return j(t,e),t.prototype.getUi=function(){var e=this,t=document.createElement("div");return t.style.display="flex",t.style.overflow="hidden",t.style.flexGrow="2",t.style.justifyContent="space-between",this.opacities.forEach((function(i){var r=document.createElement("div");r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.style.padding="5px",r.style.borderWidth="2px",r.style.borderStyle="solid",r.style.borderColor=i===e.currentOpacity?e.uiStyleSettings.toolboxAccentColor:"transparent",r.addEventListener("click",(function(){e.setCurrentOpacity(i,r)})),t.appendChild(r);var n=document.createElement("div");n.innerText=100*i+"%",r.appendChild(n),e.opacityBoxes.push(r)})),t},t.prototype.setCurrentOpacity=function(e,t){var i=this;this.currentOpacity=e,this.opacityBoxes.forEach((function(e){e.style.borderColor=e===t?i.uiStyleSettings.toolboxAccentColor:"transparent"})),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},t}(J),be=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.setOpacity=n.setOpacity.bind(n),n.fillColor=r.defaultHighlightColor,n.strokeWidth=0,n.opacity=r.defaultHighlightOpacity,n.fillPanel=new ee("Color",r.defaultColorSet,n.fillColor),n.fillPanel.onColorChanged=n.setFillColor,n.opacityPanel=new _e("Opacity",r.defaultOpacitySteps,n.opacity),n.opacityPanel.onOpacityChanged=n.setOpacity,n}return j(t,e),t.prototype.setOpacity=function(e){this.opacity=e,this.visual&&W.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="HighlightMarker",t.title="Highlight marker",t.icon='',t}(ye),Se='',Ce=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.bgColor="transparent",n.tipPosition={x:0,y:0},n.tipBase1Position={x:0,y:0},n.tipBase2Position={x:0,y:0},n.tipMoving=!1,n.color=r.defaultStrokeColor,n.bgColor=r.defaultFillColor,n.fontFamily=r.defaultFontFamily,n.defaultSize={x:100,y:30},n.setBgColor=n.setBgColor.bind(n),n.getTipPoints=n.getTipPoints.bind(n),n.positionTip=n.positionTip.bind(n),n.setTipPoints=n.setTipPoints.bind(n),n.colorPanel=new ee("Text color",r.defaultColorSet,n.color,''),n.colorPanel.onColorChanged=n.setColor,n.bgColorPanel=new ee("Fill color",r.defaultColorSet,n.bgColor,Se),n.bgColorPanel.onColorChanged=n.setBgColor,n.fontFamilyPanel=new fe("Font",r.defaultFontFamilies,r.defaultFontFamily),n.fontFamilyPanel.onFontChanged=n.setFont,n.tipGrip=new re,n.tipGrip.visual.transform.baseVal.appendItem(W.createTransform()),n.controlBox.appendChild(n.tipGrip.visual),n}return j(t,e),t.prototype.ownsTarget=function(t){return e.prototype.ownsTarget.call(this,t)||this.tipGrip.ownsTarget(t)||this.tip===t},t.prototype.createTip=function(){W.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=W.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},t.prototype.pointerDown=function(t,i){"new"===this.state&&e.prototype.pointerDown.call(this,t,i),"creating"===this.state?this.createTip():this.tipGrip.ownsTarget(i)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):e.prototype.pointerDown.call(this,t,i)},t.prototype.pointerUp=function(t){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,e.prototype.pointerUp.call(this,t);else{var i="creating"===this.state;e.prototype.pointerUp.call(this,t),this.setTipPoints(i),this.positionTip()}},t.prototype.manipulate=function(t){if(this.tipMoving){var i=this.unrotatePoint(t);this.tipPosition={x:i.x-this.manipulationStartLeft,y:i.y-this.manipulationStartTop},this.positionTip()}else e.prototype.manipulate.call(this,t)},t.prototype.setBgColor=function(e){this.bgRectangle&&this.tip&&(W.setAttributes(this.bgRectangle,[["fill",e]]),W.setAttributes(this.tip,[["fill",e]])),this.bgColor=e,this.fillColorChanged(e)},t.prototype.getTipPoints=function(){return this.setTipPoints("creating"===this.state),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},t.prototype.setTipPoints=function(e){void 0===e&&(e=!1);var t=Math.min(this.height/2,15),i=this.height/5;e&&(this.tipPosition={x:t+i/2,y:this.height+20});var r=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?r',t}(pe),we=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.fillColor="transparent",n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.opacity=1,n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.fillColor=r.defaultFillColor,n.setStrokeColor=n.setStrokeColor.bind(n),n.setFillColor=n.setFillColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.setOpacity=n.setOpacity.bind(n),n.createVisual=n.createVisual.bind(n),n.strokePanel=new ee("Line color",X(r.defaultColorSet,["transparent"]),r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.fillPanel=new ee("Fill color",X(r.defaultColorSet,["transparent"]),n.fillColor,Se),n.fillPanel.onColorChanged=n.setFillColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n.opacityPanel=new _e("Opacity",r.defaultOpacitySteps,n.opacity),n.opacityPanel.onOpacityChanged=n.setOpacity,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual)},t.prototype.createVisual=function(){this.visual=W.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"new"===this.state&&(this.createVisual(),this.moveVisual(t),this._state="creating")},t.prototype.manipulate=function(t){e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){e.prototype.resize.call(this,t),this.setSize()},t.prototype.setSize=function(){e.prototype.setSize.call(this),W.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},t.prototype.pointerUp=function(t){e.prototype.pointerUp.call(this,t),this.setSize()},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.visual&&W.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(e),this.stateChanged()},t.prototype.setFillColor=function(e){this.fillColor=e,this.visual&&W.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(e),this.stateChanged()},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.visual&&W.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.visual&&W.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},t.prototype.setOpacity=function(e){this.opacity=e,this.visual&&W.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){var i=t;this.fillColor=i.fillColor,this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.opacity=i.opacity,this.createVisual(),e.prototype.restoreState.call(this,t),this.setSize()},t.prototype.scale=function(t,i){e.prototype.scale.call(this,t,i),this.setSize()},t.typeName="EllipseMarker",t.title="Ellipse marker",t.icon='',t}(se),ke=function(e){function t(t,i,r){return e.call(this,t,i,r)||this}return j(t,e),Object.defineProperty(t.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.tip1&&t!==this.tip2)},t.prototype.createTips=function(){this.tip1=W.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.tip1),this.tip2=W.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(W.createTransform()),this.visual.appendChild(this.tip2)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),"creating"===this.state&&this.createTips()},t.prototype.adjustVisual=function(){if(e.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(W.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),W.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var t=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),i=this.tip1.transform.baseVal.getItem(0);i.setRotate(t,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(i,0);var r=this.tip2.transform.baseVal.getItem(0);r.setRotate(t+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(r,0)}},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t),this.createTips(),this.adjustVisual()},t.typeName="MeasurementMarker",t.title="Measurement marker",t.icon='',t}(de),xe=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokePanel.colors=r.defaultColorSet,n.fillColor="transparent",n}return j(t,e),Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=e.prototype.getState.call(this);return i.typeName=t.typeName,i},t.typeName="EllipseFrameMarker",t.title="Ellipse frame marker",t.icon='',t}(we),Ee=function(){function e(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),e.prototype.addUndoStep=function(e){0!==this.undoStack.length&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(e)||(this.undoStack.push(e),JSON.stringify(this.lastRedoStep)!==JSON.stringify(e)&&this.redoStack.splice(0,this.redoStack.length))},e.prototype.replaceLastUndoStep=function(e){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=e)},e.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},e.prototype.undo=function(){if(this.undoStack.length>1){var e=this.undoStack.pop();return void 0!==e&&this.redoStack.push(e),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},e.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},e}(),Te=function(e){function t(t,i,r){var n=e.call(this,t,i,r)||this;return n.strokeColor="transparent",n.strokeWidth=0,n.strokeDasharray="",n.curveX=0,n.curveY=0,n.manipulationStartCurveX=0,n.manipulationStartCurveY=0,n.setStrokeColor=n.setStrokeColor.bind(n),n.setStrokeWidth=n.setStrokeWidth.bind(n),n.setStrokeDasharray=n.setStrokeDasharray.bind(n),n.positionGrips=n.positionGrips.bind(n),n.addControlGrips=n.addControlGrips.bind(n),n.adjustVisual=n.adjustVisual.bind(n),n.setupControlBox=n.setupControlBox.bind(n),n.resize=n.resize.bind(n),n.strokeColor=r.defaultColor,n.strokeWidth=r.defaultStrokeWidth,n.strokeDasharray=r.defaultStrokeDasharray,n.strokePanel=new ee("Line color",r.defaultColorSet,r.defaultColor),n.strokePanel.onColorChanged=n.setStrokeColor,n.strokeWidthPanel=new ae("Line width",r.defaultStrokeWidths,r.defaultStrokeWidth),n.strokeWidthPanel.onWidthChanged=n.setStrokeWidth,n.strokeStylePanel=new le("Line style",r.defaultStrokeDasharrays,r.defaultStrokeDasharray),n.strokeStylePanel.onStyleChanged=n.setStrokeDasharray,n}return j(t,e),t.prototype.ownsTarget=function(t){return!(!e.prototype.ownsTarget.call(this,t)&&t!==this.visual&&t!==this.selectorCurve&&t!==this.visibleCurve&&!this.curveGrip.ownsTarget(t))},t.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},t.prototype.createVisual=function(){this.visual=W.createGroup(),this.selectorCurve=W.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=W.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},t.prototype.pointerDown=function(t,i){e.prototype.pointerDown.call(this,t,i),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,"new"===this.state&&(this.curveX=t.x,this.curveY=t.y),"new"===this.state?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(i)&&(this.activeGrip=this.curveGrip,this._state="resize")},t.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),W.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),W.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),W.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},t.prototype.setupControlBox=function(){e.prototype.setupControlBox.call(this),this.curveControlLine1=W.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=W.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},t.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,e.prototype.addControlGrips.call(this)},t.prototype.positionGrips=function(){e.prototype.positionGrips.call(this);var t=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-t/2,this.curveY-t/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},t.prototype.manipulate=function(t){"move"===this.state&&(this.curveX=this.manipulationStartCurveX+t.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+t.y-this.manipulationStartY),e.prototype.manipulate.call(this,t)},t.prototype.resize=function(t){this.activeGrip===this.curveGrip&&(this.curveX=t.x,this.curveY=t.y),e.prototype.resize.call(this,t),"creating"===this.state&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},t.prototype.setStrokeColor=function(e){this.strokeColor=e,this.adjustVisual(),this.colorChanged(e)},t.prototype.setStrokeWidth=function(e){this.strokeWidth=e,this.adjustVisual()},t.prototype.setStrokeDasharray=function(e){this.strokeDasharray=e,this.adjustVisual()},t.prototype.scale=function(t,i){this.curveX=this.curveX*t,this.curveY=this.curveY*i,e.prototype.scale.call(this,t,i)},Object.defineProperty(t.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),t.prototype.getState=function(){var i=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},e.prototype.getState.call(this));return i.typeName=t.typeName,i},t.prototype.restoreState=function(t){e.prototype.restoreState.call(this,t);var i=t;this.strokeColor=i.strokeColor,this.strokeWidth=i.strokeWidth,this.strokeDasharray=i.strokeDasharray,this.curveX=i.curveX,this.curveY=i.curveY,this.createVisual(),this.adjustVisual()},t.typeName="CurveMarker",t.title="Curve marker",t.icon='',t}(he),Le=function(){function e(e,t){void 0===t&&(t=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=e,this.cancelable=t}return Object.defineProperty(e.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),e.prototype.preventDefault=function(){this._defaultPrevented=!0},e}(),Ae=function(e){function t(t,i,r){var n=e.call(this,t,!1)||this;return n.dataUrl=i,n.state=r,n}return j(t,e),t}(Le),Re=function(e){function t(t,i,r){void 0===r&&(r=!1);var n=e.call(this,t,r)||this;return n.marker=i,n}return j(t,e),t}(Le),De=function(){function e(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return e.prototype.addEventListener=function(e,t){this[e].push(t)},e.prototype.removeEventListener=function(e,t){var i=this[e].indexOf(t);i>-1&&this[e].splice(i,1)},e}(),Oe=function(){function e(t){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new ue,this._isOpen=!1,this.undoRedoManager=new Ee,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new De,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=e.instanceCounter++,this.styles=new q(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=t,this.targetRoot=document.body,this.width=t.clientWidth,this.height=t.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(e.prototype,"ALL_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,xe,we,be,Ce,ke,ye,de,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,we,be,Ce]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"BASIC_MARKER_TYPES",{get:function(){return[ce,ge,me,pe,be]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(e){var t=this;this._availableMarkerTypes.splice(0),e.forEach((function(e){if("string"==typeof e){var i=t.ALL_MARKER_TYPES.find((function(t){return t.typeName===e}));void 0!==i&&t._availableMarkerTypes.push(i)}else t._availableMarkerTypes.push(e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(e){this._zoomLevel=e,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),"popup"===this.settings.displayMode&&this.onPopupTargetResize(),z.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},e.prototype.show=function(){var e=this;void 0===this.styles.styleSheetRoot&&void 0!==V.styleSheetRoot&&(this.styles.styleSheetRoot=V.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach((function(t){return t(new Le(e))}))},e.prototype.render=function(){return U(this,void 0,void 0,(function(){var e;return K(this,(function(t){switch(t.label){case 0:return this.setCurrentMarker(),(e=new G).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.markersOnly=this.renderMarkersOnly,e.width=this.renderWidth,e.height=this.renderHeight,[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return t.sent(),[4,e.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,t.sent()]}}))}))},e.prototype.close=function(e){var t=this;if(void 0===e&&(e=!1),this.isOpen){var i=!1;e||this.eventListeners.beforeclose.forEach((function(e){var r=new Le(t,!0);e(r),r.defaultPrevented&&(i=!0)})),i||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.settings.displayMode&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach((function(e){return e(new Le(t))})),this.detachEvents(),this._isOpen=!1)}},e.prototype.addMarkersToToolbar=function(){for(var e,t=[],i=0;ithis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*e:this.editorCanvas.clientWidth,i=t',e.title="Powered by marker.js",e.style.display="grid",e.style.alignItems="center",e.style.justifyItems="center",e.style.padding="3px",e.style.width="20px",e.style.height="20px",this.logoUI.appendChild(e),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},e.prototype.positionLogo=function(){this.logoUI&&("right"!==this.uiStyleSettings.logoPosition?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},e.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},e.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},e.prototype.showUI=function(){switch("popup"===this.settings.displayMode&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=void 0!==this.uiStyleSettings.zIndex?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin="popup"===this.settings.displayMode?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Z(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1","popup"===this.settings.displayMode&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex","popup"===this.settings.displayMode&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y-1&&this.markers.splice(this.markers.indexOf(e),1),e.dispose()},e.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),void 0!==this._currentMarker&&("new"!==this._currentMarker.state?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},e.prototype.toolbarButtonClicked=function(e,t){if("marker"===e&&void 0!==t)this.createNewMarker(t);else if("action"===e)switch(t){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":void 0===this.notesArea?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},e.prototype.deleteSelectedMarker=function(){var e=this;if(void 0!==this._currentMarker){var t=!1;if(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Re(e,e._currentMarker,!0);i(r),r.defaultPrevented&&(t=!0)})),!t){var i=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach((function(t){return t(new Re(e,i))}))}}},e.prototype.clear=function(){var e=this,t=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach((function(i){var r=new Re(e,void 0,!0);i(r),r.defaultPrevented&&(t=!0)})),!t)){this.setCurrentMarker();for(var i=function(t){var i=r.markers[t];r.setCurrentMarker(r.markers[t]),r._currentMarker.dispose(),r.markerImage.removeChild(r._currentMarker.container),r.markers.splice(r.markers.indexOf(r._currentMarker),1),r.eventListeners.markerdelete.forEach((function(t){return t(new Re(e,i))}))},r=this,n=this.markers.length-1;n>=0;n--)i(n);this.addUndoStep()}},Object.defineProperty(e.prototype,"isNotesAreaOpen",{get:function(){return void 0!==this.notesArea},enumerable:!1,configurable:!0}),e.prototype.showNotesEditor=function(){var e;void 0!==this._currentMarker&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=null!==(e=this._currentMarker.notes)&&void 0!==e?e:"",this.overlayContainer.appendChild(this.notesArea))},e.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(void 0!==this._currentMarker&&(this._currentMarker.notes=""!==this.notesArea.value.trim()?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},e.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},e.prototype.addUndoStep=function(){var e=this;if(void 0===this._currentMarker||"edit"!==this._currentMarker.state){var t=this.getState(),i=this.undoRedoManager.getLastUndoStep();if(!i||i.width===t.width&&i.height===t.height){var r=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(t),r1&&this.panTo({x:e.clientX,y:e.clientY}))},e.prototype.onPointerUp=function(e){this.touchPoints>0&&this.touchPoints--,0===this.touchPoints&&this.isDragging&&void 0!==this._currentMarker&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(e.clientX,e.clientY)),this.isDragging=!1,this.addUndoStep()},e.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},e.prototype.onKeyUp=function(e){void 0===this._currentMarker||void 0!==this.notesArea||"Delete"!==e.key&&"Backspace"!==e.key||this.deleteSelectedMarker()},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.markerImage.getBoundingClientRect();return{x:(e-i.left)/this.zoomLevel,y:(t-i.top)/this.zoomLevel}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var e=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},e.prototype.addLicenseKey=function(e){z.addKey(e)},e.prototype.addEventListener=function(e,t){this.eventListeners.addEventListener(e,t)},e.prototype.removeEventListener=function(e,t){this.eventListeners.removeEventListener(e,t)},e.prototype.renderState=function(e){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(e),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(e.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),e.prototype.focus=function(){var e=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,void 0!==this._previousCurrentMarker&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach((function(t){return t(new Le(e))})))},e.prototype.blur=function(){var e=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach((function(t){return t(new Le(e))})))},e.instanceCounter=0,e}(),Me=function(e,t){return(Me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)};
/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function Ie(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Me(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function Pe(e,t,i,r){return new(i||(i=Promise))((function(n,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((r=r.apply(e,t||[])).next())}))}function Fe(e,t){var i,r,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((n=(n=o.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]0&&t>0){var i=new Ve(e,t),r=i.ratio>=1?20:i.getHorizontalLength(20),n=i.ratio<1?20:i.getVerticalLength(20),s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(s);var o=Ne.createDefs();s.appendChild(o);var a=Ne.createElement("clipPath",[["id","text-bg-clip"]]);o.appendChild(a);var l=Ne.createPath(Ne.getHollowRectanglePath((24-r)/2,(24-n)/2,r,n,(24-r)/2+2,(24-n)/2+2,r-4,n-4));s.appendChild(l);var c=Ne.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);c.appendChild(Ne.createTSpan(e+":"+t)),s.appendChild(c);var u=c.getBBox();Ne.setAttributes(c,[["x",((24-u.width)/2).toString()],["y",((24-u.height)/2-u.y).toString()]]);var h=Ne.createPath(Ne.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(u.width))/2,(24-Math.ceil(u.height))/2,Math.ceil(u.width),Math.ceil(u.height)));return a.appendChild(h),Ne.setAttributes(l,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(s),s.outerHTML}return''},e}(),Qe=function(e){function t(t,i,r){var n=e.call(this,t,i)||this;return n.isDropdownOpen=!1,n.onClick=n.dropdownButtonClicked,n.dropdownButtons=r,n}return Ie(t,e),t.prototype.setupDropdown=function(){var e=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach((function(t){t.className=e.className,t.colorsClassName=e.colorsClassName,e.dropdownBlock.appendChild(t.getUI())})),this.uiContainer.appendChild(this.dropdownBlock)},t.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},t.prototype.dropdownButtonClicked=function(){void 0===this.dropdownBlock&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},t.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},t.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},t.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},t}(ze),Ye=function(){function e(e,t){this.GRIP_SIZE=10,this.color=e,this.fillColor=t,this.visual=Ne.createGroup(),this.visual.appendChild(Ne.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ne.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return e.prototype.ownsTarget=function(e){return e===this.visual||e===this.visual.childNodes[0]||e===this.visual.childNodes[1]},e.prototype.setCenter=function(e,t){this.visual.childNodes.forEach((function(i){return Ne.setAttributes(i,[["cx",e.toString()],["cy",t.toString()]])}))},e}(),Ze=function(){function e(e,t,i,r){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=e,this.canvasHeight=t,this.margin=i,this.container=r,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(e){this._aspectRatio=e,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.gridContainer&&Ne.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(e){this._zoomFactor=e,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),e.prototype.open=function(){var e=this;this.cropShadeElement=Ne.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ne.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var t=0;tthis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-t.height/2),Ne.setAttributes(this.cropRectElement,[["x",t.x.toString()],["y",t.y.toString()],["width",t.width.toString()],["height",t.height.toString()]]);var i=t.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach((function(e,r){var n=t.y+i*(r+1);Ne.setAttributes(e,[["x1",""+t.x],["y1",""+n],["x2",""+(t.x+t.width)],["y2",""+n]])}));var r=t.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach((function(e,i){var n=t.x+r*(i+1);Ne.setAttributes(e,[["x1",""+n],["y1",""+t.y],["x2",""+n],["y2",""+(t.y+t.height)]])})),Ne.setAttributes(this.cropShadeElement,[["d",Ne.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,t.x,t.y,t.width,t.height)]]),this.topLeftGrip.setCenter(t.x,t.y),this.topRightGrip.setCenter(t.x+t.width,t.y),this.bottomLeftGrip.setCenter(t.x,t.y+t.height),this.bottomRightGrip.setCenter(t.x+t.width,t.y+t.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},e.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.container.getBoundingClientRect();return{x:e-i.left+this.margin,y:t-i.top+this.margin}},e.prototype.onPointerDown=function(e){this.container.setPointerCapture(e.pointerId),this.previousPoint=this.clientToLocalCoordinates(e.clientX,e.clientY),this.cropRectElement===e.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(e.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(e.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(e.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(e.target)&&(this.activeGrip=this.bottomRightGrip)},e.prototype.onPointerMove=function(e){if(this.isMoving)this.move(this.clientToLocalCoordinates(e.clientX,e.clientY));else if(this.activeGrip){var t=this.clientToLocalCoordinates(e.clientX,e.clientY);this.resize(t)}e.preventDefault()},e.prototype.onPointerUp=function(e){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(e.pointerId)},e.prototype.move=function(e){var t=e.x-this.previousPoint.x,i=e.y-this.previousPoint.y;1!==this.zoomFactor&&(t=-t/this.zoomFactor,i=-i/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+t),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+i),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=e},e.prototype.resize=function(e){var t=Object.assign({},this.cropRect),i=e.x-this.previousPoint.x,r=e.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:t.x+ithis.canvasWidth*this.zoomFactor&&(i=this.canvasWidth*this.zoomFactor-t.width),t.width+=i}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(t.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(i),t.height=this.aspectRatio.getVerticalLength(t.width)):(t.y+=r,t.height=this.cropRect.y+this.cropRect.height-t.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?t.height=this.aspectRatio.getVerticalLength(t.width):t.height+=r}t.width<10&&(t.x=this.cropRect.x,t.width=10),t.height<10&&(t.y=this.cropRect.y,t.height=10),this.previousPoint=e,t.x>=this.margin&&t.y>=this.margin&&t.x-this.margin+t.width<=this.canvasWidth&&t.y-this.margin+t.height<=this.canvasHeight&&(this.cropRect=t,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},e.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var e=this.cropRect.x+this.cropRect.width/2,t=this.cropRect.y+this.cropRect.height/2,i=this.aspectRatio.getHorizontalLength(this.cropRect.height),r=this.aspectRatio.getVerticalLength(this.cropRect.width);i/this.canvasWidththis.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=e-this.cropRect.width/2,this.cropRect.y=t-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},e.prototype.getRescaledRect=function(e,t,i,r,n,s){var o=i/e,a=r/t;return{x:(n.x-s)*o+s,y:(n.y-s)*a+s,width:n.width*o,height:n.height*a}},e.prototype.scaleCanvas=function(e,t){var i=this.getRescaledRect(this.canvasWidth,this.canvasHeight,e,t,this.cropRect,this.margin);this.canvasWidth=e,this.canvasHeight=t,this.onCropChange&&this.onCropChange(i),this.setCropRectangle(i)},e}(),$e=function(){function e(e){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=e,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),e.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},e.prototype.onPointerDown=function(e){this.controlContainer.setPointerCapture(e.pointerId),this.isDragging=!0,this.previousPoint={x:e.clientX,y:e.clientY}},e.prototype.onPointerMove=function(e){this.isDragging&&(this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.previousPoint.x=e.clientX)},e.prototype.onPointerUp=function(e){this.isDragging&&this.onAngleChange&&this.onAngleChange((e.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(e.pointerId)},e.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var e=this.angleLabelText.getBBox();Ne.setAttributes(this.angleLabelElement,[["x",((this.width-e.width)/2).toString()],["y",(this.height/2).toString()]])}},e.prototype.positionScaleShape=function(){if(this.scaleShape){var e=this.scaleShape.transform.baseVal.getItem(0);e.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(e,0)}},e.prototype.getVisual=function(){var e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("width",this.width+"px"),e.setAttribute("height",this.height+"px"),e.setAttribute("viewBox","0 0 "+this.width+" "+this.height),e.style.flexShrink="0",document.body.appendChild(e);for(var t="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,i=1;i<=this.width/5+10;i++){var r=i%5==0?this.height/3:this.height/6;t+="h4v"+-r+"h1v"+r}t+="v1H0Z",this.scaleShape=Ne.createPath(t);var n=Ne.createTransform();this.scaleShape.transform.baseVal.appendItem(n),e.appendChild(this.scaleShape),this.angleLabelElement=Ne.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ne.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var s=Ne.createTSpan("");return s.innerHTML="°",this.angleLabelElement.appendChild(s),e.appendChild(this.angleLabelElement),document.body.removeChild(e),e},e}(),Je=function(){function e(){this.naturalSize=!1,this.imageType="image/png"}return e.prototype.rasterize=function(e,t,i,r,n,s,o){var a=this;return new Promise((function(l){var c=document.createElement("canvas");c.width=e.width.baseVal.value-2*r,c.height=e.height.baseVal.value-2*r;var u=1,h=1;!0===a.naturalSize?(u=t.naturalWidth/(e.width.baseVal.value-2*r)/s,h=t.naturalHeight/(e.height.baseVal.value-2*r)/o,c.width=t.naturalWidth/s,c.height=t.naturalHeight/o):void 0!==a.width&&void 0!==a.height&&(u=a.width/i.width,h=a.height/i.height,c.width*=u,c.height*=h);var d=c.getContext("2d");d.translate(c.width/2,c.height/2),d.rotate(n*Math.PI/180),d.scale(s,o),d.translate(-c.width/2,-c.height/2),d.drawImage(t,0,0,c.width,c.height);var f=document.createElement("canvas");f.width=i.width*u,f.height=i.height*h,f.getContext("2d").putImageData(d.getImageData((i.x-r)*u,(i.y-r)*h,i.width*u,i.height*h),0,0),l(f.toDataURL(a.imageType,a.imageQuality))}))},e}(),et=function(){function e(t){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=e.instanceCounter++,this.styles=new He(this.instanceNo),this.target=t,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(e.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(e){this._zoomToCropEnabled=e,e?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(e){this._isGridVisible=e,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gridLines",{get:function(){return this._gridLines},set:function(e){this._gridLines=e,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){var e;return null!==(e=this._aspectRatio)&&void 0!==e?e:this.aspectRatios[0]},set:function(e){this._aspectRatio=e},enumerable:!1,configurable:!0}),e.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),"popup"===this.displayMode&&this.onPopupResize(),this._isOpen=!0},e.prototype.show=function(){this.showUI(),this.open()},e.prototype.close=function(e){void 0===e&&(e=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),"popup"===this.displayMode&&window.removeEventListener("resize",this.setWindowHeight),e||this.closeEventListeners.forEach((function(e){return e()})),this._isOpen=!1)},e.prototype.addRenderEventListener=function(e){this.renderEventListeners.push(e)},e.prototype.removeRenderEventListener=function(e){this.renderEventListeners.indexOf(e)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(e),1)},e.prototype.addCloseEventListener=function(e){this.closeEventListeners.push(e)},e.prototype.removeCloseEventListener=function(e){this.closeEventListeners.indexOf(e)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(e),1)},e.prototype.setupResizeObserver=function(){var e=this;"inline"===this.displayMode?window.ResizeObserver&&(this.targetObserver=new ResizeObserver((function(){e.resize(e.target.clientWidth,e.target.clientHeight)})),this.targetObserver.observe(this.target)):"popup"===this.displayMode&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},e.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var e=1*this.target.clientWidth/this.target.clientHeight,t=this.contentDiv.clientWidth/e>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*e:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,i=t+2*this.CANVAS_MARGINe+this.CANVAS_MARGIN?this.target.offsetTop-(e+this.CANVAS_MARGIN):0;this.coverDiv.style.top=t+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=void 0!==this.styles.settings.zIndex?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=void 0!==this.styles.settings.zIndex?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin="popup"===this.displayMode?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,"popup"===this.displayMode&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex","popup"===this.displayMode&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},e.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},e.prototype.addTopToolbar=function(){var e=this;this.topToolbar=new Ke,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var t=new We;t.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(t);var i=[];this.aspectRatios.forEach((function(t){var r=new ze(qe.getIcon(t.horizontal,t.vertical),0===t.horizontal&&0===t.vertical?"FREE":t.horizontal+":"+t.vertical);r.onClick=function(){return e.ratioButtonClicked(t)},i.push(r)})),this.aspectRatioButton=new Qe(qe.getIcon(0,0),"Aspect ratio",i),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,t.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var r=new ze('',"Toggle grid");r.isActive=this.isGridVisible,r.onClick=function(){e.isGridVisible=!e.isGridVisible,r.isActive=e.isGridVisible},t.addButton(r);var n=new ze('',"Zoom to selection");if(n.isActive=this.zoomToCropEnabled,n.onClick=function(){e.zoomToCropEnabled=!e.zoomToCropEnabled,n.isActive=e.zoomToCropEnabled},t.addButton(n),!Be.isLicensed){var s=new Ge;this.topToolbar.addElementBlock(s);var o=document.createElement("div");o.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var a=document.createElement("a");a.style.color="currentColor",a.href="https://markerjs.com/products/cropro",a.target="_blank",a.innerHTML='',o.appendChild(a),s.addElement(o)}var l=new We;l.minWidth=3*this.toolbarHeight+"px",l.contentAlign="end",this.topToolbar.addButtonBlock(l);var c=new ze('',"OK");c.onClick=this.startRenderAndClose,l.addButton(c),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(c.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var u=new ze('',"Close");u.onClick=this.close,l.addButton(u),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(u.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},e.prototype.addBottomToolbar=function(){var e=this;this.bottomToolbar=new Ke,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var t=new We;t.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(t);var i=new ze('',"Rotate left");i.onClick=this.rotateLeftButtonClicked,t.addButton(i);var r=new ze('',"Rotate right");r.onClick=this.rotateRightButtonClicked,t.addButton(r);var n=new Ge;n.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(n),this.straightener=new $e("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(t){e.rotateBy(t),e.straightener.angle=e.rotationAngle},n.addElement(this.straightener.getUI());var s=new We;s.minWidth=2*this.toolbarHeight+"px",s.contentAlign="end",this.bottomToolbar.addButtonBlock(s);var o=new ze('',"Flip horizontal");o.onClick=this.flipHorizontallyButtonClicked,s.addButton(o);var a=new ze('',"Flip vertical");a.onClick=this.flipVerticallyButtonClicked,s.addButton(a)},e.prototype.ratioButtonClicked=function(e){this.aspectRatio=e,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},e.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=qe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},e.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&0!==this.aspectRatio.horizontal&&0!==this.aspectRatio.vertical?this.cropLayer.aspectRatio=new Ve(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},e.prototype.closeUI=function(){"popup"===this.displayMode&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},e.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},e.prototype.restoreState=function(e){if(e){var t=this.cropLayer.getRescaledRect(e.width,e.height,this.imageWidth,this.imageHeight,e.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(t),this.cropRectChanged(t),this.flippedHorizontally=e.flippedHorizontally,this.flippedVertically=e.flippedVertically,this.applyFlip(),this.rotationAngle=e.rotationAngle,this.applyRotation()}},e.prototype.clientToLocalCoordinates=function(e,t){var i=this.cropImage.getBoundingClientRect();return{x:e-i.left,y:t-i.top}},e.prototype.onWindowResize=function(){this.positionUI()},e.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var e=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=e+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},e.prototype.rotateLeftButtonClicked=function(){var e=this.rotationAngle-90;this.rotationAngle%90!=0&&(e+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateRightButtonClicked=function(){var e=this.rotationAngle+90;this.rotationAngle%90!=0&&(e-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(e)},e.prototype.rotateTo=function(e){e=(e=e>180?e-360:e)<=-180?e+360:e,this.rotationAngle=e,this.applyRotation()},e.prototype.rotateBy=function(e){this.rotateTo((this.rotationAngle+e)%360)},e.prototype.applyRotation=function(){var e=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var t=this.editingTargetRotationContainer.transform.baseVal.getItem(0);t.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(t,0);var i=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/i.width,this.imageHeight/i.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=e},e.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},e.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},e.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},e.prototype.startRenderAndClose=function(){return Pe(this,void 0,void 0,(function(){var e,t;return Fe(this,(function(i){switch(i.label){case 0:return[4,this.render()];case 1:return e=i.sent(),t=this.getState(),this.renderEventListeners.forEach((function(i){return i(e,t)})),this.close(!0),[2]}}))}))},e.prototype.render=function(){return Pe(this,void 0,void 0,(function(){var e;return Fe(this,(function(t){switch(t.label){case 0:return(e=new Je).naturalSize=this.renderAtNaturalSize,e.imageType=this.renderImageType,e.imageQuality=this.renderImageQuality,e.width=this.renderWidth,e.height=this.renderHeight,this.unzoomFromCrop(),Ne.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,e.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return t.sent(),[4,e.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,t.sent()]}}))}))},e.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ue("toolbar","\n width: "+("inline"===this.displayMode?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+";\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n justify-content: space-between; \n height: "+this.toolbarHeight+"px;\n box-sizing: content-box;\n overflow: hidden;\n line-height: 0px;\n ")),this.toolbarStyleColorsClass=this.styles.addClass(new Ue("toolbar_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarBlockStyleClass=this.styles.addClass(new Ue("toolbar-block","\n display: flex;\n align-items: center;\n box-sizing: content-box;\n "));var e=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ue("toolbar_button","\n display: inline-block;\n width: "+(this.toolbarHeight-2*e)+"px;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ue("toolbar_button_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n ")),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ue("toolbar_active_button","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n background-color: "+this.styles.settings.toolbarBackgroundActiveColor+"\n ")),this.styles.addRule(new je("."+this.toolbarButtonStyleClass.name+" svg","\n height: "+this.toolbarHeight/2+"px;\n ")),this.styles.addRule(new je("."+this.toolbarButtonStyleColorsClass.name+":hover","\n background-color: "+this.styles.settings.toolbarBackgroundHoverColor+"\n ")),this.toolbarDropdownStyleClass=this.styles.addClass(new Ue("toolbar_dropdown","\n position: absolute;\n max-width: "+4*this.toolbarHeight+"px;\n z-index: 20;\n white-space: normal;\n box-sizing: content-box;\n box-shadow: 3px 3px rgba(33, 33, 33, 0.1);\n margin: "+("inline"===this.displayMode?"0":this.popupMargin)+"px;\n line-height: 0px;\n ")),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new Ue("toolbar_dropdown_colors","\n background-color: "+this.styles.settings.toolbarBackgroundColor+";\n ")),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new Ue("toolbar_straightener_block","\n display: flex;\n overflow: hidden;\n justify-content: center;\n -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);\n ")),this.toolbarStraightenerStyleClass=this.styles.addClass(new Ue("toolbar_straightener","\n display: flex;\n overflow: hidden;\n justify-content: center;\n height: "+(this.toolbarHeight-2*e)+"px;\n padding: "+e+"px;\n cursor: default;\n user-select: none;\n box-sizing: content-box;\n ")),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new Ue("toolbar_straightener_colors","\n color: "+this.styles.settings.toolbarColor+";\n fill: currentColor;\n "))},e.instanceCounter=0,e}(),tt=i("8hTe"),it=i.n(tt),rt=/]*>/g;t.a=function(e){var t=e.value,i=void 0===t?"":t,l=e.edit,d=void 0!==l&&l,f=e.className,p=e.showTextOnly,g=e.showLines,v=e.replaces,m=e.zoomImg,y=e.hasMask,C=e.style,w=void 0===C?{}:C,k=e.stylesPrev,x=void 0===k?{}:k,L=String(i),A=Object(u.useRef)(),R=Object(u.useRef)(),D=Object(u.useState)(""),M=Object(a.a)(D,2),H=M[0],j=M[1],U=Object(u.useState)("office"),K=Object(a.a)(U,2),X=K[0],W=K[1],z=Object(u.useMemo)((function(){try{L=(L=L.replace(/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,"("+P.a.API_SERVER+"/api/attachments/").replace(/\"\/api\/attachments\/|\"\/attachments\/download\//g,'"'+P.a.API_SERVER+"/api/attachments/").replace(/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,'"'+P.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,"\n")).replace(new RegExp("(?[TOC]
",S()),_()),e=(e=e.replace(/(__special_katext_id_\d+__)/g,(function(e,i){var r=t[i],n=r.type,s=r.expression;return Object(F.renderToString)(function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue}(s)||"",{displayMode:"block"===n,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),T(),p){var i=document.createElement("div");return i.innerHTML=e,i.innerText}return setTimeout((function(){return q()}),500),e}),[L]),G=Object(u.useRef)();function V(e){var t=e.target;if("IMG"===t.tagName.toUpperCase()){if(m){var i=t.getAttribute("src");j(i),W("image")}}else if("A"===t.tagName.toUpperCase()){var r=t.getAttribute("href");if(r.indexOf("office")>-1)e.preventDefault(),j(r),W("office");else if(r.indexOf("application/pdf")>-1)e.preventDefault(),j(r),W("pdf");else if(r.indexOf("type=text")>-1)e.preventDefault(),j(r),W("html");else if(r.startsWith("#")){e.preventDefault();var n=document.getElementById(r.replace("#",""));n&&n.scrollIntoView(!0)}}}b.WebkitLineClamp=g,g&&(w=Object(s.a)(Object(s.a)({},w),b));var q=function(){var e,t=null===(e=G.current)||void 0===e?void 0:e.querySelectorAll("video");null==t||t.forEach((function(e){if(e.oncontextmenu=function(){return!1},e.src.indexOf(".m3u8")>-1)if(e.canPlayType("application/vnd.apple.mpegurl"));else if(I.a.isSupported()){var t=new I.a;t.loadSource(e.src),t.attachMedia(e)}}))};Object(u.useEffect)((function(){if(G.current&&z&&z.match(rt)&&window.PR.prettyPrint(),G.current)return G.current.addEventListener("click",V),function(){G.current.removeEventListener("click",V),T(),_()}}),[z,G.current,V]);return h.a.createElement("div",{style:{position:"relative"}},h.a.createElement("div",{ref:G,style:Object(s.a)({},w),className:"".concat(f||""," markdown-body ").concat(it.a.mdBody),onMouseOver:function(e){d&&("IMG"===e.target.nodeName?(A.current.style.display="flex",A.current.style.width=e.target.clientWidth+"px",A.current.style.height=e.target.clientHeight+"px",A.current.style.top=e.target.offsetTop+"px",A.current.style.left=e.target.offsetLeft+"px",R.current.src=e.target.getAttribute("src")):A.current.style.display="none")},dangerouslySetInnerHTML:{__html:z}}),h.a.createElement("div",{ref:A,className:it.a.button},h.a.createElement(r.a,null,h.a.createElement(n.a,{onClick:function(){return(e=new et(R.current)).displayMode="popup",e.addRenderEventListener(function(){var e=Object(o.a)(c.a.mark((function e(t){var i;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A.current.style.display="none",e.next=3,Object(N.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t}});case 3:null!=(i=e.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),void e.show();var e}},"裁剪"),h.a.createElement(n.a,{onClick:function(){return(e=new Oe(R.current)).settings.displayMode="popup",e.addEventListener("render",function(){var e=Object(o.a)(c.a.mark((function e(t){var i;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(A.current.style.display="none",!R.current){e.next=6;break}return e.next=4,Object(N.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:t.dataUrl}});case 4:null!=(i=e.sent)&&i.id&&v(R.current.getAttribute("src").replace(P.a.API_SERVER,""),"/api/attachments/".concat(null==i?void 0:i.id,"?type=").concat(i.content_type));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.show(),void(window.markerArea=e);var e}},"编辑"))),h.a.createElement("img",{ref:R,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),h.a.createElement(B.a,{close:!0,data:H,hasMask:y,type:null!=H&&H.length?X:"",style:Object(s.a)({},x),onClose:function(){return j("")}}))}},"9VGf":
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/*! exports provided: default */
/*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return n}));var r=i(/*! react */"q1tI");function n(e,t){var i=Object(r.useRef)();Object(r.useEffect)((function(){i.current=e})),Object(r.useEffect)((function(){if(null!==t){var e=setInterval((function(){i.current()}),t);return function(){return clearInterval(e)}}}),[t])}},BU3w:
/*!***************************************************!*\
!*** ./node_modules/rc-util/es/Dom/dynamicCSS.js ***!
\***************************************************/
/*! exports provided: injectCSS, updateCSS */
/*! exports used: updateCSS */function(e,t,i){"use strict";i.d(t,"a",(function(){return a}));var r=i(/*! ./canUseDom */"MNnm");function n(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function s(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object(r.a)())return null;var s,o=document.createElement("style");(null===(t=i.csp)||void 0===t?void 0:t.nonce)&&(o.nonce=null===(s=i.csp)||void 0===s?void 0:s.nonce);o.innerHTML=e;var a=n(i),l=a.firstChild;return i.prepend&&a.prepend?a.prepend(o):i.prepend&&l?a.insertBefore(o,l):a.appendChild(o),o}var o=new Map;function a(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n(i);if(!o.has(r)){var a=s("",i),l=a.parentNode;o.set(r,l),l.removeChild(a)}var c=Array.from(o.get(r).children).find((function(e){return"STYLE"===e.tagName&&e["rc-util-key"]===t}));if(c){var u,h,d;if((null===(u=i.csp)||void 0===u?void 0:u.nonce)&&c.nonce!==(null===(h=i.csp)||void 0===h?void 0:h.nonce))c.nonce=null===(d=i.csp)||void 0===d?void 0:d.nonce;return c.innerHTML!==e&&(c.innerHTML=e),c}var f=s(e,i);return f["rc-util-key"]=t,f}},Bd2K:
/*!********************************************************!*\
!*** ./node_modules/codemirror/addon/edit/closetag.js ***!
\********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){e.defineOption("autoCloseTags",!1,(function(o,a,l){if(l!=e.Init&&l&&o.removeKeyMap("autoCloseTags"),a){var c={name:"autoCloseTags"};"object"==typeof a&&!1===a.whenClosing||(c["'/'"]=function(t){return function(t){return t.getOption("disableInput")?e.Pass:r(t,!0)}(t)}),"object"==typeof a&&!1===a.whenOpening||(c["'>'"]=function(r){return function(r){if(r.getOption("disableInput"))return e.Pass;for(var o=r.listSelections(),a=[],l=r.getOption("autoCloseTags"),c=0;cu.ch&&(g=g.slice(0,g.length-h.end+u.ch));var _=g.toLowerCase();if(!g||"string"==h.type&&(h.end!=u.ch||!/[\"\']/.test(h.string.charAt(h.string.length-1))||1==h.string.length)||"tag"==h.type&&p.close||h.string.indexOf("/")==u.ch-h.start-1||m&&n(m,_)>-1||s(r,d.mode.xmlCurrentContext&&d.mode.xmlCurrentContext(f)||[],g,u,!0))return e.Pass;var b="object"==typeof l&&l.emptyTags;if(b&&n(b,g)>-1)a[c]={text:"/>",newPos:e.Pos(u.line,u.ch+2)};else{var S=y&&n(y,_)>-1;a[c]={indent:S,text:">"+(S?"\n\n":"")+""+g+">",newPos:S?e.Pos(u.line+1,0):e.Pos(u.line,u.ch+1)}}}var C="object"==typeof l&&l.dontIndentOnAutoClose;for(c=o.length-1;c>=0;c--){var w=a[c];r.replaceRange(w.text,o[c].head,o[c].anchor,"+insert");var k=r.listSelections().slice(0);k[c]={head:w.newPos,anchor:w.newPos},r.setSelections(k),!C&&w.indent&&(r.indentLine(w.newPos.line,null,!0),r.indentLine(w.newPos.line+1,null,!0))}}(r)}),o.addKeyMap(c)}}));var t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],i=["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(t,i){for(var r=t.listSelections(),n=[],o=i?"/":"",a=t.getOption("autoCloseTags"),l="object"==typeof a&&a.dontIndentOnSlash,c=0;c"!=t.getLine(u.line).charAt(h.end)&&(p+=">"),n[c]=p}if(t.replaceSelections(n),r=t.listSelections(),!l)for(c=0;c=0&&i[c]==r;c--)++l;for(n=a.to,c=1;c0){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:"",i=[],r=0;re.length)&&(t=e.length);for(var i=0,r=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(r=e[Symbol.iterator]()).next.bind(r)}var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){function t(){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}}e.exports={defaults:{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},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}})),n=(r.defaults,r.getDefaults,r.changeDefaults,/[&<>"']/),s=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,l={"&":"&","<":"<",">":">",'"':""","'":"'"},c=function(e){return l[e]},u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function h(e){return e.replace(u,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}var d=/(^|[^\[])\^/g,f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i,g={},v=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/;function _(e,t){g[" "+e]||(v.test(e)?g[" "+e]=e+"/":g[" "+e]=b(e,"/",!0));var i=-1===(e=g[" "+e]).indexOf(":");return"//"===t.substring(0,2)?i?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?i?t:e.replace(y,"$1")+t:e+t}function b(e,t,i){var r=e.length;if(0===r)return"";for(var n=0;n=0&&"\\"===i[n];)r=!r;return r?"|":" |"})).split(/ \|/),r=0;if(i.length>t)i.splice(t);else for(;i.length1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var i=this.rules.block.code.exec(e);if(i){var r=t[t.length-1];if(r&&"paragraph"===r.type)return{raw:i[0],text:i[0].trimRight()};var n=i[0].replace(/^ {4}/gm,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?n:O(n,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var i=t[0],r=function(e,t){var i=e.match(/^(\s+)(?:```)/);if(null===i)return t;var r=i[1];return t.split("\n").map((function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e})).join("\n")}(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var i={type:"table",header:M(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(i.header.length===i.align.length){var r,n=i.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:i}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){for(var i,r,n,s,o,a,l,c=t[0],u=t[2],h=u.length>1,d=")"===u[u.length-1],f={type:"list",raw:c,ordered:h,start:h?+u.slice(0,-1):"",loose:!1,items:[]},p=t[0].match(this.rules.block.item),g=!1,v=p.length,m=0;m1||this.options.smartLists&&n!==u)&&(s=p.slice(m+1).join("\n"),f.raw=f.raw.substring(0,f.raw.length-s.length),m=v-1)),o=g||/\n\n(?!\s*$)/.test(i),m!==v-1&&(g="\n"===i.charAt(i.length-1),o||(o=g)),o&&(f.loose=!0),l=void 0,(a=/^\[[ xX]\] /.test(i))&&(l=" "!==i[1],i=i.replace(/^\[[ xX]\] +/,"")),f.items.push({type:"list_item",raw:c,task:a,checked:l,loose:o,text:i});return f}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):I(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var i={type:"table",header:M(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(i.header.length===i.align.length){i.raw=t[0];var r,n=i.align.length;for(r=0;r/i.test(r[0])&&(t=!1),!i&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?i=!0:i&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(i=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:i,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):I(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var i=P(t[2],"()");if(i>-1){var r=(0===t[0].indexOf("!")?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,r).trim(),t[3]=""}var n=t[2],s="";if(this.options.pedantic){var o=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);o?(n=o[1],s=o[3]):s=""}else s=t[3]?t[3].slice(1,-1):"";return F(t,{href:(n=n.trim().replace(/^<([\s\S]*)>$/,"$1"))?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){var r=(i[2]||i[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var n=i[0].charAt(0);return{type:"text",raw:n,text:n}}return F(i,r,i[0])}},t.strong=function(e,t,i){void 0===i&&(i="");var r=this.rules.inline.strong.start.exec(e);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);var n,s="**"===r[0]?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(n=this.rules.inline.strong.middle.exec(t.slice(0,r.index+3)))return{type:"strong",raw:e.slice(0,n[0].length),text:e.slice(2,n[0].length-2)}}},t.em=function(e,t,i){void 0===i&&(i="");var r=this.rules.inline.em.start.exec(e);if(r&&(!r[1]||r[1]&&(""===i||this.rules.inline.punctuation.exec(i)))){t=t.slice(-1*e.length);var n,s="*"===r[0]?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;for(s.lastIndex=0;null!=(r=s.exec(t));)if(n=this.rules.inline.em.middle.exec(t.slice(0,r.index+2)))return{type:"em",raw:e.slice(0,n[0].length),text:e.slice(1,n[0].length-1)}}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var i=t[2].replace(/\n/g," "),r=/[^ ]/.test(i),n=i.startsWith(" ")&&i.endsWith(" ");return r&&n&&(i=i.substring(1,i.length-1)),i=I(i,!0),{type:"codespan",raw:t[0],text:i}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[1]}},t.autolink=function(e,t){var i,r,n=this.rules.inline.autolink.exec(e);if(n)return r="@"===n[2]?"mailto:"+(i=I(this.options.mangle?t(n[1]):n[1])):i=I(n[1]),{type:"link",raw:n[0],text:i,href:r,tokens:[{type:"text",raw:i,text:i}]}},t.url=function(e,t){var i;if(i=this.rules.inline.url.exec(e)){var r,n;if("@"===i[2])n="mailto:"+(r=I(this.options.mangle?t(i[0]):i[0]));else{var s;do{s=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])[0]}while(s!==i[0]);r=I(i[0]),n="www."===i[1]?"http://"+r:r}return{type:"link",raw:i[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,i){var r,n=this.rules.inline.text.exec(e);if(n)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):I(n[0]):n[0]:I(this.options.smartypants?i(n[0]):n[0]),{type:"text",raw:n[0],text:r}},e}(),N=x,H=w,j=E,U={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*|\\n*|\\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:N,table:N,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};U.def=H(U.def).replace("label",U._label).replace("title",U._title).getRegex(),U.bullet=/(?:[*+-]|\d{1,9}[.)])/,U.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,U.item=H(U.item,"gm").replace(/bull/g,U.bullet).getRegex(),U.list=H(U.list).replace(/bull/g,U.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+U.def.source+")").getRegex(),U._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",U._comment=//,U.html=H(U.html,"i").replace("comment",U._comment).replace("tag",U._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),U.paragraph=H(U._paragraph).replace("hr",U.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",U._tag).getRegex(),U.blockquote=H(U.blockquote).replace("paragraph",U.paragraph).getRegex(),U.normal=j({},U),U.gfm=j({},U.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*|$)"}),U.gfm.nptable=H(U.gfm.nptable).replace("hr",U.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",U._tag).getRegex(),U.gfm.table=H(U.gfm.table).replace("hr",U.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",U._tag).getRegex(),U.pedantic=j({},U.normal,{html:H("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",U._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:N,paragraph:H(U.normal._paragraph).replace("hr",U.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",U.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var K={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:N,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\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:N,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~"};K.punctuation=H(K.punctuation).replace(/punctuation/g,K._punctuation).getRegex(),K._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",K._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",K.em.start=H(K.em.start).replace(/punctuation/g,K._punctuation).getRegex(),K.em.middle=H(K.em.middle).replace(/punctuation/g,K._punctuation).replace(/overlapSkip/g,K._overlapSkip).getRegex(),K.em.endAst=H(K.em.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.em.endUnd=H(K.em.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.start=H(K.strong.start).replace(/punctuation/g,K._punctuation).getRegex(),K.strong.middle=H(K.strong.middle).replace(/punctuation/g,K._punctuation).replace(/blockSkip/g,K._blockSkip).getRegex(),K.strong.endAst=H(K.strong.endAst,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.strong.endUnd=H(K.strong.endUnd,"g").replace(/punctuation/g,K._punctuation).getRegex(),K.blockSkip=H(K._blockSkip,"g").getRegex(),K.overlapSkip=H(K._overlapSkip,"g").getRegex(),K._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,K._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,K._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])?)+(?![-_])/,K.autolink=H(K.autolink).replace("scheme",K._scheme).replace("email",K._email).getRegex(),K._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,K.tag=H(K.tag).replace("comment",U._comment).replace("attribute",K._attribute).getRegex(),K._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,K._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,K._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,K.link=H(K.link).replace("label",K._label).replace("href",K._href).replace("title",K._title).getRegex(),K.reflink=H(K.reflink).replace("label",K._label).getRegex(),K.reflinkSearch=H(K.reflinkSearch,"g").replace("reflink",K.reflink).replace("nolink",K.nolink).getRegex(),K.normal=j({},K),K.pedantic=j({},K.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:H(/^!?\[(label)\]\((.*?)\)/).replace("label",K._label).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",K._label).getRegex()}),K.gfm=j({},K.normal,{escape:H(K.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]*?(?:(?=[\\.5&&(i="x"+i.toString(16)),r+=""+i+";";return r}var Q=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:z.normal,inline:G.normal};this.options.pedantic?(t.block=z.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=z.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}t.lex=function(e,i){return new t(i).lex(e)};var i,r,n,s=t.prototype;return s.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},s.blockTokens=function(e,t,i){var r,n,s,o;for(void 0===t&&(t=[]),void 0===i&&(i=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((o=t[t.length-1]).raw+="\n"+r.raw,o.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],i),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),s=r.items.length,n=0;n0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(a));)l.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;e;)if(s=this.tokenizer.escape(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.tag(e,i,r))e=e.substring(s.raw.length),i=s.inLink,r=s.inRawBlock,t.push(s);else if(s=this.tokenizer.link(e))e=e.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),t.push(s);else if(s=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(s.raw.length),"link"===s.type&&(s.tokens=this.inlineTokens(s.text,[],!0,r)),t.push(s);else if(s=this.tokenizer.strong(e,a,n))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.em(e,a,n))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.codespan(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.br(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.del(e))e=e.substring(s.raw.length),s.tokens=this.inlineTokens(s.text,[],i,r),t.push(s);else if(s=this.tokenizer.autolink(e,q))e=e.substring(s.raw.length),t.push(s);else if(i||!(s=this.tokenizer.url(e,q))){if(s=this.tokenizer.inlineText(e,r,V))e=e.substring(s.raw.length),n=s.raw.slice(-1),t.push(s);else if(e){var c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}throw new Error(c)}}else e=e.substring(s.raw.length),t.push(s);return t},i=t,n=[{key:"rules",get:function(){return{block:z,inline:G}}}],(r=null)&&e(i.prototype,r),n&&e(i,n),t}(),Y=r.defaults,Z=k,$=S,J=function(){function e(e){this.options=e||Y}var t=e.prototype;return t.code=function(e,t,i){var r=(t||"").match(/\S*/)[0];if(this.options.highlight){var n=this.options.highlight(e,r);null!=n&&n!==e&&(i=!0,e=n)}return r?''+(i?e:$(e,!0))+"
\n":""+(i?e:$(e,!0))+"
\n"},t.blockquote=function(e){return"\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,i,r){return this.options.headerIds?"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,i){var r=t?"ol":"ul";return"<"+r+(t&&1!==i?' start="'+i+'"':"")+">\n"+e+""+r+">\n"},t.listitem=function(e){return""+e+"\n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return""+e+"
\n"},t.table=function(e,t){return t&&(t=""+t+""),"\n"},t.tablerow=function(e){return"\n"+e+"
\n"},t.tablecell=function(e,t){var i=t.header?"th":"td";return(t.align?"<"+i+' align="'+t.align+'">':"<"+i+">")+e+""+i+">\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
":"
"},t.del=function(e){return""+e+""},t.link=function(e,t,i){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return i;var r='"+i+""},t.image=function(e,t,i){if(null===(e=Z(this.options.sanitize,this.options.baseUrl,e)))return i;var r='
":">"},t.text=function(e){return e},e}(),ee=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,i){return""+i},t.image=function(e,t,i){return""+i},t.br=function(){return""},e}(),te=function(){function e(){this.seen={}}return e.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var i=t;do{this.seen[i]++,t=i+"-"+this.seen[i]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t},e}(),ie=r.defaults,re=C,ne=function(){function e(e){this.options=e||ie,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ee,this.slugger=new te}e.parse=function(t,i){return new e(i).parse(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var i,r,n,s,o,a,l,c,u,h,d,f,p,g,v,m,y,_,b="",S=e.length;for(i=0;i0&&"text"===v.tokens[0].type?(v.tokens[0].text=_+" "+v.tokens[0].text,v.tokens[0].tokens&&v.tokens[0].tokens.length>0&&"text"===v.tokens[0].tokens[0].type&&(v.tokens[0].tokens[0].text=_+" "+v.tokens[0].tokens[0].text)):v.tokens.unshift({type:"text",text:_}):g+=_),g+=this.parse(v.tokens,p),u+=this.renderer.listitem(g,y,m);b+=this.renderer.list(u,d,f);continue;case"html":b+=this.renderer.html(h.text);continue;case"paragraph":b+=this.renderer.paragraph(this.parseInline(h.tokens));continue;case"text":for(u=h.tokens?this.parseInline(h.tokens):h.text;i+1An error occurred:"+ae(e.message+"",!0)+"
";throw e}}return he.options=he.setOptions=function(e){return se(he.defaults,e),ce(he.defaults),he},he.getDefaults=le,he.defaults=ue,he.use=function(e){var t=se({},e);if(e.renderer&&function(){var i=he.defaults.renderer||new J,r=function(t){var r=i[t];i[t]=function(){for(var n=arguments.length,s=new Array(n),o=0;o0||o.target.offsetWidth>0){var a=p(o.target.offsetWidth,o.target.offsetHeight,e),c=Object(n.a)(a,2),u=c[0],h=c[1];console.log("cols, rows",u,h),d.a.publish("ssh-xterm-resize",{columns:u,rows:h,width:o.target.offsetWidth,height:o.target.offsetHeight}),e.resize(u,h);var f=l.Base64.decode("IA=="),g=l.Base64.decode("CBtbSw==");e.write(f),e.write(g)}}}catch(e){r.e(e)}finally{r.f()}}));return i.observe(t),i}(e,S.current);return function(){e.dispose(),t.unobserve(S.current)}}}),[y,S.current]),Object(o.useEffect)((function(){if(v&&y){var e=setInterval((function(){C.current&&C.current.send(JSON.stringify({tp:"h"}))}),3e4),n=d.a.subscribe("create-socket",(function(n){var s;i==n&&(C.current&&1===C.current.readyState?v.focus():(s=new WebSocket(y),C.current=s,s.onopen=function(){var e=v.element.parentElement;if(e){var i=e.offsetWidth,n=e.offsetHeight;console.log("init",{tp:"init",data:Object(r.a)(Object(r.a)({},t),{},{secret:_,width:i,height:n,rows:v.rows,columns:v.cols})}),s.send(JSON.stringify({tp:"init",data:Object(r.a)(Object(r.a)({},t),{},{secret:_,width:i,height:n,rows:v.rows,columns:v.cols})}))}v.focus()},s.onerror=function(e){console.log("------in socket error----",e,s,y)},s.onmessage=function(e){w.current||(v.write("\r"),setTimeout((function(){}),1e3)),w.current=!0,console.log("event:",e);var t=l.Base64.decode(e.data.toString()),i=v._core._renderService.dimensions.actualCellWidth||9.5;console.log("data:",t,i,v),v.write(t)},s.onclose=function(t){e&&clearInterval(e),v.write("\r\nconnection closed")}),v.focus())})),s=d.a.subscribe("close-socket",(function(e){i===e&&(C.current&&(C.current.close(),w.current=!1,v.clear()),C.current=null)})),o=d.a.subscribe("ssh-xterm-resize",(function(e){C.current&&1===C.current.readyState&&C.current.send(JSON.stringify({tp:"resize",data:Object(r.a)({},e)}))})),a=d.a.subscribe("ssh-add-connect-time",(function(){C.current&&1===C.current.readyState&&C.current.send(JSON.stringify({tp:"overtime"}))}));return function(){s(),n(),o(),a(),C.current&&(C.current.close(),w.current=!1)}}}),[v,y,b]),a.a.createElement("div",{ref:S,className:h.a["xterm-panel"]},y?null:a.a.createElement("p",{style:{color:"#fff"}},"正在连接命令行服务..."))}},ELLl:
/*!*************************************************************!*\
!*** ./node_modules/codemirror/addon/edit/closebrackets.js ***!
\*************************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){!function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},i=e.Pos;function r(e,i){return"pairs"==i&&"string"==typeof e?e:"object"==typeof e&&null!=e[i]?e[i]:t[i]}e.defineOption("autoCloseBrackets",!1,(function(t,i,o){o&&o!=e.Init&&(t.removeKeyMap(n),t.state.closeBrackets=null),i&&(s(r(i,"pairs")),t.state.closeBrackets=i,t.addKeyMap(n))}));var n={Backspace:function(t){var n=a(t);if(!n||t.getOption("disableInput"))return e.Pass;for(var s=r(n,"pairs"),o=t.listSelections(),c=0;c=0;c--){var h=o[c].head;t.replaceRange("",i(h.line,h.ch-1),i(h.line,h.ch+1),"+delete")}},Enter:function(t){var i=a(t),n=i&&r(i,"explode");if(!n||t.getOption("disableInput"))return e.Pass;for(var s=t.listSelections(),o=0;o1&&d.indexOf(n)>=0&&t.getRange(i(_.line,_.ch-2),_)==n+n){if(_.ch>2&&/\bstring/.test(t.getTokenTypeAt(i(_.line,_.ch-2))))return e.Pass;m="addFour"}else if(f){var S=0==_.ch?" ":t.getRange(i(_.line,_.ch-1),_);if(e.isWordChar(b)||S==n||e.isWordChar(S))return e.Pass;m="both"}else{if(!g||!(0===b.length||/\s/.test(b)||h.indexOf(b)>-1))return e.Pass;m="both"}else m=f&&c(t,_)?"both":d.indexOf(n)>=0&&t.getRange(_,i(_.line,_.ch+3))==n+n+n?"skipThree":"skip";if(u){if(u!=m)return e.Pass}else u=m}var C=l%2?o.charAt(l-1):n,w=l%2?n:o.charAt(l+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var n=t.getSelections();for(r=0;r0,{anchor:new i(s.anchor.line,s.anchor.ch+(o?-1:1)),head:new i(s.head.line,s.head.ch+(o?1:-1))});t.setSelections(n)}else"both"==u?(t.replaceSelection(C+w,null),t.triggerElectric(C+w),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(C+C+C+C,"before"),t.execCommand("goCharRight"));var s,o}))}(n,t)}}function a(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var r=e.getRange(i(t.line,t.ch-1),i(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(i(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}s(t.pairs+"`")}(i(/*! ../../lib/codemirror */"VrN/"))},"ER/M":
/*!********************************************************!*\
!*** ./src/pages/tasks/xterm-panel/index.less?modules ***!
\********************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){e.exports={"xterm-panel":"xterm-panel___2r2xx"}},Fv0C:
/*!*********************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/input/keyboard.js ***!
\*********************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,s=h(i(/*! ../util/logging.js */"Lo0S")),o=i(/*! ../util/events.js */"vewr"),a=h(i(/*! ./util.js */"8CQX")),l=(n=i(/*! ./keysym.js */"mHUz"))&&n.__esModule?n:{default:n},c=h(i(/*! ../util/browser.js */"GdRQ"));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function h(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}return i.default=e,t&&t.set(e,i),i}function d(e,t){for(var i=0;i=48&&e.keyCode<=57)t=e.keyCode;else if(e.keyCode>=65&&e.keyCode<=90){var r=String.fromCharCode(e.keyCode);t=(r=e.shiftKey?r.toUpperCase():r.toLowerCase()).charCodeAt()}else t=0;this._sendKeyEvent(t,i,!0)}}},{key:"_handleKeyUp",value:function(e){(0,o.stopEvent)(e);var t=this._getKeyCode(e);if(this._altGrArmed&&(this._altGrArmed=!1,clearTimeout(this._altGrTimeout),this._sendKeyEvent(l.default.XK_Control_L,"ControlLeft",!0)),(c.isMac()||c.isIOS())&&"CapsLock"===t)return this._sendKeyEvent(l.default.XK_Caps_Lock,"CapsLock",!0),void this._sendKeyEvent(l.default.XK_Caps_Lock,"CapsLock",!1);this._sendKeyEvent(this._keyDownList[t],t,!1),!c.isWindows()||"ShiftLeft"!==t&&"ShiftRight"!==t||("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(l.default.XK_Control_L,"ControlLeft",!0)}},{key:"_allKeysUp",value:function(){for(var e in s.Debug(">> Keyboard.allKeysUp"),this._keyDownList)this._sendKeyEvent(this._keyDownList[e],e,!1);s.Debug("<< Keyboard.allKeysUp")}},{key:"_checkAlt",value:function(e){if(!e.skipCheckAlt&&!e.altKey){var t=this._target,i=this._keyDownList;["AltLeft","AltRight"].forEach((function(e){if(e in i){var r=new KeyboardEvent("keyup",{key:i[e],code:e});r.skipCheckAlt=!0,t.dispatchEvent(r)}}))}}},{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 e=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((function(t){return document.addEventListener(t,e,{capture:!0,passive:!0})}))}}},{key:"ungrab",value:function(){if(c.isWindows()&&c.isFirefox()){var e=this._eventHandlers.checkalt;["mousedown","mouseup","mousemove","wheel","touchstart","touchend","touchmove","keydown","keyup"].forEach((function(t){return document.removeEventListener(t,e)}))}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()}}])&&d(t.prototype,i),r&&d(t,r),e}();t.default=f},GQ8N:
/*!***************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/util/int.js ***!
\***************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toUnsigned32bit=function(e){return e>>>0},t.toSigned32bit=function(e){return 0|e}},GdRQ:
/*!*******************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/util/browser.js ***!
\*******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isMac=function(){return navigator&&!!/mac/i.exec(navigator.platform)},t.isWindows=function(){return navigator&&!!/win/i.exec(navigator.platform)},t.isIOS=function(){return navigator&&(!!/ipad/i.exec(navigator.platform)||!!/iphone/i.exec(navigator.platform)||!!/ipod/i.exec(navigator.platform))},t.isSafari=function(){return navigator&&-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")},t.isIE=function(){return navigator&&!!/trident/i.exec(navigator.userAgent)},t.isEdge=function(){return navigator&&!!/edge/i.exec(navigator.userAgent)},t.isFirefox=function(){return navigator&&!!/firefox/i.exec(navigator.userAgent)},t.hasScrollbarGutter=t.supportsImageMetadata=t.supportsCursorURIs=t.dragThreshold=t.isTouchDevice=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var o="ontouchstart"in document.documentElement||void 0!==document.ontouchstart||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0;t.isTouchDevice=o,window.addEventListener("touchstart",(function e(){t.isTouchDevice=o=!0,window.removeEventListener("touchstart",e,!1)}),!1);var a=10*(window.devicePixelRatio||1);t.dragThreshold=a;var l=!1;try{var c=document.createElement("canvas");c.style.cursor='url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default',0===c.style.cursor.indexOf("url")?(n.Info("Data URI scheme cursor supported"),l=!0):n.Warn("Data URI scheme cursor not supported")}catch(e){n.Error("Data URI scheme cursor test exception: "+e)}var u=l;t.supportsCursorURIs=u;var h=!1;try{new ImageData(new Uint8ClampedArray(4),1,1),h=!0}catch(e){}var d=h;t.supportsImageMetadata=d;var f=!0;try{var p=document.createElement("div");p.style.visibility="hidden",p.style.overflow="scroll",document.body.appendChild(p);var g=document.createElement("div");p.appendChild(g);var v=p.offsetWidth-g.offsetWidth;p.parentNode.removeChild(p),f=0!=v}catch(e){n.Error("Scrollbar test exception: "+e)}var m=f;t.hasScrollbarGutter=m},Gytx:
/*!********************************************!*\
!*** ./node_modules/shallowequal/index.js ***!
\********************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){e.exports=function(e,t,i,r){var n=i?i.call(r,e,t):void 0;if(void 0!==n)return!!n;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;lthis.chunkSize&&(this.chunkSize=e,this.strm.output=new Uint8Array(this.chunkSize)),this.strm.next_out=0,this.strm.avail_out=e,(0,n.inflate)(this.strm,0)<0)throw new Error("zlib inflate failed");if(this.strm.next_out!=e)throw new Error("Incomplete zlib block");return new Uint8Array(this.strm.output.buffer,0,this.strm.next_out)}},{key:"reset",value:function(){(0,n.inflateReset)(this.strm)}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},IxHN:
/*!******************************************!*\
!*** ./src/components/Spinner/index.tsx ***!
\******************************************/
/*! exports provided: default */
/*! exports used: default */function(e,t,i){"use strict";var r=i(/*! react */"q1tI"),n=i.n(r),s=i(/*! ./index.less?modules */"07cG"),o=i.n(s);t.a=function(e){var t=e.message,i=e.className,r=e.children,s=e.style,a=void 0===s?{}:s;return n.a.createElement("div",{className:"".concat(o.a.idsRingWrapper," ").concat(i)},n.a.createElement("div",{className:o.a.ldsRing},n.a.createElement("div",null),n.a.createElement("div",null),n.a.createElement("div",null),n.a.createElement("div",null)),t?n.a.createElement("p",{style:a},t):null,r)}},J66h:
/*!******************************************!*\
!*** ./node_modules/js-base64/base64.js ***!
\******************************************/
/*! no static exports found */
/*! exports used: Base64 */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){(function(i){var r;!function(i,n){e.exports=function(i){"use strict";var n,s=(i=i||{}).Base64,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=function(e){for(var t={},i=0,r=e.length;i>>6)+l(128|63&t):l(224|t>>>12&15)+l(128|t>>>6&63)+l(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return l(240|t>>>18&7)+l(128|t>>>12&63)+l(128|t>>>6&63)+l(128|63&t)},u=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,h=function(e){return e.replace(u,c)},d=function(e){var t=[0,2,1][e.length%3],i=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[o.charAt(i>>>18),o.charAt(i>>>12&63),t>=2?"=":o.charAt(i>>>6&63),t>=1?"=":o.charAt(63&i)].join("")},f=i.btoa&&"function"==typeof i.btoa?function(e){return i.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,d)},p=function(e){return f(h(String(e)))},g=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},v=function(e,t){return t?g(p(e)):p(e)};i.Uint8Array&&(n=function(e,t){for(var i="",r=0,n=e.length;r>>18)+o.charAt(c>>>12&63)+(void 0!==a?o.charAt(c>>>6&63):"=")+(void 0!==l?o.charAt(63&c):"=")}return t?g(i):i});var m,y=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,_=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return l(55296+(t>>>10))+l(56320+(1023&t));case 3:return l((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return l((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},b=function(e){return e.replace(y,_)},S=function(e){var t=e.length,i=t%4,r=(t>0?a[e.charAt(0)]<<18:0)|(t>1?a[e.charAt(1)]<<12:0)|(t>2?a[e.charAt(2)]<<6:0)|(t>3?a[e.charAt(3)]:0),n=[l(r>>>16),l(r>>>8&255),l(255&r)];return n.length-=[0,0,2,1][i],n.join("")},C=i.atob&&"function"==typeof i.atob?function(e){return i.atob(e)}:function(e){return e.replace(/\S{1,4}/g,S)},w=function(e){return C(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},k=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},x=function(e){return function(e){return b(C(e))}(k(e))};i.Uint8Array&&(m=function(e){return Uint8Array.from(w(k(e)),(function(e){return e.charCodeAt(0)}))});var E=function(){var e=i.Base64;return i.Base64=s,e};if(i.Base64={VERSION:"2.6.4",atob:w,btoa:f,fromBase64:x,toBase64:v,utob:h,encode:v,encodeURI:function(e){return v(e,!0)},btou:b,decode:x,noConflict:E,fromUint8Array:n,toUint8Array:m},"function"==typeof Object.defineProperty){var T=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};i.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",T((function(){return x(this)}))),Object.defineProperty(String.prototype,"toBase64",T((function(e){return v(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",T((function(){return v(this,!0)})))}}i.Meteor&&(Base64=i.Base64);e.exports?e.exports.Base64=i.Base64:void 0===(r=function(){return i.Base64}.apply(t,[]))||(e.exports=r);return{Base64:i.Base64}}(i)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:this)}).call(this,i(/*! ./../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},JSwD:
/*!************************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/inftrees.js ***!
\************************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,i,r,s,u,h,d){var f,p,g,v,m,y,_,b,S,C=d.bits,w=0,k=0,x=0,E=0,T=0,L=0,A=0,R=0,D=0,O=0,M=null,I=0,P=new n.Buf16(16),F=new n.Buf16(16),B=null,N=0;for(w=0;w<=15;w++)P[w]=0;for(k=0;k=1&&0===P[E];E--);T>E&&(T=E);if(0===E)return s[u++]=20971520,s[u++]=20971520,d.bits=1,0;for(x=1;x0&&(0===e||1!==E))return-1;for(F[1]=0,w=1;w<15;w++)F[w+1]=F[w]+P[w];for(k=0;k852||2===e&&D>592)return 1;for(;;){_=w-A,h[k]y?(b=B[N+h[k]],S=M[I+h[k]]):(b=96,S=0),f=1<>A)+(p-=f)]=_<<24|b<<16|S|0}while(0!==p);for(f=1<>=1;if(0!==f?(O&=f-1,O+=f):O=0,k++,0==--P[w]){if(w===E)break;w=t[i+h[k]]}if(w>T&&(O&v)!==g){for(0===A&&(A=T),m+=x,R=1<<(L=w-A);L+A852||2===e&&D>592)return 1;s[g=O&v]=T<<24|L<<16|m-u|0}}0!==O&&(s[m+O]=w-A<<24|64<<16|0);return d.bits=T,0};var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ../utils/common.js */"6BzB"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var 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],a=[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],l=[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],c=[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]},LCi9:
/*!***************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/input/gesturehandler.js ***!
\***************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e,t){for(var i=0;i0&&Date.now()-this._tracked[0].started>250)return this._state=0,void this._ignored.push(e);if(this._waitingRelease)return this._state=0,void this._ignored.push(e);switch(this._tracked.push({id:e,started:Date.now(),active:!0,firstX:t,firstY:i,lastX:t,lastY:i,angle:0}),this._tracked.length){case 1:this._startLongpressTimeout();break;case 2:this._state&=-26,this._stopLongpressTimeout();break;case 3:this._state&=-99;break;default:this._state=0}}}},{key:"_touchMove",value:function(e,t,i){var r=this._tracked.find((function(t){return t.id===e}));if(void 0!==r){r.lastX=t,r.lastY=i;var n=t-r.firstX,s=i-r.firstY;if(r.firstX===r.lastX&&r.firstY===r.lastY||(r.angle=180*Math.atan2(s,n)/Math.PI),!this._hasDetectedGesture()){if(Math.hypot(n,s)<50)return;if(this._state&=-24,this._stopLongpressTimeout(),1!==this._tracked.length&&(this._state&=-9),2!==this._tracked.length&&(this._state&=-97),2===this._tracked.length){var o=this._tracked.find((function(t){return t.id!==e}));if(Math.hypot(o.firstX-o.lastX,o.firstY-o.lastY)>50){var a=Math.abs(r.angle-o.angle);a=Math.abs((a+180)%360-180),this._state&=a>90?-33:-65,this._isTwoTouchTimeoutRunning()&&this._stopTwoTouchTimeout()}else this._isTwoTouchTimeoutRunning()||this._startTwoTouchTimeout()}if(!this._hasDetectedGesture())return;this._pushEvent("gesturestart")}this._pushEvent("gesturemove")}}},{key:"_touchEnd",value:function(e,t,i){if(-1!==this._ignored.indexOf(e))return this._ignored.splice(this._ignored.indexOf(e),1),void(0===this._ignored.length&&0===this._tracked.length&&(this._state=127,this._waitingRelease=!1));if(!this._hasDetectedGesture()&&this._isTwoTouchTimeoutRunning()&&(this._stopTwoTouchTimeout(),this._state=0),!this._hasDetectedGesture()&&(this._state&=-105,this._state&=-17,this._stopLongpressTimeout(),!this._waitingRelease))switch(this._releaseStart=Date.now(),this._waitingRelease=!0,this._tracked.length){case 1:this._state&=-7;break;case 2:this._state&=-6}if(this._waitingRelease)if(Date.now()-this._releaseStart>250&&(this._state=0),this._tracked.some((function(e){return Date.now()-e.started>1e3}))&&(this._state=0),this._tracked.find((function(t){return t.id===e})).active=!1,this._hasDetectedGesture())this._pushEvent("gesturestart");else if(0!==this._state)return;this._hasDetectedGesture()&&this._pushEvent("gestureend");for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:1,i=O.length,r=0;r1&&void 0!==arguments[1]&&arguments[1];return Object(x.a)(e).map((function(e,i){if(!a.isValidElement(e)||!e.type)return null;var r=e.type.isSelectOptGroup,n=e.key,s=e.props,o=s.children,l=Object(c.a)(s,["children"]);return t||!r?E(e):Object(k.a)(Object(k.a)({key:"__RC_SELECT_GRP__".concat(null===n?i:n,"__"),label:n},l),{},{options:T(o)})})).filter((function(e){return e}))}var L=i("2Qr1"),A=i("qNPg"),R=i("U8pU"),D=i("Kwbf"),O=i("WKfj");var M=function(e){var t=e.mode,i=e.options,r=e.children,n=e.backfill,s=e.allowClear,o=e.placeholder,l=e.getInputElement,c=e.showSearch,u=e.onSearch,h=e.defaultOpen,d=e.autoFocus,f=e.labelInValue,p=e.value,g=e.inputValue,v=e.optionLabelProp,m="multiple"===t||"tags"===t,y=void 0!==c?c:m||"combobox"===t,_=i||T(r);if(Object(D.a)("tags"!==t||_.every((function(e){return!e.disabled})),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),"tags"===t||"combobox"===t){var b=_.some((function(e){return e.options?e.options.some((function(e){return"number"==typeof("value"in e?e.value:e.key)})):"number"==typeof("value"in e?e.value:e.key)}));Object(D.a)(!b,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(D.a)("combobox"!==t||!v,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(D.a)("combobox"===t||!n,"`backfill` only works with `combobox` mode."),Object(D.a)("combobox"===t||!l,"`getInputElement` only work with `combobox` mode."),Object(D.b)("combobox"!==t||!l||!s||!o,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),u&&!y&&"combobox"!==t&&"tags"!==t&&Object(D.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(D.b)(!h||d,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),null!=p){var S=Object(O.d)(p);Object(D.a)(!f||S.every((function(e){return"object"===Object(R.a)(e)&&("key"in e||"value"in e)})),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(D.a)(!m||Array.isArray(p),"`value` should be array when `mode` is `multiple` or `tags`")}if(r){var C=null;Object(x.a)(r).some((function(e){if(!a.isValidElement(e)||!e.type)return!1;var t=e.type;return!t.isSelectOption&&(t.isSelectOptGroup?!Object(x.a)(e.props.children).every((function(t){return!(a.isValidElement(t)&&e.type&&!t.type.isSelectOption)||(C=t.type,!1)})):(C=t,!0))})),C&&Object(D.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(C.displayName||C.name||C,"`.")),Object(D.a)(void 0===g,"`inputValue` is deprecated, please use `searchValue` instead.")}},I=Object(A.a)({prefixCls:"rc-select",components:{optionList:_},convertChildrenToData:T,flattenOptions:L.d,getLabeledValue:L.e,filterOptions:L.b,isValueDisabled:L.g,findValueOption:L.c,warningProps:M,fillOptionsWithMissingValue:L.a}),P=function(e){Object(s.a)(i,e);var t=Object(o.a)(i);function i(){var e;return Object(r.a)(this,i),(e=t.apply(this,arguments)).selectRef=a.createRef(),e.focus=function(){e.selectRef.current.focus()},e.blur=function(){e.selectRef.current.blur()},e}return Object(n.a)(i,[{key:"render",value:function(){return a.createElement(I,Object.assign({ref:this.selectRef},this.props))}}]),i}(a.Component);P.Option=S,P.OptGroup=w;var F=P;t.c=F},Lmeb:
/*!*********************************************!*\
!*** ./src/pages/tasks/vnc-view/index.less ***!
\*********************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){},Lo0S:
/*!*******************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/util/logging.js ***!
\*******************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initLogging=l,t.getLogging=function(){return r},t.Error=t.Warn=t.Info=t.Debug=void 0;var r="warn",n=function(){};t.Debug=n;var s=function(){};t.Info=s;var o=function(){};t.Warn=o;var a=function(){};function l(e){if(void 0===e?e=r:r=e,t.Debug=n=t.Info=s=t.Warn=o=t.Error=a=function(){},void 0!==window.console)switch(e){case"debug":t.Debug=n=console.debug.bind(window.console);case"info":t.Info=s=console.info.bind(window.console);case"warn":t.Warn=o=console.warn.bind(window.console);case"error":t.Error=a=console.error.bind(window.console);case"none":break;default:throw new window.Error("invalid logging type '"+e+"'")}}t.Error=a,l()},M8RZ:
/*!**********************************!*\
!*** ./src/components/modal.tsx ***!
\**********************************/
/*! exports provided: default */
/*! exports used: default */function(e,t,i){"use strict";i.d(t,"a",(function(){return u}));var r=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */"fWQN"),n=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */"mtLc"),s=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */"yKVA"),o=i(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */"879j"),a=i(/*! react */"q1tI"),l=i.n(a),c=i(/*! react-dom */"i8i4"),u=function(e){Object(s.a)(i,e);var t=Object(o.a)(i);function i(e){var n;Object(r.a)(this,i),n=t.call(this,e);var s=window.document;return n.node=s.createElement("div"),s.body.appendChild(n.node),n}return Object(n.a)(i,[{key:"render",value:function(){var e=this.props.children;return Object(c.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),i}(l.a.Component)},MZdM:
/*!**************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/display.js ***!
\**************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var o=n?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(i,s,o):i[s]=e[s]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S")),o=(n=i(/*! ./base64.js */"N/zr"))&&n.__esModule?n:{default:n},a=i(/*! ./util/browser.js */"GdRQ"),l=i(/*! ./util/int.js */"GQ8N");function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function u(e,t){for(var i=0;i> Display.constructor"),this._target=t,!this._target)throw new Error("Target must be set");if("string"==typeof this._target)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},s.Debug("User Agent: "+navigator.userAgent),!("createImageData"in this._drawCtx))throw new Error("Canvas does not support createImageData");this._tile16x16=this._drawCtx.createImageData(16,16),s.Debug("<< Display.constructor"),this._scale=1,this._clipViewport=!1,this.onflush=function(){}}var t,i,r;return t=e,(i=[{key:"viewportChangePos",value:function(e,t){var i=this._viewportLoc;e=Math.floor(e),t=Math.floor(t),this._clipViewport||(e=-i.w,t=-i.h);var r=i.x+i.w-1,n=i.y+i.h-1;e<0&&i.x+e<0&&(e=-i.x),r+e>=this._fbWidth&&(e-=r+e-this._fbWidth+1),i.y+t<0&&(t=-i.y),n+t>=this._fbHeight&&(t-=n+t-this._fbHeight+1),0===e&&0===t||(s.Debug("viewportChange deltaX: "+e+", deltaY: "+t),i.x+=e,i.y+=t,this._damage(i.x,i.y,i.w,i.h),this.flip())}},{key:"viewportChangeSize",value:function(e,t){this._clipViewport&&void 0!==e&&void 0!==t||(s.Debug("Setting viewport to full display region"),e=this._fbWidth,t=this._fbHeight),e=Math.floor(e),t=Math.floor(t),e>this._fbWidth&&(e=this._fbWidth),t>this._fbHeight&&(t=this._fbHeight);var i=this._viewportLoc;if(i.w!==e||i.h!==t){i.w=e,i.h=t;var r=this._target;r.width=e,r.height=t,this.viewportChangePos(0,0),this._damage(i.x,i.y,i.w,i.h),this.flip(),this._rescale(this._scale)}}},{key:"absX",value:function(e){return 0===this._scale?0:(0,l.toSigned32bit)(e/this._scale+this._viewportLoc.x)}},{key:"absY",value:function(e){return 0===this._scale?0:(0,l.toSigned32bit)(e/this._scale+this._viewportLoc.y)}},{key:"resize",value:function(e,t){this._prevDrawStyle="",this._fbWidth=e,this._fbHeight=t;var i=this._backbuffer;if(i.width!==e||i.height!==t){var r=null;i.width>0&&i.height>0&&(r=this._drawCtx.getImageData(0,0,i.width,i.height)),i.width!==e&&(i.width=e),i.height!==t&&(i.height=t),r&&this._drawCtx.putImageData(r,0,0)}var n=this._viewportLoc;this.viewportChangeSize(n.w,n.h),this.viewportChangePos(0,0)}},{key:"_damage",value:function(e,t,i,r){ethis._damageBounds.right&&(this._damageBounds.right=e+i),t+r>this._damageBounds.bottom&&(this._damageBounds.bottom=t+r)}},{key:"flip",value:function(e){if(0===this._renderQ.length||e){var t=this._damageBounds.left,i=this._damageBounds.top,r=this._damageBounds.right-t,n=this._damageBounds.bottom-i,s=t-this._viewportLoc.x,o=i-this._viewportLoc.y;s<0&&(r+=s,t-=s,s=0),o<0&&(n+=o,i-=o,o=0),s+r>this._viewportLoc.w&&(r=this._viewportLoc.w-s),o+n>this._viewportLoc.h&&(n=this._viewportLoc.h-o),r>0&&n>0&&this._targetCtx.drawImage(this._backbuffer,t,i,r,n,s,o,r,n),this._damageBounds.left=this._damageBounds.top=65535,this._damageBounds.right=this._damageBounds.bottom=0}else this._renderQPush({type:"flip"})}},{key:"pending",value:function(){return this._renderQ.length>0}},{key:"flush",value:function(){0===this._renderQ.length?this.onflush():this._flushing=!0}},{key:"fillRect",value:function(e,t,i,r,n,s){0===this._renderQ.length||s?(this._setFillColor(n),this._drawCtx.fillRect(e,t,i,r),this._damage(e,t,i,r)):this._renderQPush({type:"fill",x:e,y:t,width:i,height:r,color:n})}},{key:"copyImage",value:function(e,t,i,r,n,s,o){0===this._renderQ.length||o?(this._drawCtx.mozImageSmoothingEnabled=!1,this._drawCtx.webkitImageSmoothingEnabled=!1,this._drawCtx.msImageSmoothingEnabled=!1,this._drawCtx.imageSmoothingEnabled=!1,this._drawCtx.drawImage(this._backbuffer,e,t,n,s,i,r,n,s),this._damage(i,r,n,s)):this._renderQPush({type:"copy",oldX:e,oldY:t,x:i,y:r,width:n,height:s})}},{key:"imageRect",value:function(e,t,i,r,n,s){if(0!==i&&0!==r){var a=new Image;a.src="data: "+n+";base64,"+o.default.encode(s),this._renderQPush({type:"img",img:a,x:e,y:t,width:i,height:r})}}},{key:"startTile",value:function(e,t,i,r,n){this._tileX=e,this._tileY=t,this._tile=16===i&&16===r?this._tile16x16:this._drawCtx.createImageData(i,r);for(var s=n[2],o=n[1],a=n[0],l=this._tile.data,c=0;c=n?e/r.w:t/r.h}this._rescale(i)}},{key:"_rescale",value:function(e){this._scale=e;var t=this._viewportLoc,i=e*t.w+"px",r=e*t.h+"px";this._target.style.width===i&&this._target.style.height===r||(this._target.style.width=i,this._target.style.height=r)}},{key:"_setFillColor",value:function(e){var t="rgb("+e[2]+","+e[1]+","+e[0]+")";t!==this._prevDrawStyle&&(this._drawCtx.fillStyle=t,this._prevDrawStyle=t)}},{key:"_rgbImageData",value:function(e,t,i,r,n,s){for(var o=this._drawCtx.createImageData(i,r),a=o.data,l=0,c=s;l0;){var t=this._renderQ[0];switch(t.type){case"flip":this.flip(!0);break;case"copy":this.copyImage(t.oldX,t.oldY,t.x,t.y,t.width,t.height,!0);break;case"fill":this.fillRect(t.x,t.y,t.width,t.height,t.color,!0);break;case"blit":this.blitImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"blitRgb":this.blitRgbImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"blitRgbx":this.blitRgbxImage(t.x,t.y,t.width,t.height,t.data,0,!0);break;case"img":if(t.img.complete&&0!==t.img.width&&0!==t.img.height){if(t.img.width!==t.width||t.img.height!==t.height)return void s.Error("Decoded image has incorrect dimensions. Got "+t.img.width+"x"+t.img.height+". Expected "+t.width+"x"+t.height+".");this.drawImage(t.img,t.x,t.y)}else t.img._noVNCDisplay=this,t.img.addEventListener("load",this._resumeRenderQ),e=!1}e&&this._renderQ.shift()}0===this._renderQ.length&&this._flushing&&(this._flushing=!1,this.onflush())}},{key:"scale",get:function(){return this._scale},set:function(e){this._rescale(e)}},{key:"clipViewport",get:function(){return this._clipViewport},set:function(e){this._clipViewport=e;var t=this._viewportLoc;this.viewportChangeSize(t.w,t.h),this.viewportChangePos(0,0)}},{key:"width",get:function(){return this._fbWidth}},{key:"height",get:function(){return this._fbHeight}}])&&u(t.prototype,i),r&&u(t,r),e}();t.default=h},Mmt2:
/*!**************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/websock.js ***!
\**************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}function o(e,t){for(var i=0;i=0;i--)t+=this._rQ[this._rQi++]<<8*i;return t}},{key:"rQshiftStr",value:function(e){void 0===e&&(e=this.rQlen);for(var t="",i=0;i1&&void 0!==arguments[1]?arguments[1]:this.rQlen;return new Uint8Array(this._rQ.buffer,this._rQi+e,t-e)}},{key:"rQwait",value:function(e,t,i){if(this.rQlen0&&this._websocket.readyState===WebSocket.OPEN&&(this._websocket.send(this._encodeMessage()),this._sQlen=0)}},{key:"send",value:function(e){this._sQ.set(e,this._sQlen),this._sQlen+=e.length,this.flush()}},{key:"sendString",value:function(e){this.send(e.split("").map((function(e){return e.charCodeAt(0)})))}},{key:"off",value:function(e){this._eventHandlers[e]=function(){}}},{key:"on",value:function(e,t){this._eventHandlers[e]=t}},{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(e,t){var i=this;this.init(),this._websocket=new WebSocket(e,t),this._websocket.binaryType="arraybuffer",this._websocket.onmessage=this._recvMessage.bind(this),this._websocket.onopen=function(){n.Debug(">> WebSock.onopen"),i._websocket.protocol&&n.Info("Server choose sub-protocol: "+i._websocket.protocol),i._eventHandlers.open(),n.Debug("<< WebSock.onopen")},this._websocket.onclose=function(e){n.Debug(">> WebSock.onclose"),i._eventHandlers.close(e),n.Debug("<< WebSock.onclose")},this._websocket.onerror=function(e){n.Debug(">> WebSock.onerror: "+e),i._eventHandlers.error(e),n.Debug("<< WebSock.onerror: "+e)}}},{key:"close",value:function(){this._websocket&&(this._websocket.readyState!==WebSocket.OPEN&&this._websocket.readyState!==WebSocket.CONNECTING||(n.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(e){var t=8*(this._rQlen-this._rQi+e),i=this._rQbufferSize41943040&&(this._rQbufferSize=41943040,this._rQbufferSize-this.rQlenthis._rQbufferSize-this._rQlen&&this._expandCompactRQ(t.length),this._rQ.set(t,this._rQlen),this._rQlen+=t.length}},{key:"_recvMessage",value:function(e){this._DecodeMessage(e.data),this.rQlen>0?(this._eventHandlers.message(),this._rQlen==this._rQi&&(this._rQlen=0,this._rQi=0)):n.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(e){this._rQi=e}},{key:"rQlen",get:function(){return this._rQlen-this._rQi}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=a},"N/zr":
/*!*************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/base64.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=s();if(t&&t.has(e))return t.get(e);var i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(i,o,a):i[o]=e[o]}i.default=e,t&&t.set(e,i);return i}(i(/*! ./util/logging.js */"Lo0S"));function s(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return s=function(){return e},e}var o={toBase64Table:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),base64Pad:"=",encode:function(e){for(var t="",i=e.length,r=i%3,n=0;n>2],t+=this.toBase64Table[((3&e[n])<<4)+(e[n+1]>>4)],t+=this.toBase64Table[((15&e[n+1])<<2)+(e[n+2]>>6)],t+=this.toBase64Table[63&e[n+2]];var s=i-r;return 2===r?(t+=this.toBase64Table[e[s]>>2],t+=this.toBase64Table[((3&e[s])<<4)+(e[s+1]>>4)],t+=this.toBase64Table[(15&e[s+1])<<2],t+=this.toBase64Table[64]):1===r&&(t+=this.toBase64Table[e[s]>>2],t+=this.toBase64Table[(3&e[s])<<4],t+=this.toBase64Table[64],t+=this.toBase64Table[64]),t},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(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.indexOf("=")-t;i<0&&(i=e.length-t);for(var r=3*(i>>2)+Math.floor(i%4/1.5),s=new Array(r),o=0,a=0,l=0,c=t;c=8&&(o-=8,h||(s[l++]=a>>o&255),a&=(1<=0?"Cmd":"Ctrl",J=["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"],ee=(H={},Object(l.a)(H,$+"-B","bold"),Object(l.a)(H,$+"-I","italic"),H),te=(j={},Object(l.a)(j,"link","添加链接"),Object(l.a)(j,"code-block","添加代码块"),Object(l.a)(j,"upload-image","添加文件"),Object(l.a)(j,"add-table","添加表格"),j);t.a=function(e){var t=e.defaultValue,i=void 0===t?"":t,c=e.onChange,f=e.width,y=void 0===f?"100%":f,_=e.height,S=void 0===_?400:_,C=e.miniToolbar,x=void 0!==C&&C,E=e.isFocus,T=void 0!==E&&E,L=e.watch,D=e.insertTemp,O=e.mode,M=void 0===O?"markdown":O,I=e.id,P=void 0===I?"markdown-editor-id":I,B=e.showResizeBar,H=void 0!==B&&B,j=e.noStorage,U=void 0!==j&&j,K=e.showNullButton,X=void 0!==K&&K,W=e.hidetoolBar,q=void 0!==W&&W,$=e.fullScreen,ie=void 0!==$&&$,re=e.onBlur,ne=e.onCMBeforeChange,se=e.onFullScreen,oe=e.className,ae=void 0===oe?"":oe,le=e.disablePaste,ce=void 0!==le&&le,ue=e.placeholder,he=void 0===ue?"":ue,de=e.values,fe=void 0===de?"":de,pe=Object(h.useState)(null),ge=Object(a.a)(pe,2),ve=ge[0],me=ge[1],ye=Object(h.useState)(i),_e=Object(a.a)(ye,2),be=_e[0],Se=_e[1],Ce=Object(h.useState)(L),we=Object(a.a)(Ce,2),ke=we[0],xe=we[1],Ee=Object(h.useState)(ie),Te=Object(a.a)(Ee,2),Le=Te[0],Ae=Te[1],Re=Object(h.useState)(""),De=Object(a.a)(Re,2),Oe=De[0],Me=De[1],Ie=Object(h.useState)(0),Pe=Object(a.a)(Ie,2),Fe=Pe[0],Be=Pe[1],Ne=Object(h.useState)(S),He=Object(a.a)(Ne,2),je=He[0],Ue=He[1],Ke=Object(h.useState)(!1),Xe=Object(a.a)(Ke,2),We=(Xe[0],Xe[1]),ze=Object(h.useRef)(Object(V.a)()),Ge=Object(h.useRef)(!1),Ve=Object(h.useRef)(),qe=Object(h.useRef)(),Qe=Object(h.useRef)(),Ye=Object(h.useRef)(),Ze=Object(h.useRef)(),$e=function(){var e=Object(o.a)(u.a.mark((function e(){var t,i;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(G.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ze.current}});case 2:null!=(i=e.sent)&&null!==(t=i.attachments)&&void 0!==t&&t.length&&(console.log("cm:",ve,qe),i.attachments.map((function(e){e.content_type.indexOf("image")>-1?ve.replaceSelection(".concat(e.content_type,")")):e.content_type.indexOf("video")>-1?ve.replaceSelection('')):e.content_type.indexOf("pdf")>-1?ve.replaceSelection('').concat(e.name,"")):ve.replaceSelection("[".concat(e.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(h.useEffect)((function(){Se(fe),null==ve||ve.setValue(fe)}),[fe]),Object(h.useEffect)((function(){null==se||se(Le)}),[Le]),Object(h.useEffect)((function(){if(qe.current){var e=p.a.fromTextArea(qe.current,{mode:M,lineNumbers:!x,lineWrapping:!0,value:i,autoCloseTags:!0,autoCloseBrackets:!0});function t(t,i){if(!ce){var r=i.clipboardData;if(r){var n=r.types.toString(),o=r.items;if("Files"===n||r.types.indexOf("Files")>-1){if(i.preventDefault(),"stex"==M)return;try{var a,l=o[1];"file"===(null===(a=o[0])||void 0===a?void 0:a.kind)&&(l=o[0]);var c=l.getAsFile(),u=c.name.split(".").pop();N(c,(function(t){var i,r,n;t.id?(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("image"))>-1?e.replaceSelection(".concat(t.content_type,")")):(null==c||null===(r=c.type)||void 0===r?void 0:r.indexOf("video"))>-1?e.replaceSelection('')):(null==c||null===(n=c.type)||void 0===n?void 0:n.indexOf("pdf"))>-1?e.replaceSelection('').concat(c.name,"")):J.includes(u)?e.replaceSelection('').concat(c.name,"")):e.replaceSelection("[".concat(c.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")")):401===(null==t?void 0:t.status)&&(document.location.href="/user/login")}))}catch(i){s.b.warn("请使用chrome浏览器粘贴")}return!0}return!0}return!0}i.preventDefault()}return T&&e.focus(),e.on("paste",t),e.on("dragleave",(function(e,t){Qe.current.classList.remove("mouse-hover-md")})),e.on("dragover",(function(e,t){Qe.current.classList.add("mouse-hover-md")})),e.on("drop",(function(t,i){var r;if(Qe.current.classList.add("mouse-hover-md"),(r=i.dataTransfer.files).length>0){i.preventDefault(),i.stopPropagation();for(var n=function(t){var i=r[t],n=i.name.split(".").pop();N(i,(function(t){var r,s,o;t.id?(null==i||null===(r=i.type)||void 0===r?void 0:r.indexOf("image"))>-1?e.replaceSelection(".concat(t.content_type,")")):(null==i||null===(s=i.type)||void 0===s?void 0:s.indexOf("video"))>-1?e.replaceSelection('')):(null==i||null===(o=i.type)||void 0===o?void 0:o.indexOf("pdf"))>-1?e.replaceSelection('').concat(i.name,"")):J.includes(n)?e.replaceSelection('').concat(i.name,"")):e.replaceSelection("[".concat(i.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(t.id,"?type=").concat(t.content_type,")")):401===(null==t?void 0:t.status)&&(document.location.href="/user/login")}))},s=0;s0||r.target.offsetWidth>0)&&(Je(),ve.setSize("100%","100%"),ve.refresh())}}catch(e){i.e(e)}finally{i.f()}}));return e.observe(qe.current.parentElement),e}();return function(){e.unobserve(qe.current.parentElement)}}}),[ve,Je]),Object(h.useEffect)((function(){if(ve){for(var e=[],t=function(){var t=r[i],n=(s=Object(a.a)(t,2))[0],o=s[1],c=Object(l.a)({},n,(function(){et(o)}));e.push(c),ve.addKeyMap(c)},i=0,r=Object.entries(ee);i0){var e=(new Date).getTime(),t=window.sessionStorage.getItem(P);e>=Fe+1e4&&(!t||t!==be)&&(window.sessionStorage.setItem(P,be),We(!0))}}),1e4),Object(h.useEffect)((function(){xe(L)}),[ve,L]),Object(h.useEffect)((function(){ve&&T&&ve.focus()}),[ve,T]),Object(h.useEffect)((function(){if(ke&&ve){var e=ve.getScrollerElement();function t(e){var t=e.target;if(Ze.current){var i=t.scrollTop/t.scrollHeight;Ze.current.scrollTop=Ze.current.scrollHeight*i}}return e.addEventListener("scroll",t),function(){e.removeEventListener("scroll",t)}}}),[ve,ke]),Object(h.useEffect)((function(){if(ve&&ne){function e(e,t){ne(e,t)}return ve.on("beforeChange",e),function(){ve.off("beforeChange",e)}}}),[ve,ne]),Object(h.useEffect)((function(){if(ve&&re){function e(){re(ve.getValue())}return ve.on("blur",e),function(){ve.off("blur",e)}}}),[ve,re]),Object(h.useEffect)((function(){if(ve){function e(e){var t=e.getValue();Se(t),Be((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),c&&c(t)}return ve.on("change",e),function(){ve.off("change",e)}}}),[ve,c]),Object(h.useEffect)((function(){ve&&(null==i?(ve.setValue(""),Se("")):i!==ve.getValue()&&(ve.setValue(i),Se(i),ve.setCursor(ve.lineCount(),0)))}),[ve,i]);var et=Object(h.useCallback)((function(e){var t=ve.getCursor(),i=ve.getSelection(),r=i.split("\n");switch(e){case"bold":return ve.replaceSelection("**"+i+"**"),""===i&&ve.setCursor(t.line,t.ch+2),ve.focus();case"italic":return ve.replaceSelection("*"+i+"*"),""===i&&ve.setCursor(t.line,t.ch+1),ve.focus();case"code":return ve.replaceSelection("`"+i+"`"),""===i&&ve.setCursor(t.line,t.ch+1),ve.focus();case"inline-latex":return ve.replaceSelection("`$$"+i+"$$`"),""===i&&ve.setCursor(t.line,t.ch+3),ve.focus();case"latex":return ve.replaceSelection("```latex\n"+i+"\n```"),ve.setCursor(t.line+1,i.length+1),ve.focus();case"line-break":return ve.replaceSelection("
\n"),ve.focus();case"list-ul":return""===i?ve.replaceSelection("- "+i):ve.replaceSelection(r.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),ve.focus();case"list-ol":return""===i?ve.replaceSelection("1. "+i):ve.replaceSelection(r.map((function(e,t){return""===e?"":"".concat(t+1,". ").concat(e)})).join("\n")),ve.focus();case"add-null-ch":return""===i&&ve.setCursor(t.line,t.ch+1),ve.replaceSelection("▁"),ve.focus();case"inster-template-1":return""===i&&ve.setCursor(t.line,t.ch),ve.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),ve.focus();case"eraser":return ve.setValue(""),ve.focus();case"trigger-watch":return xe(!ke),ve.focus();case"trigger-full-screen":return Ae(!Le),ve.focus();case"link":return void Me("link");case"code-block":return void Me("code-block");case"upload-image":return void Me("upload-image");case"add-table":return void Me("add-table");default:throw new Error}}),[ve,ke,Le]),tt=Object(h.useCallback)((function(e){switch(Me(""),Oe){case"link":var t=e.title,i=e.link;return ve.replaceSelection("[".concat(t,"](").concat(i,")")),ve.focus();case"code-block":var r=e.language,n=e.content;return ve.replaceSelection(["```"+r,n,"```"].join("\n")),ve.focus();case"upload-image":var s=e.src,o=e.alt,a=e.name;return s.indexOf("type=image")>-1?ve.replaceSelection(".concat(s,' "').concat(o||"",'" )')):s.indexOf("type=application/pdf")>-1?ve.replaceSelection('').concat(a,"")):ve.replaceSelection('').concat(a,"")),ve.focus();case"add-table":for(var l=e.row,c=e.col,u=e.align,h="\n",d=0;d300&&(r=300),Ue(S+r+"px")}}return e.addEventListener("mousedown",r),document.addEventListener("mousemove",s),document.addEventListener("mouseup",n),function(){e.removeEventListener("mousedown",r),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",n)}}}),[ve,Ye]),Object(h.useEffect)((function(){Ue(S)}),[S]);var nt={width:Z(y),height:Z(je)};Object(h.useMemo)((function(){if(Fe){var e=new Date(Fe),t=e.getHours(),i=e.getMinutes(),r=e.getSeconds();return i=i<10?"0"+i:i,r=r<10?"0"+r:r,"".concat(t=t<10?"0"+t:t,":").concat(i,":").concat(r)}return 0}),[Fe]);return d.a.createElement(h.Fragment,null,d.a.createElement("div",{className:"markdown-editor-wrapper",ref:Qe},d.a.createElement("div",{className:"markdown-editor-container ".concat(ae," ").concat(ke?"on-preview":""," ").concat(x?"mini":""," ").concat(Le?"full-screen":""),style:nt},d.a.createElement(w,{insertTemp:D,watch:ke,fullScreen:Le,showNullButton:X,onActionCallback:et,hidetoolBar:q,uuid:ze.current,setOpenPhones:function(){Ge.current=!0}}),d.a.createElement("div",{className:"markdown-editor-body"},d.a.createElement("div",{className:"codemirror-container"},d.a.createElement("textarea",{ref:qe,placeholder:he})),ke?d.a.createElement("div",{ref:Ze,className:"preview-container"},"stex"===M&&d.a.createElement(m,{value:be}),"stex"!==M&&d.a.createElement(v.a,{edit:!0,value:be,replaces:function(e,t){var i=ve.getValue();i=i.replace(e,t),Se(i),null==ve||ve.setValue(i)}})):null))),H?d.a.createElement("a",{ref:Ye,className:"editor-resize"}):null,d.a.createElement(k.a,null,te[Oe]?d.a.createElement(r.a,{centered:!0,title:te[Oe],visible:!0,onCancel:rt,footer:null},it):null))}},P2ho:
/*!************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/input/xtscancodes.js ***!
\************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={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}},QV2g:
/*!*********************************************************************!*\
!*** ./node_modules/@novnc/novnc/lib/vendor/pako/lib/zlib/crc32.js ***!
\*********************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t,i){"use strict";function r(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;r()},SJMd:
/*!****************************************************!*\
!*** ./node_modules/code-prettify/src/prettify.js ***!
\****************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(e,t){window.PR_SHOULD_USE_CONTINUATION=!0,function(){var e=window,t=["break,continue,do,else,for,if,return,while"],i=[[t,"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"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],r=[i,"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"],n=[i,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],s=[i,"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"],o=[i,"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",l=[t,"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"],c=[t,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[t,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],h=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;function d(e,t,i,r,n){if(i){var s={sourceNode:e,pre:1,langExtension:null,numberLines:null,sourceCode:i,spans:null,basePos:t,decorations:null};r(s),n.push.apply(n,s.decorations)}}var f=/\S/;function p(e){for(var t=void 0,i=e.firstChild;i;i=i.nextSibling){var r=i.nodeType;t=1===r?t?e:i:3===r&&f.test(i.nodeValue)?e:t}return t===e?void 0:t}function g(e,t){var i,r={};!function(){for(var n=e.concat(t),s=[],o={},a=0,l=n.length;a=0;)r[u.charAt(h)]=c;var d=c[1],f=""+d;o.hasOwnProperty(f)||(s.push(d),o[f]=null)}s.push(/[\0-\uffff]/),i=function(e){for(var t=0,i=!1,r=!1,n=0,s=e.length;n122||(u<65||h>90||i.push([32|Math.max(65,h),32|Math.min(u,90)]),u<97||h>122||i.push([-33&Math.max(97,h),-33&Math.min(u,122)]))}}i.sort((function(e,t){return e[0]-t[0]||t[1]-e[1]}));var d=[],f=[];for(s=0;sp[0]&&(p[1]+1>p[0]&&n.push("-"),n.push(l(p[1])))}return n.push("]"),n.join("")}function u(e){for(var r=e.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")),n=r.length,s=[],o=0,a=0;o=2&&"["===d?r[o]=c(h):"\\"!==d&&(r[o]=h.replace(/[a-zA-Z]/g,(function(e){var t=e.charCodeAt(0);return"["+String.fromCharCode(-33&t,32|t)+"]"})))}return r.join("")}var h=[];for(n=0,s=e.length;n=5&&"lang-"===y.substring(0,5))||_&&"string"==typeof _[1]||(v=!1,y="src"),v||(f[m]=y)}var w=u;if(u+=m.length,v){var k=_[1],x=m.indexOf(k),E=x+k.length;_[2]&&(x=(E=m.length-_[2].length)-k.length);var T=y.substring(5);d(l,a+w,m.substring(0,x),s,c),d(l,a+w+x,k,S(T,k),c),d(l,a+w+E,m.substring(E),s,c)}else c.push(a+w,y)}e.decorations=c};return s}function v(e){var t=[],i=[];e.tripleQuotedStrings?t.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]):e.multiLineStrings?t.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):t.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&i.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=e.hashComments;r&&(e.cStyleComments?(r>1?t.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):t.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),i.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):t.push(["com",/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(i.push(["com",/^\/\/[^\r\n]*/,null]),i.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var n=e.regexLiterals;if(n){var s=n>1?"":"\n\r",o=s?".":"[\\S\\s]",a="/(?=[^/*"+s+"])(?:[^/\\x5B\\x5C"+s+"]|\\x5C"+o+"|\\x5B(?:[^\\x5C\\x5D"+s+"]|\\x5C"+o+")*(?:\\x5D|$))+/";i.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+a+")")])}var l=e.types;l&&i.push(["typ",l]);var c=(""+e.keywords).replace(/^ | $/g,"");c.length&&i.push(["kwd",new RegExp("^(?:"+c.replace(/[\s,]+/g,"|")+")\\b"),null]),t.push(["pln",/^\s+/,null," \r\n\t "]);var u="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(u+="(?!s*/)"),i.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",new RegExp(u),null]),g(t,i)}var m=v({keywords:[r,s,n,o,a,l,c,u],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function y(e,t,i){for(var r=/(?:^|\s)nocode(?:\s|$)/,n=/\r\n?|\n/,s=e.ownerDocument,o=s.createElement("li");e.firstChild;)o.appendChild(e.firstChild);var a=[o];function l(e){var t=e.nodeType;if(1!=t||r.test(e.className)){if((3==t||4==t)&&i){var o=e.nodeValue,a=o.match(n);if(a){var u=o.substring(0,a.index);e.nodeValue=u;var h=o.substring(a.index+a[0].length);if(h)e.parentNode.insertBefore(s.createTextNode(h),e.nextSibling);c(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)c(e),e.parentNode&&e.parentNode.removeChild(e);else for(var d=e.firstChild;d;d=d.nextSibling)l(d)}function c(e){for(;!e.nextSibling;)if(!(e=e.parentNode))return;for(var t,i=function e(t,i){var r=i?t.cloneNode(!1):t,n=t.parentNode;if(n){var s=e(n,1),o=t.nextSibling;s.appendChild(r);for(var a=o;a;a=o)o=a.nextSibling,s.appendChild(a)}return r}(e.nextSibling,0);(t=i.parentNode)&&1===t.nodeType;)i=t;a.push(i)}for(var u=0;u=0;){var n=i[r];_.hasOwnProperty(n)?e.console&&console.warn("cannot override language handler %s",n):_[n]=t}}function S(e,t){return e&&_.hasOwnProperty(e)||(e=/^\s*=b&&(u+=2),a>=S&&(f+=2)}}finally{m&&(m.style.display=y)}}(t)}catch(t){e.console&&console.log(t&&t.stack||t)}}function w(e,t,i){var r=i||!1,n=t||null,s=document.createElement("div");return s.innerHTML=""+e+"
",s=s.firstChild,r&&y(s,r,!0),C({langExtension:n,numberLines:r,sourceNode:s,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null}),s.innerHTML}function k(t,i){var r=i||document.body,n=r.ownerDocument||document;function s(e){return r.getElementsByTagName(e)}for(var o=[s("pre"),s("code"),s("xmp")],a=[],l=0;l]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^