%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/snap/lxd/29351/share/lxd-ui/assets/
Upload File :
Create Path :
Current File : //proc/self/root/snap/lxd/29351/share/lxd-ui/assets/InstanceDetail-ee6a9c3e.js

import{r as Z,j as E,d as K,f as at,q as Ee,Y as $s,c as Ni,L as Ge,F as Zs,u as Qs,Z as hr,X as At,n as Js,A as He,t as eo,_ as ur,W as gt,m as ct,$ as Vr,a0 as Xr,a1 as to,a2 as bt,v as Ct,a3 as io,a4 as ro,a5 as no,z as $r,a6 as Zr,b as Qr,x as Xe,i as et,a7 as Jr,a8 as xi,I as Ue,a9 as so,aa as Ui,ab as oo,ac as ao,ad as en,l as co,ae as lo,o as ho,P as uo,S as fo,af as _o,ag as po,ah as mo,ai as tn,aj as vo,ak as go,e as Bi,G as Ne,al as bo,am as So,an as yo,ao as Co,C as Eo,ap as wo,aq as xo}from"./index-13b2882d.js";import{u as lt,S as Et}from"./updateMaxHeight-325b3cd4.js";import{f as Ao}from"./networks-5caac489.js";import{c as Nt,a as Ze,d as Io,e as fr,u as ht,f as Po}from"./index.esm-82c30f37.js";import{S as To}from"./SelectableMainTable-5a3f3fef.js";import{p as It,S as Lo,d as Mo}from"./instanceDelete-e714bd59.js";import{a as rn,D as Ro,N as Do,R as Oo,S as ko,C as No}from"./NetworkDevicesForm-bcf4be77.js";import{g as Dt,I as nn,a as sn,E as Uo}from"./instanceEdit-cf20bafe.js";import{y as Bo,h as _r,a as dr,Y as Fo,d as jo}from"./instanceValidation-45cfba9a.js";import{I as Ho,M as ui,D as Go,N as Ko,R as Yo,S as qo,a as zo,C as Wo,Y as pr}from"./InstanceFormMenu-dff7cf6c.js";import{R as Vo}from"./RenameHeader-c74d9adb.js";import"./formFields-fc140429.js";import"./instanceConfigInheritance-fbf987f8.js";import"./ConfigurationTable-1a9d4d6f.js";import"./ConfigFieldDescription-00c1a193.js";import"./StorageVolumeForm-228515f8.js";import"./StorageVolumeFormMenu-e90b9f5c.js";import"./FormMenuItem-c8a1a121.js";import"./DiskSizeSelector-dd5e138a.js";import"./ProfileSelector-b579b8c7.js";import"./settings-c23f9009.js";import"./AutoExpandingTextArea-3a779a81.js";const Zt=({notification:t=null,onDismiss:e})=>{const i=Z.useRef(null);if(Z.useEffect(()=>{var l;(l=i.current)==null||l.scrollIntoView({behavior:"smooth",block:"center",inline:"start"}),window.dispatchEvent(new Event("resize"))},[t]),!t)return null;const{actions:n,title:r,type:p,message:a}=t,v=()=>{if(r)return r;switch(p){case"negative":return"Error";case"positive":return"Success";case"information":return"Info";default:return""}};return E.jsx("div",{ref:i,children:E.jsx(K.Row,{children:E.jsx(K.Notification,{title:v()||void 0,actions:n,severity:p,onDismiss:e,children:a})})})},Xo=({instance:t,onFailure:e})=>{const{data:i=[],error:n,isLoading:r}=at({queryKey:[Ee.networks,t.project],queryFn:()=>Ao(t.project)});n&&e("Loading networks failed",n);const p=Object.values(t.expanded_devices??{}).filter($s).map(u=>u.network),a=p.length>0,v=[{content:"Name",sortKey:"name",className:"p-muted-heading"},{content:"Interface",sortKey:"interfaceName",className:"p-muted-heading"},{content:"Type",sortKey:"type",className:"p-muted-heading"},{content:"Managed",sortKey:"managed",className:"p-muted-heading u-hide--small u-hide--medium"}],l=i.filter(u=>p.includes(u.name)).map(u=>{const d=Object.entries(t.expanded_devices??{}).filter(([b,o])=>o.type==="nic"&&o.network===u.name).map(([b])=>b);return{columns:[{content:E.jsx(Ni,{to:`/ui/project/${t.project}/networks/detail/${u.name}`,title:u.name,children:u.name}),role:"rowheader","aria-label":"Name"},{content:d.length>0?d.join(" "):"-",role:"rowheader","aria-label":"Interface"},{content:u.type,role:"rowheader","aria-label":"Type"},{content:u.managed?"Yes":"No",role:"rowheader","aria-label":"Managed"}],sortData:{name:u.name.toLowerCase(),type:u.type,managed:u.managed,interfaceName:d.join(" ")}}});return E.jsxs(E.Fragment,{children:[r&&E.jsx(Ge,{text:"Loading networks..."}),!r&&a&&E.jsx(K.MainTable,{headers:v,rows:l,sortable:!0}),!r&&!a&&E.jsx(E.Fragment,{children:"-"})]})},$o=({instance:t,onFailure:e})=>{const{data:i=[],error:n,isLoading:r}=at({queryKey:[Ee.profiles,t.project],queryFn:()=>Zs(t.project)});n&&e("Loading profiles failed",n);const p=[{content:"Name",sortKey:"name",className:"p-muted-heading"},{content:"Description",sortKey:"description",className:"p-muted-heading"}],a=t.profiles.map(v=>{if(i.length<1)return{columns:void 0};const l=i.filter(u=>u.name===v)[0].description;return{columns:[{content:E.jsx(Ni,{to:`/ui/project/${t.project}/profiles/detail/${v}`,title:v,children:v}),role:"rowheader","aria-label":"Name"},{content:l,role:"rowheader",title:l,"aria-label":"Description"}],sortData:{name:v.toLowerCase(),description:l.toLowerCase()}}});return E.jsx(E.Fragment,{children:r?E.jsx(Ge,{text:"Loading profiles..."}):E.jsx(K.MainTable,{headers:p,rows:a,sortable:!0})})};function Zo(t,e){if(t===e)return!0;if(!t||!e)return!1;var i=Object.keys(t),n=Object.keys(e),r=i.length;if(n.length!==r)return!1;for(var p=0;p<r;p++){var a=i[p];if(t[a]!==e[a]||!Object.prototype.hasOwnProperty.call(e,a))return!1}return!0}function Qo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Jo(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&St(t,e)}function Ut(t){return Ut=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},Ut(t)}function St(t,e){return St=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},St(t,e)}function ea(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Ot(t,e,i){return ea()?Ot=Reflect.construct:Ot=function(r,p,a){var v=[null];v.push.apply(v,p);var l=Function.bind.apply(r,v),u=new l;return a&&St(u,a.prototype),u},Ot.apply(null,arguments)}function ta(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Ai(t){var e=typeof Map=="function"?new Map:void 0;return Ai=function(n){if(n===null||!ta(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,r)}function r(){return Ot(n,arguments,Ut(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),St(r,n)},Ai(t)}function ia(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ra(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:ia(t)}var Qe=function(t){Jo(e,t);function e(i){return Qo(this,e),ra(this,Ut(e).call(this,"Encountered invalid line: "+i))}return e}(Ai(Error));Object.defineProperty(Qe.prototype,"name",{value:Qe.name});var mr=0,fi=1,vr=2,_i=3,Pt=4,di=5,pi=6,gr=7,mi=8,br=9,Sr=10,yr=11;function na(t){for(var e="",i="",n="",r="",p="",a=void 0,v=mr,l=0;l<t.length;++l){var u=t.charAt(l);if(v===mr)u==="{"?v=fi:u===" "||u==="	"?v=vr:e+=u;else if(v===vr)u===" "||u==="	"||(u==="{"?v=fi:(r+=u,v=_i));else if(v===fi)u===" "||u==="	"||(u==="}"?v=Pt:(i+=u,v=di));else if(v===di)u==="="?v=pi:u==="}"?v=Pt:u===" "||u==="	"?v=gr:i+=u;else if(v===gr){if(u==="=")v=pi;else if(!(u===" "||u==="	"))throw new Qe(t)}else if(v===pi){if(u==='"')v=mi;else if(!(u===" "||u==="	"))throw new Qe(t)}else if(v===mi)u==="\\"?v=br:u==='"'?(a||(a={}),a[i]=n,i="",n="",v=Sr):n+=u;else if(v===br)v=mi,u==="\\"?n+="\\":u==="n"?n+=`
`:u==='"'?n+='"':n+="\\".concat(u);else if(v===Sr){if(u===",")v=di;else if(u==="}")v=Pt;else if(!(u===" "||u==="	"))throw new Qe(t)}else v===Pt?u===" "||u==="	"||(r+=u,v=_i):v===_i?u===" "||u==="	"?v=yr:r+=u:v===yr&&(u===" "||u==="	"||(p+=u))}var d={name:e,value:r};return a&&(d.labels=a),p&&(d.timestamp_ms=p),d}var vi="SUMMARY",mt="HISTOGRAM";function sa(t){for(var e=t.split(`
`),i=[],n,r,p,a=[],v=0;v<e.length;++v){var l=e[v].trim(),u=null,d=null,b=null,o=null;if(l.length!==0)if(l.startsWith("# ")){var c=l.substring(2),f=null;if(c.startsWith("HELP ")?f=1:c.startsWith("TYPE ")&&(f=2),f){c=c.substring(5);var h=c.indexOf(" ");if(h!==-1){u=c.substring(0,h);var _=c.substring(h+1);if(f===1)d=oa(_);else{if(_.includes(" "))throw new Qe(l);b=_.toUpperCase()}}else throw new Qe(l)}}else o=na(l),u=o.name;u===n&&(!r&&d?r=d:!p&&b&&(p=b));var s="".concat(n,"_count"),g="".concat(n,"_sum"),m="".concat(n,"_bucket"),S=[n];if((p===vi||p===mt)&&(S.push(s),S.push(g)),p===mt&&S.push(m),(v+1===e.length||u&&!S.includes(u))&&(n&&(p===vi?a=Cr(a,"quantiles","quantile","value"):p===mt&&(a=Cr(a,"buckets","le","bucket")),i.push({name:n,help:r||"",type:p||"UNTYPED",metrics:a})),n=u,r=d||null,p=b||null,a=[]),o){o.name!==n&&((p===vi||p===mt)&&(o.name===s?o.count=o.value:o.name===g&&(o.sum=o.value)),p===mt&&o.name===m&&(o.bucket=o.value),delete o.value),delete o.name;var y=a.length,C=y===0?null:a[y-1];if(C&&Zo(o.labels,C.labels)){delete o.labels;for(var w in o)C[w]=o[w]}else a.push(o)}}return i}function Cr(t,e,i,n){for(var r=null,p=0;p<t.length;++p){var a=t[p];a.labels&&a.labels[i]&&a[n]?(r||(r={},r[e]={}),r[e][a.labels[i]]=a[n]):a.labels||(r||(r={}),a.count!==void 0&&(r.count=a.count),a.sum!==void 0&&(r.sum=a.sum))}return r?[r]:t}function oa(t){for(var e="",i=!1,n=0;n<t.length;++n){var r=t.charAt(n);i?(r==="\\"?e+="\\":r==="n"?e+=`
`:e+="\\".concat(r),i=!1):r==="\\"?i=!0:e+=r}return i&&(e+="\\"),e}const aa=()=>new Promise((t,e)=>{fetch("/1.0/metrics").then(i=>i.text()).then(i=>{const n=sa(i);t(n)}).catch(e)}),ca=(t,e)=>{const i=d=>{var b,o;return(o=(b=t.find(c=>c.name===d))==null?void 0:b.metrics.find(c=>c.labels.name===e.name))==null?void 0:o.value},n=i("lxd_memory_MemFree_bytes"),r=i("lxd_memory_MemTotal_bytes"),p=n&&r?{free:n,total:r}:void 0,a=d=>{var b,o;return(o=(b=t.find(c=>c.name===d))==null?void 0:b.metrics.find(c=>c.labels.name===e.name&&c.labels.mountpoint==="/"))==null?void 0:o.value},v=a("lxd_filesystem_free_bytes"),l=a("lxd_filesystem_size_bytes");return{memory:p,disk:v&&l?{free:v,total:l}:void 0}},la=({instance:t,onFailure:e})=>{const{isRestricted:i}=Qs(),{data:n=[],error:r,isLoading:p}=at({queryKey:[Ee.metrics],queryFn:aa,refetchInterval:15*1e3,enabled:!i});r&&e("Loading metrics failed",r);const a=ca(n,t);return i?E.jsx("div",{className:"u-text--muted",children:"Details are not available for restricted users"}):E.jsx(E.Fragment,{children:p?E.jsx(Ge,{text:"Loading metrics..."}):E.jsx("table",{children:E.jsxs("tbody",{children:[E.jsxs("tr",{className:"metric-row",children:[E.jsx("th",{className:"p-muted-heading",children:"Memory"}),E.jsx("td",{children:a.memory?E.jsx("div",{children:E.jsx(hr,{percentage:100/a.memory.total*(a.memory.total-a.memory.free),text:At(a.memory.total-a.memory.free)+" of "+At(a.memory.total)+" memory used"})}):"-"})]}),E.jsxs("tr",{className:"metric-row",children:[E.jsx("th",{className:"p-muted-heading",children:"Disk"}),E.jsx("td",{children:a.disk?E.jsx("div",{children:E.jsx(hr,{percentage:100/a.disk.total*(a.disk.total-a.disk.free),text:At(a.disk.total-a.disk.free)+" of "+At(a.disk.total)+" disk used"})}):"-"})]})]})})})},ha=({instance:t})=>{var v;const[e,i]=Z.useState(null),{data:n}=Js(),r=(l,u)=>{i(K.failure(l,u))},p=()=>{lt("instance-overview-tab")};Z.useEffect(p,[e]),He("resize",p);const a=!t.state||t.state.pid===0?"-":t.state.pid;return E.jsxs("div",{className:"instance-overview-tab",children:[E.jsx(Zt,{notification:e,onDismiss:()=>i(null)}),E.jsxs(K.Row,{className:"general",children:[E.jsx(K.Col,{size:3,children:E.jsx("h2",{className:"p-heading--5",children:"General"})}),E.jsx(K.Col,{size:7,children:E.jsx("table",{children:E.jsxs("tbody",{children:[E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Base image"}),E.jsx("td",{children:t.config["image.description"]??"-"})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Description"}),E.jsx("td",{children:t.description?t.description:"-"})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Type"}),E.jsx("td",{children:eo.filter(l=>l.value===t.type)[0].label})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"IPv4"}),E.jsx("td",{children:E.jsx(ur,{instance:t,family:"inet"})})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"IPv6"}),E.jsx("td",{children:E.jsx(ur,{instance:t,family:"inet6"})})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Architecture"}),E.jsx("td",{children:t.architecture})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Location"}),E.jsx("td",{children:(v=n==null?void 0:n.environment)!=null&&v.server_clustered?t.location:"-"})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"PID"}),E.jsx("td",{children:a})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Date created"}),E.jsx("td",{children:gt(t.created_at)})]}),E.jsxs("tr",{children:[E.jsx("th",{className:"p-muted-heading",children:"Last used"}),E.jsx("td",{children:gt(t.last_used_at)})]})]})})})]}),E.jsxs(K.Row,{className:"usage",children:[E.jsx(K.Col,{size:3,children:E.jsx("h2",{className:"p-heading--5",children:"Usage"})}),E.jsx(K.Col,{size:7,children:E.jsx(la,{instance:t,onFailure:r})})]}),E.jsxs(K.Row,{className:"networks",children:[E.jsx(K.Col,{size:3,children:E.jsx("h2",{className:"p-heading--5",children:"Networks"})}),E.jsx(K.Col,{size:7,children:E.jsx(Xo,{instance:t,onFailure:r})})]}),E.jsxs(K.Row,{className:"profiles",children:[E.jsx(K.Col,{size:3,children:E.jsx("h2",{className:"p-heading--5",children:"Profiles"})}),E.jsx(K.Col,{size:7,children:E.jsx($o,{instance:t,onFailure:r})})]})]})};var ua=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(n,r,p){i.o(n,r)||Object.defineProperty(n,r,{enumerable:!0,get:p})},i.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,r){if(1&r&&(n=i(n)),8&r||4&r&&typeof n=="object"&&n&&n.__esModule)return n;var p=Object.create(null);if(i.r(p),Object.defineProperty(p,"default",{enumerable:!0,value:n}),2&r&&typeof n!="string")for(var a in n)i.d(p,a,(function(v){return n[v]}).bind(null,a));return p},i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,"a",r),r},i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},i.p="",i(i.s=70)}([function(t,e,i){t.exports=i(64)()},function(t,e,i){(function(n){var r=function(p){return p&&p.Math==Math&&p};t.exports=r(typeof globalThis=="object"&&globalThis)||r(typeof window=="object"&&window)||r(typeof self=="object"&&self)||r(typeof n=="object"&&n)||Function("return this")()}).call(this,i(31))},function(t,e){t.exports=function(i){try{return!!i()}catch{return!0}}},function(t,e){var i={}.hasOwnProperty;t.exports=function(n,r){return i.call(n,r)}},function(t,e,i){var n=i(2);t.exports=!n(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},function(t,e){t.exports=function(i){return typeof i=="object"?i!==null:typeof i=="function"}},function(t,e,i){var n=i(4),r=i(17),p=i(11);t.exports=n?function(a,v,l){return r.f(a,v,p(1,l))}:function(a,v,l){return a[v]=l,a}},function(t,e,i){t.exports=i(62)},function(t,e,i){var n=i(12),r=i(14);t.exports=function(p){return n(r(p))}},function(t,e,i){var n=i(1),r=i(6);t.exports=function(p,a){try{r(n,p,a)}catch{n[p]=a}return a}},function(t,e,i){var n=i(4),r=i(32),p=i(11),a=i(8),v=i(15),l=i(3),u=i(16),d=Object.getOwnPropertyDescriptor;e.f=n?d:function(b,o){if(b=a(b),o=v(o,!0),u)try{return d(b,o)}catch{}if(l(b,o))return p(!r.f.call(b,o),b[o])}},function(t,e){t.exports=function(i,n){return{enumerable:!(1&i),configurable:!(2&i),writable:!(4&i),value:n}}},function(t,e,i){var n=i(2),r=i(13),p="".split;t.exports=n(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return r(a)=="String"?p.call(a,""):Object(a)}:Object},function(t,e){var i={}.toString;t.exports=function(n){return i.call(n).slice(8,-1)}},function(t,e){t.exports=function(i){if(i==null)throw TypeError("Can't call method on "+i);return i}},function(t,e,i){var n=i(5);t.exports=function(r,p){if(!n(r))return r;var a,v;if(p&&typeof(a=r.toString)=="function"&&!n(v=a.call(r))||typeof(a=r.valueOf)=="function"&&!n(v=a.call(r))||!p&&typeof(a=r.toString)=="function"&&!n(v=a.call(r)))return v;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n=i(4),r=i(2),p=i(33);t.exports=!n&&!r(function(){return Object.defineProperty(p("div"),"a",{get:function(){return 7}}).a!=7})},function(t,e,i){var n=i(4),r=i(16),p=i(18),a=i(15),v=Object.defineProperty;e.f=n?v:function(l,u,d){if(p(l),u=a(u,!0),p(d),r)try{return v(l,u,d)}catch{}if("get"in d||"set"in d)throw TypeError("Accessors not supported");return"value"in d&&(l[u]=d.value),l}},function(t,e,i){var n=i(5);t.exports=function(r){if(!n(r))throw TypeError(String(r)+" is not an object");return r}},function(t,e,i){var n=i(20),r=Function.toString;typeof n.inspectSource!="function"&&(n.inspectSource=function(p){return r.call(p)}),t.exports=n.inspectSource},function(t,e,i){var n=i(1),r=i(9),p=n["__core-js_shared__"]||r("__core-js_shared__",{});t.exports=p},function(t,e,i){var n=i(38),r=i(20);(t.exports=function(p,a){return r[p]||(r[p]=a!==void 0?a:{})})("versions",[]).push({version:"3.6.5",mode:n?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e){var i=0,n=Math.random();t.exports=function(r){return"Symbol("+String(r===void 0?"":r)+")_"+(++i+n).toString(36)}},function(t,e){t.exports={}},function(t,e,i){var n=i(25),r=Math.min;t.exports=function(p){return p>0?r(n(p),9007199254740991):0}},function(t,e){var i=Math.ceil,n=Math.floor;t.exports=function(r){return isNaN(r=+r)?0:(r>0?n:i)(r)}},function(t,e,i){var n=i(50).forEach,r=i(58),p=i(59),a=r("forEach"),v=p("forEach");t.exports=a&&v?[].forEach:function(l){return n(this,l,arguments.length>1?arguments[1]:void 0)}},function(t,e,i){var n=i(2);t.exports=!!Object.getOwnPropertySymbols&&!n(function(){return!String(Symbol())})},function(t,e,i){t.exports=function(n){var r={};function p(a){if(r[a])return r[a].exports;var v=r[a]={i:a,l:!1,exports:{}};return n[a].call(v.exports,v,v.exports,p),v.l=!0,v.exports}return p.m=n,p.c=r,p.d=function(a,v,l){p.o(a,v)||Object.defineProperty(a,v,{enumerable:!0,get:l})},p.r=function(a){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},p.t=function(a,v){if(1&v&&(a=p(a)),8&v||4&v&&typeof a=="object"&&a&&a.__esModule)return a;var l=Object.create(null);if(p.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:a}),2&v&&typeof a!="string")for(var u in a)p.d(l,u,(function(d){return a[d]}).bind(null,u));return l},p.n=function(a){var v=a&&a.__esModule?function(){return a.default}:function(){return a};return p.d(v,"a",v),v},p.o=function(a,v){return Object.prototype.hasOwnProperty.call(a,v)},p.p="",p(p.s=32)}([function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this._listeners=[],this._disposed=!1}return Object.defineProperty(v.prototype,"event",{get:function(){var l=this;return this._event||(this._event=function(u){return l._listeners.push(u),{dispose:function(){if(!l._disposed){for(var d=0;d<l._listeners.length;d++)if(l._listeners[d]===u)return void l._listeners.splice(d,1)}}}}),this._event},enumerable:!0,configurable:!0}),v.prototype.fire=function(l,u){for(var d=[],b=0;b<this._listeners.length;b++)d.push(this._listeners[b]);for(b=0;b<d.length;b++)d[b].call(void 0,l,u)},v.prototype.dispose=function(){this._listeners&&(this._listeners.length=0),this._disposed=!0},v}();r.EventEmitter=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(14);r.IBufferService=a.createDecorator("BufferService"),r.ICoreMouseService=a.createDecorator("CoreMouseService"),r.ICoreService=a.createDecorator("CoreService"),r.ICharsetService=a.createDecorator("CharsetService"),r.IDirtyRowService=a.createDecorator("DirtyRowService"),r.IInstantiationService=a.createDecorator("InstantiationService"),r.ILogService=a.createDecorator("LogService"),r.IOptionsService=a.createDecorator("OptionsService"),r.IUnicodeService=a.createDecorator("UnicodeService")},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this._disposables=[],this._isDisposed=!1}return v.prototype.dispose=function(){this._isDisposed=!0,this._disposables.forEach(function(l){return l.dispose()}),this._disposables.length=0},v.prototype.register=function(l){this._disposables.push(l)},v.prototype.unregister=function(l){var u=this._disposables.indexOf(l);u!==-1&&this._disposables.splice(u,1)},v}();r.Disposable=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_COLOR=256,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(14);r.ICharSizeService=a.createDecorator("CharSizeService"),r.ICoreBrowserService=a.createDecorator("CoreBrowserService"),r.IMouseService=a.createDecorator("MouseService"),r.IRenderService=a.createDecorator("RenderService"),r.ISelectionService=a.createDecorator("SelectionService"),r.ISoundService=a.createDecorator("SoundService")},function(n,r,p){var a,v=this&&this.__extends||(a=function(b,o){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var h in f)f.hasOwnProperty(h)&&(c[h]=f[h])})(b,o)},function(b,o){function c(){this.constructor=b}a(b,o),b.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(7),u=p(3),d=function(b){function o(){var c=b!==null&&b.apply(this,arguments)||this;return c.content=0,c.fg=0,c.bg=0,c.combinedData="",c}return v(o,b),o.fromCharData=function(c){var f=new o;return f.setFromCharData(c),f},o.prototype.isCombined=function(){return 2097152&this.content},o.prototype.getWidth=function(){return this.content>>22},o.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?l.stringFromCodePoint(2097151&this.content):""},o.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},o.prototype.setFromCharData=function(c){this.fg=c[u.CHAR_DATA_ATTR_INDEX],this.bg=0;var f=!1;if(c[u.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(c[u.CHAR_DATA_CHAR_INDEX].length===2){var h=c[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){var _=c[u.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(h-55296)+_-56320+65536|c[u.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=c[u.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|c[u.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=c[u.CHAR_DATA_CHAR_INDEX],this.content=2097152|c[u.CHAR_DATA_WIDTH_INDEX]<<22)},o.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},o}(p(6).AttributeData);r.CellData=d},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this.fg=0,this.bg=0}return v.toColorRGB=function(l){return[l>>>16&255,l>>>8&255,255&l]},v.fromColorRGB=function(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]},v.prototype.clone=function(){var l=new v;return l.fg=this.fg,l.bg=this.bg,l},v.prototype.isInverse=function(){return 67108864&this.fg},v.prototype.isBold=function(){return 134217728&this.fg},v.prototype.isUnderline=function(){return 268435456&this.fg},v.prototype.isBlink=function(){return 536870912&this.fg},v.prototype.isInvisible=function(){return 1073741824&this.fg},v.prototype.isItalic=function(){return 67108864&this.bg},v.prototype.isDim=function(){return 134217728&this.bg},v.prototype.getFgColorMode=function(){return 50331648&this.fg},v.prototype.getBgColorMode=function(){return 50331648&this.bg},v.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},v.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},v.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},v.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},v.prototype.isFgDefault=function(){return(50331648&this.fg)==0},v.prototype.isBgDefault=function(){return(50331648&this.bg)==0},v.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},v.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},v.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},v}();r.AttributeData=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},r.utf32ToString=function(l,u,d){u===void 0&&(u=0),d===void 0&&(d=l.length);for(var b="",o=u;o<d;++o){var c=l[o];c>65535?(c-=65536,b+=String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):b+=String.fromCharCode(c)}return b};var a=function(){function l(){this._interim=0}return l.prototype.clear=function(){this._interim=0},l.prototype.decode=function(u,d){var b=u.length;if(!b)return 0;var o=0,c=0;this._interim&&(56320<=(_=u.charCodeAt(c++))&&_<=57343?d[o++]=1024*(this._interim-55296)+_-56320+65536:(d[o++]=this._interim,d[o++]=_),this._interim=0);for(var f=c;f<b;++f){var h=u.charCodeAt(f);if(55296<=h&&h<=56319){if(++f>=b)return this._interim=h,o;var _;56320<=(_=u.charCodeAt(f))&&_<=57343?d[o++]=1024*(h-55296)+_-56320+65536:(d[o++]=h,d[o++]=_)}else d[o++]=h}return o},l}();r.StringToUtf32=a;var v=function(){function l(){this.interim=new Uint8Array(3)}return l.prototype.clear=function(){this.interim.fill(0)},l.prototype.decode=function(u,d){var b=u.length;if(!b)return 0;var o,c,f,h,_=0,s=0,g=0;if(this.interim[0]){var m=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;for(var y=0,C=void 0;(C=63&this.interim[++y])&&y<4;)S<<=6,S|=C;for(var w=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=w-y;g<I;){if(g>=b)return 0;if((192&(C=u[g++]))!=128){g--,m=!0;break}this.interim[y++]=C,S<<=6,S|=63&C}m||(w===2?S<128?g--:d[_++]=S:w===3?S<2048||S>=55296&&S<=57343||(d[_++]=S):S<65536||S>1114111||(d[_++]=S)),this.interim.fill(0)}for(var R=b-4,k=g;k<b;){for(;!(!(k<R)||128&(o=u[k])||128&(c=u[k+1])||128&(f=u[k+2])||128&(h=u[k+3]));)d[_++]=o,d[_++]=c,d[_++]=f,d[_++]=h,k+=4;if((o=u[k++])<128)d[_++]=o;else if((224&o)==192){if(k>=b)return this.interim[0]=o,_;if((192&(c=u[k++]))!=128){k--;continue}if((s=(31&o)<<6|63&c)<128){k--;continue}d[_++]=s}else if((240&o)==224){if(k>=b)return this.interim[0]=o,_;if((192&(c=u[k++]))!=128){k--;continue}if(k>=b)return this.interim[0]=o,this.interim[1]=c,_;if((192&(f=u[k++]))!=128){k--;continue}if((s=(15&o)<<12|(63&c)<<6|63&f)<2048||s>=55296&&s<=57343)continue;d[_++]=s}else if((248&o)==240){if(k>=b)return this.interim[0]=o,_;if((192&(c=u[k++]))!=128){k--;continue}if(k>=b)return this.interim[0]=o,this.interim[1]=c,_;if((192&(f=u[k++]))!=128){k--;continue}if(k>=b)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=f,_;if((192&(h=u[k++]))!=128){k--;continue}if((s=(7&o)<<18|(63&c)<<12|(63&f)<<6|63&h)<65536||s>1114111)continue;d[_++]=s}}return _},l}();r.Utf8ToUtf32=v},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=function(a,v,l,u){a.addEventListener(v,l,u);var d=!1;return{dispose:function(){d||(d=!0,a.removeEventListener(v,l,u))}}}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.CHAR_ATLAS_CELL_SPACING=1},function(n,r,p){var a,v,l,u;function d(o){var c=o.toString(16);return c.length<2?"0"+c:c}function b(o,c){return o<c?(c+.05)/(o+.05):(o+.05)/(c+.05)}Object.defineProperty(r,"__esModule",{value:!0}),function(o){o.toCss=function(c,f,h,_){return _!==void 0?"#"+d(c)+d(f)+d(h)+d(_):"#"+d(c)+d(f)+d(h)},o.toRgba=function(c,f,h,_){return _===void 0&&(_=255),(c<<24|f<<16|h<<8|_)>>>0}}(a=r.channels||(r.channels={})),(v=r.color||(r.color={})).blend=function(o,c){var f=(255&c.rgba)/255;if(f===1)return{css:c.css,rgba:c.rgba};var h=c.rgba>>24&255,_=c.rgba>>16&255,s=c.rgba>>8&255,g=o.rgba>>24&255,m=o.rgba>>16&255,S=o.rgba>>8&255,y=g+Math.round((h-g)*f),C=m+Math.round((_-m)*f),w=S+Math.round((s-S)*f);return{css:a.toCss(y,C,w),rgba:a.toRgba(y,C,w)}},v.ensureContrastRatio=function(o,c,f){var h=u.ensureContrastRatio(o.rgba,c.rgba,f);if(h)return u.toColor(h>>24&255,h>>16&255,h>>8&255)},v.opaque=function(o){var c=(255|o.rgba)>>>0,f=u.toChannels(c),h=f[0],_=f[1],s=f[2];return{css:a.toCss(h,_,s),rgba:c}},(r.css||(r.css={})).toColor=function(o){return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0}},function(o){function c(f,h,_){var s=f/255,g=h/255,m=_/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.0722*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))}o.relativeLuminance=function(f){return c(f>>16&255,f>>8&255,255&f)},o.relativeLuminance2=c}(l=r.rgb||(r.rgb={})),function(o){function c(h,_,s){for(var g=h>>24&255,m=h>>16&255,S=h>>8&255,y=_>>24&255,C=_>>16&255,w=_>>8&255,I=b(l.relativeLuminance2(y,w,C),l.relativeLuminance2(g,m,S));I<s&&(y>0||C>0||w>0);)y-=Math.max(0,Math.ceil(.1*y)),C-=Math.max(0,Math.ceil(.1*C)),w-=Math.max(0,Math.ceil(.1*w)),I=b(l.relativeLuminance2(y,w,C),l.relativeLuminance2(g,m,S));return(y<<24|C<<16|w<<8|255)>>>0}function f(h,_,s){for(var g=h>>24&255,m=h>>16&255,S=h>>8&255,y=_>>24&255,C=_>>16&255,w=_>>8&255,I=b(l.relativeLuminance2(y,w,C),l.relativeLuminance2(g,m,S));I<s&&(y<255||C<255||w<255);)y=Math.min(255,y+Math.ceil(.1*(255-y))),C=Math.min(255,C+Math.ceil(.1*(255-C))),w=Math.min(255,w+Math.ceil(.1*(255-w))),I=b(l.relativeLuminance2(y,w,C),l.relativeLuminance2(g,m,S));return(y<<24|C<<16|w<<8|255)>>>0}o.ensureContrastRatio=function(h,_,s){var g=l.relativeLuminance(h>>8),m=l.relativeLuminance(_>>8);if(b(g,m)<s)return m<g?c(h,_,s):f(h,_,s)},o.reduceLuminance=c,o.increaseLuminance=f,o.toChannels=function(h){return[h>>24&255,h>>16&255,h>>8&255,255&h]},o.toColor=function(h,_,s){return{css:a.toCss(h,_,s),rgba:a.toRgba(h,_,s)}}}(u=r.rgba||(r.rgba={})),r.toPaddedHex=d,r.contrastRatio=b},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=typeof navigator>"u",v=a?"node":navigator.userAgent,l=a?"node":navigator.platform;function u(d,b){return d.indexOf(b)>=0}r.isFirefox=!!~v.indexOf("Firefox"),r.isSafari=/^((?!chrome|android).)*safari/i.test(v),r.isMac=u(["Macintosh","MacIntel","MacPPC","Mac68K"],l),r.isIpad=l==="iPad",r.isIphone=l==="iPhone",r.isWindows=u(["Windows","Win16","Win32","WinCE"],l),r.isLinux=l.indexOf("Linux")>=0},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT="	",a.LF=`
`,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL=""}(r.C0||(r.C0={})),function(a){a.PAD="€",a.HOP="",a.BPH="‚",a.NBH="ƒ",a.IND="„",a.NEL="…",a.SSA="†",a.ESA="‡",a.HTS="ˆ",a.HTJ="‰",a.VTS="Š",a.PLD="‹",a.PLU="Œ",a.RI="",a.SS2="Ž",a.SS3="",a.DCS="",a.PU1="‘",a.PU2="’",a.STS="“",a.CCH="”",a.MW="•",a.SPA="–",a.EPA="—",a.SOS="˜",a.SGCI="™",a.SCI="š",a.CSI="›",a.ST="œ",a.OSC="",a.PM="ž",a.APC="Ÿ"}(r.C1||(r.C1={}))},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(3),v=p(9),l=p(23),u=p(6),d=p(26),b=p(10),o=function(){function c(f,h,_,s,g,m,S,y){this._container=f,this._alpha=s,this._colors=g,this._rendererId=m,this._bufferService=S,this._optionsService=y,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-"+h+"-layer"),this._canvas.style.zIndex=_.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return c.prototype.dispose=function(){var f;this._container.removeChild(this._canvas),(f=this._charAtlas)===null||f===void 0||f.dispose()},c.prototype._initCanvas=function(){this._ctx=d.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},c.prototype.onOptionsChanged=function(){},c.prototype.onBlur=function(){},c.prototype.onFocus=function(){},c.prototype.onCursorMove=function(){},c.prototype.onGridChanged=function(f,h){},c.prototype.onSelectionChanged=function(f,h,_){},c.prototype.setColors=function(f){this._refreshCharAtlas(f)},c.prototype._setTransparency=function(f){if(f!==this._alpha){var h=this._canvas;this._alpha=f,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,h),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},c.prototype._refreshCharAtlas=function(f){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=l.acquireCharAtlas(this._optionsService.options,this._rendererId,f,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},c.prototype.resize=function(f){this._scaledCellWidth=f.scaledCellWidth,this._scaledCellHeight=f.scaledCellHeight,this._scaledCharWidth=f.scaledCharWidth,this._scaledCharHeight=f.scaledCharHeight,this._scaledCharLeft=f.scaledCharLeft,this._scaledCharTop=f.scaledCharTop,this._canvas.width=f.scaledCanvasWidth,this._canvas.height=f.scaledCanvasHeight,this._canvas.style.width=f.canvasWidth+"px",this._canvas.style.height=f.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},c.prototype._fillCells=function(f,h,_,s){this._ctx.fillRect(f*this._scaledCellWidth,h*this._scaledCellHeight,_*this._scaledCellWidth,s*this._scaledCellHeight)},c.prototype._fillBottomLineAtCells=function(f,h,_){_===void 0&&(_=1),this._ctx.fillRect(f*this._scaledCellWidth,(h+1)*this._scaledCellHeight-window.devicePixelRatio-1,_*this._scaledCellWidth,window.devicePixelRatio)},c.prototype._fillLeftLineAtCell=function(f,h,_){this._ctx.fillRect(f*this._scaledCellWidth,h*this._scaledCellHeight,window.devicePixelRatio*_,this._scaledCellHeight)},c.prototype._strokeRectAtCell=function(f,h,_,s){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(f*this._scaledCellWidth+window.devicePixelRatio/2,h*this._scaledCellHeight+window.devicePixelRatio/2,_*this._scaledCellWidth-window.devicePixelRatio,s*this._scaledCellHeight-window.devicePixelRatio)},c.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))},c.prototype._clearCells=function(f,h,_,s){this._alpha?this._ctx.clearRect(f*this._scaledCellWidth,h*this._scaledCellHeight,_*this._scaledCellWidth,s*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(f*this._scaledCellWidth,h*this._scaledCellHeight,_*this._scaledCellWidth,s*this._scaledCellHeight))},c.prototype._fillCharTrueColor=function(f,h,_){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(_),this._ctx.fillText(f.getChars(),h*this._scaledCellWidth+this._scaledCharLeft,_*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},c.prototype._drawChars=function(f,h,_){var s,g,m=this._getContrastColor(f);m||f.isFgRGB()||f.isBgRGB()?this._drawUncachedChars(f,h,_,m):(f.isInverse()?(s=f.isBgDefault()?v.INVERTED_DEFAULT_COLOR:f.getBgColor(),g=f.isFgDefault()?v.INVERTED_DEFAULT_COLOR:f.getFgColor()):(g=f.isBgDefault()?a.DEFAULT_COLOR:f.getBgColor(),s=f.isFgDefault()?a.DEFAULT_COLOR:f.getFgColor()),s+=this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&s<8?8:0,this._currentGlyphIdentifier.chars=f.getChars()||a.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=f.getCode()||a.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=g,this._currentGlyphIdentifier.fg=s,this._currentGlyphIdentifier.bold=!!f.isBold(),this._currentGlyphIdentifier.dim=!!f.isDim(),this._currentGlyphIdentifier.italic=!!f.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,h*this._scaledCellWidth+this._scaledCharLeft,_*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(f,h,_))},c.prototype._drawUncachedChars=function(f,h,_,s){if(this._ctx.save(),this._ctx.font=this._getFont(!!f.isBold(),!!f.isItalic()),this._ctx.textBaseline="middle",f.isInverse())if(s)this._ctx.fillStyle=s.css;else if(f.isBgDefault())this._ctx.fillStyle=b.color.opaque(this._colors.background).css;else if(f.isBgRGB())this._ctx.fillStyle="rgb("+u.AttributeData.toColorRGB(f.getBgColor()).join(",")+")";else{var g=f.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&g<8&&(g+=8),this._ctx.fillStyle=this._colors.ansi[g].css}else if(s)this._ctx.fillStyle=s.css;else if(f.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(f.isFgRGB())this._ctx.fillStyle="rgb("+u.AttributeData.toColorRGB(f.getFgColor()).join(",")+")";else{var m=f.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&f.isBold()&&m<8&&(m+=8),this._ctx.fillStyle=this._colors.ansi[m].css}this._clipRow(_),f.isDim()&&(this._ctx.globalAlpha=v.DIM_OPACITY),this._ctx.fillText(f.getChars(),h*this._scaledCellWidth+this._scaledCharLeft,_*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},c.prototype._clipRow=function(f){this._ctx.beginPath(),this._ctx.rect(0,f*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},c.prototype._getFont=function(f,h){return(h?"italic":"")+" "+(f?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},c.prototype._getContrastColor=function(f){if(this._optionsService.options.minimumContrastRatio!==1){var h=this._colors.contrastCache.getColor(f.bg,f.fg);if(h!==void 0)return h||void 0;var _=f.getFgColor(),s=f.getFgColorMode(),g=f.getBgColor(),m=f.getBgColorMode(),S=!!f.isInverse(),y=!!f.isInverse();if(S){var C=_;_=g,g=C;var w=s;s=m,m=w}var I=this._resolveBackgroundRgba(m,g,S),R=this._resolveForegroundRgba(s,_,S,y),k=b.rgba.ensureContrastRatio(I,R,this._optionsService.options.minimumContrastRatio);if(k){var P={css:b.channels.toCss(k>>24&255,k>>16&255,k>>8&255),rgba:k};return this._colors.contrastCache.setColor(f.bg,f.fg,P),P}this._colors.contrastCache.setColor(f.bg,f.fg,null)}},c.prototype._resolveBackgroundRgba=function(f,h,_){switch(f){case 16777216:case 33554432:return this._colors.ansi[h].rgba;case 50331648:return h<<8;case 0:default:return _?this._colors.foreground.rgba:this._colors.background.rgba}},c.prototype._resolveForegroundRgba=function(f,h,_,s){switch(f){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&s&&h<8&&(h+=8),this._colors.ansi[h].rgba;case 50331648:return h<<8;case 0:default:return _?this._colors.background.rgba:this._colors.foreground.rgba}},c}();r.BaseRenderLayer=o},function(n,r,p){function a(v,l,u){l.di$target===l?l.di$dependencies.push({id:v,index:u}):(l.di$dependencies=[{id:v,index:u}],l.di$target=l)}Object.defineProperty(r,"__esModule",{value:!0}),r.serviceRegistry=new Map,r.getServiceDependencies=function(v){return v.di$dependencies||[]},r.createDecorator=function(v){if(r.serviceRegistry.has(v))return r.serviceRegistry.get(v);var l=function(u,d,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");a(l,u,b)};return l.toString=function(){return v},r.serviceRegistry.set(v,l),l}},function(n,r,p){function a(v,l,u,d){if(u===void 0&&(u=0),d===void 0&&(d=v.length),u>=v.length)return v;u=(v.length+u)%v.length,d=d>=v.length?v.length:(v.length+d)%v.length;for(var b=u;b<d;++b)v[b]=l;return v}Object.defineProperty(r,"__esModule",{value:!0}),r.fill=function(v,l,u,d){return v.fill?v.fill(l,u,d):a(v,l,u,d)},r.fillFallback=a,r.concat=function(v,l){var u=new v.constructor(v.length+l.length);return u.set(v),u.set(l,v.length),u}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(7),v=p(3),l=p(5),u=p(6);r.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);var d=function(){function b(o,c,f){f===void 0&&(f=!1),this.isWrapped=f,this._combined={},this._data=new Uint32Array(3*o);for(var h=c||l.CellData.fromCharData([0,v.NULL_CELL_CHAR,v.NULL_CELL_WIDTH,v.NULL_CELL_CODE]),_=0;_<o;++_)this.setCell(_,h);this.length=o}return b.prototype.get=function(o){var c=this._data[3*o+0],f=2097151&c;return[this._data[3*o+1],2097152&c?this._combined[o]:f?a.stringFromCodePoint(f):"",c>>22,2097152&c?this._combined[o].charCodeAt(this._combined[o].length-1):f]},b.prototype.set=function(o,c){this._data[3*o+1]=c[v.CHAR_DATA_ATTR_INDEX],c[v.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[o]=c[1],this._data[3*o+0]=2097152|o|c[v.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*o+0]=c[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|c[v.CHAR_DATA_WIDTH_INDEX]<<22},b.prototype.getWidth=function(o){return this._data[3*o+0]>>22},b.prototype.hasWidth=function(o){return 12582912&this._data[3*o+0]},b.prototype.getFg=function(o){return this._data[3*o+1]},b.prototype.getBg=function(o){return this._data[3*o+2]},b.prototype.hasContent=function(o){return 4194303&this._data[3*o+0]},b.prototype.getCodePoint=function(o){var c=this._data[3*o+0];return 2097152&c?this._combined[o].charCodeAt(this._combined[o].length-1):2097151&c},b.prototype.isCombined=function(o){return 2097152&this._data[3*o+0]},b.prototype.getString=function(o){var c=this._data[3*o+0];return 2097152&c?this._combined[o]:2097151&c?a.stringFromCodePoint(2097151&c):""},b.prototype.loadCell=function(o,c){var f=3*o;return c.content=this._data[f+0],c.fg=this._data[f+1],c.bg=this._data[f+2],2097152&c.content&&(c.combinedData=this._combined[o]),c},b.prototype.setCell=function(o,c){2097152&c.content&&(this._combined[o]=c.combinedData),this._data[3*o+0]=c.content,this._data[3*o+1]=c.fg,this._data[3*o+2]=c.bg},b.prototype.setCellFromCodePoint=function(o,c,f,h,_){this._data[3*o+0]=c|f<<22,this._data[3*o+1]=h,this._data[3*o+2]=_},b.prototype.addCodepointToCell=function(o,c){var f=this._data[3*o+0];2097152&f?this._combined[o]+=a.stringFromCodePoint(c):(2097151&f?(this._combined[o]=a.stringFromCodePoint(2097151&f)+a.stringFromCodePoint(c),f&=-2097152,f|=2097152):f=c|1<<22,this._data[3*o+0]=f)},b.prototype.insertCells=function(o,c,f,h){if((o%=this.length)&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o-1,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0),c<this.length-o){for(var _=new l.CellData,s=this.length-o-c-1;s>=0;--s)this.setCell(o+c+s,this.loadCell(o+s,_));for(s=0;s<c;++s)this.setCell(o+s,f)}else for(s=o;s<this.length;++s)this.setCell(s,f);this.getWidth(this.length-1)===2&&this.setCellFromCodePoint(this.length-1,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0)},b.prototype.deleteCells=function(o,c,f,h){if(o%=this.length,c<this.length-o){for(var _=new l.CellData,s=0;s<this.length-o-c;++s)this.setCell(o+s,this.loadCell(o+c+s,_));for(s=this.length-c;s<this.length;++s)this.setCell(s,f)}else for(s=o;s<this.length;++s)this.setCell(s,f);o&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o-1,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0),this.getWidth(o)!==0||this.hasContent(o)||this.setCellFromCodePoint(o,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0)},b.prototype.replaceCells=function(o,c,f,h){for(o&&this.getWidth(o-1)===2&&this.setCellFromCodePoint(o-1,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0),c<this.length&&this.getWidth(c-1)===2&&this.setCellFromCodePoint(c,0,1,(h==null?void 0:h.fg)||0,(h==null?void 0:h.bg)||0);o<c&&o<this.length;)this.setCell(o++,f)},b.prototype.resize=function(o,c){if(o!==this.length){if(o>this.length){var f=new Uint32Array(3*o);this.length&&(3*o<this._data.length?f.set(this._data.subarray(0,3*o)):f.set(this._data)),this._data=f;for(var h=this.length;h<o;++h)this.setCell(h,c)}else if(o){(f=new Uint32Array(3*o)).set(this._data.subarray(0,3*o)),this._data=f;var _=Object.keys(this._combined);for(h=0;h<_.length;h++){var s=parseInt(_[h],10);s>=o&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=o}},b.prototype.fill=function(o){this._combined={};for(var c=0;c<this.length;++c)this.setCell(c,o)},b.prototype.copyFrom=function(o){for(var c in this.length!==o.length?this._data=new Uint32Array(o._data):this._data.set(o._data),this.length=o.length,this._combined={},o._combined)this._combined[c]=o._combined[c];this.isWrapped=o.isWrapped},b.prototype.clone=function(){var o=new b(0);for(var c in o._data=new Uint32Array(this._data),o.length=this.length,this._combined)o._combined[c]=this._combined[c];return o.isWrapped=this.isWrapped,o},b.prototype.getTrimmedLength=function(){for(var o=this.length-1;o>=0;--o)if(4194303&this._data[3*o+0])return o+(this._data[3*o+0]>>22);return 0},b.prototype.copyCellsFrom=function(o,c,f,h,_){var s=o._data;if(_)for(var g=h-1;g>=0;g--)for(var m=0;m<3;m++)this._data[3*(f+g)+m]=s[3*(c+g)+m];else for(g=0;g<h;g++)for(m=0;m<3;m++)this._data[3*(f+g)+m]=s[3*(c+g)+m];var S=Object.keys(o._combined);for(m=0;m<S.length;m++){var y=parseInt(S[m],10);y>=c&&(this._combined[y-c+f]=o._combined[y])}},b.prototype.translateToString=function(o,c,f){o===void 0&&(o=!1),c===void 0&&(c=0),f===void 0&&(f=this.length),o&&(f=Math.min(f,this.getTrimmedLength()));for(var h="";c<f;){var _=this._data[3*c+0],s=2097151&_;h+=2097152&_?this._combined[c]:s?a.stringFromCodePoint(s):v.WHITESPACE_CELL_CHAR,c+=_>>22||1}return h},b}();r.BufferLine=d},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=null,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l,u){if(l===void 0&&(l=32),u===void 0&&(u=32),this.maxLength=l,this.maxSubParamsLength=u,u>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(u),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return v.fromArray=function(l){var u=new v;if(!l.length)return u;for(var d=l[0]instanceof Array?1:0;d<l.length;++d){var b=l[d];if(b instanceof Array)for(var o=0;o<b.length;++o)u.addSubParam(b[o]);else u.addParam(b)}return u},v.prototype.clone=function(){var l=new v(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l},v.prototype.toArray=function(){for(var l=[],u=0;u<this.length;++u){l.push(this.params[u]);var d=this._subParamsIdx[u]>>8,b=255&this._subParamsIdx[u];b-d>0&&l.push(Array.prototype.slice.call(this._subParams,d,b))}return l},v.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},v.prototype.addParam=function(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>2147483647?2147483647:l}},v.prototype.addSubParam=function(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>2147483647?2147483647:l,this._subParamsIdx[this.length-1]++}},v.prototype.hasSubParams=function(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0},v.prototype.getSubParams=function(l){var u=this._subParamsIdx[l]>>8,d=255&this._subParamsIdx[l];return d-u>0?this._subParams.subarray(u,d):null},v.prototype.getSubParamsAll=function(){for(var l={},u=0;u<this.length;++u){var d=this._subParamsIdx[u]>>8,b=255&this._subParamsIdx[u];b-d>0&&(l[u]=this._subParams.slice(d,b))}return l},v.prototype.addDigit=function(l){var u;if(!(this._rejectDigits||!(u=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var d=this._digitIsSub?this._subParams:this.params,b=d[u-1];d[u-1]=~b?Math.min(10*b+l,2147483647):l}},v}();r.Params=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(21),v=p(7),l=function(){function d(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return d.prototype.addHandler=function(b,o){this._handlers[b]===void 0&&(this._handlers[b]=[]);var c=this._handlers[b];return c.push(o),{dispose:function(){var f=c.indexOf(o);f!==-1&&c.splice(f,1)}}},d.prototype.setHandler=function(b,o){this._handlers[b]=[o]},d.prototype.clearHandler=function(b){this._handlers[b]&&delete this._handlers[b]},d.prototype.setHandlerFallback=function(b){this._handlerFb=b},d.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},d.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},d.prototype._start=function(){var b=this._handlers[this._id];if(b)for(var o=b.length-1;o>=0;o--)b[o].start();else this._handlerFb(this._id,"START")},d.prototype._put=function(b,o,c){var f=this._handlers[this._id];if(f)for(var h=f.length-1;h>=0;h--)f[h].put(b,o,c);else this._handlerFb(this._id,"PUT",v.utf32ToString(b,o,c))},d.prototype._end=function(b){var o=this._handlers[this._id];if(o){for(var c=o.length-1;c>=0&&o[c].end(b)===!1;c--);for(c--;c>=0;c--)o[c].end(!1)}else this._handlerFb(this._id,"END",b)},d.prototype.start=function(){this.reset(),this._id=-1,this._state=1},d.prototype.put=function(b,o,c){if(this._state!==3){if(this._state===1)for(;o<c;){var f=b[o++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&c-o>0&&this._put(b,o,c)}},d.prototype.end=function(b){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(b)),this._id=-1,this._state=0)},d}();r.OscParser=l;var u=function(){function d(b){this._handler=b,this._data="",this._hitLimit=!1}return d.prototype.start=function(){this._data="",this._hitLimit=!1},d.prototype.put=function(b,o,c){this._hitLimit||(this._data+=v.utf32ToString(b,o,c),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},d.prototype.end=function(b){var o;return this._hitLimit?o=!1:b&&(o=this._handler(this._data)),this._data="",this._hitLimit=!1,o},d}();r.OscHandler=u},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=1e7},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(7),v=p(19),l=p(21),u=[],d=function(){function o(){this._handlers=Object.create(null),this._active=u,this._ident=0,this._handlerFb=function(){}}return o.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},o.prototype.addHandler=function(c,f){this._handlers[c]===void 0&&(this._handlers[c]=[]);var h=this._handlers[c];return h.push(f),{dispose:function(){var _=h.indexOf(f);_!==-1&&h.splice(_,1)}}},o.prototype.setHandler=function(c,f){this._handlers[c]=[f]},o.prototype.clearHandler=function(c){this._handlers[c]&&delete this._handlers[c]},o.prototype.setHandlerFallback=function(c){this._handlerFb=c},o.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=u,this._ident=0},o.prototype.hook=function(c,f){if(this.reset(),this._ident=c,this._active=this._handlers[c]||u,this._active.length)for(var h=this._active.length-1;h>=0;h--)this._active[h].hook(f);else this._handlerFb(this._ident,"HOOK",f)},o.prototype.put=function(c,f,h){if(this._active.length)for(var _=this._active.length-1;_>=0;_--)this._active[_].put(c,f,h);else this._handlerFb(this._ident,"PUT",a.utf32ToString(c,f,h))},o.prototype.unhook=function(c){if(this._active.length){for(var f=this._active.length-1;f>=0&&this._active[f].unhook(c)===!1;f--);for(f--;f>=0;f--)this._active[f].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",c);this._active=u,this._ident=0},o}();r.DcsParser=d;var b=function(){function o(c){this._handler=c,this._data="",this._hitLimit=!1}return o.prototype.hook=function(c){this._params=c.clone(),this._data="",this._hitLimit=!1},o.prototype.put=function(c,f,h){this._hitLimit||(this._data+=a.utf32ToString(c,f,h),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},o.prototype.unhook=function(c){var f;return this._hitLimit?f=!1:c&&(f=this._handler(this._data,this._params?this._params:new v.Params)),this._params=void 0,this._data="",this._hitLimit=!1,f},o}();r.DcsHandler=b},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(24),v=p(42),l=[];r.acquireCharAtlas=function(u,d,b,o,c){for(var f=a.generateConfig(o,c,u,b),h=0;h<l.length;h++){var _=(s=l[h]).ownedBy.indexOf(d);if(_>=0){if(a.configEquals(s.config,f))return s.atlas;s.ownedBy.length===1?(s.atlas.dispose(),l.splice(h,1)):s.ownedBy.splice(_,1);break}}for(h=0;h<l.length;h++){var s=l[h];if(a.configEquals(s.config,f))return s.ownedBy.push(d),s.atlas}var g={atlas:new v.DynamicCharAtlas(document,f),config:f,ownedBy:[d]};return l.push(g),g.atlas},r.removeTerminalFromCache=function(u){for(var d=0;d<l.length;d++){var b=l[d].ownedBy.indexOf(u);if(b!==-1){l[d].ownedBy.length===1?(l[d].atlas.dispose(),l.splice(d,1)):l[d].ownedBy.splice(b,1);break}}}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(3);r.generateConfig=function(v,l,u,d){var b={foreground:d.foreground,background:d.background,cursor:void 0,cursorAccent:void 0,selection:void 0,ansi:d.ansi.slice(0,16)};return{devicePixelRatio:window.devicePixelRatio,scaledCharWidth:v,scaledCharHeight:l,fontFamily:u.fontFamily,fontSize:u.fontSize,fontWeight:u.fontWeight,fontWeightBold:u.fontWeightBold,allowTransparency:u.allowTransparency,colors:b}},r.configEquals=function(v,l){for(var u=0;u<v.colors.ansi.length;u++)if(v.colors.ansi[u].rgba!==l.colors.ansi[u].rgba)return!1;return v.devicePixelRatio===l.devicePixelRatio&&v.fontFamily===l.fontFamily&&v.fontSize===l.fontSize&&v.fontWeight===l.fontWeight&&v.fontWeightBold===l.fontWeightBold&&v.allowTransparency===l.allowTransparency&&v.scaledCharWidth===l.scaledCharWidth&&v.scaledCharHeight===l.scaledCharHeight&&v.colors.foreground===l.colors.foreground&&v.colors.background===l.colors.background},r.is256Color=function(v){return v<a.DEFAULT_COLOR}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(10),v=p(44),l=a.css.toColor("#ffffff"),u=a.css.toColor("#000000"),d=a.css.toColor("#ffffff"),b=a.css.toColor("#000000"),o={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=function(){for(var f=[a.css.toColor("#2e3436"),a.css.toColor("#cc0000"),a.css.toColor("#4e9a06"),a.css.toColor("#c4a000"),a.css.toColor("#3465a4"),a.css.toColor("#75507b"),a.css.toColor("#06989a"),a.css.toColor("#d3d7cf"),a.css.toColor("#555753"),a.css.toColor("#ef2929"),a.css.toColor("#8ae234"),a.css.toColor("#fce94f"),a.css.toColor("#729fcf"),a.css.toColor("#ad7fa8"),a.css.toColor("#34e2e2"),a.css.toColor("#eeeeec")],h=[0,95,135,175,215,255],_=0;_<216;_++){var s=h[_/36%6|0],g=h[_/6%6|0],m=h[_%6];f.push({css:a.channels.toCss(s,g,m),rgba:a.channels.toRgba(s,g,m)})}for(_=0;_<24;_++){var S=8+10*_;f.push({css:a.channels.toCss(S,S,S),rgba:a.channels.toRgba(S,S,S)})}return f}();var c=function(){function f(h,_){this.allowTransparency=_;var s=h.createElement("canvas");s.width=1,s.height=1;var g=s.getContext("2d");if(!g)throw new Error("Could not get rendering context");this._ctx=g,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new v.ColorContrastCache,this.colors={foreground:l,background:u,cursor:d,cursorAccent:b,selection:o,selectionOpaque:a.color.blend(u,o),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return f.prototype.onOptionsChange=function(h){h==="minimumContrastRatio"&&this._contrastCache.clear()},f.prototype.setTheme=function(h){h===void 0&&(h={}),this.colors.foreground=this._parseColor(h.foreground,l),this.colors.background=this._parseColor(h.background,u),this.colors.cursor=this._parseColor(h.cursor,d,!0),this.colors.cursorAccent=this._parseColor(h.cursorAccent,b,!0),this.colors.selection=this._parseColor(h.selection,o,!0),this.colors.selectionOpaque=a.color.blend(this.colors.background,this.colors.selection),this.colors.ansi[0]=this._parseColor(h.black,r.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(h.red,r.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(h.green,r.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(h.yellow,r.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(h.blue,r.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(h.magenta,r.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(h.cyan,r.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(h.white,r.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(h.brightBlack,r.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(h.brightRed,r.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(h.brightGreen,r.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(h.brightYellow,r.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(h.brightBlue,r.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(h.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(h.brightCyan,r.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(h.brightWhite,r.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},f.prototype._parseColor=function(h,_,s){if(s===void 0&&(s=this.allowTransparency),h===void 0)return _;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=h,typeof this._ctx.fillStyle!="string")return console.warn("Color: "+h+" is invalid using fallback "+_.css),_;this._ctx.fillRect(0,0,1,1);var g=this._ctx.getImageData(0,0,1,1).data;if(g[3]!==255){if(!s)return console.warn("Color: "+h+" is using transparency, but allowTransparency is false. Using fallback "+_.css+"."),_;var m=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(R){return Number(R)}),S=m[0],y=m[1],C=m[2],w=m[3],I=Math.round(255*w);return{rgba:a.channels.toRgba(S,y,C,I),css:h}}return{css:this._ctx.fillStyle,rgba:a.channels.toRgba(g[0],g[1],g[2],g[3])}},f}();r.ColorManager=c},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.throwIfFalsy=function(a){if(!a)throw new Error("value must not be falsy");return a}},function(n,r,p){var a,v=this&&this.__extends||(a=function(c,f){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,_){h.__proto__=_}||function(h,_){for(var s in _)_.hasOwnProperty(s)&&(h[s]=_[s])})(c,f)},function(c,f){function h(){this.constructor=c}a(c,f),c.prototype=f===null?Object.create(f):(h.prototype=f.prototype,new h)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(6),u=p(3),d=p(5),b=function(c){function f(h,_,s){var g=c.call(this)||this;return g.content=0,g.combinedData="",g.fg=h.fg,g.bg=h.bg,g.combinedData=_,g._width=s,g}return v(f,c),f.prototype.isCombined=function(){return 2097152},f.prototype.getWidth=function(){return this._width},f.prototype.getChars=function(){return this.combinedData},f.prototype.getCode=function(){return 2097151},f.prototype.setFromCharData=function(h){throw new Error("not implemented")},f.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},f}(l.AttributeData);r.JoinedCellData=b;var o=function(){function c(f){this._bufferService=f,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new d.CellData}return c.prototype.registerCharacterJoiner=function(f){var h={id:this._nextCharacterJoinerId++,handler:f};return this._characterJoiners.push(h),h.id},c.prototype.deregisterCharacterJoiner=function(f){for(var h=0;h<this._characterJoiners.length;h++)if(this._characterJoiners[h].id===f)return this._characterJoiners.splice(h,1),!0;return!1},c.prototype.getJoinedCharacters=function(f){if(this._characterJoiners.length===0)return[];var h=this._bufferService.buffer.lines.get(f);if(!h||h.length===0)return[];for(var _=[],s=h.translateToString(!0),g=0,m=0,S=0,y=h.getFg(0),C=h.getBg(0),w=0;w<h.getTrimmedLength();w++)if(h.loadCell(w,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==y||this._workCell.bg!==C){if(w-g>1)for(var I=this._getJoinedRanges(s,S,m,h,g),R=0;R<I.length;R++)_.push(I[R]);g=w,S=m,y=this._workCell.fg,C=this._workCell.bg}m+=this._workCell.getChars().length||u.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-g>1)for(I=this._getJoinedRanges(s,S,m,h,g),R=0;R<I.length;R++)_.push(I[R]);return _},c.prototype._getJoinedRanges=function(f,h,_,s,g){for(var m=f.substring(h,_),S=this._characterJoiners[0].handler(m),y=1;y<this._characterJoiners.length;y++)for(var C=this._characterJoiners[y].handler(m),w=0;w<C.length;w++)c._mergeRanges(S,C[w]);return this._stringRangesToCellRanges(S,s,g),S},c.prototype._stringRangesToCellRanges=function(f,h,_){var s=0,g=!1,m=0,S=f[s];if(S){for(var y=_;y<this._bufferService.cols;y++){var C=h.getWidth(y),w=h.getString(y).length||u.WHITESPACE_CELL_CHAR.length;if(C!==0){if(!g&&S[0]<=m&&(S[0]=y,g=!0),S[1]<=m){if(S[1]=y,!(S=f[++s]))break;S[0]<=m?(S[0]=y,g=!0):g=!1}m+=w}}S&&(S[1]=this._bufferService.cols)}},c._mergeRanges=function(f,h){for(var _=!1,s=0;s<f.length;s++){var g=f[s];if(_){if(h[1]<=g[0])return f[s-1][1]=h[1],f;if(h[1]<=g[1])return f[s-1][1]=Math.max(h[1],g[1]),f.splice(s,1),f;f.splice(s,1),s--}else{if(h[1]<=g[0])return f.splice(s,0,h),f;if(h[1]<=g[1])return g[0]=Math.min(h[0],g[0]),f;h[0]<g[1]&&(g[0]=Math.min(h[0],g[0]),_=!0)}}return _?f[f.length-1][1]=h[1]:f.push(h),f},c}();r.CharacterJoinerRegistry=o},function(n,r,p){function a(v,l){var u=l.getBoundingClientRect();return[v.clientX-u.left,v.clientY-u.top]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoordsRelativeToElement=a,r.getCoords=function(v,l,u,d,b,o,c,f){if(b){var h=a(v,l);if(h)return h[0]=Math.ceil((h[0]+(f?o/2:0))/o),h[1]=Math.ceil(h[1]/c),h[0]=Math.min(Math.max(h[0],1),u+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),d),h}},r.getRawByteCoords=function(v){if(v)return{x:v[0]+32,y:v[1]+32}}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l){this._renderCallback=l}return v.prototype.dispose=function(){this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},v.prototype.refresh=function(l,u,d){var b=this;this._rowCount=d,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){return b._innerRefresh()}))},v.prototype._innerRefresh=function(){this._rowStart!==void 0&&this._rowEnd!==void 0&&this._rowCount!==void 0&&(this._rowStart=Math.max(this._rowStart,0),this._rowEnd=Math.min(this._rowEnd,this._rowCount-1),this._renderCallback(this._rowStart,this._rowEnd),this._rowStart=void 0,this._rowEnd=void 0,this._animationFrame=void 0)},v}();r.RenderDebouncer=a},function(n,r,p){var a,v=this&&this.__extends||(a=function(u,d){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,o){b.__proto__=o}||function(b,o){for(var c in o)o.hasOwnProperty(c)&&(b[c]=o[c])})(u,d)},function(u,d){function b(){this.constructor=u}a(u,d),u.prototype=d===null?Object.create(d):(b.prototype=d.prototype,new b)});Object.defineProperty(r,"__esModule",{value:!0});var l=function(u){function d(){var b=u!==null&&u.apply(this,arguments)||this;return b._currentDevicePixelRatio=window.devicePixelRatio,b}return v(d,u),d.prototype.setListener=function(b){var o=this;this._listener&&this.clearListener(),this._listener=b,this._outerListener=function(){o._listener&&(o._listener(window.devicePixelRatio,o._currentDevicePixelRatio),o._updateDpr())},this._updateDpr()},d.prototype.dispose=function(){u.prototype.dispose.call(this),this.clearListener()},d.prototype._updateDpr=function(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._currentDevicePixelRatio=window.devicePixelRatio,this._resolutionMediaMatchList=window.matchMedia("screen and (resolution: "+window.devicePixelRatio+"dppx)"),this._resolutionMediaMatchList.addListener(this._outerListener))},d.prototype.clearListener=function(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)},d}(p(2).Disposable);r.ScreenDprMonitor=l},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0}),r.clone=function a(v,l){if(l===void 0&&(l=5),typeof v!="object")return v;var u=Array.isArray(v)?[]:{};for(var d in v)u[d]=l<=1?v[d]:v[d]?a(v[d],l-1):v[d];return u}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(5),v=p(33),l=p(17),u=p(0),d=p(81),b=function(){function s(g){this._core=new v.Terminal(g),this._addonManager=new d.AddonManager}return Object.defineProperty(s.prototype,"onCursorMove",{get:function(){return this._core.onCursorMove},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onLineFeed",{get:function(){return this._core.onLineFeed},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onSelectionChange",{get:function(){return this._core.onSelectionChange},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onData",{get:function(){return this._core.onData},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onBinary",{get:function(){return this._core.onBinary},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onTitleChange",{get:function(){return this._core.onTitleChange},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onScroll",{get:function(){return this._core.onScroll},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onKey",{get:function(){return this._core.onKey},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onRender",{get:function(){return this._core.onRender},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"onResize",{get:function(){return this._core.onResize},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"element",{get:function(){return this._core.element},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"parser",{get:function(){return this._parser||(this._parser=new h(this._core)),this._parser},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"unicode",{get:function(){return new _(this._core)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"textarea",{get:function(){return this._core.textarea},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"rows",{get:function(){return this._core.rows},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"cols",{get:function(){return this._core.cols},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"buffer",{get:function(){return new c(this._core.buffers)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"markers",{get:function(){return this._core.markers},enumerable:!0,configurable:!0}),s.prototype.blur=function(){this._core.blur()},s.prototype.focus=function(){this._core.focus()},s.prototype.resize=function(g,m){this._verifyIntegers(g,m),this._core.resize(g,m)},s.prototype.open=function(g){this._core.open(g)},s.prototype.attachCustomKeyEventHandler=function(g){this._core.attachCustomKeyEventHandler(g)},s.prototype.registerLinkMatcher=function(g,m,S){return this._core.registerLinkMatcher(g,m,S)},s.prototype.deregisterLinkMatcher=function(g){this._core.deregisterLinkMatcher(g)},s.prototype.registerLinkProvider=function(g){return this._core.registerLinkProvider(g)},s.prototype.registerCharacterJoiner=function(g){return this._core.registerCharacterJoiner(g)},s.prototype.deregisterCharacterJoiner=function(g){this._core.deregisterCharacterJoiner(g)},s.prototype.registerMarker=function(g){return this._verifyIntegers(g),this._core.addMarker(g)},s.prototype.addMarker=function(g){return this.registerMarker(g)},s.prototype.hasSelection=function(){return this._core.hasSelection()},s.prototype.select=function(g,m,S){this._verifyIntegers(g,m,S),this._core.select(g,m,S)},s.prototype.getSelection=function(){return this._core.getSelection()},s.prototype.getSelectionPosition=function(){return this._core.getSelectionPosition()},s.prototype.clearSelection=function(){this._core.clearSelection()},s.prototype.selectAll=function(){this._core.selectAll()},s.prototype.selectLines=function(g,m){this._verifyIntegers(g,m),this._core.selectLines(g,m)},s.prototype.dispose=function(){this._addonManager.dispose(),this._core.dispose()},s.prototype.scrollLines=function(g){this._verifyIntegers(g),this._core.scrollLines(g)},s.prototype.scrollPages=function(g){this._verifyIntegers(g),this._core.scrollPages(g)},s.prototype.scrollToTop=function(){this._core.scrollToTop()},s.prototype.scrollToBottom=function(){this._core.scrollToBottom()},s.prototype.scrollToLine=function(g){this._verifyIntegers(g),this._core.scrollToLine(g)},s.prototype.clear=function(){this._core.clear()},s.prototype.write=function(g,m){this._core.write(g,m)},s.prototype.writeUtf8=function(g,m){this._core.write(g,m)},s.prototype.writeln=function(g,m){this._core.write(g),this._core.write(`\r
`,m)},s.prototype.paste=function(g){this._core.paste(g)},s.prototype.getOption=function(g){return this._core.optionsService.getOption(g)},s.prototype.setOption=function(g,m){this._core.optionsService.setOption(g,m)},s.prototype.refresh=function(g,m){this._verifyIntegers(g,m),this._core.refresh(g,m)},s.prototype.reset=function(){this._core.reset()},s.prototype.loadAddon=function(g){return this._addonManager.loadAddon(this,g)},Object.defineProperty(s,"strings",{get:function(){return l},enumerable:!0,configurable:!0}),s.prototype._verifyIntegers=function(){for(var g=[],m=0;m<arguments.length;m++)g[m]=arguments[m];g.forEach(function(S){if(S===1/0||isNaN(S)||S%1!=0)throw new Error("This API only accepts integers")})},s}();r.Terminal=b;var o=function(){function s(g,m){this._buffer=g,this.type=m}return s.prototype.init=function(g){return this._buffer=g,this},Object.defineProperty(s.prototype,"cursorY",{get:function(){return this._buffer.y},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"cursorX",{get:function(){return this._buffer.x},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"viewportY",{get:function(){return this._buffer.ydisp},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"baseY",{get:function(){return this._buffer.ybase},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"length",{get:function(){return this._buffer.lines.length},enumerable:!0,configurable:!0}),s.prototype.getLine=function(g){var m=this._buffer.lines.get(g);if(m)return new f(m)},s.prototype.getNullCell=function(){return new a.CellData},s}(),c=function(){function s(g){var m=this;this._buffers=g,this._onBufferChange=new u.EventEmitter,this._normal=new o(this._buffers.normal,"normal"),this._alternate=new o(this._buffers.alt,"alternate"),this._buffers.onBufferActivate(function(){return m._onBufferChange.fire(m.active)})}return Object.defineProperty(s.prototype,"onBufferChange",{get:function(){return this._onBufferChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"active",{get:function(){if(this._buffers.active===this._buffers.normal)return this.normal;if(this._buffers.active===this._buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"normal",{get:function(){return this._normal.init(this._buffers.normal)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"alternate",{get:function(){return this._alternate.init(this._buffers.alt)},enumerable:!0,configurable:!0}),s}(),f=function(){function s(g){this._line=g}return Object.defineProperty(s.prototype,"isWrapped",{get:function(){return this._line.isWrapped},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"length",{get:function(){return this._line.length},enumerable:!0,configurable:!0}),s.prototype.getCell=function(g,m){if(!(g<0||g>=this._line.length))return m?(this._line.loadCell(g,m),m):this._line.loadCell(g,new a.CellData)},s.prototype.translateToString=function(g,m,S){return this._line.translateToString(g,m,S)},s}(),h=function(){function s(g){this._core=g}return s.prototype.registerCsiHandler=function(g,m){return this._core.addCsiHandler(g,function(S){return m(S.toArray())})},s.prototype.addCsiHandler=function(g,m){return this.registerCsiHandler(g,m)},s.prototype.registerDcsHandler=function(g,m){return this._core.addDcsHandler(g,function(S,y){return m(S,y.toArray())})},s.prototype.addDcsHandler=function(g,m){return this.registerDcsHandler(g,m)},s.prototype.registerEscHandler=function(g,m){return this._core.addEscHandler(g,m)},s.prototype.addEscHandler=function(g,m){return this.registerEscHandler(g,m)},s.prototype.registerOscHandler=function(g,m){return this._core.addOscHandler(g,m)},s.prototype.addOscHandler=function(g,m){return this.registerOscHandler(g,m)},s}(),_=function(){function s(g){this._core=g}return s.prototype.register=function(g){this._core.unicodeService.register(g)},Object.defineProperty(s.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(g){this._core.unicodeService.activeVersion=g},enumerable:!0,configurable:!0}),s}()},function(n,r,p){var a,v=this&&this.__extends||(a=function(ce,G){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,O){T.__proto__=O}||function(T,O){for(var Y in O)O.hasOwnProperty(Y)&&(T[Y]=O[Y])})(ce,G)},function(ce,G){function T(){this.constructor=ce}a(ce,G),ce.prototype=G===null?Object.create(G):(T.prototype=G.prototype,new T)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(34),u=p(35),d=p(36),b=p(12),o=p(37),c=p(39),f=p(49),h=p(50),_=p(11),s=p(8),g=p(17),m=p(53),S=p(54),y=p(55),C=p(56),w=p(58),I=p(0),R=p(16),k=p(59),P=p(25),x=p(60),A=p(1),M=p(61),N=p(4),z=p(62),j=p(63),ee=p(2),re=p(69),ue=p(70),_e=p(71),Ce=p(72),L=p(73),ae=p(74),B=p(75),W=p(76),U=p(77),Q=p(78),$=p(80),te=typeof window<"u"?window.document:null,de=function(ce){function G(T){T===void 0&&(T={});var O=ce.call(this)||this;return O.browser=_,O.mouseEvents=0,O._keyDownHandled=!1,O._blankLine=null,O._onCursorMove=new I.EventEmitter,O._onData=new I.EventEmitter,O._onBinary=new I.EventEmitter,O._onKey=new I.EventEmitter,O._onLineFeed=new I.EventEmitter,O._onRender=new I.EventEmitter,O._onResize=new I.EventEmitter,O._onScroll=new I.EventEmitter,O._onSelectionChange=new I.EventEmitter,O._onTitleChange=new I.EventEmitter,O._onFocus=new I.EventEmitter,O._onBlur=new I.EventEmitter,O.onA11yCharEmitter=new I.EventEmitter,O.onA11yTabEmitter=new I.EventEmitter,O._instantiationService=new L.InstantiationService,O.optionsService=new M.OptionsService(T),O._instantiationService.setService(A.IOptionsService,O.optionsService),O._bufferService=O._instantiationService.createInstance(j.BufferService),O._instantiationService.setService(A.IBufferService,O._bufferService),O._logService=O._instantiationService.createInstance(_e.LogService),O._instantiationService.setService(A.ILogService,O._logService),O._coreService=O._instantiationService.createInstance(ue.CoreService,function(){return O.scrollToBottom()}),O._instantiationService.setService(A.ICoreService,O._coreService),O._coreService.onData(function(Y){return O._onData.fire(Y)}),O._coreService.onBinary(function(Y){return O._onBinary.fire(Y)}),O._coreMouseService=O._instantiationService.createInstance(ae.CoreMouseService),O._instantiationService.setService(A.ICoreMouseService,O._coreMouseService),O._dirtyRowService=O._instantiationService.createInstance(Ce.DirtyRowService),O._instantiationService.setService(A.IDirtyRowService,O._dirtyRowService),O.unicodeService=O._instantiationService.createInstance(Q.UnicodeService),O._instantiationService.setService(A.IUnicodeService,O.unicodeService),O._charsetService=O._instantiationService.createInstance($.CharsetService),O._instantiationService.setService(A.ICharsetService,O._charsetService),O._setupOptionsListeners(),O._setup(),O._writeBuffer=new B.WriteBuffer(function(Y){return O._inputHandler.parse(Y)}),O}return v(G,ce),Object.defineProperty(G.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"cols",{get:function(){return this._bufferService.cols},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"rows",{get:function(){return this._bufferService.rows},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onA11yChar",{get:function(){return this.onA11yCharEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"onA11yTab",{get:function(){return this.onA11yTabEmitter.event},enumerable:!0,configurable:!0}),G.prototype.dispose=function(){var T,O,Y,se;this._isDisposed||(ce.prototype.dispose.call(this),(T=this._windowsMode)===null||T===void 0||T.dispose(),this._windowsMode=void 0,(O=this._renderService)===null||O===void 0||O.dispose(),this._customKeyEventHandler=null,this.write=function(){},(se=(Y=this.element)===null||Y===void 0?void 0:Y.parentNode)===null||se===void 0||se.removeChild(this.element))},G.prototype._setup=function(){var T=this;this._customKeyEventHandler=null,this.insertMode=!1,this.bracketedPasteMode=!1,this._userScrolling=!1,this._inputHandler?this._inputHandler.reset():(this._inputHandler=new o.InputHandler(this,this._bufferService,this._charsetService,this._coreService,this._dirtyRowService,this._logService,this.optionsService,this._coreMouseService,this.unicodeService,this._instantiationService),this._inputHandler.onRequestBell(function(){return T.bell()}),this._inputHandler.onRequestRefreshRows(function(O,Y){return T.refresh(O,Y)}),this._inputHandler.onRequestReset(function(){return T.reset()}),this._inputHandler.onCursorMove(function(){return T._onCursorMove.fire()}),this._inputHandler.onLineFeed(function(){return T._onLineFeed.fire()}),this.register(this._inputHandler)),this.linkifier||(this.linkifier=new f.Linkifier(this._bufferService,this._logService,this.optionsService,this.unicodeService)),this.linkifier2||(this.linkifier2=new W.Linkifier2(this._bufferService)),this.options.windowsMode&&this._enableWindowsMode()},G.prototype._enableWindowsMode=function(){var T=this;if(!this._windowsMode){var O=[];O.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.addCsiHandler({final:"H"},function(){return k.updateWindowsModeWrappedState(T._bufferService),!1})),this._windowsMode={dispose:function(){O.forEach(function(Y){return Y.dispose()})}}}},Object.defineProperty(G.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0,configurable:!0}),Object.defineProperty(G.prototype,"buffers",{get:function(){return this._bufferService.buffers},enumerable:!0,configurable:!0}),G.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},G.prototype._setupOptionsListeners=function(){var T=this;this.optionsService.onOptionChange(function(O){var Y,se,ie,le,Ie;switch(O){case"fontFamily":case"fontSize":(Y=T._renderService)===null||Y===void 0||Y.clear(),(se=T._charSizeService)===null||se===void 0||se.measure();break;case"cursorBlink":case"cursorStyle":T.refresh(T.buffer.y,T.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":T._renderService&&(T._renderService.clear(),T._renderService.onResize(T.cols,T.rows),T.refresh(0,T.rows-1));break;case"rendererType":T._renderService&&(T._renderService.setRenderer(T._createRenderer()),T._renderService.onResize(T.cols,T.rows));break;case"scrollback":T.buffers.resize(T.cols,T.rows),(ie=T.viewport)===null||ie===void 0||ie.syncScrollArea();break;case"screenReaderMode":T.optionsService.options.screenReaderMode?!T._accessibilityManager&&T._renderService&&(T._accessibilityManager=new y.AccessibilityManager(T,T._renderService)):((le=T._accessibilityManager)===null||le===void 0||le.dispose(),T._accessibilityManager=null);break;case"tabStopWidth":T.buffers.setupTabStops();break;case"theme":T._setTheme(T.optionsService.options.theme);break;case"windowsMode":T.optionsService.options.windowsMode?T._enableWindowsMode():((Ie=T._windowsMode)===null||Ie===void 0||Ie.dispose(),T._windowsMode=void 0)}})},G.prototype._onTextAreaFocus=function(T){this.sendFocus&&this._coreService.triggerDataEvent(b.C0.ESC+"[I"),this.updateCursorStyle(T),this.element.classList.add("focus"),this.showCursor(),this._onFocus.fire()},G.prototype.blur=function(){return this.textarea.blur()},G.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.sendFocus&&this._coreService.triggerDataEvent(b.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},G.prototype._initGlobal=function(){var T=this;this._bindKeys(),this.register(s.addDisposableDomListener(this.element,"copy",function(Y){T.hasSelection()&&d.copyHandler(Y,T._selectionService)}));var O=function(Y){return d.handlePasteEvent(Y,T.textarea,T.bracketedPasteMode,T._coreService)};this.register(s.addDisposableDomListener(this.textarea,"paste",O)),this.register(s.addDisposableDomListener(this.element,"paste",O)),_.isFirefox?this.register(s.addDisposableDomListener(this.element,"mousedown",function(Y){Y.button===2&&d.rightClickHandler(Y,T.textarea,T.screenElement,T._selectionService,T.options.rightClickSelectsWord)})):this.register(s.addDisposableDomListener(this.element,"contextmenu",function(Y){d.rightClickHandler(Y,T.textarea,T.screenElement,T._selectionService,T.options.rightClickSelectsWord)})),_.isLinux&&this.register(s.addDisposableDomListener(this.element,"auxclick",function(Y){Y.button===1&&d.moveTextAreaUnderMouseCursor(Y,T.textarea,T.screenElement)}))},G.prototype._bindKeys=function(){var T=this;this.register(s.addDisposableDomListener(this.textarea,"keyup",function(O){return T._keyUp(O)},!0)),this.register(s.addDisposableDomListener(this.textarea,"keydown",function(O){return T._keyDown(O)},!0)),this.register(s.addDisposableDomListener(this.textarea,"keypress",function(O){return T._keyPress(O)},!0)),this.register(s.addDisposableDomListener(this.textarea,"compositionstart",function(){return T._compositionHelper.compositionstart()})),this.register(s.addDisposableDomListener(this.textarea,"compositionupdate",function(O){return T._compositionHelper.compositionupdate(O)})),this.register(s.addDisposableDomListener(this.textarea,"compositionend",function(){return T._compositionHelper.compositionend()})),this.register(this.onRender(function(){return T._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(O){return T._queueLinkification(O.start,O.end)}))},G.prototype.open=function(T){var O=this;if(!T)throw new Error("Terminal requires a parent element.");te.body.contains(T)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=T.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"),T.appendChild(this.element);var Y=te.createDocumentFragment();this._viewportElement=te.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Y.appendChild(this._viewportElement),this._viewportScrollArea=te.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=te.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=te.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),Y.appendChild(this.screenElement),this.textarea=te.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(s.addDisposableDomListener(this.textarea,"focus",function(le){return O._onTextAreaFocus(le)})),this.register(s.addDisposableDomListener(this.textarea,"blur",function(){return O._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var se=this._instantiationService.createInstance(U.CoreBrowserService,this.textarea);this._instantiationService.setService(N.ICoreBrowserService,se),this._charSizeService=this._instantiationService.createInstance(z.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(N.ICharSizeService,this._charSizeService),this._compositionView=te.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(l.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(Y),this._theme=this.options.theme||this._theme,this.options.theme=void 0,this._colorManager=new P.ColorManager(te,this.options.allowTransparency),this.optionsService.onOptionChange(function(le){return O._colorManager.onOptionsChange(le)}),this._colorManager.setTheme(this._theme);var ie=this._createRenderer();this._renderService=this._instantiationService.createInstance(x.RenderService,ie,this.rows,this.screenElement),this._instantiationService.setService(N.IRenderService,this._renderService),this._renderService.onRender(function(le){return O._onRender.fire(le)}),this.onResize(function(le){return O._renderService.resize(le.cols,le.rows)}),this._soundService=this._instantiationService.createInstance(m.SoundService),this._instantiationService.setService(N.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(re.MouseService),this._instantiationService.setService(N.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(u.Viewport,function(le,Ie){return O.scrollLines(le,Ie)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this.viewport),this.register(this.onCursorMove(function(){return O._renderService.onCursorMove()})),this.register(this.onResize(function(){return O._renderService.onResize(O.cols,O.rows)})),this.register(this.onBlur(function(){return O._renderService.onBlur()})),this.register(this.onFocus(function(){return O._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return O.viewport.syncScrollArea()})),this._selectionService=this._instantiationService.createInstance(h.SelectionService,function(le,Ie){return O.scrollLines(le,Ie)},this.element,this.screenElement),this._instantiationService.setService(N.ISelectionService,this._selectionService),this.register(this._selectionService.onSelectionChange(function(){return O._onSelectionChange.fire()})),this.register(this._selectionService.onRedrawRequest(function(le){return O._renderService.onSelectionChanged(le.start,le.end,le.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(le){O.textarea.value=le,O.textarea.focus(),O.textarea.select()})),this.register(this.onScroll(function(){O.viewport.syncScrollArea(),O._selectionService.refresh()})),this.register(s.addDisposableDomListener(this._viewportElement,"scroll",function(){return O._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(S.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return O._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(s.addDisposableDomListener(this.element,"mousedown",function(le){return O._selectionService.onMouseDown(le)})),this.mouseEvents?(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()},G.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(c.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(C.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},G.prototype._setTheme=function(T){var O,Y,se;this._theme=T,(O=this._colorManager)===null||O===void 0||O.setTheme(T),(Y=this._renderService)===null||Y===void 0||Y.setColors(this._colorManager.colors),(se=this.viewport)===null||se===void 0||se.onThemeChange(this._colorManager.colors)},G.prototype.bindMouse=function(){var T=this,O=this,Y=this.element;function se(V){var Pe,Ye,rt=O._mouseService.getRawByteCoords(V,O.screenElement,O.cols,O.rows);if(!rt)return!1;switch(V.overrideType||V.type){case"mousemove":Ye=32,V.buttons===void 0?(Pe=3,V.button!==void 0&&(Pe=V.button<3?V.button:3)):Pe=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":Ye=0,Pe=V.button<3?V.button:3;break;case"mousedown":Ye=1,Pe=V.button<3?V.button:3;break;case"wheel":V.deltaY!==0&&(Ye=V.deltaY<0?0:1),Pe=4;break;default:return!1}return!(Ye===void 0||Pe===void 0||Pe>4)&&O._coreMouseService.triggerMouseEvent({col:rt.x-33,row:rt.y-33,button:Pe,action:Ye,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}var ie={mouseup:null,wheel:null,mousedrag:null,mousemove:null},le=function(V){return se(V),V.buttons||(T._document.removeEventListener("mouseup",ie.mouseup),ie.mousedrag&&T._document.removeEventListener("mousemove",ie.mousedrag)),T.cancel(V)},Ie=function(V){return se(V),V.preventDefault(),T.cancel(V)},Xs=function(V){V.buttons&&se(V)},cr=function(V){V.buttons||se(V)};this._coreMouseService.onProtocolChange(function(V){T.mouseEvents=V,V?(T.optionsService.options.logLevel==="debug"&&T._logService.debug("Binding to mouse events:",T._coreMouseService.explainEvents(V)),T.element.classList.add("enable-mouse-events"),T._selectionService.disable()):(T._logService.debug("Unbinding from mouse events."),T.element.classList.remove("enable-mouse-events"),T._selectionService.enable()),8&V?ie.mousemove||(Y.addEventListener("mousemove",cr),ie.mousemove=cr):(Y.removeEventListener("mousemove",ie.mousemove),ie.mousemove=null),16&V?ie.wheel||(Y.addEventListener("wheel",Ie),ie.wheel=Ie):(Y.removeEventListener("wheel",ie.wheel),ie.wheel=null),2&V?ie.mouseup||(ie.mouseup=le):(T._document.removeEventListener("mouseup",ie.mouseup),ie.mouseup=null),4&V?ie.mousedrag||(ie.mousedrag=Xs):(T._document.removeEventListener("mousemove",ie.mousedrag),ie.mousedrag=null)}),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(s.addDisposableDomListener(Y,"mousedown",function(V){if(V.preventDefault(),T.focus(),T.mouseEvents&&!T._selectionService.shouldForceSelection(V))return se(V),ie.mouseup&&T._document.addEventListener("mouseup",ie.mouseup),ie.mousedrag&&T._document.addEventListener("mousemove",ie.mousedrag),T.cancel(V)})),this.register(s.addDisposableDomListener(Y,"wheel",function(V){if(!ie.wheel){if(!T.buffer.hasScrollback){var Pe=T.viewport.getLinesScrolled(V);if(Pe===0)return;for(var Ye=b.C0.ESC+(T._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B"),rt="",lr=0;lr<Math.abs(Pe);lr++)rt+=Ye;T._coreService.triggerDataEvent(rt,!0)}}})),this.register(s.addDisposableDomListener(Y,"wheel",function(V){if(!ie.wheel)return T.viewport.onWheel(V)?void 0:T.cancel(V)})),this.register(s.addDisposableDomListener(Y,"touchstart",function(V){if(!T.mouseEvents)return T.viewport.onTouchStart(V),T.cancel(V)})),this.register(s.addDisposableDomListener(Y,"touchmove",function(V){if(!T.mouseEvents)return T.viewport.onTouchMove(V)?void 0:T.cancel(V)}))},G.prototype.refresh=function(T,O){var Y;(Y=this._renderService)===null||Y===void 0||Y.refreshRows(T,O)},G.prototype._queueLinkification=function(T,O){var Y;(Y=this.linkifier)===null||Y===void 0||Y.linkifyRows(T,O)},G.prototype.updateCursorStyle=function(T){this._selectionService&&this._selectionService.shouldColumnSelect(T)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")},G.prototype.showCursor=function(){this._coreService.isCursorInitialized||(this._coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))},G.prototype.scroll=function(T,O){var Y;O===void 0&&(O=!1),(Y=this._blankLine)&&Y.length===this.cols&&Y.getFg(0)===T.fg&&Y.getBg(0)===T.bg||(Y=this.buffer.getBlankLine(T,O),this._blankLine=Y),Y.isWrapped=O;var se=this.buffer.ybase+this.buffer.scrollTop,ie=this.buffer.ybase+this.buffer.scrollBottom;if(this.buffer.scrollTop===0){var le=this.buffer.lines.isFull;ie===this.buffer.lines.length-1?le?this.buffer.lines.recycle().copyFrom(Y):this.buffer.lines.push(Y.clone()):this.buffer.lines.splice(ie+1,0,Y.clone()),le?this._userScrolling&&(this.buffer.ydisp=Math.max(this.buffer.ydisp-1,0)):(this.buffer.ybase++,this._userScrolling||this.buffer.ydisp++)}else{var Ie=ie-se+1;this.buffer.lines.shiftElements(se+1,Ie-1,-1),this.buffer.lines.set(ie,Y.clone())}this._userScrolling||(this.buffer.ydisp=this.buffer.ybase),this._dirtyRowService.markRangeDirty(this.buffer.scrollTop,this.buffer.scrollBottom),this._onScroll.fire(this.buffer.ydisp)},G.prototype.scrollLines=function(T,O){if(T<0){if(this.buffer.ydisp===0)return;this._userScrolling=!0}else T+this.buffer.ydisp>=this.buffer.ybase&&(this._userScrolling=!1);var Y=this.buffer.ydisp;this.buffer.ydisp=Math.max(Math.min(this.buffer.ydisp+T,this.buffer.ybase),0),Y!==this.buffer.ydisp&&(O||this._onScroll.fire(this.buffer.ydisp),this.refresh(0,this.rows-1))},G.prototype.scrollPages=function(T){this.scrollLines(T*(this.rows-1))},G.prototype.scrollToTop=function(){this.scrollLines(-this.buffer.ydisp)},G.prototype.scrollToBottom=function(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)},G.prototype.scrollToLine=function(T){var O=T-this.buffer.ydisp;O!==0&&this.scrollLines(O)},G.prototype.paste=function(T){d.paste(T,this.textarea,this.bracketedPasteMode,this._coreService)},G.prototype.attachCustomKeyEventHandler=function(T){this._customKeyEventHandler=T},G.prototype.addEscHandler=function(T,O){return this._inputHandler.addEscHandler(T,O)},G.prototype.addDcsHandler=function(T,O){return this._inputHandler.addDcsHandler(T,O)},G.prototype.addCsiHandler=function(T,O){return this._inputHandler.addCsiHandler(T,O)},G.prototype.addOscHandler=function(T,O){return this._inputHandler.addOscHandler(T,O)},G.prototype.registerLinkMatcher=function(T,O,Y){var se=this.linkifier.registerLinkMatcher(T,O,Y);return this.refresh(0,this.rows-1),se},G.prototype.deregisterLinkMatcher=function(T){this.linkifier.deregisterLinkMatcher(T)&&this.refresh(0,this.rows-1)},G.prototype.registerLinkProvider=function(T){return this.linkifier2.registerLinkProvider(T)},G.prototype.registerCharacterJoiner=function(T){var O=this._renderService.registerCharacterJoiner(T);return this.refresh(0,this.rows-1),O},G.prototype.deregisterCharacterJoiner=function(T){this._renderService.deregisterCharacterJoiner(T)&&this.refresh(0,this.rows-1)},Object.defineProperty(G.prototype,"markers",{get:function(){return this.buffer.markers},enumerable:!0,configurable:!0}),G.prototype.addMarker=function(T){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+T)},G.prototype.hasSelection=function(){return!!this._selectionService&&this._selectionService.hasSelection},G.prototype.select=function(T,O,Y){this._selectionService.setSelection(T,O,Y)},G.prototype.getSelection=function(){return this._selectionService?this._selectionService.selectionText:""},G.prototype.getSelectionPosition=function(){if(this._selectionService.hasSelection)return{startColumn:this._selectionService.selectionStart[0],startRow:this._selectionService.selectionStart[1],endColumn:this._selectionService.selectionEnd[0],endRow:this._selectionService.selectionEnd[1]}},G.prototype.clearSelection=function(){var T;(T=this._selectionService)===null||T===void 0||T.clearSelection()},G.prototype.selectAll=function(){var T;(T=this._selectionService)===null||T===void 0||T.selectAll()},G.prototype.selectLines=function(T,O){var Y;(Y=this._selectionService)===null||Y===void 0||Y.selectLines(T,O)},G.prototype._keyDown=function(T){if(this._keyDownHandled=!1,this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(!this._compositionHelper.keydown(T))return this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;var O=w.evaluateKeyboardEvent(T,this._coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(T),O.type===3||O.type===2){var Y=this.rows-1;return this.scrollLines(O.type===2?-Y:Y),this.cancel(T,!0)}return O.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,T)||(O.cancel&&this.cancel(T,!0),!O.key||(O.key!==b.C0.ETX&&O.key!==b.C0.CR||(this.textarea.value=""),this._onKey.fire({key:O.key,domEvent:T}),this.showCursor(),this._coreService.triggerDataEvent(O.key,!0),this.optionsService.options.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(T,!0)))},G.prototype._isThirdLevelShift=function(T,O){var Y=T.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||T.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey;return O.type==="keypress"?Y:Y&&(!O.keyCode||O.keyCode>47)},G.prototype._keyUp=function(T){this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1||(function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18}(T)||this.focus(),this.updateCursorStyle(T))},G.prototype._keyPress=function(T){var O;if(this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(T)===!1)return!1;if(this.cancel(T),T.charCode)O=T.charCode;else if(T.which===null||T.which===void 0)O=T.keyCode;else{if(T.which===0||T.charCode===0)return!1;O=T.which}return!(!O||(T.altKey||T.ctrlKey||T.metaKey)&&!this._isThirdLevelShift(this.browser,T)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:T}),this.showCursor(),this._coreService.triggerDataEvent(O,!0),0))},G.prototype.bell=function(){var T=this;this._soundBell()&&this._soundService.playBellSound(),this._visualBell()&&(this.element.classList.add("visual-bell-active"),clearTimeout(this._visualBellTimer),this._visualBellTimer=window.setTimeout(function(){T.element.classList.remove("visual-bell-active")},200))},G.prototype.resize=function(T,O){var Y,se;isNaN(T)||isNaN(O)||(T!==this.cols||O!==this.rows?(T<j.MINIMUM_COLS&&(T=j.MINIMUM_COLS),O<j.MINIMUM_ROWS&&(O=j.MINIMUM_ROWS),this.buffers.resize(T,O),this._bufferService.resize(T,O),this.buffers.setupTabStops(this.cols),(Y=this._charSizeService)===null||Y===void 0||Y.measure(),(se=this.viewport)===null||se===void 0||se.syncScrollArea(!0),this.refresh(0,this.rows-1),this._onResize.fire({cols:T,rows:O})):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure())},G.prototype.clear=function(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var T=1;T<this.rows;T++)this.buffer.lines.push(this.buffer.getBlankLine(R.DEFAULT_ATTR_DATA));this.refresh(0,this.rows-1),this._onScroll.fire(this.buffer.ydisp)}},G.prototype.is=function(T){return(this.options.termName+"").indexOf(T)===0},G.prototype.handleTitle=function(T){this._onTitleChange.fire(T)},G.prototype.reset=function(){var T,O;this.options.rows=this.rows,this.options.cols=this.cols;var Y=this._customKeyEventHandler,se=this._userScrolling;this._setup(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset(),(T=this._selectionService)===null||T===void 0||T.reset(),this._customKeyEventHandler=Y,this._userScrolling=se,this.refresh(0,this.rows-1),(O=this.viewport)===null||O===void 0||O.syncScrollArea()},G.prototype.cancel=function(T,O){if(this.options.cancelEvents||O)return T.preventDefault(),T.stopPropagation(),!1},G.prototype._visualBell=function(){return!1},G.prototype._soundBell=function(){return this.options.bellStyle==="sound"},G.prototype.write=function(T,O){this._writeBuffer.write(T,O)},G.prototype.writeSync=function(T){this._writeBuffer.writeSync(T)},G}(ee.Disposable);r.Terminal=de},function(n,r,p){var a=this&&this.__decorate||function(b,o,c,f){var h,_=arguments.length,s=_<3?o:f===null?f=Object.getOwnPropertyDescriptor(o,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(b,o,c,f);else for(var g=b.length-1;g>=0;g--)(h=b[g])&&(s=(_<3?h(s):_>3?h(o,c,s):h(o,c))||s);return _>3&&s&&Object.defineProperty(o,c,s),s},v=this&&this.__param||function(b,o){return function(c,f){o(c,f,b)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(4),u=p(1),d=function(){function b(o,c,f,h,_,s){this._textarea=o,this._compositionView=c,this._bufferService=f,this._optionsService=h,this._charSizeService=_,this._coreService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0}}return b.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._compositionView.classList.add("active")},b.prototype.compositionupdate=function(o){var c=this;this._compositionView.textContent=o.data,this.updateCompositionElements(),setTimeout(function(){c._compositionPosition.end=c._textarea.value.length},0)},b.prototype.compositionend=function(){this._finalizeComposition(!0)},b.prototype.keydown=function(o){if(this._isComposing||this._isSendingComposition){if(o.keyCode===229||o.keyCode===16||o.keyCode===17||o.keyCode===18)return!1;this._finalizeComposition(!1)}return o.keyCode!==229||(this._handleAnyTextareaChanges(),!1)},b.prototype._finalizeComposition=function(o){var c=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,this._clearTextareaPosition(),o){var f={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){var _;c._isSendingComposition&&(c._isSendingComposition=!1,_=c._isComposing?c._textarea.value.substring(f.start,f.end):c._textarea.value.substring(f.start),c._coreService.triggerDataEvent(_,!0))},0)}else{this._isSendingComposition=!1;var h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}},b.prototype._handleAnyTextareaChanges=function(){var o=this,c=this._textarea.value;setTimeout(function(){if(!o._isComposing){var f=o._textarea.value.replace(c,"");f.length>0&&o._coreService.triggerDataEvent(f,!0)}},0)},b.prototype.updateCompositionElements=function(o){var c=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var f=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),h=this._bufferService.buffer.y*f,_=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=_+"px",this._compositionView.style.top=h+"px",this._compositionView.style.height=f+"px",this._compositionView.style.lineHeight=f+"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=_+"px",this._textarea.style.top=h+"px",this._textarea.style.width=s.width+"px",this._textarea.style.height=s.height+"px",this._textarea.style.lineHeight=s.height+"px"}o||setTimeout(function(){return c.updateCompositionElements(!0)},0)}},b.prototype._clearTextareaPosition=function(){this._textarea.style.left="",this._textarea.style.top=""},a([v(2,u.IBufferService),v(3,u.IOptionsService),v(4,l.ICharSizeService),v(5,u.ICoreService)],b)}();r.CompositionHelper=d},function(n,r,p){var a,v=this&&this.__extends||(a=function(h,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,g){s.__proto__=g}||function(s,g){for(var m in g)g.hasOwnProperty(m)&&(s[m]=g[m])})(h,_)},function(h,_){function s(){this.constructor=h}a(h,_),h.prototype=_===null?Object.create(_):(s.prototype=_.prototype,new s)}),l=this&&this.__decorate||function(h,_,s,g){var m,S=arguments.length,y=S<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,s):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(h,_,s,g);else for(var C=h.length-1;C>=0;C--)(m=h[C])&&(y=(S<3?m(y):S>3?m(_,s,y):m(_,s))||y);return S>3&&y&&Object.defineProperty(_,s,y),y},u=this&&this.__param||function(h,_){return function(s,g){_(s,g,h)}};Object.defineProperty(r,"__esModule",{value:!0});var d=p(2),b=p(8),o=p(4),c=p(1),f=function(h){function _(s,g,m,S,y,C,w){var I=h.call(this)||this;return I._scrollLines=s,I._viewportElement=g,I._scrollArea=m,I._bufferService=S,I._optionsService=y,I._charSizeService=C,I._renderService=w,I.scrollBarWidth=0,I._currentRowHeight=0,I._lastRecordedBufferLength=0,I._lastRecordedViewportHeight=0,I._lastRecordedBufferHeight=0,I._lastTouchY=0,I._lastScrollTop=0,I._wheelPartialScroll=0,I._refreshAnimationFrame=null,I._ignoreNextScrollEvent=!1,I.scrollBarWidth=I._viewportElement.offsetWidth-I._scrollArea.offsetWidth||15,I.register(b.addDisposableDomListener(I._viewportElement,"scroll",I._onScroll.bind(I))),setTimeout(function(){return I.syncScrollArea()},0),I}return v(_,h),_.prototype.onThemeChange=function(s){this._viewportElement.style.backgroundColor=s.background.css},_.prototype._refresh=function(s){var g=this;if(s)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return g._innerRefresh()}))},_.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var s=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==s&&(this._lastRecordedBufferHeight=s,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var g=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==g&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=g),this._refreshAnimationFrame=null},_.prototype.syncScrollArea=function(s){if(s===void 0&&(s=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(s);if(this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight){var g=this._bufferService.buffer.ydisp*this._currentRowHeight;this._lastScrollTop===g&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(s)}else this._refresh(s)},_.prototype._onScroll=function(s){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(g,!0)}},_.prototype._bubbleScroll=function(s,g){var m=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&m<this._lastRecordedBufferHeight)||(s.cancelable&&s.preventDefault(),!1)},_.prototype.onWheel=function(s){var g=this._getPixelsScrolled(s);return g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(s,g))},_.prototype._getPixelsScrolled=function(s){if(s.deltaY===0)return 0;var g=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g},_.prototype.getLinesScrolled=function(s){if(s.deltaY===0)return 0;var g=this._applyScrollModifier(s.deltaY,s);return s.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):s.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g},_.prototype._applyScrollModifier=function(s,g){var m=this._optionsService.options.fastScrollModifier;return m==="alt"&&g.altKey||m==="ctrl"&&g.ctrlKey||m==="shift"&&g.shiftKey?s*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:s*this._optionsService.options.scrollSensitivity},_.prototype.onTouchStart=function(s){this._lastTouchY=s.touches[0].pageY},_.prototype.onTouchMove=function(s){var g=this._lastTouchY-s.touches[0].pageY;return this._lastTouchY=s.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(s,g))},l([u(3,c.IBufferService),u(4,c.IOptionsService),u(5,o.ICharSizeService),u(6,o.IRenderService)],_)}(d.Disposable);r.Viewport=f},function(n,r,p){function a(d){return d.replace(/\r?\n/g,"\r")}function v(d,b){return b?"\x1B[200~"+d+"\x1B[201~":d}function l(d,b,o,c){d=v(d=a(d),o),c.triggerDataEvent(d,!0),b.value=""}function u(d,b,o){var c=o.getBoundingClientRect(),f=d.clientX-c.left-10,h=d.clientY-c.top-10;b.style.position="absolute",b.style.width="20px",b.style.height="20px",b.style.left=f+"px",b.style.top=h+"px",b.style.zIndex="1000",b.focus(),setTimeout(function(){b.style.position="",b.style.width="",b.style.height="",b.style.left="",b.style.top="",b.style.zIndex=""},200)}Object.defineProperty(r,"__esModule",{value:!0}),r.prepareTextForTerminal=a,r.bracketTextForPaste=v,r.copyHandler=function(d,b){d.clipboardData&&d.clipboardData.setData("text/plain",b.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,b,o,c){d.stopPropagation(),d.clipboardData&&l(d.clipboardData.getData("text/plain"),b,o,c)},r.paste=l,r.moveTextAreaUnderMouseCursor=u,r.rightClickHandler=function(d,b,o,c,f){u(d,b,o),f&&!c.isClickInSelection(d)&&c.selectWordAtCursor(d),b.value=c.selectionText,b.select()}},function(n,r,p){var a,v=this&&this.__extends||(a=function(k,P){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,A){x.__proto__=A}||function(x,A){for(var M in A)A.hasOwnProperty(M)&&(x[M]=A[M])})(k,P)},function(k,P){function x(){this.constructor=k}a(k,P),k.prototype=P===null?Object.create(P):(x.prototype=P.prototype,new x)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(12),u=p(18),d=p(38),b=p(2),o=p(15),c=p(7),f=p(16),h=p(0),_=p(3),s=p(5),g=p(6),m=p(20),S=p(22),y=p(4),C={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function w(k,P){if(k>24)return P.setWinLines||!1;switch(k){case 1:return!!P.restoreWin;case 2:return!!P.minimizeWin;case 3:return!!P.setWinPosition;case 4:return!!P.setWinSizePixels;case 5:return!!P.raiseWin;case 6:return!!P.lowerWin;case 7:return!!P.refreshWin;case 8:return!!P.setWinSizeChars;case 9:return!!P.maximizeWin;case 10:return!!P.fullscreenWin;case 11:return!!P.getWinState;case 13:return!!P.getWinPosition;case 14:return!!P.getWinSizePixels;case 15:return!!P.getScreenSizePixels;case 16:return!!P.getCellSizePixels;case 18:return!!P.getWinSizeChars;case 19:return!!P.getScreenSizeChars;case 20:return!!P.getIconTitle;case 21:return!!P.getWinTitle;case 22:return!!P.pushTitle;case 23:return!!P.popTitle;case 24:return!!P.setWinLines}return!1}var I=function(){function k(P,x,A,M){this._bufferService=P,this._coreService=x,this._logService=A,this._optionsService=M,this._data=new Uint32Array(0)}return k.prototype.hook=function(P){this._data=new Uint32Array(0)},k.prototype.put=function(P,x,A){this._data=o.concat(this._data,P.subarray(x,A))},k.prototype.unhook=function(P){if(P){var x=c.utf32ToString(this._data);switch(this._data=new Uint32Array(0),x){case'"q':return this._coreService.triggerDataEvent(l.C0.ESC+'P1$r0"q'+l.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(l.C0.ESC+'P1$r61;1"p'+l.C0.ESC+"\\");case"r":var A=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(l.C0.ESC+"P1$r"+A+l.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(l.C0.ESC+"P1$r0m"+l.C0.ESC+"\\");case" q":var M={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return M-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(l.C0.ESC+"P1$r"+M+" q"+l.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",x),this._coreService.triggerDataEvent(l.C0.ESC+"P0$r"+l.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},k}(),R=function(k){function P(x,A,M,N,z,j,ee,re,ue,_e,Ce){Ce===void 0&&(Ce=new d.EscapeSequenceParser);var L=k.call(this)||this;L._terminal=x,L._bufferService=A,L._charsetService=M,L._coreService=N,L._dirtyRowService=z,L._logService=j,L._optionsService=ee,L._coreMouseService=re,L._unicodeService=ue,L._instantiationService=_e,L._parser=Ce,L._parseBuffer=new Uint32Array(4096),L._stringDecoder=new c.StringToUtf32,L._utf8Decoder=new c.Utf8ToUtf32,L._workCell=new s.CellData,L._windowTitle="",L._iconName="",L._windowTitleStack=[],L._iconNameStack=[],L._curAttrData=f.DEFAULT_ATTR_DATA.clone(),L._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone(),L._onRequestRefreshRows=new h.EventEmitter,L._onRequestReset=new h.EventEmitter,L._onRequestBell=new h.EventEmitter,L._onCursorMove=new h.EventEmitter,L._onLineFeed=new h.EventEmitter,L._onScroll=new h.EventEmitter,L.register(L._parser),L._parser.setCsiHandlerFallback(function(U,Q){L._logService.debug("Unknown CSI code: ",{identifier:L._parser.identToString(U),params:Q.toArray()})}),L._parser.setEscHandlerFallback(function(U){L._logService.debug("Unknown ESC code: ",{identifier:L._parser.identToString(U)})}),L._parser.setExecuteHandlerFallback(function(U){L._logService.debug("Unknown EXECUTE code: ",{code:U})}),L._parser.setOscHandlerFallback(function(U,Q,$){L._logService.debug("Unknown OSC code: ",{identifier:U,action:Q,data:$})}),L._parser.setDcsHandlerFallback(function(U,Q,$){Q==="HOOK"&&($=$.toArray()),L._logService.debug("Unknown DCS code: ",{identifier:L._parser.identToString(U),action:Q,payload:$})}),L._parser.setPrintHandler(function(U,Q,$){return L.print(U,Q,$)}),L._parser.setCsiHandler({final:"@"},function(U){return L.insertChars(U)}),L._parser.setCsiHandler({intermediates:" ",final:"@"},function(U){return L.scrollLeft(U)}),L._parser.setCsiHandler({final:"A"},function(U){return L.cursorUp(U)}),L._parser.setCsiHandler({intermediates:" ",final:"A"},function(U){return L.scrollRight(U)}),L._parser.setCsiHandler({final:"B"},function(U){return L.cursorDown(U)}),L._parser.setCsiHandler({final:"C"},function(U){return L.cursorForward(U)}),L._parser.setCsiHandler({final:"D"},function(U){return L.cursorBackward(U)}),L._parser.setCsiHandler({final:"E"},function(U){return L.cursorNextLine(U)}),L._parser.setCsiHandler({final:"F"},function(U){return L.cursorPrecedingLine(U)}),L._parser.setCsiHandler({final:"G"},function(U){return L.cursorCharAbsolute(U)}),L._parser.setCsiHandler({final:"H"},function(U){return L.cursorPosition(U)}),L._parser.setCsiHandler({final:"I"},function(U){return L.cursorForwardTab(U)}),L._parser.setCsiHandler({final:"J"},function(U){return L.eraseInDisplay(U)}),L._parser.setCsiHandler({prefix:"?",final:"J"},function(U){return L.eraseInDisplay(U)}),L._parser.setCsiHandler({final:"K"},function(U){return L.eraseInLine(U)}),L._parser.setCsiHandler({prefix:"?",final:"K"},function(U){return L.eraseInLine(U)}),L._parser.setCsiHandler({final:"L"},function(U){return L.insertLines(U)}),L._parser.setCsiHandler({final:"M"},function(U){return L.deleteLines(U)}),L._parser.setCsiHandler({final:"P"},function(U){return L.deleteChars(U)}),L._parser.setCsiHandler({final:"S"},function(U){return L.scrollUp(U)}),L._parser.setCsiHandler({final:"T"},function(U){return L.scrollDown(U)}),L._parser.setCsiHandler({final:"X"},function(U){return L.eraseChars(U)}),L._parser.setCsiHandler({final:"Z"},function(U){return L.cursorBackwardTab(U)}),L._parser.setCsiHandler({final:"`"},function(U){return L.charPosAbsolute(U)}),L._parser.setCsiHandler({final:"a"},function(U){return L.hPositionRelative(U)}),L._parser.setCsiHandler({final:"b"},function(U){return L.repeatPrecedingCharacter(U)}),L._parser.setCsiHandler({final:"c"},function(U){return L.sendDeviceAttributesPrimary(U)}),L._parser.setCsiHandler({prefix:">",final:"c"},function(U){return L.sendDeviceAttributesSecondary(U)}),L._parser.setCsiHandler({final:"d"},function(U){return L.linePosAbsolute(U)}),L._parser.setCsiHandler({final:"e"},function(U){return L.vPositionRelative(U)}),L._parser.setCsiHandler({final:"f"},function(U){return L.hVPosition(U)}),L._parser.setCsiHandler({final:"g"},function(U){return L.tabClear(U)}),L._parser.setCsiHandler({final:"h"},function(U){return L.setMode(U)}),L._parser.setCsiHandler({prefix:"?",final:"h"},function(U){return L.setModePrivate(U)}),L._parser.setCsiHandler({final:"l"},function(U){return L.resetMode(U)}),L._parser.setCsiHandler({prefix:"?",final:"l"},function(U){return L.resetModePrivate(U)}),L._parser.setCsiHandler({final:"m"},function(U){return L.charAttributes(U)}),L._parser.setCsiHandler({final:"n"},function(U){return L.deviceStatus(U)}),L._parser.setCsiHandler({prefix:"?",final:"n"},function(U){return L.deviceStatusPrivate(U)}),L._parser.setCsiHandler({intermediates:"!",final:"p"},function(U){return L.softReset(U)}),L._parser.setCsiHandler({intermediates:" ",final:"q"},function(U){return L.setCursorStyle(U)}),L._parser.setCsiHandler({final:"r"},function(U){return L.setScrollRegion(U)}),L._parser.setCsiHandler({final:"s"},function(U){return L.saveCursor(U)}),L._parser.setCsiHandler({final:"t"},function(U){return L.windowOptions(U)}),L._parser.setCsiHandler({final:"u"},function(U){return L.restoreCursor(U)}),L._parser.setCsiHandler({intermediates:"'",final:"}"},function(U){return L.insertColumns(U)}),L._parser.setCsiHandler({intermediates:"'",final:"~"},function(U){return L.deleteColumns(U)}),L._parser.setExecuteHandler(l.C0.BEL,function(){return L.bell()}),L._parser.setExecuteHandler(l.C0.LF,function(){return L.lineFeed()}),L._parser.setExecuteHandler(l.C0.VT,function(){return L.lineFeed()}),L._parser.setExecuteHandler(l.C0.FF,function(){return L.lineFeed()}),L._parser.setExecuteHandler(l.C0.CR,function(){return L.carriageReturn()}),L._parser.setExecuteHandler(l.C0.BS,function(){return L.backspace()}),L._parser.setExecuteHandler(l.C0.HT,function(){return L.tab()}),L._parser.setExecuteHandler(l.C0.SO,function(){return L.shiftOut()}),L._parser.setExecuteHandler(l.C0.SI,function(){return L.shiftIn()}),L._parser.setExecuteHandler(l.C1.IND,function(){return L.index()}),L._parser.setExecuteHandler(l.C1.NEL,function(){return L.nextLine()}),L._parser.setExecuteHandler(l.C1.HTS,function(){return L.tabSet()}),L._parser.setOscHandler(0,new m.OscHandler(function(U){L.setTitle(U),L.setIconName(U)})),L._parser.setOscHandler(1,new m.OscHandler(function(U){return L.setIconName(U)})),L._parser.setOscHandler(2,new m.OscHandler(function(U){return L.setTitle(U)})),L._parser.setEscHandler({final:"7"},function(){return L.saveCursor()}),L._parser.setEscHandler({final:"8"},function(){return L.restoreCursor()}),L._parser.setEscHandler({final:"D"},function(){return L.index()}),L._parser.setEscHandler({final:"E"},function(){return L.nextLine()}),L._parser.setEscHandler({final:"H"},function(){return L.tabSet()}),L._parser.setEscHandler({final:"M"},function(){return L.reverseIndex()}),L._parser.setEscHandler({final:"="},function(){return L.keypadApplicationMode()}),L._parser.setEscHandler({final:">"},function(){return L.keypadNumericMode()}),L._parser.setEscHandler({final:"c"},function(){return L.fullReset()}),L._parser.setEscHandler({final:"n"},function(){return L.setgLevel(2)}),L._parser.setEscHandler({final:"o"},function(){return L.setgLevel(3)}),L._parser.setEscHandler({final:"|"},function(){return L.setgLevel(3)}),L._parser.setEscHandler({final:"}"},function(){return L.setgLevel(2)}),L._parser.setEscHandler({final:"~"},function(){return L.setgLevel(1)}),L._parser.setEscHandler({intermediates:"%",final:"@"},function(){return L.selectDefaultCharset()}),L._parser.setEscHandler({intermediates:"%",final:"G"},function(){return L.selectDefaultCharset()});var ae=function(U){B._parser.setEscHandler({intermediates:"(",final:U},function(){return L.selectCharset("("+U)}),B._parser.setEscHandler({intermediates:")",final:U},function(){return L.selectCharset(")"+U)}),B._parser.setEscHandler({intermediates:"*",final:U},function(){return L.selectCharset("*"+U)}),B._parser.setEscHandler({intermediates:"+",final:U},function(){return L.selectCharset("+"+U)}),B._parser.setEscHandler({intermediates:"-",final:U},function(){return L.selectCharset("-"+U)}),B._parser.setEscHandler({intermediates:".",final:U},function(){return L.selectCharset("."+U)}),B._parser.setEscHandler({intermediates:"/",final:U},function(){return L.selectCharset("/"+U)})},B=this;for(var W in u.CHARSETS)ae(W);return L._parser.setEscHandler({intermediates:"#",final:"8"},function(){return L.screenAlignmentPattern()}),L._parser.setErrorHandler(function(U){return L._logService.error("Parsing error: ",U),U}),L._parser.setDcsHandler({intermediates:"$",final:"q"},new I(L._bufferService,L._coreService,L._logService,L._optionsService)),L}return v(P,k),Object.defineProperty(P.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!0,configurable:!0}),Object.defineProperty(P.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!0,configurable:!0}),P.prototype.dispose=function(){k.prototype.dispose.call(this)},P.prototype.parse=function(x){var A=this._bufferService.buffer,M=A.x,N=A.y;if(this._logService.debug("parsing data",x),this._parseBuffer.length<x.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(x.length,131072))),this._dirtyRowService.clearRange(),x.length>131072)for(var z=0;z<x.length;z+=131072){var j=z+131072<x.length?z+131072:x.length,ee=typeof x=="string"?this._stringDecoder.decode(x.substring(z,j),this._parseBuffer):this._utf8Decoder.decode(x.subarray(z,j),this._parseBuffer);this._parser.parse(this._parseBuffer,ee)}else ee=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer),this._parser.parse(this._parseBuffer,ee);(A=this._bufferService.buffer).x===M&&A.y===N||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowService.start,this._dirtyRowService.end)},P.prototype.print=function(x,A,M){var N,z,j=this._bufferService.buffer,ee=this._charsetService.charset,re=this._optionsService.options.screenReaderMode,ue=this._bufferService.cols,_e=this._coreService.decPrivateModes.wraparound,Ce=this._terminal.insertMode,L=this._curAttrData,ae=j.lines.get(j.y+j.ybase);this._dirtyRowService.markDirty(j.y),j.x&&M-A>0&&ae.getWidth(j.x-1)===2&&ae.setCellFromCodePoint(j.x-1,0,1,L.fg,L.bg);for(var B=A;B<M;++B){if(N=x[B],z=this._unicodeService.wcwidth(N),N<127&&ee){var W=ee[String.fromCharCode(N)];W&&(N=W.charCodeAt(0))}if(re&&this._terminal.onA11yCharEmitter.fire(c.stringFromCodePoint(N)),z||!j.x){if(j.x+z-1>=ue){if(_e)j.x=0,j.y++,j.y===j.scrollBottom+1?(j.y--,this._terminal.scroll(this._eraseAttrData(),!0)):(j.y>=this._bufferService.rows&&(j.y=this._bufferService.rows-1),j.lines.get(j.y).isWrapped=!0),ae=j.lines.get(j.y+j.ybase);else if(j.x=ue-1,z===2)continue}if(Ce&&(ae.insertCells(j.x,z,j.getNullCell(L),L),ae.getWidth(ue-1)===2&&ae.setCellFromCodePoint(ue-1,_.NULL_CELL_CODE,_.NULL_CELL_WIDTH,L.fg,L.bg)),ae.setCellFromCodePoint(j.x++,N,z,L.fg,L.bg),z>0)for(;--z;)ae.setCellFromCodePoint(j.x++,0,0,L.fg,L.bg)}else ae.getWidth(j.x-1)?ae.addCodepointToCell(j.x-1,N):ae.addCodepointToCell(j.x-2,N)}M-A>0&&(ae.loadCell(j.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),j.x<ue&&M-A>0&&ae.getWidth(j.x)===0&&!ae.hasContent(j.x)&&ae.setCellFromCodePoint(j.x,0,1,L.fg,L.bg),this._dirtyRowService.markDirty(j.y)},P.prototype.addCsiHandler=function(x,A){var M=this;return x.final!=="t"||x.prefix||x.intermediates?this._parser.addCsiHandler(x,A):this._parser.addCsiHandler(x,function(N){return!w(N.params[0],M._optionsService.options.windowOptions)||A(N)})},P.prototype.addDcsHandler=function(x,A){return this._parser.addDcsHandler(x,new S.DcsHandler(A))},P.prototype.addEscHandler=function(x,A){return this._parser.addEscHandler(x,A)},P.prototype.addOscHandler=function(x,A){return this._parser.addOscHandler(x,new m.OscHandler(A))},P.prototype.bell=function(){this._onRequestBell.fire()},P.prototype.lineFeed=function(){var x=this._bufferService.buffer;this._dirtyRowService.markDirty(x.y),this._optionsService.options.convertEol&&(x.x=0),x.y++,x.y===x.scrollBottom+1?(x.y--,this._terminal.scroll(this._eraseAttrData())):x.y>=this._bufferService.rows&&(x.y=this._bufferService.rows-1),x.x>=this._bufferService.cols&&x.x--,this._dirtyRowService.markDirty(x.y),this._onLineFeed.fire()},P.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},P.prototype.backspace=function(){this._restrictCursor(),this._bufferService.buffer.x>0&&this._bufferService.buffer.x--},P.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var x=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._terminal.onA11yTabEmitter.fire(this._bufferService.buffer.x-x)}},P.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},P.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},P.prototype._restrictCursor=function(){this._bufferService.buffer.x=Math.min(this._bufferService.cols-1,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)},P.prototype._setCursor=function(x,A){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=x,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+A):(this._bufferService.buffer.x=x,this._bufferService.buffer.y=A),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},P.prototype._moveCursor=function(x,A){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+x,this._bufferService.buffer.y+A)},P.prototype.cursorUp=function(x){var A=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;A>=0?this._moveCursor(0,-Math.min(A,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1))},P.prototype.cursorDown=function(x){var A=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;A>=0?this._moveCursor(0,Math.min(A,x.params[0]||1)):this._moveCursor(0,x.params[0]||1)},P.prototype.cursorForward=function(x){this._moveCursor(x.params[0]||1,0)},P.prototype.cursorBackward=function(x){this._moveCursor(-(x.params[0]||1),0)},P.prototype.cursorNextLine=function(x){this.cursorDown(x),this._bufferService.buffer.x=0},P.prototype.cursorPrecedingLine=function(x){this.cursorUp(x),this._bufferService.buffer.x=0},P.prototype.cursorCharAbsolute=function(x){this._setCursor((x.params[0]||1)-1,this._bufferService.buffer.y)},P.prototype.cursorPosition=function(x){this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1)},P.prototype.charPosAbsolute=function(x){this._setCursor((x.params[0]||1)-1,this._bufferService.buffer.y)},P.prototype.hPositionRelative=function(x){this._moveCursor(x.params[0]||1,0)},P.prototype.linePosAbsolute=function(x){this._setCursor(this._bufferService.buffer.x,(x.params[0]||1)-1)},P.prototype.vPositionRelative=function(x){this._moveCursor(0,x.params[0]||1)},P.prototype.hVPosition=function(x){this.cursorPosition(x)},P.prototype.tabClear=function(x){var A=x.params[0];A===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:A===3&&(this._bufferService.buffer.tabs={})},P.prototype.cursorForwardTab=function(x){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var A=x.params[0]||1;A--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},P.prototype.cursorBackwardTab=function(x){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var A=x.params[0]||1,M=this._bufferService.buffer;A--;)M.x=M.prevStop()},P.prototype._eraseInBufferLine=function(x,A,M,N){N===void 0&&(N=!1);var z=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+x);z.replaceCells(A,M,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),N&&(z.isWrapped=!1)},P.prototype._resetBufferLine=function(x){var A=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+x);A.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1},P.prototype.eraseInDisplay=function(x){var A;switch(this._restrictCursor(),x.params[0]){case 0:for(A=this._bufferService.buffer.y,this._dirtyRowService.markDirty(A),this._eraseInBufferLine(A++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);A<this._bufferService.rows;A++)this._resetBufferLine(A);this._dirtyRowService.markDirty(A);break;case 1:for(A=this._bufferService.buffer.y,this._dirtyRowService.markDirty(A),this._eraseInBufferLine(A,0,this._bufferService.buffer.x+1,!0),this._bufferService.buffer.x+1>=this._bufferService.cols&&(this._bufferService.buffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A);this._dirtyRowService.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowService.markDirty(A-1);A--;)this._resetBufferLine(A);this._dirtyRowService.markDirty(0);break;case 3:var M=this._bufferService.buffer.lines.length-this._bufferService.rows;M>0&&(this._bufferService.buffer.lines.trimStart(M),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-M,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-M,0),this._onScroll.fire(0))}},P.prototype.eraseInLine=function(x){switch(this._restrictCursor(),x.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)},P.prototype.insertLines=function(x){this._restrictCursor();var A=x.params[0]||1,M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){for(var N=M.y+M.ybase,z=this._bufferService.rows-1-M.scrollBottom,j=this._bufferService.rows-1+M.ybase-z+1;A--;)M.lines.splice(j-1,1),M.lines.splice(N,0,M.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(M.y,M.scrollBottom),M.x=0}},P.prototype.deleteLines=function(x){this._restrictCursor();var A=x.params[0]||1,M=this._bufferService.buffer;if(!(M.y>M.scrollBottom||M.y<M.scrollTop)){var N,z=M.y+M.ybase;for(N=this._bufferService.rows-1-M.scrollBottom,N=this._bufferService.rows-1+M.ybase-N;A--;)M.lines.splice(z,1),M.lines.splice(N,0,M.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(M.y,M.scrollBottom),M.x=0}},P.prototype.insertChars=function(x){this._restrictCursor();var A=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);A&&(A.insertCells(this._bufferService.buffer.x,x.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},P.prototype.deleteChars=function(x){this._restrictCursor();var A=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);A&&(A.deleteCells(this._bufferService.buffer.x,x.params[0]||1,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},P.prototype.scrollUp=function(x){for(var A=x.params[0]||1,M=this._bufferService.buffer;A--;)M.lines.splice(M.ybase+M.scrollTop,1),M.lines.splice(M.ybase+M.scrollBottom,0,M.getBlankLine(this._eraseAttrData()));this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)},P.prototype.scrollDown=function(x){for(var A=x.params[0]||1,M=this._bufferService.buffer;A--;)M.lines.splice(M.ybase+M.scrollBottom,1),M.lines.splice(M.ybase+M.scrollTop,0,M.getBlankLine(f.DEFAULT_ATTR_DATA));this._dirtyRowService.markRangeDirty(M.scrollTop,M.scrollBottom)},P.prototype.scrollLeft=function(x){var A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var M=x.params[0]||1,N=A.scrollTop;N<=A.scrollBottom;++N){var z=A.lines.get(A.ybase+N);z.deleteCells(0,M,A.getNullCell(this._eraseAttrData()),this._eraseAttrData()),z.isWrapped=!1}this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)}},P.prototype.scrollRight=function(x){var A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var M=x.params[0]||1,N=A.scrollTop;N<=A.scrollBottom;++N){var z=A.lines.get(A.ybase+N);z.insertCells(0,M,A.getNullCell(this._eraseAttrData()),this._eraseAttrData()),z.isWrapped=!1}this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)}},P.prototype.insertColumns=function(x){var A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var M=x.params[0]||1,N=A.scrollTop;N<=A.scrollBottom;++N){var z=this._bufferService.buffer.lines.get(A.ybase+N);z.insertCells(A.x,M,A.getNullCell(this._eraseAttrData()),this._eraseAttrData()),z.isWrapped=!1}this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)}},P.prototype.deleteColumns=function(x){var A=this._bufferService.buffer;if(!(A.y>A.scrollBottom||A.y<A.scrollTop)){for(var M=x.params[0]||1,N=A.scrollTop;N<=A.scrollBottom;++N){var z=A.lines.get(A.ybase+N);z.deleteCells(A.x,M,A.getNullCell(this._eraseAttrData()),this._eraseAttrData()),z.isWrapped=!1}this._dirtyRowService.markRangeDirty(A.scrollTop,A.scrollBottom)}},P.prototype.eraseChars=function(x){this._restrictCursor();var A=this._bufferService.buffer.lines.get(this._bufferService.buffer.y+this._bufferService.buffer.ybase);A&&(A.replaceCells(this._bufferService.buffer.x,this._bufferService.buffer.x+(x.params[0]||1),this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),this._dirtyRowService.markDirty(this._bufferService.buffer.y))},P.prototype.repeatPrecedingCharacter=function(x){if(this._parser.precedingCodepoint){for(var A=x.params[0]||1,M=new Uint32Array(A),N=0;N<A;++N)M[N]=this._parser.precedingCodepoint;this.print(M,0,M.length)}},P.prototype.sendDeviceAttributesPrimary=function(x){x.params[0]>0||(this._terminal.is("xterm")||this._terminal.is("rxvt-unicode")||this._terminal.is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._terminal.is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c"))},P.prototype.sendDeviceAttributesSecondary=function(x){x.params[0]>0||(this._terminal.is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._terminal.is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._terminal.is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._terminal.is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c"))},P.prototype.setMode=function(x){for(var A=0;A<x.length;A++)switch(x.params[A]){case 4:this._terminal.insertMode=!0}},P.prototype.setModePrivate=function(x){for(var A,M,N=0;N<x.length;N++)switch(x.params[N]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,u.DEFAULT_CHARSET),this._charsetService.setgCharset(1,u.DEFAULT_CHARSET),this._charsetService.setgCharset(2,u.DEFAULT_CHARSET),this._charsetService.setgCharset(3,u.DEFAULT_CHARSET);break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._terminal.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,(A=this._terminal.viewport)===null||A===void 0||A.syncScrollArea();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._terminal.sendFocus=!0;break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),(M=this._terminal.viewport)===null||M===void 0||M.syncScrollArea(),this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!0}},P.prototype.resetMode=function(x){for(var A=0;A<x.length;A++)switch(x.params[A]){case 4:this._terminal.insertMode=!1}},P.prototype.resetModePrivate=function(x){for(var A,M,N=0;N<x.length;N++)switch(x.params[N]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.options.windowOptions.setWinLines&&(this._terminal.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,(A=this._terminal.viewport)===null||A===void 0||A.syncScrollArea();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._terminal.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),x.params[N]===1049&&this.restoreCursor(),this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),(M=this._terminal.viewport)===null||M===void 0||M.syncScrollArea(),this._terminal.showCursor();break;case 2004:this._terminal.bracketedPasteMode=!1}},P.prototype._extractColor=function(x,A,M){var N=[0,0,-1,0,0,0],z=0,j=0;do{if(N[j+z]=x.params[A+j],x.hasSubParams(A+j)){var ee=x.getSubParams(A+j),re=0;do N[1]===5&&(z=1),N[j+re+1+z]=ee[re];while(++re<ee.length&&re+j+1+z<N.length);break}if(N[1]===5&&j+z>=2||N[1]===2&&j+z>=5)break;N[1]&&(z=1)}while(++j+A<x.length&&j+z<N.length);for(re=2;re<N.length;++re)N[re]===-1&&(N[re]=0);return N[0]===38?N[1]===2?(M.fg|=50331648,M.fg&=-16777216,M.fg|=g.AttributeData.fromColorRGB([N[3],N[4],N[5]])):N[1]===5&&(M.fg&=-50331904,M.fg|=33554432|255&N[3]):N[0]===48&&(N[1]===2?(M.bg|=50331648,M.bg&=-16777216,M.bg|=g.AttributeData.fromColorRGB([N[3],N[4],N[5]])):N[1]===5&&(M.bg&=-50331904,M.bg|=33554432|255&N[3])),j},P.prototype.charAttributes=function(x){if(x.length===1&&x.params[0]===0)return this._curAttrData.fg=f.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=f.DEFAULT_ATTR_DATA.bg);for(var A,M=x.length,N=this._curAttrData,z=0;z<M;z++)(A=x.params[z])>=30&&A<=37?(N.fg&=-50331904,N.fg|=16777216|A-30):A>=40&&A<=47?(N.bg&=-50331904,N.bg|=16777216|A-40):A>=90&&A<=97?(N.fg&=-50331904,N.fg|=16777224|A-90):A>=100&&A<=107?(N.bg&=-50331904,N.bg|=16777224|A-100):A===0?(N.fg=f.DEFAULT_ATTR_DATA.fg,N.bg=f.DEFAULT_ATTR_DATA.bg):A===1?N.fg|=134217728:A===3?N.bg|=67108864:A===4?N.fg|=268435456:A===5?N.fg|=536870912:A===7?N.fg|=67108864:A===8?N.fg|=1073741824:A===2?N.bg|=134217728:A===22?(N.fg&=-134217729,N.bg&=-134217729):A===23?N.bg&=-67108865:A===24?N.fg&=-268435457:A===25?N.fg&=-536870913:A===27?N.fg&=-67108865:A===28?N.fg&=-1073741825:A===39?(N.fg&=-67108864,N.fg|=16777215&f.DEFAULT_ATTR_DATA.fg):A===49?(N.bg&=-67108864,N.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):A===38||A===48?z+=this._extractColor(x,z,N):A===100?(N.fg&=-67108864,N.fg|=16777215&f.DEFAULT_ATTR_DATA.fg,N.bg&=-67108864,N.bg|=16777215&f.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A)},P.prototype.deviceStatus=function(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(l.C0.ESC+"[0n");break;case 6:var A=this._bufferService.buffer.y+1,M=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(l.C0.ESC+"["+A+";"+M+"R")}},P.prototype.deviceStatusPrivate=function(x){switch(x.params[0]){case 6:var A=this._bufferService.buffer.y+1,M=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(l.C0.ESC+"[?"+A+";"+M+"R")}},P.prototype.softReset=function(x){var A;this._coreService.isCursorHidden=!1,this._terminal.insertMode=!1,(A=this._terminal.viewport)===null||A===void 0||A.syncScrollArea(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=f.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},P.prototype.setCursorStyle=function(x){var A=x.params[0]||1;switch(A){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 M=A%2==1;this._optionsService.options.cursorBlink=M},P.prototype.setScrollRegion=function(x){var A,M=x.params[0]||1;(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>M&&(this._bufferService.buffer.scrollTop=M-1,this._bufferService.buffer.scrollBottom=A-1,this._setCursor(0,0))},P.prototype.windowOptions=function(x){if(w(x.params[0],this._optionsService.options.windowOptions)){var A=x.length>1?x.params[1]:0,M=this._instantiationService.getService(y.IRenderService);switch(x.params[0]){case 14:if(M&&A!==2){console.log(M.dimensions);var N=M.dimensions.scaledCanvasWidth.toFixed(0),z=M.dimensions.scaledCanvasHeight.toFixed(0);this._coreService.triggerDataEvent(l.C0.ESC+"[4;"+z+";"+N+"t")}break;case 16:M&&(N=M.dimensions.scaledCellWidth.toFixed(0),z=M.dimensions.scaledCellHeight.toFixed(0),this._coreService.triggerDataEvent(l.C0.ESC+"[6;"+z+";"+N+"t"));break;case 18:this._bufferService&&this._coreService.triggerDataEvent(l.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:A!==0&&A!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),A!==0&&A!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:A!==0&&A!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),A!==0&&A!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},P.prototype.saveCursor=function(x){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},P.prototype.restoreCursor=function(x){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()},P.prototype.setTitle=function(x){this._windowTitle=x,this._terminal.handleTitle(x)},P.prototype.setIconName=function(x){this._iconName=x},P.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},P.prototype.keypadApplicationMode=function(){var x;this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,(x=this._terminal.viewport)===null||x===void 0||x.syncScrollArea()},P.prototype.keypadNumericMode=function(){var x;this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,(x=this._terminal.viewport)===null||x===void 0||x.syncScrollArea()},P.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,u.DEFAULT_CHARSET)},P.prototype.selectCharset=function(x){x.length===2?x[0]!=="/"&&this._charsetService.setgCharset(C[x[0]],u.CHARSETS[x[1]]||u.DEFAULT_CHARSET):this.selectDefaultCharset()},P.prototype.index=function(){this._restrictCursor();var x=this._bufferService.buffer;this._bufferService.buffer.y++,x.y===x.scrollBottom+1?(x.y--,this._terminal.scroll(this._eraseAttrData())):x.y>=this._bufferService.rows&&(x.y=this._bufferService.rows-1),this._restrictCursor()},P.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},P.prototype.reverseIndex=function(){this._restrictCursor();var x=this._bufferService.buffer;if(x.y===x.scrollTop){var A=x.scrollBottom-x.scrollTop;x.lines.shiftElements(x.y+x.ybase,A,1),x.lines.set(x.y+x.ybase,x.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(x.scrollTop,x.scrollBottom)}else x.y--,this._restrictCursor()},P.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},P.prototype.reset=function(){this._curAttrData=f.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=f.DEFAULT_ATTR_DATA.clone()},P.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},P.prototype.setgLevel=function(x){this._charsetService.setgLevel(x)},P.prototype.screenAlignmentPattern=function(){var x=new s.CellData;x.content=1<<22|"E".charCodeAt(0),x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg;var A=this._bufferService.buffer;this._setCursor(0,0);for(var M=0;M<this._bufferService.rows;++M){var N=A.y+A.ybase+M;A.lines.get(N).fill(x),A.lines.get(N).isWrapped=!1}this._dirtyRowService.markAllDirty(),this._setCursor(0,0)},P}(b.Disposable);r.InputHandler=R},function(n,r,p){var a,v=this&&this.__extends||(a=function(h,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,g){s.__proto__=g}||function(s,g){for(var m in g)g.hasOwnProperty(m)&&(s[m]=g[m])})(h,_)},function(h,_){function s(){this.constructor=h}a(h,_),h.prototype=_===null?Object.create(_):(s.prototype=_.prototype,new s)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(2),u=p(15),d=p(19),b=p(20),o=p(22),c=function(){function h(_){this.table=new Uint8Array(_)}return h.prototype.setDefault=function(_,s){u.fill(this.table,_<<4|s)},h.prototype.add=function(_,s,g,m){this.table[s<<8|_]=g<<4|m},h.prototype.addMany=function(_,s,g,m){for(var S=0;S<_.length;S++)this.table[s<<8|_[S]]=g<<4|m},h}();r.TransitionTable=c,r.VT500_TRANSITION_TABLE=function(){var h=new c(4095),_=Array.apply(null,Array(256)).map(function(C,w){return w}),s=function(C,w){return _.slice(C,w)},g=s(32,127),m=s(0,24);m.push(25),m.push.apply(m,s(28,32));var S,y=s(0,14);for(S in h.setDefault(1,0),h.addMany(g,0,2,0),y)h.addMany([24,26,153,154],S,3,0),h.addMany(s(128,144),S,3,0),h.addMany(s(144,152),S,3,0),h.add(156,S,0,0),h.add(27,S,11,1),h.add(157,S,4,8),h.addMany([152,158,159],S,0,7),h.add(155,S,11,3),h.add(144,S,11,9);return h.addMany(m,0,3,0),h.addMany(m,1,3,1),h.add(127,1,0,1),h.addMany(m,8,0,8),h.addMany(m,3,3,3),h.add(127,3,0,3),h.addMany(m,4,3,4),h.add(127,4,0,4),h.addMany(m,6,3,6),h.addMany(m,5,3,5),h.add(127,5,0,5),h.addMany(m,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(g,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(s(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(g,7,0,7),h.addMany(m,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(s(64,127),3,7,0),h.addMany(s(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(s(48,60),4,8,4),h.addMany(s(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(s(32,64),6,0,6),h.add(127,6,0,6),h.addMany(s(64,127),6,0,0),h.addMany(s(32,48),3,9,5),h.addMany(s(32,48),5,9,5),h.addMany(s(48,64),5,0,6),h.addMany(s(64,127),5,7,0),h.addMany(s(32,48),4,9,5),h.addMany(s(32,48),1,9,2),h.addMany(s(32,48),2,9,2),h.addMany(s(48,127),2,10,0),h.addMany(s(48,80),1,10,0),h.addMany(s(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(s(96,127),1,10,0),h.add(80,1,11,9),h.addMany(m,9,0,9),h.add(127,9,0,9),h.addMany(s(28,32),9,0,9),h.addMany(s(32,48),9,9,12),h.addMany(s(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(m,11,0,11),h.addMany(s(32,128),11,0,11),h.addMany(s(28,32),11,0,11),h.addMany(m,10,0,10),h.add(127,10,0,10),h.addMany(s(28,32),10,0,10),h.addMany(s(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(s(32,48),10,9,12),h.addMany(m,12,0,12),h.add(127,12,0,12),h.addMany(s(28,32),12,0,12),h.addMany(s(32,48),12,9,12),h.addMany(s(48,64),12,0,11),h.addMany(s(64,127),12,12,13),h.addMany(s(64,127),10,12,13),h.addMany(s(64,127),9,12,13),h.addMany(m,13,13,13),h.addMany(g,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(160,0,2,0),h.add(160,8,5,8),h.add(160,6,0,6),h.add(160,11,0,11),h.add(160,13,13,13),h}();var f=function(h){function _(s){s===void 0&&(s=r.VT500_TRANSITION_TABLE);var g=h.call(this)||this;return g._transitions=s,g.initialState=0,g.currentState=g.initialState,g._params=new d.Params,g._params.addParam(0),g._collect=0,g.precedingCodepoint=0,g._printHandlerFb=function(m,S,y){},g._executeHandlerFb=function(m){},g._csiHandlerFb=function(m,S){},g._escHandlerFb=function(m){},g._errorHandlerFb=function(m){return m},g._printHandler=g._printHandlerFb,g._executeHandlers=Object.create(null),g._csiHandlers=Object.create(null),g._escHandlers=Object.create(null),g._oscParser=new b.OscParser,g._dcsParser=new o.DcsParser,g._errorHandler=g._errorHandlerFb,g.setEscHandler({final:"\\"},function(){}),g}return v(_,h),_.prototype._identifier=function(s,g){g===void 0&&(g=[64,126]);var m=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if((m=s.prefix.charCodeAt(0))&&60>m||m>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var S=0;S<s.intermediates.length;++S){var y=s.intermediates.charCodeAt(S);if(32>y||y>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");m<<=8,m|=y}}if(s.final.length!==1)throw new Error("final must be a single byte");var C=s.final.charCodeAt(0);if(g[0]>C||C>g[1])throw new Error("final must be in range "+g[0]+" .. "+g[1]);return(m<<=8)|C},_.prototype.identToString=function(s){for(var g=[];s;)g.push(String.fromCharCode(255&s)),s>>=8;return g.reverse().join("")},_.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},_.prototype.setPrintHandler=function(s){this._printHandler=s},_.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},_.prototype.addEscHandler=function(s,g){var m=this._identifier(s,[48,126]);this._escHandlers[m]===void 0&&(this._escHandlers[m]=[]);var S=this._escHandlers[m];return S.push(g),{dispose:function(){var y=S.indexOf(g);y!==-1&&S.splice(y,1)}}},_.prototype.setEscHandler=function(s,g){this._escHandlers[this._identifier(s,[48,126])]=[g]},_.prototype.clearEscHandler=function(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]},_.prototype.setEscHandlerFallback=function(s){this._escHandlerFb=s},_.prototype.setExecuteHandler=function(s,g){this._executeHandlers[s.charCodeAt(0)]=g},_.prototype.clearExecuteHandler=function(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]},_.prototype.setExecuteHandlerFallback=function(s){this._executeHandlerFb=s},_.prototype.addCsiHandler=function(s,g){var m=this._identifier(s);this._csiHandlers[m]===void 0&&(this._csiHandlers[m]=[]);var S=this._csiHandlers[m];return S.push(g),{dispose:function(){var y=S.indexOf(g);y!==-1&&S.splice(y,1)}}},_.prototype.setCsiHandler=function(s,g){this._csiHandlers[this._identifier(s)]=[g]},_.prototype.clearCsiHandler=function(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]},_.prototype.setCsiHandlerFallback=function(s){this._csiHandlerFb=s},_.prototype.addDcsHandler=function(s,g){return this._dcsParser.addHandler(this._identifier(s),g)},_.prototype.setDcsHandler=function(s,g){this._dcsParser.setHandler(this._identifier(s),g)},_.prototype.clearDcsHandler=function(s){this._dcsParser.clearHandler(this._identifier(s))},_.prototype.setDcsHandlerFallback=function(s){this._dcsParser.setHandlerFallback(s)},_.prototype.addOscHandler=function(s,g){return this._oscParser.addHandler(s,g)},_.prototype.setOscHandler=function(s,g){this._oscParser.setHandler(s,g)},_.prototype.clearOscHandler=function(s){this._oscParser.clearHandler(s)},_.prototype.setOscHandlerFallback=function(s){this._oscParser.setHandlerFallback(s)},_.prototype.setErrorHandler=function(s){this._errorHandler=s},_.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},_.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},_.prototype.parse=function(s,g){for(var m=0,S=0,y=this.currentState,C=this._oscParser,w=this._dcsParser,I=this._collect,R=this._params,k=this._transitions.table,P=0;P<g;++P){switch((S=k[y<<8|((m=s[P])<160?m:160)])>>4){case 2:for(var x=P+1;;++x){if(x>=g||(m=s[x])<32||m>126&&m<160){this._printHandler(s,P,x),P=x-1;break}if(++x>=g||(m=s[x])<32||m>126&&m<160){this._printHandler(s,P,x),P=x-1;break}if(++x>=g||(m=s[x])<32||m>126&&m<160){this._printHandler(s,P,x),P=x-1;break}if(++x>=g||(m=s[x])<32||m>126&&m<160){this._printHandler(s,P,x),P=x-1;break}}break;case 3:this._executeHandlers[m]?this._executeHandlers[m]():this._executeHandlerFb(m),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:P,code:m,currentState:y,collect:I,params:R,abort:!1}).abort)return;break;case 7:for(var A=this._csiHandlers[I<<8|m],M=A?A.length-1:-1;M>=0&&A[M](R)===!1;M--);M<0&&this._csiHandlerFb(I<<8|m,R),this.precedingCodepoint=0;break;case 8:do switch(m){case 59:R.addParam(0);break;case 58:R.addSubParam(-1);break;default:R.addDigit(m-48)}while(++P<g&&(m=s[P])>47&&m<60);P--;break;case 9:I<<=8,I|=m;break;case 10:for(var N=this._escHandlers[I<<8|m],z=N?N.length-1:-1;z>=0&&N[z]()===!1;z--);z<0&&this._escHandlerFb(I<<8|m),this.precedingCodepoint=0;break;case 11:R.reset(),R.addParam(0),I=0;break;case 12:w.hook(I<<8|m,R);break;case 13:for(var j=P+1;;++j)if(j>=g||(m=s[j])===24||m===26||m===27||m>127&&m<160){w.put(s,P,j),P=j-1;break}break;case 14:w.unhook(m!==24&&m!==26),m===27&&(S|=1),R.reset(),R.addParam(0),I=0,this.precedingCodepoint=0;break;case 4:C.start();break;case 5:for(var ee=P+1;;ee++)if(ee>=g||(m=s[ee])<32||m>127&&m<=159){C.put(s,P,ee),P=ee-1;break}break;case 6:C.end(m!==24&&m!==26),m===27&&(S|=1),R.reset(),R.addParam(0),I=0,this.precedingCodepoint=0}y=15&S}this._collect=I,this.currentState=y},_}(l.Disposable);r.EscapeSequenceParser=f},function(n,r,p){var a,v=this&&this.__extends||(a=function(C,w){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(I,R){I.__proto__=R}||function(I,R){for(var k in R)R.hasOwnProperty(k)&&(I[k]=R[k])})(C,w)},function(C,w){function I(){this.constructor=C}a(C,w),C.prototype=w===null?Object.create(w):(I.prototype=w.prototype,new I)}),l=this&&this.__decorate||function(C,w,I,R){var k,P=arguments.length,x=P<3?w:R===null?R=Object.getOwnPropertyDescriptor(w,I):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(C,w,I,R);else for(var A=C.length-1;A>=0;A--)(k=C[A])&&(x=(P<3?k(x):P>3?k(w,I,x):k(w,I))||x);return P>3&&x&&Object.defineProperty(w,I,x),x},u=this&&this.__param||function(C,w){return function(I,R){w(I,R,C)}};Object.defineProperty(r,"__esModule",{value:!0});var d=p(40),b=p(46),o=p(47),c=p(48),f=p(27),h=p(2),_=p(4),s=p(1),g=p(23),m=p(0),S=1,y=function(C){function w(I,R,k,P,x,A,M,N,z){var j=C.call(this)||this;j._colors=I,j._screenElement=R,j.linkifier=k,j.linkifier2=P,j._bufferService=x,j._charSizeService=A,j._optionsService=M,j.coreService=N,j.coreBrowserService=z,j._id=S++,j._onRequestRefreshRows=new m.EventEmitter;var ee=j._optionsService.options.allowTransparency;return j._characterJoinerRegistry=new f.CharacterJoinerRegistry(j._bufferService),j._renderLayers=[new d.TextRenderLayer(j._screenElement,0,j._colors,j._characterJoinerRegistry,ee,j._id,j._bufferService,M),new b.SelectionRenderLayer(j._screenElement,1,j._colors,j._id,j._bufferService,M),new c.LinkRenderLayer(j._screenElement,2,j._colors,j._id,k,P,j._bufferService,M),new o.CursorRenderLayer(j._screenElement,3,j._colors,j._id,j._onRequestRefreshRows,j._bufferService,M,N,z)],j.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},j._devicePixelRatio=window.devicePixelRatio,j._updateDimensions(),j.onOptionsChanged(),j}return v(w,C),Object.defineProperty(w.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!0,configurable:!0}),w.prototype.dispose=function(){C.prototype.dispose.call(this),this._renderLayers.forEach(function(I){return I.dispose()}),g.removeTerminalFromCache(this._id)},w.prototype.onDevicePixelRatioChange=function(){this._devicePixelRatio!==window.devicePixelRatio&&(this._devicePixelRatio=window.devicePixelRatio,this.onResize(this._bufferService.cols,this._bufferService.rows))},w.prototype.setColors=function(I){var R=this;this._colors=I,this._renderLayers.forEach(function(k){k.setColors(R._colors),k.reset()})},w.prototype.onResize=function(I,R){var k=this;this._updateDimensions(),this._renderLayers.forEach(function(P){return P.resize(k.dimensions)}),this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},w.prototype.onCharSizeChanged=function(){this.onResize(this._bufferService.cols,this._bufferService.rows)},w.prototype.onBlur=function(){this._runOperation(function(I){return I.onBlur()})},w.prototype.onFocus=function(){this._runOperation(function(I){return I.onFocus()})},w.prototype.onSelectionChanged=function(I,R,k){k===void 0&&(k=!1),this._runOperation(function(P){return P.onSelectionChanged(I,R,k)})},w.prototype.onCursorMove=function(){this._runOperation(function(I){return I.onCursorMove()})},w.prototype.onOptionsChanged=function(){this._runOperation(function(I){return I.onOptionsChanged()})},w.prototype.clear=function(){this._runOperation(function(I){return I.reset()})},w.prototype._runOperation=function(I){this._renderLayers.forEach(function(R){return I(R)})},w.prototype.renderRows=function(I,R){this._renderLayers.forEach(function(k){return k.onGridChanged(I,R)})},w.prototype._updateDimensions=function(){this._charSizeService.hasValidSize&&(this.dimensions.scaledCharWidth=Math.floor(this._charSizeService.width*window.devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharTop=this._optionsService.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._optionsService.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._bufferService.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._bufferService.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows,this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols)},w.prototype.registerCharacterJoiner=function(I){return this._characterJoinerRegistry.registerCharacterJoiner(I)},w.prototype.deregisterCharacterJoiner=function(I){return this._characterJoinerRegistry.deregisterCharacterJoiner(I)},l([u(4,s.IBufferService),u(5,_.ICharSizeService),u(6,s.IOptionsService),u(7,s.ICoreService),u(8,_.ICoreBrowserService)],w)}(h.Disposable);r.Renderer=y},function(n,r,p){var a,v=this&&this.__extends||(a=function(h,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,g){s.__proto__=g}||function(s,g){for(var m in g)g.hasOwnProperty(m)&&(s[m]=g[m])})(h,_)},function(h,_){function s(){this.constructor=h}a(h,_),h.prototype=_===null?Object.create(_):(s.prototype=_.prototype,new s)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(41),u=p(13),d=p(6),b=p(3),o=p(27),c=p(5),f=function(h){function _(s,g,m,S,y,C,w,I){var R=h.call(this,s,"text",g,y,m,C,w,I)||this;return R.bufferService=w,R.optionsService=I,R._characterWidth=0,R._characterFont="",R._characterOverlapCache={},R._workCell=new c.CellData,R._state=new l.GridCache,R._characterJoinerRegistry=S,R}return v(_,h),_.prototype.resize=function(s){h.prototype.resize.call(this,s);var g=this._getFont(!1,!1);this._characterWidth===s.scaledCharWidth&&this._characterFont===g||(this._characterWidth=s.scaledCharWidth,this._characterFont=g,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},_.prototype.reset=function(){this._state.clear(),this._clearAll()},_.prototype._forEachCell=function(s,g,m,S){for(var y=s;y<=g;y++)for(var C=y+this._bufferService.buffer.ydisp,w=this._bufferService.buffer.lines.get(C),I=m?m.getJoinedCharacters(C):[],R=0;R<this._bufferService.cols;R++){w.loadCell(R,this._workCell);var k=this._workCell,P=!1,x=R;if(k.getWidth()!==0){if(I.length>0&&R===I[0][0]){P=!0;var A=I.shift();k=new o.JoinedCellData(this._workCell,w.translateToString(!0,A[0],A[1]),A[1]-A[0]),x=A[1]-1}!P&&this._isOverlapping(k)&&x<w.length-1&&w.getCodePoint(x+1)===b.NULL_CELL_CODE&&(k.content&=-12582913,k.content|=2<<22),S(k,R,y),R=x}}},_.prototype._drawBackground=function(s,g){var m=this,S=this._ctx,y=this._bufferService.cols,C=0,w=0,I=null;S.save(),this._forEachCell(s,g,null,function(R,k,P){var x=null;R.isInverse()?x=R.isFgDefault()?m._colors.foreground.css:R.isFgRGB()?"rgb("+d.AttributeData.toColorRGB(R.getFgColor()).join(",")+")":m._colors.ansi[R.getFgColor()].css:R.isBgRGB()?x="rgb("+d.AttributeData.toColorRGB(R.getBgColor()).join(",")+")":R.isBgPalette()&&(x=m._colors.ansi[R.getBgColor()].css),I===null&&(C=k,w=P),P!==w?(S.fillStyle=I||"",m._fillCells(C,w,y-C,1),C=k,w=P):I!==x&&(S.fillStyle=I||"",m._fillCells(C,w,k-C,1),C=k,w=P),I=x}),I!==null&&(S.fillStyle=I,this._fillCells(C,w,y-C,1)),S.restore()},_.prototype._drawForeground=function(s,g){var m=this;this._forEachCell(s,g,this._characterJoinerRegistry,function(S,y,C){if(!S.isInvisible()&&(m._drawChars(S,y,C),S.isUnderline())){if(m._ctx.save(),S.isInverse())if(S.isBgDefault())m._ctx.fillStyle=m._colors.background.css;else if(S.isBgRGB())m._ctx.fillStyle="rgb("+d.AttributeData.toColorRGB(S.getBgColor()).join(",")+")";else{var w=S.getBgColor();m._optionsService.options.drawBoldTextInBrightColors&&S.isBold()&&w<8&&(w+=8),m._ctx.fillStyle=m._colors.ansi[w].css}else if(S.isFgDefault())m._ctx.fillStyle=m._colors.foreground.css;else if(S.isFgRGB())m._ctx.fillStyle="rgb("+d.AttributeData.toColorRGB(S.getFgColor()).join(",")+")";else{var I=S.getFgColor();m._optionsService.options.drawBoldTextInBrightColors&&S.isBold()&&I<8&&(I+=8),m._ctx.fillStyle=m._colors.ansi[I].css}m._fillBottomLineAtCells(y,C,S.getWidth()),m._ctx.restore()}})},_.prototype.onGridChanged=function(s,g){this._state.cache.length!==0&&(this._charAtlas&&this._charAtlas.beginFrame(),this._clearCells(0,s,this._bufferService.cols,g-s+1),this._drawBackground(s,g),this._drawForeground(s,g))},_.prototype.onOptionsChanged=function(){this._setTransparency(this._optionsService.options.allowTransparency)},_.prototype._isOverlapping=function(s){if(s.getWidth()!==1||s.getCode()<256)return!1;var g=s.getChars();if(this._characterOverlapCache.hasOwnProperty(g))return this._characterOverlapCache[g];this._ctx.save(),this._ctx.font=this._characterFont;var m=Math.floor(this._ctx.measureText(g).width)>this._characterWidth;return this._ctx.restore(),this._characterOverlapCache[g]=m,m},_}(u.BaseRenderLayer);r.TextRenderLayer=f},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this.cache=[]}return v.prototype.resize=function(l,u){for(var d=0;d<l;d++){this.cache.length<=d&&this.cache.push([]);for(var b=this.cache[d].length;b<u;b++)this.cache[d].push(void 0);this.cache[d].length=u}this.cache.length=l},v.prototype.clear=function(){for(var l=0;l<this.cache.length;l++)for(var u=0;u<this.cache[l].length;u++)this.cache[l][u]=void 0},v}();r.GridCache=a},function(n,r,p){var a,v=this&&this.__extends||(a=function(m,S){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,C){y.__proto__=C}||function(y,C){for(var w in C)C.hasOwnProperty(w)&&(y[w]=C[w])})(m,S)},function(m,S){function y(){this.constructor=m}a(m,S),m.prototype=S===null?Object.create(S):(y.prototype=S.prototype,new y)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(9),u=p(43),d=p(25),b=p(45),o=p(11),c=p(26),f=p(10),h={css:"rgba(0, 0, 0, 0)",rgba:0};function _(m){return m.code<<21|m.bg<<12|m.fg<<3|(m.bold?0:4)+(m.dim?0:2)+(m.italic?0:1)}r.getGlyphCacheKey=_;var s=function(m){function S(y,C){var w=m.call(this)||this;w._config=C,w._drawToCacheCount=0,w._glyphsWaitingOnBitmap=[],w._bitmapCommitTimeout=null,w._bitmap=null,w._cacheCanvas=y.createElement("canvas"),w._cacheCanvas.width=1024,w._cacheCanvas.height=1024,w._cacheCtx=c.throwIfFalsy(w._cacheCanvas.getContext("2d",{alpha:!0}));var I=y.createElement("canvas");I.width=w._config.scaledCharWidth,I.height=w._config.scaledCharHeight,w._tmpCtx=c.throwIfFalsy(I.getContext("2d",{alpha:w._config.allowTransparency})),w._width=Math.floor(1024/w._config.scaledCharWidth),w._height=Math.floor(1024/w._config.scaledCharHeight);var R=w._width*w._height;return w._cacheMap=new b.LRUMap(R),w._cacheMap.prealloc(R),w}return v(S,m),S.prototype.dispose=function(){this._bitmapCommitTimeout!==null&&(window.clearTimeout(this._bitmapCommitTimeout),this._bitmapCommitTimeout=null)},S.prototype.beginFrame=function(){this._drawToCacheCount=0},S.prototype.draw=function(y,C,w,I){if(C.code===32)return!0;if(!this._canCache(C))return!1;var R=_(C),k=this._cacheMap.get(R);if(k!=null)return this._drawFromCache(y,k,w,I),!0;if(this._drawToCacheCount<100){var P;P=this._cacheMap.size<this._cacheMap.capacity?this._cacheMap.size:this._cacheMap.peek().index;var x=this._drawToCache(C,P);return this._cacheMap.set(R,x),this._drawFromCache(y,x,w,I),!0}return!1},S.prototype._canCache=function(y){return y.code<256},S.prototype._toCoordinateX=function(y){return y%this._width*this._config.scaledCharWidth},S.prototype._toCoordinateY=function(y){return Math.floor(y/this._width)*this._config.scaledCharHeight},S.prototype._drawFromCache=function(y,C,w,I){if(!C.isEmpty){var R=this._toCoordinateX(C.index),k=this._toCoordinateY(C.index);y.drawImage(C.inBitmap?this._bitmap:this._cacheCanvas,R,k,this._config.scaledCharWidth,this._config.scaledCharHeight,w,I,this._config.scaledCharWidth,this._config.scaledCharHeight)}},S.prototype._getColorFromAnsiIndex=function(y){return y<this._config.colors.ansi.length?this._config.colors.ansi[y]:d.DEFAULT_ANSI_COLORS[y]},S.prototype._getBackgroundColor=function(y){return this._config.allowTransparency?h:y.bg===l.INVERTED_DEFAULT_COLOR?this._config.colors.foreground:y.bg<256?this._getColorFromAnsiIndex(y.bg):this._config.colors.background},S.prototype._getForegroundColor=function(y){return y.fg===l.INVERTED_DEFAULT_COLOR?f.color.opaque(this._config.colors.background):y.fg<256?this._getColorFromAnsiIndex(y.fg):this._config.colors.foreground},S.prototype._drawToCache=function(y,C){this._drawToCacheCount++,this._tmpCtx.save();var w=this._getBackgroundColor(y);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=w.css,this._tmpCtx.fillRect(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),this._tmpCtx.globalCompositeOperation="source-over";var I=y.bold?this._config.fontWeightBold:this._config.fontWeight,R=y.italic?"italic":"";this._tmpCtx.font=R+" "+I+" "+this._config.fontSize*this._config.devicePixelRatio+"px "+this._config.fontFamily,this._tmpCtx.textBaseline="middle",this._tmpCtx.fillStyle=this._getForegroundColor(y).css,y.dim&&(this._tmpCtx.globalAlpha=l.DIM_OPACITY),this._tmpCtx.fillText(y.chars,0,this._config.scaledCharHeight/2),this._tmpCtx.restore();var k=this._tmpCtx.getImageData(0,0,this._config.scaledCharWidth,this._config.scaledCharHeight),P=!1;this._config.allowTransparency||(P=function(N,z){for(var j=!0,ee=z.rgba>>>24,re=z.rgba>>>16&255,ue=z.rgba>>>8&255,_e=0;_e<N.data.length;_e+=4)N.data[_e]===ee&&N.data[_e+1]===re&&N.data[_e+2]===ue?N.data[_e+3]=0:j=!1;return j}(k,w));var x=this._toCoordinateX(C),A=this._toCoordinateY(C);this._cacheCtx.putImageData(k,x,A);var M={index:C,isEmpty:P,inBitmap:!1};return this._addGlyphToBitmap(M),M},S.prototype._addGlyphToBitmap=function(y){var C=this;!("createImageBitmap"in window)||o.isFirefox||o.isSafari||(this._glyphsWaitingOnBitmap.push(y),this._bitmapCommitTimeout===null&&(this._bitmapCommitTimeout=window.setTimeout(function(){return C._generateBitmap()},100)))},S.prototype._generateBitmap=function(){var y=this,C=this._glyphsWaitingOnBitmap;this._glyphsWaitingOnBitmap=[],window.createImageBitmap(this._cacheCanvas).then(function(w){y._bitmap=w;for(var I=0;I<C.length;I++)C[I].inBitmap=!0}),this._bitmapCommitTimeout=null},S}(u.BaseCharAtlas);r.DynamicCharAtlas=s;var g=function(m){function S(y,C){return m.call(this)||this}return v(S,m),S.prototype.draw=function(y,C,w,I){return!1},S}(u.BaseCharAtlas);r.NoneCharAtlas=g},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this._didWarmUp=!1}return v.prototype.dispose=function(){},v.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},v.prototype._doWarmUp=function(){},v.prototype.beginFrame=function(){},v}();r.BaseCharAtlas=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this._color={},this._rgba={}}return v.prototype.clear=function(){this._color={},this._rgba={}},v.prototype.setCss=function(l,u,d){this._rgba[l]||(this._rgba[l]={}),this._rgba[l][u]=d},v.prototype.getCss=function(l,u){return this._rgba[l]?this._rgba[l][u]:void 0},v.prototype.setColor=function(l,u,d){this._color[l]||(this._color[l]={}),this._color[l][u]=d},v.prototype.getColor=function(l,u){return this._color[l]?this._color[l][u]:void 0},v}();r.ColorContrastCache=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l){this.capacity=l,this._map={},this._head=null,this._tail=null,this._nodePool=[],this.size=0}return v.prototype._unlinkNode=function(l){var u=l.prev,d=l.next;l===this._head&&(this._head=d),l===this._tail&&(this._tail=u),u!==null&&(u.next=d),d!==null&&(d.prev=u)},v.prototype._appendNode=function(l){var u=this._tail;u!==null&&(u.next=l),l.prev=u,l.next=null,this._tail=l,this._head===null&&(this._head=l)},v.prototype.prealloc=function(l){for(var u=this._nodePool,d=0;d<l;d++)u.push({prev:null,next:null,key:null,value:null})},v.prototype.get=function(l){var u=this._map[l];return u!==void 0?(this._unlinkNode(u),this._appendNode(u),u.value):null},v.prototype.peekValue=function(l){var u=this._map[l];return u!==void 0?u.value:null},v.prototype.peek=function(){var l=this._head;return l===null?null:l.value},v.prototype.set=function(l,u){var d=this._map[l];if(d!==void 0)d=this._map[l],this._unlinkNode(d),d.value=u;else if(this.size>=this.capacity)d=this._head,this._unlinkNode(d),delete this._map[d.key],d.key=l,d.value=u,this._map[l]=d;else{var b=this._nodePool;b.length>0?((d=b.pop()).key=l,d.value=u):d={prev:null,next:null,key:l,value:u},this._map[l]=d,this.size++}this._appendNode(d)},v}();r.LRUMap=a},function(n,r,p){var a,v=this&&this.__extends||(a=function(u,d){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,o){b.__proto__=o}||function(b,o){for(var c in o)o.hasOwnProperty(c)&&(b[c]=o[c])})(u,d)},function(u,d){function b(){this.constructor=u}a(u,d),u.prototype=d===null?Object.create(d):(b.prototype=d.prototype,new b)});Object.defineProperty(r,"__esModule",{value:!0});var l=function(u){function d(b,o,c,f,h,_){var s=u.call(this,b,"selection",o,!0,c,f,h,_)||this;return s.bufferService=h,s.optionsService=_,s._clearState(),s}return v(d,u),d.prototype._clearState=function(){this._state={start:void 0,end:void 0,columnSelectMode:void 0,ydisp:void 0}},d.prototype.resize=function(b){u.prototype.resize.call(this,b),this._clearState()},d.prototype.reset=function(){this._state.start&&this._state.end&&(this._clearState(),this._clearAll())},d.prototype.onSelectionChanged=function(b,o,c){if(this._didStateChange(b,o,c,this._bufferService.buffer.ydisp))if(this._clearAll(),b&&o){var f=b[1]-this._bufferService.buffer.ydisp,h=o[1]-this._bufferService.buffer.ydisp,_=Math.max(f,0),s=Math.min(h,this._bufferService.rows-1);if(!(_>=this._bufferService.rows||s<0)){if(this._ctx.fillStyle=this._colors.selection.css,c){var g=b[0],m=o[0]-g,S=s-_+1;this._fillCells(g,_,m,S)}else{g=f===_?b[0]:0;var y=_===s?o[0]:this._bufferService.cols;this._fillCells(g,_,y-g,1);var C=Math.max(s-_-1,0);if(this._fillCells(0,_+1,this._bufferService.cols,C),_!==s){var w=h===s?o[0]:this._bufferService.cols;this._fillCells(0,s,w,1)}}this._state.start=[b[0],b[1]],this._state.end=[o[0],o[1]],this._state.columnSelectMode=c,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},d.prototype._didStateChange=function(b,o,c,f){return!this._areCoordinatesEqual(b,this._state.start)||!this._areCoordinatesEqual(o,this._state.end)||c!==this._state.columnSelectMode||f!==this._state.ydisp},d.prototype._areCoordinatesEqual=function(b,o){return!(!b||!o)&&b[0]===o[0]&&b[1]===o[1]},d}(p(13).BaseRenderLayer);r.SelectionRenderLayer=l},function(n,r,p){var a,v=this&&this.__extends||(a=function(o,c){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var _ in h)h.hasOwnProperty(_)&&(f[_]=h[_])})(o,c)},function(o,c){function f(){this.constructor=o}a(o,c),o.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(13),u=p(5),d=function(o){function c(f,h,_,s,g,m,S,y,C){var w=o.call(this,f,"cursor",h,!0,_,s,m,S)||this;return w._onRequestRefreshRowsEvent=g,w.bufferService=m,w.optionsService=S,w._coreService=y,w._coreBrowserService=C,w._cell=new u.CellData,w._state={x:0,y:0,isFocused:!1,style:"",width:0},w._cursorRenderers={bar:w._renderBarCursor.bind(w),block:w._renderBlockCursor.bind(w),underline:w._renderUnderlineCursor.bind(w)},w}return v(c,o),c.prototype.resize=function(f){o.prototype.resize.call(this,f),this._state={x:0,y:0,isFocused:!1,style:"",width:0}},c.prototype.reset=function(){this._clearCursor(),this._cursorBlinkStateManager&&(this._cursorBlinkStateManager.dispose(),this._cursorBlinkStateManager=void 0,this.onOptionsChanged())},c.prototype.onBlur=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.pause(),this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},c.prototype.onFocus=function(){this._cursorBlinkStateManager?this._cursorBlinkStateManager.resume():this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},c.prototype.onOptionsChanged=function(){var f,h=this;this._optionsService.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new b(this._coreBrowserService.isFocused,function(){h._render(!0)})):((f=this._cursorBlinkStateManager)===null||f===void 0||f.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRefreshRowsEvent.fire({start:this._bufferService.buffer.y,end:this._bufferService.buffer.y})},c.prototype.onCursorMove=function(){this._cursorBlinkStateManager&&this._cursorBlinkStateManager.restartBlinkAnimation()},c.prototype.onGridChanged=function(f,h){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(!1):this._cursorBlinkStateManager.restartBlinkAnimation()},c.prototype._render=function(f){if(this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden){var h=this._bufferService.buffer.ybase+this._bufferService.buffer.y,_=h-this._bufferService.buffer.ydisp;if(_<0||_>=this._bufferService.rows)this._clearCursor();else{var s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(h).loadCell(s,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var g=this._optionsService.options.cursorStyle;return g&&g!=="block"?this._cursorRenderers[g](s,_,this._cell):this._renderBlurCursor(s,_,this._cell),this._ctx.restore(),this._state.x=s,this._state.y=_,this._state.isFocused=!1,this._state.style=g,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===s&&this._state.y===_&&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"](s,_,this._cell),this._ctx.restore(),this._state.x=s,this._state.y=_,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},c.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})},c.prototype._renderBarCursor=function(f,h,_){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(f,h,this._optionsService.options.cursorWidth),this._ctx.restore()},c.prototype._renderBlockCursor=function(f,h,_){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(f,h,_.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(_,f,h),this._ctx.restore()},c.prototype._renderUnderlineCursor=function(f,h,_){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(f,h),this._ctx.restore()},c.prototype._renderBlurCursor=function(f,h,_){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(f,h,_.getWidth(),1),this._ctx.restore()},c}(l.BaseRenderLayer);r.CursorRenderLayer=d;var b=function(){function o(c,f){this._renderCallback=f,this.isCursorVisible=!0,c&&this._restartInterval()}return Object.defineProperty(o.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!0,configurable:!0}),o.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)},o.prototype.restartBlinkAnimation=function(){var c=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){c._renderCallback(),c._animationFrame=void 0})))},o.prototype._restartInterval=function(c){var f=this;c===void 0&&(c=600),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(f._animationTimeRestarted){var h=600-(Date.now()-f._animationTimeRestarted);if(f._animationTimeRestarted=void 0,h>0)return void f._restartInterval(h)}f.isCursorVisible=!1,f._animationFrame=window.requestAnimationFrame(function(){f._renderCallback(),f._animationFrame=void 0}),f._blinkInterval=window.setInterval(function(){if(f._animationTimeRestarted){var _=600-(Date.now()-f._animationTimeRestarted);return f._animationTimeRestarted=void 0,void f._restartInterval(_)}f.isCursorVisible=!f.isCursorVisible,f._animationFrame=window.requestAnimationFrame(function(){f._renderCallback(),f._animationFrame=void 0})},600)},c)},o.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)},o.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},o}()},function(n,r,p){var a,v=this&&this.__extends||(a=function(o,c){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,h){f.__proto__=h}||function(f,h){for(var _ in h)h.hasOwnProperty(_)&&(f[_]=h[_])})(o,c)},function(o,c){function f(){this.constructor=o}a(o,c),o.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(13),u=p(9),d=p(24),b=function(o){function c(f,h,_,s,g,m,S,y){var C=o.call(this,f,"link",h,!0,_,s,S,y)||this;return C.bufferService=S,C.optionsService=y,g.onLinkHover(function(w){return C._onLinkHover(w)}),g.onLinkLeave(function(w){return C._onLinkLeave(w)}),m.onLinkHover(function(w){return C._onLinkHover(w)}),m.onLinkLeave(function(w){return C._onLinkLeave(w)}),C}return v(c,o),c.prototype.resize=function(f){o.prototype.resize.call(this,f),this._state=void 0},c.prototype.reset=function(){this._clearCurrentLink()},c.prototype._clearCurrentLink=function(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);var f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},c.prototype._onLinkHover=function(f){if(f.fg===u.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:f.fg&&d.is256Color(f.fg)?this._ctx.fillStyle=this._colors.ansi[f.fg].css:this._ctx.fillStyle=this._colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(var h=f.y1+1;h<f.y2;h++)this._fillBottomLineAtCells(0,h,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f},c.prototype._onLinkLeave=function(f){this._clearCurrentLink()},c}(l.BaseRenderLayer);r.LinkRenderLayer=b},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(0),v=function(){function u(d,b,o,c){this._bufferService=d,this._logService=b,this._optionsService=o,this._unicodeService=c,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onLinkHover=new a.EventEmitter,this._onLinkLeave=new a.EventEmitter,this._onLinkTooltip=new a.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(u.prototype,"onLinkHover",{get:function(){return this._onLinkHover.event},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onLinkLeave",{get:function(){return this._onLinkLeave.event},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!0,configurable:!0}),u.prototype.attachToDom=function(d,b){this._element=d,this._mouseZoneManager=b},u.prototype.linkifyRows=function(d,b){var o=this;this._mouseZoneManager&&(this._rowsToLinkify.start===void 0||this._rowsToLinkify.end===void 0?(this._rowsToLinkify.start=d,this._rowsToLinkify.end=b):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,d),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,b)),this._mouseZoneManager.clearAll(d,b),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return o._linkifyRows()},u._timeBeforeLatency))},u.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var d=this._bufferService.buffer;if(this._rowsToLinkify.start!==void 0&&this._rowsToLinkify.end!==void 0){var b=d.ydisp+this._rowsToLinkify.start;if(!(b>=d.lines.length)){for(var o=d.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,c=Math.ceil(2e3/this._bufferService.cols),f=this._bufferService.buffer.iterator(!1,b,o,c,c);f.hasNext();)for(var h=f.next(),_=0;_<this._linkMatchers.length;_++)this._doLinkifyRow(h.range.first,h.content,this._linkMatchers[_]);this._rowsToLinkify.start=void 0,this._rowsToLinkify.end=void 0}}else this._logService.debug("_rowToLinkify was unset before _linkifyRows was called")},u.prototype.registerLinkMatcher=function(d,b,o){if(o===void 0&&(o={}),!b)throw new Error("handler must be defined");var c={id:this._nextLinkMatcherId++,regex:d,handler:b,matchIndex:o.matchIndex,validationCallback:o.validationCallback,hoverTooltipCallback:o.tooltipCallback,hoverLeaveCallback:o.leaveCallback,willLinkActivate:o.willLinkActivate,priority:o.priority||0};return this._addLinkMatcherToList(c),c.id},u.prototype._addLinkMatcherToList=function(d){if(this._linkMatchers.length!==0){for(var b=this._linkMatchers.length-1;b>=0;b--)if(d.priority<=this._linkMatchers[b].priority)return void this._linkMatchers.splice(b+1,0,d);this._linkMatchers.splice(0,0,d)}else this._linkMatchers.push(d)},u.prototype.deregisterLinkMatcher=function(d){for(var b=0;b<this._linkMatchers.length;b++)if(this._linkMatchers[b].id===d)return this._linkMatchers.splice(b,1),!0;return!1},u.prototype._doLinkifyRow=function(d,b,o){for(var c,f=this,h=new RegExp(o.regex.source,(o.regex.flags||"")+"g"),_=-1,s=function(){var m=c[typeof o.matchIndex!="number"?0:o.matchIndex];if(!m)return g._logService.debug("match found without corresponding matchIndex",c,o),"break";if(_=b.indexOf(m,_+1),h.lastIndex=_+m.length,_<0)return"break";var S=g._bufferService.buffer.stringIndexToBufferIndex(d,_);if(S[0]<0)return"break";var y=g._bufferService.buffer.lines.get(S[0]);if(!y)return"break";var C=y.getFg(S[1]),w=C?C>>9&511:void 0;o.validationCallback?o.validationCallback(m,function(I){f._rowsTimeoutId||I&&f._addLink(S[1],S[0]-f._bufferService.buffer.ydisp,m,o,w)}):g._addLink(S[1],S[0]-g._bufferService.buffer.ydisp,m,o,w)},g=this;(c=h.exec(b))!==null&&s()!=="break";);},u.prototype._addLink=function(d,b,o,c,f){var h=this;if(this._mouseZoneManager&&this._element){var _=this._unicodeService.getStringCellWidth(o),s=d%this._bufferService.cols,g=b+Math.floor(d/this._bufferService.cols),m=(s+_)%this._bufferService.cols,S=g+Math.floor((s+_)/this._bufferService.cols);m===0&&(m=this._bufferService.cols,S--),this._mouseZoneManager.add(new l(s+1,g+1,m+1,S+1,function(y){if(c.handler)return c.handler(y,o);var C=window.open();C?(C.opener=null,C.location.href=o):console.warn("Opening link blocked as opener could not be cleared")},function(){h._onLinkHover.fire(h._createLinkHoverEvent(s,g,m,S,f)),h._element.classList.add("xterm-cursor-pointer")},function(y){h._onLinkTooltip.fire(h._createLinkHoverEvent(s,g,m,S,f)),c.hoverTooltipCallback&&c.hoverTooltipCallback(y,o,{start:{x:s,y:g},end:{x:m,y:S}})},function(){h._onLinkLeave.fire(h._createLinkHoverEvent(s,g,m,S,f)),h._element.classList.remove("xterm-cursor-pointer"),c.hoverLeaveCallback&&c.hoverLeaveCallback()},function(y){return!c.willLinkActivate||c.willLinkActivate(y,o)}))}},u.prototype._createLinkHoverEvent=function(d,b,o,c,f){return{x1:d,y1:b,x2:o,y2:c,cols:this._bufferService.cols,fg:f}},u._timeBeforeLatency=200,u}();r.Linkifier=v;var l=function(u,d,b,o,c,f,h,_,s){this.x1=u,this.y1=d,this.x2=b,this.y2=o,this.clickCallback=c,this.hoverCallback=f,this.tooltipCallback=h,this.leaveCallback=_,this.willLinkActivate=s};r.MouseZone=l},function(n,r,p){var a=this&&this.__decorate||function(m,S,y,C){var w,I=arguments.length,R=I<3?S:C===null?C=Object.getOwnPropertyDescriptor(S,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,S,y,C);else for(var k=m.length-1;k>=0;k--)(w=m[k])&&(R=(I<3?w(R):I>3?w(S,y,R):w(S,y))||R);return I>3&&R&&Object.defineProperty(S,y,R),R},v=this&&this.__param||function(m,S){return function(y,C){S(y,C,m)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(11),u=p(51),d=p(5),b=p(0),o=p(4),c=p(1),f=p(28),h=p(52),_=String.fromCharCode(160),s=new RegExp(_,"g"),g=function(){function m(S,y,C,w,I,R,k,P){var x=this;this._scrollLines=S,this._element=y,this._screenElement=C,this._charSizeService=w,this._bufferService=I,this._coreService=R,this._mouseService=k,this._optionsService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new d.CellData,this._mouseDownTimeStamp=0,this._onLinuxMouseSelection=new b.EventEmitter,this._onRedrawRequest=new b.EventEmitter,this._onSelectionChange=new b.EventEmitter,this._mouseMoveListener=function(A){return x._onMouseMove(A)},this._mouseUpListener=function(A){return x._onMouseUp(A)},this._coreService.onUserInput(function(){x.hasSelection&&x.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(function(A){return x._onTrim(A)}),this._bufferService.buffers.onBufferActivate(function(A){return x._onBufferActivate(A)}),this.enable(),this._model=new u.SelectionModel(this._bufferService),this._activeSelectionMode=0}return Object.defineProperty(m.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"onRedrawRequest",{get:function(){return this._onRedrawRequest.event},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!0,configurable:!0}),m.prototype.dispose=function(){this._removeMouseDownListeners()},m.prototype.reset=function(){this.clearSelection()},m.prototype.disable=function(){this.clearSelection(),this._enabled=!1},m.prototype.enable=function(){this._enabled=!0},Object.defineProperty(m.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"hasSelection",{get:function(){var S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!S||!y||S[0]===y[0]&&S[1]===y[1])},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"selectionText",{get:function(){var S=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;if(!S||!y)return"";var C=this._bufferService.buffer,w=[];if(this._activeSelectionMode===3){if(S[0]===y[0])return"";for(var I=S[1];I<=y[1];I++){var R=C.translateBufferLineToString(I,!0,S[0],y[0]);w.push(R)}}else{var k=S[1]===y[1]?y[0]:void 0;for(w.push(C.translateBufferLineToString(S[1],!0,S[0],k)),I=S[1]+1;I<=y[1]-1;I++){var P=C.lines.get(I);R=C.translateBufferLineToString(I,!0),P&&P.isWrapped?w[w.length-1]+=R:w.push(R)}S[1]!==y[1]&&(P=C.lines.get(y[1]),R=C.translateBufferLineToString(y[1],!0,0,y[0]),P&&P.isWrapped?w[w.length-1]+=R:w.push(R))}return w.map(function(x){return x.replace(s," ")}).join(l.isWindows?`\r
`:`
`)},enumerable:!0,configurable:!0}),m.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},m.prototype.refresh=function(S){var y=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return y._refresh()})),l.isLinux&&S&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},m.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})},m.prototype.isClickInSelection=function(S){var y=this._getMouseBufferCoords(S),C=this._model.finalSelectionStart,w=this._model.finalSelectionEnd;return!!(C&&w&&y)&&this._areCoordsInSelection(y,C,w)},m.prototype._areCoordsInSelection=function(S,y,C){return S[1]>y[1]&&S[1]<C[1]||y[1]===C[1]&&S[1]===y[1]&&S[0]>=y[0]&&S[0]<C[0]||y[1]<C[1]&&S[1]===C[1]&&S[0]<C[0]||y[1]<C[1]&&S[1]===y[1]&&S[0]>=y[0]},m.prototype.selectWordAtCursor=function(S){var y=this._getMouseBufferCoords(S);y&&(this._selectWordAt(y,!1),this._model.selectionEnd=void 0,this.refresh(!0))},m.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},m.prototype.selectLines=function(S,y){this._model.clearSelection(),S=Math.max(S,0),y=Math.min(y,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,y],this.refresh(),this._onSelectionChange.fire()},m.prototype._onTrim=function(S){this._model.onTrim(S)&&this.refresh()},m.prototype._getMouseBufferCoords=function(S){var y=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(y)return y[0]--,y[1]--,y[1]+=this._bufferService.buffer.ydisp,y},m.prototype._getMouseEventScrollAmount=function(S){var y=f.getCoordsRelativeToElement(S,this._screenElement)[1],C=this._bufferService.rows*Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight);return y>=0&&y<=C?0:(y>C&&(y-=C),y=Math.min(Math.max(y,-50),50),(y/=50)/Math.abs(y)+Math.round(14*y))},m.prototype.shouldForceSelection=function(S){return l.isMac?S.altKey&&this._optionsService.options.macOptionClickForcesSelection:S.shiftKey},m.prototype.onMouseDown=function(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._onIncrementalClick(S):S.detail===1?this._onSingleClick(S):S.detail===2?this._onDoubleClick(S):S.detail===3&&this._onTripleClick(S),this._addMouseDownListeners(),this.refresh(!0)}},m.prototype._addMouseDownListeners=function(){var S=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return S._dragScroll()},50)},m.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},m.prototype._onIncrementalClick=function(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))},m.prototype._onSingleClick=function(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),this._model.selectionStart){this._model.selectionEnd=void 0;var y=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);y&&y.length!==this._model.selectionStart[0]&&y.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}},m.prototype._onDoubleClick=function(S){var y=this._getMouseBufferCoords(S);y&&(this._activeSelectionMode=1,this._selectWordAt(y,!0))},m.prototype._onTripleClick=function(S){var y=this._getMouseBufferCoords(S);y&&(this._activeSelectionMode=2,this._selectLineAt(y[1]))},m.prototype.shouldColumnSelect=function(S){return S.altKey&&!(l.isMac&&this._optionsService.options.macOptionClickForcesSelection)},m.prototype._onMouseMove=function(S){if(S.stopImmediatePropagation(),this._model.selectionStart){var y=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),this._model.selectionEnd){this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var C=this._bufferService.buffer;if(this._model.selectionEnd[1]<C.lines.length){var w=C.lines.get(this._model.selectionEnd[1]);w&&w.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]++}y&&y[0]===this._model.selectionEnd[0]&&y[1]===this._model.selectionEnd[1]||this.refresh(!0)}else this.refresh(!0)}},m.prototype._dragScroll=function(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._scrollLines(this._dragScrollAmount,!1);var S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}},m.prototype._onMouseUp=function(S){var y=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&y<500){if(S.altKey&&this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var C=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(C&&C[0]!==void 0&&C[1]!==void 0){var w=h.moveToCellSequence(C[0]-1,C[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(w,!0)}}}else this.hasSelection&&this._onSelectionChange.fire()},m.prototype._onBufferActivate=function(S){var y=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim(function(C){return y._onTrim(C)})},m.prototype._convertViewportColToCharacterIndex=function(S,y){for(var C=y[0],w=0;y[0]>=w;w++){var I=S.loadCell(w,this._workCell).getChars().length;this._workCell.getWidth()===0?C--:I>1&&y[0]!==w&&(C+=I-1)}return C},m.prototype.setSelection=function(S,y,C){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,y],this._model.selectionStartLength=C,this.refresh()},m.prototype._getWordAt=function(S,y,C,w){if(C===void 0&&(C=!0),w===void 0&&(w=!0),!(S[0]>=this._bufferService.cols)){var I=this._bufferService.buffer,R=I.lines.get(S[1]);if(R){var k=I.translateBufferLineToString(S[1],!1),P=this._convertViewportColToCharacterIndex(R,S),x=P,A=S[0]-P,M=0,N=0,z=0,j=0;if(k.charAt(P)===" "){for(;P>0&&k.charAt(P-1)===" ";)P--;for(;x<k.length&&k.charAt(x+1)===" ";)x++}else{var ee=S[0],re=S[0];R.getWidth(ee)===0&&(M++,ee--),R.getWidth(re)===2&&(N++,re++);var ue=R.getString(re).length;for(ue>1&&(j+=ue-1,x+=ue-1);ee>0&&P>0&&!this._isCharWordSeparator(R.loadCell(ee-1,this._workCell));){R.loadCell(ee-1,this._workCell);var _e=this._workCell.getChars().length;this._workCell.getWidth()===0?(M++,ee--):_e>1&&(z+=_e-1,P-=_e-1),P--,ee--}for(;re<R.length&&x+1<k.length&&!this._isCharWordSeparator(R.loadCell(re+1,this._workCell));){R.loadCell(re+1,this._workCell);var Ce=this._workCell.getChars().length;this._workCell.getWidth()===2?(N++,re++):Ce>1&&(j+=Ce-1,x+=Ce-1),x++,re++}}x++;var L=P+A-M+z,ae=Math.min(this._bufferService.cols,x-P+M+N-z-j);if(y||k.slice(P,x).trim()!==""){if(C&&L===0&&R.getCodePoint(0)!==32){var B=I.lines.get(S[1]-1);if(B&&R.isWrapped&&B.getCodePoint(this._bufferService.cols-1)!==32){var W=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(W){var U=this._bufferService.cols-W.start;L-=U,ae+=U}}}if(w&&L+ae===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){var Q=I.lines.get(S[1]+1);if(Q&&Q.isWrapped&&Q.getCodePoint(0)!==32){var $=this._getWordAt([0,S[1]+1],!1,!1,!0);$&&(ae+=$.length)}}return{start:L,length:ae}}}}},m.prototype._selectWordAt=function(S,y){var C=this._getWordAt(S,y);if(C){for(;C.start<0;)C.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[C.start,S[1]],this._model.selectionStartLength=C.length}},m.prototype._selectToWordAt=function(S){var y=this._getWordAt(S,!0);if(y){for(var C=S[1];y.start<0;)y.start+=this._bufferService.cols,C--;if(!this._model.areSelectionValuesReversed())for(;y.start+y.length>this._bufferService.cols;)y.length-=this._bufferService.cols,C++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?y.start:y.start+y.length,C]}},m.prototype._isCharWordSeparator=function(S){return S.getWidth()!==0&&this._optionsService.options.wordSeparator.indexOf(S.getChars())>=0},m.prototype._selectLineAt=function(S){var y=this._bufferService.buffer.getWrappedRangeForLine(S);this._model.selectionStart=[0,y.first],this._model.selectionEnd=[this._bufferService.cols,y.last],this._model.selectionStartLength=0},a([v(3,o.ICharSizeService),v(4,c.IBufferService),v(5,c.ICoreService),v(6,o.IMouseService),v(7,c.IOptionsService)],m)}();r.SelectionService=g},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l){this._bufferService=l,this.isSelectAllActive=!1,this.selectionStartLength=0}return v.prototype.clearSelection=function(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0},Object.defineProperty(v.prototype,"finalSelectionStart",{get:function(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart},enumerable:!0,configurable:!0}),Object.defineProperty(v.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 l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,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:!0,configurable:!0}),v.prototype.areSelectionValuesReversed=function(){var l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])},v.prototype.onTrim=function(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},v}();r.SelectionModel=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(12);function v(c,f,h,_){var s=c-l(h,c),g=f-l(h,f);return o(Math.abs(s-g)-function(m,S,y){for(var C=0,w=m-l(y,m),I=S-l(y,S),R=0;R<Math.abs(w-I);R++){var k=u(m,S)==="A"?-1:1,P=y.buffer.lines.get(w+k*R);P&&P.isWrapped&&C++}return C}(c,f,h),b(u(c,f),_))}function l(c,f){for(var h=0,_=c.buffer.lines.get(f),s=_&&_.isWrapped;s&&f>=0&&f<c.rows;)h++,s=(_=c.buffer.lines.get(--f))&&_.isWrapped;return h}function u(c,f){return c>f?"A":"B"}function d(c,f,h,_,s,g){for(var m=c,S=f,y="";m!==h||S!==_;)m+=s?1:-1,s&&m>g.cols-1?(y+=g.buffer.translateBufferLineToString(S,!1,c,m),m=0,c=0,S++):!s&&m<0&&(y+=g.buffer.translateBufferLineToString(S,!1,0,c+1),c=m=g.cols-1,S--);return y+g.buffer.translateBufferLineToString(S,!1,c,m)}function b(c,f){var h=f?"O":"[";return a.C0.ESC+h+c}function o(c,f){c=Math.floor(c);for(var h="",_=0;_<c;_++)h+=f;return h}r.moveToCellSequence=function(c,f,h,_){var s,g=h.buffer.x,m=h.buffer.y;if(!h.buffer.hasScrollback)return function(y,C,w,I,R,k){return v(C,I,R,k).length===0?"":o(d(y,C,y,C-l(R,C),!1,R).length,b("D",k))}(g,m,0,f,h,_)+v(m,f,h,_)+function(y,C,w,I,R,k){var P;P=v(C,I,R,k).length>0?I-l(R,I):C;var x=I,A=function(M,N,z,j,ee,re){var ue;return ue=v(z,j,ee,re).length>0?j-l(ee,j):N,M<z&&ue<=j||M>=z&&ue<j?"C":"D"}(y,C,w,I,R,k);return o(d(y,P,w,x,A==="C",R).length,b(A,k))}(g,m,c,f,h,_);if(m===f)return s=g>c?"D":"C",o(Math.abs(g-c),b(s,_));s=m>f?"D":"C";var S=Math.abs(m-f);return o(function(y,C){return C.cols-y}(m>f?c:g,h)+(S-1)*h.cols+1+((m>f?g:c)-1),b(s,_))}},function(n,r,p){var a=this&&this.__decorate||function(d,b,o,c){var f,h=arguments.length,_=h<3?b:c===null?c=Object.getOwnPropertyDescriptor(b,o):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(d,b,o,c);else for(var s=d.length-1;s>=0;s--)(f=d[s])&&(_=(h<3?f(_):h>3?f(b,o,_):f(b,o))||_);return h>3&&_&&Object.defineProperty(b,o,_),_},v=this&&this.__param||function(d,b){return function(o,c){b(o,c,d)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=function(){function d(b){this._optionsService=b}return Object.defineProperty(d,"audioContext",{get:function(){if(!d._audioContext){var b=window.AudioContext||window.webkitAudioContext;if(!b)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;d._audioContext=new b}return d._audioContext},enumerable:!0,configurable:!0}),d.prototype.playBellSound=function(){var b=d.audioContext;if(b){var o=b.createBufferSource();b.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(c){o.buffer=c,o.connect(b.destination),o.start(0)})}},d.prototype._base64ToArrayBuffer=function(b){for(var o=window.atob(b),c=o.length,f=new Uint8Array(c),h=0;h<c;h++)f[h]=o.charCodeAt(h);return f.buffer},d.prototype._removeMimeType=function(b){return b.split(",")[1]},d=a([v(0,l.IOptionsService)],d)}();r.SoundService=u},function(n,r,p){var a,v=this&&this.__extends||(a=function(h,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,g){s.__proto__=g}||function(s,g){for(var m in g)g.hasOwnProperty(m)&&(s[m]=g[m])})(h,_)},function(h,_){function s(){this.constructor=h}a(h,_),h.prototype=_===null?Object.create(_):(s.prototype=_.prototype,new s)}),l=this&&this.__decorate||function(h,_,s,g){var m,S=arguments.length,y=S<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,s):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(h,_,s,g);else for(var C=h.length-1;C>=0;C--)(m=h[C])&&(y=(S<3?m(y):S>3?m(_,s,y):m(_,s))||y);return S>3&&y&&Object.defineProperty(_,s,y),y},u=this&&this.__param||function(h,_){return function(s,g){_(s,g,h)}};Object.defineProperty(r,"__esModule",{value:!0});var d=p(2),b=p(8),o=p(4),c=p(1),f=function(h){function _(s,g,m,S,y){var C=h.call(this)||this;return C._element=s,C._screenElement=g,C._bufferService=m,C._mouseService=S,C._selectionService=y,C._zones=[],C._areZonesActive=!1,C._lastHoverCoords=[void 0,void 0],C._initialSelectionLength=0,C.register(b.addDisposableDomListener(C._element,"mousedown",function(w){return C._onMouseDown(w)})),C._mouseMoveListener=function(w){return C._onMouseMove(w)},C._mouseLeaveListener=function(w){return C._onMouseLeave(w)},C._clickListener=function(w){return C._onClick(w)},C}return v(_,h),_.prototype.dispose=function(){h.prototype.dispose.call(this),this._deactivate()},_.prototype.add=function(s){this._zones.push(s),this._zones.length===1&&this._activate()},_.prototype.clearAll=function(s,g){if(this._zones.length!==0){s&&g||(s=0,g=this._bufferService.rows-1);for(var m=0;m<this._zones.length;m++){var S=this._zones[m];(S.y1>s&&S.y1<=g+1||S.y2>s&&S.y2<=g+1||S.y1<s&&S.y2>g+1)&&(this._currentZone&&this._currentZone===S&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(m--,1))}this._zones.length===0&&this._deactivate()}},_.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))},_.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))},_.prototype._onMouseMove=function(s){this._lastHoverCoords[0]===s.pageX&&this._lastHoverCoords[1]===s.pageY||(this._onHover(s),this._lastHoverCoords=[s.pageX,s.pageY])},_.prototype._onHover=function(s){var g=this,m=this._findZoneEventAt(s);m!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),m&&(this._currentZone=m,m.hoverCallback&&m.hoverCallback(s),this._tooltipTimeout=setTimeout(function(){return g._onTooltip(s)},500)))},_.prototype._onTooltip=function(s){this._tooltipTimeout=void 0;var g=this._findZoneEventAt(s);g&&g.tooltipCallback&&g.tooltipCallback(s)},_.prototype._onMouseDown=function(s){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var g=this._findZoneEventAt(s);g!=null&&g.willLinkActivate(s)&&(s.preventDefault(),s.stopImmediatePropagation())}},_.prototype._onMouseLeave=function(s){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},_.prototype._onClick=function(s){var g=this._findZoneEventAt(s),m=this._getSelectionLength();g&&m===this._initialSelectionLength&&(g.clickCallback(s),s.preventDefault(),s.stopImmediatePropagation())},_.prototype._getSelectionLength=function(){var s=this._selectionService.selectionText;return s?s.length:0},_.prototype._findZoneEventAt=function(s){var g=this._mouseService.getCoords(s,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(g)for(var m=g[0],S=g[1],y=0;y<this._zones.length;y++){var C=this._zones[y];if(C.y1===C.y2){if(S===C.y1&&m>=C.x1&&m<C.x2)return C}else if(S===C.y1&&m>=C.x1||S===C.y2&&m<C.x2||S>C.y1&&S<C.y2)return C}},l([u(2,c.IBufferService),u(3,o.IMouseService),u(4,o.ISelectionService)],_)}(d.Disposable);r.MouseZoneManager=f},function(n,r,p){var a,v=this&&this.__extends||(a=function(h,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,g){s.__proto__=g}||function(s,g){for(var m in g)g.hasOwnProperty(m)&&(s[m]=g[m])})(h,_)},function(h,_){function s(){this.constructor=h}a(h,_),h.prototype=_===null?Object.create(_):(s.prototype=_.prototype,new s)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(17),u=p(11),d=p(29),b=p(8),o=p(2),c=p(30),f=function(h){function _(s,g){var m=h.call(this)||this;m._terminal=s,m._renderService=g,m._liveRegionLineCount=0,m._charsToConsume=[],m._charsToAnnounce="",m._accessibilityTreeRoot=document.createElement("div"),m._accessibilityTreeRoot.classList.add("xterm-accessibility"),m._rowContainer=document.createElement("div"),m._rowContainer.classList.add("xterm-accessibility-tree"),m._rowContainer.setAttribute("role","list"),m._rowElements=[];for(var S=0;S<m._terminal.rows;S++)m._rowElements[S]=m._createAccessibilityTreeNode(),m._rowContainer.appendChild(m._rowElements[S]);return m._topBoundaryFocusListener=function(y){return m._onBoundaryFocus(y,0)},m._bottomBoundaryFocusListener=function(y){return m._onBoundaryFocus(y,1)},m._rowElements[0].addEventListener("focus",m._topBoundaryFocusListener),m._rowElements[m._rowElements.length-1].addEventListener("focus",m._bottomBoundaryFocusListener),m._refreshRowsDimensions(),m._accessibilityTreeRoot.appendChild(m._rowContainer),m._renderRowsDebouncer=new d.RenderDebouncer(m._renderRows.bind(m)),m._refreshRows(),m._liveRegion=document.createElement("div"),m._liveRegion.classList.add("live-region"),m._liveRegion.setAttribute("aria-live","assertive"),m._accessibilityTreeRoot.appendChild(m._liveRegion),m._terminal.element.insertAdjacentElement("afterbegin",m._accessibilityTreeRoot),m.register(m._renderRowsDebouncer),m.register(m._terminal.onResize(function(y){return m._onResize(y.rows)})),m.register(m._terminal.onRender(function(y){return m._refreshRows(y.start,y.end)})),m.register(m._terminal.onScroll(function(){return m._refreshRows()})),m.register(m._terminal.onA11yChar(function(y){return m._onChar(y)})),m.register(m._terminal.onLineFeed(function(){return m._onChar(`
`)})),m.register(m._terminal.onA11yTab(function(y){return m._onTab(y)})),m.register(m._terminal.onKey(function(y){return m._onKey(y.key)})),m.register(m._terminal.onBlur(function(){return m._clearLiveRegion()})),m.register(m._renderService.onDimensionsChange(function(){return m._refreshRowsDimensions()})),m._screenDprMonitor=new c.ScreenDprMonitor,m.register(m._screenDprMonitor),m._screenDprMonitor.setListener(function(){return m._refreshRowsDimensions()}),m.register(b.addDisposableDomListener(window,"resize",function(){return m._refreshRowsDimensions()})),m}return v(_,h),_.prototype.dispose=function(){h.prototype.dispose.call(this),this._terminal.element.removeChild(this._accessibilityTreeRoot),this._rowElements.length=0},_.prototype._onBoundaryFocus=function(s,g){var m=s.target,S=this._rowElements[g===0?1:this._rowElements.length-2];if(m.getAttribute("aria-posinset")!==(g===0?"1":""+this._terminal.buffer.lines.length)&&s.relatedTarget===S){var y,C;if(g===0?(y=m,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(y=this._rowElements.shift(),C=m,this._rowContainer.removeChild(y)),y.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),g===0){var w=this._createAccessibilityTreeNode();this._rowElements.unshift(w),this._rowContainer.insertAdjacentElement("afterbegin",w)}else w=this._createAccessibilityTreeNode(),this._rowElements.push(w),this._rowContainer.appendChild(w);this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(g===0?-1:1),this._rowElements[g===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}},_.prototype._onResize=function(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(var g=this._rowContainer.children.length;g<this._terminal.rows;g++)this._rowElements[g]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[g]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},_.prototype._createAccessibilityTreeNode=function(){var s=document.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s},_.prototype._onTab=function(s){for(var g=0;g<s;g++)this._onChar(" ")},_.prototype._onChar=function(s){var g=this;this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)),u.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){g._accessibilityTreeRoot.appendChild(g._liveRegion)},0))},_.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,u.isMac&&this._liveRegion.parentNode&&this._accessibilityTreeRoot.removeChild(this._liveRegion)},_.prototype._onKey=function(s){this._clearLiveRegion(),this._charsToConsume.push(s)},_.prototype._refreshRows=function(s,g){this._renderRowsDebouncer.refresh(s,g,this._terminal.rows)},_.prototype._renderRows=function(s,g){for(var m=this._terminal.buffer,S=m.lines.length.toString(),y=s;y<=g;y++){var C=m.translateBufferLineToString(m.ydisp+y,!0),w=(m.ydisp+y+1).toString(),I=this._rowElements[y];I&&(C.length===0?I.innerHTML="&nbsp;":I.textContent=C,I.setAttribute("aria-posinset",w),I.setAttribute("aria-setsize",S))}this._announceCharacters()},_.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}},_.prototype._refreshRowDimensions=function(s){s.style.height=this._renderService.dimensions.actualCellHeight+"px"},_.prototype._announceCharacters=function(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")},_}(o.Disposable);r.AccessibilityManager=f},function(n,r,p){var a,v=this&&this.__extends||(a=function(m,S){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,C){y.__proto__=C}||function(y,C){for(var w in C)C.hasOwnProperty(w)&&(y[w]=C[w])})(m,S)},function(m,S){function y(){this.constructor=m}a(m,S),m.prototype=S===null?Object.create(S):(y.prototype=S.prototype,new y)}),l=this&&this.__decorate||function(m,S,y,C){var w,I=arguments.length,R=I<3?S:C===null?C=Object.getOwnPropertyDescriptor(S,y):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,S,y,C);else for(var k=m.length-1;k>=0;k--)(w=m[k])&&(R=(I<3?w(R):I>3?w(S,y,R):w(S,y))||R);return I>3&&R&&Object.defineProperty(S,y,R),R},u=this&&this.__param||function(m,S){return function(y,C){S(y,C,m)}};Object.defineProperty(r,"__esModule",{value:!0});var d=p(57),b=p(9),o=p(2),c=p(4),f=p(1),h=p(0),_=p(10),s=1,g=function(m){function S(y,C,w,I,R,k,P,x,A){var M=m.call(this)||this;return M._colors=y,M._element=C,M._screenElement=w,M._viewportElement=I,M._linkifier=R,M._linkifier2=k,M._charSizeService=P,M._optionsService=x,M._bufferService=A,M._terminalClass=s++,M._rowElements=[],M._onRequestRefreshRows=new h.EventEmitter,M._rowContainer=document.createElement("div"),M._rowContainer.classList.add("xterm-rows"),M._rowContainer.style.lineHeight="normal",M._rowContainer.setAttribute("aria-hidden","true"),M._refreshRowElements(M._bufferService.cols,M._bufferService.rows),M._selectionContainer=document.createElement("div"),M._selectionContainer.classList.add("xterm-selection"),M._selectionContainer.setAttribute("aria-hidden","true"),M.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},M._updateDimensions(),M._injectCss(),M._rowFactory=new d.DomRendererRowFactory(document,M._optionsService,M._colors),M._element.classList.add("xterm-dom-renderer-owner-"+M._terminalClass),M._screenElement.appendChild(M._rowContainer),M._screenElement.appendChild(M._selectionContainer),M._linkifier.onLinkHover(function(N){return M._onLinkHover(N)}),M._linkifier.onLinkLeave(function(N){return M._onLinkLeave(N)}),M._linkifier2.onLinkHover(function(N){return M._onLinkHover(N)}),M._linkifier2.onLinkLeave(function(N){return M._onLinkLeave(N)}),M}return v(S,m),Object.defineProperty(S.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!0,configurable:!0}),S.prototype.dispose=function(){this._element.classList.remove("xterm-dom-renderer-owner-"+this._terminalClass),this._screenElement.removeChild(this._rowContainer),this._screenElement.removeChild(this._selectionContainer),this._screenElement.removeChild(this._themeStyleElement),this._screenElement.removeChild(this._dimensionsStyleElement),m.prototype.dispose.call(this)},S.prototype._updateDimensions=function(){var y=this;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,this._rowElements.forEach(function(w){w.style.width=y.dimensions.canvasWidth+"px",w.style.height=y.dimensions.actualCellHeight+"px",w.style.lineHeight=y.dimensions.actualCellHeight+"px",w.style.overflow="hidden"}),this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));var C=this._terminalSelector+" .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: "+this.dimensions.actualCellWidth+"px}";this._dimensionsStyleElement.innerHTML=C,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=this.dimensions.canvasWidth+"px",this._screenElement.style.height=this.dimensions.canvasHeight+"px"},S.prototype.setColors=function(y){this._colors=y,this._injectCss()},S.prototype._injectCss=function(){var y=this;this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));var C=this._terminalSelector+" .xterm-rows { color: "+this._colors.foreground.css+"; font-family: "+this._optionsService.options.fontFamily+"; font-size: "+this._optionsService.options.fontSize+"px;}";C+=this._terminalSelector+" span:not(."+d.BOLD_CLASS+") { font-weight: "+this._optionsService.options.fontWeight+";}"+this._terminalSelector+" span."+d.BOLD_CLASS+" { font-weight: "+this._optionsService.options.fontWeightBold+";}"+this._terminalSelector+" span."+d.ITALIC_CLASS+" { font-style: italic;}",C+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% {  box-shadow: none; }}",C+="@keyframes blink_block_"+this._terminalClass+" { 0% {  background-color: "+this._colors.cursor.css+";  color: "+this._colors.cursorAccent.css+"; } 50% {  background-color: "+this._colors.cursorAccent.css+";  color: "+this._colors.cursor.css+"; }}",C+=this._terminalSelector+" .xterm-rows:not(.xterm-focus) ."+d.CURSOR_CLASS+"."+d.CURSOR_STYLE_BLOCK_CLASS+" { outline: 1px solid "+this._colors.cursor.css+"; outline-offset: -1px;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+d.CURSOR_CLASS+"."+d.CURSOR_BLINK_CLASS+":not(."+d.CURSOR_STYLE_BLOCK_CLASS+") { animation: blink_box_shadow_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+d.CURSOR_CLASS+"."+d.CURSOR_BLINK_CLASS+"."+d.CURSOR_STYLE_BLOCK_CLASS+" { animation: blink_block_"+this._terminalClass+" 1s step-end infinite;}"+this._terminalSelector+" .xterm-rows.xterm-focus ."+d.CURSOR_CLASS+"."+d.CURSOR_STYLE_BLOCK_CLASS+" { background-color: "+this._colors.cursor.css+"; color: "+this._colors.cursorAccent.css+";}"+this._terminalSelector+" .xterm-rows ."+d.CURSOR_CLASS+"."+d.CURSOR_STYLE_BAR_CLASS+" { box-shadow: "+this._optionsService.options.cursorWidth+"px 0 0 "+this._colors.cursor.css+" inset;}"+this._terminalSelector+" .xterm-rows ."+d.CURSOR_CLASS+"."+d.CURSOR_STYLE_UNDERLINE_CLASS+" { box-shadow: 0 -1px 0 "+this._colors.cursor.css+" inset;}",C+=this._terminalSelector+" .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}"+this._terminalSelector+" .xterm-selection div { position: absolute; background-color: "+this._colors.selection.css+";}",this._colors.ansi.forEach(function(w,I){C+=y._terminalSelector+" .xterm-fg-"+I+" { color: "+w.css+"; }"+y._terminalSelector+" .xterm-bg-"+I+" { background-color: "+w.css+"; }"}),C+=this._terminalSelector+" .xterm-fg-"+b.INVERTED_DEFAULT_COLOR+" { color: "+_.color.opaque(this._colors.background).css+"; }"+this._terminalSelector+" .xterm-bg-"+b.INVERTED_DEFAULT_COLOR+" { background-color: "+this._colors.foreground.css+"; }",this._themeStyleElement.innerHTML=C},S.prototype.onDevicePixelRatioChange=function(){this._updateDimensions()},S.prototype._refreshRowElements=function(y,C){for(var w=this._rowElements.length;w<=C;w++){var I=document.createElement("div");this._rowContainer.appendChild(I),this._rowElements.push(I)}for(;this._rowElements.length>C;)this._rowContainer.removeChild(this._rowElements.pop())},S.prototype.onResize=function(y,C){this._refreshRowElements(y,C),this._updateDimensions()},S.prototype.onCharSizeChanged=function(){this._updateDimensions()},S.prototype.onBlur=function(){this._rowContainer.classList.remove("xterm-focus")},S.prototype.onFocus=function(){this._rowContainer.classList.add("xterm-focus")},S.prototype.onSelectionChanged=function(y,C,w){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(y&&C){var I=y[1]-this._bufferService.buffer.ydisp,R=C[1]-this._bufferService.buffer.ydisp,k=Math.max(I,0),P=Math.min(R,this._bufferService.rows-1);if(!(k>=this._bufferService.rows||P<0)){var x=document.createDocumentFragment();if(w)x.appendChild(this._createSelectionElement(k,y[0],C[0],P-k+1));else{var A=I===k?y[0]:0,M=k===P?C[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(k,A,M));var N=P-k-1;if(x.appendChild(this._createSelectionElement(k+1,0,this._bufferService.cols,N)),k!==P){var z=R===P?C[0]:this._bufferService.cols;x.appendChild(this._createSelectionElement(P,0,z))}}this._selectionContainer.appendChild(x)}}},S.prototype._createSelectionElement=function(y,C,w,I){I===void 0&&(I=1);var R=document.createElement("div");return R.style.height=I*this.dimensions.actualCellHeight+"px",R.style.top=y*this.dimensions.actualCellHeight+"px",R.style.left=C*this.dimensions.actualCellWidth+"px",R.style.width=this.dimensions.actualCellWidth*(w-C)+"px",R},S.prototype.onCursorMove=function(){},S.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},S.prototype.clear=function(){this._rowElements.forEach(function(y){return y.innerHTML=""})},S.prototype.renderRows=function(y,C){for(var w=this._bufferService.buffer.ybase+this._bufferService.buffer.y,I=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),R=this._optionsService.options.cursorBlink,k=y;k<=C;k++){var P=this._rowElements[k];P.innerHTML="";var x=k+this._bufferService.buffer.ydisp,A=this._bufferService.buffer.lines.get(x),M=this._optionsService.options.cursorStyle;P.appendChild(this._rowFactory.createRow(A,x===w,M,I,R,this.dimensions.actualCellWidth,this._bufferService.cols))}},Object.defineProperty(S.prototype,"_terminalSelector",{get:function(){return".xterm-dom-renderer-owner-"+this._terminalClass},enumerable:!0,configurable:!0}),S.prototype.registerCharacterJoiner=function(y){return-1},S.prototype.deregisterCharacterJoiner=function(y){return!1},S.prototype._onLinkHover=function(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!0)},S.prototype._onLinkLeave=function(y){this._setCellUnderline(y.x1,y.x2,y.y1,y.y2,y.cols,!1)},S.prototype._setCellUnderline=function(y,C,w,I,R,k){for(;y!==C||w!==I;){var P=this._rowElements[w];if(!P)return;var x=P.children[y];x&&(x.style.textDecoration=k?"underline":"none"),++y>=R&&(y=0,w++)}},l([u(6,c.ICharSizeService),u(7,f.IOptionsService),u(8,f.IBufferService)],S)}(o.Disposable);r.DomRenderer=g},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(9),v=p(3),l=p(5),u=p(10);r.BOLD_CLASS="xterm-bold",r.DIM_CLASS="xterm-dim",r.ITALIC_CLASS="xterm-italic",r.UNDERLINE_CLASS="xterm-underline",r.CURSOR_CLASS="xterm-cursor",r.CURSOR_BLINK_CLASS="xterm-cursor-blink",r.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",r.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",r.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var d=function(){function o(c,f,h){this._document=c,this._optionsService=f,this._colors=h,this._workCell=new l.CellData}return o.prototype.setColors=function(c){this._colors=c},o.prototype.createRow=function(c,f,h,_,s,g,m){for(var S=this._document.createDocumentFragment(),y=0,C=Math.min(c.length,m)-1;C>=0;C--)if(c.loadCell(C,this._workCell).getCode()!==v.NULL_CELL_CODE||f&&C===_){y=C+1;break}for(C=0;C<y;C++){c.loadCell(C,this._workCell);var w=this._workCell.getWidth();if(w!==0){var I=this._document.createElement("span");if(w>1&&(I.style.width=g*w+"px"),f&&C===_)switch(I.classList.add(r.CURSOR_CLASS),s&&I.classList.add(r.CURSOR_BLINK_CLASS),h){case"bar":I.classList.add(r.CURSOR_STYLE_BAR_CLASS);break;case"underline":I.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);break;default:I.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&I.classList.add(r.BOLD_CLASS),this._workCell.isItalic()&&I.classList.add(r.ITALIC_CLASS),this._workCell.isDim()&&I.classList.add(r.DIM_CLASS),this._workCell.isUnderline()&&I.classList.add(r.UNDERLINE_CLASS),this._workCell.isInvisible()?I.textContent=v.WHITESPACE_CELL_CHAR:I.textContent=this._workCell.getChars()||v.WHITESPACE_CELL_CHAR;var R=this._workCell.getFgColor(),k=this._workCell.getFgColorMode(),P=this._workCell.getBgColor(),x=this._workCell.getBgColorMode(),A=!!this._workCell.isInverse();if(A){var M=R;R=P,P=M;var N=k;k=x,x=N}switch(k){case 16777216:case 33554432:this._workCell.isBold()&&R<8&&this._optionsService.options.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(I,this._colors.background,this._colors.ansi[R])||I.classList.add("xterm-fg-"+R);break;case 50331648:var z=u.rgba.toColor(R>>16&255,R>>8&255,255&R);this._applyMinimumContrast(I,this._colors.background,z)||this._addStyle(I,"color:#"+b(R.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(I,this._colors.background,this._colors.foreground)||A&&I.classList.add("xterm-fg-"+a.INVERTED_DEFAULT_COLOR)}switch(x){case 16777216:case 33554432:I.classList.add("xterm-bg-"+P);break;case 50331648:this._addStyle(I,"background-color:#"+b(P.toString(16),"0",6));break;case 0:default:A&&I.classList.add("xterm-bg-"+a.INVERTED_DEFAULT_COLOR)}S.appendChild(I)}}return S},o.prototype._applyMinimumContrast=function(c,f,h){if(this._optionsService.options.minimumContrastRatio===1)return!1;var _=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return _===void 0&&(_=u.color.ensureContrastRatio(f,h,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,_??null)),!!_&&(this._addStyle(c,"color:"+_.css),!0)},o.prototype._addStyle=function(c,f){c.setAttribute("style",""+(c.getAttribute("style")||"")+f+";")},o}();function b(o,c,f){for(;o.length<f;)o=c+o;return o}r.DomRendererRowFactory=d},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(12),v={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};r.evaluateKeyboardEvent=function(l,u,d,b){var o={type:0,cancel:!1,key:void 0},c=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?o.key=u?a.C0.ESC+"OA":a.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?o.key=u?a.C0.ESC+"OD":a.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?o.key=u?a.C0.ESC+"OC":a.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(o.key=u?a.C0.ESC+"OB":a.C0.ESC+"[B");break;case 8:if(l.shiftKey){o.key=a.C0.BS;break}if(l.altKey){o.key=a.C0.ESC+a.C0.DEL;break}o.key=a.C0.DEL;break;case 9:if(l.shiftKey){o.key=a.C0.ESC+"[Z";break}o.key=a.C0.HT,o.cancel=!0;break;case 13:o.key=a.C0.CR,o.cancel=!0;break;case 27:o.key=a.C0.ESC,o.cancel=!0;break;case 37:if(l.metaKey)break;c?(o.key=a.C0.ESC+"[1;"+(c+1)+"D",o.key===a.C0.ESC+"[1;3D"&&(o.key=a.C0.ESC+(d?"b":"[1;5D"))):o.key=u?a.C0.ESC+"OD":a.C0.ESC+"[D";break;case 39:if(l.metaKey)break;c?(o.key=a.C0.ESC+"[1;"+(c+1)+"C",o.key===a.C0.ESC+"[1;3C"&&(o.key=a.C0.ESC+(d?"f":"[1;5C"))):o.key=u?a.C0.ESC+"OC":a.C0.ESC+"[C";break;case 38:if(l.metaKey)break;c?(o.key=a.C0.ESC+"[1;"+(c+1)+"A",d||o.key!==a.C0.ESC+"[1;3A"||(o.key=a.C0.ESC+"[1;5A")):o.key=u?a.C0.ESC+"OA":a.C0.ESC+"[A";break;case 40:if(l.metaKey)break;c?(o.key=a.C0.ESC+"[1;"+(c+1)+"B",d||o.key!==a.C0.ESC+"[1;3B"||(o.key=a.C0.ESC+"[1;5B")):o.key=u?a.C0.ESC+"OB":a.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(o.key=a.C0.ESC+"[2~");break;case 46:o.key=c?a.C0.ESC+"[3;"+(c+1)+"~":a.C0.ESC+"[3~";break;case 36:o.key=c?a.C0.ESC+"[1;"+(c+1)+"H":u?a.C0.ESC+"OH":a.C0.ESC+"[H";break;case 35:o.key=c?a.C0.ESC+"[1;"+(c+1)+"F":u?a.C0.ESC+"OF":a.C0.ESC+"[F";break;case 33:l.shiftKey?o.type=2:o.key=a.C0.ESC+"[5~";break;case 34:l.shiftKey?o.type=3:o.key=a.C0.ESC+"[6~";break;case 112:o.key=c?a.C0.ESC+"[1;"+(c+1)+"P":a.C0.ESC+"OP";break;case 113:o.key=c?a.C0.ESC+"[1;"+(c+1)+"Q":a.C0.ESC+"OQ";break;case 114:o.key=c?a.C0.ESC+"[1;"+(c+1)+"R":a.C0.ESC+"OR";break;case 115:o.key=c?a.C0.ESC+"[1;"+(c+1)+"S":a.C0.ESC+"OS";break;case 116:o.key=c?a.C0.ESC+"[15;"+(c+1)+"~":a.C0.ESC+"[15~";break;case 117:o.key=c?a.C0.ESC+"[17;"+(c+1)+"~":a.C0.ESC+"[17~";break;case 118:o.key=c?a.C0.ESC+"[18;"+(c+1)+"~":a.C0.ESC+"[18~";break;case 119:o.key=c?a.C0.ESC+"[19;"+(c+1)+"~":a.C0.ESC+"[19~";break;case 120:o.key=c?a.C0.ESC+"[20;"+(c+1)+"~":a.C0.ESC+"[20~";break;case 121:o.key=c?a.C0.ESC+"[21;"+(c+1)+"~":a.C0.ESC+"[21~";break;case 122:o.key=c?a.C0.ESC+"[23;"+(c+1)+"~":a.C0.ESC+"[23~";break;case 123:o.key=c?a.C0.ESC+"[24;"+(c+1)+"~":a.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(d&&!b||!l.altKey||l.metaKey)d&&!l.altKey&&!l.ctrlKey&&l.metaKey?l.keyCode===65&&(o.type=1):l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?o.key=l.key:l.key&&l.ctrlKey&&l.key==="_"&&(o.key=a.C0.US);else{var f=v[l.keyCode],h=f&&f[l.shiftKey?1:0];if(h)o.key=a.C0.ESC+h;else if(l.keyCode>=65&&l.keyCode<=90){var _=l.ctrlKey?l.keyCode-64:l.keyCode+32;o.key=a.C0.ESC+String.fromCharCode(_)}}else l.keyCode>=65&&l.keyCode<=90?o.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?o.key=a.C0.NUL:l.keyCode>=51&&l.keyCode<=55?o.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?o.key=a.C0.DEL:l.keyCode===219?o.key=a.C0.ESC:l.keyCode===220?o.key=a.C0.FS:l.keyCode===221&&(o.key=a.C0.GS)}return o}},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(3);r.updateWindowsModeWrappedState=function(v){var l=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),u=l==null?void 0:l.get(v.cols-1),d=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);d&&u&&(d.isWrapped=u[a.CHAR_DATA_CODE_INDEX]!==a.NULL_CELL_CODE&&u[a.CHAR_DATA_CODE_INDEX]!==a.WHITESPACE_CELL_CODE)}},function(n,r,p){var a,v=this&&this.__extends||(a=function(g,m){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(S,y){S.__proto__=y}||function(S,y){for(var C in y)y.hasOwnProperty(C)&&(S[C]=y[C])})(g,m)},function(g,m){function S(){this.constructor=g}a(g,m),g.prototype=m===null?Object.create(m):(S.prototype=m.prototype,new S)}),l=this&&this.__decorate||function(g,m,S,y){var C,w=arguments.length,I=w<3?m:y===null?y=Object.getOwnPropertyDescriptor(m,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(g,m,S,y);else for(var R=g.length-1;R>=0;R--)(C=g[R])&&(I=(w<3?C(I):w>3?C(m,S,I):C(m,S))||I);return w>3&&I&&Object.defineProperty(m,S,I),I},u=this&&this.__param||function(g,m){return function(S,y){m(S,y,g)}};Object.defineProperty(r,"__esModule",{value:!0});var d=p(29),b=p(0),o=p(2),c=p(30),f=p(8),h=p(1),_=p(4),s=function(g){function m(S,y,C,w,I){var R=g.call(this)||this;if(R._renderer=S,R._rowCount=y,R.screenElement=C,R.optionsService=w,R.charSizeService=I,R._isPaused=!1,R._needsFullRefresh=!1,R._canvasWidth=0,R._canvasHeight=0,R._onDimensionsChange=new b.EventEmitter,R._onRender=new b.EventEmitter,R._onRefreshRequest=new b.EventEmitter,R._renderDebouncer=new d.RenderDebouncer(function(P,x){return R._renderRows(P,x)}),R.register(R._renderDebouncer),R._screenDprMonitor=new c.ScreenDprMonitor,R._screenDprMonitor.setListener(function(){return R.onDevicePixelRatioChange()}),R.register(R._screenDprMonitor),R.register(w.onOptionChange(function(){return R._renderer.onOptionsChanged()})),R.register(I.onCharSizeChange(function(){return R.onCharSizeChanged()})),R._renderer.onRequestRefreshRows(function(P){return R.refreshRows(P.start,P.end)}),R.register(f.addDisposableDomListener(window,"resize",function(){return R.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var k=new IntersectionObserver(function(P){return R._onIntersectionChange(P[P.length-1])},{threshold:0});k.observe(C),R.register({dispose:function(){return k.disconnect()}})}return R}return v(m,g),Object.defineProperty(m.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!0,configurable:!0}),m.prototype._onIntersectionChange=function(S){this._isPaused=S.intersectionRatio===0,!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},m.prototype.refreshRows=function(S,y){this._isPaused?this._needsFullRefresh=!0:this._renderDebouncer.refresh(S,y,this._rowCount)},m.prototype._renderRows=function(S,y){this._renderer.renderRows(S,y),this._onRender.fire({start:S,end:y})},m.prototype.resize=function(S,y){this._rowCount=y,this._fireOnCanvasResize()},m.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},m.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},m.prototype.dispose=function(){this._renderer.dispose(),g.prototype.dispose.call(this)},m.prototype.setRenderer=function(S){var y=this;this._renderer.dispose(),this._renderer=S,this._renderer.onRequestRefreshRows(function(C){return y.refreshRows(C.start,C.end)}),this.refreshRows(0,this._rowCount-1)},m.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},m.prototype.setColors=function(S){this._renderer.setColors(S),this._fullRefresh()},m.prototype.onDevicePixelRatioChange=function(){this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},m.prototype.onResize=function(S,y){this._renderer.onResize(S,y),this._fullRefresh()},m.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},m.prototype.onBlur=function(){this._renderer.onBlur()},m.prototype.onFocus=function(){this._renderer.onFocus()},m.prototype.onSelectionChanged=function(S,y,C){this._renderer.onSelectionChanged(S,y,C)},m.prototype.onCursorMove=function(){this._renderer.onCursorMove()},m.prototype.clear=function(){this._renderer.clear()},m.prototype.registerCharacterJoiner=function(S){return this._renderer.registerCharacterJoiner(S)},m.prototype.deregisterCharacterJoiner=function(S){return this._renderer.deregisterCharacterJoiner(S)},l([u(3,h.IOptionsService),u(4,_.ICharSizeService)],m)}(o.Disposable);r.RenderService=s},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(0),v=p(11),l=p(31);r.DEFAULT_BELL_SOUND="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",r.DEFAULT_OPTIONS=Object.freeze({cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,bellSound:r.DEFAULT_BELL_SOUND,bellStyle:"none",drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:v.isMac,rendererType:"canvas",windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",convertEol:!1,termName:"xterm",cancelEvents:!1});var u=["cols","rows"],d=function(){function b(o){var c=this;this._onOptionChange=new a.EventEmitter,this.options=l.clone(r.DEFAULT_OPTIONS),Object.keys(o).forEach(function(f){if(f in c.options){var h=o[f];c.options[f]=h}})}return Object.defineProperty(b.prototype,"onOptionChange",{get:function(){return this._onOptionChange.event},enumerable:!0,configurable:!0}),b.prototype.setOption=function(o,c){if(!(o in r.DEFAULT_OPTIONS))throw new Error('No option with key "'+o+'"');if(u.indexOf(o)!==-1)throw new Error('Option "'+o+'" can only be set in the constructor');this.options[o]!==c&&(c=this._sanitizeAndValidateOption(o,c),this.options[o]!==c&&(this.options[o]=c,this._onOptionChange.fire(o)))},b.prototype._sanitizeAndValidateOption=function(o,c){switch(o){case"bellStyle":case"cursorStyle":case"fontWeight":case"fontWeightBold":case"rendererType":case"wordSeparator":c||(c=r.DEFAULT_OPTIONS[o]);break;case"cursorWidth":c=Math.floor(c);case"lineHeight":case"tabStopWidth":if(c<1)throw new Error(o+" cannot be less than 1, value: "+c);break;case"minimumContrastRatio":c=Math.max(1,Math.min(21,Math.round(10*c)/10));break;case"scrollback":if((c=Math.min(c,4294967295))<0)throw new Error(o+" cannot be less than 0, value: "+c);break;case"fastScrollSensitivity":case"scrollSensitivity":if(c<=0)throw new Error(o+" cannot be less than or equal to 0, value: "+c)}return c},b.prototype.getOption=function(o){if(!(o in r.DEFAULT_OPTIONS))throw new Error('No option with key "'+o+'"');return this.options[o]},b}();r.OptionsService=d},function(n,r,p){var a=this&&this.__decorate||function(o,c,f,h){var _,s=arguments.length,g=s<3?c:h===null?h=Object.getOwnPropertyDescriptor(c,f):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(o,c,f,h);else for(var m=o.length-1;m>=0;m--)(_=o[m])&&(g=(s<3?_(g):s>3?_(c,f,g):_(c,f))||g);return s>3&&g&&Object.defineProperty(c,f,g),g},v=this&&this.__param||function(o,c){return function(f,h){c(f,h,o)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=p(0),d=function(){function o(c,f,h){this.document=c,this.parentElement=f,this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=new u.EventEmitter,this._measureStrategy=new b(c,f,this._optionsService)}return Object.defineProperty(o.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!0,configurable:!0}),o.prototype.measure=function(){var c=this._measureStrategy.measure();c.width===this.width&&c.height===this.height||(this.width=c.width,this.height=c.height,this._onCharSizeChange.fire())},a([v(2,l.IOptionsService)],o)}();r.CharSizeService=d;var b=function(){function o(c,f,h){this._document=c,this._parentElement=f,this._optionsService=h,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 o.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var c=this._measureElement.getBoundingClientRect();return c.width!==0&&c.height!==0&&(this._result.width=c.width,this._result.height=Math.ceil(c.height)),this._result},o}()},function(n,r,p){var a=this&&this.__decorate||function(b,o,c,f){var h,_=arguments.length,s=_<3?o:f===null?f=Object.getOwnPropertyDescriptor(o,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(b,o,c,f);else for(var g=b.length-1;g>=0;g--)(h=b[g])&&(s=(_<3?h(s):_>3?h(o,c,s):h(o,c))||s);return _>3&&s&&Object.defineProperty(o,c,s),s},v=this&&this.__param||function(b,o){return function(c,f){o(c,f,b)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=p(64);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;var d=function(){function b(o){this._optionsService=o,this.cols=Math.max(o.options.cols,r.MINIMUM_COLS),this.rows=Math.max(o.options.rows,r.MINIMUM_ROWS),this.buffers=new u.BufferSet(o,this)}return Object.defineProperty(b.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!0,configurable:!0}),b.prototype.resize=function(o,c){this.cols=o,this.rows=c},b.prototype.reset=function(){this.buffers=new u.BufferSet(this._optionsService,this)},a([v(0,l.IOptionsService)],b)}();r.BufferService=d},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(65),v=p(0),l=function(){function u(d,b){this.optionsService=d,this.bufferService=b,this._onBufferActivate=new v.EventEmitter,this._normal=new a.Buffer(!0,d,b),this._normal.fillViewportRows(),this._alt=new a.Buffer(!1,d,b),this._activeBuffer=this._normal,this.setupTabStops()}return Object.defineProperty(u.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"alt",{get:function(){return this._alt},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"normal",{get:function(){return this._normal},enumerable:!0,configurable:!0}),u.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},u.prototype.activateAltBuffer=function(d){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(d),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},u.prototype.resize=function(d,b){this._normal.resize(d,b),this._alt.resize(d,b)},u.prototype.setupTabStops=function(d){this._normal.setupTabStops(d),this._alt.setupTabStops(d)},u}();r.BufferSet=l},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(66),v=p(16),l=p(5),u=p(3),d=p(67),b=p(68),o=p(18);r.MAX_BUFFER_SIZE=4294967295;var c=function(){function h(_,s,g){this._hasScrollback=_,this._optionsService=s,this._bufferService=g,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=v.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return h.prototype.getNullCell=function(_){return _?(this._nullCell.fg=_.fg,this._nullCell.bg=_.bg):(this._nullCell.fg=0,this._nullCell.bg=0),this._nullCell},h.prototype.getWhitespaceCell=function(_){return _?(this._whitespaceCell.fg=_.fg,this._whitespaceCell.bg=_.bg):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0),this._whitespaceCell},h.prototype.getBlankLine=function(_,s){return new v.BufferLine(this._bufferService.cols,this.getNullCell(_),s)},Object.defineProperty(h.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"isCursorInViewport",{get:function(){var _=this.ybase+this.y-this.ydisp;return _>=0&&_<this._rows},enumerable:!0,configurable:!0}),h.prototype._getCorrectBufferLength=function(_){if(!this._hasScrollback)return _;var s=_+this._optionsService.options.scrollback;return s>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:s},h.prototype.fillViewportRows=function(_){if(this.lines.length===0){_===void 0&&(_=v.DEFAULT_ATTR_DATA);for(var s=this._rows;s--;)this.lines.push(this.getBlankLine(_))}},h.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new a.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},h.prototype.resize=function(_,s){var g=this.getNullCell(v.DEFAULT_ATTR_DATA),m=this._getCorrectBufferLength(s);if(m>this.lines.maxLength&&(this.lines.maxLength=m),this.lines.length>0){if(this._cols<_)for(var S=0;S<this.lines.length;S++)this.lines.get(S).resize(_,g);var y=0;if(this._rows<s)for(var C=this._rows;C<s;C++)this.lines.length<s+this.ybase&&(this._optionsService.options.windowsMode?this.lines.push(new v.BufferLine(_,g)):this.ybase>0&&this.lines.length<=this.ybase+this.y+y+1?(this.ybase--,y++,this.ydisp>0&&this.ydisp--):this.lines.push(new v.BufferLine(_,g)));else for(C=this._rows;C>s;C--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(m<this.lines.maxLength){var w=this.lines.length-m;w>0&&(this.lines.trimStart(w),this.ybase=Math.max(this.ybase-w,0),this.ydisp=Math.max(this.ydisp-w,0),this.savedY=Math.max(this.savedY-w,0)),this.lines.maxLength=m}this.x=Math.min(this.x,_-1),this.y=Math.min(this.y,s-1),y&&(this.y+=y),this.savedX=Math.min(this.savedX,_-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(_,s),this._cols>_))for(S=0;S<this.lines.length;S++)this.lines.get(S).resize(_,g);this._cols=_,this._rows=s},Object.defineProperty(h.prototype,"_isReflowEnabled",{get:function(){return this._hasScrollback&&!this._optionsService.options.windowsMode},enumerable:!0,configurable:!0}),h.prototype._reflow=function(_,s){this._cols!==_&&(_>this._cols?this._reflowLarger(_,s):this._reflowSmaller(_,s))},h.prototype._reflowLarger=function(_,s){var g=d.reflowLargerGetLinesToRemove(this.lines,this._cols,_,this.ybase+this.y,this.getNullCell(v.DEFAULT_ATTR_DATA));if(g.length>0){var m=d.reflowLargerCreateNewLayout(this.lines,g);d.reflowLargerApplyNewLayout(this.lines,m.layout),this._reflowLargerAdjustViewport(_,s,m.countRemoved)}},h.prototype._reflowLargerAdjustViewport=function(_,s,g){for(var m=this.getNullCell(v.DEFAULT_ATTR_DATA),S=g;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new v.BufferLine(_,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-g,0)},h.prototype._reflowSmaller=function(_,s){for(var g=this.getNullCell(v.DEFAULT_ATTR_DATA),m=[],S=0,y=this.lines.length-1;y>=0;y--){var C=this.lines.get(y);if(!(!C||!C.isWrapped&&C.getTrimmedLength()<=_)){for(var w=[C];C.isWrapped&&y>0;)C=this.lines.get(--y),w.unshift(C);var I=this.ybase+this.y;if(!(I>=y&&I<y+w.length)){var R,k=w[w.length-1].getTrimmedLength(),P=d.reflowSmallerGetNewLineLengths(w,this._cols,_),x=P.length-w.length;R=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+x):Math.max(0,this.lines.length-this.lines.maxLength+x);for(var A=[],M=0;M<x;M++){var N=this.getBlankLine(v.DEFAULT_ATTR_DATA,!0);A.push(N)}A.length>0&&(m.push({start:y+w.length+S,newLines:A}),S+=A.length),w.push.apply(w,A);var z=P.length-1,j=P[z];j===0&&(j=P[--z]);for(var ee=w.length-x-1,re=k;ee>=0;){var ue=Math.min(re,j);if(w[z].copyCellsFrom(w[ee],re-ue,j-ue,ue,!0),(j-=ue)==0&&(j=P[--z]),(re-=ue)==0){ee--;var _e=Math.max(ee,0);re=d.getWrappedLineTrimmedLength(w,_e,this._cols)}}for(M=0;M<w.length;M++)P[M]<_&&w[M].setCell(P[M],g);for(var Ce=x-R;Ce-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+S)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+x,this.ybase+s-1)}}}if(m.length>0){var L=[],ae=[];for(M=0;M<this.lines.length;M++)ae.push(this.lines.get(M));var B=this.lines.length,W=B-1,U=0,Q=m[U];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);var $=0;for(M=Math.min(this.lines.maxLength-1,B+S-1);M>=0;M--)if(Q&&Q.start>W+$){for(var te=Q.newLines.length-1;te>=0;te--)this.lines.set(M--,Q.newLines[te]);M++,L.push({index:W+1,amount:Q.newLines.length}),$+=Q.newLines.length,Q=m[++U]}else this.lines.set(M,ae[W--]);var de=0;for(M=L.length-1;M>=0;M--)L[M].index+=de,this.lines.onInsertEmitter.fire(L[M]),de+=L[M].amount;var ce=Math.max(0,B+S-this.lines.maxLength);ce>0&&this.lines.onTrimEmitter.fire(ce)}},h.prototype.stringIndexToBufferIndex=function(_,s,g){for(g===void 0&&(g=!1);s;){var m=this.lines.get(_);if(!m)return[-1,-1];for(var S=g?m.getTrimmedLength():m.length,y=0;y<S;++y)if(m.get(y)[u.CHAR_DATA_WIDTH_INDEX]&&(s-=m.get(y)[u.CHAR_DATA_CHAR_INDEX].length||1),s<0)return[_,y];_++}return[_,0]},h.prototype.translateBufferLineToString=function(_,s,g,m){g===void 0&&(g=0);var S=this.lines.get(_);return S?S.translateToString(s,g,m):""},h.prototype.getWrappedRangeForLine=function(_){for(var s=_,g=_;s>0&&this.lines.get(s).isWrapped;)s--;for(;g+1<this.lines.length&&this.lines.get(g+1).isWrapped;)g++;return{first:s,last:g}},h.prototype.setupTabStops=function(_){for(_!=null?this.tabs[_]||(_=this.prevStop(_)):(this.tabs={},_=0);_<this._cols;_+=this._optionsService.options.tabStopWidth)this.tabs[_]=!0},h.prototype.prevStop=function(_){for(_==null&&(_=this.x);!this.tabs[--_]&&_>0;);return _>=this._cols?this._cols-1:_<0?0:_},h.prototype.nextStop=function(_){for(_==null&&(_=this.x);!this.tabs[++_]&&_<this._cols;);return _>=this._cols?this._cols-1:_<0?0:_},h.prototype.addMarker=function(_){var s=this,g=new b.Marker(_);return this.markers.push(g),g.register(this.lines.onTrim(function(m){g.line-=m,g.line<0&&g.dispose()})),g.register(this.lines.onInsert(function(m){g.line>=m.index&&(g.line+=m.amount)})),g.register(this.lines.onDelete(function(m){g.line>=m.index&&g.line<m.index+m.amount&&g.dispose(),g.line>m.index&&(g.line-=m.amount)})),g.register(g.onDispose(function(){return s._removeMarker(g)})),g},h.prototype._removeMarker=function(_){this.markers.splice(this.markers.indexOf(_),1)},h.prototype.iterator=function(_,s,g,m,S){return new f(this,_,s,g,m,S)},h}();r.Buffer=c;var f=function(){function h(_,s,g,m,S,y){g===void 0&&(g=0),m===void 0&&(m=_.lines.length),S===void 0&&(S=0),y===void 0&&(y=0),this._buffer=_,this._trimRight=s,this._startIndex=g,this._endIndex=m,this._startOverscan=S,this._endOverscan=y,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return h.prototype.hasNext=function(){return this._current<this._endIndex},h.prototype.next=function(){var _=this._buffer.getWrappedRangeForLine(this._current);_.first<this._startIndex-this._startOverscan&&(_.first=this._startIndex-this._startOverscan),_.last>this._endIndex+this._endOverscan&&(_.last=this._endIndex+this._endOverscan),_.first=Math.max(_.first,0),_.last=Math.min(_.last,this._buffer.lines.length);for(var s="",g=_.first;g<=_.last;++g)s+=this._buffer.translateBufferLineToString(g,this._trimRight);return this._current=_.last+1,{range:_,content:s}},h}();r.BufferStringIterator=f},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(0),v=function(){function l(u){this._maxLength=u,this.onDeleteEmitter=new a.EventEmitter,this.onInsertEmitter=new a.EventEmitter,this.onTrimEmitter=new a.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}return Object.defineProperty(l.prototype,"onDelete",{get:function(){return this.onDeleteEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onInsert",{get:function(){return this.onInsertEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onTrim",{get:function(){return this.onTrimEmitter.event},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"maxLength",{get:function(){return this._maxLength},set:function(u){if(this._maxLength!==u){for(var d=new Array(u),b=0;b<Math.min(u,this.length);b++)d[b]=this._array[this._getCyclicIndex(b)];this._array=d,this._maxLength=u,this._startIndex=0}},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"length",{get:function(){return this._length},set:function(u){if(u>this._length)for(var d=this._length;d<u;d++)this._array[d]=void 0;this._length=u},enumerable:!0,configurable:!0}),l.prototype.get=function(u){return this._array[this._getCyclicIndex(u)]},l.prototype.set=function(u,d){this._array[this._getCyclicIndex(u)]=d},l.prototype.push=function(u){this._array[this._getCyclicIndex(this._length)]=u,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++},l.prototype.recycle=function(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]},Object.defineProperty(l.prototype,"isFull",{get:function(){return this._length===this._maxLength},enumerable:!0,configurable:!0}),l.prototype.pop=function(){return this._array[this._getCyclicIndex(this._length---1)]},l.prototype.splice=function(u,d){for(var b=[],o=2;o<arguments.length;o++)b[o-2]=arguments[o];if(d){for(var c=u;c<this._length-d;c++)this._array[this._getCyclicIndex(c)]=this._array[this._getCyclicIndex(c+d)];this._length-=d}for(c=this._length-1;c>=u;c--)this._array[this._getCyclicIndex(c+b.length)]=this._array[this._getCyclicIndex(c)];for(c=0;c<b.length;c++)this._array[this._getCyclicIndex(u+c)]=b[c];if(this._length+b.length>this._maxLength){var f=this._length+b.length-this._maxLength;this._startIndex+=f,this._length=this._maxLength,this.onTrimEmitter.fire(f)}else this._length+=b.length},l.prototype.trimStart=function(u){u>this._length&&(u=this._length),this._startIndex+=u,this._length-=u,this.onTrimEmitter.fire(u)},l.prototype.shiftElements=function(u,d,b){if(!(d<=0)){if(u<0||u>=this._length)throw new Error("start argument out of range");if(u+b<0)throw new Error("Cannot shift elements in list beyond index 0");if(b>0){for(var o=d-1;o>=0;o--)this.set(u+o+b,this.get(u+o));var c=u+d+b-this._length;if(c>0)for(this._length+=c;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(o=0;o<d;o++)this.set(u+o+b,this.get(u+o))}},l.prototype._getCyclicIndex=function(u){return(this._startIndex+u)%this._maxLength},l}();r.CircularList=v},function(n,r,p){function a(v,l,u){if(l===v.length-1)return v[l].getTrimmedLength();var d=!v[l].hasContent(u-1)&&v[l].getWidth(u-1)===1,b=v[l+1].getWidth(0)===2;return d&&b?u-1:u}Object.defineProperty(r,"__esModule",{value:!0}),r.reflowLargerGetLinesToRemove=function(v,l,u,d,b){for(var o=[],c=0;c<v.length-1;c++){var f=c,h=v.get(++f);if(h.isWrapped){for(var _=[v.get(c)];f<v.length&&h.isWrapped;)_.push(h),h=v.get(++f);if(d>=c&&d<f)c+=_.length-1;else{for(var s=0,g=a(_,s,l),m=1,S=0;m<_.length;){var y=a(_,m,l),C=y-S,w=u-g,I=Math.min(C,w);_[s].copyCellsFrom(_[m],S,g,I,!1),(g+=I)===u&&(s++,g=0),(S+=I)===y&&(m++,S=0),g===0&&s!==0&&_[s-1].getWidth(u-1)===2&&(_[s].copyCellsFrom(_[s-1],u-1,g++,1,!1),_[s-1].setCell(u-1,b))}_[s].replaceCells(g,u,b);for(var R=0,k=_.length-1;k>0&&(k>s||_[k].getTrimmedLength()===0);k--)R++;R>0&&(o.push(c+_.length-R),o.push(R)),c+=_.length-1}}}return o},r.reflowLargerCreateNewLayout=function(v,l){for(var u=[],d=0,b=l[d],o=0,c=0;c<v.length;c++)if(b===c){var f=l[++d];v.onDeleteEmitter.fire({index:c-o,amount:f}),c+=f-1,o+=f,b=l[++d]}else u.push(c);return{layout:u,countRemoved:o}},r.reflowLargerApplyNewLayout=function(v,l){for(var u=[],d=0;d<l.length;d++)u.push(v.get(l[d]));for(d=0;d<u.length;d++)v.set(d,u[d]);v.length=l.length},r.reflowSmallerGetNewLineLengths=function(v,l,u){for(var d=[],b=v.map(function(g,m){return a(v,m,l)}).reduce(function(g,m){return g+m}),o=0,c=0,f=0;f<b;){if(b-f<u){d.push(b-f);break}o+=u;var h=a(v,c,l);o>h&&(o-=h,c++);var _=v[c].getWidth(o-1)===2;_&&o--;var s=_?u-1:u;d.push(s),f+=s}return d},r.getWrappedLineTrimmedLength=a},function(n,r,p){var a,v=this&&this.__extends||(a=function(d,b){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)c.hasOwnProperty(f)&&(o[f]=c[f])})(d,b)},function(d,b){function o(){this.constructor=d}a(d,b),d.prototype=b===null?Object.create(b):(o.prototype=b.prototype,new o)});Object.defineProperty(r,"__esModule",{value:!0});var l=p(0),u=function(d){function b(o){var c=d.call(this)||this;return c.line=o,c._id=b._nextId++,c.isDisposed=!1,c._onDispose=new l.EventEmitter,c}return v(b,d),Object.defineProperty(b.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(b.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!0,configurable:!0}),b.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire())},b._nextId=1,b}(p(2).Disposable);r.Marker=u},function(n,r,p){var a=this&&this.__decorate||function(b,o,c,f){var h,_=arguments.length,s=_<3?o:f===null?f=Object.getOwnPropertyDescriptor(o,c):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(b,o,c,f);else for(var g=b.length-1;g>=0;g--)(h=b[g])&&(s=(_<3?h(s):_>3?h(o,c,s):h(o,c))||s);return _>3&&s&&Object.defineProperty(o,c,s),s},v=this&&this.__param||function(b,o){return function(c,f){o(c,f,b)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(4),u=p(28),d=function(){function b(o,c){this._renderService=o,this._charSizeService=c}return b.prototype.getCoords=function(o,c,f,h,_){return u.getCoords(o,c,f,h,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,_)},b.prototype.getRawByteCoords=function(o,c,f,h){var _=this.getCoords(o,c,f,h);return u.getRawByteCoords(_)},a([v(0,l.IRenderService),v(1,l.ICharSizeService)],b)}();r.MouseService=d},function(n,r,p){var a=this&&this.__decorate||function(c,f,h,_){var s,g=arguments.length,m=g<3?f:_===null?_=Object.getOwnPropertyDescriptor(f,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,f,h,_);else for(var S=c.length-1;S>=0;S--)(s=c[S])&&(m=(g<3?s(m):g>3?s(f,h,m):s(f,h))||m);return g>3&&m&&Object.defineProperty(f,h,m),m},v=this&&this.__param||function(c,f){return function(h,_){f(h,_,c)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=p(0),d=p(31),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,origin:!1,wraparound:!0}),o=function(){function c(f,h,_,s){this._scrollToBottom=f,this._bufferService=h,this._logService=_,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=new u.EventEmitter,this._onUserInput=new u.EventEmitter,this._onBinary=new u.EventEmitter,this.decPrivateModes=d.clone(b)}return Object.defineProperty(c.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!0,configurable:!0}),c.prototype.reset=function(){this.decPrivateModes=d.clone(b)},c.prototype.triggerDataEvent=function(f,h){if(h===void 0&&(h=!1),!this._optionsService.options.disableStdin){var _=this._bufferService.buffer;_.ybase!==_.ydisp&&this._scrollToBottom(),h&&this._onUserInput.fire(),this._logService.debug('sending data "'+f+'"',function(){return f.split("").map(function(s){return s.charCodeAt(0)})}),this._onData.fire(f)}},c.prototype.triggerBinaryEvent=function(f){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+f+'"',function(){return f.split("").map(function(h){return h.charCodeAt(0)})}),this._onBinary.fire(f))},a([v(1,l.IBufferService),v(2,l.ILogService),v(3,l.IOptionsService)],c)}();r.CoreService=o},function(n,r,p){var a=this&&this.__decorate||function(c,f,h,_){var s,g=arguments.length,m=g<3?f:_===null?_=Object.getOwnPropertyDescriptor(f,h):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(c,f,h,_);else for(var S=c.length-1;S>=0;S--)(s=c[S])&&(m=(g<3?s(m):g>3?s(f,h,m):s(f,h))||m);return g>3&&m&&Object.defineProperty(f,h,m),m},v=this&&this.__param||function(c,f){return function(h,_){f(h,_,c)}},l=this&&this.__spreadArrays||function(){for(var c=0,f=0,h=arguments.length;f<h;f++)c+=arguments[f].length;var _=Array(c),s=0;for(f=0;f<h;f++)for(var g=arguments[f],m=0,S=g.length;m<S;m++,s++)_[s]=g[m];return _};Object.defineProperty(r,"__esModule",{value:!0});var u,d=p(1);(function(c){c[c.DEBUG=0]="DEBUG",c[c.INFO=1]="INFO",c[c.WARN=2]="WARN",c[c.ERROR=3]="ERROR",c[c.OFF=4]="OFF"})(u=r.LogLevel||(r.LogLevel={}));var b={debug:u.DEBUG,info:u.INFO,warn:u.WARN,error:u.ERROR,off:u.OFF},o=function(){function c(f){var h=this;this._optionsService=f,this._updateLogLevel(),this._optionsService.onOptionChange(function(_){_==="logLevel"&&h._updateLogLevel()})}return c.prototype._updateLogLevel=function(){this._logLevel=b[this._optionsService.options.logLevel]},c.prototype._evalLazyOptionalParams=function(f){for(var h=0;h<f.length;h++)typeof f[h]=="function"&&(f[h]=f[h]())},c.prototype._log=function(f,h,_){this._evalLazyOptionalParams(_),f.call.apply(f,l([console,"xterm.js: "+h],_))},c.prototype.debug=function(f){for(var h=[],_=1;_<arguments.length;_++)h[_-1]=arguments[_];this._logLevel<=u.DEBUG&&this._log(console.log,f,h)},c.prototype.info=function(f){for(var h=[],_=1;_<arguments.length;_++)h[_-1]=arguments[_];this._logLevel<=u.INFO&&this._log(console.info,f,h)},c.prototype.warn=function(f){for(var h=[],_=1;_<arguments.length;_++)h[_-1]=arguments[_];this._logLevel<=u.WARN&&this._log(console.warn,f,h)},c.prototype.error=function(f){for(var h=[],_=1;_<arguments.length;_++)h[_-1]=arguments[_];this._logLevel<=u.ERROR&&this._log(console.error,f,h)},a([v(0,d.IOptionsService)],c)}();r.LogService=o},function(n,r,p){var a=this&&this.__decorate||function(d,b,o,c){var f,h=arguments.length,_=h<3?b:c===null?c=Object.getOwnPropertyDescriptor(b,o):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(d,b,o,c);else for(var s=d.length-1;s>=0;s--)(f=d[s])&&(_=(h<3?f(_):h>3?f(b,o,_):f(b,o))||_);return h>3&&_&&Object.defineProperty(b,o,_),_},v=this&&this.__param||function(d,b){return function(o,c){b(o,c,d)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=function(){function d(b){this._bufferService=b,this.clearRange()}return Object.defineProperty(d.prototype,"start",{get:function(){return this._start},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"end",{get:function(){return this._end},enumerable:!0,configurable:!0}),d.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},d.prototype.markDirty=function(b){b<this._start?this._start=b:b>this._end&&(this._end=b)},d.prototype.markRangeDirty=function(b,o){if(b>o){var c=b;b=o,o=c}b<this._start&&(this._start=b),o>this._end&&(this._end=o)},d.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},a([v(0,l.IBufferService)],d)}();r.DirtyRowService=u},function(n,r,p){var a=this&&this.__spreadArrays||function(){for(var b=0,o=0,c=arguments.length;o<c;o++)b+=arguments[o].length;var f=Array(b),h=0;for(o=0;o<c;o++)for(var _=arguments[o],s=0,g=_.length;s<g;s++,h++)f[h]=_[s];return f};Object.defineProperty(r,"__esModule",{value:!0});var v=p(1),l=p(14),u=function(){function b(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];this._entries=new Map;for(var f=0,h=o;f<h.length;f++){var _=h[f],s=_[0],g=_[1];this.set(s,g)}}return b.prototype.set=function(o,c){var f=this._entries.get(o);return this._entries.set(o,c),f},b.prototype.forEach=function(o){this._entries.forEach(function(c,f){return o(f,c)})},b.prototype.has=function(o){return this._entries.has(o)},b.prototype.get=function(o){return this._entries.get(o)},b}();r.ServiceCollection=u;var d=function(){function b(){this._services=new u,this._services.set(v.IInstantiationService,this)}return b.prototype.setService=function(o,c){this._services.set(o,c)},b.prototype.getService=function(o){return this._services.get(o)},b.prototype.createInstance=function(o){for(var c=[],f=1;f<arguments.length;f++)c[f-1]=arguments[f];for(var h=l.getServiceDependencies(o).sort(function(C,w){return C.index-w.index}),_=[],s=0,g=h;s<g.length;s++){var m=g[s],S=this._services.get(m.id);if(!S)throw new Error("[createInstance] "+o.name+" depends on UNKNOWN service "+m.id+".");_.push(S)}var y=h.length>0?h[0].index:c.length;if(c.length!==y)throw new Error("[createInstance] First service dependency of "+o.name+" at position "+(y+1)+" conflicts with "+c.length+" static arguments");return new(o.bind.apply(o,a([void 0],a(c,_))))},b}();r.InstantiationService=d},function(n,r,p){var a=this&&this.__decorate||function(h,_,s,g){var m,S=arguments.length,y=S<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,s):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(h,_,s,g);else for(var C=h.length-1;C>=0;C--)(m=h[C])&&(y=(S<3?m(y):S>3?m(_,s,y):m(_,s))||y);return S>3&&y&&Object.defineProperty(_,s,y),y},v=this&&this.__param||function(h,_){return function(s,g){_(s,g,h)}};Object.defineProperty(r,"__esModule",{value:!0});var l=p(1),u=p(0),d={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(h){return h.button!==4&&h.action===1&&(h.ctrl=!1,h.alt=!1,h.shift=!1,!0)}},VT200:{events:19,restrict:function(h){return h.action!==32}},DRAG:{events:23,restrict:function(h){return h.action!==32||h.button!==3}},ANY:{events:31,restrict:function(h){return!0}}};function b(h,_){var s=(h.ctrl?16:0)|(h.shift?4:0)|(h.alt?8:0);return h.button===4?(s|=64,s|=h.action):(s|=3&h.button,4&h.button&&(s|=64),8&h.button&&(s|=128),h.action===32?s|=32:h.action!==0||_||(s|=3)),s}var o=String.fromCharCode,c={DEFAULT:function(h){var _=[b(h,!1)+32,h.col+32,h.row+32];return _[0]>255||_[1]>255||_[2]>255?"":"\x1B[M"+o(_[0])+o(_[1])+o(_[2])},SGR:function(h){var _=h.action===0&&h.button!==4?"m":"M";return"\x1B[<"+b(h,!0)+";"+h.col+";"+h.row+_}},f=function(){function h(_,s){var g=this;this._bufferService=_,this._coreService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new u.EventEmitter,this._lastEvent=null,Object.keys(d).forEach(function(m){return g.addProtocol(m,d[m])}),Object.keys(c).forEach(function(m){return g.addEncoding(m,c[m])}),this.reset()}return h.prototype.addProtocol=function(_,s){this._protocols[_]=s},h.prototype.addEncoding=function(_,s){this._encodings[_]=s},Object.defineProperty(h.prototype,"activeProtocol",{get:function(){return this._activeProtocol},set:function(_){if(!this._protocols[_])throw new Error('unknown protocol "'+_+'"');this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"activeEncoding",{get:function(){return this._activeEncoding},set:function(_){if(!this._encodings[_])throw new Error('unknown encoding "'+_+'"');this._activeEncoding=_},enumerable:!0,configurable:!0}),h.prototype.reset=function(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null},Object.defineProperty(h.prototype,"onProtocolChange",{get:function(){return this._onProtocolChange.event},enumerable:!0,configurable:!0}),h.prototype.triggerMouseEvent=function(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._compareEvents(this._lastEvent,_))||!this._protocols[this._activeProtocol].restrict(_))return!1;var s=this._encodings[this._activeEncoding](_);return s&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(s):this._coreService.triggerDataEvent(s,!0)),this._lastEvent=_,!0},h.prototype.explainEvents=function(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}},h.prototype._compareEvents=function(_,s){return _.col===s.col&&_.row===s.row&&_.button===s.button&&_.action===s.action&&_.ctrl===s.ctrl&&_.alt===s.alt&&_.shift===s.shift},a([v(0,l.IBufferService),v(1,l.ICoreService)],h)}();r.CoreMouseService=f},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l){this._action=l,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return v.prototype.writeSync=function(l){if(this._writeBuffer.length){for(var u=this._bufferOffset;u<this._writeBuffer.length;++u){var d=this._writeBuffer[u],b=this._callbacks[u];this._action(d),b&&b()}this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=2147483647}this._action(l)},v.prototype.write=function(l,u){var d=this;if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return d._innerWrite()})),this._pendingData+=l.length,this._writeBuffer.push(l),this._callbacks.push(u)},v.prototype._innerWrite=function(){for(var l=this,u=Date.now();this._writeBuffer.length>this._bufferOffset;){var d=this._writeBuffer[this._bufferOffset],b=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(d),this._pendingData-=d.length,b&&b(),Date.now()-u>=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 l._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},v}();r.WriteBuffer=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(0),v=function(){function l(u){this._bufferService=u,this._linkProviders=[],this._linkCacheDisposables=[],this._onLinkHover=new a.EventEmitter,this._onLinkLeave=new a.EventEmitter}return Object.defineProperty(l.prototype,"onLinkHover",{get:function(){return this._onLinkHover.event},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onLinkLeave",{get:function(){return this._onLinkLeave.event},enumerable:!0,configurable:!0}),l.prototype.registerLinkProvider=function(u){var d=this;return this._linkProviders.push(u),{dispose:function(){var b=d._linkProviders.indexOf(u);b!==-1&&d._linkProviders.splice(b,1)}}},l.prototype.attachToDom=function(u,d,b){this._element=u,this._mouseService=d,this._renderService=b,this._element.addEventListener("mousemove",this._onMouseMove.bind(this)),this._element.addEventListener("click",this._onMouseDown.bind(this))},l.prototype._onMouseMove=function(u){if(this._lastMouseEvent=u,this._element&&this._mouseService){var d=this._positionFromMouseEvent(u,this._element,this._mouseService);d&&(this._lastBufferCell&&d.x===this._lastBufferCell.x&&d.y===this._lastBufferCell.y||(this._onHover(d),this._lastBufferCell=d))}},l.prototype._onHover=function(u){this._currentLink?this._linkAtPosition(this._currentLink,u)||(this._clearCurrentLink(),this._askForLink(u)):this._askForLink(u)},l.prototype._askForLink=function(u){var d=this,b=new Map,o=!1;this._linkProviders.forEach(function(c,f){c.provideLink(u,function(h){b.set(f,h);for(var _=!1,s=0;s<f;s++)b.has(s)&&!b.get(s)||(_=!0);if(!_&&h&&(o=!0,d._handleNewLink(h)),b.size===d._linkProviders.length&&!o)for(s=0;s<b.size;s++){var g=b.get(s);if(g){d._handleNewLink(g);break}}})})},l.prototype._onMouseDown=function(u){if(this._element&&this._mouseService&&this._currentLink){var d=this._positionFromMouseEvent(u,this._element,this._mouseService);d&&this._linkAtPosition(this._currentLink,d)&&this._currentLink.activate(u,this._currentLink.text)}},l.prototype._clearCurrentLink=function(u,d){this._element&&this._currentLink&&this._lastMouseEvent&&(!u||!d||this._currentLink.range.start.y>=u&&this._currentLink.range.end.y<=d)&&(this._linkLeave(this._element,this._currentLink,this._lastMouseEvent),this._currentLink=void 0,this._linkCacheDisposables.forEach(function(b){return b.dispose()}),this._linkCacheDisposables=[])},l.prototype._handleNewLink=function(u){var d=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._linkAtPosition(u,b)&&(this._currentLink=u,this._linkHover(this._element,u,this._lastMouseEvent),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRender(function(o){d._clearCurrentLink(o.start+1+d._bufferService.buffer.ydisp,o.end+1+d._bufferService.buffer.ydisp)})))}},l.prototype._linkHover=function(u,d,b){var o=d.range,c=this._bufferService.buffer.ydisp;this._onLinkHover.fire(this._createLinkHoverEvent(o.start.x-1,o.start.y-c-1,o.end.x,o.end.y-c-1,void 0)),u.classList.add("xterm-cursor-pointer"),d.hover&&d.hover(b,d.text)},l.prototype._linkLeave=function(u,d,b){var o=d.range,c=this._bufferService.buffer.ydisp;this._onLinkLeave.fire(this._createLinkHoverEvent(o.start.x-1,o.start.y-c-1,o.end.x,o.end.y-c-1,void 0)),u.classList.remove("xterm-cursor-pointer"),d.leave&&d.leave(b,d.text)},l.prototype._linkAtPosition=function(u,d){var b=u.range.start.y===u.range.end.y,o=u.range.start.y<d.y,c=u.range.end.y>d.y;return(b&&u.range.start.x<=d.x&&u.range.end.x>=d.x||o&&u.range.end.x>=d.x||c&&u.range.start.x<=d.x||o&&c)&&u.range.start.y<=d.y&&u.range.end.y>=d.y},l.prototype._positionFromMouseEvent=function(u,d,b){var o=b.getCoords(u,d,this._bufferService.cols,this._bufferService.rows);if(o)return{x:o[0],y:o[1]+this._bufferService.buffer.ydisp}},l.prototype._createLinkHoverEvent=function(u,d,b,o,c){return{x1:u,y1:d,x2:b,y2:o,cols:this._bufferService.cols,fg:c}},l}();r.Linkifier2=v},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(l){this._textarea=l}return Object.defineProperty(v.prototype,"isFocused",{get:function(){return document.activeElement===this._textarea&&document.hasFocus()},enumerable:!0,configurable:!0}),v}();r.CoreBrowserService=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=p(0),v=p(79),l=function(){function u(){this._providers=Object.create(null),this._active="",this._onChange=new a.EventEmitter;var d=new v.UnicodeV6;this.register(d),this._active=d.version,this._activeProvider=d}return Object.defineProperty(u.prototype,"onChange",{get:function(){return this._onChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"versions",{get:function(){return Object.keys(this._providers)},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"activeVersion",{get:function(){return this._active},set:function(d){if(!this._providers[d])throw new Error('unknown Unicode version "'+d+'"');this._active=d,this._activeProvider=this._providers[d],this._onChange.fire(d)},enumerable:!0,configurable:!0}),u.prototype.register=function(d){this._providers[d.version]=d},u.prototype.wcwidth=function(d){return this._activeProvider.wcwidth(d)},u.prototype.getStringCellWidth=function(d){for(var b=0,o=d.length,c=0;c<o;++c){var f=d.charCodeAt(c);if(55296<=f&&f<=56319){if(++c>=o)return b+this.wcwidth(f);var h=d.charCodeAt(c);56320<=h&&h<=57343?f=1024*(f-55296)+h-56320+65536:b+=this.wcwidth(h)}b+=this.wcwidth(f)}return b},u}();r.UnicodeService=l},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a,v=p(15),l=[[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]],u=[[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]],d=function(){function b(){if(this.version="6",!a){a=new Uint8Array(65536),v.fill(a,1),a[0]=0,v.fill(a,0,1,32),v.fill(a,0,127,160),v.fill(a,2,4352,4448),a[9001]=2,a[9002]=2,v.fill(a,2,11904,42192),a[12351]=1,v.fill(a,2,44032,55204),v.fill(a,2,63744,64256),v.fill(a,2,65040,65050),v.fill(a,2,65072,65136),v.fill(a,2,65280,65377),v.fill(a,2,65504,65511);for(var o=0;o<l.length;++o)v.fill(a,0,l[o][0],l[o][1]+1)}}return b.prototype.wcwidth=function(o){return o<32?0:o<127?1:o<65536?a[o]:function(c,f){var h,_=0,s=f.length-1;if(c<f[0][0]||c>f[s][1])return!1;for(;s>=_;)if(c>f[h=_+s>>1][1])_=h+1;else{if(!(c<f[h][0]))return!0;s=h-1}return!1}(o,u)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1},b}();r.UnicodeV6=d},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this.charsets=[],this.glevel=0}return v.prototype.reset=function(){this.charset=void 0,this.charsets=[],this.glevel=0},v.prototype.setgLevel=function(l){this.glevel=l,this.charset=this.charsets[l]},v.prototype.setgCharset=function(l,u){this.charsets[l]=u,this.glevel===l&&(this.charset=u)},v}();r.CharsetService=a},function(n,r,p){Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function v(){this._addons=[]}return v.prototype.dispose=function(){for(var l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()},v.prototype.loadAddon=function(l,u){var d=this,b={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(b),u.dispose=function(){return d._wrappedAddonDispose(b)},u.activate(l)},v.prototype._wrappedAddonDispose=function(l){if(!l.isDisposed){for(var u=-1,d=0;d<this._addons.length;d++)if(this._addons[d]===l){u=d;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}},v}();r.AddonManager=a}])},function(t,e,i){var n=i(30),r=i(26);n({target:"Array",proto:!0,forced:[].forEach!=r},{forEach:r})},function(t,e,i){var n=i(1),r=i(10).f,p=i(6),a=i(34),v=i(9),l=i(39),u=i(49);t.exports=function(d,b){var o,c,f,h,_,s=d.target,g=d.global,m=d.stat;if(o=g?n:m?n[s]||v(s,{}):(n[s]||{}).prototype)for(c in b){if(h=b[c],f=d.noTargetGet?(_=r(o,c))&&_.value:o[c],!u(g?c:s+(m?".":"#")+c,d.forced)&&f!==void 0){if(typeof h==typeof f)continue;l(h,f)}(d.sham||f&&f.sham)&&p(h,"sham",!0),a(o,c,h,d)}}},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch{typeof window=="object"&&(i=window)}t.exports=i},function(t,e,i){var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,p=r&&!n.call({1:2},1);e.f=p?function(a){var v=r(this,a);return!!v&&v.enumerable}:n},function(t,e,i){var n=i(1),r=i(5),p=n.document,a=r(p)&&r(p.createElement);t.exports=function(v){return a?p.createElement(v):{}}},function(t,e,i){var n=i(1),r=i(6),p=i(3),a=i(9),v=i(19),l=i(35),u=l.get,d=l.enforce,b=String(String).split("String");(t.exports=function(o,c,f,h){var _=!!h&&!!h.unsafe,s=!!h&&!!h.enumerable,g=!!h&&!!h.noTargetGet;typeof f=="function"&&(typeof c!="string"||p(f,"name")||r(f,"name",c),d(f).source=b.join(typeof c=="string"?c:"")),o!==n?(_?!g&&o[c]&&(s=!0):delete o[c],s?o[c]=f:r(o,c,f)):s?o[c]=f:a(c,f)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||v(this)})},function(t,e,i){var n,r,p,a=i(36),v=i(1),l=i(5),u=i(6),d=i(3),b=i(37),o=i(23),c=v.WeakMap;if(a){var f=new c,h=f.get,_=f.has,s=f.set;n=function(m,S){return s.call(f,m,S),S},r=function(m){return h.call(f,m)||{}},p=function(m){return _.call(f,m)}}else{var g=b("state");o[g]=!0,n=function(m,S){return u(m,g,S),S},r=function(m){return d(m,g)?m[g]:{}},p=function(m){return d(m,g)}}t.exports={set:n,get:r,has:p,enforce:function(m){return p(m)?r(m):n(m,{})},getterFor:function(m){return function(S){var y;if(!l(S)||(y=r(S)).type!==m)throw TypeError("Incompatible receiver, "+m+" required");return y}}}},function(t,e,i){var n=i(1),r=i(19),p=n.WeakMap;t.exports=typeof p=="function"&&/native code/.test(r(p))},function(t,e,i){var n=i(21),r=i(22),p=n("keys");t.exports=function(a){return p[a]||(p[a]=r(a))}},function(t,e){t.exports=!1},function(t,e,i){var n=i(3),r=i(40),p=i(10),a=i(17);t.exports=function(v,l){for(var u=r(l),d=a.f,b=p.f,o=0;o<u.length;o++){var c=u[o];n(v,c)||d(v,c,b(l,c))}}},function(t,e,i){var n=i(41),r=i(43),p=i(48),a=i(18);t.exports=n("Reflect","ownKeys")||function(v){var l=r.f(a(v)),u=p.f;return u?l.concat(u(v)):l}},function(t,e,i){var n=i(42),r=i(1),p=function(a){return typeof a=="function"?a:void 0};t.exports=function(a,v){return arguments.length<2?p(n[a])||p(r[a]):n[a]&&n[a][v]||r[a]&&r[a][v]}},function(t,e,i){var n=i(1);t.exports=n},function(t,e,i){var n=i(44),r=i(47).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(p){return n(p,r)}},function(t,e,i){var n=i(3),r=i(8),p=i(45).indexOf,a=i(23);t.exports=function(v,l){var u,d=r(v),b=0,o=[];for(u in d)!n(a,u)&&n(d,u)&&o.push(u);for(;l.length>b;)n(d,u=l[b++])&&(~p(o,u)||o.push(u));return o}},function(t,e,i){var n=i(8),r=i(24),p=i(46),a=function(v){return function(l,u,d){var b,o=n(l),c=r(o.length),f=p(d,c);if(v&&u!=u){for(;c>f;)if((b=o[f++])!=b)return!0}else for(;c>f;f++)if((v||f in o)&&o[f]===u)return v||f||0;return!v&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},function(t,e,i){var n=i(25),r=Math.max,p=Math.min;t.exports=function(a,v){var l=n(a);return l<0?r(l+v,0):p(l,v)}},function(t,e){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){var n=i(2),r=/#|\.prototype\./,p=function(d,b){var o=v[a(d)];return o==u||o!=l&&(typeof b=="function"?n(b):!!b)},a=p.normalize=function(d){return String(d).replace(r,".").toLowerCase()},v=p.data={},l=p.NATIVE="N",u=p.POLYFILL="P";t.exports=p},function(t,e,i){var n=i(51),r=i(12),p=i(53),a=i(24),v=i(54),l=[].push,u=function(d){var b=d==1,o=d==2,c=d==3,f=d==4,h=d==6,_=d==5||h;return function(s,g,m,S){for(var y,C,w=p(s),I=r(w),R=n(g,m,3),k=a(I.length),P=0,x=S||v,A=b?x(s,k):o?x(s,0):void 0;k>P;P++)if((_||P in I)&&(C=R(y=I[P],P,w),d)){if(b)A[P]=C;else if(C)switch(d){case 3:return!0;case 5:return y;case 6:return P;case 2:l.call(A,y)}else if(f)return!1}return h?-1:c||f?f:A}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6)}},function(t,e,i){var n=i(52);t.exports=function(r,p,a){if(n(r),p===void 0)return r;switch(a){case 0:return function(){return r.call(p)};case 1:return function(v){return r.call(p,v)};case 2:return function(v,l){return r.call(p,v,l)};case 3:return function(v,l,u){return r.call(p,v,l,u)}}return function(){return r.apply(p,arguments)}}},function(t,e){t.exports=function(i){if(typeof i!="function")throw TypeError(String(i)+" is not a function");return i}},function(t,e,i){var n=i(14);t.exports=function(r){return Object(n(r))}},function(t,e,i){var n=i(5),r=i(55),p=i(56)("species");t.exports=function(a,v){var l;return r(a)&&(typeof(l=a.constructor)!="function"||l!==Array&&!r(l.prototype)?n(l)&&(l=l[p])===null&&(l=void 0):l=void 0),new(l===void 0?Array:l)(v===0?0:v)}},function(t,e,i){var n=i(13);t.exports=Array.isArray||function(r){return n(r)=="Array"}},function(t,e,i){var n=i(1),r=i(21),p=i(3),a=i(22),v=i(27),l=i(57),u=r("wks"),d=n.Symbol,b=l?d:d&&d.withoutSetter||a;t.exports=function(o){return p(u,o)||(v&&p(d,o)?u[o]=d[o]:u[o]=b("Symbol."+o)),u[o]}},function(t,e,i){var n=i(27);t.exports=n&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},function(t,e,i){var n=i(2);t.exports=function(r,p){var a=[][r];return!!a&&n(function(){a.call(null,p||function(){throw 1},1)})}},function(t,e,i){var n=i(4),r=i(2),p=i(3),a=Object.defineProperty,v={},l=function(u){throw u};t.exports=function(u,d){if(p(v,u))return v[u];d||(d={});var b=[][u],o=!!p(d,"ACCESSORS")&&d.ACCESSORS,c=p(d,0)?d[0]:l,f=p(d,1)?d[1]:void 0;return v[u]=!!b&&!r(function(){if(o&&!n)return!0;var h={length:-1};o?a(h,1,{enumerable:!0,get:l}):h[1]=1,b.call(h,c,f)})}},function(t,e,i){var n=i(1),r=i(61),p=i(26),a=i(6);for(var v in r){var l=n[v],u=l&&l.prototype;if(u&&u.forEach!==p)try{a(u,"forEach",p)}catch{u.forEach=p}}},function(t,e){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,e,i){/** @license React v16.13.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var n=i(63),r=typeof Symbol=="function"&&Symbol.for,p=r?Symbol.for("react.element"):60103,a=r?Symbol.for("react.portal"):60106,v=r?Symbol.for("react.fragment"):60107,l=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,d=r?Symbol.for("react.provider"):60109,b=r?Symbol.for("react.context"):60110,o=r?Symbol.for("react.forward_ref"):60112,c=r?Symbol.for("react.suspense"):60113,f=r?Symbol.for("react.memo"):60115,h=r?Symbol.for("react.lazy"):60116,_=typeof Symbol=="function"&&Symbol.iterator;function s(B){for(var W="https://reactjs.org/docs/error-decoder.html?invariant="+B,U=1;U<arguments.length;U++)W+="&args[]="+encodeURIComponent(arguments[U]);return"Minified React error #"+B+"; visit "+W+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m={};function S(B,W,U){this.props=B,this.context=W,this.refs=m,this.updater=U||g}function y(){}function C(B,W,U){this.props=B,this.context=W,this.refs=m,this.updater=U||g}S.prototype.isReactComponent={},S.prototype.setState=function(B,W){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error(s(85));this.updater.enqueueSetState(this,B,W,"setState")},S.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")},y.prototype=S.prototype;var w=C.prototype=new y;w.constructor=C,n(w,S.prototype),w.isPureReactComponent=!0;var I={current:null},R=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function P(B,W,U){var Q,$={},te=null,de=null;if(W!=null)for(Q in W.ref!==void 0&&(de=W.ref),W.key!==void 0&&(te=""+W.key),W)R.call(W,Q)&&!k.hasOwnProperty(Q)&&($[Q]=W[Q]);var ce=arguments.length-2;if(ce===1)$.children=U;else if(1<ce){for(var G=Array(ce),T=0;T<ce;T++)G[T]=arguments[T+2];$.children=G}if(B&&B.defaultProps)for(Q in ce=B.defaultProps)$[Q]===void 0&&($[Q]=ce[Q]);return{$$typeof:p,type:B,key:te,ref:de,props:$,_owner:I.current}}function x(B){return typeof B=="object"&&B!==null&&B.$$typeof===p}var A=/\/+/g,M=[];function N(B,W,U,Q){if(M.length){var $=M.pop();return $.result=B,$.keyPrefix=W,$.func=U,$.context=Q,$.count=0,$}return{result:B,keyPrefix:W,func:U,context:Q,count:0}}function z(B){B.result=null,B.keyPrefix=null,B.func=null,B.context=null,B.count=0,10>M.length&&M.push(B)}function j(B,W,U){return B==null?0:function Q($,te,de,ce){var G=typeof $;G!=="undefined"&&G!=="boolean"||($=null);var T=!1;if($===null)T=!0;else switch(G){case"string":case"number":T=!0;break;case"object":switch($.$$typeof){case p:case a:T=!0}}if(T)return de(ce,$,te===""?"."+ee($,0):te),1;if(T=0,te=te===""?".":te+":",Array.isArray($))for(var O=0;O<$.length;O++){var Y=te+ee(G=$[O],O);T+=Q(G,Y,de,ce)}else if($===null||typeof $!="object"?Y=null:Y=typeof(Y=_&&$[_]||$["@@iterator"])=="function"?Y:null,typeof Y=="function")for($=Y.call($),O=0;!(G=$.next()).done;)T+=Q(G=G.value,Y=te+ee(G,O++),de,ce);else if(G==="object")throw de=""+$,Error(s(31,de==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":de,""));return T}(B,"",W,U)}function ee(B,W){return typeof B=="object"&&B!==null&&B.key!=null?function(U){var Q={"=":"=0",":":"=2"};return"$"+(""+U).replace(/[=:]/g,function($){return Q[$]})}(B.key):W.toString(36)}function re(B,W){B.func.call(B.context,W,B.count++)}function ue(B,W,U){var Q=B.result,$=B.keyPrefix;B=B.func.call(B.context,W,B.count++),Array.isArray(B)?_e(B,Q,U,function(te){return te}):B!=null&&(x(B)&&(B=function(te,de){return{$$typeof:p,type:te.type,key:de,ref:te.ref,props:te.props,_owner:te._owner}}(B,$+(!B.key||W&&W.key===B.key?"":(""+B.key).replace(A,"$&/")+"/")+U)),Q.push(B))}function _e(B,W,U,Q,$){var te="";U!=null&&(te=(""+U).replace(A,"$&/")+"/"),j(B,ue,W=N(W,te,Q,$)),z(W)}var Ce={current:null};function L(){var B=Ce.current;if(B===null)throw Error(s(321));return B}var ae={ReactCurrentDispatcher:Ce,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:I,IsSomeRendererActing:{current:!1},assign:n};e.Children={map:function(B,W,U){if(B==null)return B;var Q=[];return _e(B,Q,null,W,U),Q},forEach:function(B,W,U){if(B==null)return B;j(B,re,W=N(null,null,W,U)),z(W)},count:function(B){return j(B,function(){return null},null)},toArray:function(B){var W=[];return _e(B,W,null,function(U){return U}),W},only:function(B){if(!x(B))throw Error(s(143));return B}},e.Component=S,e.Fragment=v,e.Profiler=u,e.PureComponent=C,e.StrictMode=l,e.Suspense=c,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ae,e.cloneElement=function(B,W,U){if(B==null)throw Error(s(267,B));var Q=n({},B.props),$=B.key,te=B.ref,de=B._owner;if(W!=null){if(W.ref!==void 0&&(te=W.ref,de=I.current),W.key!==void 0&&($=""+W.key),B.type&&B.type.defaultProps)var ce=B.type.defaultProps;for(G in W)R.call(W,G)&&!k.hasOwnProperty(G)&&(Q[G]=W[G]===void 0&&ce!==void 0?ce[G]:W[G])}var G=arguments.length-2;if(G===1)Q.children=U;else if(1<G){ce=Array(G);for(var T=0;T<G;T++)ce[T]=arguments[T+2];Q.children=ce}return{$$typeof:p,type:B.type,key:$,ref:te,props:Q,_owner:de}},e.createContext=function(B,W){return W===void 0&&(W=null),(B={$$typeof:b,_calculateChangedBits:W,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:d,_context:B},B.Consumer=B},e.createElement=P,e.createFactory=function(B){var W=P.bind(null,B);return W.type=B,W},e.createRef=function(){return{current:null}},e.forwardRef=function(B){return{$$typeof:o,render:B}},e.isValidElement=x,e.lazy=function(B){return{$$typeof:h,_ctor:B,_status:-1,_result:null}},e.memo=function(B,W){return{$$typeof:f,type:B,compare:W===void 0?null:W}},e.useCallback=function(B,W){return L().useCallback(B,W)},e.useContext=function(B,W){return L().useContext(B,W)},e.useDebugValue=function(){},e.useEffect=function(B,W){return L().useEffect(B,W)},e.useImperativeHandle=function(B,W,U){return L().useImperativeHandle(B,W,U)},e.useLayoutEffect=function(B,W){return L().useLayoutEffect(B,W)},e.useMemo=function(B,W){return L().useMemo(B,W)},e.useReducer=function(B,W,U){return L().useReducer(B,W,U)},e.useRef=function(B){return L().useRef(B)},e.useState=function(B){return L().useState(B)},e.version="16.13.1"},function(t,e,i){/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var n=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;function a(v){if(v==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(v)}t.exports=function(){try{if(!Object.assign)return!1;var v=new String("abc");if(v[5]="de",Object.getOwnPropertyNames(v)[0]==="5")return!1;for(var l={},u=0;u<10;u++)l["_"+String.fromCharCode(u)]=u;if(Object.getOwnPropertyNames(l).map(function(b){return l[b]}).join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(b){d[b]=b}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}()?Object.assign:function(v,l){for(var u,d,b=a(v),o=1;o<arguments.length;o++){for(var c in u=Object(arguments[o]))r.call(u,c)&&(b[c]=u[c]);if(n){d=n(u);for(var f=0;f<d.length;f++)p.call(u,d[f])&&(b[d[f]]=u[d[f]])}}return b}},function(t,e,i){var n=i(65);function r(){}function p(){}p.resetWarningCache=r,t.exports=function(){function a(u,d,b,o,c,f){if(f!==n){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}function v(){return a}a.isRequired=a;var l={array:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:v,element:a,elementType:a,instanceOf:v,node:a,objectOf:v,oneOf:v,oneOfType:v,shape:v,exact:v,checkPropTypes:p,resetWarningCache:r};return l.PropTypes=l,l}},function(t,e,i){t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,i){var n=i(67),r=i(68);typeof(r=r.__esModule?r.default:r)=="string"&&(r=[[t.i,r,""]]);var p={insert:"head",singleton:!1};n(r,p),t.exports=r.locals||{}},function(t,e,i){var n,r=function(){return n===void 0&&(n=!!(window&&document&&document.all&&!window.atob)),n},p=function(){var s={};return function(g){if(s[g]===void 0){var m=document.querySelector(g);if(window.HTMLIFrameElement&&m instanceof window.HTMLIFrameElement)try{m=m.contentDocument.head}catch{m=null}s[g]=m}return s[g]}}(),a=[];function v(s){for(var g=-1,m=0;m<a.length;m++)if(a[m].identifier===s){g=m;break}return g}function l(s,g){for(var m={},S=[],y=0;y<s.length;y++){var C=s[y],w=g.base?C[0]+g.base:C[0],I=m[w]||0,R="".concat(w," ").concat(I);m[w]=I+1;var k=v(R),P={css:C[1],media:C[2],sourceMap:C[3]};k!==-1?(a[k].references++,a[k].updater(P)):a.push({identifier:R,updater:_(P,g),references:1}),S.push(R)}return S}function u(s){var g=document.createElement("style"),m=s.attributes||{};if(m.nonce===void 0){var S=i.nc;S&&(m.nonce=S)}if(Object.keys(m).forEach(function(C){g.setAttribute(C,m[C])}),typeof s.insert=="function")s.insert(g);else{var y=p(s.insert||"head");if(!y)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");y.appendChild(g)}return g}var d,b=(d=[],function(s,g){return d[s]=g,d.filter(Boolean).join(`
`)});function o(s,g,m,S){var y=m?"":S.media?"@media ".concat(S.media," {").concat(S.css,"}"):S.css;if(s.styleSheet)s.styleSheet.cssText=b(g,y);else{var C=document.createTextNode(y),w=s.childNodes;w[g]&&s.removeChild(w[g]),w.length?s.insertBefore(C,w[g]):s.appendChild(C)}}function c(s,g,m){var S=m.css,y=m.media,C=m.sourceMap;if(y?s.setAttribute("media",y):s.removeAttribute("media"),C&&btoa&&(S+=`
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(C))))," */")),s.styleSheet)s.styleSheet.cssText=S;else{for(;s.firstChild;)s.removeChild(s.firstChild);s.appendChild(document.createTextNode(S))}}var f=null,h=0;function _(s,g){var m,S,y;if(g.singleton){var C=h++;m=f||(f=u(g)),S=o.bind(null,m,C,!1),y=o.bind(null,m,C,!0)}else m=u(g),S=c.bind(null,m,g),y=function(){(function(w){if(w.parentNode===null)return!1;w.parentNode.removeChild(w)})(m)};return S(s),function(w){if(w){if(w.css===s.css&&w.media===s.media&&w.sourceMap===s.sourceMap)return;S(s=w)}else y()}}t.exports=function(s,g){(g=g||{}).singleton||typeof g.singleton=="boolean"||(g.singleton=r());var m=l(s=s||[],g);return function(S){if(S=S||[],Object.prototype.toString.call(S)==="[object Array]"){for(var y=0;y<m.length;y++){var C=v(m[y]);a[C].references--}for(var w=l(S,g),I=0;I<m.length;I++){var R=v(m[I]);a[R].references===0&&(a[R].updater(),a.splice(R,1))}m=w}}}},function(t,e,i){(e=i(69)(!1)).push([t.i,`/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */

/**
 *  Default styles for xterm.js
 */

.xterm {
    font-feature-settings: "liga" 0;
    position: relative;
    user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
}

.xterm.focus,
.xterm:focus {
    outline: none;
}

.xterm .xterm-helpers {
    position: absolute;
    top: 0;
    /**
     * The z-index of the helpers must be higher than the canvases in order for
     * IMEs to appear on top.
     */
    z-index: 5;
}

.xterm .xterm-helper-textarea {
    /*
     * HACK: to fix IE's blinking cursor
     * Move textarea out of the screen to the far left, so that the cursor is not visible.
     */
    position: absolute;
    opacity: 0;
    left: -9999em;
    top: 0;
    width: 0;
    height: 0;
    z-index: -5;
    /** Prevent wrapping so the IME appears against the textarea at the correct position */
    white-space: nowrap;
    overflow: hidden;
    resize: none;
}

.xterm .composition-view {
    /* TODO: Composition position got messed up somewhere */
    background: #000;
    color: #FFF;
    display: none;
    position: absolute;
    white-space: nowrap;
    z-index: 1;
}

.xterm .composition-view.active {
    display: block;
}

.xterm .xterm-viewport {
    /* On OS X this is required in order for the scroll bar to appear fully opaque */
    background-color: #000;
    overflow-y: scroll;
    cursor: default;
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
}

.xterm .xterm-screen {
    position: relative;
}

.xterm .xterm-screen canvas {
    position: absolute;
    left: 0;
    top: 0;
}

.xterm .xterm-scroll-area {
    visibility: hidden;
}

.xterm-char-measure-element {
    display: inline-block;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: -9999em;
    line-height: normal;
}

.xterm {
    cursor: text;
}

.xterm.enable-mouse-events {
    /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
    cursor: default;
}

.xterm.xterm-cursor-pointer {
    cursor: pointer;
}

.xterm.column-select.focus {
    /* Column selection mode */
    cursor: crosshair;
}

.xterm .xterm-accessibility,
.xterm .xterm-message {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 10;
    color: transparent;
}

.xterm .live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.xterm-dim {
    opacity: 0.5;
}

.xterm-underline {
    text-decoration: underline;
}
`,""]),t.exports=e},function(t,e,i){t.exports=function(n){var r=[];return r.toString=function(){return this.map(function(p){var a=function(v,l){var u=v[1]||"",d=v[3];if(!d)return u;if(l&&typeof btoa=="function"){var b=(c=d,f=btoa(unescape(encodeURIComponent(JSON.stringify(c)))),h="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(f),"/*# ".concat(h," */")),o=d.sources.map(function(_){return"/*# sourceURL=".concat(d.sourceRoot||"").concat(_," */")});return[u].concat(o).concat([b]).join(`
`)}var c,f,h;return[u].join(`
`)}(p,n);return p[2]?"@media ".concat(p[2]," {").concat(a,"}"):a}).join("")},r.i=function(p,a,v){typeof p=="string"&&(p=[[null,p,""]]);var l={};if(v)for(var u=0;u<this.length;u++){var d=this[u][0];d!=null&&(l[d]=!0)}for(var b=0;b<p.length;b++){var o=[].concat(p[b]);v&&l[o[0]]||(a&&(o[2]?o[2]="".concat(a," and ").concat(o[2]):o[2]=a),r.push(o))}},r}},function(t,e,i){i.r(e),i.d(e,"XTerm",function(){return u}),i(29),i(60);var n,r=i(7),p=i(0),a=i.n(p),v=(i(66),i(28)),l=(n=function(d,b){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,c){o.__proto__=c}||function(o,c){for(var f in c)c.hasOwnProperty(f)&&(o[f]=c[f])})(d,b)},function(d,b){function o(){this.constructor=d}n(d,b),d.prototype=b===null?Object.create(b):(o.prototype=b.prototype,new o)}),u=function(d){function b(o){var c=d.call(this,o)||this;return c.terminalRef=r.createRef(),c.onData=c.onData.bind(c),c.onCursorMove=c.onCursorMove.bind(c),c.onKey=c.onKey.bind(c),c.onBinary=c.onBinary.bind(c),c.onLineFeed=c.onLineFeed.bind(c),c.onScroll=c.onScroll.bind(c),c.onSelectionChange=c.onSelectionChange.bind(c),c.onRender=c.onRender.bind(c),c.onResize=c.onResize.bind(c),c.onTitleChange=c.onTitleChange.bind(c),c.setupTerminal(),c}return l(b,d),b.prototype.setupTerminal=function(){var o=this;this.terminal=new v.Terminal(this.props.options),this.props.addons&&this.props.addons.forEach(function(c){o.terminal.loadAddon(c)}),this.terminal.onBinary(this.onBinary),this.terminal.onCursorMove(this.onCursorMove),this.terminal.onData(this.onData),this.terminal.onKey(this.onKey),this.terminal.onLineFeed(this.onLineFeed),this.terminal.onScroll(this.onScroll),this.terminal.onSelectionChange(this.onSelectionChange),this.terminal.onRender(this.onRender),this.terminal.onResize(this.onResize),this.terminal.onTitleChange(this.onTitleChange),this.props.customKeyEventHandler&&this.terminal.attachCustomKeyEventHandler(this.props.customKeyEventHandler)},b.prototype.componentDidMount=function(){this.terminalRef.current&&this.terminal.open(this.terminalRef.current)},b.prototype.componentWillUnmount=function(){this.terminal.dispose()},b.prototype.onBinary=function(o){this.props.onBinary&&this.props.onBinary(o)},b.prototype.onCursorMove=function(){this.props.onCursorMove&&this.props.onCursorMove()},b.prototype.onData=function(o){this.props.onData&&this.props.onData(o)},b.prototype.onKey=function(o){this.props.onKey&&this.props.onKey(o)},b.prototype.onLineFeed=function(){this.props.onLineFeed&&this.props.onLineFeed()},b.prototype.onScroll=function(o){this.props.onScroll&&this.props.onScroll(o)},b.prototype.onSelectionChange=function(){this.props.onSelectionChange&&this.props.onSelectionChange()},b.prototype.onRender=function(o){this.props.onRender&&this.props.onRender(o)},b.prototype.onResize=function(o){this.props.onResize&&this.props.onResize(o)},b.prototype.onTitleChange=function(o){this.props.onTitleChange&&this.props.onTitleChange(o)},b.prototype.render=function(){return r.createElement("div",{className:this.props.className,ref:this.terminalRef})},b.propTypes={className:a.a.string,options:a.a.object,addons:a.a.array,onBinary:a.a.func,onCursorMove:a.a.func,onData:a.a.func,onKey:a.a.func,onLineFeed:a.a.func,onScroll:a.a.func,onSelectionChange:a.a.func,onRender:a.a.func,onResize:a.a.func,onTitleChange:a.a.func,customKeyEventHandler:a.a.func},b}(r.Component)}]);const on=ua.XTerm;var an={exports:{}};(function(t,e){(function(i,n){t.exports=n()})(self,function(){return(()=>{var i={};return(()=>{var n=i;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{constructor(){}activate(r){this._terminal=r}dispose(){}fit(){const r=this.proposeDimensions();if(!r||!this._terminal||isNaN(r.cols)||isNaN(r.rows))return;const p=this._terminal._core;this._terminal.rows===r.rows&&this._terminal.cols===r.cols||(p._renderService.clear(),this._terminal.resize(r.cols,r.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const r=this._terminal._core;if(r._renderService.dimensions.actualCellWidth===0||r._renderService.dimensions.actualCellHeight===0)return;const p=this._terminal.options.scrollback===0?0:r.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),v=parseInt(a.getPropertyValue("height")),l=Math.max(0,parseInt(a.getPropertyValue("width"))),u=window.getComputedStyle(this._terminal.element),d=v-(parseInt(u.getPropertyValue("padding-top"))+parseInt(u.getPropertyValue("padding-bottom"))),b=l-(parseInt(u.getPropertyValue("padding-right"))+parseInt(u.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(b/r._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(d/r._renderService.dimensions.actualCellHeight))}}}})(),i})()})})(an);var cn=an.exports;const fa=({payload:t,close:e,reconnect:i})=>{const n=Z.useRef(null),r=Nt().shape({command:Ze().required("This field is required"),environment:Io().of(Nt().shape({key:Ze(),value:Ze()})),user:fr(),group:fr()}),p=ht({initialValues:t,validationSchema:r,onSubmit:i}),a=()=>{const d=[...p.values.environment];d.push({key:"",value:""}),p.setFieldValue("environment",d)},v=d=>{const b=[...p.values.environment];b.splice(d,1),p.setFieldValue("environment",b)},l=d=>{d.key==="Escape"&&e()},u=()=>{lt("content-wrapper","p-modal__footer",64,"max-height")};return He("resize",u),Z.useEffect(u,[]),Z.useEffect(()=>{var d;(d=n.current)==null||d.scrollIntoView({behavior:"smooth",block:"end",inline:"start"}),window.dispatchEvent(new Event("resize"))},[p.values.environment]),E.jsx(K.Modal,{close:e,title:"Reconnect terminal",buttonRow:E.jsxs(E.Fragment,{children:[E.jsx(K.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button","aria-label":"cancel reconnect",onClick:e,children:"Cancel"}),E.jsx(K.Button,{className:"u-no-margin--bottom",appearance:"positive","aria-label":"submit reconnect",onClick:p.submitForm,children:"Reconnect"})]}),onKeyDown:l,children:E.jsxs(K.Form,{onSubmit:p.handleSubmit,children:[E.jsx(K.Input,{type:"submit",hidden:!0}),E.jsxs("div",{className:"content-wrapper",children:[E.jsx(K.Input,{id:"command",name:"command",label:"Command",labelClassName:"u-no-margin--bottom",type:"text",required:!0,onBlur:p.handleBlur,onChange:p.handleChange,error:p.touched.command?p.errors.command:null,value:p.values.command}),E.jsx(K.Input,{id:"user",name:"user",label:"User ID",labelClassName:"u-no-margin--bottom",type:"number",onBlur:p.handleBlur,onChange:p.handleChange,value:p.values.user}),E.jsx(K.Input,{id:"group",name:"group",label:"Group ID",labelClassName:"u-no-margin--bottom",type:"number",onBlur:p.handleBlur,onChange:p.handleChange,value:p.values.group}),E.jsx("p",{className:"u-no-margin--bottom p-form__label",children:"Environment variables"}),p.values.environment.map((d,b)=>E.jsxs("div",{className:"env-variables",children:[E.jsx(K.Input,{type:"text",placeholder:"Key",labelClassName:"u-off-screen",label:`Key of variable ${b}`,id:`environment.${b}.key`,name:`environment.${b}.key`,onBlur:p.handleBlur,onChange:p.handleChange,value:p.values.environment[b].key}),E.jsx(K.Input,{type:"text",placeholder:"Value",labelClassName:"u-off-screen",label:`Value of variable ${b}`,id:`environment.${b}.value`,name:`environment.${b}.value`,onBlur:p.handleBlur,onChange:p.handleChange,value:p.values.environment[b].value}),E.jsx(K.Button,{"aria-label":`remove variable ${b}`,onClick:()=>v(b),type:"button",hasIcon:!0,children:E.jsx(K.Icon,{name:"delete"})})]},b)),E.jsx("div",{ref:n,children:E.jsx(K.Button,{"aria-label":"add variable",onClick:a,type:"button",children:E.jsx("span",{children:"Add variable"})})})]})]})})},_a=({payload:t,reconnect:e})=>{const[i,n]=Z.useState(!1),r=()=>{n(!1)},p=()=>{n(!0)},a=v=>{r(),e(v)};return E.jsxs(E.Fragment,{children:[i&&E.jsx(fa,{close:r,reconnect:a,payload:t}),E.jsxs(K.Button,{className:"u-no-margin--bottom",hasIcon:!0,onClick:p,children:[E.jsx(K.Icon,{name:"connected"}),E.jsx("span",{children:"Reconnect"})]})]})},da={theme:{background:"#292c2f"}},pa={command:"bash",environment:[{key:"TERM",value:"xterm-256color"},{key:"HOME",value:"/root"}],user:0,group:0},ma=({instance:t})=>{const{name:e,project:i}=ct(),n=Z.useRef(null),r=new TextEncoder,[p,a]=Z.useState(null),[v,l]=Z.useState(!1),[u,d]=Z.useState(null),[b,o]=Z.useState(null),[c,f]=Z.useState(pa),[h]=Z.useState(new cn.FitAddon),[_,s]=Z.useState(!1);Vr({when:_,message:"Are you sure you want to leave this page?"}),He("beforeunload",I=>{_&&(I.returnValue="Are you sure you want to leave this page?")});const m=t.status==="Running",S=async I=>{if(!e){a(K.failure("Missing name",new Error));return}if(!i){a(K.failure("Missing project",new Error));return}l(!0);const R=await to(e,i,I).catch(N=>{l(!1),a(K.failure("Connection failed",N))});if(!R)return;const k=R.operation.split("?")[0],P=`wss://${location.host}${k}/websocket?secret=${R.metadata.metadata.fds[0]}`,x=`wss://${location.host}${k}/websocket?secret=${R.metadata.metadata.fds.control}`,A=new WebSocket(P),M=new WebSocket(x);return M.onopen=()=>{l(!1),o(M)},M.onerror=N=>{a(K.failure("Error",N))},M.onclose=N=>{N.code!==1005&&a(K.failure("Error",N.reason,bt(N.code))),o(null)},M.onmessage=N=>{console.log("control message",N)},A.onopen=()=>{d(A)},A.onerror=N=>{a(K.failure("Error",N))},A.onclose=N=>{N.code!==1005&&a(K.failure("Error",N.reason,bt(N.code))),d(null)},A.binaryType="arraybuffer",A.onmessage=N=>{var z;(z=n.current)==null||z.terminal.writeUtf8(new Uint8Array(N.data))},[A,M]};Z.useEffect(()=>{var I;(I=n.current)==null||I.terminal.focus()},[n.current,b]),Z.useEffect(()=>{var R;(R=n.current)==null||R.terminal.clear(),a(null);const I=S(c);return()=>{I.then(k=>{k==null||k.map(P=>P.close())})}},[c,t.status]);const y=()=>{var R,k;if((b==null?void 0:b.readyState)===WebSocket.CLOSED)return;lt("p-terminal",void 0,10),(k=(R=n.current)==null?void 0:R.terminal.element)==null||k.style.setProperty("padding","1rem"),n.current&&n.current.terminal.options===void 0&&(n.current.terminal.options={}),h.fit();const I=h.proposeDimensions();b==null||b.send(r.encode(JSON.stringify({command:"window-resize",args:{height:I==null?void 0:I.rows.toString(),width:I==null?void 0:I.cols.toString()}})))};He("resize",()=>{y(),setTimeout(y,500)}),Z.useLayoutEffect(()=>{y()},[b,h,n]);const{handleStart:C,isLoading:w}=Xr(t);return E.jsxs("div",{className:"instance-terminal-tab",children:[m&&E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"p-panel__controls",children:E.jsx(_a,{reconnect:f,payload:c})}),E.jsx(Zt,{notification:p,onDismiss:()=>a(null)}),v&&E.jsx(Ge,{text:"Loading terminal session..."}),b&&E.jsx(on,{ref:n,addons:[h],className:"p-terminal",onData:I=>{s(!0),u==null||u.send(r.encode(I))},options:da})]}),!m&&E.jsxs(K.EmptyState,{className:"empty-state",image:E.jsx(K.Icon,{name:"containers",className:"empty-state-icon"}),title:"Instance stopped",children:[E.jsx("p",{children:"Start the instance to access the terminal."}),E.jsx(Et,{isSubmitting:w,isDisabled:!1,buttonLabel:"Start instance",onClick:C})]})]})},va=(t,e,i,n)=>new Promise((r,p)=>{fetch(`/1.0/instances/${t.name}/snapshots?project=${t.project}`,{method:"POST",body:JSON.stringify({name:e,expires_at:i,stateful:n})}).then(Ct).then(r).catch(p)}),ln=(t,e)=>new Promise((i,n)=>{fetch(`/1.0/instances/${t.name}/snapshots/${e.name}?project=${t.project}`,{method:"DELETE"}).then(Ct).then(i).catch(n)}),ga=(t,e,i)=>{const n=[];return new Promise(r=>{Promise.allSettled(e.map(async p=>await ln(t,{name:p}).then(a=>{i.set(a.metadata.id,()=>io(n),v=>ro(n,v),()=>no(n,e.length,r))})))})},ba=(t,e,i)=>new Promise((n,r)=>{fetch(`/1.0/instances/${t.name}?project=${t.project}`,{method:"PUT",body:JSON.stringify({restore:e.name,stateful:e.stateful?i:!1})}).then(Ct).then(n).catch(r)}),Sa=(t,e,i)=>new Promise((n,r)=>{fetch(`/1.0/instances/${t.name}/snapshots/${e.name}?project=${t.project}`,{method:"POST",body:JSON.stringify({name:i})}).then(Ct).then(n).catch(r)}),ya=(t,e,i)=>new Promise((n,r)=>{fetch(`/1.0/instances/${t.name}/snapshots/${e.name}?project=${t.project}`,{method:"PUT",body:JSON.stringify({expires_at:i})}).then(Ct).then(n).catch(r)}),hn=t=>!!t.config["migration.stateful"],un=(t,e)=>`${t}T${e}`,Ca=(t,e,i)=>["deduplicate","Snapshot name already in use",n=>i&&n===i||$r(n,t.project,e,`instances/${t.name}/snapshots`)],Ea=()=>["valid","Invalid date format",(t,e)=>t?new Date(t).toString()!=="Invalid Date":!e.parent.expirationTime],wa=()=>["future","The date must be in the future",t=>{if(!t)return!0;const e=new Date(t).getTime(),i=new Date(Zr()).getTime();return e>=i}],xa=()=>["valid","Invalid time format",(t,e)=>{if(!t)return!e.parent.expirationDate;const[i,n]=t.split(":"),r=new Date;return r.setHours(+i),r.setMinutes(+n),r.toString()!=="Invalid Date"}],fn=(t,e,i)=>Nt().shape({name:Ze().test(...Ca(t,e,i)).matches(/^[A-Za-z0-9-_.:]+$/,{message:"Please enter only alphanumeric characters, underscores (_), periods (.), hyphens (-), and colons (:) in this field"}),expirationDate:Ze().nullable().optional().test(...Ea()).test(...wa()),expirationTime:Ze().nullable().optional().test(...xa()),stateful:Po()}),Aa=150,_n=({isEdit:t,formik:e,close:i,isStateful:n,isRunning:r})=>{const p=u=>{u.key==="Escape"&&i()},v=(()=>t||n&&r?"":n?`To create a stateful snapshot,
the instance must be running`:E.jsxs(E.Fragment,{children:[`To create a stateful snapshot, the instance needs
`,"the ",E.jsx("code",{children:"migration.stateful"})," config set to true"]}))(),l=()=>{e.submitForm()};return E.jsxs(K.Modal,{className:"snapshot-creation-modal",close:i,title:`${t?"Edit":"Create"} snapshot`,buttonRow:E.jsxs(E.Fragment,{children:[E.jsx(K.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:i,children:"Cancel"}),E.jsx(Et,{isSubmitting:e.isSubmitting,isDisabled:!e.isValid,buttonLabel:t?"Save":"Create",onClick:l})]}),onKeyDown:p,children:[E.jsx(Qr,{}),E.jsxs(K.Form,{onSubmit:e.handleSubmit,children:[E.jsx(K.Input,{id:"name",name:"name",type:"text",label:"Snapshot name",onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.name,error:e.touched.name||t?e.errors.name:null,takeFocus:!0}),E.jsxs(K.Row,{className:"expiration-wrapper",children:[E.jsx(K.Col,{size:6,children:E.jsx(K.Input,{id:"expirationDate",name:"expirationDate",type:"date",label:"Expiry date",min:Zr(),onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.expirationDate??"",error:e.touched.expirationDate?e.errors.expirationDate:null})}),E.jsx(K.Col,{size:6,children:E.jsx(K.Input,{id:"expirationTime",name:"expirationTime",type:"time",label:"Expiry time",onChange:e.handleChange,onBlur:e.handleBlur,value:e.values.expirationTime??"",error:e.touched.expirationTime?e.errors.expirationTime:null})})]}),!t&&E.jsx(K.List,{inline:!0,items:[E.jsx(K.Input,{id:"stateful",name:"stateful",type:"checkbox",label:"Stateful",wrapperClassName:"u-inline-block",disabled:!n||!r,onChange:e.handleChange,onBlur:e.handleBlur,defaultChecked:e.values.stateful},"stateful"),...v?[E.jsx(K.Tooltip,{position:"btm-left",message:v,zIndex:Aa,children:E.jsx(K.Icon,{name:"information"})},"stateful-info")]:[]]})]})]})},Ia=({instance:t,close:e,onSuccess:i})=>{const n=Xe(),r=K.useNotify(),p=et(),a=Z.useState(null),v=ht({initialValues:{name:"",stateful:!1,expirationDate:null,expirationTime:null},validateOnMount:!0,validationSchema:fn(t,a),onSubmit:l=>{r.clear();const u=l.expirationDate&&l.expirationTime?Jr(un(l.expirationDate,l.expirationTime)):xi;va(t,l.name,u,l.stateful).then(d=>n.set(d.metadata.id,()=>{p.invalidateQueries({predicate:b=>b.queryKey[0]===Ee.instances}),i(E.jsxs(E.Fragment,{children:["Snapshot ",E.jsx(Ue,{item:l,bold:!0})," created."]})),e()},b=>{r.failure("Snapshot creation failed",new Error(b)),v.setSubmitting(!1)}))}});return E.jsx(_n,{isEdit:!1,formik:v,close:e,isStateful:hn(t),isRunning:t.status==="Running"})},Pa=({instance:t,snapshot:e,close:i,onSuccess:n})=>{const r=Xe(),p=K.useNotify(),a=et(),v=Z.useState(null),l=f=>{a.invalidateQueries({predicate:h=>h.queryKey[0]===Ee.instances}),n(E.jsxs(E.Fragment,{children:["Snapshot ",E.jsx(Ue,{item:{name:f},bold:!0})," saved."]})),i()},u=(f,h)=>{ya(t,h?{name:h}:e,f).then(s=>r.set(s.metadata.id,()=>l(h??e.name),g=>{p.failure("Snapshot update failed",new Error(g)),c.setSubmitting(!1)}))},d=(f,h)=>{Sa(t,e,f).then(_=>r.set(_.metadata.id,()=>{h?u(h,f):l(f)},s=>{p.failure("Snapshot rename failed",new Error(s)),c.setSubmitting(!1)}))},[b,o]=e.expires_at===xi?[null,null]:so(new Date(e.expires_at)).slice(0,16).split(" "),c=ht({initialValues:{name:e.name,stateful:e.stateful,expirationDate:b,expirationTime:o},validateOnMount:!0,validationSchema:fn(t,v,e.name),onSubmit:f=>{p.clear();const h=f.name,_=f.expirationDate&&f.expirationTime?Jr(un(f.expirationDate,f.expirationTime)):xi,s=h!==e.name,g=_!==e.expires_at;s&&g?d(h,_):s?d(h):u(_)}});return E.jsx(_n,{isEdit:!0,formik:c,close:i,isStateful:hn(t)})},Ta=({instance:t,snapshot:e,onSuccess:i,onFailure:n})=>{const r=Xe(),[p,a]=Z.useState(!1),[v,l]=Z.useState(!1),[u,d]=Z.useState(!1),[b,o]=Z.useState(!0),c=et(),f=()=>{l(!0),ln(t,e).then(_=>r.set(_.metadata.id,()=>i(E.jsxs(E.Fragment,{children:["Snapshot ",E.jsx(Ue,{item:e,bold:!0})," deleted."]})),s=>n("Snapshot deletion failed",new Error(s)),()=>{l(!1),c.invalidateQueries({predicate:s=>s.queryKey[0]===Ee.instances})}))},h=()=>{d(!0),ba(t,e,b).then(_=>r.set(_.metadata.id,()=>i(E.jsxs(E.Fragment,{children:["Snapshot ",E.jsx(Ue,{item:e,bold:!0})," restored."]})),s=>n("Snapshot restore failed",new Error(s)),()=>{d(!1),c.invalidateQueries({predicate:s=>s.queryKey[0]===Ee.instances})}))};return E.jsxs(E.Fragment,{children:[p&&E.jsx(Pa,{instance:t,snapshot:e,close:()=>a(!1),onSuccess:i}),E.jsx(K.List,{inline:!0,className:Ui("u-no-margin--bottom","actions-list",{"u-snapshot-actions":!v&&!u}),items:[E.jsx(K.Button,{appearance:"base",hasIcon:!0,dense:!0,disabled:v||u,onClick:()=>a(!0),type:"button","aria-label":"Edit snapshot",title:"Edit",children:E.jsx(K.Icon,{name:"edit"})},"edit"),E.jsx(K.ConfirmationButton,{appearance:"base",loading:u,className:"has-icon is-dense",title:"Confirm restore",confirmationModalProps:{title:"Confirm restore",children:E.jsxs("p",{children:["This will restore snapshot ",E.jsx(Ue,{item:e,bold:!0}),".",E.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmExtra:e.stateful?E.jsx(oo,{label:"Restore the instance state",force:[b,o]}):void 0,confirmButtonLabel:"Restore",confirmButtonAppearance:"positive",close:()=>o(!0),onConfirm:h},disabled:v||u,shiftClickEnabled:!0,showShiftClickHint:!0,children:E.jsx(K.Icon,{name:"change-version"})},"restore"),E.jsx(K.ConfirmationButton,{appearance:"base",loading:v,className:"has-icon is-dense",confirmationModalProps:{title:"Confirm delete",children:E.jsxs("p",{children:["This will permanently delete snapshot"," ",E.jsx(Ue,{item:e,bold:!0}),".",E.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:"Delete",onConfirm:f},disabled:v||u,shiftClickEnabled:!0,showShiftClickHint:!0,children:E.jsx(K.Icon,{name:"delete"})},"delete")]})]})},La=({instance:t,snapshotNames:e,onStart:i,onFinish:n,onSuccess:r,onFailure:p})=>{const a=Xe(),[v,l]=Z.useState(!1),u=et(),d=e.length,b=()=>{l(!0),i(),ga(t,e,a).then(o=>{const{fulfilledCount:c,rejectedCount:f}=ao(o);c===d?r(E.jsxs(E.Fragment,{children:[E.jsx("b",{children:e.length})," snapshot",e.length>1&&"s"," deleted."]})):f===d?p("Snapshot bulk deletion failed",void 0,E.jsxs(E.Fragment,{children:[E.jsx("b",{children:d})," ",It(d)," could not be deleted."]})):p("Snapshot bulk deletion partially failed",void 0,E.jsxs(E.Fragment,{children:[E.jsx("b",{children:c})," ",It(c)," ","deleted.",E.jsx("br",{}),E.jsx("b",{children:f})," ",It(f)," could not be deleted."]})),u.invalidateQueries({predicate:h=>h.queryKey[0]===Ee.instances}),l(!1),n()})};return E.jsxs(K.ConfirmationButton,{loading:v,confirmationModalProps:{title:"Confirm delete",children:E.jsxs("p",{children:["This will permanently delete ",E.jsx("b",{children:d})," ",It(d),".",E.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),confirmButtonLabel:"Delete",onConfirm:b},disabled:v,className:Ui({"has-icon":v}),onHoverText:"Delete snapshots",shiftClickEnabled:!0,showShiftClickHint:!0,children:[v&&E.jsx(K.Icon,{name:"spinner"}),E.jsx("span",{children:"Delete snapshots"})]})},Ma=({instance:t,close:e,onSuccess:i,onFailure:n})=>{const r=Xe(),{project:p}=ct(),a=et(),v=ht({initialValues:Dt(t),validationSchema:nn,onSubmit:u=>{const d=sn(t,u);en(d,p??"").then(b=>{r.set(b.metadata.id,()=>i("Configuration updated."),o=>n("Configuration update failed",new Error(o)),()=>{e(),a.invalidateQueries({queryKey:[Ee.instances]})})})}}),l=u=>{u.key==="Escape"&&e()};return E.jsx(K.Modal,{close:e,className:"edit-snapshot-config",title:"Snapshot configuration",buttonRow:v.values.readOnly?E.jsxs("div",{className:"u-space-between u-flex-row-reverse",children:[E.jsx(K.Button,{className:"u-no-margin--bottom u-no-margin--right",onClick:e,children:"Close"}),E.jsx(K.Button,{className:"u-no-margin--bottom",type:"button",onClick:()=>void v.setFieldValue("readOnly",!1),children:"Edit configuration"})]}):E.jsxs(E.Fragment,{children:[E.jsx(K.Button,{appearance:"base",className:"u-no-margin--bottom",type:"button",onClick:e,children:"Cancel"}),E.jsx(Et,{buttonLabel:"Save",className:"u-no-margin--bottom",isSubmitting:v.isSubmitting,isDisabled:v.isSubmitting,onClick:()=>void v.submitForm()})]}),onKeyDown:l,children:E.jsx(rn,{formik:v})})},Er=({instance:t,className:e,isDisabled:i=!1,onSuccess:n,onFailure:r})=>{const[p,a]=Z.useState(!1),v=()=>{a(!1)},l=()=>{a(!0)};return E.jsxs(E.Fragment,{children:[p&&E.jsx(Ma,{close:v,instance:t,onSuccess:n,onFailure:r}),E.jsx(K.Button,{onClick:l,className:e,disabled:i,children:"See configuration"})]})},Ra=1250,wr=()=>window.innerWidth<=Ra,Da=({instance:t})=>{var R,k,P,x;const e=co(),[i,n]=Z.useState(""),[r,p]=Z.useState(!1),[a,v]=Z.useState(null),[l,u]=Z.useState([]),[d,b]=Z.useState([]),[o,c]=Z.useState(wr()),f=A=>{v(K.success(A))},h=(A,M,N)=>{v(K.failure(A,M,N))},{project:_,isLoading:s}=lo(),g=(_==null?void 0:_.config["restricted.snapshots"])==="block";Z.useEffect(()=>{var N;const A=new Set((N=t.snapshots)==null?void 0:N.map(z=>z.name)),M=l.filter(z=>A.has(z));M.length!==l.length&&u(M)},[t.snapshots]);const m=((R=t.snapshots)==null?void 0:R.filter(A=>!(i&&!A.name.toLowerCase().includes(i.toLowerCase()))))??[],S=t.snapshots&&t.snapshots.length>0,y=[{content:o?E.jsxs(E.Fragment,{children:["Name",E.jsx("br",{}),E.jsx("div",{className:"header-second-row",children:"Date created"})]}):"Name",sortKey:o?"created_at":"name",className:"name"},...o?[]:[{content:"Date created",sortKey:"created_at",className:"created"}],{content:"Expiry date",sortKey:"expires_at",className:"expiration"},{content:"Stateful",sortKey:"stateful",className:"stateful"},{"aria-label":"Actions",className:"actions"}],C=m.map(A=>{const M=E.jsx(Ta,{instance:t,snapshot:A,onSuccess:f,onFailure:h});return{className:"u-row",name:A.name,columns:[{content:E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"u-truncate",title:A.name,children:E.jsx(Ue,{item:A})}),o&&E.jsx("div",{className:"u-text--muted",children:gt(A.created_at)})]}),role:"rowheader","aria-label":"Name",className:"name"},...o?[]:[{content:gt(A.created_at),role:"rowheader","aria-label":"Created at",className:"created"}],{content:gt(A.expires_at),role:"rowheader","aria-label":"Expires at",className:"expiration"},{content:A.stateful?"Yes":"No",role:"rowheader","aria-label":"Stateful",className:"stateful"},{content:M,role:"rowheader","aria-label":"Actions",className:"u-align--right actions"}],sortData:{name:A.name.toLowerCase(),created_at:A.created_at,expires_at:A.expires_at,stateful:A.stateful}}}),w=ho(C,"created_at","descending");return He("resize",()=>{c(wr())}),s?E.jsx(Ge,{}):E.jsxs("div",{className:"snapshot-list",children:[r&&E.jsx(Ia,{instance:t,close:()=>p(!1),onSuccess:f}),S&&E.jsx("div",{className:"upper-controls-bar",children:l.length===0?E.jsxs(E.Fragment,{children:[E.jsx("div",{className:"search-box-wrapper",children:E.jsx(K.SearchBox,{name:"search-snapshot",className:"search-box margin-right",type:"text",onChange:A=>{n(A)},placeholder:"Search for snapshots",value:i,"aria-label":"Search for snapshots"})}),E.jsx(Er,{instance:t,className:"u-no-margin--right",onSuccess:f,onFailure:h}),E.jsx(K.Button,{appearance:"positive",className:"u-float-right",onClick:()=>p(!0),children:"Create snapshot"})]}):E.jsx("div",{className:"p-panel__controls",children:E.jsx(La,{instance:t,snapshotNames:l,onStart:()=>b(l),onFinish:()=>b([]),onSuccess:f,onFailure:h})})}),E.jsx(Zt,{notification:a,onDismiss:()=>v(null)}),S?E.jsxs(E.Fragment,{children:[E.jsx(uo,{...w,id:"pagination",totalCount:((k=t.snapshots)==null?void 0:k.length)??0,visibleCount:m.length===((P=t.snapshots)==null?void 0:P.length)?w.pageData.length:m.length,selectedNotification:l.length>0&&E.jsx(Lo,{totalCount:((x=t.snapshots)==null?void 0:x.length)??0,itemName:"snapshot",parentName:"instance",selectedNames:l,setSelectedNames:u,filteredNames:m.map(A=>A.name)}),keyword:"snapshot"}),E.jsx(fo,{dependencies:[m,a],children:E.jsx(To,{headers:y,rows:w.pageData,sortable:!0,emptyStateMsg:"No snapshot found matching this search",itemName:"snapshot",parentName:"instance",selectedNames:l,setSelectedNames:u,processingNames:d,filteredNames:m.map(A=>A.name),onUpdateSort:w.updateSort,defaultSort:"created_at",defaultSortDirection:"descending"})})]}):E.jsxs(K.EmptyState,{className:"empty-state",image:E.jsx(K.Icon,{name:"containers",className:"empty-state-icon"}),title:"No snapshots found",children:[E.jsx("p",{children:g?E.jsxs(E.Fragment,{children:["Snapshots are disabled for project"," ",E.jsx(Ue,{item:_,bold:!0}),"."]}):"There are no snapshots of this instance."}),E.jsx("p",{children:E.jsxs("a",{href:`${e}/howto/storage_backup_volume/#storage-backup-snapshots`,target:"_blank",rel:"noreferrer",children:["Learn more about snapshots",E.jsx(K.Icon,{className:"external-link-icon",name:"external-link"})]})}),E.jsx(Er,{instance:t,isDisabled:g,onSuccess:f,onFailure:h}),E.jsx(K.Button,{className:"empty-state-button",appearance:"positive",onClick:()=>p(!0),disabled:g,children:"Create snapshot"})]})]})};var D={SPICE_MAGIC:"REDQ",SPICE_VERSION_MAJOR:2,SPICE_VERSION_MINOR:2,SPICE_CONNECT_TIMEOUT:30*1e3,SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION:0,SPICE_COMMON_CAP_AUTH_SPICE:1,SPICE_COMMON_CAP_AUTH_SASL:2,SPICE_COMMON_CAP_MINI_HEADER:3,SPICE_TICKET_KEY_PAIR_LENGTH:1024,SPICE_TICKET_PUBKEY_BYTES:1024/8+34,SPICE_LINK_ERR_OK:0,SPICE_LINK_ERR_ERROR:1,SPICE_LINK_ERR_INVALID_MAGIC:2,SPICE_LINK_ERR_INVALID_DATA:3,SPICE_LINK_ERR_VERSION_MISMATCH:4,SPICE_LINK_ERR_NEED_SECURED:5,SPICE_LINK_ERR_NEED_UNSECURED:6,SPICE_LINK_ERR_PERMISSION_DENIED:7,SPICE_LINK_ERR_BAD_CONNECTION_ID:8,SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE:9,SPICE_MSG_MIGRATE:1,SPICE_MSG_MIGRATE_DATA:2,SPICE_MSG_SET_ACK:3,SPICE_MSG_PING:4,SPICE_MSG_WAIT_FOR_CHANNELS:5,SPICE_MSG_DISCONNECTING:6,SPICE_MSG_NOTIFY:7,SPICE_MSG_LIST:8,SPICE_MSG_MAIN_MIGRATE_BEGIN:101,SPICE_MSG_MAIN_MIGRATE_CANCEL:102,SPICE_MSG_MAIN_INIT:103,SPICE_MSG_MAIN_CHANNELS_LIST:104,SPICE_MSG_MAIN_MOUSE_MODE:105,SPICE_MSG_MAIN_MULTI_MEDIA_TIME:106,SPICE_MSG_MAIN_AGENT_CONNECTED:107,SPICE_MSG_MAIN_AGENT_DISCONNECTED:108,SPICE_MSG_MAIN_AGENT_DATA:109,SPICE_MSG_MAIN_AGENT_TOKEN:110,SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST:111,SPICE_MSG_MAIN_MIGRATE_END:112,SPICE_MSG_MAIN_NAME:113,SPICE_MSG_MAIN_UUID:114,SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS:115,SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS:116,SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK:117,SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK:118,SPICE_MSG_END_MAIN:119,SPICE_MSGC_ACK_SYNC:1,SPICE_MSGC_ACK:2,SPICE_MSGC_PONG:3,SPICE_MSGC_MIGRATE_FLUSH_MARK:4,SPICE_MSGC_MIGRATE_DATA:5,SPICE_MSGC_DISCONNECTING:6,SPICE_MSGC_MAIN_CLIENT_INFO:101,SPICE_MSGC_MAIN_MIGRATE_CONNECTED:102,SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR:103,SPICE_MSGC_MAIN_ATTACH_CHANNELS:104,SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST:105,SPICE_MSGC_MAIN_AGENT_START:106,SPICE_MSGC_MAIN_AGENT_DATA:107,SPICE_MSGC_MAIN_AGENT_TOKEN:108,SPICE_MSGC_MAIN_MIGRATE_END:109,SPICE_MSGC_END_MAIN:110,SPICE_MSG_DISPLAY_MODE:101,SPICE_MSG_DISPLAY_MARK:102,SPICE_MSG_DISPLAY_RESET:103,SPICE_MSG_DISPLAY_COPY_BITS:104,SPICE_MSG_DISPLAY_INVAL_LIST:105,SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS:106,SPICE_MSG_DISPLAY_INVAL_PALETTE:107,SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES:108,SPICE_MSG_DISPLAY_STREAM_CREATE:122,SPICE_MSG_DISPLAY_STREAM_DATA:123,SPICE_MSG_DISPLAY_STREAM_CLIP:124,SPICE_MSG_DISPLAY_STREAM_DESTROY:125,SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL:126,SPICE_MSG_DISPLAY_DRAW_FILL:302,SPICE_MSG_DISPLAY_DRAW_OPAQUE:303,SPICE_MSG_DISPLAY_DRAW_COPY:304,SPICE_MSG_DISPLAY_DRAW_BLEND:305,SPICE_MSG_DISPLAY_DRAW_BLACKNESS:306,SPICE_MSG_DISPLAY_DRAW_WHITENESS:307,SPICE_MSG_DISPLAY_DRAW_INVERS:308,SPICE_MSG_DISPLAY_DRAW_ROP3:309,SPICE_MSG_DISPLAY_DRAW_STROKE:310,SPICE_MSG_DISPLAY_DRAW_TEXT:311,SPICE_MSG_DISPLAY_DRAW_TRANSPARENT:312,SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND:313,SPICE_MSG_DISPLAY_SURFACE_CREATE:314,SPICE_MSG_DISPLAY_SURFACE_DESTROY:315,SPICE_MSG_DISPLAY_STREAM_DATA_SIZED:316,SPICE_MSG_DISPLAY_MONITORS_CONFIG:317,SPICE_MSG_DISPLAY_DRAW_COMPOSITE:318,SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT:319,SPICE_MSGC_DISPLAY_INIT:101,SPICE_MSGC_DISPLAY_STREAM_REPORT:102,SPICE_MSG_INPUTS_INIT:101,SPICE_MSG_INPUTS_KEY_MODIFIERS:102,SPICE_MSG_INPUTS_MOUSE_MOTION_ACK:111,SPICE_MSGC_INPUTS_KEY_DOWN:101,SPICE_MSGC_INPUTS_KEY_UP:102,SPICE_MSGC_INPUTS_KEY_MODIFIERS:103,SPICE_MSGC_INPUTS_MOUSE_MOTION:111,SPICE_MSGC_INPUTS_MOUSE_POSITION:112,SPICE_MSGC_INPUTS_MOUSE_PRESS:113,SPICE_MSGC_INPUTS_MOUSE_RELEASE:114,SPICE_MSG_CURSOR_INIT:101,SPICE_MSG_CURSOR_RESET:102,SPICE_MSG_CURSOR_SET:103,SPICE_MSG_CURSOR_MOVE:104,SPICE_MSG_CURSOR_HIDE:105,SPICE_MSG_CURSOR_TRAIL:106,SPICE_MSG_CURSOR_INVAL_ONE:107,SPICE_MSG_CURSOR_INVAL_ALL:108,SPICE_MSG_PLAYBACK_DATA:101,SPICE_MSG_PLAYBACK_MODE:102,SPICE_MSG_PLAYBACK_START:103,SPICE_MSG_PLAYBACK_STOP:104,SPICE_MSG_PLAYBACK_VOLUME:105,SPICE_MSG_PLAYBACK_MUTE:106,SPICE_MSG_PLAYBACK_LATENCY:107,SPICE_MSG_SPICEVMC_DATA:101,SPICE_MSG_PORT_INIT:201,SPICE_MSG_PORT_EVENT:202,SPICE_MSG_END_PORT:203,SPICE_MSGC_SPICEVMC_DATA:101,SPICE_MSGC_PORT_EVENT:201,SPICE_MSGC_END_PORT:202,SPICE_PLAYBACK_CAP_CELT_0_5_1:0,SPICE_PLAYBACK_CAP_VOLUME:1,SPICE_PLAYBACK_CAP_LATENCY:2,SPICE_PLAYBACK_CAP_OPUS:3,SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE:0,SPICE_MAIN_CAP_NAME_AND_UUID:1,SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS:2,SPICE_MAIN_CAP_SEAMLESS_MIGRATE:3,SPICE_DISPLAY_CAP_SIZED_STREAM:0,SPICE_DISPLAY_CAP_MONITORS_CONFIG:1,SPICE_DISPLAY_CAP_COMPOSITE:2,SPICE_DISPLAY_CAP_A8_SURFACE:3,SPICE_DISPLAY_CAP_STREAM_REPORT:4,SPICE_DISPLAY_CAP_LZ4_COMPRESSION:5,SPICE_DISPLAY_CAP_PREF_COMPRESSION:6,SPICE_DISPLAY_CAP_GL_SCANOUT:7,SPICE_DISPLAY_CAP_MULTI_CODEC:8,SPICE_DISPLAY_CAP_CODEC_MJPEG:9,SPICE_DISPLAY_CAP_CODEC_VP8:10,SPICE_AUDIO_DATA_MODE_INVALID:0,SPICE_AUDIO_DATA_MODE_RAW:1,SPICE_AUDIO_DATA_MODE_CELT_0_5_1:2,SPICE_AUDIO_DATA_MODE_OPUS:3,SPICE_AUDIO_FMT_INVALID:0,SPICE_AUDIO_FMT_S16:1,SPICE_CHANNEL_MAIN:1,SPICE_CHANNEL_DISPLAY:2,SPICE_CHANNEL_INPUTS:3,SPICE_CHANNEL_CURSOR:4,SPICE_CHANNEL_PLAYBACK:5,SPICE_CHANNEL_RECORD:6,SPICE_CHANNEL_TUNNEL:7,SPICE_CHANNEL_SMARTCARD:8,SPICE_CHANNEL_USBREDIR:9,SPICE_CHANNEL_PORT:10,SPICE_CHANNEL_WEBDAV:11,SPICE_SURFACE_FLAGS_PRIMARY:1,SPICE_NOTIFY_SEVERITY_INFO:0,SPICE_NOTIFY_SEVERITY_WARN:1,SPICE_NOTIFY_SEVERITY_ERROR:2,SPICE_MOUSE_MODE_SERVER:1,SPICE_MOUSE_MODE_CLIENT:2,SPICE_MOUSE_MODE_MASK:3,SPICE_CLIP_TYPE_NONE:0,SPICE_CLIP_TYPE_RECTS:1,SPICE_IMAGE_TYPE_BITMAP:0,SPICE_IMAGE_TYPE_QUIC:1,SPICE_IMAGE_TYPE_RESERVED:2,SPICE_IMAGE_TYPE_LZ_PLT:100,SPICE_IMAGE_TYPE_LZ_RGB:101,SPICE_IMAGE_TYPE_GLZ_RGB:102,SPICE_IMAGE_TYPE_FROM_CACHE:103,SPICE_IMAGE_TYPE_SURFACE:104,SPICE_IMAGE_TYPE_JPEG:105,SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS:106,SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB:107,SPICE_IMAGE_TYPE_JPEG_ALPHA:108,SPICE_IMAGE_FLAGS_CACHE_ME:1,SPICE_IMAGE_FLAGS_HIGH_BITS_SET:2,SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME:4,SPICE_BITMAP_FLAGS_PAL_CACHE_ME:1,SPICE_BITMAP_FLAGS_PAL_FROM_CACHE:2,SPICE_BITMAP_FLAGS_TOP_DOWN:4,SPICE_BITMAP_FLAGS_MASK:7,SPICE_BITMAP_FMT_INVALID:0,SPICE_BITMAP_FMT_1BIT_LE:1,SPICE_BITMAP_FMT_1BIT_BE:2,SPICE_BITMAP_FMT_4BIT_LE:3,SPICE_BITMAP_FMT_4BIT_BE:4,SPICE_BITMAP_FMT_8BIT:5,SPICE_BITMAP_FMT_16BIT:6,SPICE_BITMAP_FMT_24BIT:7,SPICE_BITMAP_FMT_32BIT:8,SPICE_BITMAP_FMT_RGBA:9,SPICE_CURSOR_FLAGS_NONE:1,SPICE_CURSOR_FLAGS_CACHE_ME:2,SPICE_CURSOR_FLAGS_FROM_CACHE:4,SPICE_CURSOR_FLAGS_MASK:7,SPICE_MOUSE_BUTTON_MASK_LEFT:1,SPICE_MOUSE_BUTTON_MASK_MIDDLE:2,SPICE_MOUSE_BUTTON_MASK_RIGHT:4,SPICE_MOUSE_BUTTON_MASK_MASK:7,SPICE_MOUSE_BUTTON_INVALID:0,SPICE_MOUSE_BUTTON_LEFT:1,SPICE_MOUSE_BUTTON_MIDDLE:2,SPICE_MOUSE_BUTTON_RIGHT:3,SPICE_MOUSE_BUTTON_UP:4,SPICE_MOUSE_BUTTON_DOWN:5,SPICE_BRUSH_TYPE_NONE:0,SPICE_BRUSH_TYPE_SOLID:1,SPICE_BRUSH_TYPE_PATTERN:2,SPICE_SURFACE_FMT_INVALID:0,SPICE_SURFACE_FMT_1_A:1,SPICE_SURFACE_FMT_8_A:8,SPICE_SURFACE_FMT_16_555:16,SPICE_SURFACE_FMT_32_xRGB:32,SPICE_SURFACE_FMT_16_565:80,SPICE_SURFACE_FMT_32_ARGB:96,SPICE_ROPD_INVERS_SRC:1,SPICE_ROPD_INVERS_BRUSH:2,SPICE_ROPD_INVERS_DEST:4,SPICE_ROPD_OP_PUT:8,SPICE_ROPD_OP_OR:16,SPICE_ROPD_OP_AND:32,SPICE_ROPD_OP_XOR:64,SPICE_ROPD_OP_BLACKNESS:128,SPICE_ROPD_OP_WHITENESS:256,SPICE_ROPD_OP_INVERS:512,SPICE_ROPD_INVERS_RES:1024,SPICE_ROPD_MASK:2047,LZ_IMAGE_TYPE_INVALID:0,LZ_IMAGE_TYPE_PLT1_LE:1,LZ_IMAGE_TYPE_PLT1_BE:2,LZ_IMAGE_TYPE_PLT4_LE:3,LZ_IMAGE_TYPE_PLT4_BE:4,LZ_IMAGE_TYPE_PLT8:5,LZ_IMAGE_TYPE_RGB16:6,LZ_IMAGE_TYPE_RGB24:7,LZ_IMAGE_TYPE_RGB32:8,LZ_IMAGE_TYPE_RGBA:9,LZ_IMAGE_TYPE_XXXA:10,SPICE_INPUT_MOTION_ACK_BUNCH:4,SPICE_CURSOR_TYPE_ALPHA:0,SPICE_CURSOR_TYPE_MONO:1,SPICE_CURSOR_TYPE_COLOR4:2,SPICE_CURSOR_TYPE_COLOR8:3,SPICE_CURSOR_TYPE_COLOR16:4,SPICE_CURSOR_TYPE_COLOR24:5,SPICE_CURSOR_TYPE_COLOR32:6,SPICE_VIDEO_CODEC_TYPE_MJPEG:1,SPICE_VIDEO_CODEC_TYPE_VP8:2,VD_AGENT_PROTOCOL:1,VD_AGENT_MAX_DATA_SIZE:2048,VD_AGENT_MOUSE_STATE:1,VD_AGENT_MONITORS_CONFIG:2,VD_AGENT_REPLY:3,VD_AGENT_CLIPBOARD:4,VD_AGENT_DISPLAY_CONFIG:5,VD_AGENT_ANNOUNCE_CAPABILITIES:6,VD_AGENT_CLIPBOARD_GRAB:7,VD_AGENT_CLIPBOARD_REQUEST:8,VD_AGENT_CLIPBOARD_RELEASE:9,VD_AGENT_FILE_XFER_START:10,VD_AGENT_FILE_XFER_STATUS:11,VD_AGENT_FILE_XFER_DATA:12,VD_AGENT_CLIENT_DISCONNECTED:13,VD_AGENT_MAX_CLIPBOARD:14,VD_AGENT_CAP_MOUSE_STATE:0,VD_AGENT_CAP_MONITORS_CONFIG:1,VD_AGENT_CAP_REPLY:2,VD_AGENT_CAP_CLIPBOARD:3,VD_AGENT_CAP_DISPLAY_CONFIG:4,VD_AGENT_CAP_CLIPBOARD_BY_DEMAND:5,VD_AGENT_CAP_CLIPBOARD_SELECTION:6,VD_AGENT_CAP_SPARSE_MONITORS_CONFIG:7,VD_AGENT_CAP_GUEST_LINEEND_LF:8,VD_AGENT_CAP_GUEST_LINEEND_CRLF:9,VD_AGENT_CAP_MAX_CLIPBOARD:10,VD_AGENT_END_CAP:11,VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA:0,VD_AGENT_FILE_XFER_STATUS_CANCELLED:1,VD_AGENT_FILE_XFER_STATUS_ERROR:2,VD_AGENT_FILE_XFER_STATUS_SUCCESS:3};function X(t,e,i){e!==void 0?i!==void 0?this.u8=new Uint8Array(t,e,i):this.u8=new Uint8Array(t,e):this.u8=new Uint8Array(t)}X.prototype={getUint8:function(t){return this.u8[t]},getUint16:function(t,e){var i=1,n=0;return e&&(i=0,n=1),this.u8[t+n]<<8|this.u8[t+i]},getUint32:function(t,e){var i=2,n=0;return e&&(i=0,n=2),this.getUint16(t+n,e)<<16|this.getUint16(t+i,e)},getUint64:function(t,e){var i=4,n=0;return e&&(i=0,n=4),this.getUint32(t+n,e)<<32|this.getUint32(t+i,e)},setUint8:function(t,e){this.u8[t]=e&255},setUint16:function(t,e,i){var n=1,r=0;i&&(n=0,r=1),this.u8[t+r]=(e&65535)>>8,this.u8[t+n]=e&255},setUint32:function(t,e,i){var n=2,r=0;i&&(n=0,r=2),this.setUint16(t+r,(e&4294967295)>>16,i),this.setUint16(t+n,e&65535,i)},setUint64:function(t,e,i){var n=4,r=0;i&&(n=0,r=4),this.setUint32(t+r,(e&18446744073709552e3)>>32,i),this.setUint32(t+n,e&4294967295,i)}};var We;function J(t,e,i){t!=null&&(typeof t=="number"?this.fromNumber(t,e,i):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function Be(){return new J(null)}function Oa(t,e,i,n,r,p){for(;--p>=0;){var a=e*this[t++]+i[n]+r;r=Math.floor(a/67108864),i[n++]=a&67108863}return r}function ka(t,e,i,n,r,p){for(var a=e&32767,v=e>>15;--p>=0;){var l=this[t]&32767,u=this[t++]>>15,d=v*l+u*a;l=a*l+((d&32767)<<15)+i[n]+(r&1073741823),r=(l>>>30)+(d>>>15)+v*u+(r>>>30),i[n++]=l&1073741823}return r}function Na(t,e,i,n,r,p){for(var a=e&16383,v=e>>14;--p>=0;){var l=this[t]&16383,u=this[t++]>>14,d=v*l+u*a;l=a*l+((d&16383)<<14)+i[n]+r,r=(l>>28)+(d>>14)+v*u,i[n++]=l&268435455}return r}navigator.appName=="Microsoft Internet Explorer"?(J.prototype.am=ka,We=30):navigator.appName!="Netscape"?(J.prototype.am=Oa,We=26):(J.prototype.am=Na,We=28);J.prototype.DB=We;J.prototype.DM=(1<<We)-1;J.prototype.DV=1<<We;var Fi=52;J.prototype.FV=Math.pow(2,Fi);J.prototype.F1=Fi-We;J.prototype.F2=2*We-Fi;var Ua="0123456789abcdefghijklmnopqrstuvwxyz",Qt=new Array,ut,De;ut="0".charCodeAt(0);for(De=0;De<=9;++De)Qt[ut++]=De;ut="a".charCodeAt(0);for(De=10;De<36;++De)Qt[ut++]=De;ut="A".charCodeAt(0);for(De=10;De<36;++De)Qt[ut++]=De;function xr(t){return Ua.charAt(t)}function Ba(t,e){var i=Qt[t.charCodeAt(e)];return i??-1}function Fa(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function ja(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0}function dn(t){var e=Be();return e.fromInt(t),e}function Ha(t,e){var i;if(e==16)i=4;else if(e==8)i=3;else if(e==256)i=8;else if(e==2)i=1;else if(e==32)i=5;else if(e==4)i=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,r=!1,p=0;--n>=0;){var a=i==8?t[n]&255:Ba(t,n);if(a<0){t.charAt(n)=="-"&&(r=!0);continue}r=!1,p==0?this[this.t++]=a:p+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-p)-1)<<p,this[this.t++]=a>>this.DB-p):this[this.t-1]|=a<<p,p+=i,p>=this.DB&&(p-=this.DB)}i==8&&t[0]&128&&(this.s=-1,p>0&&(this[this.t-1]|=(1<<this.DB-p)-1<<p)),this.clamp(),r&&J.ZERO.subTo(this,this)}function Ga(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function Ka(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var i=(1<<e)-1,n,r=!1,p="",a=this.t,v=this.DB-a*this.DB%e;if(a-- >0)for(v<this.DB&&(n=this[a]>>v)>0&&(r=!0,p=xr(n));a>=0;)v<e?(n=(this[a]&(1<<v)-1)<<e-v,n|=this[--a]>>(v+=this.DB-e)):(n=this[a]>>(v-=e)&i,v<=0&&(v+=this.DB,--a)),n>0&&(r=!0),r&&(p+=xr(n));return r?p:"0"}function Ya(){var t=Be();return J.ZERO.subTo(this,t),t}function qa(){return this.s<0?this.negate():this}function za(t){var e=this.s-t.s;if(e!=0)return e;var i=this.t;if(e=i-t.t,e!=0)return e;for(;--i>=0;)if((e=this[i]-t[i])!=0)return e;return 0}function ji(t){var e=1,i;return(i=t>>>16)!=0&&(t=i,e+=16),(i=t>>8)!=0&&(t=i,e+=8),(i=t>>4)!=0&&(t=i,e+=4),(i=t>>2)!=0&&(t=i,e+=2),(i=t>>1)!=0&&(t=i,e+=1),e}function Wa(){return this.t<=0?0:this.DB*(this.t-1)+ji(this[this.t-1]^this.s&this.DM)}function Va(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function Xa(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s}function $a(t,e){var i=t%this.DB,n=this.DB-i,r=(1<<n)-1,p=Math.floor(t/this.DB),a=this.s<<i&this.DM,v;for(v=this.t-1;v>=0;--v)e[v+p+1]=this[v]>>n|a,a=(this[v]&r)<<i;for(v=p-1;v>=0;--v)e[v]=0;e[p]=a,e.t=this.t+p+1,e.s=this.s,e.clamp()}function Za(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t){e.t=0;return}var n=t%this.DB,r=this.DB-n,p=(1<<n)-1;e[0]=this[i]>>n;for(var a=i+1;a<this.t;++a)e[a-i-1]|=(this[a]&p)<<r,e[a-i]=this[a]>>n;n>0&&(e[this.t-i-1]|=(this.s&p)<<r),e.t=this.t-i,e.clamp()}function Qa(t,e){for(var i=0,n=0,r=Math.min(t.t,this.t);i<r;)n+=this[i]-t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n-=t[i],e[i++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:n>0&&(e[i++]=n),e.t=i,e.clamp()}function Ja(t,e){var i=this.abs(),n=t.abs(),r=i.t;for(e.t=r+n.t;--r>=0;)e[r]=0;for(r=0;r<n.t;++r)e[r+i.t]=i.am(0,n[r],e,r,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&J.ZERO.subTo(e,e)}function ec(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var n=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,n,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function tc(t,e,i){var n=t.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t){e!=null&&e.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=Be());var p=Be(),a=this.s,v=t.s,l=this.DB-ji(n[n.t-1]);l>0?(n.lShiftTo(l,p),r.lShiftTo(l,i)):(n.copyTo(p),r.copyTo(i));var u=p.t,d=p[u-1];if(d!=0){var b=d*(1<<this.F1)+(u>1?p[u-2]>>this.F2:0),o=this.FV/b,c=(1<<this.F1)/b,f=1<<this.F2,h=i.t,_=h-u,s=e??Be();for(p.dlShiftTo(_,s),i.compareTo(s)>=0&&(i[i.t++]=1,i.subTo(s,i)),J.ONE.dlShiftTo(u,s),s.subTo(p,p);p.t<u;)p[p.t++]=0;for(;--_>=0;){var g=i[--h]==d?this.DM:Math.floor(i[h]*o+(i[h-1]+f)*c);if((i[h]+=p.am(0,g,i,_,0,u))<g)for(p.dlShiftTo(_,s),i.subTo(s,i);i[h]<--g;)i.subTo(s,i)}e!=null&&(i.drShiftTo(u,e),a!=v&&J.ZERO.subTo(e,e)),i.t=u,i.clamp(),l>0&&i.rShiftTo(l,i),a<0&&J.ZERO.subTo(i,i)}}}function ic(t){var e=Be();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(J.ZERO)>0&&t.subTo(e,e),e}function ft(t){this.m=t}function rc(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function nc(t){return t}function sc(t){t.divRemTo(this.m,null,t)}function oc(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function ac(t,e){t.squareTo(e),this.reduce(e)}ft.prototype.convert=rc;ft.prototype.revert=nc;ft.prototype.reduce=sc;ft.prototype.mulTo=oc;ft.prototype.sqrTo=ac;function cc(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function _t(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function lc(t){var e=Be();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(J.ZERO)>0&&this.m.subTo(e,e),e}function hc(t){var e=Be();return t.copyTo(e),this.reduce(e),e}function uc(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=t[e]&32767,n=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,n,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function fc(t,e){t.squareTo(e),this.reduce(e)}function _c(t,e,i){t.multiplyTo(e,i),this.reduce(i)}_t.prototype.convert=lc;_t.prototype.revert=hc;_t.prototype.reduce=uc;_t.prototype.mulTo=_c;_t.prototype.sqrTo=fc;function dc(){return(this.t>0?this[0]&1:this.s)==0}function pc(t,e){if(t>4294967295||t<1)return J.ONE;var i=Be(),n=Be(),r=e.convert(this),p=ji(t)-1;for(r.copyTo(i);--p>=0;)if(e.sqrTo(i,n),(t&1<<p)>0)e.mulTo(n,r,i);else{var a=i;i=n,n=a}return e.revert(i)}function mc(t,e){var i;return t<256||e.isEven()?i=new ft(e):i=new _t(e),this.exp(t,i)}J.prototype.copyTo=Fa;J.prototype.fromInt=ja;J.prototype.fromString=Ha;J.prototype.clamp=Ga;J.prototype.dlShiftTo=Va;J.prototype.drShiftTo=Xa;J.prototype.lShiftTo=$a;J.prototype.rShiftTo=Za;J.prototype.subTo=Qa;J.prototype.multiplyTo=Ja;J.prototype.squareTo=ec;J.prototype.divRemTo=tc;J.prototype.invDigit=cc;J.prototype.isEven=dc;J.prototype.exp=pc;J.prototype.toString=Ka;J.prototype.negate=Ya;J.prototype.abs=qa;J.prototype.compareTo=za;J.prototype.bitLength=Wa;J.prototype.mod=ic;J.prototype.modPowInt=mc;J.ZERO=dn(0);J.ONE=dn(1);function Hi(){this.i=0,this.j=0,this.S=new Array}function vc(t){var e,i,n;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[i],this.S[i]=n;this.i=0,this.j=0}function gc(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}Hi.prototype.init=vc;Hi.prototype.next=gc;function bc(){return new Hi}var Ii=256,Tt,Re,Se;function Sc(t){Re[Se++]^=t&255,Re[Se++]^=t>>8&255,Re[Se++]^=t>>16&255,Re[Se++]^=t>>24&255,Se>=Ii&&(Se-=Ii)}function pn(){Sc(new Date().getTime())}if(Re==null){Re=new Array,Se=0;var $e;if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var Ar=window.crypto.random(32);for($e=0;$e<Ar.length;++$e)Re[Se++]=Ar.charCodeAt($e)&255}for(;Se<Ii;)$e=Math.floor(65536*Math.random()),Re[Se++]=$e>>>8,Re[Se++]=$e&255;Se=0,pn()}function yc(){if(Tt==null){for(pn(),Tt=bc(),Tt.init(Re),Se=0;Se<Re.length;++Se)Re[Se]=0;Se=0}return Tt.next()}function Cc(t){var e;for(e=0;e<t.length;++e)t[e]=yc()}function Gi(){}Gi.prototype.nextBytes=Cc;function Ec(t,e){return new J(t,e)}function wc(t,e){if(e<t.length+11)return alert("Message too long for RSA"),null;for(var i=new Array,n=t.length-1;n>=0&&e>0;){var r=t.charCodeAt(n--);r<128?i[--e]=r:r>127&&r<2048?(i[--e]=r&63|128,i[--e]=r>>6|192):(i[--e]=r&63|128,i[--e]=r>>6&63|128,i[--e]=r>>12|224)}i[--e]=0;for(var p=new Gi,a=new Array;e>2;){for(a[0]=0;a[0]==0;)p.nextBytes(a);i[--e]=a[0]}return i[--e]=2,i[--e]=0,new J(i)}function Jt(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function xc(t,e){t!=null&&e!=null&&t.length>0&&e.length>0?(this.n=Ec(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")}function Ac(t){return t.modPowInt(this.e,this.n)}function Ic(t){var e=wc(t,this.n.bitLength()+7>>3);if(e==null)return null;var i=this.doPublic(e);if(i==null)return null;var n=i.toString(16);return n.length&1?"0"+n:n}Jt.prototype.doPublic=Ac;Jt.prototype.setPublic=xc;Jt.prototype.encrypt=Ic;var gi=0;function Pc(t){return Tc(Ki(Lc(t)))}function Ki(t){return Rc(Dc(Mc(t),t.length*8))}function Tc(t){try{}catch{gi=0}for(var e=gi?"0123456789ABCDEF":"0123456789abcdef",i="",n,r=0;r<t.length;r++)n=t.charCodeAt(r),i+=e.charAt(n>>>4&15)+e.charAt(n&15);return i}function Lc(t){for(var e="",i=-1,n,r;++i<t.length;)n=t.charCodeAt(i),r=i+1<t.length?t.charCodeAt(i+1):0,55296<=n&&n<=56319&&56320<=r&&r<=57343&&(n=65536+((n&1023)<<10)+(r&1023),i++),n<=127?e+=String.fromCharCode(n):n<=2047?e+=String.fromCharCode(192|n>>>6&31,128|n&63):n<=65535?e+=String.fromCharCode(224|n>>>12&15,128|n>>>6&63,128|n&63):n<=2097151&&(e+=String.fromCharCode(240|n>>>18&7,128|n>>>12&63,128|n>>>6&63,128|n&63));return e}function Mc(t){for(var e=Array(t.length>>2),i=0;i<e.length;i++)e[i]=0;for(var i=0;i<t.length*8;i+=8)e[i>>5]|=(t.charCodeAt(i/8)&255)<<24-i%32;return e}function Rc(t){for(var e="",i=0;i<t.length*32;i+=8)e+=String.fromCharCode(t[i>>5]>>>24-i%32&255);return e}function Dc(t,e){t[e>>5]|=128<<24-e%32,t[(e+64>>9<<4)+15]=e;for(var i=Array(80),n=1732584193,r=-271733879,p=-1732584194,a=271733878,v=-1009589776,l=0;l<t.length;l+=16){for(var u=n,d=r,b=p,o=a,c=v,f=0;f<80;f++){f<16?i[f]=t[l+f]:i[f]=bi(i[f-3]^i[f-8]^i[f-14]^i[f-16],1);var h=je(je(bi(n,5),Oc(f,r,p,a)),je(je(v,i[f]),kc(f)));v=a,a=p,p=bi(r,30),r=n,n=h}n=je(n,u),r=je(r,d),p=je(p,b),a=je(a,o),v=je(v,c)}return Array(n,r,p,a,v)}function Oc(t,e,i,n){return t<20?e&i|~e&n:t<40?e^i^n:t<60?e&i|e&n|i&n:e^i^n}function kc(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function je(t,e){var i=(t&65535)+(e&65535),n=(t>>16)+(e>>16)+(i>>16);return n<<16|i&65535}function bi(t,e){return t<<e|t>>>32-e}var Si=20;function Ir(t,e){var i,n,r;for(i=0,r=0;r<t.length;i++){var p=new String;for(n=0;n<e.length;n++)p+=String.fromCharCode(e[n]);p+=String.fromCharCode(i>>24&255),p+=String.fromCharCode(i>>16&255),p+=String.fromCharCode(i>>8&255),p+=String.fromCharCode(i&255);var a=Ki(p);for(n=0;n<a.length&&r<t.length;n++,r++)t[r]=a.charCodeAt(n)}}function Nc(t,e,i){var n=new Array(Si),r=new Gi;r.nextBytes(n);var p=t-1-n.length,a=new Array(p),v=p-e.length-1,l;if(i===void 0&&(i=""),v<Si)return console.log("Error - data too large for key size."),null;for(l=0;l<v;l++)a[l]=0;var u=Ki(i);for(l=0;l<u.length;l++)a[l]=u.charCodeAt(l);for(a[v]=1,l=0;l<e.length;l++)a[l+v+1]=e.charCodeAt(l);var d=new Array(p);if(Ir(d,n)<0)return null;for(l=0;l<d.length;l++)a[l]^=d[l];var b=Array(Si);if(Ir(b,a)<0)return null;for(l=0;l<b.length;l++)n[l]^=b[l];var o=new String;for(o+=String.fromCharCode(0),l=0;l<n.length;l++)o+=String.fromCharCode(n[l]);for(l=0;l<a.length;l++)o+=String.fromCharCode(a[l]);return o}function kt(t,e){var i=t[e++];if(i>128){if(i!=129)return console.log("Error:  we lazily don't support keys bigger than 255 bytes.  It'd be easy to fix."),null;i=t[e++]}return[e,i]}function yi(t,e){var i;return e=e||0,t[e++]!=48?(console.log("Error:  public key should start with a sequence flag."),null):(i=kt(t,e),i||null)}function Uc(t,e){var i=new Uint8Array(t),n,r,p,a,v;if(r=yi(i,e),!r||(e=r[0],r=yi(i,e),!r))return null;if(e=r[0]+r[1],i[e++]!=3)return console.log("Error: expecting bit string next."),null;if(n=kt(i,e),!n)return null;if(e=n[0],i[e]!=0&&i[e+1]!=48)return console.log("Error: unexpected values in bit string."),null;if(r=yi(i,e+1),!r)return null;if(e=r[0],i[e++]!=2)return console.log("Error: expecting integer n next."),null;if(n=kt(i,e),!n)return null;for(e=n[0],p=new Array(n[1]),a=0;a<n[1];a++)p[a]=i[e+a];if(v=new Jt,v.n=new J(p),e+=n[1],i[e++]!=2)return console.log("Error: expecting integer e next."),null;if(n=kt(i,e),!n)return null;for(e=n[0],v.e=i[e++],a=1;a<n[1];a++)v.e<<=8,v.e|=i[e++];return v}function Bc(t,e){var i,n=[],r=Nc(t.n.bitLength()+7>>3,e);if(!r)return null;var p=new Array(r.length);for(i=0;i<r.length;i++)p[i]=r.charCodeAt(i);var a=new J(p),v=t.doPublic(a),l=v.toString(16);for(l.length&1&&(l="0"+l),i=0;i<l.length;i+=2)n[i/2]=parseInt(l.substring(i,i+2),16);return n}var qe,ye={QUIC_IMAGE_TYPE_INVALID:0,QUIC_IMAGE_TYPE_GRAY:1,QUIC_IMAGE_TYPE_RGB16:2,QUIC_IMAGE_TYPE_RGB24:3,QUIC_IMAGE_TYPE_RGB32:4,QUIC_IMAGE_TYPE_RGBA:5},Fc=3,jc=6,Hc=2048,Pr=!0,Tr=26,mn=Fc,Ve=jc,ot=Hc,Gc={nGRcodewords:[0,0,0,0,0,0,0,0],notGRcwlen:[0,0,0,0,0,0,0,0],notGRprefixmask:[0,0,0,0,0,0,0,0],notGRsuffixlen:[0,0,0,0,0,0,0,0],xlatU2L:[0,0,0,0,0,0,0,0],xlatL2U:[0,0,0,0,0,0,0,0]},me={nGRcodewords:[0,0,0,0,0,0,0,0],notGRcwlen:[0,0,0,0,0,0,0,0],notGRprefixmask:[0,0,0,0,0,0,0,0],notGRsuffixlen:[0,0,0,0,0,0,0,0],xlatU2L:[0,0,0,0,0,0,0,0],xlatL2U:[0,0,0,0,0,0,0,0]},Ae=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535,131071,262143,524287,1048575,2097151,4194303,8388607,16777215,33554431,67108863,134217727,268435455,536870911,1073741823,2147483647,4294967295],vn=[],Kc=[[550,900,800,700,500,350,300,200,180,180,160],[110,550,900,800,550,400,350,250,140,160,140],[100,120,550,900,700,500,400,300,220,250,160]],Pi=[0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,7,7,8,9,10,11,12,13,14,15],Lt=[8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Yc=[46495042,893548311,794435923,2453991765,2077388039,894197842,1462934312,697534094,1826128012,343623392,2581292719,3811265708,459739748,2638427270,1654964626,101227083,2654850628,3668700691,572794346,2758751005,3445133904,2344099199,3367450297,898927923,3618406352,1606297603,754696453,20823118,2050458127,972590750,3990194068,3305596553,4239238564,1690498157,3015324227,2306127097,1510321853,548392192,971157512,2292288069,1611390505,4086766286,4084927083,1883326811,1891043243,113180603,1107690783,3778825955,3248980775,2443839100,2190866218,1932072870,495393613,1078522166,4051963518,1784694977,1768732442,2146763203,264646923,1474361405,2361552500,296035746,2489922759,2094565616,2409465348,1334241083,72483606,3740181004,4057920662,1734898312,4114662834,574624900,880305546,3258472262,26713132,1571648456,52557195,4043234286,2458021343,676064371,1528437109,64953873,546717185,2709319979,1947039598,2812723004,28691684,286829174,4235176970,3465707163,12526951,2154766700,3165032534,2036061161,3386656087,2301212354,2023576300,1061142336,3105452904,2743866805,3283373992,3397596080,3085489552,3196092395,3210707808,3651022684,925444321,2088074316,230011220,3223248386,533229176,523863486,3028311159,13140218,2538347282,900399636,3000796173,1526771255,3541282854,2992674461,2135722105,389334227,1225164337,3119947809,1803959919,3471171263,704170491,1407019136,1924534819,526887421,168782227,333811993,298623278,4268451686,381087740,2542899140,3266880867,2498950977,200969370,3511909096,3252303004,2268881098,2499828613,2606499854,3163208665,3790254546,1840025712,1319758833,3771674836,519421307,3512796222,1563402978,4284300462,2263719815,715250337,3178437172,2660191010,2982332026,3256309961,2709659997,3434092872,2367065591,69438718,915160508,183164069,3134331940,175242981,2680543346,1421955782,4231173251,1736652874,3990568476,1710820912,2286604440,3464587098,1261907837,1757387321,1128554270,1090050251,2429922486,1288729218,882830086,211637042,1376462063,2147615815,1737974929,798170275,4271572277,4241687072,1638524620,2760366295,1065115089,2097227717,1224023317,1625204849,3383303351,1488272307,2640186157,1649047732,819719707,2615091943,502645401,760628135,4108137983,63606742,1404337880,1865161130,4272996852,1239761976,790984678,3213322601,1917062825,4195069880,1962259360,2111002573,2311983960,1861406170,511141875,2797510619,1331661048,3130608186,147483493,3767089176,2650841450,4096523407,2574446300,1956416337,851468126,3607527519,1811658703,3642821136,832691095,2453312857,933732854,94341217,3393797730,1695907457,2405722077,2877685663,2469507058,2249636341,3988608661,4001245617,825934927,3103985967,1127151177,3691656896,1640967098,2168932645,2830550957,3998822878,3002602893,1509651465,775813869,2599574079,3791574229],ne=3,Te=2,Le=1,Me=0,oe=4;function Lr(t){if(t===1)return 0;var e=1;for(t-=1;t=t>>>1;)e++;return e}function Mr(t,e,i){var n;for(n=0;n<e;n++){var r,p;r=i-e,r>Ae[e-n]&&(r=Ae[e-n]),p=Ae[e]+1-(r<<n),t.nGRcodewords[n]=r<<n,t.notGRcwlen[n]=r+Lr(p),t.notGRprefixmask[n]=Ae[32-r]>>>0,t.notGRsuffixlen[n]=Lr(p)}var a=Ae[e],v=a>>>1,l;for(l=0;l<=a;l++)l<=v?t.xlatU2L[l]=l<<1:t.xlatU2L[l]=(a-l<<1)+1;for(l=0;l<=a;l++)l&1?t.xlatL2U[l]=a-(l>>>1):t.xlatL2U[l]=l>>>1}function qc(t){switch(t){case ye.QUIC_IMAGE_TYPE_GRAY:return 8;case ye.QUIC_IMAGE_TYPE_RGB16:return 5;case ye.QUIC_IMAGE_TYPE_RGB24:return 8;case ye.QUIC_IMAGE_TYPE_RGB32:return 8;case ye.QUIC_IMAGE_TYPE_RGBA:return 8;case ye.QUIC_IMAGE_TYPE_INVALID:default:return console.log(`quic: bad image type
`),0}}function zc(t){return t&4286578688?Lt[t>>>24]:t&4294934528?8+Lt[t>>>16&255]:t&4294967168?16+Lt[t>>>8&255]:24+Lt[t&255]}function ke(t,e){var i,n;if(e<0||e>me.notGRprefixmask[t]){var r=zc(e);n=r+1+t,i=r<<t|e>>32-n&Ae[t]}else n=me.notGRcwlen[t],i=me.nGRcodewords[t]+(e>>32-n&Ae[me.notGRsuffixlen[t]]);return{codewordlen:n,rc:i}}function Rr(t,e){return t<me.nGRcodewords[e]?(t>>>e)+1+e:me.notGRcwlen[e]}function Ti(t){var e,i=0;switch(this.levels=1<<t,this.n_buckets_ptrs=0,mn){case 1:this.repfirst=3,this.firstsize=1,this.repnext=2,this.mulsize=2;break;case 3:this.repfirst=1,this.firstsize=1,this.repnext=1,this.mulsize=2;break;case 5:this.repfirst=1,this.firstsize=1,this.repnext=1,this.mulsize=4;break;case 0:case 2:case 4:console.log(`quic: findmodelparams(): evol value obsolete!!!
`);break;default:console.log(`quic: findmodelparams(): evol out of range!!!
`)}this.n_buckets=0;var n=this.repfirst+1,r=this.firstsize;do this.n_buckets?e=i+1:e=0,--n||(n=this.repnext,r*=this.mulsize),i=e+r-1,i+r>=this.levels&&(i=this.levels-1),this.n_buckets_ptrs||(this.n_buckets_ptrs=this.levels),this.n_buckets++;while(i<this.levels-1)}Ti.prototype={n_buckets:0,n_buckets_ptrs:0,repfirst:0,firstsize:0,repnext:0,mulsize:0,levels:0};function gn(){this.counters=[0,0,0,0,0,0,0,0]}gn.prototype={bestcode:0,reste:function(t){this.bestcode=t,this.counters=[0,0,0,0,0,0,0,0]},update_model_8bpc:function(t,e,i){var n,r=i-1,p=this.counters[r]+=Rr(e,r);for(n=i-2;n>=0;n--){var a=this.counters[n]+=Rr(e,n);a<p&&(r=n,p=a)}if(this.bestcode=r,p>t.wm_trigger)for(n=0;n<i;n++)this.counters[n]=this.counters[n]>>>1}};function Li(){this.buckets_ptrs=[],this.buckets_buf=[]}Li.prototype={fill_model_structures:function(t){var e,i=0,n=0,r=t.repfirst+1,p=t.firstsize;do{n?e=i+1:e=0,--r||(r=t.repnext,p*=t.mulsize),i=e+p-1,i+p>=t.levels&&(i=t.levels-1),this.buckets_buf[n]=new gn;var a;for(a=e;a<=i;a++)this.buckets_ptrs[a]=this.buckets_buf[n];n++}while(i<t.levels-1);return!0}};function bn(t,e){this.state=new Yi,this.family_stat_8bpc=new Li,this.family_stat_5bpc=new Li,this.correlate_row={zero:0,row:[]},this.model_8bpc=t,this.model_5bpc=e,this.buckets_ptrs=[],this.family_stat_8bpc.fill_model_structures(this.model_8bpc)&&this.family_stat_5bpc.fill_model_structures(this.model_5bpc)}bn.prototype={reste:function(t){var e;if(this.correlate_row={zero:0,row:[]},t==8){for(e=0;e<this.model_8bpc.n_buckets;e++)this.family_stat_8bpc.buckets_buf[e].reste(7);this.buckets_ptrs=this.family_stat_8bpc.buckets_ptrs}else if(t==5){for(e=0;e<this.model_5bpc.n_buckets;e++)this.family_stat_8bpc.buckets_buf[e].reste(4);this.buckets_ptrs=this.family_stat_5bpc.buckets_ptrs}else return console.log(`quic: %s: bad bpc %d
`,__FUNCTION__,t),!1;return this.state.reste(),!0}};function Yi(){}Yi.prototype={waitcnt:0,tabrand_seed:255,wm_trigger:0,wmidx:0,wmileft:ot,melcstate:0,melclen:0,melcorder:0,set_wm_trigger:function(){var t=this.wmidx;t>10&&(t=10),this.wm_trigger=Kc[Math.floor(mn/2)][t]},reste:function(){this.waitcnt=0,this.tabrand_seed=255,this.wmidx=0,this.wmileft=ot,this.set_wm_trigger(),this.melcstate=0,this.melclen=Pi[0],this.melcorder=1<<this.melclen},tabrand:function(){return this.tabrand_seed++,Yc[this.tabrand_seed&255]}};function ve(){this.rgb_state=new Yi,this.model_8bpc=new Ti(8),this.model_5bpc=new Ti(5),this.channels=[];var t;for(t=0;t<4;t++)if(this.channels[t]=new bn(this.model_8bpc,this.model_5bpc),!this.channels[t]){console.log("quic: failed to create channel");return}}ve.prototype={type:0,width:0,height:0,io_idx:0,io_available_bits:0,io_word:0,io_next_word:0,io_now:0,io_end:0,rows_completed:0};ve.prototype.reste=function(t){return this.rgb_state.reste(),this.io_now=t,this.io_end=this.io_now.length,this.io_idx=0,this.rows_completed=0,!0};ve.prototype.read_io_word=function(){if(this.io_idx>=this.io_end)throw"quic: out of data";this.io_next_word=this.io_now[this.io_idx++]|this.io_now[this.io_idx++]<<8|this.io_now[this.io_idx++]<<16|this.io_now[this.io_idx++]<<24};ve.prototype.decode_eatbits=function(t){this.io_word=this.io_word<<t;var e=this.io_available_bits-t;e>=0?(this.io_available_bits=e,this.io_word|=this.io_next_word>>>this.io_available_bits):(e=-1*e,this.io_word|=this.io_next_word<<e,this.read_io_word(),this.io_available_bits=32-e,this.io_word|=this.io_next_word>>>this.io_available_bits)};ve.prototype.decode_eat32bits=function(){this.decode_eatbits(16),this.decode_eatbits(16)};ve.prototype.reste_channels=function(t){var e;for(e=0;e<4;e++)if(!this.channels[e].reste(t))return!1;return!0};ve.prototype.quic_decode_begin=function(t){if(!this.reste(t))return!1;this.io_idx=0,this.io_next_word=this.io_now[this.io_idx++]|this.io_now[this.io_idx++]<<8|this.io_now[this.io_idx++]<<16|this.io_now[this.io_idx++]<<24,this.io_word=this.io_next_word,this.io_available_bits=0;var e=this.io_word;if(this.decode_eat32bits(),e!=1128879441)return console.log("quic: bad magic "+e.toString(16)),!1;var i=this.io_word;if(this.decode_eat32bits(),i!=0)return console.log("quic: bad version "+i.toString(16)),!1;this.type=this.io_word,this.decode_eat32bits(),this.width=this.io_word,this.decode_eat32bits(),this.height=this.io_word,this.decode_eat32bits();var n=qc(this.type);return!!this.reste_channels(n)};ve.prototype.quic_rgb32_uncompress_row0_seg=function(t,e,i,n,r,p){var a,v=3,l,u;if(t)a=t+this.rgb_state.waitcnt;else{e[ne]=0,l=0;do u=ke(this.channels[l].buckets_ptrs[this.channels[l].correlate_row.zero].bestcode,this.io_word),this.channels[l].correlate_row.row[0]=u.rc,e[2-l]=me.xlatL2U[u.rc]&255,this.decode_eatbits(u.codewordlen);while(++l<v);if(this.rgb_state.waitcnt)--this.rgb_state.waitcnt;else{this.rgb_state.waitcnt=this.rgb_state.tabrand()&n,l=0;do this.channels[l].buckets_ptrs[this.channels[l].correlate_row.zero].update_model_8bpc(this.rgb_state,this.channels[l].correlate_row.row[0],r);while(++l<v)}a=++t+this.rgb_state.waitcnt}for(;a<i;){for(;t<=a;t++){e[t*oe+ne]=0,l=0;do u=ke(this.channels[l].buckets_ptrs[this.channels[l].correlate_row.row[t-1]].bestcode,this.io_word),this.channels[l].correlate_row.row[t]=u.rc,e[t*oe+(2-l)]=me.xlatL2U[u.rc]+e[(t-1)*oe+(2-l)]&p,this.decode_eatbits(u.codewordlen);while(++l<v)}l=0;do this.channels[l].buckets_ptrs[this.channels[l].correlate_row.row[a-1]].update_model_8bpc(this.rgb_state,this.channels[l].correlate_row.row[a],r);while(++l<v);a=t+(this.rgb_state.tabrand()&n)}for(;t<i;t++){e[t*oe+ne]=0,l=0;do u=ke(this.channels[l].buckets_ptrs[this.channels[l].correlate_row.row[t-1]].bestcode,this.io_word),this.channels[l].correlate_row.row[t]=u.rc,e[t*oe+(2-l)]=me.xlatL2U[u.rc]+e[(t-1)*oe+(2-l)]&p,this.decode_eatbits(u.codewordlen);while(++l<v)}this.rgb_state.waitcnt=a-i};ve.prototype.quic_rgb32_uncompress_row0=function(t){for(var e=8,i=255,n=0,r=this.width;Ve>this.rgb_state.wmidx&&this.rgb_state.wmileft<=r;)this.rgb_state.wmileft&&(this.quic_rgb32_uncompress_row0_seg(n,t,n+this.rgb_state.wmileft,Ae[this.rgb_state.wmidx],e,i),n+=this.rgb_state.wmileft,r-=this.rgb_state.wmileft),this.rgb_state.wmidx++,this.rgb_state.set_wm_trigger(),this.rgb_state.wmileft=ot;r&&(this.quic_rgb32_uncompress_row0_seg(n,t,n+r,Ae[this.rgb_state.wmidx],e,i),Ve>this.rgb_state.wmidx&&(this.rgb_state.wmileft-=r))};ve.prototype.quic_rgb32_uncompress_row_seg=function(t,e,i,n,r,p){var a=3,v=Ae[this.rgb_state.wmidx],l,u=0,d=0,b=0,o;if(i)d=i+this.rgb_state.waitcnt;else{e[ne]=0,o=0;do l=ke(this.channels[o].buckets_ptrs[this.channels[o].correlate_row.zero].bestcode,this.io_word),this.channels[o].correlate_row.row[0]=l.rc,e[2-o]=me.xlatL2U[this.channels[o].correlate_row.row[0]]+t[2-o]&p,this.decode_eatbits(l.codewordlen);while(++o<a);if(this.rgb_state.waitcnt)--this.rgb_state.waitcnt;else{this.rgb_state.waitcnt=this.rgb_state.tabrand()&v,o=0;do this.channels[o].buckets_ptrs[this.channels[o].correlate_row.zero].update_model_8bpc(this.rgb_state,this.channels[o].correlate_row.row[0],r);while(++o<a)}d=++i+this.rgb_state.waitcnt}for(;;){for(var c=0;d<n&&!c;){for(;i<=d&&!c;i++){var f=i*oe,h=(i-1)*oe,_=(i-2)*oe;if(t[h+Te]==t[f+Te]&&t[h+Le]==t[f+Le]&&t[h+Me]==t[f+Me]&&u!=i&&i>2&&e[h+Te]==e[_+Te]&&e[h+Le]==e[_+Le]&&e[h+Me]==e[_+Me]){for(this.rgb_state.waitcnt=d-i,u=i,b=i+this.decode_run(this.rgb_state);i<b;i++){var f=i*oe,h=(i-1)*oe;e[f+ne]=0,e[f+Te]=e[h+Te],e[f+Le]=e[h+Le],e[f+Me]=e[h+Me]}if(i==n)return;d=i+this.rgb_state.waitcnt,c=1;break}o=0,e[f+ne]=0;do{var s=this.channels[o],g=s.correlate_row;l=ke(s.buckets_ptrs[g.row[i-1]].bestcode,this.io_word),g.row[i]=l.rc,e[f+(2-o)]=me.xlatL2U[l.rc]+(e[h+(2-o)]+t[f+(2-o)]>>1)&p,this.decode_eatbits(l.codewordlen)}while(++o<a)}if(c)break;o=0;do this.channels[o].buckets_ptrs[this.channels[o].correlate_row.row[d-1]].update_model_8bpc(this.rgb_state,this.channels[o].correlate_row.row[d],r);while(++o<a);d=i+(this.rgb_state.tabrand()&v)}for(;i<n&&!c;i++){var f=i*oe,h=(i-1)*oe,_=(i-2)*oe;if(t[h+Te]==t[f+Te]&&t[h+Le]==t[f+Le]&&t[h+Me]==t[f+Me]&&u!=i&&i>2&&e[h+Te]==e[_+Te]&&e[h+Le]==e[_+Le]&&e[h+Me]==e[_+Me]){for(this.rgb_state.waitcnt=d-i,u=i,b=i+this.decode_run(this.rgb_state);i<b;i++){var f=i*oe,h=(i-1)*oe;e[f+ne]=0,e[f+Te]=e[h+Te],e[f+Le]=e[h+Le],e[f+Me]=e[h+Me]}if(i==n)return;d=i+this.rgb_state.waitcnt,c=1;break}e[f+ne]=0,o=0;do l=ke(this.channels[o].buckets_ptrs[this.channels[o].correlate_row.row[i-1]].bestcode,this.io_word),this.channels[o].correlate_row.row[i]=l.rc,e[f+(2-o)]=me.xlatL2U[l.rc]+(e[h+(2-o)]+t[f+(2-o)]>>1)&p,this.decode_eatbits(l.codewordlen);while(++o<a)}if(!c){this.rgb_state.waitcnt=d-n;return}}};ve.prototype.decode_run=function(t){var e=0;do{var i,n=~(this.io_word>>>24)>>>0&255,r=vn[n];for(i=1;i<=r;i++)e+=t.melcorder,t.melcstate<32&&(t.melclen=Pi[++t.melcstate],t.melcorder=1<<t.melclen);if(r!=8){this.decode_eatbits(r+1);break}this.decode_eatbits(8)}while(!0);return t.melclen&&(e+=this.io_word>>>32-t.melclen,this.decode_eatbits(t.melclen)),t.melcstate&&(t.melclen=Pi[--t.melcstate],t.melcorder=1<<t.melclen),e};ve.prototype.quic_rgb32_uncompress_row=function(t,e){for(var i=8,n=255,r=0,p=this.width;Ve>this.rgb_state.wmidx&&this.rgb_state.wmileft<=p;)this.rgb_state.wmileft&&(this.quic_rgb32_uncompress_row_seg(t,e,r,r+this.rgb_state.wmileft,i,n),r+=this.rgb_state.wmileft,p-=this.rgb_state.wmileft),this.rgb_state.wmidx++,this.rgb_state.set_wm_trigger(),this.rgb_state.wmileft=ot;p&&(this.quic_rgb32_uncompress_row_seg(t,e,r,r+p,i,n),Ve>this.rgb_state.wmidx&&(this.rgb_state.wmileft-=p))};ve.prototype.quic_four_uncompress_row0_seg=function(t,e,i,n,r,p,a,v){var l,u;for(e==0?(u=ke(t.buckets_ptrs[i.zero].bestcode,this.io_word),i.row[0]=u.rc,n[ne]=me.xlatL2U[u.rc],this.decode_eatbits(u.codewordlen),t.state.waitcnt?--t.state.waitcnt:(t.state.waitcnt=t.state.tabrand()&p,t.buckets_ptrs[i.zero].update_model_8bpc(t.state,i.row[0],a)),l=++e+t.state.waitcnt):l=e+t.state.waitcnt;l<r;){for(var d;e<=l;e++)d=t.buckets_ptrs[i.row[e-1]],u=ke(d.bestcode,this.io_word),i.row[e]=u.rc,n[e*oe+ne]=me.xlatL2U[u.rc]+n[(e-1)*oe+ne]&v,this.decode_eatbits(u.codewordlen);d.update_model_8bpc(t.state,i.row[l],a),l=e+(t.state.tabrand()&p)}for(;e<r;e++)u=ke(t.buckets_ptrs[i.row[e-1]].bestcode,this.io_word),i.row[e]=u.rc,n[e*oe+ne]=me.xlatL2U[u.rc]+n[(e-1)*oe+ne]&v,this.decode_eatbits(u.codewordlen);t.state.waitcnt=l-r};ve.prototype.quic_four_uncompress_row0=function(t,e){for(var i=8,n=255,r=t.correlate_row,p=0,a=this.width;Ve>t.state.wmidx&&t.state.wmileft<=a;)t.state.wmileft&&(this.quic_four_uncompress_row0_seg(t,p,r,e,p+t.state.wmileft,Ae[t.state.wmidx],i,n),p+=t.state.wmileft,a-=t.state.wmileft),t.state.wmidx++,t.state.set_wm_trigger(),t.state.wmileft=ot;a&&(this.quic_four_uncompress_row0_seg(t,p,r,e,p+a,Ae[t.state.wmidx],i,n),Ve>t.state.wmidx&&(t.state.wmileft-=a))};ve.prototype.quic_four_uncompress_row_seg=function(t,e,i,n,r,p,a,v){var l=Ae[t.state.wmidx],u,d=0,b,o;for(r==0?(o=ke(t.buckets_ptrs[e.zero].bestcode,this.io_word),e.row[0]=o.rc,n[ne]=me.xlatL2U[o.rc]+i[ne]&v,this.decode_eatbits(o.codewordlen),t.state.waitcnt?--t.state.waitcnt:(t.state.waitcnt=t.state.tabrand()&l,t.buckets_ptrs[e.zero].update_model_8bpc(t.state,e.row[0],a)),u=++r+t.state.waitcnt):u=r+t.state.waitcnt;;){for(var c=0;u<p&&!c;){for(var f;r<=u&&!c;r++){var h=r*oe,_=(r-1)*oe,s=(r-2)*oe;if(i[_+ne]==i[h+ne]&&d!=r&&r>2&&n[_+ne]==n[s+ne]){for(t.state.waitcnt=u-r,d=r,b=r+this.decode_run(t.state);r<b;r++){var h=r*oe,_=(r-1)*oe;n[h+ne]=n[_+ne]}if(r==p)return;u=r+t.state.waitcnt,c=1;break}f=t.buckets_ptrs[e.row[r-1]],o=ke(f.bestcode,this.io_word),e.row[r]=o.rc,n[h+ne]=me.xlatL2U[o.rc]+(n[_+ne]+i[h+ne]>>1)&v,this.decode_eatbits(o.codewordlen)}if(c)break;f.update_model_8bpc(t.state,e.row[u],a),u=r+(t.state.tabrand()&l)}for(;r<p&&!c;r++){var h=r*oe,_=(r-1)*oe,s=(r-2)*oe;if(i[_+ne]==i[h+ne]&&d!=r&&r>2&&n[_+ne]==n[s+ne]){for(t.state.waitcnt=u-r,d=r,b=r+this.decode_run(t.state);r<b;r++){var h=r*oe,_=(r-1)*oe;n[h+ne]=n[_+ne]}if(r==p)return;u=r+t.state.waitcnt,c=1;break}o=ke(t.buckets_ptrs[e.row[r-1]].bestcode,this.io_word),e.row[r]=o.rc,n[h+ne]=me.xlatL2U[o.rc]+(n[_+ne]+i[h+ne]>>1)&v,this.decode_eatbits(o.codewordlen)}if(!c){t.state.waitcnt=u-p;return}}};ve.prototype.quic_four_uncompress_row=function(t,e,i){for(var n=8,r=255,p=t.correlate_row,a=0,v=this.width;Ve>t.state.wmidx&&t.state.wmileft<=v;)t.state.wmileft&&(this.quic_four_uncompress_row_seg(t,p,e,i,a,a+t.state.wmileft,n,r),a+=t.state.wmileft,v-=t.state.wmileft),t.state.wmidx++,t.state.set_wm_trigger(),t.state.wmileft=ot;v&&(this.quic_four_uncompress_row_seg(t,p,e,i,a,a+v,n,r),Ve>t.state.wmidx&&(t.state.wmileft-=v))};ve.prototype.quic_decode=function(t,e){var i;switch(this.type){case ye.QUIC_IMAGE_TYPE_RGB32:case ye.QUIC_IMAGE_TYPE_RGB24:for(this.channels[0].correlate_row.zero=0,this.channels[1].correlate_row.zero=0,this.channels[2].correlate_row.zero=0,this.quic_rgb32_uncompress_row0(t),this.rows_completed++,i=1;i<this.height;i++){var n=t;t=n.subarray(e),this.channels[0].correlate_row.zero=this.channels[0].correlate_row.row[0],this.channels[1].correlate_row.zero=this.channels[1].correlate_row.row[0],this.channels[2].correlate_row.zero=this.channels[2].correlate_row.row[0],this.quic_rgb32_uncompress_row(n,t),this.rows_completed++}break;case ye.QUIC_IMAGE_TYPE_RGB16:return console.log(`quic: unsupported output format
`),!1;case ye.QUIC_IMAGE_TYPE_RGBA:for(this.channels[0].correlate_row.zero=0,this.channels[1].correlate_row.zero=0,this.channels[2].correlate_row.zero=0,this.quic_rgb32_uncompress_row0(t),this.channels[3].correlate_row.zero=0,this.quic_four_uncompress_row0(this.channels[3],t),this.rows_completed++,i=1;i<this.height;i++){var n=t;t=n.subarray(e),this.channels[0].correlate_row.zero=this.channels[0].correlate_row.row[0],this.channels[1].correlate_row.zero=this.channels[1].correlate_row.row[0],this.channels[2].correlate_row.zero=this.channels[2].correlate_row.row[0],this.quic_rgb32_uncompress_row(n,t),this.channels[3].correlate_row.zero=this.channels[3].correlate_row.row[0],this.quic_four_uncompress_row(qe.channels[3],n,t),this.rows_completed++}break;case ye.QUIC_IMAGE_TYPE_GRAY:return console.log(`quic: unsupported output format
`),!1;case ye.QUIC_IMAGE_TYPE_INVALID:default:return console.log(`quic: bad image type
`),!1}return!0};ve.prototype.simple_quic_decode=function(t){var e=4;if(this.quic_decode_begin(t)&&!(this.type!=ye.QUIC_IMAGE_TYPE_RGB32&&this.type!=ye.QUIC_IMAGE_TYPE_RGB24&&this.type!=ye.QUIC_IMAGE_TYPE_RGBA)){var i=new Uint8Array(this.width*this.height*4);if(i[0]=69,this.quic_decode(i,this.width*e))return i}};function Sn(){}Sn.prototype={from_dv:function(t,e,i){if(!qe)throw"quic: no quic encoder";this.data_size=t.getUint32(e,!0),e+=4;var n=new Uint8Array(i.slice(e));return this.outptr=qe.simple_quic_decode(n),this.outptr&&(this.type=qe.type,this.width=qe.width,this.height=qe.height),e+=n.length,e}};function Wc(t,e){var i=t.createImageData(e.width,e.height),n;for(n=0;n<i.width*i.height*4;n+=4)i.data[n+0]=e.outptr[n+2],i.data[n+1]=e.outptr[n+1],i.data[n+2]=e.outptr[n+0],e.type!==ye.QUIC_IMAGE_TYPE_RGBA?i.data[n+3]=255:i.data[n+3]=255-e.outptr[n+3];return i}if(Pr){Pr=!1,Mr(me,8,Tr),Mr(Gc,5,Tr);var Mt,Ci,Rt,Ei;for(Ci=Rt=1,Ei=8,Mt=0;Mt<256;++Mt)vn[Mt]=Ei,--Rt,Rt==0&&(Rt=Ci,--Ei,Ci*=2);if(qe=new ve,!qe)throw"quic: failed to create encoder"}function yn(){}yn.prototype={from_dv:function(t,e,i){return this.type=t.getUint8(e,!0),e++,this.id=t.getUint8(e,!0),e++,e}};function tt(){}tt.prototype={from_dv:function(t,e,i){return this.top=t.getUint32(e,!0),e+=4,this.left=t.getUint32(e,!0),e+=4,this.bottom=t.getUint32(e,!0),e+=4,this.right=t.getUint32(e,!0),e+=4,e},is_same_size:function(t){return this.bottom-this.top==t.bottom-t.top&&this.right-this.left==t.right-t.left}};function Cn(){}Cn.prototype={from_dv:function(t,e,i){var n;for(this.num_rects=t.getUint32(e,!0),e+=4,this.num_rects>0&&(this.rects=[]),n=0;n<this.num_rects;n++)this.rects[n]=new tt,e=this.rects[n].from_dv(t,e,i);return e}};function ei(){}ei.prototype={from_dv:function(t,e,i){return this.type=t.getUint8(e,!0),e++,this.type==D.SPICE_CLIP_TYPE_RECTS&&(this.rects=new Cn,e=this.rects.from_dv(t,e,i)),e}};function En(){}En.prototype={from_dv:function(t,e,i){return this.id=t.getUint64(e,!0),e+=8,this.type=t.getUint8(e,!0),e++,this.flags=t.getUint8(e,!0),e++,this.width=t.getUint32(e,!0),e+=4,this.height=t.getUint32(e,!0),e+=4,e}};function wn(){}wn.prototype={from_dv:function(t,e,i){var n;for(this.unique=t.getUint64(e,!0),e+=8,this.num_ents=t.getUint16(e,!0),e+=2,this.ents=[],n=0;n<this.num_ents;n++)this.ents[n]=t.getUint32(e,!0),e+=4;return e}};function xn(){}xn.prototype={from_dv:function(t,e,i){if(this.format=t.getUint8(e,!0),e++,this.flags=t.getUint8(e,!0),e++,this.x=t.getUint32(e,!0),e+=4,this.y=t.getUint32(e,!0),e+=4,this.stride=t.getUint32(e,!0),e+=4,this.flags&D.SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)this.palette_id=t.getUint64(e,!0),e+=8;else{var n=t.getUint32(e,!0);e+=4,n==0?this.palette=null:(this.palette=new wn,this.palette.from_dv(t,n,i))}return this.data=i.slice(e),e+=this.data.byteLength,e}};function ti(){}ti.prototype={from_dv:function(t,e,i){if(this.descriptor=new En,e=this.descriptor.from_dv(t,e,i),this.descriptor.type==D.SPICE_IMAGE_TYPE_LZ_RGB){this.lz_rgb=new Object,this.lz_rgb.length=t.getUint32(e,!0),e+=4;var n=e;this.lz_rgb.magic="";for(var r=3;r>=0;r--)this.lz_rgb.magic+=String.fromCharCode(t.getUint8(e+r));e+=4,this.lz_rgb.version=t.getUint32(e),e+=4,this.lz_rgb.type=t.getUint32(e),e+=4,this.lz_rgb.width=t.getUint32(e),e+=4,this.lz_rgb.height=t.getUint32(e),e+=4,this.lz_rgb.stride=t.getUint32(e),e+=4,this.lz_rgb.top_down=t.getUint32(e),e+=4;var p=e-n;this.lz_rgb.data=i.slice(e,this.lz_rgb.length+e-p),e+=this.lz_rgb.data.byteLength}if(this.descriptor.type==D.SPICE_IMAGE_TYPE_BITMAP&&(this.bitmap=new xn,e=this.bitmap.from_dv(t,e,i)),this.descriptor.type==D.SPICE_IMAGE_TYPE_SURFACE&&(this.surface_id=t.getUint32(e,!0),e+=4),this.descriptor.type==D.SPICE_IMAGE_TYPE_JPEG&&(this.jpeg=new Object,this.jpeg.data_size=t.getUint32(e,!0),e+=4,this.jpeg.data=i.slice(e),e+=this.jpeg.data.byteLength),this.descriptor.type==D.SPICE_IMAGE_TYPE_JPEG_ALPHA){this.jpeg_alpha=new Object,this.jpeg_alpha.flags=t.getUint8(e,!0),e+=1,this.jpeg_alpha.jpeg_size=t.getUint32(e,!0),e+=4,this.jpeg_alpha.data_size=t.getUint32(e,!0),e+=4,this.jpeg_alpha.data=i.slice(e,this.jpeg_alpha.jpeg_size+e),e+=this.jpeg_alpha.data.byteLength,this.jpeg_alpha.alpha=new Object,this.jpeg_alpha.alpha.length=this.jpeg_alpha.data_size-this.jpeg_alpha.jpeg_size;var n=e;this.jpeg_alpha.alpha.magic="";for(var r=3;r>=0;r--)this.jpeg_alpha.alpha.magic+=String.fromCharCode(t.getUint8(e+r));e+=4,this.jpeg_alpha.alpha.version=t.getUint32(e),e+=4,this.jpeg_alpha.alpha.type=t.getUint32(e),e+=4,this.jpeg_alpha.alpha.width=t.getUint32(e),e+=4,this.jpeg_alpha.alpha.height=t.getUint32(e),e+=4,this.jpeg_alpha.alpha.stride=t.getUint32(e),e+=4,this.jpeg_alpha.alpha.top_down=t.getUint32(e),e+=4;var p=e-n;this.jpeg_alpha.alpha.data=i.slice(e,this.jpeg_alpha.alpha.length+e-p),e+=this.jpeg_alpha.alpha.data.byteLength}return this.descriptor.type==D.SPICE_IMAGE_TYPE_QUIC&&(this.quic=new Sn,e=this.quic.from_dv(t,e,i)),e}};function qi(){}qi.prototype={from_dv:function(t,e,i){this.flags=t.getUint8(e,!0),e++,this.pos=new ii,e=this.pos.from_dv(t,e,i);var n=t.getUint32(e,!0);return e+=4,n==0?(this.bitmap=null,e):(this.bitmap=new ti,this.bitmap.from_dv(t,n,i))}};function An(){}An.prototype={from_dv:function(t,e,i){var n=t.getUint32(e,!0);return e+=4,n==0?this.pat=null:(this.pat=new ti,this.pat.from_dv(t,n,i)),this.pos=new ii,this.pos.from_dv(t,e,i)}};function In(){}In.prototype={from_dv:function(t,e,i){return this.type=t.getUint8(e,!0),e++,this.type==D.SPICE_BRUSH_TYPE_SOLID?(this.color=t.getUint32(e,!0),e+=4):this.type==D.SPICE_BRUSH_TYPE_PATTERN&&(this.pattern=new An,e=this.pattern.from_dv(t,e,i)),e}};function Pn(){}Pn.prototype={from_dv:function(t,e,i){return this.brush=new In,e=this.brush.from_dv(t,e,i),this.rop_descriptor=t.getUint16(e,!0),e+=2,this.mask=new qi,this.mask.from_dv(t,e,i)}};function Tn(){}Tn.prototype={from_dv:function(t,e,i){var n=t.getUint32(e,!0);return e+=4,n==0?this.src_bitmap=null:(this.src_bitmap=new ti,this.src_bitmap.from_dv(t,n,i)),this.src_area=new tt,e=this.src_area.from_dv(t,e,i),this.rop_descriptor=t.getUint16(e,!0),e+=2,this.scale_mode=t.getUint8(e,!0),e++,this.mask=new qi,this.mask.from_dv(t,e,i)}};function zi(){}zi.prototype={from_dv:function(t,e,i){return this.x=t.getUint16(e,!0),e+=2,this.y=t.getUint16(e,!0),e+=2,e}};function ii(){}ii.prototype={from_dv:function(t,e,i){return this.x=t.getUint32(e,!0),e+=4,this.y=t.getUint32(e,!0),e+=4,e}};function Ln(){}Ln.prototype={from_dv:function(t,e,i){return this.unique=t.getUint64(e,!0),e+=8,this.type=t.getUint8(e,!0),e++,this.width=t.getUint16(e,!0),e+=2,this.height=t.getUint16(e,!0),e+=2,this.hot_spot_x=t.getUint16(e,!0),e+=2,this.hot_spot_y=t.getUint16(e,!0),e+=2,e}};function Wi(){}Wi.prototype={from_dv:function(t,e,i){return this.flags=t.getUint16(e,!0),e+=2,this.flags&D.SPICE_CURSOR_FLAGS_NONE?this.header=null:(this.header=new Ln,e=this.header.from_dv(t,e,i),this.data=i.slice(e),e+=this.data.byteLength),e}};function Mn(){}Mn.prototype={from_dv:function(t,e,i){return this.surface_id=t.getUint32(e,!0),e+=4,this.width=t.getUint32(e,!0),e+=4,this.height=t.getUint32(e,!0),e+=4,this.format=t.getUint32(e,!0),e+=4,this.flags=t.getUint32(e,!0),e+=4,e}};var H={KEY_Escape:1,KEY_1:2,KEY_2:3,KEY_3:4,KEY_4:5,KEY_5:6,KEY_6:7,KEY_7:8,KEY_8:9,KEY_9:10,KEY_0:11,KEY_Minus:12,KEY_Equal:13,KEY_BackSpace:14,KEY_Tab:15,KEY_Q:16,KEY_W:17,KEY_E:18,KEY_R:19,KEY_T:20,KEY_Y:21,KEY_U:22,KEY_I:23,KEY_O:24,KEY_P:25,KEY_LBrace:26,KEY_RBrace:27,KEY_Enter:28,KEY_LCtrl:29,KEY_A:30,KEY_S:31,KEY_D:32,KEY_F:33,KEY_G:34,KEY_H:35,KEY_J:36,KEY_K:37,KEY_L:38,KEY_SemiColon:39,KEY_Quote:40,KEY_Tilde:41,KEY_ShiftL:42,KEY_BSlash:43,KEY_Z:44,KEY_X:45,KEY_C:46,KEY_V:47,KEY_B:48,KEY_N:49,KEY_M:50,KEY_Comma:51,KEY_Period:52,KEY_Slash:53,KEY_ShiftR:54,KEY_KP_Multiply:55,KEY_Alt:56,KEY_Space:57,KEY_CapsLock:58,KEY_F1:59,KEY_F2:60,KEY_F3:61,KEY_F4:62,KEY_F5:63,KEY_F6:64,KEY_F7:65,KEY_F8:66,KEY_F9:67,KEY_F10:68,KEY_NumLock:69,KEY_ScrollLock:70,KEY_KP_7:71,KEY_KP_8:72,KEY_KP_9:73,KEY_KP_Minus:74,KEY_KP_4:75,KEY_KP_5:76,KEY_KP_6:77,KEY_KP_Plus:78,KEY_KP_1:79,KEY_KP_2:80,KEY_KP_3:81,KEY_KP_0:82,KEY_KP_Decimal:83,KEY_SysRequest:84,KEY_Less:86,KEY_F11:87,KEY_F12:88,KEY_Prefix0:96,KEY_Prefix1:97};const F=[];F.Escape=1;F.Digit1=2;F.Digit2=3;F.Digit3=4;F.Digit4=5;F.Digit5=6;F.Digit6=7;F.Digit7=8;F.Digit8=9;F.Digit9=10;F.Digit0=11;F.Minus=12;F.Equal=13;F.Backspace=14;F.Tab=15;F.KeyQ=16;F.KeyW=17;F.KeyE=18;F.KeyR=19;F.KeyT=20;F.KeyY=21;F.KeyU=22;F.KeyI=23;F.KeyO=24;F.KeyP=25;F.BracketLeft=26;F.BracketRight=27;F.Enter=28;F.ControlLeft=29;F.KeyA=30;F.KeyS=31;F.KeyD=32;F.KeyF=33;F.KeyG=34;F.KeyH=35;F.KeyJ=36;F.KeyK=37;F.KeyL=38;F.Semicolon=39;F.Quote=40;F.Backquote=41;F.ShiftLeft=42;F.Backslash=43;F.KeyZ=44;F.KeyX=45;F.KeyC=46;F.KeyV=47;F.KeyB=48;F.KeyN=49;F.KeyM=50;F.Comma=51;F.Period=52;F.Slash=53;F.ShiftRight=54;F.NumpadMultiply=55;F.AltLeft=56;F.Space=57;F.CapsLock=58;F.F1=59;F.F2=60;F.F3=61;F.F4=62;F.F5=63;F.F6=64;F.F7=65;F.F8=66;F.F9=67;F.F10=68;F.Pause=69;F.ScrollLock=70;F.Numpad7=71;F.Numpad8=72;F.Numpad9=73;F.NumpadSubtract=74;F.Numpad4=75;F.Numpad5=76;F.Numpad6=77;F.NumpadAdd=78;F.Numpad1=79;F.Numpad2=80;F.Numpad3=81;F.Numpad0=82;F.NumpadDecimal=83;F.PrintScreen=84;F.IntlBackslash=86;F.F11=87;F.F12=88;F.NumpadEqual=89;F.F13=100;F.F14=101;F.F15=102;F.F16=103;F.F17=104;F.F18=105;F.F19=106;F.F20=107;F.F21=108;F.F22=109;F.F23=110;F.KanaMode=112;F.IntlRo=115;F.F24=118;F.Convert=121;F.NonConvert=123;F.IntlYen=125;F.NumpadComma=126;F.MediaTrackPrevious=4320;F.MediaTrackNext=6624;F.NumpadEnter=7392;F.ControlRight=7648;F.AudioVolumeMute=8416;F.LaunchApp2=8672;F.MediaPlayPause=8928;F.MediaStop=9440;F.VolumeDown=12e3;F.VolumeUp=12512;F.BrowserHome=13024;F.NumpadDivide=13792;F.PrintScreen=14304;F.AltRight=14560;F.NumLock=17888;F.Pause=18144;F.Home=18400;F.ArrowUp=18656;F.PageUp=18912;F.ArrowLeft=19424;F.ArrowRight=19936;F.End=20448;F.ArrowDown=20704;F.PageDown=20960;F.Insert=21216;F.Delete=21472;F.MetaLeft=23520;F.MetaRight=23776;F.ContextMenu=24032;F.Power=24288;F.BrowserSearch=26080;F.BrowserFavorites=26336;F.BrowserRefresh=26592;F.BrowserStop=26848;F.BrowserForward=27104;F.BrowserBack=27360;F.LaunchApp1=27616;F.LaunchMail=27872;F.MediaSelect=28128;var Vc=0,Xc="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function $c(t,e){var i=new Uint8Array(t),n=new Uint8Array(e),r=new ArrayBuffer(t.byteLength+e.byteLength),p=new Uint8Array(r),a=0,v;for(v=0;v<i.length;v++)p[a++]=i[v];for(v=0;v<n.length;v++)p[a++]=n[v];return r}function Zc(t){return String.fromCharCode.apply(null,new Uint16Array(t))}var q=[];q["1".charCodeAt(0)]=H.KEY_1;q["2".charCodeAt(0)]=H.KEY_2;q["3".charCodeAt(0)]=H.KEY_3;q["4".charCodeAt(0)]=H.KEY_4;q["5".charCodeAt(0)]=H.KEY_5;q["6".charCodeAt(0)]=H.KEY_6;q["7".charCodeAt(0)]=H.KEY_7;q["8".charCodeAt(0)]=H.KEY_8;q["9".charCodeAt(0)]=H.KEY_9;q["0".charCodeAt(0)]=H.KEY_0;q[145]=H.KEY_ScrollLock;q[103]=H.KEY_KP_7;q[104]=H.KEY_KP_8;q[105]=H.KEY_KP_9;q[100]=H.KEY_KP_4;q[101]=H.KEY_KP_5;q[102]=H.KEY_KP_6;q[107]=H.KEY_KP_Plus;q[97]=H.KEY_KP_1;q[98]=H.KEY_KP_2;q[99]=H.KEY_KP_3;q[96]=H.KEY_KP_0;q[109]=H.KEY_Minus;q[110]=H.KEY_KP_Decimal;q[191]=H.KEY_Slash;q[190]=H.KEY_Period;q[188]=H.KEY_Comma;q[220]=H.KEY_BSlash;q[192]=H.KEY_Tilde;q[222]=H.KEY_Quote;q[219]=H.KEY_LBrace;q[221]=H.KEY_RBrace;q["Q".charCodeAt(0)]=H.KEY_Q;q["W".charCodeAt(0)]=H.KEY_W;q["E".charCodeAt(0)]=H.KEY_E;q["R".charCodeAt(0)]=H.KEY_R;q["T".charCodeAt(0)]=H.KEY_T;q["Y".charCodeAt(0)]=H.KEY_Y;q["U".charCodeAt(0)]=H.KEY_U;q["I".charCodeAt(0)]=H.KEY_I;q["O".charCodeAt(0)]=H.KEY_O;q["P".charCodeAt(0)]=H.KEY_P;q["A".charCodeAt(0)]=H.KEY_A;q["S".charCodeAt(0)]=H.KEY_S;q["D".charCodeAt(0)]=H.KEY_D;q["F".charCodeAt(0)]=H.KEY_F;q["G".charCodeAt(0)]=H.KEY_G;q["H".charCodeAt(0)]=H.KEY_H;q["J".charCodeAt(0)]=H.KEY_J;q["K".charCodeAt(0)]=H.KEY_K;q["L".charCodeAt(0)]=H.KEY_L;q["Z".charCodeAt(0)]=H.KEY_Z;q["X".charCodeAt(0)]=H.KEY_X;q["C".charCodeAt(0)]=H.KEY_C;q["V".charCodeAt(0)]=H.KEY_V;q["B".charCodeAt(0)]=H.KEY_B;q["N".charCodeAt(0)]=H.KEY_N;q["M".charCodeAt(0)]=H.KEY_M;q[" ".charCodeAt(0)]=H.KEY_Space;q[13]=H.KEY_Enter;q[27]=H.KEY_Escape;q[8]=H.KEY_BackSpace;q[9]=H.KEY_Tab;q[16]=H.KEY_ShiftL;q[17]=H.KEY_LCtrl;q[18]=H.KEY_Alt;q[20]=H.KEY_CapsLock;q[44]=H.KEY_SysReqest;q[144]=H.KEY_NumLock;q[112]=H.KEY_F1;q[113]=H.KEY_F2;q[114]=H.KEY_F3;q[115]=H.KEY_F4;q[116]=H.KEY_F5;q[117]=H.KEY_F6;q[118]=H.KEY_F7;q[119]=H.KEY_F8;q[120]=H.KEY_F9;q[121]=H.KEY_F10;q[122]=H.KEY_F11;q[123]=H.KEY_F12;q[42]=99;q[19]=101;q[111]=224|H.KEY_Slash<<8;q[106]=224|H.KEY_KP_Multiply<<8;q[36]=224|H.KEY_KP_7<<8;q[38]=224|H.KEY_KP_8<<8;q[33]=224|H.KEY_KP_9<<8;q[37]=224|H.KEY_KP_4<<8;q[39]=224|H.KEY_KP_6<<8;q[35]=224|H.KEY_KP_1<<8;q[40]=224|H.KEY_KP_2<<8;q[34]=224|H.KEY_KP_3<<8;q[45]=224|H.KEY_KP_0<<8;q[46]=224|H.KEY_KP_Decimal<<8;q[91]=23520;q[92]=23776;q[93]=24032;var ri=[];ri[173]=H.KEY_Minus;ri[61]=H.KEY_Equal;ri[59]=H.KEY_SemiColon;var ni=[];ni[189]=H.KEY_Minus;ni[187]=H.KEY_Equal;ni[186]=H.KEY_SemiColon;function Rn(t,e){return F[e]!==void 0?F[e]:q[t]===void 0?navigator.userAgent.indexOf("Firefox")!=-1?ri[t]:ni[t]:q[t]}function Qc(t,e){var i=Rn(t,e);return i===void 0?(alert("no map for "+t),0):i}function Jc(t,e){var i=Rn(t,e);return i===void 0?0:i<256?i|128:i|32768}function Dn(t){var e="[networkState "+t.networkState+"|readyState "+t.readyState+"|error "+t.error+"|seeking "+t.seeking+"|duration "+t.duration+"|paused "+t.paused+"|ended "+t.error+"|buffered "+el(t.buffered)+"]";return e}function el(t){var e;if(t){var i=t.length;e="{len "+i,i>0&&(e+="; start "+t.start(0)+"; end "+t.end(i-1)),e+="}"}else e="N/A";return e}function Bt(t,e){this.magic=D.SPICE_MAGIC,this.major_version=D.SPICE_VERSION_MAJOR,this.minor_version=D.SPICE_VERSION_MINOR,this.size=0,t!==void 0&&this.from_buffer(t,e)}Bt.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.magic="";for(var n=0;n<4;n++)this.magic+=String.fromCharCode(i.getUint8(e+n));e+=4,this.major_version=i.getUint32(e,!0),e+=4,this.minor_version=i.getUint32(e,!0),e+=4,this.size=i.getUint32(e,!0),e+=4},to_buffer:function(t,e){e=e||0;for(var i=new X(t),n=0;n<4;n++)i.setUint8(e+n,this.magic.charCodeAt(n));e+=4,i.setUint32(e,this.major_version,!0),e+=4,i.setUint32(e,this.minor_version,!0),e+=4,i.setUint32(e,this.size,!0),e+=4},buffer_size:function(){return 16}};function On(t,e){this.connection_id=0,this.channel_type=0,this.channel_id=0,this.common_caps=[],this.channel_caps=[],t!==void 0&&this.from_buffer(t,e)}On.prototype={from_buffer:function(t,e){e=e||0;var i,n=e,r=new X(t);this.connection_id=r.getUint32(e,!0),e+=4,this.channel_type=r.getUint8(e,!0),e++,this.channel_id=r.getUint8(e,!0),e++;var p=r.getUint32(e,!0);e+=4;var a=r.getUint32(e,!0);e+=4;var v=r.getUint32(e,!0);for(e+=4,e=n+v,this.common_caps=[],i=0;i<p;i++)this.common_caps.unshift(r.getUint32(e,!0)),e+=4;for(this.channel_caps=[],i=0;i<a;i++)this.channel_caps.unshift(r.getUint32(e,!0)),e+=4},to_buffer:function(t,e){e=e||0;var i=e,n,r=new X(t);for(r.setUint32(e,this.connection_id,!0),e+=4,r.setUint8(e,this.channel_type,!0),e++,r.setUint8(e,this.channel_id,!0),e++,r.setUint32(e,this.common_caps.length,!0),e+=4,r.setUint32(e,this.channel_caps.length,!0),e+=4,r.setUint32(e,e-i+4,!0),e+=4,n=0;n<this.common_caps.length;n++)r.setUint32(e,this.common_caps[n],!0),e+=4;for(n=0;n<this.channel_caps.length;n++)r.setUint32(e,this.channel_caps[n],!0),e+=4},buffer_size:function(){return 18+4*this.common_caps.length+4*this.channel_caps.length}};function kn(t,e){this.error=0,this.pub_key=void 0,this.common_caps=[],this.channel_caps=[],t!==void 0&&this.from_buffer(t,e)}kn.prototype={from_buffer:function(t,e){e=e||0;var i,n=e,r=new X(t);this.error=r.getUint32(e,!0),e+=4,this.pub_key=Uc(t,e),e+=D.SPICE_TICKET_PUBKEY_BYTES;var p=r.getUint32(e,!0);e+=4;var a=r.getUint32(e,!0);e+=4;var v=r.getUint32(e,!0);for(e+=4,e=n+v,this.common_caps=[],i=0;i<p;i++)this.common_caps.unshift(r.getUint32(e,!0)),e+=4;for(this.channel_caps=[],i=0;i<a;i++)this.channel_caps.unshift(r.getUint32(e,!0)),e+=4}};function Nn(t,e){this.auth_mechanism=0,this.encrypted_data=void 0}Nn.prototype={to_buffer:function(t,e){e=e||0;var i,n=new X(t);for(n.setUint32(e,this.auth_mechanism,!0),e+=4,i=0;i<D.SPICE_TICKET_KEY_PAIR_LENGTH/8;i++)this.encrypted_data&&i<this.encrypted_data.length?n.setUint8(e,this.encrypted_data[i],!0):n.setUint8(e,0,!0),e++},buffer_size:function(){return 4+D.SPICE_TICKET_KEY_PAIR_LENGTH/8}};function Mi(t,e){this.auth_code=0,t!==void 0&&this.from_buffer(t,e)}Mi.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.auth_code=i.getUint32(e,!0),e+=4},buffer_size:function(){return 4}};function fe(t,e){this.type=0,this.size=0,this.data=void 0,t!==void 0&&this.from_buffer(t,e)}fe.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.type=i.getUint16(e,!0),e+=2,this.size=i.getUint32(e,!0),e+=4,t.byteLength>e&&(this.data=t.slice(e),e+=this.data.byteLength)},to_buffer:function(t,e){e=e||0;var i,n=new X(t);if(n.setUint16(e,this.type,!0),e+=2,n.setUint32(e,this.data?this.data.byteLength:0,!0),e+=4,this.data&&this.data.byteLength>0){var r=new Uint8Array(this.data);for(i=0;i<r.length;i++,e++)n.setUint8(e,r[i],!0)}},build_msg:function(t,e){this.type=t,this.size=e.buffer_size(),this.data=new ArrayBuffer(this.size),e.to_buffer(this.data)},buffer_size:function(){return this.data?6+this.data.byteLength:6}};function Un(t,e){this.num_of_channels=0,this.channels=[],t!==void 0&&this.from_buffer(t,e)}Un.prototype={from_buffer:function(t,e){e=e||0;var i,n=new X(t);for(this.num_of_channels=n.getUint32(e,!0),e+=4,i=0;i<this.num_of_channels;i++){var r=new yn;e=r.from_dv(n,e,t),this.channels.push(r)}}};function Bn(t,e){this.from_buffer(t,e)}Bn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.session_id=i.getUint32(e,!0),e+=4,this.display_channels_hint=i.getUint32(e,!0),e+=4,this.supported_mouse_modes=i.getUint32(e,!0),e+=4,this.current_mouse_mode=i.getUint32(e,!0),e+=4,this.agent_connected=i.getUint32(e,!0),e+=4,this.agent_tokens=i.getUint32(e,!0),e+=4,this.multi_media_time=i.getUint32(e,!0),e+=4,this.ram_hint=i.getUint32(e,!0),e+=4}};function Fn(t,e){this.from_buffer(t,e)}Fn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.supported_modes=i.getUint16(e,!0),e+=2,this.current_mode=i.getUint16(e,!0),e+=2}};function jn(t,e){this.from_buffer(t,e)}jn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.protocol=i.getUint32(e,!0),e+=4,this.type=i.getUint32(e,!0),e+=4,this.opaque=i.getUint64(e,!0),e+=8,this.size=i.getUint32(e,!0),e+=4,t.byteLength>e&&(this.data=t.slice(e),e+=this.data.byteLength)}};function Ri(t,e){this.from_buffer(t,e)}Ri.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.num_tokens=i.getUint32(e,!0),e+=4}};function Hn(t,e){this.from_buffer(t,e)}Hn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.generation=i.getUint32(e,!0),e+=4,this.window=i.getUint32(e,!0),e+=4}};function Gn(t){this.generation=t.generation}Gn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.generation,!0),e+=4},buffer_size:function(){return 4}};function Kn(t){this.mode=t}Kn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint16(e,this.mode,!0),e+=2},buffer_size:function(){return 2}};function Yn(t){this.num_tokens=t}Yn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.num_tokens,!0),e+=4},buffer_size:function(){return 4}};function qn(t,e){this.protocol=D.VD_AGENT_PROTOCOL,this.type=t,this.opaque=0,this.size=e.buffer_size(),this.data=e}qn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.protocol,!0),e+=4,i.setUint32(e,this.type,!0),e+=4,i.setUint64(e,this.opaque,!0),e+=8,i.setUint32(e,this.size,!0),e+=4,this.data.to_buffer(t,e)},buffer_size:function(){return 4+4+8+4+this.data.buffer_size()}};function Vi(t,e){e?(this.request=t,this.caps=e):this.from_buffer(t)}Vi.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.request,!0),e+=4,i.setUint32(e,this.caps,!0),e+=4},from_buffer:function(t,e){e=e||0;var i=new X(t);return this.request=i.getUint32(e,!0),e+=4,this.caps=i.getUint32(e,!0),e+=4,e},buffer_size:function(){return 8}};function zn(t,e,i,n,r,p){this.num_mon=1,this.flags=t,this.width=e,this.height=i,this.depth=n,this.x=r,this.y=p}zn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.num_mon,!0),e+=4,i.setUint32(e,this.flags,!0),e+=4,i.setUint32(e,this.height,!0),e+=4,i.setUint32(e,this.width,!0),e+=4,i.setUint32(e,this.depth,!0),e+=4,i.setUint32(e,this.x,!0),e+=4,i.setUint32(e,this.y,!0),e+=4},buffer_size:function(){return 28}};function Xi(t,e){e?(this.id=t,this.result=e):this.from_buffer(t)}Xi.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.id,!0),e+=4,i.setUint32(e,this.result,!0),e+=4},from_buffer:function(t,e){e=e||0;var i=new X(t);return this.id=i.getUint32(e,!0),e+=4,this.result=i.getUint32(e,!0),e+=4,e},buffer_size:function(){return 8}};function Wn(t,e,i){this.id=t,this.string=`[vdagent-file-xfer]
name=`+e+`
size=`+i+`
`}Wn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint32(e,this.id,!0),e+=4;for(var n=0;n<this.string.length;n++,e++)i.setUint8(e,this.string.charCodeAt(n))},buffer_size:function(){return 4+this.string.length+1}};function Vn(t,e,i){this.id=t,this.size=e,this.data=i}Vn.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);if(i.setUint32(e,this.id,!0),e+=4,i.setUint64(e,this.size,!0),e+=8,this.data&&this.data.byteLength>0)for(var n=new Uint8Array(this.data),r=0;r<n.length;r++,e++)i.setUint8(e,n[r])},buffer_size:function(){return 12+this.size}};function Xn(t,e){this.from_buffer(t,e)}Xn.prototype={from_buffer:function(t,e){e=e||0;var i,n=new X(t);for(this.time_stamp=n.getUint64(e,!0),e+=8,this.severity=n.getUint32(e,!0),e+=4,this.visibility=n.getUint32(e,!0),e+=4,this.what=n.getUint32(e,!0),e+=4,this.message_len=n.getUint32(e,!0),e+=4,this.message="",i=0;i<this.message_len;i++){var r=n.getUint8(e,!0);e++,this.message+=String.fromCharCode(r)}}};function $n(){this.pixmap_cache_id=1,this.glz_dictionary_id=0,this.pixmap_cache_size=10*1024*1024,this.glz_dictionary_window_size=0}$n.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);i.setUint8(e,this.pixmap_cache_id,!0),e++,i.setUint64(e,this.pixmap_cache_size,!0),e+=8,i.setUint8(e,this.glz_dictionary_id,!0),e++,i.setUint32(e,this.glz_dictionary_window_size,!0),e+=4},buffer_size:function(){return 14}};function wt(){}wt.prototype={from_dv:function(t,e,i){return this.surface_id=t.getUint32(e,!0),e+=4,this.box=new tt,e=this.box.from_dv(t,e,i),this.clip=new ei,this.clip.from_dv(t,e,i)}};function Zn(t,e){this.from_buffer(t,e)}Zn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.base=new wt,e=this.base.from_dv(i,e,t),this.data=new Tn,this.data.from_dv(i,e,t)}};function Qn(t,e){this.from_buffer(t,e)}Qn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.base=new wt,e=this.base.from_dv(i,e,t),this.data=new Pn,this.data.from_dv(i,e,t)}};function Jn(t,e){this.from_buffer(t,e)}Jn.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.base=new wt,e=this.base.from_dv(i,e,t),this.src_pos=new ii,this.src_pos.from_dv(i,e,t)}};function es(t,e){this.from_buffer(t,e)}es.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.surface=new Mn,this.surface.from_dv(i,e,t)}};function ts(t,e){this.from_buffer(t,e)}ts.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.surface_id=i.getUint32(e,!0),e+=4}};function is(t,e){this.from_buffer(t,e)}is.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.keyboard_modifiers=i.getUint16(e,!0),e+=2,e}};function rs(t,e){this.from_buffer(t,e)}rs.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);return this.keyboard_modifiers=i.getUint16(e,!0),e+=2,e}};function ns(t,e){this.from_buffer(t,e)}ns.prototype={from_buffer:function(t,e,i){e=e||0;var n=new X(t);return this.position=new zi,e=this.position.from_dv(n,e,i),this.trail_length=n.getUint16(e,!0),e+=2,this.trail_frequency=n.getUint16(e,!0),e+=2,this.visible=n.getUint8(e,!0),e++,this.cursor=new Wi,this.cursor.from_dv(n,e,t)}};function ss(t,e){this.from_buffer(t,e)}ss.prototype={from_buffer:function(t,e,i){e=e||0;var n=new X(t);return this.time=n.getUint32(e,!0),e+=4,t.byteLength>e&&(this.data=t.slice(e),e+=this.data.byteLength),e}};function os(t,e){this.from_buffer(t,e)}os.prototype={from_buffer:function(t,e,i){e=e||0;var n=new X(t);return this.time=n.getUint32(e,!0),e+=4,this.mode=n.getUint16(e,!0),e+=2,t.byteLength>e&&(this.data=t.slice(e),e+=this.data.byteLength),e}};function as(t,e){this.from_buffer(t,e)}as.prototype={from_buffer:function(t,e,i){e=e||0;var n=new X(t);return this.channels=n.getUint32(e,!0),e+=4,this.format=n.getUint16(e,!0),e+=2,this.frequency=n.getUint32(e,!0),e+=4,this.time=n.getUint32(e,!0),e+=4,e}};function cs(t,e){this.from_buffer(t,e)}cs.prototype={from_buffer:function(t,e,i){e=e||0;var n=new X(t);return this.position=new zi,e=this.position.from_dv(n,e,i),this.visible=n.getUint8(e,!0),e++,this.cursor=new Wi,this.cursor.from_dv(n,e,t)}};function si(t,e){this.display_id=0,this.buttons_state=t.buttons_state,e?(this.x=e.offsetX,this.y=e.offsetY,t.mousex=e.offsetX,t.mousey=e.offsetY):this.x=this.y=this.buttons_state=0}si.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint32(e,this.x,!0),e+=4,i.setUint32(e,this.y,!0),e+=4,i.setUint16(e,this.buttons_state,!0),e+=2,i.setUint8(e,this.display_id,!0),e+=1,e},buffer_size:function(){return 11}};function $i(t,e){this.display_id=0,this.buttons_state=t.buttons_state,e?(this.x=e.offsetX,this.y=e.offsetY,t.mousex!==void 0&&(this.x-=t.mousex,this.y-=t.mousey),t.mousex=e.offsetX,t.mousey=e.offsetY):this.x=this.y=this.buttons_state=0}$i.prototype.to_buffer=si.prototype.to_buffer;$i.prototype.buffer_size=si.prototype.buffer_size;function xt(t,e){e?(this.button=e.button+1,this.buttons_state=1<<e.button,t.buttons_state=this.buttons_state):(this.button=D.SPICE_MOUSE_BUTTON_LEFT,this.buttons_state=D.SPICE_MOUSE_BUTTON_MASK_LEFT)}xt.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint8(e,this.button,!0),e++,i.setUint16(e,this.buttons_state,!0),e+=2,e},buffer_size:function(){return 3}};function oi(t,e){e?(this.button=e.button+1,this.buttons_state=0,t.buttons_state=this.buttons_state):(this.button=D.SPICE_MOUSE_BUTTON_LEFT,this.buttons_state=0)}oi.prototype.to_buffer=xt.prototype.to_buffer;oi.prototype.buffer_size=xt.prototype.buffer_size;function dt(t){t?this.code=Qc(t.keyCode,t.code):this.code=0}dt.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint32(e,this.code,!0),e+=4,e},buffer_size:function(){return 4}};function ai(t){t?this.code=Jc(t.keyCode,t.code):this.code=0}ai.prototype.to_buffer=dt.prototype.to_buffer;ai.prototype.buffer_size=dt.prototype.buffer_size;function ls(t,e){this.from_buffer(t,e)}ls.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.surface_id=i.getUint32(e,!0),e+=4,this.id=i.getUint32(e,!0),e+=4,this.flags=i.getUint8(e,!0),e+=1,this.codec_type=i.getUint8(e,!0),e+=1,this.stamp=i.getUint64(e,!0),e+=8,this.stream_width=i.getUint32(e,!0),e+=4,this.stream_height=i.getUint32(e,!0),e+=4,this.src_width=i.getUint32(e,!0),e+=4,this.src_height=i.getUint32(e,!0),e+=4,this.dest=new tt,e=this.dest.from_dv(i,e,t),this.clip=new ei,this.clip.from_dv(i,e,t)}};function Zi(t,e){}Zi.prototype={from_dv:function(t,e,i){return this.id=t.getUint32(e,!0),e+=4,this.multi_media_time=t.getUint32(e,!0),e+=4,e}};function hs(t,e){this.from_buffer(t,e)}hs.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.base=new Zi,e=this.base.from_dv(i,e,t),this.data_size=i.getUint32(e,!0),e+=4,this.data=i.u8.subarray(e,e+this.data_size)}};function us(t,e){this.from_buffer(t,e)}us.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.base=new Zi,e=this.base.from_dv(i,e,t),this.width=i.getUint32(e,!0),e+=4,this.height=i.getUint32(e,!0),e+=4,this.dest=new tt,e=this.dest.from_dv(i,e,t),this.data_size=i.getUint32(e,!0),e+=4,this.data=i.u8.subarray(e,e+this.data_size)}};function fs(t,e){this.from_buffer(t,e)}fs.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.id=i.getUint32(e,!0),e+=4,this.clip=new ei,this.clip.from_dv(i,e,t)}};function _s(t,e){this.from_buffer(t,e)}_s.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.id=i.getUint32(e,!0),e+=4}};function ds(t,e){this.from_buffer(t,e)}ds.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t);this.stream_id=i.getUint32(e,!0),e+=4,this.unique_id=i.getUint32(e,!0),e+=4,this.max_window_size=i.getUint32(e,!0),e+=4,this.timeout_ms=i.getUint32(e,!0),e+=4}};function ps(t,e){this.stream_id=t,this.unique_id=e,this.start_frame_mm_time=0,this.end_frame_mm_time=0,this.num_frames=0,this.num_drops=0,this.last_frame_delay=0,this.audio_delay=-1}ps.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint32(e,this.stream_id,!0),e+=4,i.setUint32(e,this.unique_id,!0),e+=4,i.setUint32(e,this.start_frame_mm_time,!0),e+=4,i.setUint32(e,this.end_frame_mm_time,!0),e+=4,i.setUint32(e,this.num_frames,!0),e+=4,i.setUint32(e,this.num_drops,!0),e+=4,i.setUint32(e,this.last_frame_delay,!0),e+=4,i.setUint32(e,this.audio_delay,!0),e+=4,e},buffer_size:function(){return 8*4}};function ms(t,e){this.count=0,this.resources=[],this.from_buffer(t,e)}ms.prototype={from_buffer:function(t,e){var i;e=e||0;var n=new X(t);for(this.count=n.getUint16(e,!0),e+=2,i=0;i<this.count;i++)this.resources[i]={},this.resources[i].type=n.getUint8(e,!0),e++,this.resources[i].id=n.getUint64(e,!0),e+=8}};function vs(t,e){this.from_buffer(t,e)}vs.prototype={from_buffer:function(t,e){e=e||0;var i=new X(t),n=i.getUint32(e,!0);e+=4;var r=i.getUint32(e,!0);e+=4,this.opened=i.getUint8(e,!0),e+=1,this.name=t.slice(r,r+n-1)}};var gs=Array(256),bs=0;function tl(){var t,e,i;for(e=0;e<256;e++){for(t=e,i=0;i<8;i++)t&1?t=(3988292384^t>>>1)>>>0&4294967295:t=t>>>1;gs[e]=t}bs=1}function il(t,e,i,n){var r=t,p;for(bs||tl(),p=0;p<n;p++)r=gs[(r^e[i+p])&255]^r>>>8;return r}function rl(t,e,i){return il(4294967295,t,e,i)^4294967295}function Qi(t,e,i){var n=new Uint8Array(t);return rl(n,e,i)}function Ss(t,e){this.width=t,this.height=e,this.depth=8,this.type=6,this.compression=0,this.filter=0,this.interlace=0}Ss.prototype={to_buffer:function(t,e){e=e||0;var i=e,n=new X(t);return n.setUint32(e,this.buffer_size()-12),e+=4,n.setUint8(e,"I".charCodeAt(0)),e++,n.setUint8(e,"H".charCodeAt(0)),e++,n.setUint8(e,"D".charCodeAt(0)),e++,n.setUint8(e,"R".charCodeAt(0)),e++,n.setUint32(e,this.width),e+=4,n.setUint32(e,this.height),e+=4,n.setUint8(e,this.depth),e++,n.setUint8(e,this.type),e++,n.setUint8(e,this.compression),e++,n.setUint8(e,this.filter),e++,n.setUint8(e,this.interlace),e++,n.setUint32(e,Qi(t,i+4,this.buffer_size()-8)),e+=4,e},buffer_size:function(){return 12+13}};function ys(){this.s1=1,this.s2=0}ys.prototype.update=function(t){this.s1+=t,this.s1%=65521,this.s2+=this.s1,this.s2%=65521};function Cs(t,e,i){if(i.byteLength>65535)throw new Error("Cannot handle more than 64K");this.data=i,this.width=t,this.height=e}Cs.prototype={to_buffer:function(t,e){e=e||0;var i=e,n,r,p,a=new X(t),v=new ys;a.setUint32(e,this.buffer_size()-12),e+=4,a.setUint8(e,"I".charCodeAt(0)),e++,a.setUint8(e,"D".charCodeAt(0)),e++,a.setUint8(e,"A".charCodeAt(0)),e++,a.setUint8(e,"T".charCodeAt(0)),e++,a.setUint8(e,120),e++,a.setUint8(e,1),e++,a.setUint8(e,128),e++,a.setUint16(e,this.data.byteLength+this.height),e+=2,a.setUint16(e,~(this.data.byteLength+this.height)),e+=2;var l=new Uint8Array(this.data);for(p=0,r=0;r<this.height;r++)for(a.setUint8(e,0),e++,v.update(0),n=0;n<this.width&&p<this.data.byteLength;n++)v.update(l[p]),a.setUint8(e,l[p++]),e++,v.update(l[p]),a.setUint8(e,l[p++]),e++,v.update(l[p]),a.setUint8(e,l[p++]),e++,v.update(l[p]),a.setUint8(e,l[p++]),e++;return a.setUint16(e,v.s2),e+=2,a.setUint16(e,v.s1),e+=2,a.setUint32(e,Qi(t,i+4,this.buffer_size()-8)),e+=4,e},buffer_size:function(){return 12+this.data.byteLength+this.height+4+2+1+2+2}};function Es(){}Es.prototype={to_buffer:function(t,e){e=e||0;var i=e,n=new X(t);return n.setUint32(e,this.buffer_size()-12),e+=4,n.setUint8(e,"I".charCodeAt(0)),e++,n.setUint8(e,"E".charCodeAt(0)),e++,n.setUint8(e,"N".charCodeAt(0)),e++,n.setUint8(e,"D".charCodeAt(0)),e++,n.setUint32(e,Qi(t,i+4,this.buffer_size()-8)),e+=4,e},buffer_size:function(){return 12}};function nl(t,e,i){var n,r=new Ss(t,e),p=new Cs(t,e,i),a=new Es,v=new ArrayBuffer(r.buffer_size()+p.buffer_size()+a.buffer_size()),l=r.to_buffer(v);l=p.to_buffer(v,l),l=a.to_buffer(v,l);var u=new Uint8Array(v),d="";for(n=0;n<l;n++)d+="%",u[n]<16&&(d+="0"),d+=u[n].toString(16);return"%89PNG%0D%0A%1A%0A"+d}var be={cursors:new Array,unknown_cursors:new Array,warned:!1,add_cursor:function(t,e){be.cursors[t]=e},unknown_cursor:function(t,e){be.warned||(be.warned=!0,alert(`Internet Explorer does not support dynamic cursors.  This page will now simulate cursors with images, which will be imperfect.  We recommend using Chrome or Firefox instead.  

If you need to use Internet Explorer, you can create a static cursor file for each cursor your application uses.  View the console log for more information on creating static cursors for your environment.`)),be.unknown_cursors[t]||(be.unknown_cursors[t]=e,console.log("Unknown cursor.  Simulation required.  To avoid simulation for this cursor, create and include a custom javascript file, and add the following line:"),console.log('SpiceCursorSimulator.add_cursor("'+t+'"), "<your filename here>.cur");'),console.log("And then run following command, redirecting output into <your filename here>.cur:"),console.log(`php -r "echo urldecode('`+e+`');"`))},simulate_cursor:function(t,e,i,n){var r=Pc(n+" "+e.header.hot_spot_x+" "+e.header.hot_spot_y);if(typeof be.cursors<"u"&&typeof be.cursors[r]<"u"){var p="url("+be.cursors[r]+"), default";i.style.cursor=p}window.getComputedStyle(i,null).cursor=="auto"?(be.unknown_cursor(r,be.create_icondir(e.header.width,e.header.height,e.data.byteLength,e.header.hot_spot_x,e.header.hot_spot_y)+n),document.getElementById(t.parent.screen_id).style.cursor="none",t.spice_simulated_cursor||(t.spice_simulated_cursor=document.createElement("img"),t.spice_simulated_cursor.style.position="absolute",t.spice_simulated_cursor.style.display="none",t.spice_simulated_cursor.style.overflow="hidden",t.spice_simulated_cursor.spice_screen=document.getElementById(t.parent.screen_id),t.spice_simulated_cursor.addEventListener("mousemove",be.handle_sim_mousemove),t.spice_simulated_cursor.spice_screen.appendChild(t.spice_simulated_cursor)),t.spice_simulated_cursor.src="data:image/png,"+n,t.spice_simulated_cursor.spice_hot_x=e.header.hot_spot_x,t.spice_simulated_cursor.spice_hot_y=e.header.hot_spot_y,t.spice_simulated_cursor.style.pointerEvents="none"):t.spice_simulated_cursor&&(t.spice_simulated_cursor.spice_screen.removeChild(t.spice_simulated_cursor),delete t.spice_simulated_cursor)},handle_sim_mousemove:function(t){var e=be.duplicate_mouse_event(t,this.spice_screen);return this.spice_screen.dispatchEvent(e)},duplicate_mouse_event:function(t,e){var i=document.createEvent("mouseevent");return i.initMouseEvent(t.type,!0,!0,t.view,t.detail,t.screenX,t.screenY,t.clientX,t.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget),i},ICONDIR:function(){},ICONDIRENTRY:function(t,e,i,n,r){this.width=t,this.height=e,this.bytes=i,this.hot_x=n,this.hot_y=r},create_icondir:function(t,e,i,n,r){var p,a=new be.ICONDIR,v=new be.ICONDIRENTRY(t,e,i,n,r),l=new ArrayBuffer(a.buffer_size()+v.buffer_size()),u=a.to_buffer(l);u=v.to_buffer(l,u);var d=new Uint8Array(l),b="";for(p=0;p<u;p++)b+="%",d[p]<16&&(b+="0"),b+=d[p].toString(16);return b}};be.ICONDIR.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint16(e,0,!0),e+=2,i.setUint16(e,2,!0),e+=2,i.setUint16(e,1,!0),e+=2,e},buffer_size:function(){return 6}};be.ICONDIRENTRY.prototype={to_buffer:function(t,e){e=e||0;var i=new X(t);return i.setUint8(e,this.width),e++,i.setUint8(e,this.height),e++,i.setUint8(e,0),e++,i.setUint8(e,0),e++,i.setUint16(e,this.hot_x,!0),e+=2,i.setUint16(e,this.hot_y,!0),e+=2,i.setUint32(e,this.bytes,!0),e+=4,i.setUint32(e,e+4,!0),e+=4,e},buffer_size:function(){return 16}};function Ji(t,e){this.sc=t,this.callback=e,this.needed=0,this.buffers=[],this.sc.ws.wire_reader=this,this.sc.ws.binaryType="arraybuffer",this.sc.ws.addEventListener("message",sl)}Ji.prototype={inbound:function(t){if(this.needed==0){this.buffers.push(t);return}for(this.buffers.length==0&&t.byteLength>=this.needed?(t.byteLength>this.needed&&(this.buffers.push(t.slice(this.needed)),t=t.slice(0,this.needed)),this.callback.call(this.sc,t,this.saved_msg_header||void 0)):this.buffers.push(t);this.buffers.length>1&&this.buffers[0].byteLength<this.needed;){var e=this.buffers.shift(),i=this.buffers.shift();this.buffers.unshift($c(e,i))}for(;this.buffers.length>0&&this.buffers[0].byteLength>=this.needed;)t=this.buffers.shift(),t.byteLength>this.needed&&(this.buffers.unshift(t.slice(this.needed)),t=t.slice(0,this.needed)),this.callback.call(this.sc,t,this.saved_msg_header||void 0)},request:function(t){this.needed=t},save_header:function(t){this.saved_msg_header=t},clear_header:function(){this.saved_msg_header=void 0}};function sl(t){Ji.prototype.inbound.call(this.wire_reader,t.data)}var ol=[26,69,223,163],al=[66,134],cl=[66,247],ll=[66,242],hl=[66,243],ul=[66,130],fl=[66,135],_l=[66,133],dl=[24,83,128,103],ws=[21,73,169,102],Dr=[42,215,177],Or=[77,128],kr=[87,65],pl=[17,77,155,116],ml=[77,187],Nr=[83,171],Ur=[83,172],xs=[22,84,174,107],As=[174],Ft=[215],jt=[115,197],Ht=[131],Gt=[185],Kt=[136],Yt=[85,170],qt=[156],zt=[109,231],Wt=[85,238],Vt=[170],Xt=[86,187],Br=[86,170],Fr=[99,162],$t=[134],vl=[224],jr=[154],Hr=[176],Gr=[186],gl=[225],Kr=[181],Yr=[159],bl=[31,67,182,117],qr=[231],Sl=[163],pe={CLUSTER_SIMPLEBLOCK_FLAG_KEYFRAME:128,OPUS_FREQUENCY:48e3,OPUS_CHANNELS:2,SPICE_PLAYBACK_CODEC:'audio/webm; codecs="opus"',MAX_CLUSTER_TIME:1e3,EXPECTED_PACKET_DURATION:10,GAP_DETECTION_THRESHOLD:50,SPICE_VP8_CODEC:'video/webm; codecs="vp8"'};function it(t,e,i){var n=128|t;return e.setUint8(i,n),i+1}function he(t,e,i,n){return n=ge(t,i,n),n=it(1,i,n),i.setUint8(n,e),n+1}function yt(t,e,i,n){return n=ge(t,i,n),n=it(4,i,n),i.setUint32(n,e),n+4}function Di(t,e,i,n){return n=ge(t,i,n),n=it(2,i,n),i.setUint16(n,e),n+2}function yl(t,e,i,n){return n=ge(t,i,n),n=it(4,i,n),i.setFloat32(n,e),n+4}function Fe(t,e,i){e.setUint8(i++,1),e.setUint8(i++,0),e.setUint8(i++,0),e.setUint8(i++,0);for(var n=t&4294967295,r=24;r>=0;r-=8)e.setUint8(i++,n>>r);return i}function ge(t,e,i){for(var n=0;n<t.length;n++)e.setUint8(i+n,t[n]);return i+t.length}function Cl(t,e,i){for(var n=0;n<t.length;n++)e.setUint8(i+n,t.charCodeAt(n));return i+t.length}function Je(t,e,i,n){return n=ge(t,i,n),e.length<127?n=it(e.length,i,n):n=Fe(e.length,i,n),typeof e=="string"?n=Cl(e,i,n):n=ge(e,i,n),n}function Is(){this.id=ol,this.Version=1,this.ReadVersion=1,this.MaxIDLength=4,this.MaxSizeLength=8,this.DocType="webm",this.DocTypeVersion=2,this.DocTypeReadVersion=2}Is.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(31,i,e),e=he(al,this.Version,i,e),e=he(cl,this.ReadVersion,i,e),e=he(ll,this.MaxIDLength,i,e),e=he(hl,this.MaxSizeLength,i,e),e=Je(ul,this.DocType,i,e),e=he(fl,this.DocTypeVersion,i,e),e=he(_l,this.DocTypeReadVersion,i,e),e},buffer_size:function(){return 31+8+this.id.length}};function Ps(){this.id=dl}Ps.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),i.setUint8(e++,255),e},buffer_size:function(){return this.id.length+1}};function Ts(){this.id=ws,this.timecode_scale=1e6,this.muxing_app="spice",this.writing_app="spice-html5"}Ts.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=yt(Dr,this.timecode_scale,i,e),e=Je(Or,this.muxing_app,i,e),e=Je(kr,this.writing_app,i,e),e},buffer_size:function(){return this.id.length+8+Dr.length+1+4+Or.length+1+this.muxing_app.length+kr.length+1+this.writing_app.length}};function Ls(t){this.id=gl,this.sampling_frequency=t,this.channels=pe.OPUS_CHANNELS}Ls.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=he(Yr,this.channels,i,e),e=yl(Kr,this.sampling_frequency,i,e),e},buffer_size:function(){return this.id.length+8+Kr.length+1+4+Yr.length+1+1}};function Ms(t,e){this.id=vl,this.flag_interlaced=0,this.width=t,this.height=e}Ms.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=he(jr,this.flag_interlaced,i,e),e=Di(Hr,this.width,i,e),e=Di(Gr,this.height,i,e),e},buffer_size:function(){return this.id.length+8+jr.length+1+1+Hr.length+1+2+Gr.length+1+2}};function Oi(t,e){this.id=ml,this.pos=e,this.seekid=t}Oi.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=it(this.buffer_size()-1-this.id.length,i,e),e=Je(Nr,this.seekid,i,e),e=Di(Ur,this.pos,i,e),e},buffer_size:function(){return this.id.length+1+Nr.length+1+this.seekid.length+Ur.length+1+2}};function Rs(t,e){this.id=pl,this.info=new Oi(ws,t),this.track=new Oi(xs,e)}Rs.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=this.info.to_buffer(t,e),e=this.track.to_buffer(t,e),e},buffer_size:function(){return this.id.length+8+this.info.buffer_size()+this.track.buffer_size()}};function Ds(){this.id=As,this.number=1,this.uid=2,this.type=2,this.flag_enabled=1,this.flag_default=1,this.flag_forced=1,this.flag_lacing=0,this.min_cache=0,this.max_block_addition_id=0,this.codec_decode_all=0,this.seek_pre_roll=0,this.codec_delay=8e7,this.codec_id="A_OPUS",this.audio=new Ls(pe.OPUS_FREQUENCY),this.codec_private=[79,112,117,115,72,101,97,100,1,pe.OPUS_CHANNELS,0,15,128,187,0,0,0,0,0]}Ds.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=he(Ft,this.number,i,e),e=he(jt,this.uid,i,e),e=he(Gt,this.flag_enabled,i,e),e=he(Kt,this.flag_default,i,e),e=he(Yt,this.flag_forced,i,e),e=he(qt,this.flag_lacing,i,e),e=Je($t,this.codec_id,i,e),e=he(zt,this.min_cache,i,e),e=he(Wt,this.max_block_addition_id,i,e),e=he(Vt,this.codec_decode_all,i,e),e=yt(Br,this.codec_delay,i,e),e=yt(Xt,this.seek_pre_roll,i,e),e=he(Ht,this.type,i,e),e=Je(Fr,this.codec_private,i,e),e=this.audio.to_buffer(t,e),e},buffer_size:function(){return this.id.length+8+Ft.length+1+1+jt.length+1+1+Ht.length+1+1+Gt.length+1+1+Kt.length+1+1+Yt.length+1+1+qt.length+1+1+zt.length+1+1+Wt.length+1+1+Vt.length+1+1+Xt.length+1+4+Br.length+1+4+$t.length+this.codec_id.length+1+Fr.length+1+this.codec_private.length+this.audio.buffer_size()}};function Os(t,e){this.id=As,this.number=1,this.uid=1,this.type=1,this.flag_enabled=1,this.flag_default=1,this.flag_forced=1,this.flag_lacing=1,this.min_cache=0,this.max_block_addition_id=0,this.codec_id="V_VP8",this.codec_decode_all=1,this.seek_pre_roll=0,this.video=new Ms(t,e)}Os.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=he(Ft,this.number,i,e),e=he(jt,this.uid,i,e),e=he(Gt,this.flag_enabled,i,e),e=he(Kt,this.flag_default,i,e),e=he(Yt,this.flag_forced,i,e),e=he(qt,this.flag_lacing,i,e),e=Je($t,this.codec_id,i,e),e=he(zt,this.min_cache,i,e),e=he(Wt,this.max_block_addition_id,i,e),e=he(Vt,this.codec_decode_all,i,e),e=yt(Xt,this.seek_pre_roll,i,e),e=he(Ht,this.type,i,e),e=this.video.to_buffer(t,e),e},buffer_size:function(){return this.id.length+8+Ft.length+1+1+jt.length+1+1+Gt.length+1+1+Kt.length+1+1+Yt.length+1+1+qt.length+1+1+$t.length+this.codec_id.length+1+zt.length+1+1+Wt.length+1+1+Vt.length+1+1+Xt.length+1+4+Ht.length+1+1+this.video.buffer_size()}};function er(t){this.id=xs,this.track_entry=t}er.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),e=Fe(this.buffer_size()-8-this.id.length,i,e),e=this.track_entry.to_buffer(t,e),e},buffer_size:function(){return this.id.length+8+this.track_entry.buffer_size()}};function tr(t,e){this.id=bl,this.timecode=t,this.data=e}tr.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);return e=ge(this.id,i,e),i.setUint8(e++,255),e=yt(qr,this.timecode,i,e),e},buffer_size:function(){return this.id.length+1+qr.length+1+4}};function ir(t,e,i){this.id=Sl,this.timecode=t,this.data=e,this.keyframe=i}ir.prototype={to_buffer:function(t,e){e=e||0;var i=new DataView(t);e=ge(this.id,i,e),e=Fe(this.data.byteLength+4,i,e),e=it(1,i,e),i.setUint16(e,this.timecode),e+=2,i.setUint8(e,this.keyframe?pe.CLUSTER_SIMPLEBLOCK_FLAG_KEYFRAME:0),e+=1;for(var n=new Uint8Array(this.data),r=0;r<this.data.byteLength;r++)i.setUint8(e++,n[r]);return e},buffer_size:function(){return this.id.length+8+1+2+1+this.data.byteLength}};function rr(){this.ebml=new Is,this.segment=new Ps,this.seek_head=new Rs(0,0),this.seek_head.info.pos=this.segment.buffer_size()+this.seek_head.buffer_size(),this.info=new Ts,this.seek_head.track.pos=this.seek_head.info.pos+this.info.buffer_size()}rr.prototype={to_buffer:function(t,e){return e=e||0,e=this.ebml.to_buffer(t,e),e=this.segment.to_buffer(t,e),e=this.info.to_buffer(t,e),e},buffer_size:function(){return this.ebml.buffer_size()+this.segment.buffer_size()+this.info.buffer_size()}};function we(t){if(t===void 0||t.uri===void 0||!t.uri)throw new Error("You must specify a uri");if(this.ws=new WebSocket(t.uri),!this.ws.binaryType)throw new Error("WebSocket doesn't support binaryType.  Try a different browser.");if(this.connection_id=t.connection_id!==void 0?t.connection_id:0,this.type=t.type!==void 0?t.type:D.SPICE_CHANNEL_MAIN,this.chan_id=t.chan_id!==void 0?t.chan_id:0,t.parent!==void 0&&(this.parent=t.parent,this.message_id=t.parent.message_id,this.password=t.parent.password),t.screen_id!==void 0&&(this.screen_id=t.screen_id),t.dump_id!==void 0&&(this.dump_id=t.dump_id),t.message_id!==void 0&&(this.message_id=t.message_id),t.password!==void 0&&(this.password=t.password),t.onerror!==void 0&&(this.onerror=t.onerror),t.onsuccess!==void 0&&(this.onsuccess=t.onsuccess),t.onagent!==void 0&&(this.onagent=t.onagent),this.state="connecting",this.ws.parent=this,this.wire_reader=new Ji(this,this.process_inbound),this.messages_sent=0,this.warnings=[],this.ws.addEventListener("open",function(e){this.parent.send_hdr(),this.parent.wire_reader.request(Bt.prototype.buffer_size()),this.parent.state="start"}),this.ws.addEventListener("error",function(e){"url"in e.target&&this.parent.log_err("WebSocket error: Can't connect to websocket on URL: "+e.target.url),this.parent.report_error(e)}),this.ws.addEventListener("close",function(e){if(this.parent.state!="closing"&&this.parent.state!="error"&&this.parent.onerror!==void 0){var e;this.parent.state=="connecting"?e=new Error("Connection refused."):this.parent.state=="start"||this.parent.state=="link"?e=new Error("Unexpected protocol mismatch."):this.parent.state=="ticket"?e=new Error("Bad password."):e=new Error("Unexpected close while "+this.parent.state),this.parent.onerror(e),this.parent.log_err(e.toString())}}),this.ws.readyState==2||this.ws.readyState==3)throw new Error("Unable to connect to "+t.uri);this.timeout=window.setTimeout(El,D.SPICE_CONNECT_TIMEOUT,this)}we.prototype={send_hdr:function(){var t=new Bt,e=new On;if(e.connection_id=this.connection_id,e.channel_type=this.type,e.channel_id=this.chan_id,e.common_caps.push(1<<D.SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION|1<<D.SPICE_COMMON_CAP_MINI_HEADER),e.channel_type==D.SPICE_CHANNEL_PLAYBACK){var i=0;"MediaSource"in window&&MediaSource.isTypeSupported(pe.SPICE_PLAYBACK_CODEC)&&(i|=1<<D.SPICE_PLAYBACK_CAP_OPUS),e.channel_caps.push(i)}else if(e.channel_type==D.SPICE_CHANNEL_MAIN)e.channel_caps.push(1<<D.SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS);else if(e.channel_type==D.SPICE_CHANNEL_DISPLAY){var i=1<<D.SPICE_DISPLAY_CAP_SIZED_STREAM|1<<D.SPICE_DISPLAY_CAP_STREAM_REPORT|1<<D.SPICE_DISPLAY_CAP_MULTI_CODEC|1<<D.SPICE_DISPLAY_CAP_CODEC_MJPEG;"MediaSource"in window&&MediaSource.isTypeSupported(pe.SPICE_VP8_CODEC)&&(i|=1<<D.SPICE_DISPLAY_CAP_CODEC_VP8),e.channel_caps.push(i)}t.size=e.buffer_size();var n=new ArrayBuffer(t.buffer_size()+e.buffer_size());t.to_buffer(n),e.to_buffer(n,t.buffer_size()),this.ws.send(n)},send_ticket:function(t){var e=new Nn;e.auth_mechanism=D.SPICE_COMMON_CAP_AUTH_SPICE,e.encrypted_data=t;var i=new ArrayBuffer(e.buffer_size());e.to_buffer(i),this.ws.send(i)},send_msg:function(t){var e=new ArrayBuffer(t.buffer_size());t.to_buffer(e),this.messages_sent++,this.ws.send(e)},process_inbound:function(t,e){if(this.state=="ready")if(e==null){var i=new fe(t);i.type>500,i.size==0?(this.process_message(i),this.wire_reader.request(fe.prototype.buffer_size())):(this.wire_reader.request(i.size),this.wire_reader.save_header(i))}else e.data=t,this.process_message(e),this.wire_reader.request(fe.prototype.buffer_size()),this.wire_reader.save_header(void 0);else if(this.state=="start")if(this.reply_hdr=new Bt(t),this.reply_hdr.magic!=D.SPICE_MAGIC){this.state="error";var n=new Error("Error: magic mismatch: "+this.reply_hdr.magic);this.report_error(n)}else this.wire_reader.request(this.reply_hdr.size),this.state="link";else if(this.state=="link")if(this.reply_link=new kn(t),this.reply_link.error){this.state="error";var n=new Error("Error: reply link error "+this.reply_link.error);this.report_error(n)}else this.send_ticket(Bc(this.reply_link.pub_key,this.password+String.fromCharCode(0))),this.state="ticket",this.wire_reader.request(Mi.prototype.buffer_size());else if(this.state=="ticket")if(this.auth_reply=new Mi(t),this.auth_reply.auth_code==D.SPICE_LINK_ERR_OK){if(this.type==D.SPICE_CHANNEL_DISPLAY){var r=new $n,p=new fe;p.build_msg(D.SPICE_MSGC_DISPLAY_INIT,r),this.send_msg(p)}this.state="ready",this.wire_reader.request(fe.prototype.buffer_size()),this.timeout&&(window.clearTimeout(this.timeout),delete this.timeout)}else{if(this.state="error",this.auth_reply.auth_code==D.SPICE_LINK_ERR_PERMISSION_DENIED)var n=new Error("Permission denied.");else var n=new Error("Unexpected link error "+this.auth_reply.auth_code);this.report_error(n)}},process_common_messages:function(t){if(t.type==D.SPICE_MSG_SET_ACK){var e=new Hn(t.data);this.ack_window=e.window,this.msgs_until_ack=this.ack_window;var i=new Gn(e),n=new fe;return n.build_msg(D.SPICE_MSGC_ACK_SYNC,i),this.send_msg(n),!0}if(t.type==D.SPICE_MSG_PING){var r=new fe;return r.type=D.SPICE_MSGC_PONG,t.data&&(r.data=t.data.slice(0,12)),r.size=r.buffer_size(),this.send_msg(r),!0}if(t.type==D.SPICE_MSG_NOTIFY){var p=new Xn(t.data);return p.severity==D.SPICE_NOTIFY_SEVERITY_ERROR?this.log_err(p.message):p.severity==D.SPICE_NOTIFY_SEVERITY_WARN?this.log_warn(p.message):this.log_info(p.message),!0}return!1},process_message:function(t){var e,i=Date.now();if(e=this.process_common_messages(t),e||(this.process_channel_message?(e=this.process_channel_message(t),e||this.log_warn(this.channel_type()+": Unknown message type "+t.type+"!")):this.log_err(this.channel_type()+": No message handlers for this channel; message "+t.type)),this.msgs_until_ack!==void 0&&this.ack_window&&(this.msgs_until_ack--,this.msgs_until_ack<=0)){this.msgs_until_ack=this.ack_window;var n=new fe;n.type=D.SPICE_MSGC_ACK,this.send_msg(n)}var r=Date.now()-i;return r>pe.GAP_DETECTION_THRESHOLD&&console.log("delta "+this.channel_type()+":"+t.type+" "+r),e},channel_type:function(){return this.type==D.SPICE_CHANNEL_MAIN?"main":this.type==D.SPICE_CHANNEL_DISPLAY?"display":this.type==D.SPICE_CHANNEL_INPUTS?"inputs":this.type==D.SPICE_CHANNEL_CURSOR?"cursor":this.type==D.SPICE_CHANNEL_PLAYBACK?"playback":this.type==D.SPICE_CHANNEL_RECORD?"record":this.type==D.SPICE_CHANNEL_TUNNEL?"tunnel":this.type==D.SPICE_CHANNEL_SMARTCARD?"smartcard":this.type==D.SPICE_CHANNEL_USBREDIR?"Fusbredir":this.type==D.SPICE_CHANNEL_PORT?"port":this.type==D.SPICE_CHANNEL_WEBDAV?"webdav":"unknown-"+this.type},log_info:function(){var t=Array.prototype.join.call(arguments," ");if(console.log(t),this.message_id){var e=document.createElement("p");e.appendChild(document.createTextNode(t)),e.className+="spice-message-info",document.getElementById(this.message_id).appendChild(e)}},log_warn:function(){var t=Array.prototype.join.call(arguments," ");if(console.log("WARNING: "+t),this.message_id){var e=document.createElement("p");e.appendChild(document.createTextNode(t)),e.className+="spice-message-warning",document.getElementById(this.message_id).appendChild(e)}},log_err:function(){var t=Array.prototype.join.call(arguments," ");if(console.log("ERROR: "+t),this.message_id){var e=document.createElement("p");e.appendChild(document.createTextNode(t)),e.className+="spice-message-error",document.getElementById(this.message_id).appendChild(e)}},known_unimplemented:function(t,e){if(!this.warnings[t]||Vc>1){var i="";i=" [ further notices suppressed ]",this.log_warn("Unimplemented function "+t+"("+e+")"+i),this.warnings[t]=!0}},report_error:function(t){if(this.log_err(t.toString()),this.onerror!=null)this.onerror(t);else throw t},report_success:function(t){this.onsuccess!=null&&this.onsuccess(t)},cleanup:function(){this.timeout&&(window.clearTimeout(this.timeout),delete this.timeout),this.ws&&(this.ws.close(),this.ws=void 0)},handle_timeout:function(){var t=new Error("Connection timed out.");this.report_error(t)}};function El(t){we.prototype.handle_timeout.call(t)}function ci(){we.apply(this,arguments)}ci.prototype=Object.create(we.prototype);ci.prototype.process_channel_message=function(t){if(t.type==D.SPICE_MSG_CURSOR_INIT){var e=new ns(t.data);return this.parent&&this.parent.inputs&&this.parent.inputs.mouse_mode==D.SPICE_MOUSE_MODE_SERVER&&(this.parent.inputs.mousex=e.position.x,this.parent.inputs.mousey=e.position.y),!0}if(t.type==D.SPICE_MSG_CURSOR_SET){var i=new cs(t.data);return i.flags&D.SPICE_CURSOR_FLAGS_NONE?(document.getElementById(this.parent.screen_id).style.cursor="none",!0):(i.flags>0&&this.log_warn("FIXME: No support for cursor flags "+i.flags),i.cursor.header.type!=D.SPICE_CURSOR_TYPE_ALPHA?(this.log_warn("FIXME: No support for cursor type "+i.cursor.header.type),!1):(this.set_cursor(i.cursor),!0))}return t.type==D.SPICE_MSG_CURSOR_MOVE?(this.known_unimplemented(t.type,"Cursor Move"),!0):t.type==D.SPICE_MSG_CURSOR_HIDE?(document.getElementById(this.parent.screen_id).style.cursor="none",!0):t.type==D.SPICE_MSG_CURSOR_TRAIL?(this.known_unimplemented(t.type,"Cursor Trail"),!0):t.type==D.SPICE_MSG_CURSOR_RESET?(document.getElementById(this.parent.screen_id).style.cursor="auto",!0):t.type==D.SPICE_MSG_CURSOR_INVAL_ONE?(this.known_unimplemented(t.type,"Cursor Inval One"),!0):t.type==D.SPICE_MSG_CURSOR_INVAL_ALL};ci.prototype.set_cursor=function(t){var e=nl(t.header.width,t.header.height,t.data),i="url(data:image/png,"+e+") "+t.header.hot_spot_x+" "+t.header.hot_spot_y+", default",n=document.getElementById(this.parent.screen_id);n.style.cursor="auto",n.style.cursor=i,window.getComputedStyle(n,null).cursor=="auto"&&be.simulate_cursor(this,t,n,e)};function li(t,e){this.id=t,this.file=e}li.prototype.create_progressbar=function(){var t=this,e=document.createElement("input");this.progressbar_container=document.createElement("div"),this.progressbar=document.createElement("progress"),e.type="button",e.value="Cancel",e.style.float="right",e.onclick=function(){t.cancelled=!0,t.remove_progressbar()},this.progressbar.setAttribute("max",this.file.size),this.progressbar.setAttribute("value",0),this.progressbar.style.width="100%",this.progressbar.style.margin="4px auto",this.progressbar.style.display="inline-block",this.progressbar_container.style.width="90%",this.progressbar_container.style.margin="auto",this.progressbar_container.style.padding="4px",this.progressbar_container.textContent=this.file.name,this.progressbar_container.appendChild(e),this.progressbar_container.appendChild(this.progressbar),document.getElementById("spice-xfer-area").appendChild(this.progressbar_container)};li.prototype.update_progressbar=function(t){this.progressbar.setAttribute("value",t)};li.prototype.remove_progressbar=function(){this.progressbar_container&&this.progressbar_container.parentNode&&this.progressbar_container.parentNode.removeChild(this.progressbar_container)};var nt=-1,st=-1,ze=-1,vt=-1;function nr(){we.apply(this,arguments),this.mousex=void 0,this.mousey=void 0,this.button_state=0,this.waiting_for_ack=0}nr.prototype=Object.create(we.prototype);nr.prototype.process_channel_message=function(t){if(t.type==D.SPICE_MSG_INPUTS_INIT){var e=new is(t.data);return this.keyboard_modifiers=e.keyboard_modifiers,!0}if(t.type==D.SPICE_MSG_INPUTS_KEY_MODIFIERS){var i=new rs(t.data);return this.keyboard_modifiers=i.keyboard_modifiers,!0}return t.type==D.SPICE_MSG_INPUTS_MOUSE_MOTION_ACK?(this.waiting_for_ack-=D.SPICE_INPUT_MOTION_ACK_BUNCH,!0):!1};function ks(t){var e=new fe,i;this.sc.mouse_mode==D.SPICE_MOUSE_MODE_CLIENT?(i=new si(this.sc,t),e.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_POSITION,i)):(i=new $i(this.sc,t),e.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_MOTION,i)),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.waiting_for_ack<2*D.SPICE_INPUT_MOTION_ACK_BUNCH&&(this.sc.inputs.send_msg(e),this.sc.inputs.waiting_for_ack++),this.sc&&this.sc.cursor&&this.sc.cursor.spice_simulated_cursor&&(this.sc.cursor.spice_simulated_cursor.style.display="block",this.sc.cursor.spice_simulated_cursor.style.left=t.pageX-this.sc.cursor.spice_simulated_cursor.spice_hot_x+"px",this.sc.cursor.spice_simulated_cursor.style.top=t.pageY-this.sc.cursor.spice_simulated_cursor.spice_hot_y+"px",t.preventDefault())}function Ns(t){var e=new xt(this.sc,t),i=new fe;i.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_PRESS,e),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(i),t.preventDefault()}function Us(t){return t.preventDefault(),!1}function Bs(t){var e=new oi(this.sc,t),i=new fe;i.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_RELEASE,e),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(i),t.preventDefault()}function Fs(t){var e=new xt,i=new oi;t.deltaY<0?e.button=i.button=D.SPICE_MOUSE_BUTTON_UP:e.button=i.button=D.SPICE_MOUSE_BUTTON_DOWN,e.buttons_state=0,i.buttons_state=0;var n=new fe;n.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_PRESS,e),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(n),n.build_msg(D.SPICE_MSGC_INPUTS_MOUSE_RELEASE,i),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(n),t.preventDefault()}function js(t){var e=new dt(t),i=new fe;Gs(t,e.code,this.sc),i.build_msg(D.SPICE_MSGC_INPUTS_KEY_DOWN,e),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(i),t.preventDefault()}function Hs(t){var e=new ai(t),i=new fe;Gs(t,e.code,this.sc),i.build_msg(D.SPICE_MSGC_INPUTS_KEY_UP,e),this.sc&&this.sc.inputs&&this.sc.inputs.state==="ready"&&this.sc.inputs.send_msg(i),t.preventDefault()}function sr(t,e){var i=new fe,n=new dt;n.code=e,i.build_msg(D.SPICE_MSGC_INPUTS_KEY_DOWN,n),t.inputs.send_msg(i),n.code=128|e,i.build_msg(D.SPICE_MSGC_INPUTS_KEY_UP,n),t.inputs.send_msg(i)}function wl(t){t&&t.inputs&&t.inputs.state==="ready"&&(Oe(!0,H.KEY_LCtrl,t),Oe(!0,H.KEY_Alt,t),sr(t,H.KEY_KP_Decimal),st==!1&&Oe(!1,H.KEY_LCtrl,t),ze==!1&&Oe(!1,H.KEY_Alt,t))}function xl(t){t&&t.inputs&&t.inputs.state==="ready"&&(Oe(!0,H.KEY_Alt,t),sr(t,H.KEY_F4),ze==!1&&Oe(!1,H.KEY_Alt,t))}function Al(t){t&&t.inputs&&t.inputs.state==="ready"&&(Oe(!0,H.KEY_Alt,t),sr(t,H.KEY_Tab),ze==!1&&Oe(!1,H.KEY_Alt,t))}function Oe(t,e,i){var n=new fe;if(t){var r=new dt;r.code=e,n.build_msg(D.SPICE_MSGC_INPUTS_KEY_DOWN,r)}else{var r=new ai;r.code=128|e,n.build_msg(D.SPICE_MSGC_INPUTS_KEY_UP,r)}i.inputs.send_msg(n)}function Gs(t,e,i){nt===-1&&(nt=t.shiftKey,st=t.ctrlKey,ze=t.altKey,vt=t.metaKey),e===H.KEY_ShiftL?nt=!0:e===H.KEY_Alt?ze=!0:e===H.KEY_LCtrl?st=!0:e===57525?vt=!0:e===(128|H.KEY_ShiftL)?nt=!1:e===(128|H.KEY_Alt)?ze=!1:e===(128|H.KEY_LCtrl)?st=!1:e===57525&&(vt=!1),i&&i.inputs&&i.inputs.state==="ready"&&(nt!=t.shiftKey&&(console.log("Shift state out of sync"),Oe(t.shiftKey,H.KEY_ShiftL,i),nt=t.shiftKey),ze!=t.altKey&&(console.log("Alt state out of sync"),Oe(t.altKey,H.KEY_Alt,i),ze=t.altKey),st!=t.ctrlKey&&(console.log("Ctrl state out of sync"),Oe(t.ctrlKey,H.KEY_LCtrl,i),st=t.ctrlKey),vt!=t.metaKey&&(console.log("Meta state out of sync"),Oe(t.metaKey,57525,i),vt=t.metaKey))}function wi(t,e,i,n,r){var p=e,a=0,v,l=0;for(v=t[p++];a*4<i.length;v=t[p++]){var u=a,d=v>>5,b=(v&31)<<8;if(v>=32){var o;if(d--,d==7-1)do o=t[p++],d+=o;while(o==255);if(o=t[p++],b+=o,o==255&&b-o==7936&&(b=t[p++]<<8,b+=t[p++],b+=8191),d+=1,n==D.LZ_IMAGE_TYPE_RGBA&&(d+=2),b+=1,u-=b,u==a-1)for(var c=u;d;--d){if(n==D.LZ_IMAGE_TYPE_RGBA)i[a*4+3]=i[c*4+3];else for(l=0;l<4;l++)i[a*4+l]=i[c*4+l];a++}else for(;d;--d){if(n==D.LZ_IMAGE_TYPE_RGBA)i[a*4+3]=i[u*4+3];else for(l=0;l<4;l++)i[a*4+l]=i[u*4+l];a++,u++}}else for(v++,n==D.LZ_IMAGE_TYPE_RGBA?i[a*4+3]=t[p++]:(i[a*4+0]=t[p+2],i[a*4+1]=t[p+1],i[a*4+2]=t[p+0],r&&(i[a*4+3]=255),p+=3),a++,--v;v;v--)n==D.LZ_IMAGE_TYPE_RGBA?i[a*4+3]=t[p++]:(i[a*4+0]=t[p+2],i[a*4+1]=t[p+1],i[a*4+2]=t[p+0],r&&(i[a*4+3]=255),p+=3),a++}return p-1}function Il(t){for(var e=t.width*4,i=t.height,n=i,r=new Uint8Array(t.width*t.height*4);n--;)r.set(t.data.subarray(n*e,(n+1)*e),(i-n-1)*e);t.data.set(r)}function zr(t,e){var i;if(e.type===D.LZ_IMAGE_TYPE_RGB32||e.type===D.LZ_IMAGE_TYPE_RGBA){var n=new Uint8Array(e.data),r=t.createImageData(e.width,e.height);i=wi(n,0,r.data,D.LZ_IMAGE_TYPE_RGB32,e.type!=D.LZ_IMAGE_TYPE_RGBA),e.top_down||Il(r),e.type==D.LZ_IMAGE_TYPE_RGBA&&wi(n,i,r.data,D.LZ_IMAGE_TYPE_RGBA,!1)}else if(e.type===D.LZ_IMAGE_TYPE_XXXA){var n=new Uint8Array(e.data),r=t.createImageData(e.width,e.height);wi(n,0,r.data,D.LZ_IMAGE_TYPE_RGBA,!1)}else return;return r}function Pl(t,e){var i,n,r,p=0,a=0,v=new Uint8Array(e.data);if(!(e.format!=D.SPICE_BITMAP_FMT_32BIT&&e.format!=D.SPICE_BITMAP_FMT_RGBA)){for(e.flags&D.SPICE_BITMAP_FLAGS_TOP_DOWN||(p=(e.y-1)*e.stride,a=2*e.stride),i=t.createImageData(e.x,e.y),n=0;n<e.y*e.stride;p-=a)for(r=0;r<e.x;r++,n+=4,p+=4)i.data[n+0]=v[p+2],i.data[n+1]=v[p+1],i.data[n+2]=v[p+0],e.format==D.SPICE_BITMAP_FMT_32BIT?i.data[n+3]=255:i.data[n+3]=v[p];return i}}function Ks(t,e,i,n){var r=document.createElement("canvas"),p=r.getContext("2d");r.setAttribute("width",e.width),r.setAttribute("height",e.height),p.putImageData(e,0,0),t.drawImage(r,i,n,e.width,e.height)}function Tl(t){var e;for(e=0;e<t.width*t.height*4;e+=4)t.data[e+3]=255}function Ke(){we.apply(this,arguments)}Ke.prototype=Object.create(we.prototype);Ke.prototype.process_channel_message=function(t){if(t.type==D.SPICE_MSG_DISPLAY_MODE)return this.known_unimplemented(t.type,"Display Mode"),!0;if(t.type==D.SPICE_MSG_DISPLAY_MARK)return this.known_unimplemented(t.type,"Display Mark"),!0;if(t.type==D.SPICE_MSG_DISPLAY_RESET)return this.surfaces[this.primary_surface].canvas.context.restore(),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_COPY){var e=new Zn(t.data);if(e.base.box.is_same_size(e.data.src_area)||this.log_warn("FIXME: DrawCopy src_area is a different size than base.box; we do not handle that yet."),e.base.clip.type!=D.SPICE_CLIP_TYPE_NONE&&this.log_warn("FIXME: DrawCopy we don't handle clipping yet"),e.data.rop_descriptor!=D.SPICE_ROPD_OP_PUT&&this.log_warn("FIXME: DrawCopy we don't handle ropd type: "+e.data.rop_descriptor),e.data.mask.flags&&this.log_warn("FIXME: DrawCopy we don't handle mask flag: "+e.data.mask.flags),e.data.mask.bitmap&&this.log_warn("FIXME: DrawCopy we don't handle mask"),e.data&&e.data.src_bitmap)if(e.data.src_bitmap.descriptor.flags&&e.data.src_bitmap.descriptor.flags!=D.SPICE_IMAGE_FLAGS_CACHE_ME&&e.data.src_bitmap.descriptor.flags!=D.SPICE_IMAGE_FLAGS_HIGH_BITS_SET&&(this.log_warn("FIXME: DrawCopy unhandled image flags: "+e.data.src_bitmap.descriptor.flags),this.log_draw("DrawCopy",e)),e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_QUIC){var i=this.surfaces[e.base.surface_id].canvas;if(!e.data.src_bitmap.quic)return this.log_warn("FIXME: DrawCopy could not handle this QUIC file."),!1;var n=Wc(i.context,e.data.src_bitmap.quic);return this.draw_copy_helper({base:e.base,src_area:e.data.src_area,image_data:n,tag:"copyquic."+e.data.src_bitmap.quic.type,has_alpha:e.data.src_bitmap.quic.type==ye.QUIC_IMAGE_TYPE_RGBA,descriptor:e.data.src_bitmap.descriptor})}else{if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_FROM_CACHE||e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_FROM_CACHE_LOSSLESS)return!this.cache||!this.cache[e.data.src_bitmap.descriptor.id]?(this.log_warn("FIXME: DrawCopy did not find image id "+e.data.src_bitmap.descriptor.id+" in cache."),!1):this.draw_copy_helper({base:e.base,src_area:e.data.src_area,image_data:this.cache[e.data.src_bitmap.descriptor.id],tag:"copycache."+e.data.src_bitmap.descriptor.id,has_alpha:!0,descriptor:e.data.src_bitmap.descriptor});if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_SURFACE){var r=this.surfaces[e.data.src_bitmap.surface_id].canvas.context;this.surfaces[e.base.surface_id].canvas.context;var n=r.getImageData(e.data.src_area.left,e.data.src_area.top,e.data.src_area.right-e.data.src_area.left,e.data.src_area.bottom-e.data.src_area.top),p=new tt;return p.top=p.left=0,p.right=n.width,p.bottom=n.height,this.draw_copy_helper({base:e.base,src_area:p,image_data:n,tag:"copysurf."+e.data.src_bitmap.surface_id,has_alpha:this.surfaces[e.data.src_bitmap.surface_id].format!=D.SPICE_SURFACE_FMT_32_xRGB,descriptor:e.data.src_bitmap.descriptor})}else if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_JPEG){if(!e.data.src_bitmap.jpeg)return this.log_warn("FIXME: DrawCopy could not handle this JPEG file."),!1;var a="data:image/jpeg,",v=new Image,l,u=new Uint8Array(e.data.src_bitmap.jpeg.data);for(l=0;l<u.length;l++)a+="%",u[l]<16&&(a+="0"),a+=u[l].toString(16);return v.o={base:e.base,tag:"jpeg."+e.data.src_bitmap.surface_id,descriptor:e.data.src_bitmap.descriptor,sc:this},v.onload=ki,v.src=a,!0}else if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_JPEG_ALPHA){if(!e.data.src_bitmap.jpeg_alpha)return this.log_warn("FIXME: DrawCopy could not handle this JPEG ALPHA file."),!1;var a="data:image/jpeg,",v=new Image,l,u=new Uint8Array(e.data.src_bitmap.jpeg_alpha.data);for(l=0;l<u.length;l++)a+="%",u[l]<16&&(a+="0"),a+=u[l].toString(16);if(v.o={base:e.base,tag:"jpeg."+e.data.src_bitmap.surface_id,descriptor:e.data.src_bitmap.descriptor,sc:this},this.surfaces[e.base.surface_id].format==D.SPICE_SURFACE_FMT_32_ARGB){var i=this.surfaces[e.base.surface_id].canvas;v.alpha_img=zr(i.context,e.data.src_bitmap.jpeg_alpha.alpha)}return v.onload=ki,v.src=a,!0}else if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_BITMAP){var i=this.surfaces[e.base.surface_id].canvas;if(!e.data.src_bitmap.bitmap)return this.log_err("null bitmap"),!1;var n=Pl(i.context,e.data.src_bitmap.bitmap);return n?this.draw_copy_helper({base:e.base,src_area:e.data.src_area,image_data:n,tag:"bitmap."+e.data.src_bitmap.bitmap.format,has_alpha:e.data.src_bitmap.bitmap!=D.SPICE_BITMAP_FMT_32BIT,descriptor:e.data.src_bitmap.descriptor}):(this.log_warn("FIXME: Unable to interpret bitmap of format: "+e.data.src_bitmap.bitmap.format),!1)}else if(e.data.src_bitmap.descriptor.type==D.SPICE_IMAGE_TYPE_LZ_RGB){var i=this.surfaces[e.base.surface_id].canvas;if(!e.data.src_bitmap.lz_rgb)return this.log_err("null lz_rgb "),!1;var n=zr(i.context,e.data.src_bitmap.lz_rgb);return n?this.draw_copy_helper({base:e.base,src_area:e.data.src_area,image_data:n,tag:"lz_rgb."+e.data.src_bitmap.lz_rgb.type,has_alpha:e.data.src_bitmap.lz_rgb.type==D.LZ_IMAGE_TYPE_RGBA,descriptor:e.data.src_bitmap.descriptor}):(this.log_warn("FIXME: Unable to interpret bitmap of type: "+e.data.src_bitmap.lz_rgb.type),!1)}else return this.log_warn("FIXME: DrawCopy unhandled image type: "+e.data.src_bitmap.descriptor.type),this.log_draw("DrawCopy",e),!1}return this.log_warn("FIXME: DrawCopy no src_bitmap."),!1}if(t.type==D.SPICE_MSG_DISPLAY_DRAW_FILL){var d=new Qn(t.data);if(d.data.rop_descriptor!=D.SPICE_ROPD_OP_PUT&&this.log_warn("FIXME: DrawFill we don't handle ropd type: "+d.data.rop_descriptor),d.data.mask.flags&&this.log_warn("FIXME: DrawFill we don't handle mask flag: "+d.data.mask.flags),d.data.mask.bitmap&&this.log_warn("FIXME: DrawFill we don't handle mask"),d.data.brush.type==D.SPICE_BRUSH_TYPE_SOLID){var b=d.data.brush.color&16777215,o="rgb("+(b>>16)+", "+(b>>8&255)+", "+(b&255)+")";this.surfaces[d.base.surface_id].canvas.context.fillStyle=o,this.surfaces[d.base.surface_id].canvas.context.fillRect(d.base.box.left,d.base.box.top,d.base.box.right-d.base.box.left,d.base.box.bottom-d.base.box.top),this.surfaces[d.base.surface_id].draw_count++}else this.log_warn("FIXME: DrawFill can't handle brush type: "+d.data.brush.type);return!0}if(t.type==D.SPICE_MSG_DISPLAY_DRAW_OPAQUE)return this.known_unimplemented(t.type,"Display Draw Opaque"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_BLEND)return this.known_unimplemented(t.type,"Display Draw Blend"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_BLACKNESS)return this.known_unimplemented(t.type,"Display Draw Blackness"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_WHITENESS)return this.known_unimplemented(t.type,"Display Draw Whiteness"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_INVERS)return this.known_unimplemented(t.type,"Display Draw Invers"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_ROP3)return this.known_unimplemented(t.type,"Display Draw ROP3"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_STROKE)return this.known_unimplemented(t.type,"Display Draw Stroke"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_TRANSPARENT)return this.known_unimplemented(t.type,"Display Draw Transparent"),!0;if(t.type==D.SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND)return this.known_unimplemented(t.type,"Display Draw Alpha Blend"),!0;if(t.type==D.SPICE_MSG_DISPLAY_COPY_BITS){var c=new Jn(t.data),f=this.surfaces[c.base.surface_id].canvas,r=f.context,h=f.width-c.src_pos.x,_=f.height-c.src_pos.y;h>c.base.box.right-c.base.box.left&&(h=c.base.box.right-c.base.box.left),_>c.base.box.bottom-c.base.box.top&&(_=c.base.box.bottom-c.base.box.top);var n=r.getImageData(c.src_pos.x,c.src_pos.y,h,_);return Ks(r,n,c.base.box.left,c.base.box.top),this.surfaces[c.base.surface_id].draw_count++,!0}if(t.type==D.SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS)return this.known_unimplemented(t.type,"Display Inval All Pixmaps"),!0;if(t.type==D.SPICE_MSG_DISPLAY_INVAL_PALETTE)return this.known_unimplemented(t.type,"Display Inval Palette"),!0;if(t.type==D.SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES)return this.known_unimplemented(t.type,"Inval All Palettes"),!0;if(t.type==D.SPICE_MSG_DISPLAY_SURFACE_CREATE){"surfaces"in this||(this.surfaces=[]);var s=new es(t.data);if(s.surface.format!=D.SPICE_SURFACE_FMT_32_xRGB&&s.surface.format!=D.SPICE_SURFACE_FMT_32_ARGB)return this.log_warn("FIXME: cannot handle surface format "+s.surface.format+" yet."),!1;var i=document.createElement("canvas");return i.setAttribute("width",s.surface.width),i.setAttribute("height",s.surface.height),i.setAttribute("id","spice_surface_"+s.surface.surface_id),i.setAttribute("tabindex",s.surface.surface_id),i.context=i.getContext("2d"),s.surface.canvas=i,s.surface.draw_count=0,this.surfaces[s.surface.surface_id]=s.surface,s.surface.flags&D.SPICE_SURFACE_FLAGS_PRIMARY&&(this.primary_surface=s.surface.surface_id,i.context.save(),document.getElementById(this.parent.screen_id).appendChild(i),document.getElementById(this.parent.screen_id).style.height=s.surface.height+"px",this.hook_events()),!0}if(t.type==D.SPICE_MSG_DISPLAY_SURFACE_DESTROY){var s=new ts(t.data);return this.delete_surface(s.surface_id),!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_CREATE){var s=new ls(t.data);if(this.streams||(this.streams=new Array),this.streams[s.id]?console.log("Stream "+s.id+" already exists"):this.streams[s.id]=s,s.codec_type==D.SPICE_VIDEO_CODEC_TYPE_VP8){var g=new MediaSource,m=document.createElement("video");m.src=window.URL.createObjectURL(g),m.setAttribute("muted",!0),m.setAttribute("autoplay",!0),m.setAttribute("width",s.stream_width),m.setAttribute("height",s.stream_height);var S=s.dest.left,y=s.dest.top;this.surfaces[s.surface_id]!==void 0&&(S+=this.surfaces[s.surface_id].canvas.offsetLeft,y+=this.surfaces[s.surface_id].canvas.offsetTop),document.getElementById(this.parent.screen_id).appendChild(m),m.setAttribute("style","pointer-events:none; position: absolute; top:"+y+"px; left:"+S+"px;"),g.addEventListener("sourceopen",Ml,!1),g.addEventListener("sourceended",Rl,!1),g.addEventListener("sourceclosed",Dl,!1);var C=this.streams[s.id];C.video=m,C.media=g,C.queue=new Array,C.start_time=0,C.cluster_time=0,C.append_okay=!1,g.stream=C,g.spiceconn=this,m.spice_stream=C}else s.codec_type==D.SPICE_VIDEO_CODEC_TYPE_MJPEG?this.streams[s.id].frames_loading=0:console.log("Unhandled stream codec: "+s.codec_type);return!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_DATA||t.type==D.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED){var s;if(t.type==D.SPICE_MSG_DISPLAY_STREAM_DATA_SIZED?s=new us(t.data):s=new hs(t.data),!this.streams[s.base.id])return console.log("no stream for data"),!1;var w=s.base.multi_media_time-this.parent.relative_now();return this.streams[s.base.id].codec_type===D.SPICE_VIDEO_CODEC_TYPE_MJPEG&&Ll(this,s,w),this.streams[s.base.id].codec_type===D.SPICE_VIDEO_CODEC_TYPE_VP8&&Nl(this.streams[s.base.id],s),!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT){var s=new ds(t.data),I=new ps(s.stream_id,s.unique_id);return this.streams[s.stream_id]&&(this.streams[s.stream_id].report=I,this.streams[s.stream_id].max_window_size=s.max_window_size,this.streams[s.stream_id].timeout_ms=s.timeout_ms),!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_CLIP){var s=new fs(t.data);return this.streams[s.id].clip=s.clip,!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_DESTROY){var s=new _s(t.data);return this.streams[s.id].codec_type==D.SPICE_VIDEO_CODEC_TYPE_VP8&&(document.getElementById(this.parent.screen_id).removeChild(this.streams[s.id].video),this.streams[s.id].source_buffer=null,this.streams[s.id].media=null,this.streams[s.id].video=null),this.streams[s.id]=void 0,!0}if(t.type==D.SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL)return this.known_unimplemented(t.type,"Display Stream Destroy All"),!0;if(t.type==D.SPICE_MSG_DISPLAY_INVAL_LIST){var s=new ms(t.data),l;for(l=0;l<s.count;l++)this.cache[s.resources[l].id]!=null&&delete this.cache[s.resources[l].id];return!0}return t.type==D.SPICE_MSG_DISPLAY_MONITORS_CONFIG?(this.known_unimplemented(t.type,"Display Monitors Config"),!0):t.type==D.SPICE_MSG_DISPLAY_DRAW_COMPOSITE?(this.known_unimplemented(t.type,"Display Draw Composite"),!0):!1};Ke.prototype.delete_surface=function(t){var i;var e=document.getElementById("spice_surface_"+t);this.primary_surface==t&&(this.unhook_events(),this.primary_surface=void 0,(i=document.getElementById(this.parent.screen_id))==null||i.removeChild(e)),delete this.surfaces[t]};Ke.prototype.draw_copy_helper=function(t){var e=this.surfaces[t.base.surface_id].canvas;return t.has_alpha?this.surfaces[t.base.surface_id].format==D.SPICE_SURFACE_FMT_32_xRGB?(Tl(t.image_data),e.context.putImageData(t.image_data,t.base.box.left,t.base.box.top)):Ks(e.context,t.image_data,t.base.box.left,t.base.box.top):e.context.putImageData(t.image_data,t.base.box.left,t.base.box.top),(t.src_area.left>0||t.src_area.top>0)&&this.log_warn("FIXME: DrawCopy not shifting draw copies just yet..."),t.descriptor&&t.descriptor.flags&D.SPICE_IMAGE_FLAGS_CACHE_ME&&("cache"in this||(this.cache={}),this.cache[t.descriptor.id]=t.image_data),this.surfaces[t.base.surface_id].draw_count++,!0};Ke.prototype.log_draw=function(t,e){var i=t+"."+e.base.surface_id+"."+this.surfaces[e.base.surface_id].draw_count+": ";i+="base.box "+e.base.box.left+", "+e.base.box.top+" to "+e.base.box.right+", "+e.base.box.bottom,i+="; clip.type "+e.base.clip.type,e.data&&(e.data.src_area&&(i+="; src_area "+e.data.src_area.left+", "+e.data.src_area.top+" to "+e.data.src_area.right+", "+e.data.src_area.bottom),e.data.src_bitmap&&e.data.src_bitmap!=null?(i+="; src_bitmap id: "+e.data.src_bitmap.descriptor.id,i+="; src_bitmap width "+e.data.src_bitmap.descriptor.width+", height "+e.data.src_bitmap.descriptor.height,i+="; src_bitmap type "+e.data.src_bitmap.descriptor.type+", flags "+e.data.src_bitmap.descriptor.flags,e.data.src_bitmap.surface_id!==void 0&&(i+="; src_bitmap surface_id "+e.data.src_bitmap.surface_id),e.data.src_bitmap.bitmap&&(i+="; BITMAP format "+e.data.src_bitmap.bitmap.format+"; flags "+e.data.src_bitmap.bitmap.flags+"; x "+e.data.src_bitmap.bitmap.x+"; y "+e.data.src_bitmap.bitmap.y+"; stride "+e.data.src_bitmap.bitmap.stride),e.data.src_bitmap.quic&&(i+="; QUIC type "+e.data.src_bitmap.quic.type+"; width "+e.data.src_bitmap.quic.width+"; height "+e.data.src_bitmap.quic.height),e.data.src_bitmap.lz_rgb&&(i+="; LZ_RGB length "+e.data.src_bitmap.lz_rgb.length+"; magic "+e.data.src_bitmap.lz_rgb.magic+"; version 0x"+e.data.src_bitmap.lz_rgb.version.toString(16)+"; type "+e.data.src_bitmap.lz_rgb.type+"; width "+e.data.src_bitmap.lz_rgb.width+"; height "+e.data.src_bitmap.lz_rgb.height+"; stride "+e.data.src_bitmap.lz_rgb.stride+"; top down "+e.data.src_bitmap.lz_rgb.top_down)):i+="; src_bitmap is null",e.data.brush&&(e.data.brush.type==D.SPICE_BRUSH_TYPE_SOLID&&(i+="; brush.color 0x"+e.data.brush.color.toString(16)),e.data.brush.type==D.SPICE_BRUSH_TYPE_PATTERN&&(i+="; brush.pat ",e.data.brush.pattern.pat!=null?i+="[SpiceImage]":i+="[null]",i+=" at "+e.data.brush.pattern.pos.x+", "+e.data.brush.pattern.pos.y)),i+="; rop_descriptor "+e.data.rop_descriptor,e.data.scale_mode!==void 0&&(i+="; scale_mode "+e.data.scale_mode),i+="; mask.flags "+e.data.mask.flags,i+="; mask.pos "+e.data.mask.pos.x+", "+e.data.mask.pos.y,e.data.mask.bitmap!=null?(i+="; mask.bitmap width "+e.data.mask.bitmap.descriptor.width+", height "+e.data.mask.bitmap.descriptor.height,i+="; mask.bitmap type "+e.data.mask.bitmap.descriptor.type+", flags "+e.data.mask.bitmap.descriptor.flags):i+="; mask.bitmap is null"),console.log(i)};Ke.prototype.hook_events=function(){if(this.primary_surface!==void 0){var t=this.surfaces[this.primary_surface].canvas;t.sc=this.parent,t.addEventListener("mousemove",ks),t.addEventListener("mousedown",Ns),t.addEventListener("contextmenu",Us),t.addEventListener("mouseup",Bs),t.addEventListener("keydown",js),t.addEventListener("keyup",Hs),t.addEventListener("mouseout",qs),t.addEventListener("mouseover",Ys),t.addEventListener("wheel",Fs),t.focus()}};Ke.prototype.unhook_events=function(){if(this.primary_surface!==void 0){var t=this.surfaces[this.primary_surface].canvas;t.removeEventListener("mousemove",ks),t.removeEventListener("mousedown",Ns),t.removeEventListener("contextmenu",Us),t.removeEventListener("mouseup",Bs),t.removeEventListener("keydown",js),t.removeEventListener("keyup",Hs),t.removeEventListener("mouseout",qs),t.removeEventListener("mouseover",Ys),t.removeEventListener("wheel",Fs)}};Ke.prototype.destroy_surfaces=function(){for(var t in this.surfaces)this.delete_surface(this.surfaces[t].surface_id);this.surfaces=void 0};function Ys(t){this.focus()}function qs(t){this.sc&&this.sc.cursor&&this.sc.cursor.spice_simulated_cursor&&(this.sc.cursor.spice_simulated_cursor.style.display="none"),this.blur()}function ki(){var t=null,e;if("streams"in this.o.sc&&this.o.sc.streams[this.o.id]&&this.o.sc.streams[this.o.id].frames_loading--,this.o.sc.surfaces[this.o.base.surface_id]===void 0?(t=document.createElement("canvas"),t.setAttribute("width",this.o.base.box.right),t.setAttribute("height",this.o.base.box.bottom),e=t.getContext("2d")):e=this.o.sc.surfaces[this.o.base.surface_id].canvas.context,this.alpha_img){var i=document.createElement("canvas"),n=i.getContext("2d");i.setAttribute("width",this.alpha_img.width),i.setAttribute("height",this.alpha_img.height),n.putImageData(this.alpha_img,0,0),n.globalCompositeOperation="source-in",n.drawImage(this,0,0),e.drawImage(i,this.o.base.box.left,this.o.base.box.top),this.o.descriptor&&this.o.descriptor.flags&D.SPICE_IMAGE_FLAGS_CACHE_ME&&("cache"in this.o.sc||(this.o.sc.cache={}),this.o.sc.cache[this.o.descriptor.id]=n.getImageData(0,0,this.alpha_img.width,this.alpha_img.height))}else e.drawImage(this,this.o.base.box.left,this.o.base.box.top),this.onload=void 0,this.src=Xc,this.o.descriptor&&this.o.descriptor.flags&D.SPICE_IMAGE_FLAGS_CACHE_ME&&("cache"in this.o.sc||(this.o.sc.cache={}),this.o.sc.cache[this.o.descriptor.id]=e.getImageData(this.o.base.box.left,this.o.base.box.top,this.o.base.box.right-this.o.base.box.left,this.o.base.box.bottom-this.o.base.box.top));t==null&&this.o.sc.surfaces[this.o.base.surface_id].draw_count++,this.o.sc.streams[this.o.id]&&"report"in this.o.sc.streams[this.o.id]&&zs(this.o.sc,this.o.id,this.o.msg_mmtime,this.o.msg_mmtime-this.o.sc.parent.relative_now())}function Ll(t,e,i){if(i<0&&t.streams[e.base.id].frames_loading>0){"report"in t.streams[e.base.id]&&t.streams[e.base.id].report.num_drops++;return}var n="data:image/jpeg,",r=new Image,p;for(p=0;p<e.data.length;p++)n+="%",e.data[p]<16&&(n+="0"),n+=e.data[p].toString(16);var a=new wt;a.surface_id=t.streams[e.base.id].surface_id,a.box=e.dest||t.streams[e.base.id].dest,a.clip=t.streams[e.base.id].clip,r.o={base:a,tag:"mjpeg."+e.base.id,descriptor:null,sc:t,id:e.base.id,msg_mmtime:e.base.multi_media_time},r.onload=ki,r.src=n,t.streams[e.base.id].frames_loading++}function zs(t,e,i,n){if(t.streams[e].report.num_frames++,t.streams[e].report.start_frame_mm_time==0&&(t.streams[e].report.start_frame_mm_time=i),t.streams[e].report.num_frames>t.streams[e].max_window_size||i-t.streams[e].report.start_frame_mm_time>t.streams[e].timeout_ms){t.streams[e].report.end_frame_mm_time=i,t.streams[e].report.last_frame_delay=n;var r=new fe;r.build_msg(D.SPICE_MSGC_DISPLAY_STREAM_REPORT,t.streams[e].report),t.send_msg(r),t.streams[e].report.start_frame_mm_time=0,t.streams[e].report.num_frames=0,t.streams[e].report.num_drops=0}}function Ml(t){var e=this.stream,i=this.spiceconn;if(!e.source_buffer){var n=this.addSourceBuffer(pe.SPICE_VP8_CODEC);if(!n){i.log_err("Codec "+pe.SPICE_VP8_CODEC+" not available.");return}e.source_buffer=n,n.spiceconn=i,n.stream=e,Fl(e);var r=new rr,p=new Os(this.stream.stream_width,this.stream.stream_height),a=new er(p),v=new ArrayBuffer(r.buffer_size()+a.buffer_size()),l=r.to_buffer(v);a.to_buffer(v,l),n.addEventListener("error",kl,!1),n.addEventListener("updateend",Ol,!1),or(n,v)}}function Rl(t){var e=this.spiceconn;e.log_err("Video source unexpectedly ended.")}function Dl(t){var e=this.spiceconn;e.log_err("Video source unexpectedly closed.")}function or(t,e){try{t.stream.append_okay=!1,t.appendBuffer(e)}catch(n){var i=t.spiceconn;i.log_err("Error invoking appendBuffer: "+n.message)}}function Ol(t){var e=this.stream;if(e.current_frame&&"report"in e){var i=this.stream.media.spiceconn,n=this.stream.current_frame.msg_mmtime;zs(i,e.id,n,n-i.parent.relative_now())}if(e.queue.length>0?(e.current_frame=e.queue.shift(),or(e.source_buffer,e.current_frame.mb)):e.append_okay=!0,!!e.video&&(e.video.buffered.length>0&&e.video.currentTime<e.video.buffered.start(e.video.buffered.length-1)&&(console.log("Video appears to have fallen behind; advancing to "+e.video.buffered.start(e.video.buffered.length-1)),e.video.currentTime=e.video.buffered.start(e.video.buffered.length-1)),this.stream.video.paused&&this.stream.video.readyState>=2))var r=this.stream.video.play()}function kl(t){var e=this.spiceconn;e.log_err("source_buffer error "+t.message)}function Ws(t,e,i){var n={msg_mmtime:e.base.multi_media_time};t.append_okay?(t.current_frame=n,or(t.source_buffer,i)):(n.mb=i,t.queue.push(n))}function Vs(t,e,i){var n=new ir(e.base.multi_media_time-t.cluster_time,e.data,i),r=new ArrayBuffer(n.buffer_size());n.to_buffer(r),Ws(t,e,r)}function Wr(t,e){t.cluster_time=e.base.multi_media_time;var i=new tr(t.cluster_time-t.start_time,e.data),n=new ArrayBuffer(i.buffer_size());i.to_buffer(n),Ws(t,e,n),Vs(t,e,!0)}function Nl(t,e){t.start_time==0?(t.start_time=e.base.multi_media_time,Wr(t,e)):e.base.multi_media_time-t.cluster_time>=pe.MAX_CLUSTER_TIME?Wr(t,e):Vs(t,e,!1)}function Ul(t){var e=this.spice_stream;e.video&&e.video.buffered.len>1&&console.log(e.video.currentTime+":id "+e.id+" event "+t.type+Dn(e.video)),e.queue.length>1&&console.log("  queue len "+e.queue.length+"; append_okay: "+e.append_okay)}function Bl(t){this.addEventListener(t,Ul)}function Fl(t){var e=["abort","error"];e.forEach(Bl,t.video)}function pt(){we.apply(this,arguments),this.queue=new Array,this.append_okay=!1,this.start_time=0}pt.prototype=Object.create(we.prototype);pt.prototype.process_channel_message=function(t){if(!window.MediaSource)return this.log_err("MediaSource API is not available"),!1;if(t.type==D.SPICE_MSG_PLAYBACK_START){var e=new as(t.data);if(e.frequency!=pe.OPUS_FREQUENCY)return this.log_err("This player cannot handle frequency "+e.frequency),!1;if(e.channels!=pe.OPUS_CHANNELS)return this.log_err("This player cannot handle "+e.channels+" channels"),!1;if(e.format!=D.SPICE_AUDIO_FMT_S16)return this.log_err("This player cannot format "+e.format),!1;if(!this.source_buffer)return this.media_source=new MediaSource,this.media_source.spiceconn=this,this.audio=document.createElement("audio"),this.audio.spiceconn=this,this.audio.setAttribute("autoplay",!0),this.audio.src=window.URL.createObjectURL(this.media_source),document.getElementById(this.parent.screen_id).appendChild(this.audio),this.media_source.addEventListener("sourceopen",jl,!1),this.media_source.addEventListener("sourceended",Hl,!1),this.media_source.addEventListener("sourceclosed",Gl,!1),this.bytes_written=0,!0}if(t.type==D.SPICE_MSG_PLAYBACK_DATA){var i=new ss(t.data);return this.source_buffer&&(this.audio.readyState>=3&&this.audio.buffered.length>1&&this.audio.currentTime==this.audio.buffered.end(0)&&this.audio.currentTime<this.audio.buffered.start(this.audio.buffered.length-1)&&(console.log("Audio underrun: we appear to have fallen behind; advancing to "+this.audio.buffered.start(this.audio.buffered.length-1)),this.audio.currentTime=this.audio.buffered.start(this.audio.buffered.length-1)),this.start_time!=0&&i.time!=this.last_data_time+pe.EXPECTED_PACKET_DURATION&&Math.abs(i.time-(pe.EXPECTED_PACKET_DURATION+this.last_data_time))<pe.MAX_CLUSTER_TIME&&(i.time=this.last_data_time+pe.EXPECTED_PACKET_DURATION),this.last_data_time=i.time,this.start_time==0?this.start_playback(i):i.time-this.cluster_time>=pe.MAX_CLUSTER_TIME?this.new_cluster(i):this.simple_block(i,!1)),!0}if(t.type==D.SPICE_MSG_PLAYBACK_MODE){var n=new os(t.data);return n.mode!=D.SPICE_AUDIO_DATA_MODE_OPUS&&(this.log_err("This player cannot handle mode "+n.mode),delete this.source_buffer),!0}return t.type==D.SPICE_MSG_PLAYBACK_STOP&&this.source_buffer?(document.getElementById(this.parent.screen_id).removeChild(this.audio),window.URL.revokeObjectURL(this.audio.src),delete this.source_buffer,delete this.media_source,delete this.audio,this.append_okay=!1,this.queue=new Array,this.start_time=0,!0):t.type==D.SPICE_MSG_PLAYBACK_VOLUME?(this.known_unimplemented(t.type,"Playback Volume"),!0):t.type==D.SPICE_MSG_PLAYBACK_MUTE?(this.known_unimplemented(t.type,"Playback Mute"),!0):t.type==D.SPICE_MSG_PLAYBACK_LATENCY?(this.known_unimplemented(t.type,"Playback Latency"),!0):!1};pt.prototype.start_playback=function(t){this.start_time=t.time;var e=new rr,i=new Ds,n=new er(i),r=new ArrayBuffer(e.buffer_size()+n.buffer_size());this.bytes_written=e.to_buffer(r),this.bytes_written=n.to_buffer(r,this.bytes_written),this.source_buffer.addEventListener("error",ql,!1),this.source_buffer.addEventListener("updateend",Yl,!1),hi(this,r),this.new_cluster(t)};pt.prototype.new_cluster=function(t){this.cluster_time=t.time;var e=new tr(t.time-this.start_time),i=new ArrayBuffer(e.buffer_size());this.bytes_written+=e.to_buffer(i),this.append_okay?hi(this,i):this.queue.push(i),this.simple_block(t,!0)};pt.prototype.simple_block=function(t,e){var i=new ir(t.time-this.cluster_time,t.data,e),n=new ArrayBuffer(i.buffer_size());this.bytes_written+=i.to_buffer(n),this.append_okay?hi(this,n):this.queue.push(n)};function jl(t){var e=this.spiceconn;if(!e.source_buffer){if(e.source_buffer=this.addSourceBuffer(pe.SPICE_PLAYBACK_CODEC),!e.source_buffer){e.log_err("Codec "+pe.SPICE_PLAYBACK_CODEC+" not available.");return}Vl(e),e.source_buffer.spiceconn=e,e.source_buffer.mode="segments"}}function Hl(t){var e=this.spiceconn;e.log_err("Audio source unexpectedly ended.")}function Gl(t){var e=this.spiceconn;e.log_err("Audio source unexpectedly closed.")}function Kl(t){if(t.length==1)return t.shift();var e=0,i=0;for(i=0;i<t.length;i++)e+=t[i].byteLength;var n=new ArrayBuffer(e),r=new Uint8Array(n);for(e=0,i=0;i<t.length;i++)r.set(new Uint8Array(t[i]),e),e+=t[i].byteLength;return t.length=0,n}function Yl(t){var e=this.spiceconn;if(e.queue.length>0){var i=Kl(e.queue);hi(e,i)}else e.append_okay=!0}function ql(t){var e=this.spiceconn;e.log_err("source_buffer error "+t.message)}function hi(t,e){try{t.source_buffer.appendBuffer(e),t.append_okay=!1}catch(i){t.log_err("Error invoking appendBuffer: "+i.message)}}function zl(t){var e=this.spiceconn;e.audio&&e.audio.buffered.len>1&&console.log(e.audio.currentTime+": event "+t.type+Dn(e.audio)),e.queue.length>1&&console.log("  queue len "+e.queue.length+"; append_okay: "+e.append_okay)}function Wl(t){this.addEventListener(t,zl)}function Vl(t){var e=["abort","error"];e.forEach(Wl,t.audio)}function ar(){we.apply(this,arguments),this.port_name=null}ar.prototype=Object.create(we.prototype);ar.prototype.process_channel_message=function(t){if(t.type==D.SPICE_MSG_PORT_INIT){if(this.port_name===null){var e=new vs(t.data);return this.portName=Zc(new Uint8Array(e.name)),this.portOpened=e.opened,!0}}else if(t.type==D.SPICE_MSG_PORT_EVENT){var i=new CustomEvent("spice-port-event",{detail:{channel:this,spiceEvent:new Uint8Array(t.data)},bubbles:!0,cancelable:!0});return window.dispatchEvent(i),!0}else if(t.type==D.SPICE_MSG_SPICEVMC_DATA){var i=new CustomEvent("spice-port-data",{detail:{channel:this,data:t.data},bubbles:!0,cancelable:!0});return window.dispatchEvent(i),!0}return!1};function Xl(t){if(t){var e=document.getElementById(t.screen_id).clientWidth,i=document.getElementById("spice-area"),n=document.isFullScreen||document.fullscreenElement||document.webkitIsFullScreen||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement,r=window.innerHeight-i.getBoundingClientRect().top;n||(r=r-20),r<200&&(r=200),r%8>0&&(r-=r%8),e%8>0&&(e-=e%8),t.resize_window(0,e,r,32,0,0),t.spice_resize_timer=void 0}}function $l(t){var e=window.spice_connection;e&&(e.spice_resize_timer&&(window.clearTimeout(e.spice_resize_timer),e.spice_resize_timer=void 0),e.spice_resize_timer=window.setTimeout(Xl,200,e))}function xe(){if(typeof WebSocket>"u")throw new Error("WebSocket unavailable.  You need to use a different browser.");we.apply(this,arguments),this.agent_msg_queue=[],this.file_xfer_tasks={},this.file_xfer_task_id=0,this.file_xfer_read_queue=[],this.ports=[]}xe.prototype=Object.create(we.prototype);xe.prototype.process_channel_message=function(t){if(t.type==D.SPICE_MSG_MAIN_MIGRATE_BEGIN)return this.known_unimplemented(t.type,"Main Migrate Begin"),!0;if(t.type==D.SPICE_MSG_MAIN_MIGRATE_CANCEL)return this.known_unimplemented(t.type,"Main Migrate Cancel"),!0;if(t.type==D.SPICE_MSG_MAIN_INIT){this.log_info("Connected to "+this.ws.url),this.report_success("Connected"),this.main_init=new Bn(t.data),this.connection_id=this.main_init.session_id,this.agent_tokens=this.main_init.agent_tokens,this.our_mm_time=Date.now(),this.mm_time=this.main_init.multi_media_time,this.handle_mouse_mode(this.main_init.current_mouse_mode,this.main_init.supported_mouse_modes),this.main_init.agent_connected&&this.connect_agent();var e=new fe;return e.type=D.SPICE_MSGC_MAIN_ATTACH_CHANNELS,e.size=e.buffer_size(),this.send_msg(e),!0}if(t.type==D.SPICE_MSG_MAIN_MOUSE_MODE){var i=new Fn(t.data);return this.handle_mouse_mode(i.current_mode,i.supported_modes),!0}if(t.type==D.SPICE_MSG_MAIN_MULTI_MEDIA_TIME)return this.known_unimplemented(t.type,"Main Multi Media Time"),!0;if(t.type==D.SPICE_MSG_MAIN_CHANNELS_LIST){var n,r;for(r=new Un(t.data),n=0;n<r.channels.length;n++){var p={uri:this.ws.url,parent:this,connection_id:this.connection_id,type:r.channels[n].type,chan_id:r.channels[n].id};r.channels[n].type==D.SPICE_CHANNEL_DISPLAY?r.channels[n].id==0?this.display=new Ke(p):this.log_warn("The spice-html5 client does not handle multiple heads."):r.channels[n].type==D.SPICE_CHANNEL_INPUTS?(this.inputs=new nr(p),this.inputs.mouse_mode=this.mouse_mode):r.channels[n].type==D.SPICE_CHANNEL_CURSOR?this.cursor=new ci(p):r.channels[n].type==D.SPICE_CHANNEL_PLAYBACK?this.cursor=new pt(p):r.channels[n].type==D.SPICE_CHANNEL_PORT?this.ports.push(new ar(p)):("extra_channels"in this||(this.extra_channels=[]),this.extra_channels[n]=new we(p),this.log_err("Channel type "+this.extra_channels[n].channel_type()+" not implemented"))}return!0}if(t.type==D.SPICE_MSG_MAIN_AGENT_CONNECTED)return this.connect_agent(),!0;if(t.type==D.SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS){var a=new Ri(t.data);return this.agent_tokens=a.num_tokens,this.connect_agent(),!0}if(t.type==D.SPICE_MSG_MAIN_AGENT_TOKEN){var v,l=new Ri(t.data);for(this.agent_tokens+=l.num_tokens,this.send_agent_message_queue(),v=this.agent_tokens;v>0&&this.file_xfer_read_queue.length>0;){var u=this.file_xfer_read_queue.shift();this.file_xfer_read(u,u.read_bytes),v--}return!0}if(t.type==D.SPICE_MSG_MAIN_AGENT_DISCONNECTED)return this.agent_connected=!1,!0;if(t.type==D.SPICE_MSG_MAIN_AGENT_DATA){var d=new jn(t.data);if(d.type==D.VD_AGENT_ANNOUNCE_CAPABILITIES){var b=new Vi(d.data);return b.request&&this.announce_agent_capabilities(0),!0}else if(d.type==D.VD_AGENT_FILE_XFER_STATUS)return this.handle_file_xfer_status(new Xi(d.data)),!0;return!1}return t.type==D.SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST?(this.known_unimplemented(t.type,"Main Migrate Switch Host"),!0):t.type==D.SPICE_MSG_MAIN_MIGRATE_END?(this.known_unimplemented(t.type,"Main Migrate End"),!0):t.type==D.SPICE_MSG_MAIN_NAME?(this.known_unimplemented(t.type,"Main Name"),!0):t.type==D.SPICE_MSG_MAIN_UUID?(this.known_unimplemented(t.type,"Main UUID"),!0):t.type==D.SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS?(this.known_unimplemented(t.type,"Main Migrate Begin Seamless"),!0):t.type==D.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK?(this.known_unimplemented(t.type,"Main Migrate Dst Seamless ACK"),!0):t.type==D.SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_NACK?(this.known_unimplemented(t.type,"Main Migrate Dst Seamless NACK"),!0):!1};xe.prototype.stop=function(t){if(this.state="closing",this.inputs&&(this.inputs.cleanup(),this.inputs=void 0),this.cursor&&(this.cursor.cleanup(),this.cursor=void 0),this.display&&(this.display.cleanup(),this.display.destroy_surfaces(),this.display=void 0),this.cleanup(),"extra_channels"in this)for(var e in this.extra_channels)this.extra_channels[e].cleanup();this.extra_channels=void 0};xe.prototype.send_agent_message_queue=function(t){if(this.agent_connected)for(t&&this.agent_msg_queue.push(t);this.agent_tokens>0&&this.agent_msg_queue.length>0;){var e=this.agent_msg_queue.shift();this.send_msg(e),this.agent_tokens--}};xe.prototype.send_agent_message=function(t,e){var i=new qn(t,e),n=0,r=D.VD_AGENT_MAX_DATA_SIZE-fe.prototype.buffer_size(),p=new ArrayBuffer(i.buffer_size());for(i.to_buffer(p);n<i.buffer_size();){var a=Math.min(n+r,i.buffer_size()),v=new fe;v.type=D.SPICE_MSGC_MAIN_AGENT_DATA,v.size=a-n,v.data=p.slice(n,a),this.send_agent_message_queue(v),n=a}};xe.prototype.announce_agent_capabilities=function(t){var e=new Vi(t,1<<D.VD_AGENT_CAP_MOUSE_STATE|1<<D.VD_AGENT_CAP_MONITORS_CONFIG|1<<D.VD_AGENT_CAP_REPLY);this.send_agent_message(D.VD_AGENT_ANNOUNCE_CAPABILITIES,e)};xe.prototype.resize_window=function(t,e,i,n,r,p){var a=new zn(t,e,i,n,r,p);this.send_agent_message(D.VD_AGENT_MONITORS_CONFIG,a)};xe.prototype.file_xfer_start=function(t){var e,i,n;e=this.file_xfer_task_id++,n=new li(e,t),n.create_progressbar(),this.file_xfer_tasks[e]=n,i=new Wn(e,t.name,t.size),this.send_agent_message(D.VD_AGENT_FILE_XFER_START,i)};xe.prototype.handle_file_xfer_status=function(t){var e,i;if(this.file_xfer_tasks[t.id]){switch(i=this.file_xfer_tasks[t.id],t.result){case D.VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA:this.file_xfer_read(i);return;case D.VD_AGENT_FILE_XFER_STATUS_CANCELLED:e="transfer is cancelled by spice agent";break;case D.VD_AGENT_FILE_XFER_STATUS_ERROR:e="some errors occurred in the spice agent";break;case D.VD_AGENT_FILE_XFER_STATUS_SUCCESS:break;default:e="unhandled status type: "+t.result;break}this.file_xfer_completed(i,e)}};xe.prototype.file_xfer_read=function(t,e){var i=32*D.VD_AGENT_MAX_DATA_SIZE,n=this,r,p,a,v;if(!(!t||!this.file_xfer_tasks[t.id]||e>0&&e==t.file.size)){if(t.cancelled){var l=new Xi(t.id,D.VD_AGENT_FILE_XFER_STATUS_CANCELLED);this.send_agent_message(D.VD_AGENT_FILE_XFER_STATUS,l),delete this.file_xfer_tasks[t.id];return}if(r=e||0,p=Math.min(r+i,t.file.size),!this.agent_tokens){t.read_bytes=r,this.file_xfer_read_queue.push(t);return}v=new FileReader,v.onload=function(u){var d=new Vn(t.id,u.target.result.byteLength,u.target.result);n.send_agent_message(D.VD_AGENT_FILE_XFER_DATA,d),n.file_xfer_read(t,p),t.update_progressbar(p)},a=t.file.slice(r,p),v.readAsArrayBuffer(a)}};xe.prototype.file_xfer_completed=function(t,e){e?this.log_err(e):this.log_info("transfer of '"+t.file.name+"' was successful"),t.remove_progressbar(),delete this.file_xfer_tasks[t.id]};xe.prototype.connect_agent=function(){this.agent_connected=!0;var t=new Yn(-1),e=new fe;e.build_msg(D.SPICE_MSGC_MAIN_AGENT_START,t),this.send_msg(e),this.announce_agent_capabilities(1),this.onagent!==void 0&&this.onagent(this)};xe.prototype.handle_mouse_mode=function(t,e){if(this.mouse_mode=t,t!=D.SPICE_MOUSE_MODE_CLIENT&&e&D.SPICE_MOUSE_MODE_CLIENT){var i=new Kn(D.SPICE_MOUSE_MODE_CLIENT),n=new fe;n.build_msg(D.SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST,i),this.send_msg(n)}this.inputs&&(this.inputs.mouse_mode=t)};xe.prototype.relative_now=function(){var t=Date.now()-this.our_mm_time+this.mm_time;return t};const Zl=({instance:t,onMount:e,onFailure:i,inTabNotification:n,clearNotification:r})=>{var _;const{name:p,project:a}=ct(),v=K.useNotify(),l=Z.useRef(null),[u,d]=Z.useState(!1),b=t.status==="Running",o=s=>{i("Error",s)},c=()=>{lt("spice-wrapper",void 0,10),$l()},f=async()=>{if(!p){i("Missing name",new Error);return}if(!a){i("Missing project",new Error);return}d(!0);const s=await _o(p,a).catch(C=>{d(!1),b&&i("Connection failed",C)});if(!s)return;const g=s.operation.split("?")[0],m=`wss://${location.host}${g}/websocket?secret=${s.metadata.metadata.fds[0]}`,S=`wss://${location.host}${g}/websocket?secret=${s.metadata.metadata.fds.control}`,y=new WebSocket(S);y.onerror=o,y.onclose=C=>{C.code!==1005&&i("Error",C.reason,bt(C.code))},y.onmessage=C=>{console.log("control message",C)};try{window.spice_connection=new xe({uri:m,screen_id:"spice-screen",onerror:o,onsuccess:()=>{d(!1),c()},onagent:c})}catch(C){b&&i("Connection failed",C)}return y};return He("resize",c),Z.useEffect(c,[(_=v.notification)==null?void 0:_.message,n==null?void 0:n.message]),Z.useEffect(()=>{r();const s=f();return()=>{var g;try{(g=window.spice_connection)==null||g.stop()}catch(m){console.error(m)}s.then(m=>m==null?void 0:m.close())}},[t.status]),e(()=>{const s=l.current;s&&s.requestFullscreen().then(c).catch(g=>{i("Failed to enter full-screen mode",g)})}),E.jsx(E.Fragment,{children:u?E.jsx(Ge,{text:"Loading VGA session..."}):E.jsx("div",{id:"spice-area",ref:l,children:E.jsx("div",{id:"spice-screen",className:"spice-screen"})})})},Ql=({instance:t,onFailure:e,showNotRunningInfo:i,clearNotification:n})=>{const{name:r,project:p}=ct(),a=Z.useRef(null),v=new TextEncoder,[l,u]=Z.useState(!1),[d,b]=Z.useState(""),[o,c]=Z.useState(null),[f]=Z.useState(new cn.FitAddon),[h,_]=Z.useState(!1);Vr({when:h,message:"Are you sure you want to leave this page?"}),He("beforeunload",C=>{h&&(C.returnValue="Are you sure you want to leave this page?")});const g=t.status==="Running",m=C=>{e("Error",C)},S=async()=>{if(!r){e("Missing name",new Error);return}if(!p){e("Missing project",new Error);return}u(!0),po(r,p).then(b).catch(console.error);const C=await mo(r,p).catch(x=>{u(!1),g?e("Connection failed",x):i()});if(!C)return;const w=C.operation.split("?")[0],I=`wss://${location.host}${w}/websocket?secret=${C.metadata.metadata.fds[0]}`,R=`wss://${location.host}${w}/websocket?secret=${C.metadata.metadata.fds.control}`,k=new WebSocket(I),P=new WebSocket(R);return P.onopen=()=>{u(!1)},P.onerror=m,P.onclose=x=>{x.code!==1005&&e("Error",x.reason,bt(x.code))},P.onmessage=x=>{console.log("control message",x)},k.onopen=()=>{c(k)},k.onerror=m,k.onclose=x=>{x.code!==1005&&e("Error",x.reason,bt(x.code)),c(null)},k.binaryType="arraybuffer",k.onmessage=x=>{var A;(A=a.current)==null||A.terminal.writeUtf8(new Uint8Array(x.data))},[k,P]};Z.useEffect(()=>{var C;g&&((C=a.current)==null||C.terminal.focus())},[g,a.current]),Z.useEffect(()=>{if(o)return;n();const C=S();return()=>{C.then(w=>{w==null||w.map(I=>I.close())})}},[a,f,t.status]),Z.useEffect(()=>{!d||!a.current||l||(a.current.terminal.write(d),b(""))},[d,a,l]);const y=()=>{var C,w;lt("p-terminal",void 0,10),(w=(C=a.current)==null?void 0:C.terminal.element)==null||w.style.setProperty("padding","1rem"),a.current&&a.current.terminal.options===void 0&&(a.current.terminal.options={}),f.fit()};return He("resize",()=>{y(),setTimeout(y,500)}),Z.useLayoutEffect(()=>{y()},[f,a,l]),E.jsx(E.Fragment,{children:l?E.jsx(Ge,{text:"Loading text console..."}):E.jsx(on,{ref:a,addons:[f],className:"p-terminal",onData:C=>{_(!0),o==null||o.send(v.encode(C))}})})},Jl=({instance:t})=>{const[e,i]=Z.useState(null),n=t.type==="virtual-machine",[r,p]=Z.useState(n),a=t.status==="Running",v=(f,h,_)=>{i(K.failure(f,h,_))},l=()=>{i(K.info("Start the instance to interact with the text console.","Instance not running"))};let u=()=>{};const d=f=>{u=f},b=f=>{i(null),p(f)},{handleStart:o,isLoading:c}=Xr(t);return E.jsxs("div",{className:"instance-console-tab",children:[n&&E.jsxs("div",{className:"p-panel__controls",children:[E.jsxs("div",{className:"console-radio-wrapper",children:[E.jsx(K.RadioInput,{labelClassName:"right-margin",label:"Graphic",checked:r,onChange:()=>b(!0)}),E.jsx(K.RadioInput,{label:"Text console",checked:!r,onChange:()=>b(!1)})]}),r&&a&&E.jsxs("div",{children:[E.jsx(K.Button,{className:"u-no-margin--bottom",onClick:()=>u(),children:E.jsx("span",{children:"Fullscreen"})}),E.jsx(K.ContextualMenu,{hasToggleIcon:!0,toggleLabel:"Shortcuts",toggleClassName:"u-no-margin--bottom",links:[{children:"Send Ctrl + Alt + Del",onClick:()=>wl(window.spice_connection)},{children:"Send Alt + TAB",onClick:()=>Al(window.spice_connection)},{children:"Send Alt + F4",onClick:()=>xl(window.spice_connection)}]})]})]}),E.jsx(Zt,{notification:e,onDismiss:()=>i(null)}),r&&!a&&E.jsxs(K.EmptyState,{className:"empty-state",image:E.jsx(K.Icon,{name:"containers",className:"empty-state-icon"}),title:"Instance stopped",children:[E.jsx("p",{children:"Start the instance to access the graphic console."}),E.jsx(Et,{isSubmitting:c,isDisabled:!1,buttonLabel:"Start instance",onClick:o})]}),r&&a&&E.jsx("div",{className:"spice-wrapper",children:E.jsx(Zl,{instance:t,onMount:d,onFailure:v,inTabNotification:e,clearNotification:()=>i(null)})}),!r&&E.jsx(Ql,{instance:t,onFailure:v,showNotRunningInfo:l,clearNotification:()=>i(null)})]})},eh=({instance:t,content:e,fileName:i})=>{const n=Z.useRef(null),r=(a,v)=>{const l=document.createElement("a");return l.setAttribute("href",v),l.setAttribute("target","_blank"),l.setAttribute("download",i),l.setAttribute("id",a),l.style.display="none",l},p=async()=>{var o;const a=`link-${i.toLowerCase().replace(" ","-")}`,v=document.getElementById(a);if(v){v.click();return}const l=e||await tn(t.name,t.project,i),u=new Blob([l],{type:"text/plain"}),d=URL.createObjectURL(u),b=r(a,d);(o=n.current)==null||o.appendChild(b),b.click()};return E.jsx(K.Button,{appearance:"base",className:"u-no-margin--bottom",onClick:()=>void p(),title:`Download ${i}`,"aria-label":`Download ${i} file`,hasIcon:!0,dense:!0,ref:n,children:E.jsx(K.Icon,{name:"begin-downloading",alt:"download"})})},th=({instance:t,path:e})=>{const i=e.split("/").at(-1)??"",n=`/ui/project/${t.project}/instances/detail/${t.name}/logs/?file=${i}`,[r,p]=Z.useState(vo("file")===i),{data:a,isLoading:v,isSuccess:l}=at({queryKey:[Ee.instances,t.name,t.project,Ee.logs,i],queryFn:()=>tn(t.name,t.project,i),enabled:r}),u=()=>{p(d=>!d)};return E.jsxs("div",{className:"p-code-snippet file-row",children:[E.jsxs("div",{className:"p-code-snippet__header file-row-header",children:[E.jsxs(K.Button,{appearance:"base",hasIcon:!0,className:"u-no-margin--bottom file-row-toggle","aria-label":`Toggle ${i} visibility`,"aria-controls":i,"aria-hidden":!r,onClick:u,children:[E.jsx(K.Icon,{name:r?"chevron-up":"chevron-down"}),E.jsx("h3",{className:"p-code-snippet__title file-row-title",children:i})]}),E.jsx("a",{href:n,"aria-label":`File ${i} URL`,className:"p-button--base u-no-margin--bottom",children:E.jsx(K.Icon,{name:"get-link",alt:"link"})}),E.jsx(eh,{fileName:i,instance:t,content:a??""})]}),r&&E.jsx("pre",{id:i,className:"p-code-snippet__block","aria-hidden":!r,children:E.jsxs("code",{children:[v&&E.jsx(E.Fragment,{children:"Downloading file content..."}),l&&!a&&E.jsx(E.Fragment,{children:"This file is empty."}),l&&a&&E.jsx(E.Fragment,{children:a})]})})]})},ih=({instance:t})=>{const{data:e=[],isLoading:i}=at({queryKey:[Ee.instances,t.name,t.project,Ee.logs],queryFn:()=>go(t.name,t.project)});return E.jsxs(E.Fragment,{children:[i&&E.jsx(Ge,{text:"Loading logs..."}),!i&&e.length===0&&E.jsx("div",{className:"u-align-text--center",children:"There are no log files for this instance."}),!i&&e.length>0&&e.map(n=>E.jsx(th,{instance:t,path:n},n))]})},rh=({instance:t})=>{var h;const e=Xe(),i=K.useNotify(),{project:n,activeSection:r}=ct(),p=et(),a=Bi(),[v,l]=Z.useState(!0);if(!n)return E.jsx(E.Fragment,{children:"Missing project"});const u=()=>{lt("form-contents","p-bottom-controls")};Z.useEffect(u,[(h=i.notification)==null?void 0:h.message,r]),He("resize",u);const d=ht({initialValues:Dt(t),validationSchema:nn,onSubmit:_=>{const s=_.yaml?Bo(_.yaml):sn(t,_);s.etag=t.etag,en(s,n).then(g=>{e.set(g.metadata.id,()=>{i.success("Instance updated."),d.setValues(Dt(s))},m=>i.failure("Instance update failed",new Error(m)),()=>{d.setSubmitting(!1),p.invalidateQueries({queryKey:[Ee.instances]})})})}}),b=_=>{d.values.yaml&&_!==pr&&d.setFieldValue("yaml",void 0);const s=`/ui/project/${n}/instances/detail/${t.name}/configuration`;a(_===ui?s:`${s}/${Ne(_)}`)},o=()=>{l(_=>!_)},c=()=>{const _=new Set(["backups","snapshots","state","expanded_config","expanded_devices","etag"]),s=Object.fromEntries(Object.entries(t).filter(g=>!_.has(g[0])));return jo(s)},f=d.values.readOnly;return E.jsxs("div",{className:"edit-instance",children:[E.jsxs(K.Form,{onSubmit:d.handleSubmit,stacked:!0,className:"form",children:[E.jsx(Ho,{active:r??Ne(ui),setActive:b,isConfigDisabled:!1,isConfigOpen:v,toggleConfigOpen:o,hasDiskError:_r(d),hasNetworkError:dr(d)}),E.jsx(K.Row,{className:"form-contents",children:E.jsxs(K.Col,{size:12,children:[(r===Ne(ui)||!r)&&E.jsx(Uo,{formik:d,project:n}),r===Ne(Go)&&E.jsx(Ro,{formik:d,project:n}),r===Ne(Ko)&&E.jsx(Do,{formik:d,project:n}),r===Ne(Yo)&&E.jsx(Oo,{formik:d}),r===Ne(qo)&&E.jsx(ko,{formik:d}),r===Ne(zo)&&E.jsx(rn,{formik:d}),r===Ne(Wo)&&E.jsx(No,{formik:d}),r===Ne(pr)&&E.jsx(Fo,{yaml:c(),setYaml:_=>void d.setFieldValue("yaml",_),isReadOnly:f,children:!f&&E.jsx(K.Notification,{severity:"caution",title:"Before you edit the YAML",children:"Changes will be discarded, when switching back to the guided forms."})})]})},r)]}),E.jsxs("div",{className:"p-bottom-controls",id:"form-footer",children:[E.jsx("hr",{}),E.jsx(K.Row,{className:"u-align--right",children:E.jsx(K.Col,{size:12,children:f?E.jsx(K.Button,{appearance:"positive",onClick:()=>{d.setFieldValue("readOnly",!1),i.clear()},children:"Edit instance"}):E.jsxs(E.Fragment,{children:[E.jsx(K.Button,{appearance:"base",onClick:()=>d.setValues(Dt(t)),children:"Cancel"}),E.jsx(Et,{isSubmitting:d.isSubmitting,isDisabled:!d.isValid||_r(d)||dr(d),buttonLabel:"Save changes",onClick:()=>void d.submitForm()})]})})})]})]})},nh=({instance:t})=>{const e=Xe(),i=bo(),n=K.useNotify(),r=et(),[p,a]=Z.useState(!1),v=Bi(),l=()=>{a(!0),So(t).then(o=>{e.set(o.metadata.id,()=>{r.invalidateQueries({queryKey:[Ee.projects,t.project]}),v(`/ui/project/${t.project}/instances`,n.queue(n.success(`Instance ${t.name} deleted.`)))},c=>n.failure("Instance deletion failed",new Error(c),E.jsxs(E.Fragment,{children:["Instance ",E.jsx(Ue,{item:t,bold:!0}),":"]})),()=>a(!1))})},u=Mo.includes(t.status),d=p||!u,b=()=>u?"Delete instance":"Stop the instance to delete it";return E.jsxs(K.ConfirmationButton,{onHoverText:b(),appearance:i?"base":"default",className:Ui("u-no-margin--bottom",{"has-icon":i}),loading:p,confirmationModalProps:{title:"Confirm delete",children:E.jsxs("p",{children:["This will permanently delete instance"," ",E.jsx(Ue,{item:t,bold:!0}),".",E.jsx("br",{}),"This action cannot be undone, and can result in data loss."]}),onConfirm:l,confirmButtonLabel:"Delete"},disabled:d,shiftClickEnabled:!0,showShiftClickHint:!0,children:[i&&E.jsx(K.Icon,{name:"delete"}),!i&&E.jsx("span",{children:"Delete instance"})]})},sh=({name:t,instance:e,project:i})=>{const n=Xe(),r=Bi(),p=K.useNotify(),a=Z.useState(null),v=Nt().shape({name:Ze().test("deduplicate","An instance with this name already exists",u=>(e==null?void 0:e.name)===u||$r(u,i,a,"instances")).matches(/^[A-Za-z0-9-]+$/,{message:"Only alphanumeric and hyphen characters are allowed"}).matches(/^[A-Za-z].*$/,{message:"Instance name must start with a letter"}).required("Instance name is required")}),l=ht({initialValues:{name:t,isRenaming:!1},validationSchema:v,onSubmit:u=>{if(t===u.name){l.setFieldValue("isRenaming",!1),l.setSubmitting(!1);return}yo(t,u.name,i).then(d=>{n.set(d.metadata.id,()=>{r(`/ui/project/${i}/instances/detail/${u.name}`,p.queue(p.success("Instance renamed."))),l.setFieldValue("isRenaming",!1)},b=>p.failure("Renaming failed",new Error(b)),()=>l.setSubmitting(!1))})}});return E.jsx(Vo,{name:t,titleClassName:"instance-detail-title",parentItems:[E.jsx(Ni,{to:`/ui/project/${i}/instances`,children:"Instances"},1)],renameDisabledReason:(e==null?void 0:e.status)!=="Stopped"?"Stop the instance to rename":void 0,centerControls:e?E.jsxs("div",{children:[E.jsx("i",{className:"status u-text--muted",children:e.status}),E.jsx(Co,{instance:e},"state")]}):null,controls:e?E.jsx(nh,{instance:e},"delete"):null,isLoaded:!!e,formik:l})},oh=["Overview","Configuration","Snapshots","Terminal","Console","Logs"],Th=()=>{const t=K.useNotify(),{name:e,project:i,activeTab:n}=ct();if(!e)return E.jsx(E.Fragment,{children:"Missing name"});if(!i)return E.jsx(E.Fragment,{children:"Missing project"});const{data:r,error:p,isLoading:a}=at({queryKey:[Ee.instances,e,i],queryFn:()=>xo(e,i)});return p&&t.failure("Loading instance failed",p),E.jsxs(Eo,{header:E.jsx(sh,{name:e,instance:r,project:i}),contentClassName:"detail-page",children:[E.jsx(Qr,{}),a&&E.jsx(Ge,{text:"Loading instance details..."}),!a&&!r&&E.jsx(E.Fragment,{children:"Loading instance failed"}),!a&&r&&E.jsxs(K.Row,{children:[E.jsx(wo,{tabs:oh,activeTab:n,tabUrl:`/ui/project/${i}/instances/detail/${e}`}),!n&&E.jsx("div",{role:"tabpanel","aria-labelledby":"overview",children:E.jsx(ha,{instance:r})}),n==="configuration"&&E.jsx("div",{role:"tabpanel","aria-labelledby":"configuration",children:E.jsx(rh,{instance:r})}),n==="snapshots"&&E.jsx("div",{role:"tabpanel","aria-labelledby":"snapshots",children:E.jsx(Da,{instance:r})}),n==="terminal"&&E.jsx("div",{role:"tabpanel","aria-labelledby":"terminal",children:E.jsx(ma,{instance:r})}),n==="console"&&E.jsx("div",{role:"tabpanel","aria-labelledby":"console",children:E.jsx(Jl,{instance:r})}),n==="logs"&&E.jsx("div",{role:"tabpanel","aria-labelledby":"logs",children:E.jsx(ih,{instance:r})})]})]})};export{Th as default};

Zerion Mini Shell 1.0