phirepass-widgets 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-elO6rcMK.js';
2
- export { s as setNonce } from './index-elO6rcMK.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-DtzrexIM.js';
2
+ export { s as setNonce } from './index-DtzrexIM.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v4.43.0 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v4.43.2 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
 
9
9
  var patchBrowser = () => {
@@ -0,0 +1,2 @@
1
+ function t(t,e,n){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,e);if(o&&(!n||o.get))return o;t=Object.getPrototypeOf(t)}}var e,n=(e,n)=>{var o;Object.entries(null!=(o=n.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=e[o],i=t(Object.getPrototypeOf(e),o,!0)||Object.getOwnPropertyDescriptor(e,o);i&&Object.defineProperty(e,o,{get(){return i.get.call(this)},set(t){i.set.call(this,t)},configurable:!0,enumerable:!0}),n.l.has(o)?e[o]=n.l.get(o):void 0!==l&&(e[o]=l)}}))},o=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},l=(t,e)=>{e&&(t.__stencil__getHostRef=()=>e,e.i=t,512&e.o.u&&n(t,e))},i=(t,e)=>(0,console.error)(t,e),s=new Map,r=new Map,c="undefined"!=typeof window?window:{},u={u:0,h:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},a=t=>Promise.resolve(t),f=(()=>{try{return!!c.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),d=!!f&&(()=>!!c.document&&Object.getOwnPropertyDescriptor(c.document.adoptedStyleSheets,"length").writable)(),h=!1,p=[],m=[],v=(t,e)=>n=>{t.push(n),h||(h=!0,e&&4&u.u?$(b):u.raf(b))},y=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){i(t)}t.length=0},b=()=>{y(p),y(m),(h=p.length>0)&&u.raf(b)},$=t=>a().then(t),w=v(m,!0);function g(){const t=this.attachShadow({mode:"open"});void 0===e&&(e=null),e&&(d?t.adoptedStyleSheets.push(e):t.adoptedStyleSheets=[...t.adoptedStyleSheets,e])}function j(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}var S,O=new WeakMap,k=t=>"sc-"+t.p,M=t=>"object"==(t=typeof t)||"function"===t,E=(t,e,...n)=>{let o=null,l=null,i=!1,s=!1;const r=[],c=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?c(o):null!=o&&"boolean"!=typeof o&&((i="function"!=typeof t&&!M(o))&&(o+=""),i&&s?r[r.length-1].m+=o:r.push(i?C(null,o):o),s=i)};c(n),e&&e.key&&(l=e.key);const u=C(t,null);return u.v=e,r.length>0&&(u.$=r),u.j=l,u},C=(t,e)=>({u:0,S:t,m:null!=e?e:null,O:null,$:null,v:null,j:null}),A={},L=(t,e)=>null==t||M(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,N=t=>{var e;return null==(e=o(t))?void 0:e.$hostElement$},x=(t,e,n,l,i,s)=>{if(n===l)return;let r=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"key"===e);else{if("a"===e[0]&&e.startsWith("attr:")){const n=e.slice(5);let i;{const e=o(t);if(e&&e.o&&e.o.t){const t=e.o.t[n];t&&t[1]&&(i=t[1])}}return i||(i=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==l||!1===l?!1===l&&""!==t.getAttribute(i)||t.removeAttribute(i):t.setAttribute(i,!0===l?"":l))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=l}catch(t){}return}{const o=M(l);if((r||o&&null!==l)&&!i)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const o=null==l?"":l;"list"===e?r=!1:null!=n&&t[e]===o||("function"==typeof t.__lookupSetter__(e)?t[e]=o:t.setAttribute(e,o))}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!r||4&s||i)&&!o&&1===t.nodeType&&t.setAttribute(e,l=!0===l?"":l)}}},D=(t,e,n)=>{const o=11===e.O.nodeType&&e.O.host?e.O.host:e.O,l=t&&t.v||{},i=e.v||{};for(const t of H(Object.keys(l)))t in i||x(o,t,l[t],void 0,n,e.u);for(const t of H(Object.keys(i)))x(o,t,l[t],i[t],n,e.u)};function H(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var P=!1,R=!1,T=(t,e,n)=>{const o=e.$[n];let l,i,s=0;if(!c.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=c.document.createElement(o.S),D(null,o,R),o.$){const e="template"===o.S?l.content:l;for(s=0;s<o.$.length;++s)i=T(t,o,s),i&&e.appendChild(i)}return l["s-hn"]=S,l},U=(t,e,n,o,l,i)=>{let s,r=t;for(r.shadowRoot&&r.tagName===S&&(r=r.shadowRoot),"template"===n.S&&(r=r.content);l<=i;++l)o[l]&&(s=T(null,n,l),s&&(o[l].O=s,q(r,s,e)))},W=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;t&&t.remove()}}},z=(t,e,n=!1)=>t.S===e.S&&(n?(n&&!t.j&&e.j&&(t.j=e.j),!0):t.j===e.j),F=(t,e,n=!1)=>{const o=e.O=t.O,l=t.$,i=e.$;"slot"!==e.S||P||t.k!==e.k&&(e.O["s-sn"]=e.k||"",(t=>{u.u|=1;const e=t.closest(S.toLowerCase());if(null!=e){const n=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),o=Array.from(t.__childNodes||t.childNodes);for(const t of n?o.reverse():o)null!=t["s-sh"]&&(q(e,t,null!=n?n:null),t["s-sh"]=void 0)}u.u&=-2})(e.O.parentElement)),D(t,e,R),null!==l&&null!==i?((t,e,n,o,l=!1)=>{let i,s,r=0,c=0,u=0,a=0,f=e.length-1,d=e[0],h=e[f],p=o.length-1,m=o[0],v=o[p];const y="template"===n.S?t.content:t;for(;r<=f&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--f];else if(null==m)m=o[++c];else if(null==v)v=o[--p];else if(z(d,m,l))F(d,m,l),d=e[++r],m=o[++c];else if(z(h,v,l))F(h,v,l),h=e[--f],v=o[--p];else if(z(d,v,l))F(d,v,l),q(y,d.O,h.O.nextSibling),d=e[++r],v=o[--p];else if(z(h,m,l))F(h,m,l),q(y,h.O,d.O),h=e[--f],m=o[++c];else{for(u=-1,a=r;a<=f;++a)if(e[a]&&null!==e[a].j&&e[a].j===m.j){u=a;break}u>=0?(s=e[u],s.S!==m.S?i=T(e&&e[c],n,u):(F(s,m,l),e[u]=void 0,i=s.O),m=o[++c]):(i=T(e&&e[c],n,c),m=o[++c]),i&&q(d.O.parentNode,i,d.O)}r>f?U(t,null==o[p+1]?null:o[p+1].O,n,o,c,p):c>p&&W(e,r,f)})(o,l,e,i,n):null!==i?U(o,null,e,i,0,i.length-1):!n&&null!==l&&W(l,0,l.length-1)},q=(t,e,n)=>t.__insertBefore?t.__insertBefore(e,n):null==t?void 0:t.insertBefore(e,n),V=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.M=()=>{e["s-p"].splice(n-1,1),o()})))}},G=(t,e)=>{if(t.u|=16,4&t.u)return void(t.u|=512);V(t,t.C);const n=()=>Y(t,e);if(!e)return w(n);queueMicrotask((()=>{n()}))},Y=(t,e)=>{const n=t.$hostElement$,o=t.i;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return e?(t.A.length&&t.A.forEach((t=>t(n))),l=Q(o,"componentWillLoad",void 0,n)):l=Q(o,"componentWillUpdate",void 0,n),l=Z(l,(()=>Q(o,"componentWillRender",void 0,n))),Z(l,(()=>B(t,o,e)))},Z=(t,e)=>_(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),_=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,B=async(t,e,n)=>{var o;const l=t.$hostElement$,i=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.u,l=((t,e)=>{var n,o,l;const i=k(e),s=r.get(i);if(!c.document)return i;if(t=11===t.nodeType?t:c.document,s)if("string"==typeof s){let l,r=O.get(t=t.head||t);if(r||O.set(t,r=new Set),!r.has(i)){l=c.document.createElement("style"),l.textContent=s;const a=null!=(n=u.L)?n:j(c.document);if(null!=a&&l.setAttribute("nonce",a),!(1&e.u))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(f){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(s),d?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=s+e.textContent:t.prepend(l)}else t.append(l);1&e.u&&t.insertBefore(l,null),4&e.u&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),r&&r.add(i)}}else{let e=O.get(t);if(e||O.set(t,e=new Set),!e.has(i)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(s.constructor===n.CSSStyleSheet)o=s;else{o=new n.CSSStyleSheet;for(let t=0;t<s.cssRules.length;t++)o.insertRule(s.cssRules[t].cssText,t)}d?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(i)}}return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);I(t,e,l,n),i&&(i.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>J(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.u|=4,e.length=0)}},I=(t,e,n,o)=>{try{e=e.render(),t.u&=-17,t.u|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.o,i=t.N||C(null,null),s=(t=>t&&t.S===A)(e)?e:E(null,null,e);if(S=o.tagName,n&&s.v)for(const t of Object.keys(s.v))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.v[t]=o[t]);s.S=null,s.u|=4,t.N=s,s.O=i.O=o.shadowRoot||o,P=!(!(1&l.u)||128&l.u),F(i,s,n)})(t,e,o)}catch(e){i(e,t.$hostElement$)}return null},J=t=>{const e=t.$hostElement$,n=t.i,o=t.C;Q(n,"componentDidRender",void 0,e),64&t.u?Q(n,"componentDidUpdate",void 0,e):(t.u|=64,X(e),Q(n,"componentDidLoad",void 0,e),t.D(e),o||K()),t.M&&(t.M(),t.M=void 0),512&t.u&&$((()=>G(t,!1))),t.u&=-517},K=()=>{$((()=>(t=>{const e=u.ce("appload",{detail:{namespace:"phirepass-widgets"}});return t.dispatchEvent(e),e})(c)))},Q=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){i(t,o)}},X=t=>t.classList.add("hydrated"),tt=(t,e,n,l)=>{const s=o(t);if(!s)return;if(!s)throw Error(`Couldn't find host element for "${l.p}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const r=s.$hostElement$,c=s.l.get(e),u=s.u,a=s.i;if(n=L(n,l.t[e][0]),!(8&u&&void 0!==c||n===c||Number.isNaN(c)&&Number.isNaN(n))){if(s.l.set(e,n),l.H){const t=l.H[e];t&&t.map((t=>{try{const[[o,l]]=Object.entries(t);(128&u||1&l)&&(a?a[o](n,c,e):s.A.push((()=>{s.i[o](n,c,e)})))}catch(t){i(t,r)}}))}if(2&u){if(a.componentShouldUpdate&&!1===a.componentShouldUpdate(n,c,e)&&!(16&u))return;16&u||G(s,!1)}}},et=(e,n,l)=>{var i,s;const r=e.prototype;{e.watchers&&!n.H&&(n.H=e.watchers),e.deserializers&&!n.P&&(n.P=e.deserializers),e.serializers&&!n.R&&(n.R=e.serializers);const c=Object.entries(null!=(i=n.t)?i:{});if(c.map((([e,[i]])=>{if(31&i||2&l&&32&i){const{get:s,set:c}=t(r,e)||{};s&&(n.t[e][0]|=2048),c&&(n.t[e][0]|=4096),(1&l||!s)&&Object.defineProperty(r,e,{get(){{if(!(2048&n.t[e][0]))return((t,e)=>o(this).l.get(e))(0,e);const t=o(this),l=t?t.i:r;if(!l)return;return l[e]}},configurable:!0,enumerable:!0}),Object.defineProperty(r,e,{set(t){const s=o(this);if(s){if(c)return void 0===(32&i?this[e]:s.$hostElement$[e])&&s.l.get(e)&&(t=s.l.get(e)),c.call(this,L(t,i)),void tt(this,e,t=32&i?this[e]:s.$hostElement$[e],n);{if(!(1&l&&4096&n.t[e][0]))return tt(this,e,t,n),void(1&l&&!s.i&&s.A.push((()=>{4096&n.t[e][0]&&s.i[e]!==s.l.get(e)&&(s.i[e]=t)})));const o=()=>{const o=s.i[e];!s.l.get(e)&&o&&s.l.set(e,o),s.i[e]=L(t,i),tt(this,e,s.i[e],n)};s.i?o():s.A.push((()=>{o()}))}}}})}})),1&l){const t=new Map;r.attributeChangedCallback=function(e,l,i){u.jmp((()=>{var s;const u=t.get(e),a=o(this);if(this.hasOwnProperty(u)&&(i=this[u],delete this[u]),r.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==i)return;if(null==u){const t=null==a?void 0:a.u;if(a&&t&&!(8&t)&&i!==l){const o=a.i,r=null==(s=n.H)?void 0:s[e];null==r||r.forEach((n=>{const[[s,r]]=Object.entries(n);null!=o[s]&&(128&t||1&r)&&o[s].call(o,i,l,e)}))}return}const f=c.find((([t])=>t===u));f&&4&f[1][0]&&(i=null!==i&&"false"!==i);const d=Object.getOwnPropertyDescriptor(r,u);i==this[u]||d.get&&!d.set||(this[u]=i)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=n.H)?s:{}),...c.filter((([t,e])=>31&e[0])).map((([e,n])=>{const o=n[1]||e;return t.set(o,e),o}))]))}}return e},nt=(t,e)=>{Q(t,"connectedCallback",void 0,e)},ot=(t,e)=>{Q(t,"disconnectedCallback",void 0,e||t)},lt=(t,e={})=>{var n;if(!c.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const l=[],a=e.exclude||[],d=c.customElements,h=c.document.head,p=h.querySelector("meta[charset]"),m=c.document.createElement("style"),v=[];let y,b=!0;if(Object.assign(u,e),u.h=new URL(e.resourcesUrl||"./",c.document.baseURI).href,t.map((t=>{t[1].map((e=>{var n,c,h;const p={u:e[0],p:e[1],t:e[2],T:e[3]};p.t=e[2],p.H=null!=(n=e[4])?n:{},p.R=null!=(c=e[5])?c:{},p.P=null!=(h=e[6])?h:{};const m=p.p,$=class extends HTMLElement{"s-p";"s-rc";hasRegisteredEventListeners=!1;constructor(t){if(super(t),((t,e)=>{const n={u:0,$hostElement$:t,o:e,l:new Map,U:new Map};n.W=new Promise((t=>n.D=t)),t["s-p"]=[],t["s-rc"]=[],n.A=[];const o=n;t.__stencil__getHostRef=()=>o})(t=this,p),1&p.u)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${p.p}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else g.call(t,p)}connectedCallback(){o(this)&&(this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),y&&(clearTimeout(y),y=null),b?v.push(this):u.jmp((()=>(t=>{if(!(1&u.u)){const e=o(t);if(!e)return;const n=e.o,l=()=>{};if(1&e.u)(null==e?void 0:e.i)?nt(e.i,t):(null==e?void 0:e.W)&&e.W.then((()=>nt(e.i,t)));else{e.u|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){V(e,e.C=n);break}}n.t&&Object.entries(n.t).map((([e,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let o;try{if(!(32&e.u)){if(e.u|=32,n.F){const l=((t,e)=>{const n=t.p.replace(/-/g,"_"),o=t.F;if(!o)return;const l=s.get(o);return l?l[n]:import(`./${o}.entry.js`).then((t=>(s.set(o,t),t[n])),(t=>{i(t,e.$hostElement$)}))
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n,e);if(l&&"then"in l){const t=()=>{};o=await l,t()}else o=l;if(!o)throw Error(`Constructor for "${n.p}#${e.q}" was not found`);o.isProxied||(n.H=o.watchers,n.R=o.serializers,n.P=o.deserializers,et(o,n,2),o.isProxied=!0);const r=()=>{};e.u|=8;try{new o(e)}catch(e){i(e,t)}e.u&=-9,e.u|=128,r(),nt(e.i,t)}else o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.u|=128));if(o&&o.style){let t;"string"==typeof o.style&&(t=o.style);const e=k(n);if(!r.has(e)){const o=()=>{};((t,e,n)=>{let o=r.get(t);f&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,r.set(t,o)})(e,t,!!(1&n.u)),o()}}}const l=e.C,c=()=>G(e,!0);l&&l["s-rc"]?l["s-rc"].push(c):c()}catch(n){i(n,t),e.M&&(e.M(),e.M=void 0),e.D&&e.D(t)}})(t,e,n)}l()}})(this))))}disconnectedCallback(){u.jmp((()=>(async t=>{if(!(1&u.u)){const e=o(t);(null==e?void 0:e.i)?ot(e.i,t):(null==e?void 0:e.W)&&e.W.then((()=>ot(e.i,t)))}O.has(t)&&O.delete(t),t.shadowRoot&&O.has(t.shadowRoot)&&O.delete(t.shadowRoot)})(this))),u.raf((()=>{var t;const e=o(this);if(!e)return;const n=v.findIndex((t=>t===this));n>-1&&v.splice(n,1),(null==(t=null==e?void 0:e.N)?void 0:t.O)instanceof Node&&!e.N.O.isConnected&&delete e.N.O}))}componentOnReady(){var t;return null==(t=o(this))?void 0:t.W}};p.F=t[0],a.includes(m)||d.get(m)||(l.push(m),d.define(m,et($,p,1)))}))})),l.length>0&&(m.textContent+=l.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",m.innerHTML.length)){m.setAttribute("data-styles","");const t=null!=(n=u.L)?n:j(c.document);null!=t&&m.setAttribute("nonce",t),h.insertBefore(m,p?p.nextSibling:h.firstChild)}b=!1,v.length?v.map((t=>t.connectedCallback())):u.jmp((()=>y=setTimeout(K,30)))},it=t=>u.L=t;export{A as H,lt as b,N as g,E as h,a as p,l as r,it as s}
@@ -1,4 +1,4 @@
1
- import{r as t,g as i,h as s,H as e}from"./p-elO6rcMK.js";
1
+ import{r as t,g as i,h as s,H as e}from"./p-DtzrexIM.js";
2
2
  /**
3
3
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
4
4
  * @license MIT
@@ -46,4 +46,4 @@ import{r as t,g as i,h as s,H as e}from"./p-elO6rcMK.js";
46
46
  * Fabrice Bellard's javascript vt100 for jslinux:
47
47
  * http://bellard.org/jslinux/
48
48
  * Copyright (c) 2011 Fabrice Bellard
49
- */function Ya(t,i){let s,e=this,h=!1;return function(){return h||(h=!0,i||(s=t.apply(e,arguments))),s}}(t=>{t.isLessThan=function(t){return t<0},t.isLessThanOrEqual=function(t){return t<=0},t.isGreaterThan=function(t){return t>0},t.isNeitherLessOrGreaterThan=function(t){return 0===t},t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(La||={}),(t=>{function i(t){return t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]}t.is=i;let s=Object.freeze([]);function*e(t){yield t}t.empty=function(){return s},t.single=e,t.wrap=function(t){return i(t)?t:e(t)},t.from=function(t){return t||s},t.reverse=function*(t){for(let i=t.length-1;i>=0;i--)yield t[i]},t.isEmpty=function(t){return!t||!0===t[Symbol.iterator]().next().done},t.first=function(t){return t[Symbol.iterator]().next().value},t.some=function(t,i){let s=0;for(let e of t)if(i(e,s++))return!0;return!1},t.find=function(t,i){for(let s of t)if(i(s))return s},t.filter=function*(t,i){for(let s of t)i(s)&&(yield s)},t.map=function*(t,i){let s=0;for(let e of t)yield i(e,s++)},t.flatMap=function*(t,i){let s=0;for(let e of t)yield*i(e,s++)},t.concat=function*(...t){for(let i of t)yield*i},t.reduce=function(t,i,s){let e=s;for(let s of t)e=i(e,s);return e},t.slice=function*(t,i,s=t.length){for(i<0&&(i+=t.length),s<0?s+=t.length:s>t.length&&(s=t.length);i<s;i++)yield t[i]},t.consume=function(i,s=Number.POSITIVE_INFINITY){let e=[];if(0===s)return[e,i];let h=i[Symbol.iterator]();for(let i=0;i<s;i++){let i=h.next();if(i.done)return[e,t.empty()];e.push(i.value)}return[e,{[Symbol.iterator]:()=>h}]},t.asyncToArray=async function(t){let i=[];for await(let s of t)i.push(s);return Promise.resolve(i)}})(_a||={});var Za=class t{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{!function(t){if(_a.is(t)){let i=[];for(let s of t)if(s)try{s.dispose()}catch(t){i.push(t)}if(1===i.length)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}t&&t.dispose()}(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?t.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&this._toDispose.delete(t)}};Za.DISABLE_DISPOSED_WARNING=!1;var Xa=Za,Va=class{constructor(){this._store=new Xa}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Va.None=Object.freeze({dispose(){}});var tc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},ic=class t extends Va{constructor(t){super(),this._terminal=t,this._optionsRefresh=this._register(new tc),this._oldOpen=this._terminal._core.open,this._terminal._core.open=t=>{this._oldOpen?.call(this._terminal._core,t),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange((t=>{"fontSize"===t&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))})),this._register(function(t){return{dispose:Ya((()=>{t()}))}}((()=>{this.removeLayerFromDom(),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this.canvas=void 0,this._ctx=void 0,this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0})))}static createCanvas(t,i,s){let e=(t||document).createElement("canvas");return e.width=0|i,e.height=0|s,e}static createImageData(t,i,s,e){if("function"!=typeof ImageData){let h=t.createImageData(i,s);return e&&h.data.set(new Uint8ClampedArray(e,0,i*s*4)),h}return e?new ImageData(new Uint8ClampedArray(e,0,i*s*4),i,s):new ImageData(i,s)}static createImageBitmap(t){return"function"!=typeof createImageBitmap?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&-1!==this.cellSize.height&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._renderService?.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,i){this._ctx?.clearRect(0,t*(this.dimensions?.css.cell.height||0),this.dimensions?.css.canvas.width||0,(++i-t)*(this.dimensions?.css.cell.height||0))}clearAll(){this._ctx?.clearRect(0,0,this.canvas?.width||0,this.canvas?.height||0)}draw(t,i,s,e,h=1){if(!this._ctx)return;let{width:r,height:n}=this.cellSize;if(-1===r||-1===n)return;this._rescaleImage(t,r,n);let o=t.actual,l=Math.ceil(o.width/r),a=i%l*r,c=Math.floor(i/l)*n,u=s*r,A=e*n,f=h*r+a>o.width?o.width-a:h*r,d=c+n>o.height?o.height-c:n;this._ctx.drawImage(o,Math.floor(a),Math.floor(c),Math.ceil(f),Math.ceil(d),Math.floor(u),Math.floor(A),Math.ceil(f),Math.ceil(d))}extractTile(i,s){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h)return;this._rescaleImage(i,e,h);let r=i.actual,n=Math.ceil(r.width/e),o=s%n*e,l=Math.floor(s/n)*h,a=e+o>r.width?r.width-o:e,c=l+h>r.height?r.height-l:h,u=t.createCanvas(this.document,a,c),A=u.getContext("2d");return A?(A.drawImage(r,Math.floor(o),Math.floor(l),Math.floor(a),Math.floor(c),0,0,Math.floor(a),Math.floor(c)),u):void 0}drawPlaceholder(t,i,s=1){if(this._ctx){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h||(this._placeholder?h>=this._placeholder.height&&this._createPlaceHolder(h+1):this._createPlaceHolder(Math.max(h+1,24)),!this._placeholder))return;this._ctx.drawImage(this._placeholderBitmap||this._placeholder,t*e,i*h%2?0:1,e*s,h,t*e,i*h,e*s,h)}}rescaleCanvas(){this.canvas&&(this.canvas.width!==this.dimensions.css.canvas.width||this.canvas.height!==this.dimensions.css.canvas.height)&&(this.canvas.width=this.dimensions.css.canvas.width||0,this.canvas.height=this.dimensions.css.canvas.height||0)}_rescaleImage(i,s,e){if(s===i.actualCellSize.width&&e===i.actualCellSize.height)return;let{width:h,height:r}=i.origCellSize;if(s===h&&e===r)return i.actual=i.orig,i.actualCellSize.width=h,void(i.actualCellSize.height=r);let n=t.createCanvas(this.document,Math.ceil(i.orig.width*s/h),Math.ceil(i.orig.height*e/r)),o=n.getContext("2d");o&&(o.drawImage(i.orig,0,0,n.width,n.height),i.actual=n,i.actualCellSize.width=s,i.actualCellSize.height=e)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{this.removeLayerFromDom(),this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(){this.document&&this._terminal._core.screenElement?this.canvas||(this.canvas=t.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0),this.canvas.classList.add("xterm-image-layer"),this._terminal._core.screenElement.appendChild(this.canvas),this._ctx=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0}),this.clearAll()):console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement")}removeLayerFromDom(){this.canvas&&(this._ctx=void 0,this.canvas.remove(),this.canvas=void 0)}_createPlaceHolder(i=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let s=32,e=t.createCanvas(this.document,s,i),h=e.getContext("2d",{alpha:!1});if(!h)return;let r=t.createImageData(h,s,i),n=new Uint32Array(r.data.buffer),o=(0,ja.toRGBA8888)(0,0,0),l=(0,ja.toRGBA8888)(255,255,255);n.fill(o);for(let t=0;t<i;++t){let i=t%2,e=t*s;for(let t=0;t<s;t+=2)n[e+t+i]=l}h.putImageData(r,0,0);let a=screen.width+s-1&-32||4096;this._placeholder=t.createCanvas(this.document,a,i);let c=this._placeholder.getContext("2d",{alpha:!1});if(c){for(let t=0;t<a;t+=s)c.drawImage(e,t,0);t.createImageBitmap(this._placeholder).then((t=>this._placeholderBitmap=t))}else this._placeholder=void 0}get document(){return this._terminal._core._coreBrowserService?.window.document}},sc={width:7,height:14},ec=class t{constructor(t=0,i=0,s=-1,e=-1){this.imageId=s,this.tileId=e,this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(t){this._ext&=-67108864,this._ext|=67108863&t}get underlineVariantOffset(){let t=(3758096384&this._ext)>>29;return t<0?4294967288^t:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new t(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId&&-1===this.imageId}},hc=new ec,rc=class{constructor(t,i,s){this._terminal=t,this._renderer=i,this._opts=s,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(t){console.error(t.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let t of this._images.values())t.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return 4*this._pixelLimit/1e6}setLimit(t){if(t<.5||t>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=t/4*1e6>>>0,this._evictOldest(0)}getUsage(){return 4*this._getStoredPixels()/1e6}_getStoredPixels(){let t=0;for(let i of this._images.values())i.orig&&(t+=i.orig.width*i.orig.height,i.actual&&i.actual!==i.orig&&(t+=i.actual.width*i.actual.height));return t}_delImg(t){let i=this._images.get(t);this._images.delete(t),i&&window.ImageBitmap&&i.orig instanceof ImageBitmap&&i.orig.close()}wipeAlternate(){let t=[];for(let[i,s]of this._images.entries())"alternate"===s.bufferType&&(s.marker?.dispose(),t.push(i));for(let i of t)this._delImg(i);this._needsFullClear=!0,this._fullyCleared=!1}advanceCursor(t){if(this._opts.sixelScrolling){let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=sc);let s=Math.ceil(t/i.height);for(let t=1;t<s;++t)this._terminal._core._inputHandler.lineFeed()}}addImage(t){this._evictOldest(t.width*t.height);let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=sc);let s=Math.ceil(t.width/i.width),e=Math.ceil(t.height/i.height),h=++this._lastId,r=this._terminal._core.buffer,n=this._terminal.cols,o=this._terminal.rows,l=r.x,a=r.y,c=l,u=0;this._opts.sixelScrolling||(r.x=0,r.y=0,c=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y);for(let t=0;t<e;++t){let i=r.lines.get(r.y+r.ybase);for(let e=0;e<s&&!(c+e>=n);++e)this._writeToCell(i,c+e,h,t*s+e),u++;if(this._opts.sixelScrolling)t<e-1&&this._terminal._core._inputHandler.lineFeed();else if(++r.y>=o)break;r.x=c}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y),this._opts.sixelScrolling?r.x=c:(r.x=l,r.y=a);let A=[];for(let[t,i]of this._images.entries())i.tileCount<1&&(i.marker?.dispose(),A.push(t));for(let t of A)this._delImg(t);let f=this._terminal.registerMarker(0);f?.onDispose((()=>{this._images.get(h)&&this._delImg(h)})),"alternate"===this._terminal.buffer.active.type&&this._evictOnAlternate();let d={orig:t,origCellSize:i,actual:t,actualCellSize:{...i},marker:f||void 0,tileCount:u,bufferType:this._terminal.buffer.active.type};this._images.set(h,d)}render(t){if(!this._renderer.canvas&&this._images.size&&(this._renderer.insertLayerToDom(),!this._renderer.canvas))return;if(this._renderer.rescaleCanvas(),!this._images.size)return this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),void(this._renderer.canvas&&this._renderer.removeLayerFromDom());this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:i,end:s}=t,e=this._terminal._core.buffer,h=this._terminal._core.cols;this._renderer.clearLines(i,s);for(let t=i;t<=s;++t){let i=e.lines.get(t+e.ydisp);if(!i)return;for(let s=0;s<h;++s)if(268435456&i.getBg(s)){let e=i._extendedAttrs[s]||hc,r=e.imageId;if(void 0===r||-1===r)continue;let n=this._images.get(r);if(-1!==e.tileId){let o=e.tileId,l=s,a=1;for(;++s<h&&268435456&i.getBg(s)&&(e=i._extendedAttrs[s]||hc)&&e.imageId===r&&e.tileId===o+a;)a++;s--,n?n.actual&&this._renderer.draw(n,o,l,t,a):this._opts.showPlaceholder&&this._renderer.drawPlaceholder(l,t,a),this._fullyCleared=!1}}}}viewportResize(t){if(!this._images.size)return void(this._viewportMetrics=t);if(this._viewportMetrics.cols>=t.cols)return void(this._viewportMetrics=t);let i=this._terminal._core.buffer,s=i.lines.length,e=this._viewportMetrics.cols-1;for(let h=0;h<s;++h){let s=i.lines.get(h);if(268435456&s.getBg(e)){let i=s._extendedAttrs[e]||hc,h=i.imageId;if(void 0===h||-1===h)continue;let r=this._images.get(h);if(!r)continue;let n=Math.ceil((r.actual?.width||0)/r.actualCellSize.width);if(i.tileId%n+1>=n)continue;let o=!1;for(let i=e+1;i>t.cols;++i)if(4194303&s._data[3*i+0]){o=!0;break}if(o)continue;let l=Math.min(t.cols,n-i.tileId%n+e),a=i.tileId;for(let t=e+1;t<l;++t)this._writeToCell(s,t,h,++a),r.tileCount++}}this._viewportMetrics=t}getImageAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||hc;if(i.imageId&&-1!==i.imageId){let t=this._images.get(i.imageId)?.orig;if(window.ImageBitmap&&t instanceof ImageBitmap){let i=ic.createCanvas(window.document,t.width,t.height);return i.getContext("2d")?.drawImage(t,0,0,t.width,t.height),i}return t}}}extractTileAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||hc;if(i.imageId&&-1!==i.imageId&&-1!==i.tileId){let t=this._images.get(i.imageId);if(t)return this._renderer.extractTile(t,i.tileId)}}}_evictOldest(t){let i=this._getStoredPixels(),s=i;for(;this._pixelLimit<s+t&&this._images.size;){let t=this._images.get(++this._lowestId);t&&t.orig&&(s-=t.orig.width*t.orig.height,t.actual&&t.orig!==t.actual&&(s-=t.actual.width*t.actual.height),t.marker?.dispose(),this._delImg(this._lowestId))}return i-s}_writeToCell(t,i,s,e){if(268435456&t._data[3*i+2]){let h=t._extendedAttrs[i];if(h){if(void 0!==h.imageId){let t=this._images.get(h.imageId);return t&&t.tileCount--,h.imageId=s,void(h.tileId=e)}return void(t._extendedAttrs[i]=new ec(h.ext,h.urlId,s,e))}}t._data[3*i+2]|=268435456,t._extendedAttrs[i]=new ec(0,0,s,e)}_evictOnAlternate(){for(let t of this._images.values())"alternate"===t.bufferType&&(t.tileCount=0);let t=this._terminal._core.buffer;for(let i=0;i<this._terminal.rows;++i){let s=t.lines.get(i);if(s)for(let t=0;t<this._terminal.cols;++t)if(268435456&s._data[3*t+2]){let i=s._extendedAttrs[t]?.imageId;if(i){let t=this._images.get(i);t&&t.tileCount++}}}let i=[];for(let[t,s]of this._images.entries())"alternate"===s.bufferType&&!s.tileCount&&(s.marker?.dispose(),i.push(t));for(let t of i)this._delImg(t)}},nc=Ja(qa());function oc(t){let i="";for(let s=0;s<t.length;++s)i+=String.fromCharCode(t[s]);return i}function lc(t){let i=0;for(let s=0;s<t.length;++s){if(t[s]<48||t[s]>57)throw new Error("illegal char");i=10*i+t[s]-48}return i}function ac(t){let i=oc(t);if(!i.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return i}var cc={inline:lc,size:lc,name:function(t){if(typeof Buffer<"u")return Buffer.from(oc(t),"base64").toString();let i=atob(oc(t)),s=new Uint8Array(i.length);for(let t=0;t<s.length;++t)s[t]=i.charCodeAt(t);return(new TextDecoder).decode(s)},width:ac,height:ac,preserveAspectRatio:lc},uc=[70,105,108,101],Ac=1024,fc=class{constructor(){this.state=0,this._buffer=new Uint32Array(Ac),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}parse(t,i,s){let e=this.state,h=this._position,r=this._buffer;if(1===e||4===e||0===e&&h>6)return-1;for(let n=i;n<s;++n){let i=t[n];switch(i){case 59:if(!this._storeValue(h))return this._a();e=2,h=0;break;case 61:if(0===e){for(let t=0;t<uc.length;++t)if(r[t]!==uc[t])return this._a();e=2,h=0}else if(2===e){if(!this._storeKey(h))return this._a();e=3,h=0}else if(3===e){if(h>=Ac)return this._a();r[h++]=i}break;case 58:return 3!==e||this._storeValue(h)?(this.state=4,n+1):this._a();default:if(h>=Ac)return this._a();r[h++]=i}}return this.state=e,this._position=h,-2}_a(){return this.state=1,-1}_storeKey(t){let i=oc(this._buffer.subarray(0,t));return!!i&&(this._key=i,this.fields[i]=null,!0)}_storeValue(t){if(this._key){try{let i=this._buffer.slice(0,t);this.fields[this._key]=cc[this._key]?cc[this._key](i):i}catch{return!1}return!0}return!1}},dc={mime:"unsupported",width:0,height:0},gc={name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},wc=class{constructor(t,i,s,e){this._opts=t,this._renderer=i,this._storage=s,this._coreTerminal=e,this._aborted=!1,this._hp=new fc,this._header=gc,this._dec=new nc.default(4194304),this._metrics=dc}reset(){}start(){this._aborted=!1,this._header=gc,this._metrics=dc,this._hp.reset()}put(t,i,s){if(!this._aborted)if(4===this._hp.state)this._dec.put(t,i,s)&&(this._dec.release(),this._aborted=!0);else{let e=this._hp.parse(t,i,s);if(-1===e)return void(this._aborted=!0);if(e>0){if(this._header=Object.assign({},gc,this._hp.fields),!this._header.inline||!this._header.size||this._header.size>this._opts.iipSizeLimit)return void(this._aborted=!0);this._dec.init(this._header.size),this._dec.put(t,e,s)&&(this._dec.release(),this._aborted=!0)}}}end(t){if(this._aborted)return!0;let i=0,s=0,e=!0;if((e=t)&&(e=!this._dec.end())&&(this._metrics=function(t){if(t.length<24)return dc;let i=new Uint32Array(t.buffer,t.byteOffset,6);if(1196314761===i[0]&&169478669===i[1]&&1380206665===i[3])return{mime:"image/png",width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(255===t[0]&&216===t[1]&&255===t[2]){let[i,s]=function(t){let i=t.length,s=4,e=t[s]<<8|t[s+1];for(;;){if(s+=e,s>=i)return[0,0];if(255!==t[s])return[0,0];if(192===t[s+1]||194===t[s+1])return s+8<i?[t[s+7]<<8|t[s+8],t[s+5]<<8|t[s+6]]:[0,0];s+=2,e=t[s]<<8|t[s+1]}}(t);return{mime:"image/jpeg",width:i,height:s}}return 944130375!==i[0]||55!==t[4]&&57!==t[4]||97!==t[5]?dc:{mime:"image/gif",width:t[7]<<8|t[6],height:t[9]<<8|t[8]}}(this._dec.data8),(e="unsupported"!==this._metrics.mime)&&(i=this._metrics.width,s=this._metrics.height,(e=i&&s&&i*s<this._opts.pixelLimit)&&([i,s]=this._resize(i,s).map(Math.floor),e=i&&s&&i*s<this._opts.pixelLimit))),!e)return this._dec.release(),!0;let h=new Blob([this._dec.data8],{type:this._metrics.mime});if(this._dec.release(),!window.createImageBitmap){let t=URL.createObjectURL(h),e=new Image;return new Promise((h=>{e.addEventListener("load",(()=>{URL.revokeObjectURL(t);let r=ic.createCanvas(window.document,i,s);r.getContext("2d")?.drawImage(e,0,0,i,s),this._storage.addImage(r),h(!0)})),e.src=t,setTimeout((()=>h(!0)),1e3)}))}return createImageBitmap(h,{resizeWidth:i,resizeHeight:s}).then((t=>(this._storage.addImage(t),!0)))}_resize(t,i){let s=this._renderer.dimensions?.css.cell.width||sc.width,e=this._renderer.dimensions?.css.cell.height||sc.height,h=this._renderer.dimensions?.css.canvas.width||s*this._coreTerminal.cols,r=this._renderer.dimensions?.css.canvas.height||e*this._coreTerminal.rows,n=this._dim(this._header.width,h,s),o=this._dim(this._header.height,r,e);if(!n&&!o){let s=Math.min(h/t,(r-e)/i);return s<1?[t*s,i*s]:[t,i]}return n?!this._header.preserveAspectRatio&&n&&o?[n,o]:[n,i*n/t]:[t*o/i,o]}_dim(t,i,s){return"auto"===t?0:t.endsWith("%")?parseInt(t.slice(0,-1))*i/100:t.endsWith("px")?parseInt(t.slice(0,-2)):parseInt(t)*s}},pc=Ja(Oa()),Cc=Ja(Ka()),Ic=pc.PALETTE_ANSI_256;Ic.set(pc.PALETTE_VT340_COLOR);var mc=class{constructor(t,i,s){this._opts=t,this._storage=i,this._coreTerminal=s,this._size=0,this._aborted=!1,(0,Cc.DecoderAsync)({memoryLimit:4*this._opts.pixelLimit,palette:Ic,paletteLimit:this._opts.sixelPaletteLimit}).then((t=>this._dec=t))}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Ic,this._opts.sixelPaletteLimit))}hook(t){if(this._size=0,this._aborted=!1,this._dec){let i=1===t.params[1]?0:function(t,i){let s=0;if(!i)return s;if(t.isInverse())if(t.isFgDefault())s=vc(i.foreground.rgba);else if(t.isFgRGB()){let i=t.constructor.toColorRGB(t.getFgColor());s=(0,pc.toRGBA8888)(...i)}else s=vc(i.ansi[t.getFgColor()].rgba);else if(t.isBgDefault())s=vc(i.background.rgba);else if(t.isBgRGB()){let i=t.constructor.toColorRGB(t.getBgColor());s=(0,pc.toRGBA8888)(...i)}else s=vc(i.ansi[t.getBgColor()].rgba);return s}(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(i,null,this._opts.sixelPaletteLimit)}}put(t,i,s){if(!this._aborted&&this._dec){if(this._size+=s-i,this._size>this._opts.sixelSizeLimit)return console.warn("SIXEL: too much data, aborting"),this._aborted=!0,void this._dec.release();try{this._dec.decode(t,i,s)}catch(t){console.warn(`SIXEL: error while decoding image - ${t}`),this._aborted=!0,this._dec.release()}}}unhook(t){if(this._aborted||!t||!this._dec)return!0;let i=this._dec.width,s=this._dec.height;if(!i||!s)return s&&this._storage.advanceCursor(s),!0;let e=ic.createCanvas(void 0,i,s);return e.getContext("2d")?.putImageData(new ImageData(this._dec.data8,i,s),0,0),this._dec.memoryUsage>4194304&&this._dec.release(),this._storage.addImage(e),!0}};function vc(t){return pc.BIG_ENDIAN?t:(255&t)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255}var Bc={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7},bc=class{constructor(t){this._disposables=[],this._handlers=new Map,this._opts=Object.assign({},Bc,t),this._defaultOpts=Object.assign({},Bc,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear()}_disposeLater(...t){for(let i of t)this._disposables.push(i)}activate(t){if(this._terminal=t,this._renderer=new ic(t),this._storage=new rc(t,this._renderer,this._opts),this._opts.enableSizeReports){let i=t.options.windowOptions||{};i.getWinSizePixels=!0,i.getCellSizePixels=!0,i.getWinSizeChars=!0,t.options.windowOptions=i}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},(t=>this._decset(t))),t.parser.registerCsiHandler({prefix:"?",final:"l"},(t=>this._decrst(t))),t.parser.registerCsiHandler({final:"c"},(t=>this._da1(t))),t.parser.registerCsiHandler({prefix:"?",final:"S"},(t=>this._xtermGraphicsAttributes(t))),t.onRender((t=>this._storage?.render(t))),t.parser.registerCsiHandler({intermediates:"!",final:"p"},(()=>this.reset())),t.parser.registerEscHandler({final:"c"},(()=>this.reset())),t._core._inputHandler.onRequestReset((()=>this.reset())),t.buffer.onBufferChange((()=>this._storage?.wipeAlternate())),t.onResize((t=>this._storage?.viewportResize(t)))),this._opts.sixelSupport){let i=new mc(this._opts,this._storage,t);this._handlers.set("sixel",i),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},i))}if(this._opts.iipSupport){let i=new wc(this._opts,this._renderer,this._storage,t);this._handlers.set("iip",i),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,i))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,i){return this._storage?.getImageAtBufferCell(t,i)}extractTileAtBufferCell(t,i){return this._storage?.extractTileAtBufferCell(t,i)}_report(t){this._terminal?._core.coreService.triggerDataEvent(t)}_decset(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return!!t[0]||!!this._opts.sixelSupport&&(this._report("[?62;4;9;22c"),!0)}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(1===t[0])switch(t[1]){case 1:return this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let t of this._handlers.values())t.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=4096?(this._opts.sixelPaletteLimit=t[2],this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`[?${t[0]};2S`),!0;case 4:return this._report(`[?${t[0]};0;4096S`),!0;default:return this._report(`[?${t[0]};2S`),!0}if(2===t[0])switch(t[1]){case 1:let i=this._renderer?.dimensions?.css.canvas.width,s=this._renderer?.dimensions?.css.canvas.height;if(!i||!s){let t=sc;i=(this._terminal?.cols||80)*t.width,s=(this._terminal?.rows||24)*t.height}if(i*s<this._opts.pixelLimit)this._report(`[?${t[0]};0;${i.toFixed(0)};${s.toFixed(0)}S`);else{let i=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`[?${t[0]};0;${i};${i}S`)}return!0;case 4:let e=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`[?${t[0]};0;${e};${e}S`),!0;default:return this._report(`[?${t[0]};2S`),!0}return this._report(`[?${t[0]};1S`),!0}};class Mc{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,Dc.unregister(this),t}free(){const t=this.__destroy_into_raw();Xc.__wbg_channel_free(t,0)}connect(){Xc.channel_connect(this.__wbg_ptr)}disconnect(){Xc.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==Xc.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==Xc.channel_is_disconnected(this.__wbg_ptr)}constructor(t,i,s){const e=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),h=Vc,r=qc(i,Xc.__wbindgen_export,Xc.__wbindgen_export2),n=Vc;var o=Oc(s)?0:qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2);const l=Xc.channel_new(e,h,r,n,o,Vc);return this.__wbg_ptr=l>>>0,Dc.register(this,this.__wbg_ptr,this),this}on_connection_close(t){Xc.channel_on_connection_close(this.__wbg_ptr,Oc(t)?0:Lc(t))}on_connection_error(t){Xc.channel_on_connection_error(this.__wbg_ptr,Oc(t)?0:Lc(t))}on_connection_message(t){Xc.channel_on_connection_message(this.__wbg_ptr,Oc(t)?0:Lc(t))}on_connection_open(t){Xc.channel_on_connection_open(this.__wbg_ptr,Oc(t)?0:Lc(t))}on_protocol_message(t){Xc.channel_on_protocol_message(this.__wbg_ptr,Oc(t)?0:Lc(t))}open_sftp_tunnel(t,i,s,e){const h=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),r=Vc;var n=Oc(i)?0:qc(i,Xc.__wbindgen_export,Xc.__wbindgen_export2),o=Vc,l=Oc(s)?0:qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_open_sftp_tunnel(this.__wbg_ptr,h,r,n,o,l,Vc,Oc(e)?4294967297:e>>>0)}open_ssh_tunnel(t,i,s,e){const h=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),r=Vc;var n=Oc(i)?0:qc(i,Xc.__wbindgen_export,Xc.__wbindgen_export2),o=Vc,l=Oc(s)?0:qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_open_ssh_tunnel(this.__wbg_ptr,h,r,n,o,l,Vc,Oc(e)?4294967297:e>>>0)}send_sftp_delete(t,i,s,e,h){const r=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),n=Vc,o=qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2),l=Vc,a=qc(e,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_sftp_delete(this.__wbg_ptr,r,n,i,o,l,a,Vc,Oc(h)?4294967297:h>>>0)}send_sftp_download_chunk(t,i,s,e,h){const r=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_sftp_download_chunk(this.__wbg_ptr,r,Vc,i,s,e,Oc(h)?4294967297:h>>>0)}send_sftp_download_start(t,i,s,e,h){const r=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),n=Vc,o=qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2),l=Vc,a=qc(e,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_sftp_download_start(this.__wbg_ptr,r,n,i,o,l,a,Vc,Oc(h)?4294967297:h>>>0)}send_sftp_list_data(t,i,s,e){const h=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),r=Vc,n=qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_sftp_list_data(this.__wbg_ptr,h,r,i,n,Vc,Oc(e)?4294967297:e>>>0)}send_sftp_upload_chunk(t,i,s,e,h,r,n){const o=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),l=Vc,a=function(t){const i=(0,Xc.__wbindgen_export)(1*t.length,1)>>>0;return Uc().set(t,i/1),Vc=t.length,i}(r);Xc.channel_send_sftp_upload_chunk(this.__wbg_ptr,o,l,i,s,e,h,a,Vc,Oc(n)?4294967297:n>>>0)}send_sftp_upload_start(t,i,s,e,h,r,n){const o=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),l=Vc,a=qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2),c=Vc,u=qc(e,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_sftp_upload_start(this.__wbg_ptr,o,l,i,a,c,u,Vc,h,r,Oc(n)?4294967297:n>>>0)}send_ssh_terminal_resize(t,i,s,e){const h=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_ssh_terminal_resize(this.__wbg_ptr,h,Vc,i,s,e)}send_ssh_tunnel_data(t,i,s){const e=qc(t,Xc.__wbindgen_export,Xc.__wbindgen_export2),h=Vc,r=qc(s,Xc.__wbindgen_export,Xc.__wbindgen_export2);Xc.channel_send_ssh_tunnel_data(this.__wbg_ptr,e,h,i,r,Vc)}start_heartbeat(t){Xc.channel_start_heartbeat(this.__wbg_ptr,t)}stop_heartbeat(){Xc.channel_stop_heartbeat(this.__wbg_ptr)}}Symbol.dispose&&(Mc.prototype[Symbol.dispose]=Mc.prototype.free);const yc=Object.freeze({Generic:0,0:"Generic",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword"});function Ec(){const t={__proto__:null,__wbg_Error_8c4e43fe74559d73:function(t,i){return Lc(Error(Fc(t,i)))},__wbg_String_8f0eb39a4a4c2f66:function(t,i){const s=qc(String(Tc(i)),Xc.__wbindgen_export,Xc.__wbindgen_export2),e=Vc;Nc().setInt32(t+4,e,!0),Nc().setInt32(t+0,s,!0)},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(t,i){const s=qc(Sc(Tc(i)),Xc.__wbindgen_export,Xc.__wbindgen_export2),e=Vc;Nc().setInt32(t+4,e,!0),Nc().setInt32(t+0,s,!0)},__wbg___wbindgen_string_get_72fb696202c56729:function(t,i){const s=Tc(i),e="string"==typeof s?s:void 0;var h=Oc(e)?0:qc(e,Xc.__wbindgen_export,Xc.__wbindgen_export2),r=Vc;Nc().setInt32(t+4,r,!0),Nc().setInt32(t+0,h,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(t,i){throw new Error(Fc(t,i))},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(t){Tc(t)._wbg_cb_unref()},__wbg_call_389efe28435a9388:function(){return Gc((function(t,i){return Lc(Tc(t).call(Tc(i)))}),arguments)},__wbg_call_4708e0c13bdc8e95:function(){return Gc((function(t,i,s){return Lc(Tc(t).call(Tc(i),Tc(s)))}),arguments)},__wbg_clearInterval_dd1e598f425db353:function(t){return Lc(clearInterval(zc(t)))},__wbg_close_1d08eaf57ed325c0:function(){return Gc((function(t){Tc(t).close()}),arguments)},__wbg_data_5330da50312d0bc1:function(t){return Lc(Tc(t).data)},__wbg_from_bddd64e7d5ff6941:function(t){return Lc(Array.from(Tc(t)))},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(t){let i;try{i=Tc(t)instanceof ArrayBuffer}catch(t){i=!1}return i},__wbg_length_32ed9a279acd054c:function(t){return Tc(t).length},__wbg_new_361308b2356cecd0:function(){return Lc(new Object)},__wbg_new_3eb36ae241fe6f44:function(){return Lc(new Array)},__wbg_new_dd2b680c8bf6ae29:function(t){return Lc(new Uint8Array(Tc(t)))},__wbg_new_with_str_8406051fb31dddaa:function(){return Gc((function(t,i,s,e){return Lc(new WebSocket(Fc(t,i),Fc(s,e)))}),arguments)},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(t,i,s){Uint8Array.prototype.set.call($c(t,i),Tc(s))},__wbg_readyState_1bb73ec7b8a54656:function(t){return Tc(t).readyState},__wbg_send_542f95dea2df7994:function(){return Gc((function(t,i,s){Tc(t).send($c(i,s))}),arguments)},__wbg_setInterval_ed3b5e3c3ebb8a6d:function(){return Gc((function(t,i){return Lc(setInterval(Tc(t),i))}),arguments)},__wbg_set_3f1d0b984ed272ed:function(t,i,s){Tc(t)[zc(i)]=zc(s)},__wbg_set_binaryType_5bbf62e9f705dc1a:function(t,i){Tc(t).binaryType=xc[i]},__wbg_set_f43e577aea94465b:function(t,i,s){Tc(t)[i>>>0]=zc(s)},__wbg_set_onclose_d382f3e2c2b850eb:function(t,i){Tc(t).onclose=Tc(i)},__wbg_set_onerror_377f18bf4569bf85:function(t,i){Tc(t).onerror=Tc(i)},__wbg_set_onmessage_2114aa5f4f53051e:function(t,i){Tc(t).onmessage=Tc(i)},__wbg_set_onopen_b7b52d519d6c0f11:function(t,i){Tc(t).onopen=Tc(i)},__wbg_warn_3c04f620e87dffa8:function(t,i){console.warn(Fc(t,i))},__wbindgen_cast_0000000000000001:function(t,i){return Lc(Wc(t,i,Xc.__wasm_bindgen_func_elem_37,kc))},__wbindgen_cast_0000000000000002:function(t,i){return Lc(Wc(t,i,Xc.__wasm_bindgen_func_elem_37,kc))},__wbindgen_cast_0000000000000003:function(t,i){return Lc(Wc(t,i,Xc.__wasm_bindgen_func_elem_37,kc))},__wbindgen_cast_0000000000000004:function(t,i){return Lc(Wc(t,i,Xc.__wasm_bindgen_func_elem_37,Qc))},__wbindgen_cast_0000000000000005:function(t){return Lc(t)},__wbindgen_cast_0000000000000006:function(t,i){return Lc($c(t,i))},__wbindgen_cast_0000000000000007:function(t,i){return Lc(Fc(t,i))},__wbindgen_cast_0000000000000008:function(t){return Lc(BigInt.asUintN(64,t))},__wbindgen_object_clone_ref:function(t){return Lc(Tc(t))},__wbindgen_object_drop_ref:function(t){zc(t)}};return{__proto__:null,"./phirepass-channel_bg.js":t}}function Qc(t,i){Xc.__wasm_bindgen_func_elem_38(t,i)}function kc(t,i,s){Xc.__wasm_bindgen_func_elem_40(t,i,Lc(s))}const xc=["blob","arraybuffer"],Dc="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>Xc.__wbg_channel_free(t>>>0,1)));function Lc(t){Jc===Pc.length&&Pc.push(Pc.length+1);const i=Jc;return Jc=Pc[i],Pc[i]=t,i}const _c="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>t.dtor(t.a,t.b)));function Sc(t){const i=typeof t;if("number"==i||"boolean"==i||null==t)return`${t}`;if("string"==i)return`"${t}"`;if("symbol"==i){const i=t.description;return null==i?"Symbol":`Symbol(${i})`}if("function"==i){const i=t.name;return"string"==typeof i&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=Sc(t[0]));for(let e=1;e<i;e++)s+=", "+Sc(t[e]);return s+="]",s}const s=/\[object ([^\]]+)\]/.exec(toString.call(t));let e;if(!(s&&s.length>1))return toString.call(t);if(e=s[1],"Object"==e)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:e}function $c(t,i){return t>>>=0,Uc().subarray(t/1,t/1+i)}let Rc=null;function Nc(){return(null===Rc||!0===Rc.buffer.detached||void 0===Rc.buffer.detached&&Rc.buffer!==Xc.memory.buffer)&&(Rc=new DataView(Xc.memory.buffer)),Rc}function Fc(t,i){return function(t,i){return Yc+=i,Yc>=jc&&(Kc=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Kc.decode(),Yc=i),Kc.decode(Uc().subarray(t,t+i))}(t>>>=0,i)}let Hc=null;function Uc(){return null!==Hc&&0!==Hc.byteLength||(Hc=new Uint8Array(Xc.memory.buffer)),Hc}function Tc(t){return Pc[t]}function Gc(t,i){try{return t.apply(this,i)}catch(t){Xc.__wbindgen_export3(Lc(t))}}let Pc=new Array(128).fill(void 0);Pc.push(void 0,null,!0,!1);let Jc=Pc.length;function Oc(t){return null==t}function Wc(t,i,s,e){const h={a:t,b:i,cnt:1,dtor:s},r=(...t)=>{h.cnt++;const i=h.a;h.a=0;try{return e(i,h.b,...t)}finally{h.a=i,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{0==--h.cnt&&(h.dtor(h.a,h.b),h.a=0,_c.unregister(h))},_c.register(r,h,h),r}function qc(t,i,s){if(void 0===s){const s=Zc.encode(t),e=i(s.length,1)>>>0;return Uc().subarray(e,e+s.length).set(s),Vc=s.length,e}let e=t.length,h=i(e,1)>>>0;const r=Uc();let n=0;for(;n<e;n++){const i=t.charCodeAt(n);if(i>127)break;r[h+n]=i}if(n!==e){0!==n&&(t=t.slice(n)),h=s(h,e,e=n+3*t.length,1)>>>0;const i=Uc().subarray(h+n,h+e);n+=Zc.encodeInto(t,i).written,h=s(h,e,n,1)>>>0}return Vc=n,h}function zc(t){const i=Tc(t);return function(t){t<132||(Pc[t]=Jc,Jc=t)}(t),i}let Kc=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Kc.decode();const jc=2146435072;let Yc=0;const Zc=new TextEncoder;"encodeInto"in Zc||(Zc.encodeInto=function(t,i){const s=Zc.encode(t);return i.set(s),{read:t.length,written:s.length}});let Xc,Vc=0;var tu;!function(t){t[t.Username=0]="Username",t[t.Password=1]="Password",t[t.Default=2]="Default"}(tu||(tu={}));const iu=class{constructor(i){t(this,i)}terminal;fitAddon;webLinksAddon;searchAddon;webglAddon;serializeAddon;imageAddon;channel;inputMode=tu.Default;resizeObserver;resizeDebounceHandle;session_id;usernameBuffer="";passwordBuffer="";xtermImageSettings={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};get el(){return i(this)}terminalOptions={termName:"xterm-256color",rendererType:"canvas",allowTransparency:!1,fontFamily:'"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace',fontSize:12,letterSpacing:0,lineHeight:1,allowProposedApi:!0,cursorBlink:!0,cursorWidth:1,theme:{background:"#0b1021",foreground:"#e2e8f0",cursor:"#67e8f9"},scrollback:1e4,fastScrollModifier:"shift",fastScrollSensitivity:5,bellStyle:"sound",convertEol:!1,disableStdin:!1,rightClickSelectsWord:!0,drawBoldTextInBrightColors:!0,minimumContrastRatio:1,windowsMode:!1,macOptionIsMeta:!1,altClickMovesCursor:!0};serverHost="phirepass.io";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;onNodeIdChange(t,i){this.resetSessionState(),this.terminal.reset(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,i){this.onNodeIdChange(this.nodeId,this.nodeId)}createWebSocketEndpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){await async function(t){if(void 0!==Xc)return Xc;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module_or_path:t}=t):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("phirepass-channel_bg.wasm",import.meta.url));const i=Ec();("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t));const{instance:s}=await async function(t,i){if("function"==typeof Response&&t instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(t,i)}catch(i){if(!t.ok||!function(t){switch(t){case"basic":case"cors":case"default":return!0}return!1}(t.type)||"application/wasm"===t.headers.get("Content-Type"))throw i;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i)}const s=await t.arrayBuffer();return await WebAssembly.instantiate(s,i)}{const s=await WebAssembly.instantiate(t,i);return s instanceof WebAssembly.Instance?{instance:s,module:t}:s}}(await t,i);return function(t){return Xc=t.exports,Rc=null,Hc=null,Xc}(s)}(),this.setup_terminal(),this.open_comms(),this.nodeId?this.connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}async disconnectedCallback(){this.resizeObserver&&this.resizeObserver.disconnect(),this.close_comms(),this.destroy_terminal()}setup_terminal(){this.terminal=new wr(this.terminalOptions),this.fitAddon=new pr,this.terminal.loadAddon(this.fitAddon),this.webLinksAddon=new br,this.terminal.loadAddon(this.webLinksAddon),this.searchAddon=new Mn,this.terminal.loadAddon(this.searchAddon),this.serializeAddon=new $a,this.terminal.loadAddon(this.serializeAddon),this.imageAddon=new bc(this.xtermImageSettings),this.terminal.loadAddon(this.imageAddon);try{this.webglAddon=new Ca,this.terminal.loadAddon(this.webglAddon)}catch(t){console.warn("WebGL addon not available or failed to load:",t)}this.fitAddon.fit()}destroy_terminal(){this.terminal&&(this.terminal.reset(),"function"==typeof this.terminal.dispose&&this.terminal.dispose())}open_comms(){this.channel=this.serverId?new Mc(`${this.createWebSocketEndpoint()}/api/web/ws`,this.nodeId,this.serverId):new Mc(`${this.createWebSocketEndpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_ssh_tunnel(this.nodeId)})),this.channel.on_connection_close((()=>{this.terminal.reset()})),this.channel.on_connection_error((t=>{console.error(">> connection error:",t)})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:i}=t.data;switch(i.type){case"Error":this.handle_error(i);break;case"TunnelOpened":this.session_id=i.sid,this.terminal.reset(),this.send_ssh_terminal_resize();break;case"TunnelClosed":this.handleTunnelClosed();break;case"TunnelData":this.terminal.write(new Uint8Array(i.data));break;default:console.warn("Unknown protocol message type:",i)}}))}send_ssh_terminal_resize(){if(!this.channel||!this.channel.is_connected()||!this.session_id)return;const t=this.terminal?.cols??0,i=this.terminal?.rows??0;if(!(t<=0||i<=0))try{this.channel.send_ssh_terminal_resize(this.nodeId,this.session_id,t,i)}catch(t){console.error("Failed to send terminal resize:",t)}}send_ssh_data(t){this.channel.is_connected()&&this.session_id&&this.channel.send_ssh_tunnel_data(this.nodeId,this.session_id,t)}handle_error(t){switch(t.kind){case yc.Generic:this.terminal.reset(),this.terminal.write(t.message+"\r\n"),this.terminal.focus();break;case yc.RequiresUsername:this.terminal.reset(),this.inputMode=tu.Username,this.usernameBuffer="",this.terminal.write("Enter your username: "),this.terminal.focus();break;case yc.RequiresPassword:this.terminal.reset(),this.inputMode=tu.Password,this.passwordBuffer="",this.terminal.write("Enter your password: "),this.terminal.focus();break;default:console.warn("Unknown error kind:",t)}}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}cancelCredentialEntry(){this.inputMode=tu.Default,this.usernameBuffer="",this.passwordBuffer="",this.terminal.writeln("Authentication cancelled."),this.terminal.reset()}resetSessionState(){this.session_id=void 0,this.inputMode=tu.Default,this.usernameBuffer="",this.passwordBuffer=""}handleTunnelClosed(){this.session_id=void 0,this.inputMode=tu.Default,this.usernameBuffer="",this.passwordBuffer="",this.terminal.reset(),this.terminal.writeln("Connection closed.")}connect(){const t=this.el.shadowRoot.getElementById("ccc");t&&(this.terminal.open(t),this.fitAddon.fit(),this.terminal.focus(),this.terminal.onData(this.handleTerminalData.bind(this)),this.channel.connect(),this.setupResizeObserver())}setupResizeObserver(){this.resizeObserver=new ResizeObserver((()=>{this.resizeDebounceHandle&&clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=setTimeout((()=>{this.fitAddon.fit(),this.send_ssh_terminal_resize()}),100)})),this.resizeObserver.observe(this.el)}handleTerminalData(t){switch(this.inputMode){case tu.Username:this.handleUsernameInput(t);break;case tu.Password:this.handlePasswordInput(t);break;case tu.Default:this.send_ssh_data(t)}}handleUsernameInput(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submitUsername()):""===t?(this.terminal.write("^C\r\n"),void this.cancelCredentialEntry()):void(""!==t?t>=" "&&t<="~"&&(this.usernameBuffer+=t,this.terminal.write(t)):this.usernameBuffer.length&&(this.usernameBuffer=this.usernameBuffer.slice(0,-1),this.terminal.write("\b \b")))}submitUsername(){if(!this.channel.is_connected())return;const t=this.usernameBuffer.trim();if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your username: "),void(this.usernameBuffer="");this.inputMode=tu.Default,this.channel.open_ssh_tunnel(this.nodeId,t)}handlePasswordInput(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submitPassword()):""===t?(this.terminal.write("^C\r\n"),void this.cancelCredentialEntry()):void(""!==t?t>=" "&&t<="~"&&(this.passwordBuffer+=t,this.terminal.write("*")):this.passwordBuffer.length&&(this.passwordBuffer=this.passwordBuffer.slice(0,-1),this.terminal.write("\b \b")))}submitPassword(){if(!this.channel.is_connected())return;const t=this.passwordBuffer;if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your password: "),void(this.passwordBuffer="");this.inputMode=tu.Default,this.channel.open_ssh_tunnel(this.nodeId,this.usernameBuffer.trim(),t),this.passwordBuffer="",this.usernameBuffer=""}render(){return s(e,{key:"101e530c574a390d3ffb99988c7f180634d73e4b"},s("div",{key:"354204fab9b5e635a8d145abe19cc165b4458af8",id:"ccc"}))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};iu.style=".xterm{cursor:text;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;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{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-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%}:host #ccc{width:inherit;height:inherit}";export{iu as phirepass_terminal}
49
+ */function Ya(t,i){let s,e=this,h=!1;return function(){return h||(h=!0,i||(s=t.apply(e,arguments))),s}}(t=>{t.isLessThan=function(t){return t<0},t.isLessThanOrEqual=function(t){return t<=0},t.isGreaterThan=function(t){return t>0},t.isNeitherLessOrGreaterThan=function(t){return 0===t},t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(La||={}),(t=>{function i(t){return t&&"object"==typeof t&&"function"==typeof t[Symbol.iterator]}t.is=i;let s=Object.freeze([]);function*e(t){yield t}t.empty=function(){return s},t.single=e,t.wrap=function(t){return i(t)?t:e(t)},t.from=function(t){return t||s},t.reverse=function*(t){for(let i=t.length-1;i>=0;i--)yield t[i]},t.isEmpty=function(t){return!t||!0===t[Symbol.iterator]().next().done},t.first=function(t){return t[Symbol.iterator]().next().value},t.some=function(t,i){let s=0;for(let e of t)if(i(e,s++))return!0;return!1},t.find=function(t,i){for(let s of t)if(i(s))return s},t.filter=function*(t,i){for(let s of t)i(s)&&(yield s)},t.map=function*(t,i){let s=0;for(let e of t)yield i(e,s++)},t.flatMap=function*(t,i){let s=0;for(let e of t)yield*i(e,s++)},t.concat=function*(...t){for(let i of t)yield*i},t.reduce=function(t,i,s){let e=s;for(let s of t)e=i(e,s);return e},t.slice=function*(t,i,s=t.length){for(i<0&&(i+=t.length),s<0?s+=t.length:s>t.length&&(s=t.length);i<s;i++)yield t[i]},t.consume=function(i,s=Number.POSITIVE_INFINITY){let e=[];if(0===s)return[e,i];let h=i[Symbol.iterator]();for(let i=0;i<s;i++){let i=h.next();if(i.done)return[e,t.empty()];e.push(i.value)}return[e,{[Symbol.iterator]:()=>h}]},t.asyncToArray=async function(t){let i=[];for await(let s of t)i.push(s);return Promise.resolve(i)}})(_a||={});var Za=class t{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{!function(t){if(_a.is(t)){let i=[];for(let s of t)if(s)try{s.dispose()}catch(t){i.push(t)}if(1===i.length)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}t&&t.dispose()}(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?t.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(i),i}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&this._toDispose.delete(t)}};Za.DISABLE_DISPOSED_WARNING=!1;var Xa=Za,Va=class{constructor(){this._store=new Xa}dispose(){this._store.dispose()}_register(t){if(t===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(t)}};Va.None=Object.freeze({dispose(){}});var tc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},ic=class t extends Va{constructor(t){super(),this._terminal=t,this._optionsRefresh=this._register(new tc),this._oldOpen=this._terminal._core.open,this._terminal._core.open=t=>{this._oldOpen?.call(this._terminal._core,t),this._open()},this._terminal._core.screenElement&&this._open(),this._optionsRefresh.value=this._terminal._core.optionsService.onOptionChange((t=>{"fontSize"===t&&(this.rescaleCanvas(),this._renderService?.refreshRows(0,this._terminal.rows))})),this._register(function(t){return{dispose:Ya((()=>{t()}))}}((()=>{this.removeLayerFromDom(),this._terminal._core&&this._oldOpen&&(this._terminal._core.open=this._oldOpen,this._oldOpen=void 0),this._renderService&&this._oldSetRenderer&&(this._renderService.setRenderer=this._oldSetRenderer,this._oldSetRenderer=void 0),this._renderService=void 0,this.canvas=void 0,this._ctx=void 0,this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0})))}static createCanvas(t,i,s){let e=(t||document).createElement("canvas");return e.width=0|i,e.height=0|s,e}static createImageData(t,i,s,e){if("function"!=typeof ImageData){let h=t.createImageData(i,s);return e&&h.data.set(new Uint8ClampedArray(e,0,i*s*4)),h}return e?new ImageData(new Uint8ClampedArray(e,0,i*s*4),i,s):new ImageData(i,s)}static createImageBitmap(t){return"function"!=typeof createImageBitmap?Promise.resolve(void 0):createImageBitmap(t)}showPlaceholder(t){t?!this._placeholder&&-1!==this.cellSize.height&&this._createPlaceHolder(Math.max(this.cellSize.height+1,24)):(this._placeholderBitmap?.close(),this._placeholderBitmap=void 0,this._placeholder=void 0),this._renderService?.refreshRows(0,this._terminal.rows)}get dimensions(){return this._renderService?.dimensions}get cellSize(){return{width:this.dimensions?.css.cell.width||-1,height:this.dimensions?.css.cell.height||-1}}clearLines(t,i){this._ctx?.clearRect(0,t*(this.dimensions?.css.cell.height||0),this.dimensions?.css.canvas.width||0,(++i-t)*(this.dimensions?.css.cell.height||0))}clearAll(){this._ctx?.clearRect(0,0,this.canvas?.width||0,this.canvas?.height||0)}draw(t,i,s,e,h=1){if(!this._ctx)return;let{width:r,height:n}=this.cellSize;if(-1===r||-1===n)return;this._rescaleImage(t,r,n);let o=t.actual,l=Math.ceil(o.width/r),a=i%l*r,c=Math.floor(i/l)*n,u=s*r,A=e*n,f=h*r+a>o.width?o.width-a:h*r,d=c+n>o.height?o.height-c:n;this._ctx.drawImage(o,Math.floor(a),Math.floor(c),Math.ceil(f),Math.ceil(d),Math.floor(u),Math.floor(A),Math.ceil(f),Math.ceil(d))}extractTile(i,s){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h)return;this._rescaleImage(i,e,h);let r=i.actual,n=Math.ceil(r.width/e),o=s%n*e,l=Math.floor(s/n)*h,a=e+o>r.width?r.width-o:e,c=l+h>r.height?r.height-l:h,u=t.createCanvas(this.document,a,c),A=u.getContext("2d");return A?(A.drawImage(r,Math.floor(o),Math.floor(l),Math.floor(a),Math.floor(c),0,0,Math.floor(a),Math.floor(c)),u):void 0}drawPlaceholder(t,i,s=1){if(this._ctx){let{width:e,height:h}=this.cellSize;if(-1===e||-1===h||(this._placeholder?h>=this._placeholder.height&&this._createPlaceHolder(h+1):this._createPlaceHolder(Math.max(h+1,24)),!this._placeholder))return;this._ctx.drawImage(this._placeholderBitmap||this._placeholder,t*e,i*h%2?0:1,e*s,h,t*e,i*h,e*s,h)}}rescaleCanvas(){this.canvas&&(this.canvas.width!==this.dimensions.css.canvas.width||this.canvas.height!==this.dimensions.css.canvas.height)&&(this.canvas.width=this.dimensions.css.canvas.width||0,this.canvas.height=this.dimensions.css.canvas.height||0)}_rescaleImage(i,s,e){if(s===i.actualCellSize.width&&e===i.actualCellSize.height)return;let{width:h,height:r}=i.origCellSize;if(s===h&&e===r)return i.actual=i.orig,i.actualCellSize.width=h,void(i.actualCellSize.height=r);let n=t.createCanvas(this.document,Math.ceil(i.orig.width*s/h),Math.ceil(i.orig.height*e/r)),o=n.getContext("2d");o&&(o.drawImage(i.orig,0,0,n.width,n.height),i.actual=n,i.actualCellSize.width=s,i.actualCellSize.height=e)}_open(){this._renderService=this._terminal._core._renderService,this._oldSetRenderer=this._renderService.setRenderer.bind(this._renderService),this._renderService.setRenderer=t=>{this.removeLayerFromDom(),this._oldSetRenderer?.call(this._renderService,t)}}insertLayerToDom(){this.document&&this._terminal._core.screenElement?this.canvas||(this.canvas=t.createCanvas(this.document,this.dimensions?.css.canvas.width||0,this.dimensions?.css.canvas.height||0),this.canvas.classList.add("xterm-image-layer"),this._terminal._core.screenElement.appendChild(this.canvas),this._ctx=this.canvas.getContext("2d",{alpha:!0,desynchronized:!0}),this.clearAll()):console.warn("image addon: cannot insert output canvas to DOM, missing document or screenElement")}removeLayerFromDom(){this.canvas&&(this._ctx=void 0,this.canvas.remove(),this.canvas=void 0)}_createPlaceHolder(i=24){this._placeholderBitmap?.close(),this._placeholderBitmap=void 0;let s=32,e=t.createCanvas(this.document,s,i),h=e.getContext("2d",{alpha:!1});if(!h)return;let r=t.createImageData(h,s,i),n=new Uint32Array(r.data.buffer),o=(0,ja.toRGBA8888)(0,0,0),l=(0,ja.toRGBA8888)(255,255,255);n.fill(o);for(let t=0;t<i;++t){let i=t%2,e=t*s;for(let t=0;t<s;t+=2)n[e+t+i]=l}h.putImageData(r,0,0);let a=screen.width+s-1&-32||4096;this._placeholder=t.createCanvas(this.document,a,i);let c=this._placeholder.getContext("2d",{alpha:!1});if(c){for(let t=0;t<a;t+=s)c.drawImage(e,t,0);t.createImageBitmap(this._placeholder).then((t=>this._placeholderBitmap=t))}else this._placeholder=void 0}get document(){return this._terminal._core._coreBrowserService?.window.document}},sc={width:7,height:14},ec=class t{constructor(t=0,i=0,s=-1,e=-1){this.imageId=s,this.tileId=e,this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(t){this._ext&=-67108864,this._ext|=67108863&t}get underlineVariantOffset(){let t=(3758096384&this._ext)>>29;return t<0?4294967288^t:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}get urlId(){return this._urlId}set urlId(t){this._urlId=t}clone(){return new t(this._ext,this._urlId,this.imageId,this.tileId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId&&-1===this.imageId}},hc=new ec,rc=class{constructor(t,i,s){this._terminal=t,this._renderer=i,this._opts=s,this._images=new Map,this._lastId=0,this._lowestId=0,this._fullyCleared=!1,this._needsFullClear=!1,this._pixelLimit=25e5;try{this.setLimit(this._opts.storageLimit)}catch(t){console.error(t.message),console.warn(`storageLimit is set to ${this.getLimit()} MB`)}this._viewportMetrics={cols:this._terminal.cols,rows:this._terminal.rows}}dispose(){this.reset()}reset(){for(let t of this._images.values())t.marker?.dispose();this._images.clear(),this._renderer.clearAll()}getLimit(){return 4*this._pixelLimit/1e6}setLimit(t){if(t<.5||t>1e3)throw RangeError("invalid storageLimit, should be at least 0.5 MB and not exceed 1G");this._pixelLimit=t/4*1e6>>>0,this._evictOldest(0)}getUsage(){return 4*this._getStoredPixels()/1e6}_getStoredPixels(){let t=0;for(let i of this._images.values())i.orig&&(t+=i.orig.width*i.orig.height,i.actual&&i.actual!==i.orig&&(t+=i.actual.width*i.actual.height));return t}_delImg(t){let i=this._images.get(t);this._images.delete(t),i&&window.ImageBitmap&&i.orig instanceof ImageBitmap&&i.orig.close()}wipeAlternate(){let t=[];for(let[i,s]of this._images.entries())"alternate"===s.bufferType&&(s.marker?.dispose(),t.push(i));for(let i of t)this._delImg(i);this._needsFullClear=!0,this._fullyCleared=!1}advanceCursor(t){if(this._opts.sixelScrolling){let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=sc);let s=Math.ceil(t/i.height);for(let t=1;t<s;++t)this._terminal._core._inputHandler.lineFeed()}}addImage(t){this._evictOldest(t.width*t.height);let i=this._renderer.cellSize;(-1===i.width||-1===i.height)&&(i=sc);let s=Math.ceil(t.width/i.width),e=Math.ceil(t.height/i.height),h=++this._lastId,r=this._terminal._core.buffer,n=this._terminal.cols,o=this._terminal.rows,l=r.x,a=r.y,c=l,u=0;this._opts.sixelScrolling||(r.x=0,r.y=0,c=0),this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y);for(let t=0;t<e;++t){let i=r.lines.get(r.y+r.ybase);for(let e=0;e<s&&!(c+e>=n);++e)this._writeToCell(i,c+e,h,t*s+e),u++;if(this._opts.sixelScrolling)t<e-1&&this._terminal._core._inputHandler.lineFeed();else if(++r.y>=o)break;r.x=c}this._terminal._core._inputHandler._dirtyRowTracker.markDirty(r.y),this._opts.sixelScrolling?r.x=c:(r.x=l,r.y=a);let A=[];for(let[t,i]of this._images.entries())i.tileCount<1&&(i.marker?.dispose(),A.push(t));for(let t of A)this._delImg(t);let f=this._terminal.registerMarker(0);f?.onDispose((()=>{this._images.get(h)&&this._delImg(h)})),"alternate"===this._terminal.buffer.active.type&&this._evictOnAlternate();let d={orig:t,origCellSize:i,actual:t,actualCellSize:{...i},marker:f||void 0,tileCount:u,bufferType:this._terminal.buffer.active.type};this._images.set(h,d)}render(t){if(!this._renderer.canvas&&this._images.size&&(this._renderer.insertLayerToDom(),!this._renderer.canvas))return;if(this._renderer.rescaleCanvas(),!this._images.size)return this._fullyCleared||(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1),void(this._renderer.canvas&&this._renderer.removeLayerFromDom());this._needsFullClear&&(this._renderer.clearAll(),this._fullyCleared=!0,this._needsFullClear=!1);let{start:i,end:s}=t,e=this._terminal._core.buffer,h=this._terminal._core.cols;this._renderer.clearLines(i,s);for(let t=i;t<=s;++t){let i=e.lines.get(t+e.ydisp);if(!i)return;for(let s=0;s<h;++s)if(268435456&i.getBg(s)){let e=i._extendedAttrs[s]||hc,r=e.imageId;if(void 0===r||-1===r)continue;let n=this._images.get(r);if(-1!==e.tileId){let o=e.tileId,l=s,a=1;for(;++s<h&&268435456&i.getBg(s)&&(e=i._extendedAttrs[s]||hc)&&e.imageId===r&&e.tileId===o+a;)a++;s--,n?n.actual&&this._renderer.draw(n,o,l,t,a):this._opts.showPlaceholder&&this._renderer.drawPlaceholder(l,t,a),this._fullyCleared=!1}}}}viewportResize(t){if(!this._images.size)return void(this._viewportMetrics=t);if(this._viewportMetrics.cols>=t.cols)return void(this._viewportMetrics=t);let i=this._terminal._core.buffer,s=i.lines.length,e=this._viewportMetrics.cols-1;for(let h=0;h<s;++h){let s=i.lines.get(h);if(268435456&s.getBg(e)){let i=s._extendedAttrs[e]||hc,h=i.imageId;if(void 0===h||-1===h)continue;let r=this._images.get(h);if(!r)continue;let n=Math.ceil((r.actual?.width||0)/r.actualCellSize.width);if(i.tileId%n+1>=n)continue;let o=!1;for(let i=e+1;i>t.cols;++i)if(4194303&s._data[3*i+0]){o=!0;break}if(o)continue;let l=Math.min(t.cols,n-i.tileId%n+e),a=i.tileId;for(let t=e+1;t<l;++t)this._writeToCell(s,t,h,++a),r.tileCount++}}this._viewportMetrics=t}getImageAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||hc;if(i.imageId&&-1!==i.imageId){let t=this._images.get(i.imageId)?.orig;if(window.ImageBitmap&&t instanceof ImageBitmap){let i=ic.createCanvas(window.document,t.width,t.height);return i.getContext("2d")?.drawImage(t,0,0,t.width,t.height),i}return t}}}extractTileAtBufferCell(t,i){let s=this._terminal._core.buffer.lines.get(i);if(s&&268435456&s.getBg(t)){let i=s._extendedAttrs[t]||hc;if(i.imageId&&-1!==i.imageId&&-1!==i.tileId){let t=this._images.get(i.imageId);if(t)return this._renderer.extractTile(t,i.tileId)}}}_evictOldest(t){let i=this._getStoredPixels(),s=i;for(;this._pixelLimit<s+t&&this._images.size;){let t=this._images.get(++this._lowestId);t&&t.orig&&(s-=t.orig.width*t.orig.height,t.actual&&t.orig!==t.actual&&(s-=t.actual.width*t.actual.height),t.marker?.dispose(),this._delImg(this._lowestId))}return i-s}_writeToCell(t,i,s,e){if(268435456&t._data[3*i+2]){let h=t._extendedAttrs[i];if(h){if(void 0!==h.imageId){let t=this._images.get(h.imageId);return t&&t.tileCount--,h.imageId=s,void(h.tileId=e)}return void(t._extendedAttrs[i]=new ec(h.ext,h.urlId,s,e))}}t._data[3*i+2]|=268435456,t._extendedAttrs[i]=new ec(0,0,s,e)}_evictOnAlternate(){for(let t of this._images.values())"alternate"===t.bufferType&&(t.tileCount=0);let t=this._terminal._core.buffer;for(let i=0;i<this._terminal.rows;++i){let s=t.lines.get(i);if(s)for(let t=0;t<this._terminal.cols;++t)if(268435456&s._data[3*t+2]){let i=s._extendedAttrs[t]?.imageId;if(i){let t=this._images.get(i);t&&t.tileCount++}}}let i=[];for(let[t,s]of this._images.entries())"alternate"===s.bufferType&&!s.tileCount&&(s.marker?.dispose(),i.push(t));for(let t of i)this._delImg(t)}},nc=Ja(qa());function oc(t){let i="";for(let s=0;s<t.length;++s)i+=String.fromCharCode(t[s]);return i}function lc(t){let i=0;for(let s=0;s<t.length;++s){if(t[s]<48||t[s]>57)throw new Error("illegal char");i=10*i+t[s]-48}return i}function ac(t){let i=oc(t);if(!i.match(/^((auto)|(\d+?((px)|(%)){0,1}))$/))throw new Error("illegal size");return i}var cc={inline:lc,size:lc,name:function(t){if(typeof Buffer<"u")return Buffer.from(oc(t),"base64").toString();let i=atob(oc(t)),s=new Uint8Array(i.length);for(let t=0;t<s.length;++t)s[t]=i.charCodeAt(t);return(new TextDecoder).decode(s)},width:ac,height:ac,preserveAspectRatio:lc},uc=[70,105,108,101],Ac=1024,fc=class{constructor(){this.state=0,this._buffer=new Uint32Array(Ac),this._position=0,this._key="",this.fields={}}reset(){this._buffer.fill(0),this.state=0,this._position=0,this.fields={},this._key=""}parse(t,i,s){let e=this.state,h=this._position,r=this._buffer;if(1===e||4===e||0===e&&h>6)return-1;for(let n=i;n<s;++n){let i=t[n];switch(i){case 59:if(!this._storeValue(h))return this._a();e=2,h=0;break;case 61:if(0===e){for(let t=0;t<uc.length;++t)if(r[t]!==uc[t])return this._a();e=2,h=0}else if(2===e){if(!this._storeKey(h))return this._a();e=3,h=0}else if(3===e){if(h>=Ac)return this._a();r[h++]=i}break;case 58:return 3!==e||this._storeValue(h)?(this.state=4,n+1):this._a();default:if(h>=Ac)return this._a();r[h++]=i}}return this.state=e,this._position=h,-2}_a(){return this.state=1,-1}_storeKey(t){let i=oc(this._buffer.subarray(0,t));return!!i&&(this._key=i,this.fields[i]=null,!0)}_storeValue(t){if(this._key){try{let i=this._buffer.slice(0,t);this.fields[this._key]=cc[this._key]?cc[this._key](i):i}catch{return!1}return!0}return!1}},dc={mime:"unsupported",width:0,height:0},gc={name:"Unnamed file",size:0,width:"auto",height:"auto",preserveAspectRatio:1,inline:0},wc=class{constructor(t,i,s,e){this._opts=t,this._renderer=i,this._storage=s,this._coreTerminal=e,this._aborted=!1,this._hp=new fc,this._header=gc,this._dec=new nc.default(4194304),this._metrics=dc}reset(){}start(){this._aborted=!1,this._header=gc,this._metrics=dc,this._hp.reset()}put(t,i,s){if(!this._aborted)if(4===this._hp.state)this._dec.put(t,i,s)&&(this._dec.release(),this._aborted=!0);else{let e=this._hp.parse(t,i,s);if(-1===e)return void(this._aborted=!0);if(e>0){if(this._header=Object.assign({},gc,this._hp.fields),!this._header.inline||!this._header.size||this._header.size>this._opts.iipSizeLimit)return void(this._aborted=!0);this._dec.init(this._header.size),this._dec.put(t,e,s)&&(this._dec.release(),this._aborted=!0)}}}end(t){if(this._aborted)return!0;let i=0,s=0,e=!0;if((e=t)&&(e=!this._dec.end())&&(this._metrics=function(t){if(t.length<24)return dc;let i=new Uint32Array(t.buffer,t.byteOffset,6);if(1196314761===i[0]&&169478669===i[1]&&1380206665===i[3])return{mime:"image/png",width:t[16]<<24|t[17]<<16|t[18]<<8|t[19],height:t[20]<<24|t[21]<<16|t[22]<<8|t[23]};if(255===t[0]&&216===t[1]&&255===t[2]){let[i,s]=function(t){let i=t.length,s=4,e=t[s]<<8|t[s+1];for(;;){if(s+=e,s>=i)return[0,0];if(255!==t[s])return[0,0];if(192===t[s+1]||194===t[s+1])return s+8<i?[t[s+7]<<8|t[s+8],t[s+5]<<8|t[s+6]]:[0,0];s+=2,e=t[s]<<8|t[s+1]}}(t);return{mime:"image/jpeg",width:i,height:s}}return 944130375!==i[0]||55!==t[4]&&57!==t[4]||97!==t[5]?dc:{mime:"image/gif",width:t[7]<<8|t[6],height:t[9]<<8|t[8]}}(this._dec.data8),(e="unsupported"!==this._metrics.mime)&&(i=this._metrics.width,s=this._metrics.height,(e=i&&s&&i*s<this._opts.pixelLimit)&&([i,s]=this._resize(i,s).map(Math.floor),e=i&&s&&i*s<this._opts.pixelLimit))),!e)return this._dec.release(),!0;let h=new Blob([this._dec.data8],{type:this._metrics.mime});if(this._dec.release(),!window.createImageBitmap){let t=URL.createObjectURL(h),e=new Image;return new Promise((h=>{e.addEventListener("load",(()=>{URL.revokeObjectURL(t);let r=ic.createCanvas(window.document,i,s);r.getContext("2d")?.drawImage(e,0,0,i,s),this._storage.addImage(r),h(!0)})),e.src=t,setTimeout((()=>h(!0)),1e3)}))}return createImageBitmap(h,{resizeWidth:i,resizeHeight:s}).then((t=>(this._storage.addImage(t),!0)))}_resize(t,i){let s=this._renderer.dimensions?.css.cell.width||sc.width,e=this._renderer.dimensions?.css.cell.height||sc.height,h=this._renderer.dimensions?.css.canvas.width||s*this._coreTerminal.cols,r=this._renderer.dimensions?.css.canvas.height||e*this._coreTerminal.rows,n=this._dim(this._header.width,h,s),o=this._dim(this._header.height,r,e);if(!n&&!o){let s=Math.min(h/t,(r-e)/i);return s<1?[t*s,i*s]:[t,i]}return n?!this._header.preserveAspectRatio&&n&&o?[n,o]:[n,i*n/t]:[t*o/i,o]}_dim(t,i,s){return"auto"===t?0:t.endsWith("%")?parseInt(t.slice(0,-1))*i/100:t.endsWith("px")?parseInt(t.slice(0,-2)):parseInt(t)*s}},pc=Ja(Oa()),Cc=Ja(Ka()),Ic=pc.PALETTE_ANSI_256;Ic.set(pc.PALETTE_VT340_COLOR);var mc=class{constructor(t,i,s){this._opts=t,this._storage=i,this._coreTerminal=s,this._size=0,this._aborted=!1,(0,Cc.DecoderAsync)({memoryLimit:4*this._opts.pixelLimit,palette:Ic,paletteLimit:this._opts.sixelPaletteLimit}).then((t=>this._dec=t))}reset(){this._dec&&(this._dec.release(),this._dec._palette.fill(0),this._dec.init(0,Ic,this._opts.sixelPaletteLimit))}hook(t){if(this._size=0,this._aborted=!1,this._dec){let i=1===t.params[1]?0:function(t,i){let s=0;if(!i)return s;if(t.isInverse())if(t.isFgDefault())s=vc(i.foreground.rgba);else if(t.isFgRGB()){let i=t.constructor.toColorRGB(t.getFgColor());s=(0,pc.toRGBA8888)(...i)}else s=vc(i.ansi[t.getFgColor()].rgba);else if(t.isBgDefault())s=vc(i.background.rgba);else if(t.isBgRGB()){let i=t.constructor.toColorRGB(t.getBgColor());s=(0,pc.toRGBA8888)(...i)}else s=vc(i.ansi[t.getBgColor()].rgba);return s}(this._coreTerminal._core._inputHandler._curAttrData,this._coreTerminal._core._themeService?.colors);this._dec.init(i,null,this._opts.sixelPaletteLimit)}}put(t,i,s){if(!this._aborted&&this._dec){if(this._size+=s-i,this._size>this._opts.sixelSizeLimit)return console.warn("SIXEL: too much data, aborting"),this._aborted=!0,void this._dec.release();try{this._dec.decode(t,i,s)}catch(t){console.warn(`SIXEL: error while decoding image - ${t}`),this._aborted=!0,this._dec.release()}}}unhook(t){if(this._aborted||!t||!this._dec)return!0;let i=this._dec.width,s=this._dec.height;if(!i||!s)return s&&this._storage.advanceCursor(s),!0;let e=ic.createCanvas(void 0,i,s);return e.getContext("2d")?.putImageData(new ImageData(this._dec.data8,i,s),0,0),this._dec.memoryUsage>4194304&&this._dec.release(),this._storage.addImage(e),!0}};function vc(t){return pc.BIG_ENDIAN?t:(255&t)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255}var Bc={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7},bc=class{constructor(t){this._disposables=[],this._handlers=new Map,this._opts=Object.assign({},Bc,t),this._defaultOpts=Object.assign({},Bc,t)}dispose(){for(let t of this._disposables)t.dispose();this._disposables.length=0,this._handlers.clear()}_disposeLater(...t){for(let i of t)this._disposables.push(i)}activate(t){if(this._terminal=t,this._renderer=new ic(t),this._storage=new rc(t,this._renderer,this._opts),this._opts.enableSizeReports){let i=t.options.windowOptions||{};i.getWinSizePixels=!0,i.getCellSizePixels=!0,i.getWinSizeChars=!0,t.options.windowOptions=i}if(this._disposeLater(this._renderer,this._storage,t.parser.registerCsiHandler({prefix:"?",final:"h"},(t=>this._decset(t))),t.parser.registerCsiHandler({prefix:"?",final:"l"},(t=>this._decrst(t))),t.parser.registerCsiHandler({final:"c"},(t=>this._da1(t))),t.parser.registerCsiHandler({prefix:"?",final:"S"},(t=>this._xtermGraphicsAttributes(t))),t.onRender((t=>this._storage?.render(t))),t.parser.registerCsiHandler({intermediates:"!",final:"p"},(()=>this.reset())),t.parser.registerEscHandler({final:"c"},(()=>this.reset())),t._core._inputHandler.onRequestReset((()=>this.reset())),t.buffer.onBufferChange((()=>this._storage?.wipeAlternate())),t.onResize((t=>this._storage?.viewportResize(t)))),this._opts.sixelSupport){let i=new mc(this._opts,this._storage,t);this._handlers.set("sixel",i),this._disposeLater(t._core._inputHandler._parser.registerDcsHandler({final:"q"},i))}if(this._opts.iipSupport){let i=new wc(this._opts,this._renderer,this._storage,t);this._handlers.set("iip",i),this._disposeLater(t._core._inputHandler._parser.registerOscHandler(1337,i))}}reset(){this._opts.sixelScrolling=this._defaultOpts.sixelScrolling,this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._storage?.reset();for(let t of this._handlers.values())t.reset();return!1}get storageLimit(){return this._storage?.getLimit()||-1}set storageLimit(t){this._storage?.setLimit(t),this._opts.storageLimit=t}get storageUsage(){return this._storage?this._storage.getUsage():-1}get showPlaceholder(){return this._opts.showPlaceholder}set showPlaceholder(t){this._opts.showPlaceholder=t,this._renderer?.showPlaceholder(t)}getImageAtBufferCell(t,i){return this._storage?.getImageAtBufferCell(t,i)}extractTileAtBufferCell(t,i){return this._storage?.extractTileAtBufferCell(t,i)}_report(t){this._terminal?._core.coreService.triggerDataEvent(t)}_decset(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!1);return!1}_decrst(t){for(let i=0;i<t.length;++i)80===t[i]&&(this._opts.sixelScrolling=!0);return!1}_da1(t){return!!t[0]||!!this._opts.sixelSupport&&(this._report("[?62;4;9;22c"),!0)}_xtermGraphicsAttributes(t){if(t.length<2)return!0;if(1===t[0])switch(t[1]){case 1:return this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`),!0;case 2:this._opts.sixelPaletteLimit=this._defaultOpts.sixelPaletteLimit,this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`);for(let t of this._handlers.values())t.reset();return!0;case 3:return t.length>2&&!(t[2]instanceof Array)&&t[2]<=4096?(this._opts.sixelPaletteLimit=t[2],this._report(`[?${t[0]};0;${this._opts.sixelPaletteLimit}S`)):this._report(`[?${t[0]};2S`),!0;case 4:return this._report(`[?${t[0]};0;4096S`),!0;default:return this._report(`[?${t[0]};2S`),!0}if(2===t[0])switch(t[1]){case 1:let i=this._renderer?.dimensions?.css.canvas.width,s=this._renderer?.dimensions?.css.canvas.height;if(!i||!s){let t=sc;i=(this._terminal?.cols||80)*t.width,s=(this._terminal?.rows||24)*t.height}if(i*s<this._opts.pixelLimit)this._report(`[?${t[0]};0;${i.toFixed(0)};${s.toFixed(0)}S`);else{let i=Math.floor(Math.sqrt(this._opts.pixelLimit));this._report(`[?${t[0]};0;${i};${i}S`)}return!0;case 4:let e=Math.floor(Math.sqrt(this._opts.pixelLimit));return this._report(`[?${t[0]};0;${e};${e}S`),!0;default:return this._report(`[?${t[0]};2S`),!0}return this._report(`[?${t[0]};1S`),!0}};class Mc{__destroy_into_raw(){const t=this.__wbg_ptr;return this.__wbg_ptr=0,_c.unregister(this),t}free(){const t=this.__destroy_into_raw();tu.__wbg_channel_free(t,0)}connect(){tu.channel_connect(this.__wbg_ptr)}disconnect(){tu.channel_disconnect(this.__wbg_ptr)}is_connected(){return 0!==tu.channel_is_connected(this.__wbg_ptr)}is_disconnected(){return 0!==tu.channel_is_disconnected(this.__wbg_ptr)}constructor(t,i,s){const e=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),h=iu,r=Kc(i,tu.__wbindgen_export,tu.__wbindgen_export2),n=iu;var o=qc(s)?0:Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2);const l=tu.channel_new(e,h,r,n,o,iu);return this.__wbg_ptr=l>>>0,_c.register(this,this.__wbg_ptr,this),this}on_connection_close(t){tu.channel_on_connection_close(this.__wbg_ptr,qc(t)?0:Sc(t))}on_connection_error(t){tu.channel_on_connection_error(this.__wbg_ptr,qc(t)?0:Sc(t))}on_connection_message(t){tu.channel_on_connection_message(this.__wbg_ptr,qc(t)?0:Sc(t))}on_connection_open(t){tu.channel_on_connection_open(this.__wbg_ptr,qc(t)?0:Sc(t))}on_protocol_message(t){tu.channel_on_protocol_message(this.__wbg_ptr,qc(t)?0:Sc(t))}open_sftp_tunnel(t,i,s,e){const h=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),r=iu;var n=qc(i)?0:Kc(i,tu.__wbindgen_export,tu.__wbindgen_export2),o=iu,l=qc(s)?0:Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_open_sftp_tunnel(this.__wbg_ptr,h,r,n,o,l,iu,qc(e)?4294967297:e>>>0)}open_ssh_tunnel(t,i,s,e){const h=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),r=iu;var n=qc(i)?0:Kc(i,tu.__wbindgen_export,tu.__wbindgen_export2),o=iu,l=qc(s)?0:Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_open_ssh_tunnel(this.__wbg_ptr,h,r,n,o,l,iu,qc(e)?4294967297:e>>>0)}send_sftp_delete(t,i,s,e,h){const r=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),n=iu,o=Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2),l=iu,a=Kc(e,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_sftp_delete(this.__wbg_ptr,r,n,i,o,l,a,iu,qc(h)?4294967297:h>>>0)}send_sftp_download_chunk(t,i,s,e,h){const r=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_sftp_download_chunk(this.__wbg_ptr,r,iu,i,s,e,qc(h)?4294967297:h>>>0)}send_sftp_download_start(t,i,s,e,h){const r=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),n=iu,o=Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2),l=iu,a=Kc(e,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_sftp_download_start(this.__wbg_ptr,r,n,i,o,l,a,iu,qc(h)?4294967297:h>>>0)}send_sftp_list_data(t,i,s,e){const h=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),r=iu,n=Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_sftp_list_data(this.__wbg_ptr,h,r,i,n,iu,qc(e)?4294967297:e>>>0)}send_sftp_upload_chunk(t,i,s,e,h,r,n){const o=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),l=iu,a=function(t){const i=(0,tu.__wbindgen_export)(1*t.length,1)>>>0;return Gc().set(t,i/1),iu=t.length,i}(r);tu.channel_send_sftp_upload_chunk(this.__wbg_ptr,o,l,i,s,e,h,a,iu,qc(n)?4294967297:n>>>0)}send_sftp_upload_start(t,i,s,e,h,r,n){const o=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),l=iu,a=Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2),c=iu,u=Kc(e,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_sftp_upload_start(this.__wbg_ptr,o,l,i,a,c,u,iu,h,r,qc(n)?4294967297:n>>>0)}send_ssh_terminal_resize(t,i,s,e){const h=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_ssh_terminal_resize(this.__wbg_ptr,h,iu,i,s,e)}send_ssh_tunnel_data(t,i,s){const e=Kc(t,tu.__wbindgen_export,tu.__wbindgen_export2),h=iu,r=Kc(s,tu.__wbindgen_export,tu.__wbindgen_export2);tu.channel_send_ssh_tunnel_data(this.__wbg_ptr,e,h,i,r,iu)}start_heartbeat(t){tu.channel_start_heartbeat(this.__wbg_ptr,t)}stop_heartbeat(){tu.channel_stop_heartbeat(this.__wbg_ptr)}}Symbol.dispose&&(Mc.prototype[Symbol.dispose]=Mc.prototype.free);const yc=Object.freeze({Generic:0,0:"Generic",RequiresUsername:100,100:"RequiresUsername",RequiresPassword:110,110:"RequiresPassword"});function Ec(){const t={__proto__:null,__wbg_Error_83742b46f01ce22d:function(t,i){return Sc(Error(Uc(t,i)))},__wbg_String_8564e559799eccda:function(t,i){const s=Kc(String(Pc(i)),tu.__wbindgen_export,tu.__wbindgen_export2),e=iu;Hc().setInt32(t+4,e,!0),Hc().setInt32(t+0,s,!0)},__wbg___wbindgen_debug_string_5398f5bb970e0daa:function(t,i){const s=Kc(Rc(Pc(i)),tu.__wbindgen_export,tu.__wbindgen_export2),e=iu;Hc().setInt32(t+4,e,!0),Hc().setInt32(t+0,s,!0)},__wbg___wbindgen_string_get_395e606bd0ee4427:function(t,i){const s=Pc(i),e="string"==typeof s?s:void 0;var h=qc(e)?0:Kc(e,tu.__wbindgen_export,tu.__wbindgen_export2),r=iu;Hc().setInt32(t+4,r,!0),Hc().setInt32(t+0,h,!0)},__wbg___wbindgen_throw_6ddd609b62940d55:function(t,i){throw new Error(Uc(t,i))},__wbg__wbg_cb_unref_6b5b6b8576d35cb1:function(t){Pc(t)._wbg_cb_unref()},__wbg_call_2d781c1f4d5c0ef8:function(){return Jc((function(t,i,s){return Sc(Pc(t).call(Pc(i),Pc(s)))}),arguments)},__wbg_call_e133b57c9155d22c:function(){return Jc((function(t,i){return Sc(Pc(t).call(Pc(i)))}),arguments)},__wbg_clearInterval_16e8cbbce92291d0:function(t){return Sc(clearInterval(jc(t)))},__wbg_close_af26905c832a88cb:function(){return Jc((function(t){Pc(t).close()}),arguments)},__wbg_data_a3d9ff9cdd801002:function(t){return Sc(Pc(t).data)},__wbg_from_4bdf88943703fd48:function(t){return Sc(Array.from(Pc(t)))},__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6:function(t){let i;try{i=Pc(t)instanceof ArrayBuffer}catch(t){i=!1}return i},__wbg_length_ea16607d7b61445b:function(t){return Pc(t).length},__wbg_new_5f486cdf45a04d78:function(t){return Sc(new Uint8Array(Pc(t)))},__wbg_new_a70fbab9066b301f:function(){return Sc(new Array)},__wbg_new_ab79df5bd7c26067:function(){return Sc(new Object)},__wbg_new_with_str_299114bdb2430303:function(){return Jc((function(t,i,s,e){return Sc(new WebSocket(Uc(t,i),Uc(s,e)))}),arguments)},__wbg_prototypesetcall_d62e5099504357e6:function(t,i,s){Uint8Array.prototype.set.call(Nc(t,i),Pc(s))},__wbg_readyState_1f1e7f1bdf9f4d42:function(t){return Pc(t).readyState},__wbg_send_d31a693c975dea74:function(){return Jc((function(t,i,s){Pc(t).send(Nc(i,s))}),arguments)},__wbg_setInterval_84b64f01452a246e:function(){return Jc((function(t,i){return Sc(setInterval(Pc(t),i))}),arguments)},__wbg_set_282384002438957f:function(t,i,s){Pc(t)[i>>>0]=jc(s)},__wbg_set_6be42768c690e380:function(t,i,s){Pc(t)[jc(i)]=jc(s)},__wbg_set_binaryType_3dcf8281ec100a8f:function(t,i){Pc(t).binaryType=Lc[i]},__wbg_set_onclose_8da801226bdd7a7b:function(t,i){Pc(t).onclose=Pc(i)},__wbg_set_onerror_901ca711f94a5bbb:function(t,i){Pc(t).onerror=Pc(i)},__wbg_set_onmessage_6f80ab771bf151aa:function(t,i){Pc(t).onmessage=Pc(i)},__wbg_set_onopen_34e3e24cf9337ddd:function(t,i){Pc(t).onopen=Pc(i)},__wbg_warn_8bf12ab4ab279fd4:function(t,i){console.warn(Uc(t,i))},__wbindgen_cast_0000000000000001:function(t,i){return Sc(zc(t,i,tu.__wasm_bindgen_func_elem_37,kc))},__wbindgen_cast_0000000000000002:function(t,i){return Sc(zc(t,i,tu.__wasm_bindgen_func_elem_37,xc))},__wbindgen_cast_0000000000000003:function(t,i){return Sc(zc(t,i,tu.__wasm_bindgen_func_elem_37,Dc))},__wbindgen_cast_0000000000000004:function(t,i){return Sc(zc(t,i,tu.__wasm_bindgen_func_elem_37,Qc))},__wbindgen_cast_0000000000000005:function(t){return Sc(t)},__wbindgen_cast_0000000000000006:function(t,i){return Sc(Nc(t,i))},__wbindgen_cast_0000000000000007:function(t,i){return Sc(Uc(t,i))},__wbindgen_cast_0000000000000008:function(t){return Sc(BigInt.asUintN(64,t))},__wbindgen_object_clone_ref:function(t){return Sc(Pc(t))},__wbindgen_object_drop_ref:function(t){jc(t)}};return{__proto__:null,"./phirepass-channel_bg.js":t}}function Qc(t,i){tu.__wasm_bindgen_func_elem_42(t,i)}function kc(t,i,s){tu.__wasm_bindgen_func_elem_38(t,i,Sc(s))}function xc(t,i,s){tu.__wasm_bindgen_func_elem_38_1(t,i,Sc(s))}function Dc(t,i,s){tu.__wasm_bindgen_func_elem_38_2(t,i,Sc(s))}const Lc=["blob","arraybuffer"],_c="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>tu.__wbg_channel_free(t>>>0,1)));function Sc(t){Wc===Oc.length&&Oc.push(Oc.length+1);const i=Wc;return Wc=Oc[i],Oc[i]=t,i}const $c="undefined"==typeof FinalizationRegistry?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry((t=>t.dtor(t.a,t.b)));function Rc(t){const i=typeof t;if("number"==i||"boolean"==i||null==t)return`${t}`;if("string"==i)return`"${t}"`;if("symbol"==i){const i=t.description;return null==i?"Symbol":`Symbol(${i})`}if("function"==i){const i=t.name;return"string"==typeof i&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){const i=t.length;let s="[";i>0&&(s+=Rc(t[0]));for(let e=1;e<i;e++)s+=", "+Rc(t[e]);return s+="]",s}const s=/\[object ([^\]]+)\]/.exec(toString.call(t));let e;if(!(s&&s.length>1))return toString.call(t);if(e=s[1],"Object"==e)try{return"Object("+JSON.stringify(t)+")"}catch(t){return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:e}function Nc(t,i){return t>>>=0,Gc().subarray(t/1,t/1+i)}let Fc=null;function Hc(){return(null===Fc||!0===Fc.buffer.detached||void 0===Fc.buffer.detached&&Fc.buffer!==tu.memory.buffer)&&(Fc=new DataView(tu.memory.buffer)),Fc}function Uc(t,i){return function(t,i){return Xc+=i,Xc>=Zc&&(Yc=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),Yc.decode(),Xc=i),Yc.decode(Gc().subarray(t,t+i))}(t>>>=0,i)}let Tc=null;function Gc(){return null!==Tc&&0!==Tc.byteLength||(Tc=new Uint8Array(tu.memory.buffer)),Tc}function Pc(t){return Oc[t]}function Jc(t,i){try{return t.apply(this,i)}catch(t){tu.__wbindgen_export3(Sc(t))}}let Oc=new Array(1024).fill(void 0);Oc.push(void 0,null,!0,!1);let Wc=Oc.length;function qc(t){return null==t}function zc(t,i,s,e){const h={a:t,b:i,cnt:1,dtor:s},r=(...t)=>{h.cnt++;const i=h.a;h.a=0;try{return e(i,h.b,...t)}finally{h.a=i,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{0==--h.cnt&&(h.dtor(h.a,h.b),h.a=0,$c.unregister(h))},$c.register(r,h,h),r}function Kc(t,i,s){if(void 0===s){const s=Vc.encode(t),e=i(s.length,1)>>>0;return Gc().subarray(e,e+s.length).set(s),iu=s.length,e}let e=t.length,h=i(e,1)>>>0;const r=Gc();let n=0;for(;n<e;n++){const i=t.charCodeAt(n);if(i>127)break;r[h+n]=i}if(n!==e){0!==n&&(t=t.slice(n)),h=s(h,e,e=n+3*t.length,1)>>>0;const i=Gc().subarray(h+n,h+e);n+=Vc.encodeInto(t,i).written,h=s(h,e,n,1)>>>0}return iu=n,h}function jc(t){const i=Pc(t);return function(t){t<1028||(Oc[t]=Wc,Wc=t)}(t),i}let Yc=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Yc.decode();const Zc=2146435072;let Xc=0;const Vc=new TextEncoder;"encodeInto"in Vc||(Vc.encodeInto=function(t,i){const s=Vc.encode(t);return i.set(s),{read:t.length,written:s.length}});let tu,iu=0;var su;!function(t){t[t.Username=0]="Username",t[t.Password=1]="Password",t[t.Default=2]="Default"}(su||(su={}));const eu=class{constructor(i){t(this,i)}terminal;fitAddon;webLinksAddon;searchAddon;webglAddon;serializeAddon;imageAddon;channel;inputMode=su.Default;resizeObserver;resizeDebounceHandle;session_id;usernameBuffer="";passwordBuffer="";xtermImageSettings={enableSizeReports:!0,pixelLimit:16777216,sixelSupport:!0,sixelScrolling:!0,sixelPaletteLimit:256,sixelSizeLimit:25e6,storageLimit:128,showPlaceholder:!0,iipSupport:!0,iipSizeLimit:2e7};get el(){return i(this)}terminalOptions={termName:"xterm-256color",rendererType:"canvas",allowTransparency:!1,fontFamily:'"Berkeley Mono", "Fira Code", "SFMono-Regular", Menlo, monospace',fontSize:12,letterSpacing:0,lineHeight:1,allowProposedApi:!0,cursorBlink:!0,cursorWidth:1,theme:{background:"#0b1021",foreground:"#e2e8f0",cursor:"#67e8f9"},scrollback:1e4,fastScrollModifier:"shift",fastScrollSensitivity:5,bellStyle:"sound",convertEol:!1,disableStdin:!1,rightClickSelectsWord:!0,drawBoldTextInBrightColors:!0,minimumContrastRatio:1,windowsMode:!1,macOptionIsMeta:!1,altClickMovesCursor:!0};serverHost="phirepass.com";serverPort=443;allowInsecure=!1;heartbeatInterval=3e4;nodeId;onNodeIdChange(t,i){this.resetSessionState(),this.terminal.reset(),this.channel&&this.channel.is_connected()&&this.close_comms(),t&&(this.open_comms(),this.channel.connect())}serverId;onServerIdChange(t,i){this.onNodeIdChange(this.nodeId,this.nodeId)}createWebSocketEndpoint(){const t=this.allowInsecure?"ws":"wss";return this.allowInsecure||443!==this.serverPort?this.allowInsecure&&80===this.serverPort?`${t}://${this.serverHost}`:`${t}://${this.serverHost}:${this.serverPort}`:`${t}://${this.serverHost}`}async connectedCallback(){await async function(t){if(void 0!==tu)return tu;void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?({module_or_path:t}=t):console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("phirepass-channel_bg.wasm",import.meta.url));const i=Ec();("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t));const{instance:s}=await async function(t,i){if("function"==typeof Response&&t instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(t,i)}catch(i){if(!t.ok||!function(t){switch(t){case"basic":case"cors":case"default":return!0}return!1}(t.type)||"application/wasm"===t.headers.get("Content-Type"))throw i;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i)}const s=await t.arrayBuffer();return await WebAssembly.instantiate(s,i)}{const s=await WebAssembly.instantiate(t,i);return s instanceof WebAssembly.Instance?{instance:s,module:t}:s}}(await t,i);return function(t){return tu=t.exports,Fc=null,Tc=null,tu}(s)}(),this.setup_terminal(),this.open_comms(),this.nodeId?this.connect():console.warn("Prop node_id is not set. Cannot connect to terminal.")}async disconnectedCallback(){this.resizeObserver&&this.resizeObserver.disconnect(),this.close_comms(),this.destroy_terminal()}setup_terminal(){this.terminal=new wr(this.terminalOptions),this.fitAddon=new pr,this.terminal.loadAddon(this.fitAddon),this.webLinksAddon=new br,this.terminal.loadAddon(this.webLinksAddon),this.searchAddon=new Mn,this.terminal.loadAddon(this.searchAddon),this.serializeAddon=new $a,this.terminal.loadAddon(this.serializeAddon),this.imageAddon=new bc(this.xtermImageSettings),this.terminal.loadAddon(this.imageAddon);try{this.webglAddon=new Ca,this.terminal.loadAddon(this.webglAddon)}catch(t){console.warn("WebGL addon not available or failed to load:",t)}this.fitAddon.fit()}destroy_terminal(){this.terminal&&(this.terminal.reset(),"function"==typeof this.terminal.dispose&&this.terminal.dispose())}open_comms(){this.channel=this.serverId?new Mc(`${this.createWebSocketEndpoint()}/api/web/ws`,this.nodeId,this.serverId):new Mc(`${this.createWebSocketEndpoint()}/api/web/ws`,this.nodeId),this.channel.on_connection_open((()=>{this.channel.start_heartbeat(this.heartbeatInterval<=15e3?3e4:this.heartbeatInterval),this.channel.open_ssh_tunnel(this.nodeId)})),this.channel.on_connection_close((()=>{this.terminal.reset()})),this.channel.on_connection_error((t=>{console.error(">> connection error:",t)})),this.channel.on_connection_message((()=>{})),this.channel.on_protocol_message((t=>{const{web:i}=t.data;switch(i.type){case"Error":this.handle_error(i);break;case"TunnelOpened":this.session_id=i.sid,this.terminal.reset(),this.send_ssh_terminal_resize();break;case"TunnelClosed":this.handleTunnelClosed();break;case"TunnelData":this.terminal.write(new Uint8Array(i.data));break;default:console.warn("Unknown protocol message type:",i)}}))}send_ssh_terminal_resize(){if(!this.channel||!this.channel.is_connected()||!this.session_id)return;const t=this.terminal?.cols??0,i=this.terminal?.rows??0;if(!(t<=0||i<=0))try{this.channel.send_ssh_terminal_resize(this.nodeId,this.session_id,t,i)}catch(t){console.error("Failed to send terminal resize:",t)}}send_ssh_data(t){this.channel.is_connected()&&this.session_id&&this.channel.send_ssh_tunnel_data(this.nodeId,this.session_id,t)}handle_error(t){switch(t.kind){case yc.Generic:this.terminal.reset(),this.terminal.write(t.message+"\r\n"),this.terminal.focus();break;case yc.RequiresUsername:this.terminal.reset(),this.inputMode=su.Username,this.usernameBuffer="",this.terminal.write("Enter your username: "),this.terminal.focus();break;case yc.RequiresPassword:this.terminal.reset(),this.inputMode=su.Password,this.passwordBuffer="",this.terminal.write("Enter your password: "),this.terminal.focus();break;default:console.warn("Unknown error kind:",t)}}close_comms(){this.channel.stop_heartbeat(),this.channel.disconnect()}cancelCredentialEntry(){this.inputMode=su.Default,this.usernameBuffer="",this.passwordBuffer="",this.terminal.writeln("Authentication cancelled."),this.terminal.reset()}resetSessionState(){this.session_id=void 0,this.inputMode=su.Default,this.usernameBuffer="",this.passwordBuffer=""}handleTunnelClosed(){this.session_id=void 0,this.inputMode=su.Default,this.usernameBuffer="",this.passwordBuffer="",this.terminal.reset(),this.terminal.writeln("Connection closed.")}connect(){const t=this.el.shadowRoot.getElementById("ccc");t&&(this.terminal.open(t),this.fitAddon.fit(),this.terminal.focus(),this.terminal.onData(this.handleTerminalData.bind(this)),this.channel.connect(),this.setupResizeObserver())}setupResizeObserver(){this.resizeObserver=new ResizeObserver((()=>{this.resizeDebounceHandle&&clearTimeout(this.resizeDebounceHandle),this.resizeDebounceHandle=setTimeout((()=>{this.fitAddon.fit(),this.send_ssh_terminal_resize()}),100)})),this.resizeObserver.observe(this.el)}handleTerminalData(t){switch(this.inputMode){case su.Username:this.handleUsernameInput(t);break;case su.Password:this.handlePasswordInput(t);break;case su.Default:this.send_ssh_data(t)}}handleUsernameInput(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submitUsername()):""===t?(this.terminal.write("^C\r\n"),void this.cancelCredentialEntry()):void(""!==t?t>=" "&&t<="~"&&(this.usernameBuffer+=t,this.terminal.write(t)):this.usernameBuffer.length&&(this.usernameBuffer=this.usernameBuffer.slice(0,-1),this.terminal.write("\b \b")))}submitUsername(){if(!this.channel.is_connected())return;const t=this.usernameBuffer.trim();if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your username: "),void(this.usernameBuffer="");this.inputMode=su.Default,this.channel.open_ssh_tunnel(this.nodeId,t)}handlePasswordInput(t){return"\r"===t||"\n"===t?(this.terminal.write("\r\n"),void this.submitPassword()):""===t?(this.terminal.write("^C\r\n"),void this.cancelCredentialEntry()):void(""!==t?t>=" "&&t<="~"&&(this.passwordBuffer+=t,this.terminal.write("*")):this.passwordBuffer.length&&(this.passwordBuffer=this.passwordBuffer.slice(0,-1),this.terminal.write("\b \b")))}submitPassword(){if(!this.channel.is_connected())return;const t=this.passwordBuffer;if(!t)return this.terminal.writeln(""),this.terminal.write("Enter your password: "),void(this.passwordBuffer="");this.inputMode=su.Default,this.channel.open_ssh_tunnel(this.nodeId,this.usernameBuffer.trim(),t),this.passwordBuffer="",this.usernameBuffer=""}render(){return s(e,{key:"885e11a9806ba614dda57e491f9d67fddd9aca9e"},s("div",{key:"ea169bd62479b9f831989f244f640777d48d65c4",id:"ccc"}))}static get watchers(){return{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}}};eu.style=".xterm{cursor:text;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;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{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-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%}:host #ccc{width:inherit;height:inherit}";export{eu as phirepass_terminal}
@@ -0,0 +1 @@
1
+ import{r as e,h as s,H as r}from"./p-DtzrexIM.js";const t=class{constructor(s){e(this,s)}render(){return s(r,{key:"d03ff09e3636f79d699c7462e121abe7d08c6683"},s("slot",{key:"bd7285e70384558e4cbf0600b89a57fa4ec3406d"}))}};t.style=":host{display:block}";export{t as phirepass_sftp_client}
@@ -1 +1 @@
1
- import{p as e,b as r}from"./p-elO6rcMK.js";export{s as setNonce}from"./p-elO6rcMK.js";import{g as t}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,s={};return""!==r&&(s.resourcesUrl=new URL(".",r).href),e(s)})().then((async e=>(await t(),r([["p-37426f4b",[[257,"phirepass-sftp-client"]]],["p-2ee3ba0c",[[513,"phirepass-terminal",{terminalOptions:[16],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serverId:[1,"server-id"]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]]],e))));
1
+ import{p as e,b as r}from"./p-DtzrexIM.js";export{s as setNonce}from"./p-DtzrexIM.js";import{g as t}from"./p-DQuL1Twl.js";(()=>{const r=import.meta.url,s={};return""!==r&&(s.resourcesUrl=new URL(".",r).href),e(s)})().then((async e=>(await t(),r([["p-ffa3a974",[[257,"phirepass-sftp-client"]]],["p-ff78ace0",[[513,"phirepass-terminal",{terminalOptions:[16],serverHost:[1,"server-host"],serverPort:[2,"server-port"],allowInsecure:[4,"allow-insecure"],heartbeatInterval:[2,"heartbeat-interval"],nodeId:[1,"node-id"],serverId:[1,"server-id"]},null,{nodeId:[{onNodeIdChange:0}],serverId:[{onServerIdChange:0}]}]]]],e))));
@@ -19,7 +19,7 @@ export namespace Components {
19
19
  "heartbeatInterval": number;
20
20
  "nodeId"?: string;
21
21
  /**
22
- * @default "phirepass.io"
22
+ * @default "phirepass.com"
23
23
  */
24
24
  "serverHost": string;
25
25
  "serverId"?: string;
@@ -65,7 +65,7 @@ declare namespace LocalJSX {
65
65
  "heartbeatInterval"?: number;
66
66
  "nodeId"?: string;
67
67
  /**
68
- * @default "phirepass.io"
68
+ * @default "phirepass.com"
69
69
  */
70
70
  "serverHost"?: string;
71
71
  "serverId"?: string;
@@ -679,6 +679,7 @@ export declare namespace h {
679
679
  function h(sel: any, data: VNodeData | null, text: string): VNode;
680
680
  function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode;
681
681
  function h(sel: any, data: VNodeData | null, children: VNode): VNode;
682
+ function h(sel: any, data: VNodeData | null, ...children: (VNode | string | number)[]): VNode;
682
683
  namespace JSX {
683
684
  interface IntrinsicElements extends LocalJSX.IntrinsicElements, JSXBase.IntrinsicElements {
684
685
  [tagName: string]: any;
@@ -692,6 +693,8 @@ export declare function h(sel: any, text: string): VNode;
692
693
  export declare function h(sel: any, children: Array<VNode | undefined | null>): VNode;
693
694
  export declare function h(sel: any, data: VNodeData | null, text: string): VNode;
694
695
  export declare function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode;
696
+ export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode;
697
+ export declare function h(sel: any, data: VNodeData | null, ...children: (VNode | string | number)[]): VNode;
695
698
  /**
696
699
  * Automatic JSX runtime functions for TypeScript's react-jsx mode.
697
700
  * These functions are called automatically by TypeScript when using "jsx": "react-jsx".
@@ -721,7 +724,6 @@ export declare function jsxs(type: any, props: any, key?: string): VNode;
721
724
  * @returns a jsx vnode
722
725
  */
723
726
  export declare function jsxDEV(type: any, props: any, key?: string | number, isStaticChildren?: boolean, source?: any, self?: any): VNode;
724
- export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode;
725
727
  /**
726
728
  * A virtual DOM node
727
729
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phirepass-widgets",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Phirepass widgets for the web application",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -41,12 +41,12 @@
41
41
  "generate": "stencil generate"
42
42
  },
43
43
  "devDependencies": {
44
- "@stencil/core": "^4.43.0",
44
+ "@stencil/core": "^4.43.2",
45
45
  "@types/jest": "^29",
46
- "@types/node": "^25.2.3",
46
+ "@types/node": "^25.5.0",
47
47
  "jest": "^29",
48
48
  "jest-cli": "^29",
49
- "puppeteer": "^24.37.3"
49
+ "puppeteer": "^24.39.1"
50
50
  },
51
51
  "license": "AGPL-3.0-or-later",
52
52
  "dependencies": {
@@ -57,6 +57,6 @@
57
57
  "@xterm/addon-web-links": "^0.12.0",
58
58
  "@xterm/addon-webgl": "^0.19.0",
59
59
  "@xterm/xterm": "^6.0.0",
60
- "phirepass-channel": "^0.1.123"
60
+ "phirepass-channel": "^0.1.160"
61
61
  }
62
62
  }
@@ -1 +0,0 @@
1
- import{r as e,h as s,H as r}from"./p-elO6rcMK.js";const c=class{constructor(s){e(this,s)}render(){return s(r,{key:"d03ff09e3636f79d699c7462e121abe7d08c6683"},s("slot",{key:"bd7285e70384558e4cbf0600b89a57fa4ec3406d"}))}};c.style=":host{display:block}";export{c as phirepass_sftp_client}
@@ -1,2 +0,0 @@
1
- var t,e=(t,e)=>{var n;Object.entries(null!=(n=e.o.t)?n:{}).map((([n,[o]])=>{if(31&o||32&o){const o=t[n],l=function(t,e){for(;t;){const n=Object.getOwnPropertyDescriptor(t,e);if(null==n?void 0:n.get)return n;t=Object.getPrototypeOf(t)}}(Object.getPrototypeOf(t),n)||Object.getOwnPropertyDescriptor(t,n);l&&Object.defineProperty(t,n,{get(){return l.get.call(this)},set(t){l.set.call(this,t)},configurable:!0,enumerable:!0}),t[n]=e.l.has(n)?e.l.get(n):o}}))},n=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},o=(t,n)=>{n&&(t.__stencil__getHostRef=()=>n,n.i=t,512&n.o.u&&e(t,n))},l=(t,e)=>(0,console.error)(t,e),i=new Map,s=new Map,r="undefined"!=typeof window?window:{},c={u:0,h:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o),ce:(t,e)=>new CustomEvent(t,e)},u=t=>Promise.resolve(t),a=(()=>{try{return!!r.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),f=!!a&&(()=>!!r.document&&Object.getOwnPropertyDescriptor(r.document.adoptedStyleSheets,"length").writable)(),d=!1,h=[],p=[],m=(t,e)=>n=>{t.push(n),d||(d=!0,e&&4&c.u?b(y):c.raf(y))},v=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){l(t)}t.length=0},y=()=>{v(h),v(p),(d=h.length>0)&&c.raf(y)},b=t=>u().then(t),$=m(p,!0);function w(){const e=this.attachShadow({mode:"open"});void 0===t&&(t=null),t&&(f?e.adoptedStyleSheets.push(t):e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])}function g(t){var e,n,o;return null!=(o=null==(n=null==(e=t.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?o:void 0}var j,S=new WeakMap,O=t=>"sc-"+t.p,k=t=>"object"==(t=typeof t)||"function"===t,M=(t,e,...n)=>{let o=null,l=null,i=!1,s=!1;const r=[],c=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?c(o):null!=o&&"boolean"!=typeof o&&((i="function"!=typeof t&&!k(o))&&(o+=""),i&&s?r[r.length-1].m+=o:r.push(i?C(null,o):o),s=i)};c(n),e&&e.key&&(l=e.key);const u=C(t,null);return u.v=e,r.length>0&&(u.$=r),u.j=l,u},C=(t,e)=>({u:0,S:t,m:null!=e?e:null,O:null,$:null,v:null,j:null}),E={},A=(t,e)=>null==t||k(t)?t:4&e?"false"!==t&&(""===t||!!t):2&e?"string"==typeof t?parseFloat(t):"number"==typeof t?t:NaN:1&e?t+"":t,N=t=>{var e;return null==(e=n(t))?void 0:e.$hostElement$},x=(t,e,o,l,i,s)=>{if(o===l)return;let r=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"key"===e);else{if("a"===e[0]&&e.startsWith("attr:")){const o=e.slice(5);let i;{const e=n(t);if(e&&e.o&&e.o.t){const t=e.o.t[o];t&&t[1]&&(i=t[1])}}return i||(i=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==l||!1===l?!1===l&&""!==t.getAttribute(i)||t.removeAttribute(i):t.setAttribute(i,!0===l?"":l))}if("p"===e[0]&&e.startsWith("prop:")){const n=e.slice(5);try{t[n]=l}catch(t){}return}{const n=k(l);if(r||n&&null!==l)try{if(t.tagName.includes("-"))t[e]!==l&&(t[e]=l);else{const n=null==l?"":l;"list"===e?r=!1:null!=o&&t[e]===n||("function"==typeof t.__lookupSetter__(e)?t[e]=n:t.setAttribute(e,n))}}catch(t){}null==l||!1===l?!1===l&&""!==t.getAttribute(e)||t.removeAttribute(e):(!r||4&s||i)&&!n&&1===t.nodeType&&t.setAttribute(e,l=!0===l?"":l)}}},D=(t,e,n)=>{const o=11===e.O.nodeType&&e.O.host?e.O.host:e.O,l=t&&t.v||{},i=e.v||{};for(const t of P(Object.keys(l)))t in i||x(o,t,l[t],void 0,n,e.u);for(const t of P(Object.keys(i)))x(o,t,l[t],i[t],n,e.u)};function P(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var R=!1,L=!1,U=(t,e,n)=>{const o=e.$[n];let l,i,s=0;if(!r.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(l=o.O=r.document.createElement(o.S),D(null,o,L),o.$){const e="template"===o.S?l.content:l;for(s=0;s<o.$.length;++s)i=U(t,o,s),i&&e.appendChild(i)}return l["s-hn"]=j,l},H=(t,e,n,o,l,i)=>{let s,r=t;for(r.shadowRoot&&r.tagName===j&&(r=r.shadowRoot),"template"===n.S&&(r=r.content);l<=i;++l)o[l]&&(s=U(null,n,l),s&&(o[l].O=s,F(r,s,e)))},T=(t,e,n)=>{for(let o=e;o<=n;++o){const e=t[o];if(e){const t=e.O;t&&t.remove()}}},W=(t,e,n=!1)=>t.S===e.S&&(n?(n&&!t.j&&e.j&&(t.j=e.j),!0):t.j===e.j),z=(t,e,n=!1)=>{const o=e.O=t.O,l=t.$,i=e.$;"slot"!==e.S||R||t.k!==e.k&&(e.O["s-sn"]=e.k||"",(t=>{c.u|=1;const e=t.closest(j.toLowerCase());if(null!=e){const n=Array.from(e.__childNodes||e.childNodes).find((t=>t["s-cr"])),o=Array.from(t.__childNodes||t.childNodes);for(const t of n?o.reverse():o)null!=t["s-sh"]&&(F(e,t,null!=n?n:null),t["s-sh"]=void 0)}c.u&=-2})(e.O.parentElement)),D(t,e,L),null!==l&&null!==i?((t,e,n,o,l=!1)=>{let i,s,r=0,c=0,u=0,a=0,f=e.length-1,d=e[0],h=e[f],p=o.length-1,m=o[0],v=o[p];const y="template"===n.S?t.content:t;for(;r<=f&&c<=p;)if(null==d)d=e[++r];else if(null==h)h=e[--f];else if(null==m)m=o[++c];else if(null==v)v=o[--p];else if(W(d,m,l))z(d,m,l),d=e[++r],m=o[++c];else if(W(h,v,l))z(h,v,l),h=e[--f],v=o[--p];else if(W(d,v,l))z(d,v,l),F(y,d.O,h.O.nextSibling),d=e[++r],v=o[--p];else if(W(h,m,l))z(h,m,l),F(y,h.O,d.O),h=e[--f],m=o[++c];else{for(u=-1,a=r;a<=f;++a)if(e[a]&&null!==e[a].j&&e[a].j===m.j){u=a;break}u>=0?(s=e[u],s.S!==m.S?i=U(e&&e[c],n,u):(z(s,m,l),e[u]=void 0,i=s.O),m=o[++c]):(i=U(e&&e[c],n,c),m=o[++c]),i&&F(d.O.parentNode,i,d.O)}r>f?H(t,null==o[p+1]?null:o[p+1].O,n,o,c,p):c>p&&T(e,r,f)})(o,l,e,i,n):null!==i?H(o,null,e,i,0,i.length-1):!n&&null!==l&&T(l,0,l.length-1)},F=(t,e,n)=>t.__insertBefore?t.__insertBefore(e,n):null==t?void 0:t.insertBefore(e,n),q=(t,e)=>{if(e&&!t.M&&e["s-p"]){const n=e["s-p"].push(new Promise((o=>t.M=()=>{e["s-p"].splice(n-1,1),o()})))}},V=(t,e)=>{if(t.u|=16,4&t.u)return void(t.u|=512);q(t,t.C);const n=()=>G(t,e);if(!e)return $(n);queueMicrotask((()=>{n()}))},G=(t,e)=>{const n=t.$hostElement$,o=t.i;if(!o)throw Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return e?(t.A.length&&t.A.forEach((t=>t(n))),l=K(o,"componentWillLoad",void 0,n)):l=K(o,"componentWillUpdate",void 0,n),l=Y(l,(()=>K(o,"componentWillRender",void 0,n))),Y(l,(()=>_(t,o,e)))},Y=(t,e)=>Z(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),Z=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,_=async(t,e,n)=>{var o;const l=t.$hostElement$,i=l["s-rc"];n&&(t=>{const e=t.o,n=t.$hostElement$,o=e.u,l=((t,e)=>{var n,o,l;const i=O(e),u=s.get(i);if(!r.document)return i;if(t=11===t.nodeType?t:r.document,u)if("string"==typeof u){let l,s=S.get(t=t.head||t);if(s||S.set(t,s=new Set),!s.has(i)){l=r.document.createElement("style"),l.textContent=u;const d=null!=(n=c.N)?n:g(r.document);if(null!=d&&l.setAttribute("nonce",d),!(1&e.u))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),n=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==n?void 0:n.parentNode)===t?n:null)}else if("host"in t)if(a){const e=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(u),f?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.textContent=u+e.textContent:t.prepend(l)}else t.append(l);1&e.u&&t.insertBefore(l,null),4&e.u&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(i)}}else{let e=S.get(t);if(e||S.set(t,e=new Set),!e.has(i)){const n=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(u.constructor===n.CSSStyleSheet)o=u;else{o=new n.CSSStyleSheet;for(let t=0;t<u.cssRules.length;t++)o.insertRule(u.cssRules[t].cssText,t)}f?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],e.add(i)}}return i})(n.shadowRoot?n.shadowRoot:n.getRootNode(),e);10&o&&(n["s-sc"]=l,n.classList.add(l+"-h"))})(t);B(t,e,l,n),i&&(i.map((t=>t())),l["s-rc"]=void 0);{const e=null!=(o=l["s-p"])?o:[],n=()=>I(t);0===e.length?n():(Promise.all(e).then(n).catch(n),t.u|=4,e.length=0)}},B=(t,e,n,o)=>{try{e=e.render(),t.u&=-17,t.u|=2,((t,e,n=!1)=>{const o=t.$hostElement$,l=t.o,i=t.D||C(null,null),s=(t=>t&&t.S===E)(e)?e:M(null,null,e);if(j=o.tagName,n&&s.v)for(const t of Object.keys(s.v))o.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(s.v[t]=o[t]);s.S=null,s.u|=4,t.D=s,s.O=i.O=o.shadowRoot||o,R=!(!(1&l.u)||128&l.u),z(i,s,n)})(t,e,o)}catch(e){l(e,t.$hostElement$)}return null},I=t=>{const e=t.$hostElement$,n=t.i,o=t.C;K(n,"componentDidRender",void 0,e),64&t.u?K(n,"componentDidUpdate",void 0,e):(t.u|=64,Q(e),K(n,"componentDidLoad",void 0,e),t.P(e),o||J()),t.M&&(t.M(),t.M=void 0),512&t.u&&b((()=>V(t,!1))),t.u&=-517},J=()=>{b((()=>(t=>{const e=c.ce("appload",{detail:{namespace:"phirepass-widgets"}});return t.dispatchEvent(e),e})(r)))},K=(t,e,n,o)=>{if(t&&t[e])try{return t[e](n)}catch(t){l(t,o)}},Q=t=>t.classList.add("hydrated"),X=(t,e,o,i)=>{const s=n(t);if(!s)return;if(!s)throw Error(`Couldn't find host element for "${i.p}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const r=s.$hostElement$,c=s.l.get(e),u=s.u,a=s.i;if(o=A(o,i.t[e][0]),!(8&u&&void 0!==c||o===c||Number.isNaN(c)&&Number.isNaN(o))){if(s.l.set(e,o),i.R){const t=i.R[e];t&&t.map((t=>{try{const[[n,l]]=Object.entries(t);(128&u||1&l)&&(a?a[n](o,c,e):s.A.push((()=>{s.i[n](o,c,e)})))}catch(t){l(t,r)}}))}if(2&u){if(a.componentShouldUpdate&&!1===a.componentShouldUpdate(o,c,e)&&!(16&u))return;16&u||V(s,!1)}}},tt=(t,e,o)=>{var l,i;const s=t.prototype;{t.watchers&&!e.R&&(e.R=t.watchers),t.deserializers&&!e.L&&(e.L=t.deserializers),t.serializers&&!e.U&&(e.U=t.serializers);const r=Object.entries(null!=(l=e.t)?l:{});if(r.map((([t,[l]])=>{if(31&l||2&o&&32&l){const{get:i,set:r}=Object.getOwnPropertyDescriptor(s,t)||{};i&&(e.t[t][0]|=2048),r&&(e.t[t][0]|=4096),(1&o||!i)&&Object.defineProperty(s,t,{get(){{if(!(2048&e.t[t][0]))return((t,e)=>n(this).l.get(e))(0,t);const o=n(this),l=o?o.i:s;if(!l)return;return l[t]}},configurable:!0,enumerable:!0}),Object.defineProperty(s,t,{set(i){const s=n(this);if(s){if(r)return void 0===(32&l?this[t]:s.$hostElement$[t])&&s.l.get(t)&&(i=s.l.get(t)),r.call(this,A(i,l)),void X(this,t,i=32&l?this[t]:s.$hostElement$[t],e);{if(!(1&o&&4096&e.t[t][0]))return X(this,t,i,e),void(1&o&&!s.i&&s.A.push((()=>{4096&e.t[t][0]&&s.i[t]!==s.l.get(t)&&(s.i[t]=i)})));const n=()=>{const n=s.i[t];!s.l.get(t)&&n&&s.l.set(t,n),s.i[t]=A(i,l),X(this,t,s.i[t],e)};s.i?n():s.A.push((()=>{n()}))}}}})}})),1&o){const o=new Map;s.attributeChangedCallback=function(t,l,i){c.jmp((()=>{var c;const u=o.get(t),a=n(this);if(this.hasOwnProperty(u)&&(i=this[u],delete this[u]),s.hasOwnProperty(u)&&"number"==typeof this[u]&&this[u]==i)return;if(null==u){const n=null==a?void 0:a.u;if(a&&n&&!(8&n)&&i!==l){const o=a.i,s=null==(c=e.R)?void 0:c[t];null==s||s.forEach((e=>{const[[s,r]]=Object.entries(e);null!=o[s]&&(128&n||1&r)&&o[s].call(o,i,l,t)}))}return}const f=r.find((([t])=>t===u));f&&4&f[1][0]&&(i=null!==i&&"false"!==i);const d=Object.getOwnPropertyDescriptor(s,u);i==this[u]||d.get&&!d.set||(this[u]=i)}))},t.observedAttributes=Array.from(new Set([...Object.keys(null!=(i=e.R)?i:{}),...r.filter((([t,e])=>31&e[0])).map((([t,e])=>{const n=e[1]||t;return o.set(n,t),n}))]))}}return t},et=(t,e)=>{K(t,"connectedCallback",void 0,e)},nt=(t,e)=>{K(t,"disconnectedCallback",void 0,e||t)},ot=(t,e={})=>{var o;if(!r.document)return void console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");const u=[],f=e.exclude||[],d=r.customElements,h=r.document.head,p=h.querySelector("meta[charset]"),m=r.document.createElement("style"),v=[];let y,b=!0;if(Object.assign(c,e),c.h=new URL(e.resourcesUrl||"./",r.document.baseURI).href,t.map((t=>{t[1].map((e=>{var o,r,h;const p={u:e[0],p:e[1],t:e[2],H:e[3]};p.t=e[2],p.R=null!=(o=e[4])?o:{},p.U=null!=(r=e[5])?r:{},p.L=null!=(h=e[6])?h:{};const m=p.p,$=class extends HTMLElement{"s-p";"s-rc";hasRegisteredEventListeners=!1;constructor(t){if(super(t),((t,e)=>{const n={u:0,$hostElement$:t,o:e,l:new Map,T:new Map};n.W=new Promise((t=>n.P=t)),t["s-p"]=[],t["s-rc"]=[],n.A=[];const o=n;t.__stencil__getHostRef=()=>o})(t=this,p),1&p.u)if(t.shadowRoot){if("open"!==t.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${p.p}! Mode is set to ${t.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else w.call(t,p)}connectedCallback(){n(this)&&(this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),y&&(clearTimeout(y),y=null),b?v.push(this):c.jmp((()=>(t=>{if(!(1&c.u)){const e=n(t);if(!e)return;const o=e.o,r=()=>{};if(1&e.u)(null==e?void 0:e.i)?et(e.i,t):(null==e?void 0:e.W)&&e.W.then((()=>et(e.i,t)));else{e.u|=1;{let n=t;for(;n=n.parentNode||n.host;)if(n["s-p"]){q(e,e.C=n);break}}o.t&&Object.entries(o.t).map((([e,[n]])=>{if(31&n&&e in t&&t[e]!==Object.prototype[e]){const n=t[e];delete t[e],t[e]=n}})),(async(t,e,n)=>{let o;try{if(!(32&e.u)){if(e.u|=32,n.F){const s=((t,e)=>{const n=t.p.replace(/-/g,"_"),o=t.F;if(!o)return;const s=i.get(o);return s?s[n]:import(`./${o}.entry.js`).then((t=>(i.set(o,t),t[n])),(t=>{l(t,e.$hostElement$)}))
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n,e);if(s&&"then"in s){const t=()=>{};o=await s,t()}else o=s;if(!o)throw Error(`Constructor for "${n.p}#${e.q}" was not found`);o.isProxied||(n.R=o.watchers,n.U=o.serializers,n.L=o.deserializers,tt(o,n,2),o.isProxied=!0);const r=()=>{};e.u|=8;try{new o(e)}catch(e){l(e,t)}e.u&=-9,e.u|=128,r(),et(e.i,t)}else o=t.constructor,customElements.whenDefined(t.localName).then((()=>e.u|=128));if(o&&o.style){let t;"string"==typeof o.style&&(t=o.style);const e=O(n);if(!s.has(e)){const o=()=>{};((t,e,n)=>{let o=s.get(t);a&&n?(o=o||new CSSStyleSheet,"string"==typeof o?o=e:o.replaceSync(e)):o=e,s.set(t,o)})(e,t,!!(1&n.u)),o()}}}const r=e.C,c=()=>V(e,!0);r&&r["s-rc"]?r["s-rc"].push(c):c()}catch(n){l(n,t),e.M&&(e.M(),e.M=void 0),e.P&&e.P(t)}})(t,e,o)}r()}})(this))))}disconnectedCallback(){c.jmp((()=>(async t=>{if(!(1&c.u)){const e=n(t);(null==e?void 0:e.i)?nt(e.i,t):(null==e?void 0:e.W)&&e.W.then((()=>nt(e.i,t)))}S.has(t)&&S.delete(t),t.shadowRoot&&S.has(t.shadowRoot)&&S.delete(t.shadowRoot)})(this))),c.raf((()=>{var t;const e=n(this);if(!e)return;const o=v.findIndex((t=>t===this));o>-1&&v.splice(o,1),(null==(t=null==e?void 0:e.D)?void 0:t.O)instanceof Node&&!e.D.O.isConnected&&delete e.D.O}))}componentOnReady(){var t;return null==(t=n(this))?void 0:t.W}};p.F=t[0],f.includes(m)||d.get(m)||(u.push(m),d.define(m,tt($,p,1)))}))})),u.length>0&&(m.textContent+=u.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",m.innerHTML.length)){m.setAttribute("data-styles","");const t=null!=(o=c.N)?o:g(r.document);null!=t&&m.setAttribute("nonce",t),h.insertBefore(m,p?p.nextSibling:h.firstChild)}b=!1,v.length?v.map((t=>t.connectedCallback())):c.jmp((()=>y=setTimeout(J,30)))},lt=t=>c.N=t;export{E as H,ot as b,N as g,M as h,u as p,o as r,lt as s}