piclaw 0.0.4 → 0.0.6
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.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/dist-D51xeTP2.js +12 -0
- package/.output/public/assets/index-B3x2_en6.css +1 -0
- package/.output/public/assets/index-SfjxJZSD.js +38 -0
- package/.output/public/assets/md4x-CNLJ57xO.wasm +0 -0
- package/.output/public/assets/md4x-CyfQToGJ.js +1 -0
- package/.output/public/assets/wasm-Cm7RZrwg.js +1 -0
- package/.output/public/icon.svg +25 -0
- package/.output/public/index.html +3 -2
- package/.output/public/manifest.json +1 -1
- package/.output/server/_chunks/bun.mjs +49 -0
- package/.output/server/_chunks/commands.mjs +280 -0
- package/.output/server/_chunks/config.mjs +2 -4
- package/.output/server/_chunks/db.mjs +11 -5
- package/.output/server/_chunks/logger.mjs +1 -1
- package/.output/server/_chunks/node.mjs +31 -0
- package/.output/server/_chunks/ntfy.mjs +45 -0
- package/.output/server/_chunks/pi.mjs +33 -1
- package/.output/server/_chunks/renderer-template.mjs +1 -1
- package/.output/server/_chunks/{bootstrap.mjs → server.mjs} +203 -205
- package/.output/server/_chunks/session.mjs +249 -40
- package/.output/server/_chunks/settings.mjs +1 -1
- package/.output/server/_chunks/terminal.mjs +35 -20
- package/.output/server/_chunks/virtual.mjs +129 -0
- package/.output/server/_jid_.delete.mjs +2 -2
- package/.output/server/_jid_.patch.mjs +30 -3
- package/.output/server/_jid_2.delete.mjs +2 -2
- package/.output/server/_libs/@aws-sdk/client-bedrock-runtime+[...].mjs +13148 -13149
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +1 -1
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +2 -2
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +1 -1
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +1 -1
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +1 -1
- package/.output/server/_libs/@google/genai.mjs +2 -2
- package/.output/server/_libs/@mariozechner/pi-agent-core+[...].mjs +40 -74
- package/.output/server/_libs/@mariozechner/pi-coding-agent+[...].mjs +1315 -1210
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +3 -3
- package/.output/server/_libs/_.mjs +3 -2
- package/.output/server/_libs/_100.mjs +3 -0
- package/.output/server/_libs/_101.mjs +2 -0
- package/.output/server/_libs/_102.mjs +3 -0
- package/.output/server/_libs/_103.mjs +2 -0
- package/.output/server/_libs/_16.mjs +2 -5
- package/.output/server/_libs/_17.mjs +2 -3
- package/.output/server/_libs/_18.mjs +2 -3
- package/.output/server/_libs/_19.mjs +2 -4
- package/.output/server/_libs/_2.mjs +2 -3
- package/.output/server/_libs/_20.mjs +2 -2
- package/.output/server/_libs/_21.mjs +2 -0
- package/.output/server/_libs/_22.mjs +2 -0
- package/.output/server/_libs/_23.mjs +2 -0
- package/.output/server/_libs/_24.mjs +2 -0
- package/.output/server/_libs/_25.mjs +2 -0
- package/.output/server/_libs/_26.mjs +2 -0
- package/.output/server/_libs/_27.mjs +2 -0
- package/.output/server/_libs/_28.mjs +2 -0
- package/.output/server/_libs/_29.mjs +2 -0
- package/.output/server/_libs/_30.mjs +2 -0
- package/.output/server/_libs/_31.mjs +2 -0
- package/.output/server/_libs/_32.mjs +2 -0
- package/.output/server/_libs/_33.mjs +2 -0
- package/.output/server/_libs/_34.mjs +2 -0
- package/.output/server/_libs/_35.mjs +2 -0
- package/.output/server/_libs/_36.mjs +2 -0
- package/.output/server/_libs/_37.mjs +2 -0
- package/.output/server/_libs/_38.mjs +2 -0
- package/.output/server/_libs/_39.mjs +2 -0
- package/.output/server/_libs/_40.mjs +2 -0
- package/.output/server/_libs/_41.mjs +2 -0
- package/.output/server/_libs/_42.mjs +2 -0
- package/.output/server/_libs/_43.mjs +2 -0
- package/.output/server/_libs/_44.mjs +2 -0
- package/.output/server/_libs/_45.mjs +2 -0
- package/.output/server/_libs/_46.mjs +2 -0
- package/.output/server/_libs/_47.mjs +2 -0
- package/.output/server/_libs/_48.mjs +2 -0
- package/.output/server/_libs/_49.mjs +2 -0
- package/.output/server/_libs/_50.mjs +2 -0
- package/.output/server/_libs/_51.mjs +2 -0
- package/.output/server/_libs/_52.mjs +2 -0
- package/.output/server/_libs/_53.mjs +2 -0
- package/.output/server/_libs/_54.mjs +2 -0
- package/.output/server/_libs/_55.mjs +2 -0
- package/.output/server/_libs/_56.mjs +2 -0
- package/.output/server/_libs/_57.mjs +2 -0
- package/.output/server/_libs/_58.mjs +2 -0
- package/.output/server/_libs/_59.mjs +2 -0
- package/.output/server/_libs/_60.mjs +2 -0
- package/.output/server/_libs/_61.mjs +2 -0
- package/.output/server/_libs/_62.mjs +2 -0
- package/.output/server/_libs/_63.mjs +2 -0
- package/.output/server/_libs/_64.mjs +2 -0
- package/.output/server/_libs/_65.mjs +2 -0
- package/.output/server/_libs/_66.mjs +2 -0
- package/.output/server/_libs/_67.mjs +2 -0
- package/.output/server/_libs/_68.mjs +2 -0
- package/.output/server/_libs/_69.mjs +2 -0
- package/.output/server/_libs/_70.mjs +2 -0
- package/.output/server/_libs/_71.mjs +2 -0
- package/.output/server/_libs/_72.mjs +2 -0
- package/.output/server/_libs/_73.mjs +2 -0
- package/.output/server/_libs/_74.mjs +2 -0
- package/.output/server/_libs/_75.mjs +2 -0
- package/.output/server/_libs/_76.mjs +2 -0
- package/.output/server/_libs/_77.mjs +2 -0
- package/.output/server/_libs/_78.mjs +2 -0
- package/.output/server/_libs/_79.mjs +2 -0
- package/.output/server/_libs/_80.mjs +2 -0
- package/.output/server/_libs/_81.mjs +2 -0
- package/.output/server/_libs/_82.mjs +2 -0
- package/.output/server/_libs/_83.mjs +2 -0
- package/.output/server/_libs/_84.mjs +2 -0
- package/.output/server/_libs/_85.mjs +2 -0
- package/.output/server/_libs/_86.mjs +2 -0
- package/.output/server/_libs/_87.mjs +2 -0
- package/.output/server/_libs/_88.mjs +2 -0
- package/.output/server/_libs/_89.mjs +2 -0
- package/.output/server/_libs/_90.mjs +2 -0
- package/.output/server/_libs/_91.mjs +2 -0
- package/.output/server/_libs/_92.mjs +2 -0
- package/.output/server/_libs/_93.mjs +2 -0
- package/.output/server/_libs/_94.mjs +2 -0
- package/.output/server/_libs/_95.mjs +2 -0
- package/.output/server/_libs/_96.mjs +2 -0
- package/.output/server/_libs/_97.mjs +2 -0
- package/.output/server/_libs/_98.mjs +2 -0
- package/.output/server/_libs/_99.mjs +5 -0
- package/.output/server/_libs/amdefine.mjs +188 -0
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +1 -1
- package/.output/server/_libs/compressjs.mjs +50 -0
- package/.output/server/_libs/diff.mjs +137 -0
- package/.output/server/_libs/get-uri.mjs +1 -1
- package/.output/server/_libs/http-proxy-agent.mjs +1 -1
- package/.output/server/_libs/https-proxy-agent.mjs +1 -1
- package/.output/server/_libs/just-bash+[...].mjs +80359 -0
- package/.output/server/_libs/md4x.mjs +73 -0
- package/.output/server/_libs/mixmark-io__domino.mjs +14801 -0
- package/.output/server/_libs/node-fetch.mjs +1 -1
- package/.output/server/_libs/node-liblzma.mjs +1107 -0
- package/.output/server/_libs/pac-proxy-agent+[...].mjs +1 -1
- package/.output/server/_libs/proxy-agent+proxy-from-env.mjs +1 -1
- package/.output/server/_libs/smithy__core.mjs +1 -1
- package/.output/server/_routes/api/files/delete.mjs +2 -2
- package/.output/server/_routes/api/files/groups.mjs +14 -0
- package/.output/server/_routes/api/files/raw.mjs +1 -1
- package/.output/server/_routes/api/files/read.mjs +1 -1
- package/.output/server/_routes/api/files/watch.mjs +1 -1
- package/.output/server/_routes/api/files/write.mjs +3 -2
- package/.output/server/_routes/api/files.mjs +1 -1
- package/.output/server/_routes/api/groups.mjs +2 -2
- package/.output/server/_routes/api/groups2.mjs +3 -2
- package/.output/server/_routes/api/health.mjs +2 -2
- package/.output/server/_routes/api/logs.mjs +4 -2
- package/.output/server/_routes/api/ntfy/setup.mjs +54 -0
- package/.output/server/_routes/api/ntfy/status.mjs +12 -0
- package/.output/server/_routes/api/pi/apikey.mjs +1 -1
- package/.output/server/_routes/api/pi/apikey_providers.mjs +1 -1
- package/.output/server/_routes/api/pi/commands.mjs +6 -0
- package/.output/server/_routes/api/pi/login/events.mjs +1 -1
- package/.output/server/_routes/api/pi/login/respond.mjs +1 -1
- package/.output/server/_routes/api/pi/login.mjs +1 -1
- package/.output/server/_routes/api/pi/logout.mjs +1 -1
- package/.output/server/_routes/api/pi/models.mjs +1 -1
- package/.output/server/_routes/api/pi/status.mjs +1 -1
- package/.output/server/_routes/api/send.mjs +22 -3
- package/.output/server/_routes/api/status.mjs +9 -7
- package/.output/server/_routes/api/tasks2.mjs +2 -2
- package/.output/server/_routes/api/telegram/setup.mjs +2 -2
- package/.output/server/_routes/api/telegram/status.mjs +2 -2
- package/.output/server/_routes/api/terminal2.mjs +3 -2
- package/.output/server/_utils.mjs +12 -4
- package/.output/server/build/md4x.wasm +0 -0
- package/.output/server/index.mjs +223 -149
- package/.output/server/node_modules/@mongodb-js/zstd/lib/index.js +55 -0
- package/.output/server/node_modules/@mongodb-js/zstd/package.json +51 -0
- package/.output/server/package.json +1 -0
- package/README.md +118 -24
- package/bin/piclaw.mjs +39 -1
- package/package.json +16 -13
- package/.output/public/assets/client-TIs-Ghqj.js +0 -9
- package/.output/public/assets/dist-BVjfG3ok.js +0 -12
- package/.output/public/assets/dist-DJh8l6yS.js +0 -1
- package/.output/public/assets/index-BNNEMkNV.js +0 -39
- package/.output/public/assets/index-CdWBxO5V.css +0 -1
- package/.output/public/assets/react-DFP7nCmh.js +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DJh8l6yS.js","assets/react-DFP7nCmh.js","assets/client-TIs-Ghqj.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function l(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var u={},d=[],f=()=>{},p=()=>!1,m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),h=e=>e.startsWith(`onUpdate:`),g=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},v=Object.prototype.hasOwnProperty,y=(e,t)=>v.call(e,t),b=Array.isArray,x=e=>te(e)===`[object Map]`,S=e=>te(e)===`[object Set]`,C=e=>te(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,E=e=>typeof e==`symbol`,D=e=>typeof e==`object`&&!!e,ee=e=>(D(e)||w(e))&&w(e.then)&&w(e.catch),O=Object.prototype.toString,te=e=>O.call(e),ne=e=>te(e).slice(8,-1),k=e=>te(e)===`[object Object]`,A=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,re=l(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),j=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ie=/-\w/g,ae=j(e=>e.replace(ie,e=>e.slice(1).toUpperCase())),oe=/\B([A-Z])/g,se=j(e=>e.replace(oe,`-$1`).toLowerCase()),ce=j(e=>e.charAt(0).toUpperCase()+e.slice(1)),le=j(e=>e?`on${ce(e)}`:``),ue=(e,t)=>!Object.is(e,t),de=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},fe=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},pe=e=>{let t=parseFloat(e);return isNaN(t)?e:t},me=e=>{let t=T(e)?Number(e):NaN;return isNaN(t)?e:t},he,ge=()=>he||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function _e(e){if(b(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?xe(r):_e(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(T(e)||D(e))return e}var ve=/;(?![^(]*\))/g,ye=/:([^]+)/,be=/\/\*[^]*?\*\//g;function xe(e){let t={};return e.replace(be,``).split(ve).forEach(e=>{if(e){let n=e.split(ye);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function M(e){let t=``;if(T(e))t=e;else if(b(e))for(let n=0;n<e.length;n++){let r=M(e[n]);r&&(t+=r+` `)}else if(D(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Se=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Ce=l(Se);l(Se+`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);function we(e){return!!e||e===``}function Te(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ee(e[r],t[r]);return n}function Ee(e,t){if(e===t)return!0;let n=C(e),r=C(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=E(e),r=E(t),n||r)return e===t;if(n=b(e),r=b(t),n||r)return n&&r?Te(e,t):!1;if(n=D(e),r=D(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!Ee(e[n],t[n]))return!1}}return String(e)===String(t)}function De(e,t){return e.findIndex(e=>Ee(e,t))}var Oe=e=>!!(e&&e.__v_isRef===!0),N=e=>T(e)?e:e==null?``:b(e)||D(e)&&(e.toString===O||!w(e.toString))?Oe(e)?N(e.value):JSON.stringify(e,ke,2):String(e),ke=(e,t)=>Oe(t)?ke(e,t.value):x(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ae(t,r)+` =>`]=n,e),{})}:S(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ae(e))}:E(t)?Ae(t):D(t)&&!b(t)&&!k(t)?String(t):t,Ae=(e,t=``)=>E(e)?`Symbol(${e.description??t})`:e,je,Me=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=je,!e&&je&&(this.index=(je.scopes||=[]).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){let t=je;try{return je=this,e()}finally{je=t}}}on(){++this._on===1&&(this.prevScope=je,je=this)}off(){this._on>0&&--this._on===0&&(je=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Ne(){return je}function Pe(e,t=!1){je&&je.cleanups.push(e)}var Fe,Ie=new WeakSet,Le=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,je&&je.active&&je.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ie.has(this)&&(Ie.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ve(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,et(this),We(this);let e=Fe,t=Xe;Fe=this,Xe=!0;try{return this.fn()}finally{Ge(this),Fe=e,Xe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Je(e);this.deps=this.depsTail=void 0,et(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ie.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ke(this)&&this.run()}get dirty(){return Ke(this)}},Re=0,ze,Be;function Ve(e,t=!1){if(e.flags|=8,t){e.next=Be,Be=e;return}e.next=ze,ze=e}function He(){Re++}function Ue(){if(--Re>0)return;if(Be){let e=Be;for(Be=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;ze;){let t=ze;for(ze=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function We(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ge(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Je(r),Ye(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ke(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(qe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function qe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===tt)||(e.globalVersion=tt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ke(e))))return;e.flags|=2;let t=e.dep,n=Fe,r=Xe;Fe=e,Xe=!0;try{We(e);let n=e.fn(e._value);(t.version===0||ue(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Fe=n,Xe=r,Ge(e),e.flags&=-3}}function Je(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Je(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ye(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Xe=!0,Ze=[];function Qe(){Ze.push(Xe),Xe=!1}function $e(){let e=Ze.pop();Xe=e===void 0?!0:e}function et(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Fe;Fe=void 0;try{t()}finally{Fe=e}}}var tt=0,nt=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},rt=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Fe||!Xe||Fe===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Fe)t=this.activeLink=new nt(Fe,this),Fe.deps?(t.prevDep=Fe.depsTail,Fe.depsTail.nextDep=t,Fe.depsTail=t):Fe.deps=Fe.depsTail=t,it(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Fe.depsTail,t.nextDep=void 0,Fe.depsTail.nextDep=t,Fe.depsTail=t,Fe.deps===t&&(Fe.deps=e)}return t}trigger(e){this.version++,tt++,this.notify(e)}notify(e){He();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ue()}}};function it(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)it(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var at=new WeakMap,ot=Symbol(``),st=Symbol(``),ct=Symbol(``);function lt(e,t,n){if(Xe&&Fe){let t=at.get(e);t||at.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new rt),r.map=t,r.key=n),r.track()}}function ut(e,t,n,r,i,a){let o=at.get(e);if(!o){tt++;return}let s=e=>{e&&e.trigger()};if(He(),t===`clear`)o.forEach(s);else{let i=b(e),a=i&&A(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ct||!E(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ct)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(ot)),x(e)&&s(o.get(st)));break;case`delete`:i||(s(o.get(ot)),x(e)&&s(o.get(st)));break;case`set`:x(e)&&s(o.get(ot));break}}Ue()}function dt(e,t){let n=at.get(e);return n&&n.get(t)}function ft(e){let t=P(e);return t===e?t:(lt(t,`iterate`,ct),Qt(e)?t:t.map(tn))}function pt(e){return lt(e=P(e),`iterate`,ct),e}function mt(e,t){return Zt(e)?Xt(e)?nn(tn(t)):nn(t):tn(t)}var ht={__proto__:null,[Symbol.iterator](){return gt(this,Symbol.iterator,e=>mt(this,e))},concat(...e){return ft(this).concat(...e.map(e=>b(e)?ft(e):e))},entries(){return gt(this,`entries`,e=>(e[1]=mt(this,e[1]),e))},every(e,t){return vt(this,`every`,e,t,void 0,arguments)},filter(e,t){return vt(this,`filter`,e,t,e=>e.map(e=>mt(this,e)),arguments)},find(e,t){return vt(this,`find`,e,t,e=>mt(this,e),arguments)},findIndex(e,t){return vt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return vt(this,`findLast`,e,t,e=>mt(this,e),arguments)},findLastIndex(e,t){return vt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return vt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return bt(this,`includes`,e)},indexOf(...e){return bt(this,`indexOf`,e)},join(e){return ft(this).join(e)},lastIndexOf(...e){return bt(this,`lastIndexOf`,e)},map(e,t){return vt(this,`map`,e,t,void 0,arguments)},pop(){return xt(this,`pop`)},push(...e){return xt(this,`push`,e)},reduce(e,...t){return yt(this,`reduce`,e,t)},reduceRight(e,...t){return yt(this,`reduceRight`,e,t)},shift(){return xt(this,`shift`)},some(e,t){return vt(this,`some`,e,t,void 0,arguments)},splice(...e){return xt(this,`splice`,e)},toReversed(){return ft(this).toReversed()},toSorted(e){return ft(this).toSorted(e)},toSpliced(...e){return ft(this).toSpliced(...e)},unshift(...e){return xt(this,`unshift`,e)},values(){return gt(this,`values`,e=>mt(this,e))}};function gt(e,t,n){let r=pt(e),i=r[t]();return r!==e&&!Qt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var _t=Array.prototype;function vt(e,t,n,r,i,a){let o=pt(e),s=o!==e&&!Qt(e),c=o[t];if(c!==_t[t]){let t=c.apply(e,a);return s?tn(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,mt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function yt(e,t,n,r){let i=pt(e),a=n;return i!==e&&(Qt(e)?n.length>3&&(a=function(t,r,i){return n.call(this,t,r,i,e)}):a=function(t,r,i){return n.call(this,t,mt(e,r),i,e)}),i[t](a,...r)}function bt(e,t,n){let r=P(e);lt(r,`iterate`,ct);let i=r[t](...n);return(i===-1||i===!1)&&$t(n[0])?(n[0]=P(n[0]),r[t](...n)):i}function xt(e,t,n=[]){Qe(),He();let r=P(e)[t].apply(e,n);return Ue(),$e(),r}var St=l(`__proto__,__v_isRef,__isVue`),Ct=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(E));function wt(e){E(e)||(e=String(e));let t=P(this);return lt(t,`has`,e),t.hasOwnProperty(e)}var Tt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Ut:Ht:i?Vt:Bt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=b(e);if(!r){let e;if(a&&(e=ht[t]))return e;if(t===`hasOwnProperty`)return wt}let o=Reflect.get(e,t,rn(e)?e:n);if((E(t)?Ct.has(t):St(t))||(r||lt(e,`get`,t),i))return o;if(rn(o)){let e=a&&A(t)?o:o.value;return r&&D(e)?Jt(e):e}return D(o)?r?Jt(o):Kt(o):o}},Et=class extends Tt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=b(e)&&A(t);if(!this._isShallow){let e=Zt(i);if(!Qt(n)&&!Zt(n)&&(i=P(i),n=P(n)),!a&&rn(i)&&!rn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:y(e,t),s=Reflect.set(e,t,n,rn(e)?e:r);return e===P(r)&&(o?ue(n,i)&&ut(e,`set`,t,n,i):ut(e,`add`,t,n)),s}deleteProperty(e,t){let n=y(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ut(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!E(t)||!Ct.has(t))&<(e,`has`,t),n}ownKeys(e){return lt(e,`iterate`,b(e)?`length`:ot),Reflect.ownKeys(e)}},Dt=class extends Tt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Ot=new Et,kt=new Dt,At=new Et(!0),jt=e=>e,Mt=e=>Reflect.getPrototypeOf(e);function Nt(e,t,n){return function(...r){let i=this.__v_raw,a=P(i),o=x(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?jt:t?nn:tn;return!t&<(a,`iterate`,c?st:ot),g(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Pt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ft(e,t){let n={get(n){let r=this.__v_raw,i=P(r),a=P(n);e||(ue(n,a)&<(i,`get`,n),lt(i,`get`,a));let{has:o}=Mt(i),s=t?jt:e?nn:tn;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&<(P(t),`iterate`,ot),t.size},has(t){let n=this.__v_raw,r=P(n),i=P(t);return e||(ue(t,i)&<(r,`has`,t),lt(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=P(a),s=t?jt:e?nn:tn;return!e&<(o,`iterate`,ot),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return g(n,e?{add:Pt(`add`),set:Pt(`set`),delete:Pt(`delete`),clear:Pt(`clear`)}:{add(e){!t&&!Qt(e)&&!Zt(e)&&(e=P(e));let n=P(this);return Mt(n).has.call(n,e)||(n.add(e),ut(n,`add`,e,e)),this},set(e,n){!t&&!Qt(n)&&!Zt(n)&&(n=P(n));let r=P(this),{has:i,get:a}=Mt(r),o=i.call(r,e);o||=(e=P(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?ue(n,s)&&ut(r,`set`,e,n,s):ut(r,`add`,e,n),this},delete(e){let t=P(this),{has:n,get:r}=Mt(t),i=n.call(t,e);i||=(e=P(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ut(t,`delete`,e,void 0,a),o},clear(){let e=P(this),t=e.size!==0,n=e.clear();return t&&ut(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Nt(r,e,t)}),n}function It(e,t){let n=Ft(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(y(n,r)&&r in t?n:t,r,i)}var Lt={get:It(!1,!1)},Rt={get:It(!1,!0)},zt={get:It(!0,!1)},Bt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,Ut=new WeakMap;function Wt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Gt(e){return e.__v_skip||!Object.isExtensible(e)?0:Wt(ne(e))}function Kt(e){return Zt(e)?e:Yt(e,!1,Ot,Lt,Bt)}function qt(e){return Yt(e,!1,At,Rt,Vt)}function Jt(e){return Yt(e,!0,kt,zt,Ht)}function Yt(e,t,n,r,i){if(!D(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;let a=Gt(e);if(a===0)return e;let o=i.get(e);if(o)return o;let s=new Proxy(e,a===2?r:n);return i.set(e,s),s}function Xt(e){return Zt(e)?Xt(e.__v_raw):!!(e&&e.__v_isReactive)}function Zt(e){return!!(e&&e.__v_isReadonly)}function Qt(e){return!!(e&&e.__v_isShallow)}function $t(e){return e?!!e.__v_raw:!1}function P(e){let t=e&&e.__v_raw;return t?P(t):e}function en(e){return!y(e,`__v_skip`)&&Object.isExtensible(e)&&fe(e,`__v_skip`,!0),e}var tn=e=>D(e)?Kt(e):e,nn=e=>D(e)?Jt(e):e;function rn(e){return e?e.__v_isRef===!0:!1}function F(e){return on(e,!1)}function an(e){return on(e,!0)}function on(e,t){return rn(e)?e:new sn(e,t)}var sn=class{constructor(e,t){this.dep=new rt,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:P(e),this._value=t?e:tn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Qt(e)||Zt(e);e=n?e:P(e),ue(e,t)&&(this._rawValue=e,this._value=n?e:tn(e),this.dep.trigger())}};function I(e){return rn(e)?e.value:e}var cn={get:(e,t,n)=>t===`__v_raw`?e:I(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return rn(i)&&!rn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function ln(e){return Xt(e)?e:new Proxy(e,cn)}var un=class{constructor(e,t,n){this._object=e,this._key=t,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._raw=P(e);let r=!0,i=e;if(!b(e)||!A(String(t)))do r=!$t(i)||Qt(i);while(r&&(i=i.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=I(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&rn(this._raw[this._key])){let t=this._object[this._key];if(rn(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return dt(this._raw,this._key)}},dn=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}};function fn(e,t,n){return rn(e)?e:w(e)?new dn(e):D(e)&&arguments.length>1?pn(e,t,n):F(e)}function pn(e,t,n){return new un(e,t,n)}var mn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new rt(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=tt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Fe!==this)return Ve(this,!0),!0}get value(){let e=this.dep.track();return qe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function hn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new mn(r,i,n)}var gn={},_n=new WeakMap,vn=void 0;function yn(e,t=!1,n=vn){if(n){let t=_n.get(n);t||_n.set(n,t=[]),t.push(e)}}function bn(e,t,n=u){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Qt(e)||i===!1||i===0?xn(e,1):xn(e),d,p,m,h,g=!1,v=!1;if(rn(e)?(p=()=>e.value,g=Qt(e)):Xt(e)?(p=()=>l(e),g=!0):b(e)?(v=!0,g=e.some(e=>Xt(e)||Qt(e)),p=()=>e.map(e=>{if(rn(e))return e.value;if(Xt(e))return l(e);if(w(e))return c?c(e,2):e()})):p=w(e)?t?c?()=>c(e,2):e:()=>{if(m){Qe();try{m()}finally{$e()}}let t=vn;vn=d;try{return c?c(e,3,[h]):e(h)}finally{vn=t}}:f,t&&i){let e=p,t=i===!0?1/0:i;p=()=>xn(e(),t)}let y=Ne(),x=()=>{d.stop(),y&&y.active&&_(y.effects,d)};if(a&&t){let e=t;t=(...t)=>{e(...t),x()}}let S=v?Array(e.length).fill(gn):gn,C=e=>{if(!(!(d.flags&1)||!d.dirty&&!e))if(t){let e=d.run();if(i||g||(v?e.some((e,t)=>ue(e,S[t])):ue(e,S))){m&&m();let n=vn;vn=d;try{let n=[e,S===gn?void 0:v&&S[0]===gn?[]:S,h];S=e,c?c(t,3,n):t(...n)}finally{vn=n}}}else d.run()};return s&&s(C),d=new Le(p),d.scheduler=o?()=>o(C,!1):C,h=e=>yn(e,!1,d),m=d.onStop=()=>{let e=_n.get(d);if(e){if(c)c(e,4);else for(let t of e)t();_n.delete(d)}},t?r?C(!0):S=d.run():o?o(C.bind(null,!0),!0):d.run(),x.pause=d.pause.bind(d),x.resume=d.resume.bind(d),x.stop=x,x}function xn(e,t=1/0,n){if(t<=0||!D(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,rn(e))xn(e.value,t,n);else if(b(e))for(let r=0;r<e.length;r++)xn(e[r],t,n);else if(S(e)||x(e))e.forEach(e=>{xn(e,t,n)});else if(k(e)){for(let r in e)xn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&xn(e[r],t,n)}return e}function Sn(e,t,n,r){try{return r?e(...r):e()}catch(e){wn(e,t,n)}}function Cn(e,t,n,r){if(w(e)){let i=Sn(e,t,n,r);return i&&ee(i)&&i.catch(e=>{wn(e,t,n)}),i}if(b(e)){let i=[];for(let a=0;a<e.length;a++)i.push(Cn(e[a],t,n,r));return i}}function wn(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||u;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){Qe(),Sn(a,null,10,[e,i,o]),$e();return}}Tn(e,n,i,r,o)}function Tn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var En=[],Dn=-1,On=[],kn=null,An=0,jn=Promise.resolve(),Mn=null;function Nn(e){let t=Mn||jn;return e?t.then(this?e.bind(this):e):t}function Pn(e){let t=Dn+1,n=En.length;for(;t<n;){let r=t+n>>>1,i=En[r],a=Bn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Fn(e){if(!(e.flags&1)){let t=Bn(e),n=En[En.length-1];!n||!(e.flags&2)&&t>=Bn(n)?En.push(e):En.splice(Pn(t),0,e),e.flags|=1,In()}}function In(){Mn||=jn.then(Vn)}function Ln(e){b(e)?On.push(...e):kn&&e.id===-1?kn.splice(An+1,0,e):e.flags&1||(On.push(e),e.flags|=1),In()}function Rn(e,t,n=Dn+1){for(;n<En.length;n++){let t=En[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;En.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function zn(e){if(On.length){let e=[...new Set(On)].sort((e,t)=>Bn(e)-Bn(t));if(On.length=0,kn){kn.push(...e);return}for(kn=e,An=0;An<kn.length;An++){let e=kn[An];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}kn=null,An=0}}var Bn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Vn(e){try{for(Dn=0;Dn<En.length;Dn++){let e=En[Dn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Sn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Dn<En.length;Dn++){let e=En[Dn];e&&(e.flags&=-2)}Dn=-1,En.length=0,zn(e),Mn=null,(En.length||On.length)&&Vn(e)}}var Hn=null,Un=null;function Wn(e){let t=Hn;return Hn=e,Un=e&&e.type.__scopeId||null,t}function Gn(e,t=Hn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Oa(-1);let i=Wn(t),a;try{a=e(...n)}finally{Wn(i),r._d&&Oa(1)}return a};return r._n=!0,r._c=!0,r._d=!0,r}function Kn(e,t){if(Hn===null)return e;let n=lo(Hn),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=u]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&xn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function qn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(Qe(),Cn(c,n,8,[e.el,s,e,t]),$e())}}function Jn(e,t){if(qa){let n=qa.provides,r=qa.parent&&qa.parent.provides;r===n&&(n=qa.provides=Object.create(r)),n[e]=t}}function Yn(e,t,n=!1){let r=Ja();if(r||ji){let i=ji?ji._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var Xn=Symbol.for(`v-scx`),Zn=()=>Yn(Xn);function L(e,t,n){return Qn(e,t,n)}function Qn(e,t,n=u){let{immediate:r,deep:i,flush:a,once:o}=n,s=g({},n),c=t&&r||!t&&a!==`post`,l;if(eo){if(a===`sync`){let e=Zn();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=f,e.resume=f,e.pause=f,e}}let d=qa;s.call=(e,t,n)=>Cn(e,d,t,n);let p=!1;a===`post`?s.scheduler=e=>{ca(e,d&&d.suspense)}:a!==`sync`&&(p=!0,s.scheduler=(e,t)=>{t?e():Fn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),p&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=bn(e,t,s);return eo&&(l?l.push(m):c&&m()),m}function $n(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?er(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=Za(this),s=Qn(i,a.bind(r),n);return o(),s}function er(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var tr=Symbol(`_vte`),nr=e=>e.__isTeleport,rr=e=>e&&(e.disabled||e.disabled===``),ir=e=>e&&(e.defer||e.defer===``),ar=e=>typeof SVGElement<`u`&&e instanceof SVGElement,or=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,sr=(e,t)=>{let n=e&&e.to;return T(n)?t?t(n):null:n},cr={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g}}=l,_=rr(t.props),{shapeFlag:v,children:y,dynamicChildren:b}=t;if(e==null){let e=t.el=h(``),l=t.anchor=h(``);p(e,n,r),p(l,n,r);let d=(e,t)=>{v&16&&u(y,e,t,i,a,o,s,c)},f=()=>{let e=t.target=sr(t.props,m),n=pr(e,t,h,p);e&&(o!==`svg`&&ar(e)?o=`svg`:o!==`mathml`&&or(e)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(e),_||(d(e,n),fr(t,!1)))};_&&(d(n,l),fr(t,!0)),ir(t.props)?(t.el.__isMounted=!1,ca(()=>{f(),delete t.el.__isMounted},a)):f()}else{if(ir(t.props)&&e.el.__isMounted===!1){ca(()=>{cr.process(e,t,n,r,i,a,o,s,c,l)},a);return}t.el=e.el,t.targetStart=e.targetStart;let u=t.anchor=e.anchor,p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=rr(e.props),v=g?n:p,y=g?u:h;if(o===`svg`||ar(p)?o=`svg`:(o===`mathml`||or(p))&&(o=`mathml`),b?(f(e.dynamicChildren,b,v,i,a,o,s),ma(e,t,!0)):c||d(e,t,v,y,i,a,o,s,!1),_)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):lr(t,n,u,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=t.target=sr(t.props,m);e&&lr(t,e,null,l,0)}else g&&lr(t,p,h,l,1);fr(t,_)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e;if(d&&(i(l),i(u)),a&&i(c),o&16){let e=a||!rr(f);for(let i=0;i<s.length;i++){let a=s[i];r(a,t,n,e,!!a.dynamicChildren)}}},move:lr,hydrate:ur};function lr(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),(!d||rr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function ur(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;for(;r;){if(r&&r.nodeType===8){if(r.data===`teleport start anchor`)t.targetStart=r;else if(r.data===`teleport anchor`){t.targetAnchor=r,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=sr(t.props,c),h=rr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||pr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||pr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),fr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var dr=cr;function fr(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function pr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[tr]=o,e&&(r(a,e,i),r(o,e,i)),o}var mr=Symbol(`_leaveCb`),hr=Symbol(`_enterCb`);function gr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Wr(()=>{e.isMounted=!0}),qr(()=>{e.isUnmounting=!0}),e}var _r=[Function,Array],vr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:_r,onEnter:_r,onAfterEnter:_r,onEnterCancelled:_r,onBeforeLeave:_r,onLeave:_r,onAfterLeave:_r,onLeaveCancelled:_r,onBeforeAppear:_r,onAppear:_r,onAfterAppear:_r,onAppearCancelled:_r},yr=e=>{let t=e.subTree;return t.component?yr(t.component):t},br={name:`BaseTransition`,props:vr,setup(e,{slots:t}){let n=Ja(),r=gr();return()=>{let i=t.default&&Or(t.default(),!0);if(!i||!i.length)return;let a=xr(i),o=P(e),{mode:s}=o;if(r.isLeaving)return Tr(a);let c=Er(a);if(!c)return Tr(a);let l=wr(c,o,r,n,e=>l=e);c.type!==Sa&&Dr(c,l);let u=n.subTree&&Er(n.subTree);if(u&&u.type!==Sa&&!Ma(u,c)&&yr(n).type!==Sa){let e=wr(u,o,r,n);if(Dr(u,e),s===`out-in`&&c.type!==Sa)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Tr(a);s===`in-out`&&c.type!==Sa?e.delayLeave=(e,t,n)=>{let i=Cr(r,u);i[String(u.key)]=u,e[mr]=()=>{t(),e[mr]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function xr(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Sa){t=n;break}}return t}var Sr=br;function Cr(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function wr(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:p,onAfterLeave:m,onLeaveCancelled:h,onBeforeAppear:g,onAppear:_,onAfterAppear:v,onAppearCancelled:y}=t,x=String(e.key),S=Cr(n,e),C=(e,t)=>{e&&Cn(e,r,9,t)},w=(e,t)=>{let n=t[1];C(e,t),b(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},T={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted)if(a)r=g||c;else return;t[mr]&&t[mr](!0);let i=S[x];i&&Ma(e,i)&&i.el[mr]&&i.el[mr](),C(r,[t])},enter(t){if(S[x]===e)return;let r=l,i=u,o=d;if(!n.isMounted)if(a)r=_||l,i=v||u,o=y||d;else return;let s=!1;t[hr]=e=>{s||(s=!0,C(e?o:i,[t]),T.delayedLeave&&T.delayedLeave(),t[hr]=void 0)};let c=t[hr].bind(null,!1);r?w(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[hr]&&t[hr](!0),n.isUnmounting)return r();C(f,[t]);let a=!1;t[mr]=n=>{a||(a=!0,r(),C(n?h:m,[t]),t[mr]=void 0,S[i]===e&&delete S[i])};let o=t[mr].bind(null,!1);S[i]=e,p?w(p,[t,o]):o()},clone(e){let a=wr(e,t,n,r,i);return i&&i(a),a}};return T}function Tr(e){if(Ir(e))return e=La(e),e.children=null,e}function Er(e){if(!Ir(e))return nr(e.type)&&e.children?xr(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&w(n.default))return n.default()}}function Dr(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Dr(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Or(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===R?(o.patchFlag&128&&i++,r=r.concat(Or(o.children,t,s))):(t||o.type!==Sa)&&r.push(s==null?o:La(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function kr(e,t){return w(e)?g({name:e.name},t,{setup:e}):e}function Ar(e){e.ids=[e.ids[0]+ e.ids[2]+++`-`,0,0]}function jr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var Mr=new WeakMap;function Nr(e,t,n,r,i=!1){if(b(e)){e.forEach((e,a)=>Nr(e,t&&(b(t)?t[a]:t),n,r,i));return}if(Fr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Nr(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?lo(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,d=s.refs===u?s.refs={}:s.refs,f=s.setupState,m=P(f),h=f===u?p:e=>jr(d,e)?!1:y(m,e),g=(e,t)=>!(t&&jr(d,t));if(l!=null&&l!==c){if(Pr(t),T(l))d[l]=null,h(l)&&(f[l]=null);else if(rn(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(d[e.k]=null)}}if(w(c))Sn(c,s,12,[o,d]);else{let t=T(c),r=rn(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:d[c]:g(c)||!e.k?c.value:d[e.k];if(i)b(n)&&_(n,a);else if(b(n))n.includes(a)||n.push(a);else if(t)d[c]=[a],h(c)&&(f[c]=d[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(d[e.k]=t)}}else t?(d[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(d[e.k]=o))};if(o){let t=()=>{s(),Mr.delete(e)};t.id=-1,Mr.set(e,t),ca(t,n)}else Pr(e),s()}}}function Pr(e){let t=Mr.get(e);t&&(t.flags|=8,Mr.delete(e))}ge().requestIdleCallback,ge().cancelIdleCallback;var Fr=e=>!!e.type.__asyncLoader,Ir=e=>e.type.__isKeepAlive;function Lr(e,t){zr(e,`a`,t)}function Rr(e,t){zr(e,`da`,t)}function zr(e,t,n=qa){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Vr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Ir(e.parent.vnode)&&Br(r,t,n,e),e=e.parent}}function Br(e,t,n,r){let i=Vr(t,e,r,!0);Jr(()=>{_(r[t],i)},n)}function Vr(e,t,n=qa,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{Qe();let i=Za(n),a=Cn(t,n,e,r);return i(),$e(),a};return r?i.unshift(a):i.push(a),a}}var Hr=e=>(t,n=qa)=>{(!eo||e===`sp`)&&Vr(e,(...e)=>t(...e),n)},Ur=Hr(`bm`),Wr=Hr(`m`),Gr=Hr(`bu`),Kr=Hr(`u`),qr=Hr(`bum`),Jr=Hr(`um`),Yr=Hr(`sp`),Xr=Hr(`rtg`),Zr=Hr(`rtc`);function Qr(e,t=qa){Vr(`ec`,e,t)}var $r=`components`;function ei(e,t){return ri($r,e,!0,t)||e}var ti=Symbol.for(`v-ndc`);function ni(e){return T(e)?ri($r,e,!1)||e:e||ti}function ri(e,t,n=!0,r=!1){let i=Hn||qa;if(i){let n=i.type;if(e===$r){let e=uo(n,!1);if(e&&(e===t||e===ae(t)||e===ce(ae(t))))return n}let a=ii(i[e]||n[e],t)||ii(i.appContext[e],t);return!a&&r?n:a}}function ii(e,t){return e&&(e[t]||e[ae(t)]||e[ce(ae(t))])}function ai(e,t,n,r){let i,a=n&&n[r],o=b(e);if(o||T(e)){let n=o&&Xt(e),r=!1,s=!1;n&&(r=!Qt(e),s=Zt(e),e=pt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?nn(tn(e[n])):tn(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(D(e))if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}else i=[];return n&&(n[r]=i),i}function oi(e,t,n={},r,i){if(Hn.ce||Hn.parent&&Fr(Hn.parent)&&Hn.parent.ce){let e=Object.keys(n).length>0;return t!==`default`&&(n.name=t),z(),Aa(R,null,[H(`slot`,n,r&&r())],e?-2:64)}let a=e[t];a&&a._c&&(a._d=!1),z();let o=a&&si(a(n)),s=n.key||o&&o.key,c=Aa(R,{key:(s&&!E(s)?s:`_${t}`)+(!o&&r?`_fb`:``)},o||(r?r():[]),o&&e._===1?64:-2);return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),a&&a._c&&(a._d=!0),c}function si(e){return e.some(e=>ja(e)?!(e.type===Sa||e.type===R&&!si(e.children)):!0)?e:null}var ci=e=>e?$a(e)?lo(e):ci(e.parent):null,li=g(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ci(e.parent),$root:e=>ci(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>vi(e),$forceUpdate:e=>e.f||=()=>{Fn(e.update)},$nextTick:e=>e.n||=Nn.bind(e.proxy),$watch:e=>$n.bind(e)}),ui=(e,t)=>e!==u&&!e.__isScriptSetup&&y(e,t),di={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(ui(r,t))return o[t]=1,r[t];else if(i!==u&&y(i,t))return o[t]=2,i[t];else if(y(a,t))return o[t]=3,a[t];else if(n!==u&&y(n,t))return o[t]=4,n[t];else pi&&(o[t]=0)}let l=li[t],d,f;if(l)return t===`$attrs`&<(e.attrs,`get`,``),l(e);if((d=s.__cssModules)&&(d=d[t]))return d;if(n!==u&&y(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,y(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return ui(i,t)?(i[t]=n,!0):r!==u&&y(r,t)?(r[t]=n,!0):y(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==u&&s[0]!==`$`&&y(e,s)||ui(t,s)||y(a,s)||y(r,s)||y(li,s)||y(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?y(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function fi(e){return b(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var pi=!0;function mi(e){let t=vi(e),n=e.proxy,r=e.ctx;pi=!1,t.beforeCreate&&gi(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:p,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:x,unmounted:S,render:C,renderTracked:T,renderTriggered:E,errorCaptured:ee,serverPrefetch:O,expose:te,inheritAttrs:ne,components:k,directives:A,filters:re}=t;if(l&&hi(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);D(t)&&(e.data=Kt(t))}if(pi=!0,a)for(let e in a){let t=a[e],i=G({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):f,set:!w(t)&&w(t.set)?t.set.bind(n):f});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)_i(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Jn(t,e[t])})}u&&gi(u,e,`c`);function j(e,t){b(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(j(Ur,d),j(Wr,p),j(Gr,m),j(Kr,h),j(Lr,g),j(Rr,_),j(Qr,ee),j(Zr,T),j(Xr,E),j(qr,y),j(Jr,S),j(Yr,O),b(te))if(te.length){let t=e.exposed||={};te.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};C&&e.render===f&&(e.render=C),ne!=null&&(e.inheritAttrs=ne),k&&(e.components=k),A&&(e.directives=A),O&&Ar(e)}function hi(e,t,n=f){b(e)&&(e=Ci(e));for(let n in e){let r=e[n],i;i=D(r)?`default`in r?Yn(r.from||n,r.default,!0):Yn(r.from||n):Yn(r),rn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function gi(e,t,n){Cn(b(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function _i(e,t,n,r){let i=r.includes(`.`)?er(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&L(i,n)}else if(w(e))L(i,e.bind(n));else if(D(e))if(b(e))e.forEach(e=>_i(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&L(i,r,e)}}function vi(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>yi(c,e,o,!0)),yi(c,t,o)),D(t)&&a.set(t,c),c}function yi(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&yi(e,a,n,!0),i&&i.forEach(t=>yi(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=bi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var bi={data:xi,props:Ei,emits:Ei,methods:Ti,computed:Ti,beforeCreate:wi,created:wi,beforeMount:wi,mounted:wi,beforeUpdate:wi,updated:wi,beforeDestroy:wi,beforeUnmount:wi,destroyed:wi,unmounted:wi,activated:wi,deactivated:wi,errorCaptured:wi,serverPrefetch:wi,components:Ti,directives:Ti,watch:Di,provide:xi,inject:Si};function xi(e,t){return t?e?function(){return g(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function Si(e,t){return Ti(Ci(e),Ci(t))}function Ci(e){if(b(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function wi(e,t){return e?[...new Set([].concat(e,t))]:t}function Ti(e,t){return e?g(Object.create(null),e,t):t}function Ei(e,t){return e?b(e)&&b(t)?[...new Set([...e,...t])]:g(Object.create(null),fi(e),fi(t??{})):t}function Di(e,t){if(!e)return t;if(!t)return e;let n=g(Object.create(null),e);for(let r in t)n[r]=wi(e[r],t[r]);return n}function Oi(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ki=0;function Ai(e,t){return function(n,r=null){w(n)||(n=g({},n)),r!=null&&!D(r)&&(r=null);let i=Oi(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ki++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:mo,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||H(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,lo(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(Cn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=ji;ji=c;try{return e()}finally{ji=t}}};return c}}var ji=null,Mi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ae(t)}Modifiers`]||e[`${se(t)}Modifiers`];function Ni(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||u,i=n,a=t.startsWith(`update:`),o=a&&Mi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=n.map(pe)));let s,c=r[s=le(t)]||r[s=le(ae(t))];!c&&a&&(c=r[s=le(se(t))]),c&&Cn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,Cn(l,e,6,i)}}var Pi=new WeakMap;function Fi(e,t,n=!1){let r=n?Pi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=Fi(e,t,!0);n&&(s=!0,g(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(D(e)&&r.set(e,null),null):(b(a)?a.forEach(e=>o[e]=null):g(o,a),D(e)&&r.set(e,o),o)}function Ii(e,t){return!e||!m(t)?!1:(t=t.slice(2).replace(/Once$/,``),y(e,t[0].toLowerCase()+t.slice(1))||y(e,se(t))||y(e,t))}function Li(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:g}=e,_=Wn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=za(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=za(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:Ri(s)}}catch(t){wa.length=0,wn(t,e,1),v=H(Sa)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(h)&&(y=zi(y,a)),b=La(b,y,!1,!0))}return n.dirs&&(b=La(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Dr(b,n.transition),v=b,Wn(_),v}var Ri=e=>{let t;for(let n in e)(n===`class`||n===`style`||m(n))&&((t||={})[n]=e[n]);return t},zi=(e,t)=>{let n={};for(let r in e)(!h(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Bi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Vi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Hi(o,r,n)&&!Ii(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?o?Vi(r,o,l):!0:!!o;return!1}function Vi(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Hi(t,e,a)&&!Ii(n,a))return!0}return!1}function Hi(e,t,n){let r=e[n],i=t[n];return n===`style`&&D(r)&&D(i)?!Ee(r,i):r!==i}function Ui({vnode:e,parent:t},n){for(;t;){let r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}var Wi={},Gi=()=>Object.create(Wi),Ki=e=>Object.getPrototypeOf(e)===Wi;function qi(e,t,n,r=!1){let i={},a=Gi();e.propsDefaults=Object.create(null),Yi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:qt(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function Ji(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=P(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(Ii(e.emitsOptions,o))continue;let u=t[o];if(c)if(y(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=ae(o);i[t]=Xi(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Yi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!y(t,a)&&((r=se(a))===a||!y(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Xi(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!y(t,e))&&(delete a[e],l=!0)}l&&ut(e.attrs,`set`,``)}function Yi(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(re(c))continue;let l=t[c],u;i&&y(i,u=ae(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:Ii(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=P(n),r=s||u;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Xi(i,t,s,r[s],e,!y(r,s))}}return o}function Xi(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=y(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Za(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===se(n))&&(r=!0))}return r}var Zi=new WeakMap;function Qi(e,t,n=!1){let r=n?Zi:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=Qi(e,t,!0);g(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return D(e)&&r.set(e,d),d;if(b(a))for(let e=0;e<a.length;e++){let t=ae(a[e]);$i(t)&&(o[t]=u)}else if(a)for(let e in a){let t=ae(e);if($i(t)){let n=a[e],r=o[t]=b(n)||w(n)?{type:n}:g({},n),i=r.type,c=!1,l=!0;if(b(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}else n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||y(r,`default`))&&s.push(t)}}let l=[o,s];return D(e)&&r.set(e,l),l}function $i(e){return e[0]!==`$`&&!re(e)}var ea=e=>e===`_`||e===`_ctx`||e===`$stable`,ta=e=>b(e)?e.map(za):[za(e)],na=(e,t,n)=>{if(t._n)return t;let r=Gn((...e)=>ta(t(...e)),n);return r._c=!1,r},ra=(e,t,n)=>{let r=e._ctx;for(let n in e){if(ea(n))continue;let i=e[n];if(w(i))t[n]=na(n,i,r);else if(i!=null){let e=ta(i);t[n]=()=>e}}},ia=(e,t)=>{let n=ta(t);e.slots.default=()=>n},aa=(e,t,n)=>{for(let r in t)(n||!ea(r))&&(e[r]=t[r])},oa=(e,t,n)=>{let r=e.slots=Gi();if(e.vnode.shapeFlag&32){let e=t._;e?(aa(r,t,n),n&&fe(r,`_`,e,!0)):ra(t,r)}else t&&ia(e,t)},sa=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=u;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:aa(i,t,n):(a=!t.$stable,ra(t,i)),o=t}else t&&(ia(e,t),o={default:1});if(a)for(let e in i)!ea(e)&&o[e]==null&&delete i[e]},ca=ba;function la(e){return ua(e)}function ua(e,t){let n=ge();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=f,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!Ma(e,t)&&(r=_e(e),ue(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case xa:y(e,t,n,r);break;case Sa:b(e,t,n,r);break;case Ca:e??x(t,n,r,o);break;case R:ne(e,t,n,r,i,a,o,s,c);break;default:d&1?w(e,t,n,r,i,a,o,s,c):d&6?k(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,be)}u!=null&&i?Nr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&Nr(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),ee(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,i,s,c,l,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=o(e.type,c,m&&m.is,m),h&8?p(d,e.children):h&16&&D(e.children,d,null,i,s,da(e,c),l,u),_&&qn(e,null,i,`created`),E(d,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!re(e)&&a(d,e,null,m[e],c,i);`value`in m&&a(d,`value`,null,m.value,c),(f=m.onVnodeBeforeMount)&&Ua(f,i,e)}_&&qn(e,null,i,`beforeMount`);let v=pa(s,g);v&&g.beforeEnter(d),r(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&ca(()=>{f&&Ua(f,i,e),v&&g.enter(d),_&&qn(e,null,i,`mounted`)},s)},E=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||ya(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;E(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},D=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++)v(null,e[l]=s?Ba(e[l]):za(e[l]),t,n,r,i,a,o,s)},ee=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||u,h=t.props||u,g;if(n&&fa(n,!1),(g=h.onVnodeBeforeUpdate)&&Ua(g,n,t,e),f&&qn(t,e,n,`beforeUpdate`),n&&fa(n,!0),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(c,``),d?O(e.dynamicChildren,d,c,n,r,da(t,i),o):s||oe(e,t,c,null,n,r,da(t,i),o,!1),l>0){if(l&16)te(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&p(c,t.children)}else !s&&d==null&&te(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&ca(()=>{g&&Ua(g,n,t,e),f&&qn(t,e,n,`updated`)},r)},O=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s];v(c,l,c.el&&(c.type===R||!Ma(c,l)||c.shapeFlag&198)?m(c.el):n,null,r,i,a,o,!0)}},te=(e,t,n,r,i)=>{if(t!==n){if(t!==u)for(let o in t)!re(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(re(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},ne=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),D(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(O(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&ma(e,t,!0)):oe(e,t,n,f,a,o,c,l,u)},k=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):A(t,n,r,i,a,o,c):j(e,t,c)},A=(e,t,n,r,i,a,o)=>{let s=e.component=Ka(e,r,i);if(Ir(e)&&(s.ctx.renderer=be),to(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,ie,o),!e.el){let r=s.subTree=H(Sa);b(null,r,t,n),e.placeholder=r.el}}else ie(s,e,t,n,i,a,o)},j=(e,t,n)=>{let r=t.component=e.component;if(Bi(e,t,n))if(r.asyncDep&&!r.asyncResolved){ae(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},ie=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=ga(e);if(n){t&&(t.el=c.el,ae(e,t,o)),n.asyncDep.then(()=>{ca(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;fa(e,!1),t?(t.el=c.el,ae(e,t,o)):t=c,n&&de(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Ua(d,s,t,c),fa(e,!0);let f=Li(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),_e(p),e,i,a),t.el=f.el,u===null&&Ui(e,f.el),r&&ca(r,i),(d=t.props&&t.props.onVnodeUpdated)&&ca(()=>Ua(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Fr(t);if(fa(e,!1),l&&de(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Ua(o,d,t),fa(e,!0),s&&M){let t=()=>{e.subTree=Li(e),M(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p);let o=e.subTree=Li(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ca(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ca(()=>Ua(o,d,e),i)}(t.shapeFlag&256||d&&Fr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ca(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Le(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Fn(u),fa(e,!0),l()},ae=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Ji(e,t.props,r,n),sa(e,t.children,n),Qe(),Rn(e),$e()},oe=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){ce(l,d,n,r,i,a,o,s,c);return}else if(f&256){se(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&he(l,i,a),d!==l&&p(n,d)):u&16?m&16?ce(l,d,n,r,i,a,o,s,c):he(l,i,a,!0):(u&8&&p(n,``),m&16&&D(d,n,r,i,a,o,s,c))},se=(e,t,n,r,i,a,o,s,c)=>{e||=d,t||=d;let l=e.length,u=t.length,f=Math.min(l,u),p;for(p=0;p<f;p++){let r=t[p]=c?Ba(t[p]):za(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?he(e,i,a,!0,!1,f):D(t,n,r,i,a,o,s,c,f)},ce=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,f=e.length-1,p=u-1;for(;l<=f&&l<=p;){let r=e[l],u=t[l]=c?Ba(t[l]):za(t[l]);if(Ma(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=f&&l<=p;){let r=e[f],l=t[p]=c?Ba(t[p]):za(t[p]);if(Ma(r,l))v(r,l,n,null,i,a,o,s,c);else break;f--,p--}if(l>f){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?Ba(t[l]):za(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=f;)ue(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?Ba(t[l]):za(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=f;l++){let r=e[l];if(y>=b){ue(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&Ma(r,t[_])){u=_;break}u===void 0?ue(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?ha(C):d;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||va(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?le(d,n,p,2):_--)}}},le=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){le(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,be);return}if(c===R){r(s,t,n);for(let e=0;e<u.length;e++)le(u[e],t,n,a);r(e.anchor,t,n);return}if(c===Ca){S(e,t,n);return}if(a!==2&&d&1&&l)if(a===0)l.beforeEnter(s),r(s,t,n),ca(()=>l.enter(s),o);else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{s._isLeaving&&s[mr](!0),a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}else r(s,t,n)},ue=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p}=e;if(d===-2&&(i=!1),s!=null&&(Qe(),Nr(s,null,n,e,!0),$e()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let m=u&1&&f,h=!Fr(e),g;if(h&&(g=o&&o.onVnodeBeforeUnmount)&&Ua(g,t,e),u&6)me(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}m&&qn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,be,r):l&&!l.hasOnce&&(a!==R||d>0&&d&64)?he(l,t,n,!1,!0):(a===R&&d&384||!i&&u&16)&&he(c,t,n),r&&fe(e)}(h&&(g=o&&o.onVnodeUnmounted)||m)&&ca(()=>{g&&Ua(g,t,e),m&&qn(e,null,t,`unmounted`)},n)},fe=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===R){pe(n,r);return}if(t===Ca){C(e);return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},pe=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},me=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;_a(c),_a(l),r&&de(r),i.stop(),a&&(a.flags|=8,ue(o,e,t,n)),s&&ca(s,t),ca(()=>{e.isUnmounted=!0},t)},he=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)ue(e[o],t,n,r,i)},_e=e=>{if(e.shapeFlag&6)return _e(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[tr];return n?h(n):t},ve=!1,ye=(e,t,n)=>{let r;e==null?t._vnode&&(ue(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,ve||=(ve=!0,Rn(r),zn(),!1)},be={p:v,um:ue,m:le,r:fe,mt:A,mc:D,pc:oe,pbc:O,n:_e,o:e},xe,M;return t&&([xe,M]=t(be)),{render:ye,hydrate:xe,createApp:Ai(ye,xe)}}function da({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function fa({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function pa(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ma(e,t,n=!1){let r=e.children,i=t.children;if(b(r)&&b(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=Ba(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&ma(t,a)),a.type===xa&&(a.patchFlag===-1&&(a=i[e]=Ba(a)),a.el=t.el),a.type===Sa&&!a.el&&(a.el=t.el)}}function ha(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-- >0;)n[a]=o,o=t[o];return n}function ga(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ga(t)}function _a(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function va(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?va(t.subTree):null}var ya=e=>e.__isSuspense;function ba(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):Ln(e)}var R=Symbol.for(`v-fgt`),xa=Symbol.for(`v-txt`),Sa=Symbol.for(`v-cmt`),Ca=Symbol.for(`v-stc`),wa=[],Ta=null;function z(e=!1){wa.push(Ta=e?null:[])}function Ea(){wa.pop(),Ta=wa[wa.length-1]||null}var Da=1;function Oa(e,t=!1){Da+=e,e<0&&Ta&&t&&(Ta.hasOnce=!0)}function ka(e){return e.dynamicChildren=Da>0?Ta||d:null,Ea(),Da>0&&Ta&&Ta.push(e),e}function B(e,t,n,r,i,a){return ka(V(e,t,n,r,i,a,!0))}function Aa(e,t,n,r,i){return ka(H(e,t,n,r,i,!0))}function ja(e){return e?e.__v_isVNode===!0:!1}function Ma(e,t){return e.type===t.type&&e.key===t.key}var Na=({key:e})=>e??null,Pa=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||rn(e)||w(e)?{i:Hn,r:e,k:t,f:!!n}:e);function V(e,t=null,n=null,r=0,i=null,a=e===R?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Na(t),ref:t&&Pa(t),scopeId:Un,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Hn};return s?(Va(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),Da>0&&!o&&Ta&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Ta.push(c),c}var H=Fa;function Fa(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===ti)&&(e=Sa),ja(e)){let r=La(e,t,!0);return n&&Va(r,n),Da>0&&!a&&Ta&&(r.shapeFlag&6?Ta[Ta.indexOf(e)]=r:Ta.push(r)),r.patchFlag=-2,r}if(fo(e)&&(e=e.__vccOpts),t){t=Ia(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=M(e)),D(n)&&($t(n)&&!b(n)&&(n=g({},n)),t.style=_e(n))}let o=T(e)?1:ya(e)?128:nr(e)?64:D(e)?4:w(e)?2:0;return V(e,t,n,r,i,o,a,!0)}function Ia(e){return e?$t(e)||Ki(e)?g({},e):e:null}function La(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Ha(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Na(l),ref:t&&t.ref?n&&a?b(a)?a.concat(Pa(t)):[a,Pa(t)]:Pa(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==R?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&La(e.ssContent),ssFallback:e.ssFallback&&La(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&Dr(u,c.clone(u)),u}function U(e=` `,t=0){return H(xa,null,e,t)}function Ra(e,t){let n=H(Ca,null,e);return n.staticCount=t,n}function W(e=``,t=!1){return t?(z(),Aa(Sa,null,e)):H(Sa,null,e)}function za(e){return e==null||typeof e==`boolean`?H(Sa):b(e)?H(R,null,e.slice()):ja(e)?Ba(e):H(xa,null,String(e))}function Ba(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:La(e)}function Va(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(b(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),Va(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!Ki(t)?t._ctx=Hn:r===3&&Hn&&(Hn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else w(t)?(t={default:t,_ctx:Hn},n=32):(t=String(t),r&64?(n=16,t=[U(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ha(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=M([t.class,r.class]));else if(e===`style`)t.style=_e([t.style,r.style]);else if(m(e)){let n=t[e],i=r[e];i&&n!==i&&!(b(n)&&n.includes(i))&&(t[e]=n?[].concat(n,i):i)}else e!==``&&(t[e]=r[e])}return t}function Ua(e,t,n,r=null){Cn(e,t,7,[n,r])}var Wa=Oi(),Ga=0;function Ka(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||Wa,a={uid:Ga++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Me(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Qi(r,i),emitsOptions:Fi(r,i),emit:null,emitted:null,propsDefaults:u,inheritAttrs:r.inheritAttrs,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=Ni.bind(null,a),e.ce&&e.ce(a),a}var qa=null,Ja=()=>qa||Hn,Ya,Xa;{let e=ge(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Ya=t(`__VUE_INSTANCE_SETTERS__`,e=>qa=e),Xa=t(`__VUE_SSR_SETTERS__`,e=>eo=e)}var Za=e=>{let t=qa;return Ya(e),e.scope.on(),()=>{e.scope.off(),Ya(t)}},Qa=()=>{qa&&qa.scope.off(),Ya(null)};function $a(e){return e.vnode.shapeFlag&4}var eo=!1;function to(e,t=!1,n=!1){t&&Xa(t);let{props:r,children:i}=e.vnode,a=$a(e);qi(e,r,a,t),oa(e,i,n||t);let o=a?no(e,t):void 0;return t&&Xa(!1),o}function no(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,di);let{setup:r}=n;if(r){Qe();let n=e.setupContext=r.length>1?co(e):null,i=Za(e),a=Sn(r,e,0,[e.props,n]),o=ee(a);if($e(),i(),(o||e.sp)&&!Fr(e)&&Ar(e),o){if(a.then(Qa,Qa),t)return a.then(n=>{ro(e,n,t)}).catch(t=>{wn(t,e,0)});e.asyncDep=a}else ro(e,a,t)}else oo(e,t)}function ro(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:D(t)&&(e.setupState=ln(t)),oo(e,n)}var io,ao;function oo(e,t,n){let r=e.type;if(!e.render){if(!t&&io&&!r.render){let t=r.template||vi(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=io(t,g(g({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||f,ao&&ao(e)}{let t=Za(e);Qe();try{mi(e)}finally{$e(),t()}}}var so={get(e,t){return lt(e,`get`,``),e[t]}};function co(e){return{attrs:new Proxy(e.attrs,so),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function lo(e){return e.exposed?e.exposeProxy||=new Proxy(ln(en(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in li)return li[n](e)},has(e,t){return t in e||t in li}}):e.proxy}function uo(e,t=!0){return w(e)?e.displayName||e.name:e.name||t&&e.__name}function fo(e){return w(e)&&`__vccOpts`in e}var G=(e,t)=>hn(e,t,eo);function po(e,t,n){try{Oa(-1);let r=arguments.length;return r===2?D(t)&&!b(t)?ja(t)?H(e,null,[t]):H(e,t):H(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ja(n)&&(n=[n]),H(e,t,n))}finally{Oa(1)}}var mo=`3.5.29`,ho=void 0,go=typeof window<`u`&&window.trustedTypes;if(go)try{ho=go.createPolicy(`vue`,{createHTML:e=>e})}catch{}var _o=ho?e=>ho.createHTML(e):e=>e,vo=`http://www.w3.org/2000/svg`,yo=`http://www.w3.org/1998/Math/MathML`,bo=typeof document<`u`?document:null,xo=bo&&bo.createElement(`template`),So={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?bo.createElementNS(vo,e):t===`mathml`?bo.createElementNS(yo,e):n?bo.createElement(e,{is:n}):bo.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>bo.createTextNode(e),createComment:e=>bo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>bo.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{xo.innerHTML=_o(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=xo.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Co=`transition`,wo=`animation`,To=Symbol(`_vtc`),Eo={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},Do=g({},vr,Eo),Oo=(e=>(e.displayName=`Transition`,e.props=Do,e))((e,{slots:t})=>po(Sr,jo(e),t)),ko=(e,t=[])=>{b(e)?e.forEach(e=>e(...t)):e&&e(...t)},Ao=e=>e?b(e)?e.some(e=>e.length>1):e.length>1:!1;function jo(e){let t={};for(let n in e)n in Eo||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=Mo(i),h=m&&m[0],_=m&&m[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:x,onLeaveCancelled:S,onBeforeAppear:C=v,onAppear:w=y,onAppearCancelled:T=b}=t,E=(e,t,n,r)=>{e._enterCancelled=r,Fo(e,t?u:s),Fo(e,t?l:o),n&&n()},D=(e,t)=>{e._isLeaving=!1,Fo(e,d),Fo(e,p),Fo(e,f),t&&t()},ee=e=>(t,n)=>{let i=e?w:y,o=()=>E(t,e,n);ko(i,[t,o]),Io(()=>{Fo(t,e?c:a),Po(t,e?u:s),Ao(i)||Ro(t,r,h,o)})};return g(t,{onBeforeEnter(e){ko(v,[e]),Po(e,a),Po(e,o)},onBeforeAppear(e){ko(C,[e]),Po(e,c),Po(e,l)},onEnter:ee(!1),onAppear:ee(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>D(e,t);Po(e,d),e._enterCancelled?(Po(e,f),Ho(e)):(Ho(e),Po(e,f)),Io(()=>{e._isLeaving&&(Fo(e,d),Po(e,p),Ao(x)||Ro(e,r,_,n))}),ko(x,[e,n])},onEnterCancelled(e){E(e,!1,void 0,!0),ko(b,[e])},onAppearCancelled(e){E(e,!0,void 0,!0),ko(T,[e])},onLeaveCancelled(e){D(e),ko(S,[e])}})}function Mo(e){if(e==null)return null;if(D(e))return[No(e.enter),No(e.leave)];{let t=No(e);return[t,t]}}function No(e){return me(e)}function Po(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[To]||(e[To]=new Set)).add(t)}function Fo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[To];n&&(n.delete(t),n.size||(e[To]=void 0))}function Io(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Lo=0;function Ro(e,t,n,r){let i=e._endId=++Lo,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=zo(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function zo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${Co}Delay`),a=r(`${Co}Duration`),o=Bo(i,a),s=r(`${wo}Delay`),c=r(`${wo}Duration`),l=Bo(s,c),u=null,d=0,f=0;t===Co?o>0&&(u=Co,d=o,f=a.length):t===wo?l>0&&(u=wo,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?Co:wo:null,f=u?u===Co?a.length:c.length:0);let p=u===Co&&/\b(?:transform|all)(?:,|$)/.test(r(`${Co}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function Bo(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Vo(t)+Vo(e[n])))}function Vo(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Ho(e){return(e?e.ownerDocument:document).body.offsetHeight}function Uo(e,t,n){let r=e[To];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Wo=Symbol(`_vod`),Go=Symbol(`_vsh`),Ko={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Wo]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):qo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),qo(e,!0),r.enter(e)):r.leave(e,()=>{qo(e,!1)}):qo(e,t))},beforeUnmount(e,{value:t}){qo(e,t)}};function qo(e,t){e.style.display=t?e[Wo]:`none`,e[Go]=!t}var Jo=Symbol(``),Yo=/(?:^|;)\s*display\s*:/;function Xo(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t)if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Qo(r,t,``)}else for(let e in t)n[e]??Qo(r,e,``);for(let e in n)e===`display`&&(a=!0),Qo(r,e,n[e])}else if(i){if(t!==n){let e=r[Jo];e&&(n+=`;`+e),r.cssText=n,a=Yo.test(n)}}else t&&e.removeAttribute(`style`);Wo in e&&(e[Wo]=a?r.display:``,e[Go]&&(r.display=`none`))}var Zo=/\s*!important$/;function Qo(e,t,n){if(b(n))n.forEach(n=>Qo(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=ts(e,t);Zo.test(n)?e.setProperty(se(r),n.replace(Zo,``),`important`):e[r]=n}}var $o=[`Webkit`,`Moz`,`ms`],es={};function ts(e,t){let n=es[t];if(n)return n;let r=ae(t);if(r!==`filter`&&r in e)return es[t]=r;r=ce(r);for(let n=0;n<$o.length;n++){let i=$o[n]+r;if(i in e)return es[t]=i}return t}var ns=`http://www.w3.org/1999/xlink`;function rs(e,t,n,r,i,a=Ce(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(ns,t.slice(6,t.length)):e.setAttributeNS(ns,t,n):n==null||a&&!we(n)?e.removeAttribute(t):e.setAttribute(t,a?``:E(n)?String(n):n)}function is(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?_o(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=we(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function as(e,t,n,r){e.addEventListener(t,n,r)}function os(e,t,n,r){e.removeEventListener(t,n,r)}var ss=Symbol(`_vei`);function cs(e,t,n,r,i=null){let a=e[ss]||(e[ss]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=us(t);r?as(e,n,a[t]=ms(r,i),s):o&&(os(e,n,o,s),a[t]=void 0)}}var ls=/(?:Once|Passive|Capture)$/;function us(e){let t;if(ls.test(e)){t={};let n;for(;n=e.match(ls);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===`:`?e.slice(3):se(e.slice(2)),t]}var ds=0,fs=Promise.resolve(),ps=()=>ds||=(fs.then(()=>ds=0),Date.now());function ms(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;Cn(hs(e,n.value),t,5,[e])};return n.value=e,n.attached=ps(),n}function hs(e,t){if(b(t)){let n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}else return t}var gs=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,_s=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Uo(e,r,o):t===`style`?Xo(e,n,r):m(t)?h(t)||cs(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):vs(e,t,r,o))?(is(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&rs(e,t,r,o,a,t!==`value`)):e._isVueCE&&(/[A-Z]/.test(t)||!T(r))?is(e,ae(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),rs(e,t,r,o))};function vs(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&gs(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return gs(t)&&T(n)?!1:t in e}var ys=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return b(t)?e=>de(t,e):t};function bs(e){e.target.composing=!0}function xs(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var Ss=Symbol(`_assign`);function Cs(e,t,n){return t&&(e=e.trim()),n&&(e=pe(e)),e}var ws={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e[Ss]=ys(i);let a=r||i.props&&i.props.type===`number`;as(e,t?`change`:`input`,t=>{t.target.composing||e[Ss](Cs(e.value,n,a))}),(n||a)&&as(e,`change`,()=>{e.value=Cs(e.value,n,a)}),t||(as(e,`compositionstart`,bs),as(e,`compositionend`,xs),as(e,`change`,xs))},mounted(e,{value:t}){e.value=t??``},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[Ss]=ys(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?pe(e.value):e.value,c=t??``;s!==c&&(document.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c))}},Ts={deep:!0,created(e,{value:t,modifiers:{number:n}},r){let i=S(t);as(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pe(Ds(e)):Ds(e));e[Ss](e.multiple?i?new Set(t):t:t[0]),e._assigning=!0,Nn(()=>{e._assigning=!1})}),e[Ss]=ys(r)},mounted(e,{value:t}){Es(e,t)},beforeUpdate(e,t,n){e[Ss]=ys(n)},updated(e,{value:t}){e._assigning||Es(e,t)}};function Es(e,t){let n=e.multiple,r=b(t);if(!(n&&!r&&!S(t))){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Ds(a);if(n)if(r){let e=typeof o;e===`string`||e===`number`?a.selected=t.some(e=>String(e)===String(o)):a.selected=De(t,o)>-1}else a.selected=t.has(o);else if(Ee(Ds(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ds(e){return`_value`in e?e._value:e.value}var Os=[`ctrl`,`shift`,`alt`,`meta`],ks={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Os.some(n=>e[`${n}Key`]&&!t.includes(n))},As=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=ks[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},js={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ms=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=se(n.key);if(t.some(e=>e===r||js[e]===r))return e(n)}))},Ns=g({patchProp:_s},So),Ps;function Fs(){return Ps||=la(Ns)}var Is=((...e)=>{let t=Fs().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Rs(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Ls(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Ls(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Rs(e){return T(e)?document.querySelector(e):e}var zs=/^[a-z0-9]+(-[a-z0-9]+)*$/,Bs=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!Vs(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!Vs(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!Vs(e,n)?null:e}return null},Vs=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,Hs=Object.freeze({left:0,top:0,width:16,height:16}),Us=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Ws=Object.freeze({...Hs,...Us}),Gs=Object.freeze({...Ws,body:``,hidden:!1});function Ks(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function qs(e,t){let n=Ks(e,t);for(let r in Gs)r in Us?r in e&&!(r in n)&&(n[r]=Us[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function Js(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function Ys(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=qs(r[e]||i[e],a)}return o(t),n.forEach(o),qs(e,a)}function Xs(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=Js(e);for(let i in r){let a=r[i];a&&(t(i,Ys(e,i,a)),n.push(i))}return n}var Zs={provider:``,aliases:{},not_found:{},...Hs};function Qs(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function $s(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!Qs(e,Zs))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!Qs(t,Gs))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!Qs(t,Gs))return null}return t}var ec=Object.create(null);function tc(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function nc(e,t){let n=ec[e]||(ec[e]=Object.create(null));return n[t]||(n[t]=tc(e,t))}function rc(e,t){return $s(t)?Xs(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ic(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var ac=!1;function oc(e){return typeof e==`boolean`&&(ac=e),ac}function sc(e){let t=typeof e==`string`?Bs(e,!0,ac):e;if(t){let e=nc(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function cc(e,t){let n=Bs(e,!0,ac);if(!n)return!1;let r=nc(n.provider,n.prefix);return t?ic(r,n.name,t):(r.missing.add(n.name),!0)}function lc(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),ac&&!t&&!e.prefix){let t=!1;return $s(e)&&(e.prefix=``,Xs(e,(e,n)=>{cc(e,n)&&(t=!0)})),t}let n=e.prefix;return Vs({prefix:n,name:`a`})?!!rc(nc(t,n),e):!1}var uc=Object.freeze({width:null,height:null}),dc=Object.freeze({...uc,...Us}),fc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,pc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function mc(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(fc);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=pc.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function hc(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function gc(e,t){return e?`<defs>`+e+`</defs>`+t:t}function _c(e,t,n){let r=hc(e);return gc(r.defs,t+r.content+n)}var vc=e=>e===`unset`||e===`undefined`||e===`none`;function yc(e,t){let n={...Ws,...e},r={...dc,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=_c(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=mc(d,c/l)):(u=o===`auto`?c:o,d=s===null?mc(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{vc(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var bc=/\sid="(\S+)"/g,xc=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Sc=0;function Cc(e,t=xc){let n=[],r;for(;r=bc.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(Sc++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var wc=Object.create(null);function Tc(e,t){wc[e]=t}function Ec(e){return wc[e]||wc[``]}function Dc(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var Oc=Object.create(null),kc=[`https://api.simplesvg.com`,`https://api.unisvg.com`],Ac=[];kc.length>0;)kc.length===1||Math.random()>.5?Ac.push(kc.shift()):Ac.push(kc.pop());Oc[``]=Dc({resources:[`https://api.iconify.design`].concat(Ac)});function jc(e,t){let n=Dc(t);return n===null?!1:(Oc[e]=n,!0)}function Mc(e){return Oc[e]}var Nc=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Pc(e,t){let n=Mc(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{let n=t;e=Math.max(e,n.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function Fc(e){return e===404}var Ic=(e,t,n)=>{let r=[],i=Pc(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function Lc(e){if(typeof e==`string`){let t=Mc(e);if(t)return t.path}return`/`}var Rc={prepare:Ic,send:(e,t,n)=>{if(!Nc){n(`abort`,424);return}let r=Lc(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;Nc(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(Fc(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function zc(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=nc(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function Bc(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Vc(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||Bc([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Hc=0;function Uc(e,t,n){let r=Hc++,i=Bc.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Wc(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?Bs(e,t,n):e;i&&r.push(i)}),r}var Gc={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Kc(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function qc(e){let t={...Gc,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Kc(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Jc(){}var Yc=Object.create(null);function Xc(e){if(!Yc[e]){let t=Mc(e);if(!t)return;Yc[e]={config:t,redundancy:qc(t)}}return Yc[e]}function Zc(e,t,n){let r,i;if(typeof e==`string`){let t=Ec(e);if(!t)return n(void 0,424),Jc;i=t.send;let a=Xc(e);a&&(r=a.redundancy)}else{let t=Dc(e);if(t){r=qc(t);let n=Ec(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Jc):r.query(t,i,n)().abort}function Qc(){}function $c(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Vc(e)}))}function el(e){let t=[],n=[];return e.forEach(e=>{(e.match(zs)?t:n).push(e)}),{valid:t,invalid:n}}function tl(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!rc(e,n).length){r();return}}catch(e){console.error(e)}r(),$c(e)}function nl(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function rl(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){nl(e.loadIcons(r,n,t),t=>{tl(e,r,t)});return}if(i){r.forEach(r=>{nl(i(r,n,t),t=>{tl(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=el(r);if(o.length&&tl(e,o,null),!a.length)return;let s=n.match(zs)?Ec(t):null;if(!s){tl(e,a,null);return}s.prepare(t,n,a).forEach(n=>{Zc(t,n,t=>{tl(e,n.icons,t)})})}))}var il=(e,t)=>{let n=zc(Wc(e,!0,oc()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Qc)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(nc(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=nc(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&rl(e,t)}),t?Uc(t,n,i):Qc};function al(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in uc?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var ol=/[\s,]+/;function sl(e,t){t.split(ol).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function cl(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function ll(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function ul(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function dl(e){return`data:image/svg+xml,`+ul(e)}function fl(e){return`url("`+dl(e)+`")`}var pl={...dc,inline:!1},ml={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},hl={display:`inline-block`},gl={backgroundColor:`currentColor`},_l={backgroundColor:`transparent`},vl={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},yl={webkitMask:gl,mask:gl,background:_l};for(let e in yl){let t=yl[e];for(let n in vl)t[e+n]=vl[n]}var bl={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;bl[e+`-flip`]=t,bl[e.slice(0,1)+`-flip`]=t,bl[e+`Flip`]=t});function xl(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var Sl=(e,t)=>{let n=al(pl,t),r={...ml},i=t.mode||`svg`,a={},o=t.style,s=typeof o==`object`&&!(o instanceof Array)?o:{};for(let e in t){let i=t[e];if(i!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:n[e]=i===!0||i===`true`||i===1;break;case`flip`:typeof i==`string`&&sl(n,i);break;case`color`:a.color=i;break;case`rotate`:typeof i==`string`?n[e]=cl(i):typeof i==`number`&&(n[e]=i);break;case`ariaHidden`:case`aria-hidden`:i!==!0&&i!==`true`&&delete r[`aria-hidden`];break;default:{let t=bl[e];t?(i===!0||i===`true`||i===1)&&(n[t]=!0):pl[e]===void 0&&(r[e]=i)}}}let c=yc(e,n),l=c.attributes;if(n.inline&&(a.verticalAlign=`-0.125em`),i===`svg`){r.style={...a,...s},Object.assign(r,l);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),r.innerHTML=Cc(c.body,n?()=>n+`ID`+ e++:`iconifyVue`),po(`svg`,r)}let{body:u,width:d,height:f}=e,p=i===`mask`||(i===`bg`?!1:u.indexOf(`currentColor`)!==-1),m=ll(u,{...l,width:d+``,height:f+``});return r.style={...a,"--svg":fl(m),width:xl(l.width),height:xl(l.height),...hl,...p?gl:_l,...s},po(`span`,r)};if(oc(!0),Tc(``,Rc),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!lc(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;jc(e,r)||console.error(n)}catch{console.error(n)}}}}var Cl={...Ws,body:``},K=kr((e,{emit:t})=>{let n=F(null);function r(){n.value&&=(n.value.abort?.(),null)}let i=F(!!e.ssr),a=F(``),o=an(null);function s(){let i=e.icon;if(typeof i==`object`&&i&&typeof i.body==`string`)return a.value=``,{data:i};let o;if(typeof i!=`string`||(o=Bs(i,!1,!0))===null)return null;let s=sc(o);if(!s){let e=n.value;return(!e||e.name!==i)&&(s===null?n.value={name:i}:n.value={name:i,abort:il([o],c)}),null}r(),a.value!==i&&(a.value=i,Nn(()=>{t(`load`,i)}));let l=e.customise;if(l){s=Object.assign({},s);let e=l(s.body,o.name,o.prefix,o.provider);typeof e==`string`&&(s.body=e)}let u=[`iconify`];return o.prefix!==``&&u.push(`iconify--`+o.prefix),o.provider!==``&&u.push(`iconify--`+o.provider),{data:s,classes:u}}function c(){let e=s();e?e.data!==o.value?.data&&(o.value=e):o.value=null}return i.value?c():Wr(()=>{i.value=!0,c()}),L(()=>e.icon,c),Jr(r),()=>{let t=o.value;if(!t)return Sl(Cl,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),Sl({...Ws,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),wl=kr({__name:`ContextMenu`,props:{pos:{},transform:{}},setup(e){return(t,n)=>(z(),Aa(dr,{to:`body`},[e.pos?(z(),B(`div`,{key:0,class:`ctx-menu-glass fixed z-[1200] min-w-[140px] select-none rounded-xl py-1 backdrop-blur-2xl backdrop-saturate-150`,style:_e({left:`${e.pos.x}px`,top:`${e.pos.y}px`,transform:e.transform})},[oi(t.$slots,`default`)],4)):W(``,!0)]))}}),Tl={class:`h-8 px-3 border-b border-border flex items-center justify-between`},El={class:`section-title`},Dl={class:`p-3 overflow-y-auto`,style:{"max-height":`calc(100vh - 64px - 32px)`}},Ol=kr({__name:`ModalWindow`,props:{title:{},width:{default:`480px`}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t;function i(e){e.target===e.currentTarget&&r(`close`)}return(e,t)=>(z(),Aa(dr,{to:`body`},[V(`div`,{class:`fixed inset-0 z-[9999] flex items-center justify-center bg-bg/80`,onMousedown:i},[V(`div`,{class:`border border-border bg-surface rounded shadow-lg`,style:_e({width:n.width,maxWidth:`calc(100vw - 32px)`,maxHeight:`calc(100vh - 64px)`})},[V(`div`,Tl,[V(`span`,El,N(n.title),1),V(`button`,{type:`button`,class:`text-[11px] text-muted hover:text-text transition-colors`,onClick:t[0]||=e=>r(`close`)},` x `)]),V(`div`,Dl,[oi(e.$slots,`default`)])],4)],32)]))}}),kl=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,Al=F(null),jl=F(!1);function Ml(e){e.preventDefault(),Al.value=e}function Nl(){jl.value=!0,Al.value=null}typeof window<`u`&&(window.addEventListener(`beforeinstallprompt`,Ml),window.addEventListener(`appinstalled`,Nl));var Pl=G(()=>!kl&&!jl.value),Fl=/iPad|iPhone|iPod/.test(navigator.userAgent),Il=Fl?[{icon:`lucide:share`,text:`tap the share button`},{icon:`lucide:plus-square`,text:`tap "add to home screen"`}]:[{icon:`lucide:ellipsis-vertical`,text:`tap the browser menu`},{icon:`lucide:download`,text:`tap "install app" or "add to home screen"`}];function Ll(){let e=F(!1);function t(){Al.value?(Al.value.prompt(),Al.value=null):e.value=!0}return{showInstall:Pl,showA2hs:e,handleInstallClick:t,isIos:Fl,a2hsSteps:Il}}var Rl={key:1,class:`badge-ok`},zl={key:2,class:`fixed bottom-2.5 max-md:bottom-14 right-2.5 z-[10] flex gap-1.5`},Bl=[`title`],Vl={class:`flex flex-col gap-2.5 mb-3`},Hl={class:`flex items-center justify-center w-6 h-6 rounded-md bg-white/10 shrink-0`},Ul={class:`flex justify-end`},Wl=kr({__name:`FullscreenToggle`,props:{inlineInstall:{type:Boolean,default:!1}},setup(e){let t=e,n=!!document.documentElement.requestFullscreen,r=F(!!document.fullscreenElement);function i(){document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()}function a(){r.value=!!document.fullscreenElement}Wr(()=>document.addEventListener(`fullscreenchange`,a)),Jr(()=>document.removeEventListener(`fullscreenchange`,a));let{showInstall:o,showA2hs:s,handleInstallClick:c,a2hsSteps:l}=Ll();return(e,a)=>(z(),B(R,null,[t.inlineInstall&&I(o)?(z(),B(`button`,{key:0,type:`button`,class:`btn-primary text-[11px] inline-flex items-center gap-1.5`,onClick:a[0]||=e=>I(c)()},[H(I(K),{icon:`lucide:download`,class:`text-[13px]`}),a[5]||=U(` add to home screen `,-1)])):t.inlineInstall?(z(),B(`span`,Rl,`already installed`)):!t.inlineInstall&&(n||I(o))?(z(),B(`div`,zl,[I(o)?(z(),B(`button`,{key:0,type:`button`,tabindex:`-1`,class:`p-1 rounded bg-black/30 backdrop-blur-sm text-white/80 hover:text-white hover:bg-black/50 transition-all`,title:`install app`,onClick:a[1]||=e=>I(c)()},[H(I(K),{icon:`lucide:download`,class:`text-base`})])):W(``,!0),n?(z(),B(`button`,{key:1,type:`button`,tabindex:`-1`,class:`p-1 rounded bg-black/30 backdrop-blur-sm text-white/80 hover:text-white hover:bg-black/50 transition-all`,title:r.value?`exit fullscreen`:`enter fullscreen`,onClick:a[2]||=e=>i()},[H(I(K),{icon:r.value?`lucide:minimize`:`lucide:maximize`,class:`text-base`},null,8,[`icon`])],8,Bl)):W(``,!0)])):W(``,!0),I(s)?(z(),Aa(Ol,{key:3,title:`install app`,width:`340px`,onClose:a[4]||=e=>s.value=!1},{default:Gn(()=>[a[6]||=V(`p`,{class:`text-[12px] text-text mb-3`},` for the best experience, add this app to your home screen: `,-1),V(`div`,Vl,[(z(!0),B(R,null,ai(I(l),(e,t)=>(z(),B(`div`,{key:t,class:`flex items-center gap-2.5 text-[12px] text-muted`},[V(`span`,Hl,[H(I(K),{icon:e.icon,class:`text-sm text-text`},null,8,[`icon`])]),V(`span`,null,N(t+1)+`. `+N(e.text),1)]))),128))]),V(`div`,Ul,[V(`button`,{class:`btn-ghost`,onClick:a[3]||=e=>s.value=!1},`close`)])]),_:1})):W(``,!0)],64))}});function Gl(){let e=F(null),t;function n(t,n,r){e.value={x:t,y:n,data:r}}function r(){e.value=null}function i(e,t){e.preventDefault(),n(e.clientX,e.clientY,t)}function a(e,r){let{clientX:i,clientY:a}=e.touches[0];t=setTimeout(()=>{e.preventDefault(),n(i,a,r)},500)}function o(){clearTimeout(t)}function s(){e.value&&r()}return Wr(()=>document.addEventListener(`click`,s)),Jr(()=>document.removeEventListener(`click`,s)),{menu:e,open:n,close:r,onContext:i,onTouchStart:a,cancelLongPress:o}}var Kl=`piclaw:settings`,ql=768;function Jl(){return window.matchMedia(`(max-width: ${ql-1}px)`).matches?`small`:`large`}function Yl(){return{theme:`system`,wallpaper:``,iconLayout:`list`,dockSize:Jl(),showClock:!0,clockFormat:`24h`,showStatus:!0,showFullscreen:!0}}function Xl(){let e=Yl();try{let t=localStorage.getItem(Kl);if(t)return{...e,...JSON.parse(t)}}catch{}let t={...e},n=localStorage.getItem(`piclaw:desktop-bg`);n&&(t.wallpaper=n,localStorage.removeItem(`piclaw:desktop-bg`));let r=localStorage.getItem(`piclaw:icon-layout`);return(r===`list`||r===`grid`)&&(t.iconLayout=r,localStorage.removeItem(`piclaw:icon-layout`)),t}var Zl=Kt(Xl());function Ql(){localStorage.setItem(Kl,JSON.stringify(Zl))}L(Zl,Ql,{deep:!0});function $l(e){window.dispatchEvent(new CustomEvent(`piclaw:settings:${e}`,{detail:Zl[e]}))}function eu(){return{settings:Zl,set(e){for(let[t,n]of Object.entries(e))Zl[t]=n,$l(t)},reset(){Object.assign(Zl,Yl()),Ql()}}}const tu=Symbol(`windowState`),nu=Symbol(`instanceId`);function ru(e){let t=Yn(tu);if(!t)throw Error(`useWindowState requires windowStateKey to be provided`);let n=Yn(nu),r=G(()=>e??n?.value??``);return{instanceId:r,state:G(()=>t.windowState[r.value]??{}),set:e=>{r.value&&t.setWindowState(r.value,e)},setTitle:e=>{r.value&&t.setWindowTitle(r.value,e)},close:()=>{r.value&&t.closeWindow(r.value)},setWindowState:t.setWindowState,setWindowTitle:t.setWindowTitle,bringToFront:t.bringToFront,openWindow:t.openWindow,closeWindow:t.closeWindow}}var iu={key:1,class:`fixed bottom-3 max-md:bottom-[3.25rem] right-10 max-md:right-3 z-[1] text-[11px] text-white/70 pointer-events-none select-none`,style:{"text-shadow":`0 1px 3px rgba(0, 0, 0, 0.8)`},"aria-hidden":`true`},au={key:0,class:`absolute inset-0 flex items-center justify-center pointer-events-none select-none`,"aria-hidden":`true`},ou=[`onClick`],su={class:`mt-1 truncate`,style:{"text-shadow":`0 1px 3px rgba(0, 0, 0, 0.9),
|
|
3
|
-
0 0 8px rgba(0, 0, 0, 0.5)`}},cu=kr({__name:`AppDesktop`,props:{apps:{},openInstances:{}},emits:[`launch`,`ctxAction`],setup(e,{expose:t,emit:n}){let r=n,{settings:i,set:a}=eu(),o=G(()=>i.wallpaper),s=G(()=>i.iconLayout);function c(){a({iconLayout:i.iconLayout===`list`?`grid`:`list`}),p()}let{menu:l,onContext:u,onTouchStart:d,cancelLongPress:f,close:p}=Gl();function m(e){p(),r(`ctxAction`,e)}function h(){p(),globalThis.location.reload()}t({closeCtxMenu:p});let g=kr({props:{instanceId:{type:String,required:!0}},setup(e,{slots:t}){return Jn(nu,fn(()=>e.instanceId)),()=>t.default?.()}});return(t,n)=>(z(),B(R,null,[o.value?(z(),B(`div`,{key:0,class:`fixed inset-0 bg-cover bg-center pointer-events-none select-none z-0`,style:_e({backgroundImage:`url(${o.value})`}),"aria-hidden":`true`},null,4)):W(``,!0),o.value?.includes(`wallhaven.cc`)?(z(),B(`span`,iu,`wallhaven.cc`)):W(``,!0),V(`div`,{class:`flex-1 min-h-0 p-4 max-md:p-0 relative h-full overflow-hidden select-none`,onContextmenu:n[0]||=As(e=>I(u)(e,void 0),[`self`]),onTouchstart:n[1]||=As(e=>I(d)(e,void 0),[`self`]),onTouchend:n[2]||=As((...e)=>I(f)&&I(f)(...e),[`self`]),onTouchmove:n[3]||=As((...e)=>I(f)&&I(f)(...e),[`self`])},[o.value?W(``,!0):(z(),B(`div`,au,[...n[6]||=[V(`svg`,{class:`text-surface w-[min(55vw,55vh)] h-[min(55vw,55vh)]`,viewBox:`0 0 200 200`,fill:`none`,stroke:`currentColor`,"stroke-width":`3.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M 30 55 Q 60 48, 100 50 Q 140 52, 170 47`}),V(`path`,{d:`M 65 50 Q 58 90, 55 120 Q 52 145, 48 170`}),V(`path`,{d:`M 125 50 Q 130 90, 132 120 Q 134 150, 140 175`})],-1)]])),V(`div`,{class:M([`absolute z-[5] pointer-events-none`,s.value===`grid`?`inset-4 grid grid-cols-4 justify-items-center content-start gap-3 md:flex md:flex-wrap md:justify-center`:`top-4 left-4 flex flex-col gap-1.5 max-md:flex-wrap max-md:max-h-[calc((theme(spacing.18)+theme(spacing.1.5))*4)] max-md:gap-x-3`])},[(z(!0),B(R,null,ai(e.apps.filter(e=>!e.hidden),e=>(z(),B(`button`,{key:`desktop-${e.key}`,type:`button`,tabindex:-1,class:M([`pointer-events-auto px-2 py-2 rounded text-center text-white/90 hover:text-white transition-colors`,s.value===`grid`?`w-22 text-[12px]`:`w-18 text-[11px]`]),onClick:t=>r(`launch`,e.key)},[H(I(K),{icon:e.icon,class:M([`mx-auto drop-shadow-[0_1px_3px_rgba(0,0,0,0.8)]`,s.value===`grid`?`text-2xl`:`text-xl`]),style:_e({color:e.color})},null,8,[`icon`,`class`,`style`]),V(`div`,su,N(e.label),1)],10,ou))),128))],2),(z(!0),B(R,null,ai(e.openInstances,e=>(z(),Aa(dr,{key:e.id,to:e.mountTarget},[H(I(g),{"instance-id":e.id},{default:Gn(()=>[(z(),Aa(ni(e.app.component)))]),_:2},1032,[`instance-id`])],8,[`to`]))),128))],32),I(i).showFullscreen?(z(),Aa(Wl,{key:2})):W(``,!0),H(wl,{pos:I(l)??null},{default:Gn(()=>[V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:n[4]||=e=>h()},` Reload `),V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:c},N(s.value===`list`?`Grid layout`:`List layout`),1),V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:n[5]||=e=>m(`settings`)},` Settings `)]),_:1},8,[`pos`])],64))}}),lu=F();function uu(){function e(e){return new Promise(t=>{lu.value={message:e,resolve:t}})}function t(e){return new Promise(t=>{lu.value={message:e,alertOnly:!0,resolve:()=>t()}})}function n(){lu.value?.resolve(!0),lu.value=void 0}function r(){lu.value?.resolve(!1),lu.value=void 0}return{state:lu,confirm:e,alert:t,accept:n,cancel:r}}var du={class:`text-[12px] text-text mb-3`},fu={class:`flex gap-2 items-center justify-end`},pu=kr({__name:`ConfirmDialog`,setup(e){let{state:t,accept:n,cancel:r}=uu(),i=F();L(t,async e=>{e&&(await Nn(),i.value?.focus())});function a(e){t.value&&(e.key===`Enter`?(e.preventDefault(),n()):e.key===`Escape`&&(e.preventDefault(),r()))}return Wr(()=>window.addEventListener(`keydown`,a)),Jr(()=>window.removeEventListener(`keydown`,a)),(e,a)=>I(t)?(z(),Aa(Ol,{key:0,title:I(t).alertOnly?`notice`:`confirm`,width:`360px`,onClose:I(r)},{default:Gn(()=>[V(`p`,du,N(I(t).message),1),V(`div`,fu,[I(t).alertOnly?(z(),B(`button`,{key:0,ref_key:`primaryBtn`,ref:i,type:`button`,class:`btn-primary`,onClick:a[0]||=(...e)=>I(n)&&I(n)(...e)},[...a[3]||=[U(` ok `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]],512)):(z(),B(R,{key:1},[V(`button`,{type:`button`,class:`btn-ghost`,onClick:a[1]||=(...e)=>I(r)&&I(r)(...e)},[...a[4]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]]),V(`button`,{ref_key:`primaryBtn`,ref:i,type:`button`,class:`btn-danger`,onClick:a[2]||=(...e)=>I(n)&&I(n)(...e)},[...a[5]||=[U(` confirm `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]],512)],64))])]),_:1},8,[`title`,`onClose`])):W(``,!0)}}),mu=``;async function hu(e,t){try{let n=await fetch(mu+e,t);if(!n.ok)throw Error(await n.text());return await n.json()}catch(e){return console.error(`API error:`,e),null}}async function gu(e,t){return await hu(e,t)||null}var _u=768;function vu(){let e=F(window.innerWidth<_u),t=window.matchMedia(`(max-width: ${_u-1}px)`),n=t=>{e.value=t.matches};return t.addEventListener(`change`,n),Pe(()=>t.removeEventListener(`change`,n)),e}function yu(e,t){let n;Wr(()=>{e(),n=setInterval(()=>{e()},t)}),Jr(()=>{n&&=(clearInterval(n),void 0)})}var bu={class:`flex flex-col h-full overflow-y-auto`},xu={class:`p-3`},Su={key:0,class:`text-[12px] text-muted`},Cu={key:1,class:`text-[12px] text-muted`},wu={key:2,class:`w-full border-collapse text-[12px]`},Tu={class:`py-1.5 px-2 border-b border-border font-medium`},Eu={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},Du={class:`py-1.5 px-2 border-b border-border`},Ou={class:`py-1.5 px-2 border-b border-border text-right`},ku=[`disabled`,`onClick`],Au=[`disabled`,`onClick`],ju={class:`px-3 pb-3`},Mu={key:0,class:`text-[12px] text-muted`},Nu={key:1,class:`w-full border-collapse text-[12px]`},Pu={class:`py-1.5 px-2 border-b border-border font-medium`},Fu={class:`py-1.5 px-2 border-b border-border text-muted font-mono text-[11px]`},Iu={class:`py-1.5 px-2 border-b border-border`},Lu={class:`py-1.5 px-2 border-b border-border text-right whitespace-nowrap`},Ru=[`disabled`,`onClick`],zu=[`onClick`],Bu=[`onClick`],Vu={key:0,class:`mb-3 text-center`},Hu={key:0,class:`text-[11px] text-muted mb-2`},Uu={key:1,class:`text-[11px] text-muted mb-2`},Wu=[`href`],Gu={key:1,class:`mb-3`},Ku={class:`text-[11px] text-muted`},qu={key:2,class:`mb-3`},Ju={class:`text-[11px] text-muted mb-1`},Yu=[`placeholder`],Xu=[`disabled`],Zu={key:3,class:`text-[11px] text-muted`},Qu={key:4,class:`text-[11px] text-ok`},$u={key:5,class:`text-[11px] text-danger`},ed={class:`mb-3`},td={class:`text-[11px] text-muted mb-1`},nd={class:`font-medium text-text`},rd={class:`text-[10px] text-muted mb-1`},id={class:`font-mono text-accent`},ad={key:0,class:`text-[10px] text-muted`},od={key:0},sd=[`href`],cd=[`disabled`],ld=kr({__name:`AuthTab`,setup(e){let t=F(null),n=F(!1),r=F(null),i=F(null),a=F(null),o=F([]),s=F(!1),c=F(``),l=F(null),u=null,d=F([]),f=F(null),p=F(``),m=F(!1),h=F(null),g=G(()=>t.value?t.value.oauthProviders.map(e=>{let n=t.value.providers.find(t=>t.provider===e.id);return{...e,hasAuth:n?.hasAuth??!1}}):[]),_=G(()=>s.value?null:x(`prompt`)?.prompt??null),v=G(()=>x(`progress`)?.message??null),y=G(()=>s.value?null:x(`auth`)?.authInfo??null),b=G(()=>x(`error`)?.error??null);function x(e){return[...o.value].reverse().find(t=>t.type===e)}let S=G(()=>o.value.some(e=>e.type===`complete`));async function C(){let e=await gu(`/api/pi/status`);e&&(t.value=e.auth)}async function w(){let e=await gu(`/api/pi/apikey-providers`);e&&(d.value=e)}function T(){C(),w()}yu(T,1e4);async function E(e){O(),i.value=e,o.value=[],s.value=!1,c.value=``,n.value=!0;try{let t=await hu(`/api/pi/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({providerId:e})});if(!t?.loginId){o.value.push({type:`error`,error:`Failed to start login`}),s.value=!0;return}a.value=t.loginId,u=new EventSource(`/api/pi/login/events?loginId=${t.loginId}`),u.onmessage=e=>{try{let t=JSON.parse(e.data);o.value.push(t),(t.type===`complete`||t.type===`error`)&&(s.value=!0,O(),t.type===`complete`&&T())}catch{}},u.onerror=()=>{s.value||=(o.value.push({type:`error`,error:`Connection lost`}),!0),O()}}catch(e){o.value.push({type:`error`,error:e instanceof Error?e.message:`Login failed`}),s.value=!0}finally{n.value=!1}}async function D(){if(!a.value)return;let e=c.value;c.value=``,await hu(`/api/pi/login/respond`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginId:a.value,value:e})})}function ee(){O(),i.value=null,a.value=null,o.value=[],s.value=!1}function O(){u&&=(u.close(),null)}async function te(e){r.value=e;try{await hu(`/api/pi/logout`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e})}),T()}finally{r.value=null}}function ne(e){f.value=e,p.value=``,m.value=!1,Nn(()=>h.value?.focus())}function k(){f.value=null,p.value=``,m.value=!1}async function A(){if(!(!f.value||!p.value.trim())){m.value=!0;try{await hu(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:f.value.id,key:p.value.trim()})}),k(),T()}finally{m.value=!1}}}async function re(e){r.value=e;try{await hu(`/api/pi/apikey`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({provider:e,key:null})}),T()}finally{r.value=null}}return L(_,e=>{e&&Nn(()=>l.value?.focus())}),(e,a)=>(z(),B(R,null,[V(`div`,bu,[V(`div`,xu,[a[2]||=V(`h3`,{class:`section-title mb-2 select-none`},`oauth providers`,-1),t.value?g.value.length===0?(z(),B(`div`,Cu,` no oauth providers available `)):(z(),B(`table`,wu,[V(`tbody`,null,[(z(!0),B(R,null,ai(g.value,e=>(z(),B(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,Tu,N(e.name),1),V(`td`,Eu,N(e.id),1),V(`td`,Du,[V(`span`,{class:M(e.hasAuth?`badge-ok`:`badge-muted`)},N(e.hasAuth?`connected`:`not connected`),3)]),V(`td`,Ou,[e.hasAuth?(z(),B(`button`,{key:0,type:`button`,disabled:r.value===e.id,class:`btn-sm border-danger-dim text-danger bg-danger-dim hover:text-text disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>te(e.id)},N(r.value===e.id?`...`:`logout`),9,ku)):(z(),B(`button`,{key:1,type:`button`,disabled:n.value&&i.value===e.id,class:`btn-sm border-accent-dim text-accent bg-accent-dim hover:bg-accent-dimmer disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>E(e.id)},N(n.value&&i.value===e.id?`...`:`login`),9,Au))])]))),128))])])):(z(),B(`div`,Su,`loading...`))]),V(`div`,ju,[a[3]||=V(`h3`,{class:`section-title mb-2 select-none`},`api keys`,-1),d.value.length===0?(z(),B(`div`,Mu,`loading...`)):(z(),B(`table`,Nu,[V(`tbody`,null,[(z(!0),B(R,null,ai(d.value,e=>(z(),B(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,Pu,N(e.name),1),V(`td`,Fu,N(e.envVar),1),V(`td`,Iu,[V(`span`,{class:M(e.hasAuth?`badge-ok`:`badge-muted`)},N(e.hasAuth?`configured`:`not set`),3)]),V(`td`,Lu,[e.hasAuth?(z(),B(`button`,{key:0,type:`button`,disabled:r.value===e.id,class:`btn-sm border-danger-dim text-danger bg-danger-dim hover:text-text disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:t=>re(e.id)},N(r.value===e.id?`...`:`remove`),9,Ru)):W(``,!0),e.hasAuth?W(``,!0):(z(),B(`button`,{key:1,type:`button`,class:`btn-sm border-accent-dim text-accent bg-accent-dim hover:bg-accent-dimmer`,onClick:t=>ne(e)},` set key `,8,zu)),e.hasAuth?(z(),B(`button`,{key:2,type:`button`,class:`ml-1 btn-sm`,onClick:t=>ne(e)},` update `,8,Bu)):W(``,!0)])]))),128))])]))])]),i.value?(z(),Aa(Ol,{key:0,title:`login — ${i.value}`,width:`420px`,onClose:ee},{default:Gn(()=>[y.value?(z(),B(`div`,Vu,[y.value.instructions?(z(),B(`p`,Hu,N(y.value.instructions),1)):(z(),B(`p`,Uu,` open this url in your browser to authenticate: `)),V(`a`,{href:y.value.url,target:`_blank`,rel:`noopener`,class:`btn-primary inline-block text-[11px]`},` open in browser -> `,8,Wu)])):W(``,!0),v.value&&!s.value?(z(),B(`div`,Gu,[V(`p`,Ku,N(v.value),1)])):W(``,!0),_.value?(z(),B(`div`,qu,[V(`p`,Ju,N(_.value.message),1),V(`form`,{class:`flex gap-2`,onSubmit:As(D,[`prevent`]),onKeydown:Ms(ee,[`escape`])},[Kn(V(`input`,{ref_key:`promptInputEl`,ref:l,"onUpdate:modelValue":a[0]||=e=>c.value=e,placeholder:_.value.placeholder||``,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,8,Yu),[[ws,c.value]]),V(`button`,{type:`submit`,disabled:!c.value.trim()&&!_.value.allowEmpty,class:`btn-primary text-[11px] disabled:text-muted disabled:bg-surface disabled:border-border`},` submit `,8,Xu)],32)])):W(``,!0),!s.value&&!y.value&&!_.value&&!v.value?(z(),B(`div`,Zu,` connecting... `)):W(``,!0),S.value?(z(),B(`div`,Qu,`login successful`)):W(``,!0),b.value?(z(),B(`div`,$u,N(b.value),1)):W(``,!0)]),_:1},8,[`title`])):W(``,!0),f.value?(z(),Aa(Ol,{key:1,title:`${f.value.name} — api key`,width:`420px`,onClose:k},{default:Gn(()=>[V(`div`,ed,[V(`p`,td,[a[4]||=U(` enter your API key for `,-1),V(`span`,nd,N(f.value.name),1)]),V(`p`,rd,[a[5]||=U(` env: `,-1),V(`code`,id,N(f.value.envVar),1)]),f.value.url?(z(),B(`p`,ad,[f.value.guide?(z(),B(`span`,od,N(f.value.guide)+` — `,1)):W(``,!0),V(`a`,{href:f.value.url,target:`_blank`,rel:`noopener`,class:`text-accent hover:underline`},`LINK`,8,sd)])):W(``,!0)]),V(`form`,{class:`flex gap-2`,onSubmit:As(A,[`prevent`]),onKeydown:Ms(k,[`escape`])},[Kn(V(`input`,{ref_key:`apiKeyInputEl`,ref:h,"onUpdate:modelValue":a[1]||=e=>p.value=e,type:`password`,placeholder:`sk-...`,autocomplete:`off`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,512),[[ws,p.value]]),V(`button`,{type:`submit`,disabled:!p.value.trim()||m.value,class:`btn-primary text-[11px] disabled:text-muted disabled:bg-surface disabled:border-border`},N(m.value?`...`:`save`),9,cd)],32)]),_:1},8,[`title`])):W(``,!0)],64))}}),ud=window.matchMedia(`(prefers-color-scheme: dark)`);function dd(){let{settings:e}=eu(),t=G(()=>e.theme===`system`?ud.matches?`dark`:`light`:e.theme);function n(){let e=t.value;e===`dark`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e}return L(t,n,{immediate:!0}),ud.addEventListener(`change`,n),{effective:t}}var fd=`modulepreload`,pd=function(e){return`/`+e},md={};const hd=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=pd(t,n),t in md)return;md[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:fd,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};var gd=kr({__name:`CodeEditor`,props:{modelValue:{},language:{default:`plaintext`},readOnly:{type:Boolean,default:!1}},emits:[`update:modelValue`,`save`],setup(e,{expose:t,emit:n}){let r=e,i=n,{effective:a}=dd(),o=F(null),s=null,c=!1;async function l(){if(!o.value||s)return;let{init:e}=await hd(async()=>{let{init:e}=await import(`./dist-BVjfG3ok.js`);return{init:e}},[]),t=await e();t.editor.defineTheme(`piclaw-dark`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#0a0e14`,"editorGutter.background":`#0a0e14`,"editorLineNumber.foreground":`#5c6773`}}),t.editor.defineTheme(`piclaw-light`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#ffffff`,"editorGutter.background":`#f5f5f7`,"editorLineNumber.foreground":`#86868b`}});let n=t.editor.createModel(r.modelValue,r.language);s=t.editor.create(o.value,{model:n,theme:a.value===`light`?`piclaw-light`:`piclaw-dark`,readOnly:r.readOnly,minimap:{enabled:!1},fontSize:12,fontFamily:`Geist Mono Variable, monospace`,lineNumbers:`on`,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,wordWrap:`on`}),n.onDidChangeContent(()=>{c||i(`update:modelValue`,n.getValue())}),s.addCommand(t.KeyMod.CtrlCmd|t.KeyCode.KeyS,()=>{i(`save`)})}function u(){s?.dispose(),s=null}function d(){if(!s)return;let e=s.getModel();e&&e.getValue()!==r.modelValue&&(c=!0,e.setValue(r.modelValue),c=!1)}function f(){if(!s)return;let e=s.getModel();e&&hd(async()=>{let{init:e}=await import(`./dist-BVjfG3ok.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setModelLanguage(e,r.language)}))}return L(()=>r.modelValue,d),L(()=>r.language,f),L(()=>r.readOnly,e=>s?.updateOptions({readOnly:e})),L(a,e=>{s&&hd(async()=>{let{init:e}=await import(`./dist-BVjfG3ok.js`);return{init:e}},[]).then(({init:t})=>t().then(t=>{t.editor.setTheme(e===`light`?`piclaw-light`:`piclaw-dark`)}))}),Wr(l),Jr(u),t({editor:()=>s}),(e,t)=>(z(),B(`div`,{ref_key:`el`,ref:o,class:`h-full w-full`},null,512))}}),_d={class:`relative h-full min-h-0`},vd={class:`absolute top-1 right-5 z-10 flex items-center gap-0.5 bg-bg/80 backdrop-blur rounded px-1 py-0.5`},yd=`piclaw:json-editor-mode`,bd=kr({__name:`JsonEditor`,props:{value:{},readOnly:{type:Boolean,default:!1},schema:{default:null}},emits:[`change`,`validation`],setup(e,{emit:t}){let n=F(localStorage.getItem(yd)||`visual`);L(n,e=>localStorage.setItem(yd,e));let r=e,i=t,a=r.value??{},o=F(!0);function s(e){a=e,i(`change`,e)}L(()=>r.value,e=>{a=e??{}},{deep:!0});let l=F(null),u=null,d={"--vj-bg":`var(--color-bg)`,"--vj-bg-panel":`var(--color-surface)`,"--vj-bg-hover":`var(--color-muted-dim)`,"--vj-bg-selected":`var(--color-accent-dim)`,"--vj-border":`var(--color-border)`,"--vj-text":`var(--color-text)`,"--vj-text-muted":`var(--color-muted)`,"--vj-accent":`var(--color-accent)`,"--vj-string":`var(--color-accent)`,"--vj-number":`var(--color-ok)`,"--vj-font":`var(--font-mono)`};function f(e){e&&typeof e==`object`&&!Array.isArray(e)&&s(e)}async function p(){if(!u)return;let[e,{JsonEditor:t}]=await Promise.all([hd(()=>import(`./react-DFP7nCmh.js`).then(e=>c(e.t(),1)),[]),hd(()=>import(`./dist-DJh8l6yS.js`),__vite__mapDeps([0,1]))]);u.render(e.createElement(t,{value:a,schema:r.schema??void 0,readOnly:r.readOnly,onChange:r.readOnly?void 0:f,editorShowDescriptions:!!r.schema,height:`100%`,width:`100%`,style:d}))}async function m(){if(!l.value||u)return;let{createRoot:e}=await hd(async()=>{let{createRoot:e}=await import(`./client-TIs-Ghqj.js`).then(e=>c(e.default,1));return{createRoot:e}},__vite__mapDeps([2,1]));u=e(l.value),await p()}function h(){u?.unmount(),u=null}let g=F(JSON.stringify(a,null,2));function _(e){g.value=e;try{let t=JSON.parse(e);t&&typeof t==`object`&&!Array.isArray(t)&&s(t),o.value=!0,i(`validation`,{valid:!0})}catch(e){o.value=!1,i(`validation`,{valid:!1,error:e instanceof SyntaxError?e.message:`Invalid JSON`})}}function v(){let e=JSON.stringify(a,null,2);g.value!==e&&(g.value=e)}return Wr(()=>{n.value!==`json`&&m()}),L(n,e=>{e===`json`?(h(),v()):requestAnimationFrame(()=>m())}),L(()=>[r.value,r.readOnly,r.schema],()=>{n.value===`json`?v():p()},{deep:!0}),Jr(()=>{h()}),(e,t)=>(z(),B(`div`,_d,[V(`div`,vd,[V(`button`,{type:`button`,class:M([`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wider font-medium transition-colors`,n.value===`json`?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:t[0]||=e=>n.value=`json`},` json `,2),V(`button`,{type:`button`,class:M([`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wider font-medium transition-colors`,n.value===`visual`?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:t[1]||=e=>n.value=`visual`},` visual `,2)]),Kn(H(gd,{"model-value":g.value,language:`json`,"read-only":r.readOnly,class:`h-full`,"onUpdate:modelValue":_},null,8,[`model-value`,`read-only`]),[[Ko,n.value===`json`]]),Kn(V(`div`,{ref_key:`visualEl`,ref:l,class:`h-full`},null,512),[[Ko,n.value===`visual`]])]))}}),xd={class:`p-3 h-full min-h-0`},Sd=kr({__name:`ConfigTab`,setup(e){let t=F(null);return yu(async()=>{t.value=await gu(`/api/pi/status`)},3e4),(e,n)=>(z(),B(`div`,xd,[H(bd,{value:t.value,"read-only":!0},null,8,[`value`])]))}}),Cd={class:`flex flex-col h-full`},wd={class:`px-3 py-3 border-b border-border bg-surface/40`},Td={class:`flex flex-wrap items-center gap-4 text-[12px]`},Ed={class:`flex items-center gap-2`},Dd={class:`flex items-center gap-2 min-w-0`},Od={class:`px-3 py-2 flex gap-2 items-center border-b border-border`},kd=[`value`],Ad={class:`px-3 py-2 text-[11px] text-muted border-b border-border`},jd={class:`overflow-auto flex-1 min-h-0`},Md={class:`w-full border-collapse text-[12px]`},Nd={key:0},Pd={key:1},Fd={class:`py-1.5 px-2 border-b border-border text-muted select-text`},Id={class:`py-1.5 px-2 border-b border-border font-medium select-text`},Ld={class:`ml-1.5 text-[10px] text-muted`},Rd={class:`py-1.5 px-2 border-b border-border text-center`},zd=[`disabled`,`onClick`],Bd={key:1,class:`badge-accent border border-accent`},Vd={class:`py-1.5 px-2 border-b border-border text-[10px] text-muted select-text`},Hd={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Ud={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Wd={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Gd={class:`py-1.5 px-2 border-b border-border text-muted font-mono select-text`},Kd={class:`py-1.5 px-2 border-b border-border`},qd={key:0,class:`badge-accent mr-1`},Jd={key:1,class:`badge-ok`},Yd=kr({__name:`ModelsTab`,setup(e){let t=F(null),n=F(``),r=F(``),i=F(!1);async function a(){t.value=await gu(`/api/pi/models`)}yu(a,3e4);let o=G(()=>t.value?[...new Set(t.value.models.map(e=>e.provider))].sort():[]),s=G(()=>{if(!t.value)return{};let e={};for(let n of t.value.models)e[n.provider]=(e[n.provider]||0)+1;return e}),c=G(()=>{if(!t.value)return[];let e=t.value.models;if(r.value&&(e=e.filter(e=>e.provider===r.value)),n.value.trim()){let t=n.value.trim().toLowerCase();e=e.filter(e=>e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.provider.toLowerCase().includes(t))}return e});function l(e){return!!t.value&&t.value.defaultModel===e.id&&t.value.defaultProvider===e.provider}async function u(e){if(!i.value){i.value=!0;try{await gu(`/api/pi/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaultModel:e.id,defaultProvider:e.provider})}),await a()}finally{i.value=!1}}}function d(e){return e>=1e6?`${(e/1e6).toFixed(0)}m`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}function f(e){return e===0?`0`:e<.01?e.toFixed(3):e<1?e.toFixed(2):e.toFixed(1)}return(e,a)=>(z(),B(`div`,Cd,[V(`div`,wd,[a[4]||=V(`div`,{class:`text-[10px] uppercase tracking-wider text-muted mb-2`},`default model`,-1),V(`div`,Td,[V(`div`,Ed,[a[2]||=V(`span`,{class:`text-muted`},`provider`,-1),V(`span`,{class:M([`px-2 py-0.5 rounded border border-border font-medium select-text`,t.value?.defaultProvider?`text-accent bg-accent-dim`:`text-muted`])},N(t.value?.defaultProvider||`—`),3)]),V(`div`,Dd,[a[3]||=V(`span`,{class:`text-muted`},`model`,-1),V(`span`,{class:M([`px-2 py-0.5 rounded border border-border font-mono text-[11px] max-w-[60ch] truncate select-text`,t.value?.defaultModel?`text-accent bg-accent-dim`:`text-muted`])},N(t.value?.defaultModel||`—`),3)])])]),V(`div`,Od,[Kn(V(`input`,{"onUpdate:modelValue":a[0]||=e=>n.value=e,placeholder:`search models...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1 text-[12px] font-mono flex-1 outline-none transition-colors focus:border-accent`},null,512),[[ws,n.value]]),Kn(V(`select`,{"onUpdate:modelValue":a[1]||=e=>r.value=e,class:`bg-bg border border-border rounded text-text px-2 py-1 text-[12px] font-mono outline-none transition-colors focus:border-accent`},[a[5]||=V(`option`,{value:``},`all providers`,-1),(z(!0),B(R,null,ai(o.value,e=>(z(),B(`option`,{key:e,value:e},N(e)+` (`+N(s.value[e])+`) `,9,kd))),128))],512),[[Ts,r.value]])]),V(`div`,Ad,N(t.value?c.value.length:`-`)+`/`+N(t.value?.models.length??`-`)+` models `,1),V(`div`,jd,[V(`table`,Md,[a[8]||=V(`thead`,{class:`sticky top-0 bg-bg z-10`},[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` provider `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` model `),V(`th`,{class:`text-center text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-16`}),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` api `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` ctx `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` max out `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` $/m in `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` $/m out `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` flags `)])],-1),V(`tbody`,null,[t.value?c.value.length===0?(z(),B(`tr`,Pd,[...a[7]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`no models found`,-1)]])):W(``,!0):(z(),B(`tr`,Nd,[...a[6]||=[V(`td`,{colspan:`9`,class:`text-center py-8 text-muted text-[12px]`},`loading...`,-1)]])),(z(!0),B(R,null,ai(c.value,e=>(z(),B(`tr`,{key:`${e.provider}/${e.id}`,class:M([`hover:bg-surface`,l(e)?`bg-accent-dim/30`:``])},[V(`td`,Fd,N(e.provider),1),V(`td`,Id,[V(`span`,null,N(e.name),1),V(`span`,Ld,N(e.id),1)]),V(`td`,Rd,[l(e)?(z(),B(`span`,Bd,` active `)):(z(),B(`button`,{key:0,type:`button`,class:`btn-sm hover:text-accent hover:border-accent bg-bg disabled:opacity-40`,disabled:i.value,onClick:t=>u(e)},` use `,8,zd))]),V(`td`,Vd,N(e.api),1),V(`td`,Hd,N(d(e.contextWindow)),1),V(`td`,Ud,N(d(e.maxTokens)),1),V(`td`,Wd,N(f(e.cost.input)),1),V(`td`,Gd,N(f(e.cost.output)),1),V(`td`,Kd,[e.reasoning?(z(),B(`span`,qd,`reasoning`)):W(``,!0),e.input.includes(`image`)?(z(),B(`span`,Jd,`vision`)):W(``,!0)])],2))),128))])])])]))}}),Xd={class:`flex flex-col h-full min-h-0`},Zd={class:`px-3 py-2 border-b border-border flex items-center gap-2`},Qd=[`onClick`],$d={class:`ml-auto flex items-center gap-2`},ef={key:0,class:`text-[11px] text-err truncate max-w-[200px]`},tf=[`disabled`],nf={key:2,class:`text-[11px] text-muted`},rf={class:`flex-1 min-h-0 p-3`},af={class:`h-full border border-border`},of=kr({__name:`SettingsTab`,setup(e){let t={settings:{label:`settings.json`,endpoint:`/api/pi/settings`,schemaKey:`settings`},"models-config":{label:`models.json`,endpoint:`/api/pi/models-config`,schemaKey:`modelsConfig`},auth:{label:`auth.json`,endpoint:`/api/pi/auth`}},n=F(`settings`),r=F(null),i=F(null),a=F(!1),o=F(null),s=F(null),c=F(null),l=``,u=F(!1),d=()=>{let e=t[n.value].schemaKey;return!e||!i.value?null:i.value[e]??null};async function f(){i.value=await gu(`/api/pi/schemas`)}async function p(){s.value=null,c.value=null,u.value=!1,o.value=null,r.value=(await gu(t[n.value].endpoint))?.data??null,l=JSON.stringify(r.value)}function m(e){o.value=e,u.value=JSON.stringify(e)!==l}function h(e){c.value=e.valid?null:e.error??`Invalid JSON`,e.valid||(u.value=!0)}async function g(){if(o.value){a.value=!0,s.value=null;try{let e=await fetch(t[n.value].endpoint,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(o.value)});if(!e.ok){s.value=await e.text();return}r.value=o.value,l=JSON.stringify(r.value),u.value=!1,o.value=null}catch(e){s.value=e instanceof Error?e.message:String(e)}finally{a.value=!1}}}function _(){o.value=null,u.value=!1,c.value=null,r.value=r.value?{...r.value}:null}function v(e){!e.metaKey&&!e.ctrlKey||(e.key===`s`&&u.value&&!c.value&&!a.value?(e.preventDefault(),g()):e.key===`d`&&u.value&&(e.preventDefault(),_()))}return Wr(()=>{f(),window.addEventListener(`keydown`,v)}),Jr(()=>window.removeEventListener(`keydown`,v)),L(n,()=>p(),{immediate:!0}),(e,i)=>(z(),B(`div`,Xd,[V(`div`,Zd,[(z(),B(R,null,ai(t,(e,t)=>V(`button`,{key:t,type:`button`,class:M([`px-2.5 py-1 rounded text-[11px] font-mono transition-colors`,n.value===t?`bg-surface text-text`:`text-muted hover:text-text`]),onClick:e=>n.value=t},N(e.label),11,Qd)),64)),V(`div`,$d,[s.value||c.value?(z(),B(`span`,ef,N(s.value||c.value),1)):W(``,!0),u.value?(z(),B(R,{key:1},[V(`button`,{type:`button`,class:`px-2.5 py-1 rounded text-[11px] font-medium bg-surface text-muted hover:text-text transition-colors`,title:`⌘D`,onClick:_},[...i[0]||=[U(` discard `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`⌘D`,-1)]]),V(`button`,{type:`button`,class:`px-2.5 py-1 rounded text-[11px] font-medium bg-accent text-bg transition-colors disabled:opacity-50`,disabled:a.value||!!c.value,title:`⌘S`,onClick:g},[a.value?(z(),B(R,{key:0},[U(`saving...`)],64)):(z(),B(R,{key:1},[i[1]||=U(`save `,-1),i[2]||=V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`⌘S`,-1)],64))],8,tf)],64)):(z(),B(`span`,nf,`~/.pi/agent/`+N(t[n.value].label),1))])]),V(`div`,rf,[V(`div`,af,[(z(),Aa(bd,{key:n.value,value:r.value,schema:d(),"read-only":!1,onChange:m,onValidation:h},null,8,[`value`,`schema`]))])])]))}}),sf={class:`flex flex-col h-full`},cf={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},lf={key:`agent`,label:`Pi Agent`,icon:`pixelarticons:cpu`,color:`#39bae6`,component:kr({__name:`window`,setup(e){let t=[`auth`,`models`,`settings`,`status`],{state:n,set:r}=ru(),i=F(t.includes(n.value.tab)?n.value.tab:`auth`);return L(i,e=>r({tab:e})),(e,t)=>(z(),B(`div`,sf,[V(`div`,cf,[V(`button`,{type:`button`,class:M(i.value===`auth`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`auth`},` auth `,2),V(`button`,{type:`button`,class:M(i.value===`models`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`models`},` models `,2),V(`button`,{type:`button`,class:M(i.value===`settings`?`tab-active`:`tab-inactive`),onClick:t[2]||=e=>i.value=`settings`},` settings `,2),V(`button`,{type:`button`,class:M(i.value===`status`?`tab-active`:`tab-inactive`),onClick:t[3]||=e=>i.value=`status`},` status `,2)]),i.value===`auth`?(z(),Aa(ld,{key:0})):i.value===`models`?(z(),Aa(Yd,{key:1})):i.value===`settings`?(z(),Aa(of,{key:2})):i.value===`status`?(z(),Aa(Sd,{key:3})):W(``,!0)]))}}),window:{width:900,height:520,minwidth:480,minheight:300}},uf={text:``,isStreaming:!1,activeTool:null};function df(e){let t=F({...uf}),n;function r(e){i(),t.value={...uf},n=new EventSource(`/api/stream?jid=${encodeURIComponent(e)}`),n.addEventListener(`text_delta`,e=>{let n=JSON.parse(e.data);t.value={...t.value,text:t.value.text+n.delta,isStreaming:!0}}),n.addEventListener(`text_end`,()=>{t.value={...uf}}),n.addEventListener(`tool_start`,e=>{let n=JSON.parse(e.data);t.value={...t.value,activeTool:n.toolName}}),n.addEventListener(`tool_end`,()=>{t.value={...t.value,activeTool:null}}),n.addEventListener(`agent_end`,()=>{t.value={...uf}})}function i(){n?.close(),n=void 0}return L(e,e=>{e?r(e):i()},{immediate:!0}),Jr(i),{streamState:t}}function ff(e){if(!e)return``;let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}function pf(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?`just now`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function mf(e){let t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`}function hf(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}function gf(e){switch(e){case`active`:return`badge-ok`;case`paused`:return`badge-warn`;case`completed`:return`badge-muted`;case`error`:return`badge-danger`;default:return`badge-muted`}}function _f(e){if(!e)return``;let t=ff(e);return t=t.replace(/```(\w*)?\n([\s\S]*?)```/g,`<pre class="bg-code px-2 py-1.5 rounded overflow-x-auto my-1 text-[11px] border border-border"><code>$2</code></pre>`),t=t.replace(/`([^`]+)`/g,`<code class="bg-code px-1 py-px rounded text-[11px]">$1</code>`),t=t.replace(/\*\*(.+?)\*\*/g,`<strong>$1</strong>`),t}var vf=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},yf={},bf={type:`button`,class:`w-7 h-7 flex items-center justify-center text-muted hover:text-text rounded transition-colors cursor-pointer`,title:`toggle sidebar`};function xf(e,t){return z(),B(`button`,bf,[...t[0]||=[Ra(`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"><rect x="1.5" y="2.5" width="13" height="11" rx="2"></rect><line x1="5.5" y1="2.5" x2="5.5" y2="13.5"></line><line x1="3" y1="5.5" x2="4" y2="5.5"></line><line x1="3" y1="8" x2="4" y2="8"></line><line x1="3" y1="10.5" x2="4" y2="10.5"></line></svg>`,1)]])}var Sf=vf(yf,[[`render`,xf]]),Cf={key:0,class:`flex-1 flex items-center justify-center text-muted text-[13px] font-sans`},wf={key:0,class:`flex justify-center py-2`},Tf={class:`bg-surface text-muted text-[10px] font-medium tracking-wide rounded-full px-3 py-1`},Ef={key:0,class:`text-[10px] font-medium mb-0.5 px-3 text-ok`},Df=[`innerHTML`],Of={key:2,class:`px-4 py-2.5 rounded-2xl rounded-br-sm text-[13px] font-sans leading-snug whitespace-pre-wrap break-words bg-accent-dimmer text-text border border-accent-dim select-text`},kf={class:`text-[9px] text-muted mt-1 px-3`},Af={key:1,class:`flex flex-col max-w-[70%] max-md:max-w-[80%] self-start items-start`},jf=[`innerHTML`],Mf={key:2,class:`flex flex-col self-start items-start`},Nf={class:`px-4 py-2 rounded-2xl rounded-bl-sm text-[11px] font-mono text-muted bg-surface border border-border`},Pf={key:0,class:`shrink-0 justify-center px-4 py-2.5 bg-bg items-center gap-1.5 flex`},Ff=kr({__name:`ChatMessages`,props:{messages:{},sendingMessage:{type:Boolean},typingVisible:{type:Boolean},streamState:{}},setup(e){let t=e;function n(e){return e.replace(/<internal>[\s\S]*?<\/internal>/g,``).trim()}let r=G(()=>{let e=t.streamState.text;return e?n(e).replace(/<internal>[\s\S]*$/,``).trim():``}),i=F(null),a=F(!1);L(()=>t.messages.length,async(e,n)=>{let r=i.value;if(!r)return;let o=r.scrollHeight-r.scrollTop-r.clientHeight<80,s=e>(n??0);if(await Nn(),!a.value){r.scrollTop=r.scrollHeight,a.value=!0;return}(s&&o||t.sendingMessage)&&(r.scrollTop=r.scrollHeight)}),Wr(async()=>{await Nn();let e=i.value;e&&(e.scrollTop=e.scrollHeight,a.value=!0)});function o(e){return new Date(e).toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`})}function s(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}function c(e){return e===0?!0:o(t.messages[e].timestamp)!==o(t.messages[e-1].timestamp)}return L(()=>r.value.length,async()=>{let e=i.value;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<80;await Nn(),t&&(e.scrollTop=e.scrollHeight)}),(t,n)=>(z(),B(R,null,[V(`div`,{ref_key:`listEl`,ref:i,class:`flex-1 min-h-0 overflow-y-auto px-4 py-4 flex flex-col gap-2 bg-bg overscroll-contain [scrollbar-gutter:stable]`},[e.messages.length===0?(z(),B(`div`,Cf,[...n[0]||=[V(`div`,{class:`text-center`},[V(`div`,{class:`text-[28px] text-border mb-3`},`~`),V(`div`,null,`no messages yet`)],-1)]])):W(``,!0),(z(!0),B(R,null,ai(e.messages,(e,t)=>(z(),B(R,{key:`${e.timestamp}-${t}`},[c(t)?(z(),B(`div`,wf,[V(`span`,Tf,N(o(e.timestamp)),1)])):W(``,!0),V(`div`,{class:M([`flex flex-col max-w-[70%] max-md:max-w-[80%]`,e.is_bot_message?`self-start items-start`:`self-end items-end`])},[e.is_bot_message?(z(),B(`div`,Ef,N(e.sender_name),1)):W(``,!0),e.is_bot_message?(z(),B(`div`,{key:1,class:`px-4 py-2.5 rounded-2xl rounded-bl-sm text-[13px] font-sans leading-snug whitespace-pre-wrap break-words bg-surface border border-border select-text`,innerHTML:I(_f)(e.content)},null,8,Df)):(z(),B(`div`,Of,N(e.content),1)),V(`div`,kf,N(s(e.timestamp)),1)],2)],64))),128)),r.value?(z(),B(`div`,Af,[V(`div`,{class:`px-4 py-2.5 rounded-2xl rounded-bl-sm text-[13px] font-sans leading-snug whitespace-pre-wrap break-words bg-surface border border-border select-text opacity-80`,innerHTML:I(_f)(r.value)},null,8,jf)])):W(``,!0),e.streamState.activeTool&&!r.value?(z(),B(`div`,Mf,[V(`div`,Nf,` using `+N(e.streamState.activeTool)+`... `,1)])):W(``,!0)],512),e.typingVisible&&!r.value&&!e.streamState.activeTool?(z(),B(`div`,Pf,[...n[1]||=[V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1),V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1),V(`div`,{class:`typing-dot w-1.5 h-1.5 rounded-full bg-muted`},null,-1)]])):W(``,!0)],64))}}),If={class:`w-[280px] min-w-[280px] max-md:w-full max-md:min-w-0 border-r border-border flex flex-col bg-surface`},Lf={class:`px-3 py-3 border-b border-border flex items-center gap-2`},Rf={class:`flex-1 overflow-y-auto p-1.5`},zf={key:0,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},Bf={key:1,class:`flex-1 flex flex-col items-center justify-center text-muted text-[13px] font-sans py-12`},Vf=[`onClick`,`onContextmenu`,`onTouchstart`],Hf={class:`flex-1 min-w-0`},Uf={class:`text-[13px] font-medium font-sans truncate`},Wf={class:`text-[11px] text-muted mt-0.5 truncate`},Gf=kr({__name:`ChatSidebar`,props:{items:{},loading:{type:Boolean},currentJid:{}},emits:[`select`,`delete`,`settings`,`register`,`toggle`],setup(e,{emit:t}){let n=t,r=[`bg-accent-dim text-accent`,`bg-ok-dim text-ok`,`bg-warn-dim text-warn`,`bg-danger-dim text-danger`];function i(e){let t=0;for(let n of e)t=(t<<5)-t+n.charCodeAt(0)|0;return r[Math.abs(t)%r.length]}function a(e){return(e[0]||`?`).toUpperCase()}let{menu:o,onContext:s,onTouchStart:c,cancelLongPress:l,close:u}=Gl();function d(){o.value&&n(`delete`,o.value.data),u()}function f(){o.value&&n(`settings`,o.value.data),u()}return(t,r)=>(z(),B(`div`,If,[V(`div`,Lf,[r[5]||=V(`span`,{class:`text-[13px] font-medium text-text font-sans`},`chats`,-1),r[6]||=V(`span`,{class:`flex-1`},null,-1),V(`button`,{type:`button`,class:`h-7 flex items-center justify-center text-[13px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer px-2 gap-1`,onClick:r[0]||=e=>n(`register`)},` + `),H(Sf,{onClick:r[1]||=e=>n(`toggle`)})]),V(`div`,Rf,[e.loading?(z(),B(`div`,zf,[H(I(K),{icon:`lucide:loader`,class:`animate-spin text-[20px] mb-3`}),r[7]||=V(`div`,null,`loading...`,-1)])):e.items.length===0?(z(),B(`div`,Bf,[r[8]||=V(`div`,{class:`text-[28px] mb-3 text-border`},`~`,-1),r[9]||=V(`div`,{class:`mb-4`},`no chats yet`,-1),V(`button`,{type:`button`,class:`h-9 flex items-center justify-center text-[16px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer px-3 gap-1`,onClick:r[2]||=e=>n(`register`)},` + `)])):W(``,!0),(z(!0),B(R,null,ai(e.items,t=>(z(),B(`button`,{key:t.jid,type:`button`,class:M([`w-full text-left px-2.5 py-2.5 cursor-pointer rounded-lg transition-colors hover:bg-accent-dim/50 flex items-center gap-3`,t.jid===e.currentJid?`bg-accent-dim`:``]),onClick:e=>n(`select`,t.jid),onContextmenu:e=>I(s)(e,t.jid),onTouchstart:e=>I(c)(e,t.jid),onTouchend:r[3]||=(...e)=>I(l)&&I(l)(...e),onTouchmove:r[4]||=(...e)=>I(l)&&I(l)(...e)},[V(`div`,{class:M([`w-9 h-9 rounded-full flex items-center justify-center text-[13px] font-semibold shrink-0`,i(t.name)])},N(a(t.name)),3),V(`div`,Hf,[V(`div`,Uf,N(t.name),1),V(`div`,Wf,N(t.folder?`~/${t.folder}`:t.jid.slice(0,24)),1)])],42,Vf))),128))]),H(wl,{pos:I(o)??null},{default:Gn(()=>[V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:f},` Settings `),V(`button`,{type:`button`,class:`w-full text-left px-3 py-1.5 text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:d},` Delete `)]),_:1},8,[`pos`])]))}}),Kf={class:`mb-2`},qf={key:0,class:`text-[10px] text-muted mb-2`},Jf={key:1,class:`mb-2`},Yf={class:`grid grid-cols-2 gap-2 max-md:grid-cols-1`},Xf=[`value`],Zf={class:`space-y-3`},Qf={class:`flex items-center gap-2`},$f={key:0,class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},ep=[`value`],tp=[`value`],np=[`value`],rp=[`value`],ip=[`value`],ap={class:`col-span-2 max-md:col-span-1`},op={class:`text-[12px] font-mono text-text`},sp={class:`pt-1 flex items-center justify-between`},cp={key:0,class:`flex-1 flex flex-col text-muted text-[13px] font-sans bg-bg`},lp={key:0,class:`flex shrink-0 px-4 py-3 border-b border-border items-center bg-surface`},up={class:`flex-1 flex items-center justify-center`},dp={class:`text-center text-muted`},fp={key:1,class:`flex flex-col h-full`},pp={class:`shrink-0 px-4 py-3 border-b border-border flex items-center gap-3 bg-surface`},mp={class:`w-8 h-8 rounded-full bg-accent-dim text-accent flex items-center justify-center text-[13px] font-semibold shrink-0`},hp={class:`flex-1 min-w-0 text-center`},gp={class:`text-[14px] font-medium font-sans truncate`},_p={key:0,class:`shrink-0 mx-4 mt-3 mb-1 px-4 py-3 rounded-2xl bg-surface border border-border flex flex-col items-center gap-2 text-[13px] font-sans text-center`},vp={class:`flex gap-2`},yp={key:1,class:`shrink-0 mx-4 mt-2 px-3 py-1.5 rounded-lg bg-warn/8 border border-warn/20 text-[11px] font-mono text-warn flex items-center gap-1.5`},bp={class:`font-semibold`},xp=[`disabled`,`onKeydown`],Sp=[`disabled`],Cp=kr({__name:`window`,props:{fillHeight:{type:Boolean,default:!1}},setup(e){let t=e,{state:n,set:r,setTitle:i}=ru(),a=F(n.value.jid||null),o=F([]),s=F([]),c=F([]),l=F(``),u=F(null),d=F(!1),f=vu(),p=F(!1),{confirm:m}=uu(),h=F(!0),g=F(!1),_=F(!1),v=F(!1),y=F([]),b=F(!1),x=F(),S=F(``);L(b,e=>{e&&Nn(()=>x.value?.focus())});let C=F(``),w=F(``),T=F(``),E=F(``),D=G(()=>hf(S.value.trim())),{streamState:ee}=df(a),O=G(()=>{let e=new Set,t=[];for(let n of o.value)e.add(n.jid),t.push({jid:n.jid,name:n.name,folder:n.folder,registered:!0});for(let n of s.value)e.has(n.jid)||t.push({jid:n.jid,name:n.name||n.jid,registered:!1});return t}),te=G(()=>a.value?o.value.find(e=>e.jid===a.value)?.name||a.value:`-`);L(te,e=>{i(e&&e!==`-`?`Chats — ${e}`:`Chats`)});let ne=G(()=>a.value?o.value.some(e=>e.jid===a.value):!0),k=G(()=>o.value.find(e=>e.jid===a.value)),A=G(()=>ee.value.isStreaming||ee.value.activeTool!==null);async function re(){let e=await gu(`/api/pi/models`);e&&(y.value=e.models??[])}async function j(){let[e,t]=await Promise.all([gu(`/api/groups`),gu(`/api/chats`)]);if(e&&(o.value=e),t&&(s.value=t),_.value=!0,a.value){let e=a.value;o.value.some(t=>t.jid===e)||s.value.some(t=>t.jid===e)||(a.value=null,r({jid:``}),c.value=[])}}async function ie(){if(!a.value)return;let e=await gu(`/api/messages?${new URLSearchParams({jid:a.value,limit:`200`})}`);e&&(c.value=e)}L(()=>ee.value.isStreaming,(e,t)=>{t&&!e&&ie()});function ae(e){a.value=e,r({jid:e}),f.value&&(h.value=!1),c.value=[],ie();let t=o.value.find(t=>t.jid===e);l.value=t?.requiresTrigger?`${t.trigger} `:``,setTimeout(()=>{u.value?.focus()},0)}async function oe(){if(!a.value)return;let e=l.value.trim();e&&(l.value=k.value?.requiresTrigger?`${k.value.trigger} `:``,pe(),d.value=!0,await hu(`/api/send`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:a.value,message:e})}),await ie(),d.value=!1,await Nn(),u.value?.focus())}function se(e){ae(e),v.value=!0}async function ce(e){await m(`delete chat and all messages for ${e}?`)&&(await hu(`/api/chats/${encodeURIComponent(e)}`,{method:`DELETE`}),a.value===e&&(a.value=null,c.value=[]),await j())}function le(){a.value&&(S.value=s.value.find(e=>e.jid===a.value)?.name||``,w.value=a.value,C.value=``,T.value=``,E.value=``,b.value=!0)}function ue(){b.value=!1,S.value=``,C.value=``,w.value=``,T.value=``,E.value=``}async function de(){let e=S.value.trim();if(!e)return;let t=C.value.trim()||hf(e),n=w.value.trim()||`${t}@admin`;await hu(`/api/groups`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jid:n,name:e,folder:t,trigger:T.value.trim(),model:E.value||void 0})});let r=n;ue(),await j(),ae(r)}async function fe(e,t){await hu(`/api/groups/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),await j()}function pe(){u.value&&(u.value.style.height=`auto`,u.value.style.height=`${Math.min(u.value.scrollHeight,120)}px`)}yu(j,3e4);function me(e){if(e.metaKey&&e.key===`j`&&a.value){e.preventDefault(),v.value=!v.value;return}!ne.value&&a.value&&(e.key===`Enter`&&!e.metaKey&&!e.ctrlKey&&!p.value?(e.preventDefault(),g.value?(le(),g.value=!1):g.value=!0):e.key===`Escape`&&g.value&&(e.preventDefault(),g.value=!1))}return Wr(()=>{re(),a.value&&ie(),window.addEventListener(`keydown`,me)}),Jr(()=>{window.removeEventListener(`keydown`,me)}),(e,n)=>(z(),B(`div`,{class:M([`flex overflow-hidden relative`,t.fillHeight?`h-full min-h-0`:`h-[calc(100dvh-140px)]`])},[Kn(H(Gf,{items:O.value,loading:!_.value,"current-jid":a.value,class:`max-md:absolute max-md:inset-y-0 max-md:left-0 max-md:z-10 max-md:w-[280px] max-md:min-w-0 max-md:!bg-surface`,onSelect:ae,onDelete:ce,onSettings:se,onRegister:n[0]||=e=>b.value=!0,onToggle:n[1]||=e=>h.value=!h.value},null,8,[`items`,`loading`,`current-jid`]),[[Ko,h.value]]),b.value?(z(),Aa(Ol,{key:0,title:`New chat`,width:`420px`,onClose:ue},{default:Gn(()=>[V(`form`,{onSubmit:As(de,[`prevent`]),onKeydown:Ms(ue,[`escape`])},[V(`div`,Kf,[n[24]||=V(`label`,{class:`label group/label`},[U(` name `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`display name for this chat group`)])],-1),Kn(V(`input`,{ref_key:`regNameInput`,ref:x,"onUpdate:modelValue":n[2]||=e=>S.value=e,placeholder:`My Project`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,S.value]])]),D.value?(z(),B(`div`,qf,` -> ~/`+N(D.value)+`/ · `+N(D.value)+`@admin `,1)):W(``,!0),D.value?(z(),B(`div`,Jf,[V(`div`,Yf,[V(`div`,null,[n[25]||=V(`label`,{class:`label group/label`},[U(` folder `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`agent working directory name`)])],-1),Kn(V(`input`,{"onUpdate:modelValue":n[3]||=e=>C.value=e,placeholder:`auto`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,C.value]])]),V(`div`,null,[n[26]||=V(`label`,{class:`label group/label`},[U(` jid `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`unique chat identifier`)])],-1),Kn(V(`input`,{"onUpdate:modelValue":n[4]||=e=>w.value=e,placeholder:`auto`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,w.value]])]),V(`div`,null,[n[27]||=V(`label`,{class:`label group/label`},[U(` trigger `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`word to activate the agent (e.g. @pi)`)])],-1),Kn(V(`input`,{"onUpdate:modelValue":n[5]||=e=>T.value=e,placeholder:`default`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,T.value]])]),V(`div`,null,[n[29]||=V(`label`,{class:`label group/label`},[U(` model `),V(`span`,{class:`relative inline-block ml-0.5 cursor-help`},[V(`span`,{class:`text-[9px] text-border hover:text-muted transition-colors`},`?`),V(`span`,{class:`hidden group-hover/label:block absolute left-0 top-full mt-0.5 z-10 px-1.5 py-1 bg-surface border border-border rounded text-[10px] text-muted normal-case tracking-normal whitespace-nowrap`},`override the global model for this chat`)])],-1),Kn(V(`select`,{"onUpdate:modelValue":n[6]||=e=>E.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[n[28]||=V(`option`,{value:``},`default`,-1),(z(!0),B(R,null,ai(y.value,e=>(z(),B(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},N(e.name),9,Xf))),128))],512),[[Ts,E.value]])])])])):W(``,!0),V(`div`,{class:`flex gap-2 items-center`},[n[31]||=V(`button`,{type:`submit`,class:`btn-primary`},[U(` register `),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`)],-1),V(`button`,{type:`button`,class:`btn-ghost`,onClick:ue},[...n[30]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],32)]),_:1})):W(``,!0),v.value&&a.value?(z(),Aa(Ol,{key:1,title:`chat settings`,width:`360px`,onClose:n[13]||=e=>v.value=!1},{default:Gn(()=>[V(`div`,Zf,[V(`div`,null,[n[32]||=V(`label`,{class:`label`},`status`,-1),V(`div`,Qf,[V(`span`,{class:M([`inline-block w-1.5 h-1.5 rounded-full`,k.value?`bg-ok`:`bg-warn`])},null,2),V(`span`,{class:M([`text-[12px] font-mono`,k.value?`text-ok`:`text-warn`])},N(k.value?`registered`:`unmanaged`),3)])]),k.value?(z(),B(`div`,$f,[V(`div`,null,[n[33]||=V(`label`,{class:`label`},`name`,-1),V(`input`,{value:k.value.name,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:n[7]||=e=>fe(a.value,{name:e.target.value})},null,40,ep)]),V(`div`,null,[n[34]||=V(`label`,{class:`label`},`trigger`,-1),V(`input`,{value:k.value.trigger,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:n[8]||=e=>fe(a.value,{trigger:e.target.value})},null,40,tp)]),V(`div`,null,[n[36]||=V(`label`,{class:`label`},`model`,-1),V(`select`,{value:k.value.model||``,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:n[9]||=e=>fe(a.value,{model:e.target.value||null})},[n[35]||=V(`option`,{value:``},`default`,-1),(z(!0),B(R,null,ai(y.value,e=>(z(),B(`option`,{key:`${e.provider}/${e.id}`,value:`${e.provider}/${e.id}`},N(e.name),9,rp))),128))],40,np)]),V(`div`,null,[n[38]||=V(`label`,{class:`label`},`require trigger`,-1),V(`select`,{value:k.value.requiresTrigger===!1?`false`:`true`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`,onChange:n[10]||=e=>fe(a.value,{requiresTrigger:e.target.value===`true`?null:!1})},[...n[37]||=[V(`option`,{value:`true`},`yes`,-1),V(`option`,{value:`false`},`no (all messages)`,-1)]],40,ip)]),V(`div`,ap,[n[39]||=V(`label`,{class:`label`},`folder`,-1),V(`div`,op,`~/`+N(k.value.folder)+`/`,1)])])):W(``,!0),V(`div`,sp,[V(`button`,{type:`button`,class:`btn-ghost`,onClick:n[11]||=e=>v.value=!1},[...n[40]||=[U(` close `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]]),V(`button`,{type:`button`,class:`btn-danger`,onClick:n[12]||=e=>{v.value=!1,ce(a.value)}},` delete chat `)])])]),_:1})):W(``,!0),V(`div`,{class:M([`flex-1 flex flex-col min-w-0`,p.value&&I(f)?`max-md:fixed max-md:inset-0 max-md:z-20 max-md:bg-bg`:``]),id:`chat-main`},[a.value?(z(),B(`div`,fp,[V(`div`,pp,[h.value?W(``,!0):(z(),Aa(Sf,{key:0,class:`mr-1`,onClick:n[16]||=e=>h.value=!0})),V(`div`,mp,N((te.value[0]||`?`).toUpperCase()),1),V(`div`,hp,[V(`div`,gp,N(te.value),1)]),V(`button`,{type:`button`,class:`text-muted hover:text-text leading-none transition-colors flex items-center gap-1`,title:`chat settings (⌘J)`,onClick:n[17]||=e=>v.value=!0},[H(I(K),{icon:`lucide:settings`,class:`text-base`})])]),_.value&&!ne.value?(z(),B(`div`,_p,[n[47]||=V(`div`,{class:`text-muted`},`this chat is not registered — messages won't reach the agent`,-1),g.value?(z(),B(R,{key:1},[n[46]||=V(`div`,{class:`text-[11px] text-warn font-semibold`},` only register chats you trust — registered chats get full agent access `,-1),V(`div`,vp,[V(`button`,{type:`button`,class:`px-5 py-2 bg-accent text-bg rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:bg-accent/90`,onClick:n[19]||=e=>{le(),g.value=!1}},[...n[44]||=[U(` confirm `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]]),V(`button`,{type:`button`,class:`px-4 py-2 text-muted rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:text-text`,onClick:n[20]||=e=>g.value=!1},[...n[45]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],64)):(z(),B(`button`,{key:0,type:`button`,class:`px-5 py-2 bg-accent text-bg rounded-full text-[13px] font-medium cursor-pointer transition-colors hover:bg-accent/90`,onClick:n[18]||=e=>g.value=!0},[...n[43]||=[U(` register chat `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`,-1)]]))])):W(``,!0),k.value&&k.value.requiresTrigger?(z(),B(`div`,yp,[n[48]||=V(`span`,{class:`opacity-60`},`trigger:`,-1),V(`span`,bp,N(k.value.trigger),1),n[49]||=V(`span`,{class:`opacity-50`},`— prefix messages to reach the agent`,-1)])):W(``,!0),H(Ff,{messages:c.value,"stream-state":I(ee),"typing-visible":A.value,"sending-message":d.value},null,8,[`messages`,`stream-state`,`typing-visible`,`sending-message`]),V(`form`,{autocomplete:`off`,"data-form-type":`other`,class:M([`shrink-0 px-3 py-2.5 border-t border-border flex gap-2 items-end bg-surface`,p.value&&I(f)?`max-md:absolute max-md:bottom-0 max-md:left-0 max-md:right-0`:``]),onSubmit:As(oe,[`prevent`])},[Kn(V(`textarea`,{ref_key:`composeRef`,ref:u,"onUpdate:modelValue":n[21]||=e=>l.value=e,name:`message`,placeholder:`message...`,rows:`1`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,enterkeyhint:`send`,class:`flex-1 min-h-[38px] max-h-[120px] resize-none px-4 py-2.5 rounded-2xl text-[13px] leading-snug bg-bg border border-border text-text outline-none transition-colors focus:border-accent font-sans`,disabled:d.value,onInput:pe,onKeydown:Ms(As(oe,[`exact`,`prevent`]),[`enter`]),onFocus:n[22]||=e=>p.value=!0,onBlur:n[23]||=e=>p.value=!1},null,40,xp),[[ws,l.value]]),V(`button`,{type:`submit`,class:`rounded-full w-9 h-9 p-0 flex items-center justify-center shrink-0 text-sm bg-accent text-bg cursor-pointer transition-colors hover:bg-accent/90 disabled:text-muted disabled:bg-surface disabled:border-border`,disabled:d.value},[...n[50]||=[V(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[V(`path`,{d:`M22 2L11 13`}),V(`path`,{d:`M22 2L15 22L11 13L2 9L22 2Z`})],-1)]],8,Sp)],34)])):(z(),B(`div`,cp,[h.value?W(``,!0):(z(),B(`div`,lp,[H(Sf,{onClick:n[14]||=e=>h.value=!0})])),V(`div`,up,[V(`div`,dp,[n[41]||=V(`div`,{class:`text-[28px] mb-3 text-border`},`~`,-1),n[42]||=V(`div`,{class:`mb-4`},`no chat selected`,-1),V(`button`,{type:`button`,class:`h-10 flex items-center justify-center text-[18px] bg-accent-dim text-accent rounded-full cursor-pointer transition-colors hover:bg-accent-dimmer mx-auto px-4 gap-1.5`,onClick:n[15]||=e=>b.value=!0},` + `)])])]))],2)],2))}}),wp={key:`chat`,label:`Chats`,icon:`pixelarticons:chat`,color:`#58a6ff`,component:{name:`ChatContent`,render:()=>po(Cp,{fillHeight:!0})},window:{width:1e3,height:700,minwidth:420,minheight:320}},Tp={"package.json":{icon:`lucide:package`,color:`text-ok`},".gitignore":{icon:`lucide:git-branch`,color:`text-warn`},".gitattributes":{icon:`lucide:git-branch`,color:`text-warn`},dockerfile:{icon:`lucide:container`,color:`text-accent`},license:{icon:`lucide:scale`,color:`text-muted`},makefile:{icon:`lucide:terminal`,color:`text-muted`}},Ep=[{test:e=>e.startsWith(`tsconfig`)&&e.endsWith(`.json`),result:{icon:`lucide:settings`,color:`text-accent`}},{test:e=>e.startsWith(`.env`),result:{icon:`lucide:lock`,color:`text-warn`}},{test:e=>e.endsWith(`.lock`),result:{icon:`lucide:lock`,color:`text-muted`}}],Dp={ts:{icon:`lucide:file-code`,color:`text-accent`},tsx:{icon:`lucide:file-code`,color:`text-accent`},js:{icon:`lucide:file-code`,color:`text-warn`},jsx:{icon:`lucide:file-code`,color:`text-warn`},mjs:{icon:`lucide:file-code`,color:`text-warn`},cjs:{icon:`lucide:file-code`,color:`text-warn`},vue:{icon:`lucide:file-code`,color:`text-ok`},md:{icon:`lucide:file-text`,color:`text-accent`},json:{icon:`lucide:braces`,color:`text-warn`},css:{icon:`lucide:file-code`,color:`text-accent`},scss:{icon:`lucide:file-code`,color:`text-accent`},yaml:{icon:`lucide:file-cog`,color:`text-muted`},yml:{icon:`lucide:file-cog`,color:`text-muted`},toml:{icon:`lucide:file-cog`,color:`text-muted`},sh:{icon:`lucide:terminal`,color:`text-ok`},bash:{icon:`lucide:terminal`,color:`text-ok`},zsh:{icon:`lucide:terminal`,color:`text-ok`},png:{icon:`lucide:image`,color:`text-warn`},jpg:{icon:`lucide:image`,color:`text-warn`},jpeg:{icon:`lucide:image`,color:`text-warn`},gif:{icon:`lucide:image`,color:`text-warn`},svg:{icon:`lucide:image`,color:`text-warn`},webp:{icon:`lucide:image`,color:`text-warn`},ico:{icon:`lucide:image`,color:`text-warn`},sql:{icon:`lucide:database`,color:`text-accent`},db:{icon:`lucide:database`,color:`text-accent`},sqlite:{icon:`lucide:database`,color:`text-accent`},txt:{icon:`lucide:file-text`,color:`text-muted`},log:{icon:`lucide:file-text`,color:`text-muted`},py:{icon:`lucide:file-code`,color:`text-ok`},go:{icon:`lucide:file-code`,color:`text-accent`},rs:{icon:`lucide:file-code`,color:`text-warn`},html:{icon:`lucide:file-code`,color:`text-warn`},htm:{icon:`lucide:file-code`,color:`text-warn`},xml:{icon:`lucide:file-code`,color:`text-muted`}},Op={icon:`lucide:file`,color:`text-muted`};function kp(e){let t=e.toLowerCase();if(Tp[t])return Tp[t];for(let e of Ep)if(e.test(t))return e.result;let n=t.split(`.`).pop();return n&&Dp[n]?Dp[n]:Op}function Ap(e){return{icon:e?`lucide:folder-open`:`lucide:folder`,color:`text-accent`}}var jp=[`onClick`],Mp={key:1,class:`inline-block w-3`},Np=kr({__name:`FileTree`,props:{nodes:{},depth:{},activeFolder:{},activePath:{}},emits:[`toggle`,`select`,`open`],setup(e,{emit:t}){let n=t;return(t,r)=>{let i=ei(`FileTree`,!0);return z(!0),B(R,null,ai(e.nodes,t=>(z(),B(`div`,{key:t.folder+`/`+t.path},[V(`button`,{type:`button`,class:M([`w-full text-left py-1 text-[11px] font-mono transition-colors block truncate`,t.isFile?`text-muted hover:text-text`:t.folder===e.activeFolder&&t.path===e.activePath?`bg-surface text-text`:`text-muted hover:text-text`]),style:_e({paddingLeft:(e.depth??0)*12+8+`px`,paddingRight:`8px`}),onClick:e=>t.isFile?n(`open`,t):(n(`toggle`,t),n(`select`,t))},[t.isFile?(z(),B(R,{key:1},[r[3]||=V(`span`,{class:`inline-block w-3`},null,-1),H(I(K),{icon:I(kp)(t.name).icon,class:M([I(kp)(t.name).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)):(z(),B(R,{key:0},[t.children?.length||!t.loaded?(z(),Aa(I(K),{key:0,icon:t.expanded?`lucide:chevron-down`:`lucide:chevron-right`,class:`inline-block w-3 h-3 align-[-2px] text-muted`},null,8,[`icon`])):(z(),B(`span`,Mp)),H(I(K),{icon:I(Ap)(t.expanded).icon,class:M([I(Ap)(t.expanded).color,`inline-block w-3.5 h-3.5 align-[-3px] mx-0.5`])},null,8,[`icon`,`class`])],64)),U(` `+N(t.name),1)],14,jp),!t.isFile&&t.expanded&&t.children&&t.children.length>0?(z(),Aa(i,{key:0,nodes:t.children,depth:(e.depth??0)+1,"active-folder":e.activeFolder,"active-path":e.activePath,onToggle:r[0]||=e=>n(`toggle`,e),onSelect:r[1]||=e=>n(`select`,e),onOpen:r[2]||=e=>n(`open`,e)},null,8,[`nodes`,`depth`,`active-folder`,`active-path`])):W(``,!0)]))),128)}}}),Pp={class:`flex h-full`},Fp={key:0,class:`w-[180px] min-w-[140px] border-r border-border overflow-auto py-2 flex-shrink-0`},Ip={key:0,class:`px-3 py-4 text-[11px] text-muted`},Lp={class:`flex-1 flex flex-col min-w-0`},Rp={class:`px-3 py-1.5 text-[11px] text-muted flex items-center gap-1 border-b border-border`},zp={key:0,class:`opacity-40`},Bp=[`onClick`],Vp={class:`ml-auto flex items-center gap-1 flex-shrink-0`},Hp={key:0,class:`text-center py-8 text-muted text-[12px]`},Up=[`onClick`,`onDblclick`],Wp={key:2,class:`grid grid-cols-[repeat(auto-fill,minmax(80px,1fr))] gap-1`},Gp=[`onClick`,`onDblclick`],Kp={class:`text-[10px] font-mono text-center w-full truncate text-accent`},qp={key:3,class:`w-full border-collapse text-[12px]`},Jp={key:1},Yp=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],Xp={class:`py-1.5 px-2 border-b border-border font-mono`},Zp={key:0,class:`inline-flex items-center gap-1.5 text-accent`},Qp={key:1,class:`inline-flex items-center gap-1.5`},$p={class:`py-1.5 px-2 border-b border-border text-muted`},em={class:`py-1.5 px-2 border-b border-border text-muted`},tm={key:1,class:`text-center py-8 text-muted text-[12px]`},nm={class:`grid grid-cols-[repeat(auto-fill,minmax(80px,1fr))] gap-1`},rm=[`onClick`,`onDblclick`,`onContextmenu`,`onTouchstart`],im={key:`files`,label:`Files`,icon:`pixelarticons:folder`,color:`#7fd962`,component:kr({__name:`window`,setup(e){let{confirm:t}=uu(),n=vu(),{settings:r,set:i}=eu(),{state:a,set:o,openWindow:s,setTitle:c}=ru(),{menu:l,onContext:u,onTouchStart:d,cancelLongPress:f,close:p}=Gl(),m=F([]),h=F([]),g=F(a.value.folder||``),_=F(a.value.path||`.`),v=F([]),y=F(-1),b=F(),x=F(r.filesViewMode??(n.value?`grid`:`list`)),S=F(window.innerWidth>=640),C=G(()=>{let e=[`~`];return g.value?(e.push(g.value),_.value!==`.`&&e.push(..._.value.split(`/`)),e):e}),w=G(()=>[...v.value].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1)),T={jid:`.pi`,name:`~/.pi`,folder:`.pi`};async function E(){let e=await gu(`/api/groups`);if(!e)return;let t=[T,...e];m.value=t;let n=new Set(h.value.map(e=>e.folder));for(let e of t)n.has(e.folder)||h.value.push({name:e.folder,path:`.`,folder:e.folder,expanded:!1,loaded:!1});h.value=h.value.filter(e=>t.some(t=>t.folder===e.folder)),ne()}async function D(e){let t=await gu(`/api/files?${new URLSearchParams({folder:e.folder,path:e.path})}`);t&&(e.children=[...t.entries].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1).map(t=>({name:t.name,path:e.path===`.`?t.name:`${e.path}/${t.name}`,folder:e.folder,isFile:t.type===`file`,expanded:!1,loaded:t.type===`file`})),e.loaded=!0)}async function ee(e){if(e.expanded){e.expanded=!1;return}e.loaded||await D(e),e.expanded=!0}function O(e){g.value=e.folder,_.value=e.path}function te(e){g.value=e.folder;let t=e.path.split(`/`);t.pop(),_.value=t.length>0?t.join(`/`):`.`,s(`viewer`,{folder:e.folder,path:e.path})}async function ne(){if(!g.value)return;let e=h.value.find(e=>e.folder===g.value&&e.path===`.`);if(!e||(e.expanded=!0,e.loaded||await D(e),_.value===`.`))return;let t=_.value.split(`/`).filter(Boolean),n=e;for(let e of t){if(!n.children)return;let t=n.children.find(t=>t.name===e&&!t.isFile);if(t||=(n.loaded||await D(n),n.children?.find(t=>t.name===e&&!t.isFile)),!t)return;t.expanded=!0,t.loaded||await D(t),n=t}}async function k(){if(!g.value)return;let e=await gu(`/api/files?${new URLSearchParams({folder:g.value,path:_.value})}`);e&&(v.value=e.entries),y.value=0}function A(e){let t=_.value===`.`?e:`${_.value}/${e}`;s(`viewer`,{folder:g.value,path:t})}async function re(e){if(!await t(`delete ${e.name+(e.type===`directory`?`/`:``)}?`))return;let n=_.value===`.`?e.name:`${_.value}/${e.name}`;await gu(`/api/files/delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folder:g.value,path:n})}),await k(),v.value.length===0&&_.value!==`.`?j(`..`):y.value=Math.min(y.value,w.value.length-1)}function j(e){if(e===`..`){if(_.value===`.`){g.value=``,v.value=[];return}let e=_.value.split(`/`);e.pop(),_.value=e.length>0?e.join(`/`):`.`;return}_.value=_.value===`.`?e:`${_.value}/${e}`}function ie(e){g.value=e.folder,_.value=`.`}function ae(e){n.value&&ie(e)}function oe(e,t){y.value=t,!(!n.value||l.value)&&(e.type===`directory`?j(e.name):A(e.name))}function se(e){if(e===0){g.value=``,_.value=`.`,v.value=[];return}e===1?_.value=`.`:_.value=_.value.split(`/`).slice(0,e-1).join(`/`)}L(g,e=>o({folder:e})),L(_,e=>o({path:e})),L(x,e=>{o({viewMode:e}),i({filesViewMode:e})}),L(()=>r.filesViewMode,e=>{e&&e!==x.value&&(x.value=e)}),L([g,_],([e,t])=>{if(!e)return c(`Files`);c(`Files — ${t&&t!==`.`?`${e}/${t}`:e}`)});let ce;function le(){if(ce?.close(),!g.value)return;let e=new URLSearchParams({folder:g.value,path:_.value}),t=new EventSource(`/api/files/watch?${e}`);t.onmessage=()=>k(),ce=t}L([g,_],()=>{k(),le(),ne()},{immediate:!0}),Jr(()=>ce?.close()),yu(E,1e4);function ue(){l.value&&re(l.value.data),p()}function de(){if(!l.value)return;let e=l.value.data;e.type===`directory`?j(e.name):A(e.name),p()}function fe(){let e=b.value?.clientWidth??0;return e<=0?1:Math.max(1,Math.floor((e+4)/84))}function pe(e){if(e.key===`Delete`||e.key===`Backspace`||e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&e.key.toLowerCase()===`u`){e.preventDefault(),j(`..`);return}let t=w.value;if(!t.length)return;let n=Math.max(y.value,0);if(y.value<0&&(y.value=0),[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key)){e.preventDefault();let r=n;if(x.value===`grid`){let t=fe();e.key===`ArrowLeft`?r=n-1:e.key===`ArrowRight`?r=n+1:e.key===`ArrowUp`?r=n-t:e.key===`ArrowDown`&&(r=n+t)}else e.key===`ArrowLeft`||e.key===`ArrowUp`?r=n-1:(e.key===`ArrowRight`||e.key===`ArrowDown`)&&(r=n+1);y.value=Math.max(0,Math.min(r,t.length-1))}else if(e.key===`Enter`){e.preventDefault();let n=t[y.value];n&&(n.type===`directory`?j(n.name):A(n.name))}}function me(e){return e===void 0?`-`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}return(e,t)=>(z(),B(`div`,Pp,[S.value?(z(),B(`div`,Fp,[h.value.length===0?(z(),B(`div`,Ip,`no groups`)):W(``,!0),H(Np,{nodes:h.value,"active-folder":g.value,"active-path":_.value,onToggle:ee,onSelect:O,onOpen:te},null,8,[`nodes`,`active-folder`,`active-path`])])):W(``,!0),V(`div`,Lp,[V(`div`,Rp,[V(`button`,{type:`button`,class:M([`btn-sm hover:bg-surface mr-1`,S.value?`text-text`:``]),onClick:t[0]||=e=>S.value=!S.value},[H(I(K),{icon:`lucide:panel-left`,class:`w-3 h-3`})],2),(z(!0),B(R,null,ai(C.value,(e,t)=>(z(),B(R,{key:t},[t>0?(z(),B(`span`,zp,`/`)):W(``,!0),V(`button`,{type:`button`,class:M([`hover:text-text transition-colors`,t===C.value.length-1?`text-text`:``]),onClick:e=>se(t)},N(t===0?`~/`:e),11,Bp)],64))),128)),V(`div`,Vp,[V(`button`,{type:`button`,class:M([`btn-sm hover:bg-surface`,x.value===`list`?`text-text`:``]),onClick:t[1]||=e=>x.value=`list`},[H(I(K),{icon:`lucide:list`,class:`w-3 h-3`})],2),V(`button`,{type:`button`,class:M([`btn-sm hover:bg-surface`,x.value===`grid`?`text-text`:``]),onClick:t[2]||=e=>x.value=`grid`},[H(I(K),{icon:`lucide:layout-grid`,class:`w-3 h-3`})],2),g.value?(z(),B(`button`,{key:0,type:`button`,class:`btn-sm hover:bg-surface`,onClick:k},` refresh `)):W(``,!0)])]),V(`div`,{ref_key:`listingEl`,ref:b,class:`flex-1 overflow-auto p-3 outline-none`,tabindex:`0`,onKeydown:pe},[!g.value&&m.value.length===0?(z(),B(`div`,Hp,` no groups `)):!g.value&&x.value===`list`?(z(!0),B(R,{key:1},ai(m.value,e=>(z(),B(`div`,{key:e.jid,class:`flex items-center gap-1.5 px-2 py-1.5 font-mono text-[12px] text-accent hover:bg-surface cursor-pointer rounded`,onClick:t=>ae(e),onDblclick:t=>ie(e)},[H(I(K),{icon:`lucide:folder`,class:`w-3.5 h-3.5 flex-shrink-0`}),U(` `+N(e.folder)+`/ `,1)],40,Up))),128)):g.value?x.value===`list`?(z(),B(`table`,qp,[t[11]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` name `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[80px]`},` size `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[80px]`},` modified `)])],-1),V(`tbody`,null,[_.value===`.`?W(``,!0):(z(),B(`tr`,{key:0,class:`hover:bg-surface cursor-pointer`,onClick:t[3]||=e=>j(`..`)},[...t[9]||=[V(`td`,{colspan:`3`,class:`py-1.5 px-2 border-b border-border font-mono text-muted`},` .. `,-1)]])),w.value.length===0?(z(),B(`tr`,Jp,[...t[10]||=[V(`td`,{colspan:`3`,class:`text-center py-8 text-muted text-[12px]`},`empty directory`,-1)]])):W(``,!0),(z(!0),B(R,null,ai(w.value,(e,n)=>(z(),B(`tr`,{key:e.name,class:M([`cursor-pointer`,n===y.value?`bg-surface`:`hover:bg-surface`]),onClick:t=>oe(e,n),onDblclick:t=>e.type===`directory`?j(e.name):A(e.name),onContextmenu:t=>I(u)(t,e),onTouchstart:t=>I(d)(t,e),onTouchend:t[4]||=(...e)=>I(f)&&I(f)(...e),onTouchmove:t[5]||=(...e)=>I(f)&&I(f)(...e)},[V(`td`,Xp,[e.type===`directory`?(z(),B(`span`,Zp,[H(I(K),{icon:I(Ap)(!1).icon,class:`w-3.5 h-3.5 flex-shrink-0`},null,8,[`icon`]),U(` `+N(e.name)+`/ `,1)])):(z(),B(`span`,Qp,[H(I(K),{icon:I(kp)(e.name).icon,class:M([I(kp)(e.name).color,`w-3.5 h-3.5 flex-shrink-0`])},null,8,[`icon`,`class`]),U(` `+N(e.name),1)]))]),V(`td`,$p,N(me(e.size)),1),V(`td`,em,N(I(pf)(e.mtime)),1)],42,Yp))),128))])])):(z(),B(R,{key:4},[_.value===`.`?W(``,!0):(z(),B(`div`,{key:0,class:`flex items-center gap-1.5 px-2 py-1.5 mb-1 font-mono text-[12px] text-muted hover:bg-surface cursor-pointer rounded`,onClick:t[6]||=e=>j(`..`)},` .. `)),w.value.length===0?(z(),B(`div`,tm,` empty directory `)):W(``,!0),V(`div`,nm,[(z(!0),B(R,null,ai(w.value,(e,n)=>(z(),B(`div`,{key:e.name,class:M([`flex flex-col items-center gap-1 p-2 rounded cursor-pointer select-none`,n===y.value?`bg-surface`:`hover:bg-surface`]),onClick:t=>oe(e,n),onDblclick:t=>e.type===`directory`?j(e.name):A(e.name),onContextmenu:t=>I(u)(t,e),onTouchstart:t=>I(d)(t,e),onTouchend:t[7]||=(...e)=>I(f)&&I(f)(...e),onTouchmove:t[8]||=(...e)=>I(f)&&I(f)(...e)},[e.type===`directory`?(z(),Aa(I(K),{key:0,icon:I(Ap)(!1).icon,class:`w-7 h-7 text-accent`},null,8,[`icon`])):(z(),Aa(I(K),{key:1,icon:I(kp)(e.name).icon,class:M([I(kp)(e.name).color,`w-7 h-7`])},null,8,[`icon`,`class`])),V(`span`,{class:M([`text-[10px] font-mono text-center w-full truncate`,e.type===`directory`?`text-accent`:`text-text`])},N(e.name),3)],42,rm))),128))])],64)):(z(),B(`div`,Wp,[(z(!0),B(R,null,ai(m.value,e=>(z(),B(`div`,{key:e.jid,class:`flex flex-col items-center gap-1 p-2 rounded cursor-pointer select-none hover:bg-surface`,onClick:t=>ae(e),onDblclick:t=>ie(e)},[H(I(K),{icon:`lucide:folder`,class:`w-7 h-7 text-accent`}),V(`span`,Kp,N(e.folder),1)],40,Gp))),128))]))],544)]),H(wl,{pos:I(l)??null},{default:Gn(()=>[V(`button`,{class:`w-full text-left px-3 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-accent-dim hover:text-accent`,onClick:de},` Open `),V(`button`,{class:`w-full text-left px-3 py-1.5 text-[12px] text-text cursor-pointer transition-colors hover:bg-danger-dim hover:text-danger`,onClick:ue},` Delete `)]),_:1},8,[`pos`])]))}}),window:{width:800,height:520,minwidth:480,minheight:300}},am={class:`flex flex-col h-full`},om={class:`flex gap-2 items-center p-3 pb-0`},sm=[`value`],cm={class:`flex-1 overflow-auto p-3 pt-2 select-text relative`},lm={class:`w-full border-collapse text-[12px] table-fixed`},um={key:0},dm={colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},fm={key:1},pm={class:`py-1.5 px-2 border-b border-border align-top`},mm={class:`mt-0.5`},hm={class:`badge-muted`},gm=[`title`],_m={class:`badge-muted whitespace-nowrap`},vm={class:`py-1.5 px-2 border-b border-border font-mono select-text break-all align-top`},ym=[`innerHTML`],bm={key:`logs`,label:`Logs`,icon:`pixelarticons:list-box`,color:`#e5a535`,component:kr({__name:`window`,setup(e){let t={10:`debug`,20:`info`,30:`warn`,40:`error`,50:`fatal`},n=F([]),r=F(!0),i=F(``),a=F(``),o=F([]),s;function c(){s?.close(),r.value=!0;let e=new URLSearchParams({limit:`200`});i.value&&e.set(`level`,i.value),a.value&&e.set(`tag`,a.value);let t=new EventSource(`/api/logs?${e}`);t.onmessage=e=>{try{let t=JSON.parse(e.data);n.value=t,r.value=!1;let i=new Set(t.map(e=>e.tag));for(let e of i)o.value.includes(e)||o.value.push(e);o.value.sort()}catch{}},s=t}Wr(()=>{c()}),Jr(()=>{s?.close()}),L([i,a],c);function l(e){return t[e]??String(e)}function u(e){return e>=40?`badge-danger`:e>=30?`badge-warn`:e>=20?`badge-accent`:`badge-muted`}function d(e){return JSON.stringify(e,null,2).replace(/^\{\n/,``).replace(/\n\}$/,``).replace(/^ /gm,``).replace(/("(?:\\.|[^"\\])*")\s*(:)?|(\b(?:true|false|null)\b)|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g,(e,t,n,r,i)=>t?n?`<span class="text-accent">${f(t)}</span>:`:`<span class="text-green">${f(t)}</span>`:r?`<span class="text-warn">${e}</span>`:i?`<span class="text-danger">${e}</span>`:e)}function f(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}return(e,t)=>(z(),B(`div`,am,[V(`div`,om,[t[4]||=V(`h3`,{class:`section-title`},`system logs`,-1),Kn(V(`select`,{"onUpdate:modelValue":t[0]||=e=>a.value=e,class:`ml-auto bg-bg border border-border rounded text-text px-2 py-1 text-[11px] font-mono outline-none transition-colors focus:border-accent`},[t[2]||=V(`option`,{value:``},`all tags`,-1),(z(!0),B(R,null,ai(o.value,e=>(z(),B(`option`,{key:e,value:e},N(e),9,sm))),128))],512),[[Ts,a.value]]),Kn(V(`select`,{"onUpdate:modelValue":t[1]||=e=>i.value=e,class:`bg-bg border border-border rounded text-text px-2 py-1 text-[11px] font-mono outline-none transition-colors focus:border-accent`},[...t[3]||=[Ra(`<option value="">all levels</option><option value="10">debug+</option><option value="20">info+</option><option value="30">warn+</option><option value="40">error+</option><option value="50">fatal</option>`,6)]],512),[[Ts,i.value]])]),V(`div`,cm,[V(`table`,lm,[t[7]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide w-[90px]`},` info `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` message `)])],-1),V(`tbody`,null,[r.value?(z(),B(`tr`,um,[V(`td`,dm,[H(I(K),{icon:`lucide:loader`,class:`inline-block align-[-2px] mr-1 animate-spin`}),t[5]||=U(`loading... `,-1)])])):n.value.length===0?(z(),B(`tr`,fm,[...t[6]||=[V(`td`,{colspan:`2`,class:`text-center py-8 text-muted text-[12px]`},`no logs`,-1)]])):W(``,!0),(z(!0),B(R,null,ai(n.value,e=>(z(),B(`tr`,{key:e.timestamp,class:`hover:bg-surface`},[V(`td`,pm,[V(`span`,{class:M(u(e.level))},[H(I(K),{icon:`lucide:signal`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(N(l(e.level)),1)],2),V(`div`,mm,[V(`span`,hm,[H(I(K),{icon:`lucide:tag`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(N(e.tag),1)])]),V(`div`,{class:`mt-0.5`,title:e.timestamp},[V(`span`,_m,[H(I(K),{icon:`lucide:clock`,class:`inline-block align-[-2px] mr-0.5 text-[10px]`}),U(N(I(pf)(e.timestamp)),1)])],8,gm)]),V(`td`,vm,[V(`span`,null,N(e.message),1),e.data?(z(),B(`pre`,{key:0,class:`whitespace-pre-wrap m-0 mt-1 text-muted text-[11px]`,innerHTML:d(e.data)},null,8,ym)):W(``,!0)])]))),128))])])])]))}}),window:{width:800,height:500,minwidth:400,minheight:280}},xm={class:`grid gap-3 p-3`},Sm={class:`border border-border p-3`},Cm={class:`flex gap-2`},wm=[`onClick`],Tm={class:`border border-border p-3`},Em={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},Dm=[`checked`],Om={key:0,class:`ml-5 mt-1.5 grid gap-1.5`},km={class:`flex gap-2`},Am=[`onClick`],jm={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text`},Mm=[`checked`],Nm={class:`flex items-center gap-2 cursor-pointer text-[12px] text-text mt-1.5`},Pm=[`checked`],Fm=kr({__name:`DashTab`,setup(e){let{settings:t,set:n}=eu(),r=[`small`,`medium`,`large`],i=[`12h`,`24h`];return(e,a)=>(z(),B(`div`,xm,[V(`div`,Sm,[a[3]||=V(`h3`,{class:`section-title mb-2`},`dock size`,-1),V(`div`,Cm,[(z(),B(R,null,ai(r,e=>V(`button`,{key:e,type:`button`,class:M([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,I(t).dockSize===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>I(n)({dockSize:e})},N(e),11,wm)),64))])]),V(`div`,Tm,[a[7]||=V(`h3`,{class:`section-title mb-2`},`dock`,-1),V(`label`,Em,[V(`input`,{type:`checkbox`,checked:I(t).showClock,class:`accent-accent`,onChange:a[0]||=e=>I(n)({showClock:!I(t).showClock,showStatus:!I(t).showClock})},null,40,Dm),a[4]||=U(` show clock `,-1)]),I(t).showClock?(z(),B(`div`,Om,[V(`div`,km,[(z(),B(R,null,ai(i,e=>V(`button`,{key:e,type:`button`,class:M([`px-2 py-1 text-[11px] rounded border transition-colors cursor-pointer`,I(t).clockFormat===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>I(n)({clockFormat:e})},N(e),11,Am)),64))]),V(`label`,jm,[V(`input`,{type:`checkbox`,checked:I(t).showStatus,class:`accent-accent`,onChange:a[1]||=e=>I(n)({showStatus:!I(t).showStatus})},null,40,Mm),a[5]||=U(` show status indicator `,-1)])])):W(``,!0),V(`label`,Nm,[V(`input`,{type:`checkbox`,checked:I(t).showFullscreen,class:`accent-accent`,onChange:a[2]||=e=>I(n)({showFullscreen:!I(t).showFullscreen})},null,40,Pm),a[6]||=U(` show fullscreen button `,-1)])])]))}}),Im={class:`grid gap-3 p-3`},Lm={class:`border border-border p-3`},Rm={class:`flex gap-2`},zm=[`onClick`],Bm={class:`border border-border p-3`},Vm={class:`flex gap-2`},Hm={class:`border border-border p-3`},Um={class:`flex gap-1.5 mb-2`},Wm=[`onClick`],Gm={key:0,class:`text-[11px] text-muted`},Km={key:1,class:`grid grid-cols-3 gap-1.5`},qm=[`onClick`],Jm=[`src`,`alt`],Ym={class:`border border-border p-3`},Xm={class:`flex gap-2`},Zm=kr({__name:`DesktopTab`,setup(e){let{settings:t,set:n}=eu(),r=[`dark`,`light`,`system`],i=G(()=>t.iconLayout),a=G(()=>t.wallpaper),o=F(a.value),s=[`general`,`anime`,`people`],c={general:`100`,anime:`010`,people:`001`},l=F(`general`);function u(e){l.value!==e&&(l.value=e,p())}let d=F([]),f=F(!1);async function p(){f.value=!0;try{d.value=(await(await fetch(`/proxy/wallhaven/search?categories=${c[l.value]}&purity=100&sorting=toplist&order=desc&ratios=16x9&per_page=6`)).json()).data.map(e=>({id:e.id,thumb:e.thumbs.small,full:e.path}))}catch{}finally{f.value=!1}}function m(e){o.value=e,n({wallpaper:e})}function h(){m(o.value.trim())}function g(){m(``)}return Wr(p),(e,c)=>(z(),B(`div`,Im,[V(`div`,Lm,[c[3]||=V(`h3`,{class:`section-title mb-2`},`theme`,-1),V(`div`,Rm,[(z(),B(R,null,ai(r,e=>V(`button`,{key:e,type:`button`,class:M([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,I(t).theme===e?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:t=>I(n)({theme:e})},N(e),11,zm)),64))])]),V(`div`,Bm,[c[4]||=V(`h3`,{class:`section-title mb-2`},`layout`,-1),V(`div`,Vm,[V(`button`,{type:`button`,class:M([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,i.value===`list`?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:c[0]||=e=>I(n)({iconLayout:`list`})},` list `,2),V(`button`,{type:`button`,class:M([`px-3 py-1.5 text-[12px] rounded border transition-colors cursor-pointer`,i.value===`grid`?`border-accent text-accent bg-accent-dim`:`border-border text-text hover:border-muted`]),onClick:c[1]||=e=>I(n)({iconLayout:`grid`})},` grid `,2)])]),V(`div`,Hm,[c[5]||=V(`h3`,{class:`section-title mb-2`},[U(` wallpapers `),V(`a`,{href:`https://wallhaven.cc`,target:`_blank`,class:`text-accent hover:underline normal-case tracking-normal`},`wallhaven.cc`)],-1),V(`div`,Um,[(z(),B(R,null,ai(s,e=>V(`button`,{key:e,type:`button`,class:M([`px-2 py-1 text-[10px] uppercase tracking-wider rounded border transition-colors cursor-pointer`,l.value===e?`border-accent text-accent bg-accent-dim`:`border-border text-muted hover:border-muted`]),onClick:t=>u(e)},N(e),11,Wm)),64))]),f.value?(z(),B(`div`,Gm,`loading...`)):(z(),B(`div`,Km,[(z(!0),B(R,null,ai(d.value,e=>(z(),B(`button`,{key:e.id,type:`button`,class:M([`relative rounded border cursor-pointer overflow-hidden transition-all aspect-video`,a.value===e.full?`border-accent`:`border-border hover:border-muted`]),onClick:t=>m(e.full)},[V(`img`,{src:e.thumb,alt:`wallpaper ${e.id}`,class:`w-full h-full object-cover`,loading:`lazy`},null,8,Jm)],10,qm))),128))]))]),V(`div`,Ym,[c[7]||=V(`h3`,{class:`section-title mb-2`},`custom url`,-1),V(`form`,{onSubmit:As(h,[`prevent`])},[Kn(V(`input`,{"onUpdate:modelValue":c[2]||=e=>o.value=e,type:`text`,placeholder:`https://example.com/bg.jpg`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent mb-2`},null,512),[[ws,o.value]]),V(`div`,Xm,[c[6]||=V(`button`,{type:`submit`,class:`btn-primary`},`apply`,-1),a.value?(z(),B(`button`,{key:0,type:`button`,class:`btn-danger`,onClick:g},`clear`)):W(``,!0)])],32)])]))}}),Qm={class:`flex flex-col h-full`},$m={class:`px-3 pt-3 border-b border-border flex items-center gap-2`},eh={key:`settings`,label:`Settings`,icon:`pixelarticons:sliders`,color:`#c5cdd8`,component:kr({__name:`window`,setup(e){let t=[`desktop`,`dash`],{state:n,set:r}=ru(),i=F(t.includes(n.value.tab)?n.value.tab:`desktop`);return L(i,e=>r({tab:e})),(e,t)=>(z(),B(`div`,Qm,[V(`div`,$m,[V(`button`,{type:`button`,class:M(i.value===`desktop`?`tab-active`:`tab-inactive`),onClick:t[0]||=e=>i.value=`desktop`},` desktop `,2),V(`button`,{type:`button`,class:M(i.value===`dash`?`tab-active`:`tab-inactive`),onClick:t[1]||=e=>i.value=`dash`},` dash `,2)]),i.value===`desktop`?(z(),Aa(Zm,{key:0})):i.value===`dash`?(z(),Aa(Fm,{key:1})):W(``,!0)]))}}),window:{width:720,height:560,minwidth:400,minheight:300}},th={class:`grid gap-3 p-3`},nh={class:`border border-border p-3`},rh={class:`w-full border-collapse text-[12px]`},ih={class:`hover:bg-surface`},ah={class:`py-1.5 px-2 border-b border-border`},oh={class:`hover:bg-surface`},sh={class:`py-1.5 px-2 border-b border-border`},ch={class:`hover:bg-surface`},lh={class:`py-1.5 px-2 border-b border-border`},uh={class:`hover:bg-surface`},dh={class:`py-1.5 px-2`},fh={class:`border border-border p-3`},ph={class:`w-full border-collapse text-[12px]`},mh={class:`hover:bg-surface`},hh={class:`py-1.5 px-2 border-b border-border`},gh={class:`hover:bg-surface`},_h={class:`py-1.5 px-2 border-b border-border`},vh={class:`hover:bg-surface`},yh={class:`py-1.5 px-2`},bh={key:`overview`,label:`System`,icon:`pixelarticons:monitor`,color:`#3fb950`,component:kr({__name:`window`,setup(e){let t=F(null);async function n(){let e=await gu(`/api/status`);e&&(t.value=e)}return yu(n,5e3),(e,n)=>(z(),B(`div`,th,[V(`div`,nh,[n[4]||=V(`h3`,{class:`section-title mb-2`},`system`,-1),V(`table`,rh,[V(`tbody`,null,[V(`tr`,ih,[n[0]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`uptime`,-1),V(`td`,ah,N(t.value?I(mf)(t.value.uptimeMs):`-`),1)]),V(`tr`,oh,[n[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`agents`,-1),V(`td`,sh,N(t.value?.activeAgents??`-`),1)]),V(`tr`,ch,[n[2]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`queue`,-1),V(`td`,lh,N(t.value?.queueSize??`-`),1)]),V(`tr`,uh,[n[3]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`assistant`,-1),V(`td`,dh,N(t.value?.assistantName??`-`),1)])])])]),V(`div`,fh,[n[8]||=V(`h3`,{class:`section-title mb-2`},`overview`,-1),V(`table`,ph,[V(`tbody`,null,[V(`tr`,mh,[n[5]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`groups`,-1),V(`td`,hh,N(t.value?.groupCount??`-`),1)]),V(`tr`,gh,[n[6]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`chats`,-1),V(`td`,_h,N(t.value?.chatCount??`-`),1)]),V(`tr`,vh,[n[7]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`tasks`,-1),V(`td`,yh,N(t.value?.activeTaskCount??`-`),1)])])])])]))}}),window:{width:460,height:500,minwidth:320,minheight:260}},xh={class:`p-3`},Sh={class:`flex gap-2 items-center mb-2`},Ch={class:`grid grid-cols-2 gap-3 max-md:grid-cols-1`},wh={class:`mb-2`},Th={class:`mb-2`},Eh={class:`mb-2`},Dh={class:`mb-2`},Oh={class:`mb-2`},kh={class:`w-full border-collapse text-[12px]`},Ah={key:0},jh=[`title`],Mh={class:`py-1.5 px-2 border-b border-border text-muted`},Nh={class:`py-1.5 px-2 border-b border-border text-muted`},Ph={class:`py-1.5 px-2 border-b border-border`},Fh={class:`py-1.5 px-2 border-b border-border text-muted`},Ih=[`title`],Lh={class:`py-1.5 px-2 border-b border-border`},Rh=[`onClick`],zh=[`onClick`],Bh={key:`tasks`,label:`Tasks`,icon:`pixelarticons:checklist`,color:`#d29922`,component:kr({__name:`window`,setup(e){let{alert:t}=uu(),n=F([]),r=F(!1),i=F(``),a=F(`cron`),o=F(``),s=F(`group`),c=F(``);async function l(){n.value=await gu(`/api/tasks`)??[]}function u(){r.value=!1,i.value=``,a.value=`cron`,o.value=``,s.value=`group`,c.value=``}async function d(){if(!i.value.trim()||!o.value.trim()||!c.value.trim()){await t(`jid, schedule, and prompt are required`);return}await hu(`/api/tasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({chatJid:i.value.trim(),scheduleType:a.value,scheduleValue:o.value.trim(),contextMode:s.value,prompt:c.value.trim()})}),u(),await l()}async function f(e,t){await hu(`/api/tasks/${encodeURIComponent(e)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})}),await l()}return yu(l,5e3),(e,t)=>(z(),B(`div`,xh,[V(`div`,Sh,[t[6]||=V(`h3`,{class:`section-title`},`tasks`,-1),V(`button`,{type:`button`,class:`ml-auto btn-primary`,onClick:t[0]||=e=>r.value=!0},`+ new task`)]),r.value?(z(),Aa(Ol,{key:0,title:`new task`,width:`520px`,onClose:u},{default:Gn(()=>[V(`form`,{onSubmit:As(d,[`prevent`]),onKeydown:Ms(u,[`escape`])},[V(`div`,Ch,[V(`div`,wh,[t[7]||=V(`label`,{class:`label`},`chat jid`,-1),Kn(V(`input`,{"onUpdate:modelValue":t[1]||=e=>i.value=e,placeholder:`xxxx@g.us`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,i.value]])]),V(`div`,Th,[t[9]||=V(`label`,{class:`label`},`schedule type`,-1),Kn(V(`select`,{"onUpdate:modelValue":t[2]||=e=>a.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[...t[8]||=[V(`option`,{value:`cron`},`cron`,-1),V(`option`,{value:`interval`},`interval`,-1),V(`option`,{value:`once`},`once`,-1)]],512),[[Ts,a.value]])]),V(`div`,Eh,[t[10]||=V(`label`,{class:`label`},`schedule value`,-1),Kn(V(`input`,{"onUpdate:modelValue":t[3]||=e=>o.value=e,placeholder:`*/5 * * * * or 300000`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,o.value]])]),V(`div`,Dh,[t[12]||=V(`label`,{class:`label`},`context`,-1),Kn(V(`select`,{"onUpdate:modelValue":t[4]||=e=>s.value=e,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},[...t[11]||=[V(`option`,{value:`group`},`group (shared)`,-1),V(`option`,{value:`isolated`},`isolated`,-1)]],512),[[Ts,s.value]])])]),V(`div`,Oh,[t[13]||=V(`label`,{class:`label`},`prompt`,-1),Kn(V(`textarea`,{"onUpdate:modelValue":t[5]||=e=>c.value=e,placeholder:`what should the agent do?`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent resize-y min-h-[60px]`},null,512),[[ws,c.value]])]),V(`div`,{class:`flex gap-2 items-center`},[t[15]||=V(`button`,{type:`submit`,class:`btn-primary`},[U(` create `),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`↵`)],-1),V(`button`,{type:`button`,class:`btn-ghost`,onClick:u},[...t[14]||=[U(` cancel `,-1),V(`span`,{class:`text-[9px] opacity-60 hidden sm:inline`},`esc`,-1)]])])],32)]),_:1})):W(``,!0),V(`table`,kh,[t[17]||=V(`thead`,null,[V(`tr`,null,[V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` prompt `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` type `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` value `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` status `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` next run `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`},` last result `),V(`th`,{class:`text-left text-muted font-medium py-1.5 px-2 border-b border-border text-[10px] uppercase tracking-wide`})])],-1),V(`tbody`,null,[n.value.length===0?(z(),B(`tr`,Ah,[...t[16]||=[V(`td`,{colspan:`7`,class:`text-center py-8 text-muted text-[12px]`},`no scheduled tasks`,-1)]])):W(``,!0),(z(!0),B(R,null,ai(n.value,e=>(z(),B(`tr`,{key:e.id,class:`hover:bg-surface`},[V(`td`,{class:`py-1.5 px-2 border-b border-border max-w-[250px] overflow-hidden text-ellipsis whitespace-nowrap`,title:e.prompt},N(e.prompt.slice(0,60)),9,jh),V(`td`,Mh,N(e.schedule_type),1),V(`td`,Nh,N(e.schedule_value),1),V(`td`,Ph,[V(`span`,{class:M(I(gf)(e.status))},N(e.status),3)]),V(`td`,Fh,N(I(pf)(e.next_run)),1),V(`td`,{class:`py-1.5 px-2 border-b border-border max-w-[200px] overflow-hidden text-ellipsis whitespace-nowrap text-muted`,title:e.last_result||``},N(e.last_result||`-`),9,Ih),V(`td`,Lh,[e.status===`active`?(z(),B(`button`,{key:0,type:`button`,class:`btn-sm bg-warn-dim text-warn border-warn-dim hover:bg-warn-dim`,onClick:t=>f(e.id,`paused`)},` pause `,8,Rh)):e.status===`paused`?(z(),B(`button`,{key:1,type:`button`,class:`btn-sm bg-ok-dim text-ok border-ok-dim hover:bg-ok-dim`,onClick:t=>f(e.id,`active`)},` resume `,8,zh)):W(``,!0)])]))),128))])])]))}}),window:{width:900,height:420,minwidth:420,minheight:240}},Vh={class:`grid gap-3 p-3`},Hh={key:0,class:`border border-border p-3`},Uh={class:`w-full border-collapse text-[12px]`},Wh={key:0,class:`hover:bg-surface`},Gh={class:`py-1.5 px-2 border-b border-border font-mono`},Kh={class:`hover:bg-surface`},qh={class:`py-1.5 px-2`},Jh={key:0,class:`text-muted`},Yh={key:1,class:`text-muted`},Xh={key:1,class:`border border-border p-3`},Zh={key:2,class:`border border-border p-3`},Qh={key:0,class:`text-[11px] text-danger mb-2`},$h=[`disabled`],eg={key:3,class:`border border-border p-3`},tg={class:`mb-2`},ng={key:0,class:`text-[11px] text-danger mb-2`},rg=[`disabled`],ig={key:4,class:`border border-border p-3`},ag=[`disabled`],og={key:`telegram`,label:`Telegram`,icon:`simple-icons:telegram`,color:`#2AABEE`,component:kr({__name:`window`,setup(e){let t=F(null),n=F(``),r=F(!1),i=F(``),a=G(()=>t.value?.connected??!1);async function o(){let e=await gu(`/api/telegram/status`);e&&(t.value=e)}async function s(){if(n.value.trim()){r.value=!0,i.value=``;try{(await hu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`connect`,botToken:n.value.trim()})}))?.ok&&(n.value=``,await o())}catch(e){i.value=e instanceof Error?e.message:`connection failed`}finally{r.value=!1}}}async function c(){r.value=!0,i.value=``;try{await hu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`disconnect`})}),await o()}catch(e){i.value=e instanceof Error?e.message:`disconnect failed`}finally{r.value=!1}}let l=G(()=>!a.value&&(t.value?.configured||t.value?.hasEnvToken));async function u(){r.value=!0,i.value=``;try{await hu(`/api/telegram/setup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`reconnect`})}),await o()}catch(e){i.value=e instanceof Error?e.message:`reconnect failed`}finally{r.value=!1}}return yu(o,5e3),(e,o)=>(z(),B(`div`,Vh,[a.value?(z(),B(`div`,Hh,[o[4]||=V(`h3`,{class:`section-title mb-2`},`status`,-1),V(`table`,Uh,[V(`tbody`,null,[o[3]||=V(`tr`,{class:`hover:bg-surface`},[V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`connection`),V(`td`,{class:`py-1.5 px-2 border-b border-border`},[V(`span`,{class:`badge-ok`},`connected`)])],-1),t.value?.botUsername?(z(),B(`tr`,Wh,[o[1]||=V(`td`,{class:`py-1.5 px-2 border-b border-border text-muted`},`bot`,-1),V(`td`,Gh,`@`+N(t.value.botUsername),1)])):W(``,!0),V(`tr`,Kh,[o[2]||=V(`td`,{class:`py-1.5 px-2 text-muted`},`source`,-1),V(`td`,qh,[t.value?.hasEnvToken?(z(),B(`span`,Jh,`env`)):t.value?.configured?(z(),B(`span`,Yh,`saved`)):W(``,!0)])])])])])):W(``,!0),!a.value&&!l.value?(z(),B(`div`,Xh,[...o[5]||=[V(`h3`,{class:`section-title mb-2`},`setup`,-1),V(`ol`,{class:`text-[12px] text-muted list-decimal list-inside grid gap-1.5`},[V(`li`,null,[U(` Open `),V(`a`,{href:`https://t.me/BotFather`,target:`_blank`,class:`text-accent hover:underline`},`@BotFather`),U(` on Telegram `)]),V(`li`,null,[U(`Send `),V(`span`,{class:`font-mono text-text`},`/newbot`),U(` and follow the prompts`)]),V(`li`,null,`Copy the bot token and paste it below`)],-1)]])):W(``,!0),l.value?(z(),B(`div`,Zh,[o[6]||=V(`h3`,{class:`section-title mb-2`},`reconnect`,-1),o[7]||=V(`p`,{class:`text-[11px] text-muted mb-2`},[U(` Bot is configured but not connected. If you see 409 errors, another instance may be polling the same token or a webhook is set. Use `),V(`span`,{class:`font-mono text-text`},`deleteWebhook`),U(` via Bot API to clear it. `)],-1),i.value?(z(),B(`div`,Qh,N(i.value),1)):W(``,!0),V(`button`,{type:`button`,disabled:r.value,class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`,onClick:u},N(r.value?`reconnecting...`:`reconnect`),9,$h)])):W(``,!0),!a.value&&!l.value?(z(),B(`div`,eg,[o[9]||=V(`h3`,{class:`section-title mb-2`},`connect`,-1),V(`form`,{onSubmit:As(s,[`prevent`])},[V(`div`,tg,[o[8]||=V(`label`,{class:`label`},`bot token`,-1),Kn(V(`input`,{"onUpdate:modelValue":o[0]||=e=>n.value=e,type:`password`,placeholder:`123456:ABC-DEF...`,class:`bg-bg border border-border rounded text-text px-2.5 py-1.5 text-[12px] font-mono w-full outline-none transition-colors focus:border-accent`},null,512),[[ws,n.value]])]),i.value?(z(),B(`div`,ng,N(i.value),1)):W(``,!0),V(`button`,{type:`submit`,disabled:r.value||!n.value.trim(),class:`btn-primary disabled:text-muted disabled:bg-surface disabled:border-border`},N(r.value?`connecting...`:`connect`),9,rg)],32)])):W(``,!0),a.value||l.value?(z(),B(`div`,ig,[o[10]||=V(`h3`,{class:`section-title mb-2`},`actions`,-1),V(`button`,{type:`button`,disabled:r.value,class:`btn-danger`,onClick:c},` disconnect `,8,ag)])):W(``,!0)]))}}),window:{width:420,height:420,minwidth:320,minheight:200,autosize:!0}},sg=Object.defineProperty,cg=Object.getOwnPropertyDescriptor,lg=(e,t)=>{for(var n in t)sg(e,n,{get:t[n],enumerable:!0})},ug=(e,t,n,r)=>{for(var i=r>1?void 0:r?cg(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&sg(t,n,i),i},q=(e,t)=>(n,r)=>t(n,r,e),dg=`Terminal input`,fg={get:()=>dg,set:e=>dg=e},pg=`Too much output to announce, navigate to rows manually to read`,mg={get:()=>pg,set:e=>pg=e};function hg(e){return e.replace(/\r?\n/g,`\r`)}function gg(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function _g(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function vg(e,t,n,r){e.stopPropagation(),e.clipboardData&&yg(e.clipboardData.getData(`text/plain`),t,n,r)}function yg(e,t,n,r){e=hg(e),e=gg(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function bg(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function xg(e,t,n,r,i){bg(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Sg(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Cg(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var wg=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},Tg=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Eg=``,Dg=` `,Og=class e{constructor(){this.fg=0,this.bg=0,this.extended=new kg}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},kg=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ag=class e extends Og{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new kg,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Sg(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},jg=`di$target`,Mg=`di$dependencies`,Ng=new Map;function Pg(e){return e[Mg]||[]}function Fg(e){if(Ng.has(e))return Ng.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Ig(t,e,r)};return t._id=e,Ng.set(e,t),t}function Ig(e,t,n){t[jg]===t?t[Mg].push({id:e,index:n}):(t[Mg]=[{id:e,index:n}],t[jg]=t)}var Lg=Fg(`BufferService`),Rg=Fg(`CoreMouseService`),zg=Fg(`CoreService`),Bg=Fg(`CharsetService`),Vg=Fg(`InstantiationService`),Hg=Fg(`LogService`),Ug=Fg(`OptionsService`),Wg=Fg(`OscLinkService`),Gg=Fg(`UnicodeService`),Kg=Fg(`DecorationService`),qg=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Ag,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+(!l&&t===o-1?1:0),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Jg(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};qg=ug([q(0,Lg),q(1,Ug),q(2,Wg)],qg);function Jg(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
4
|
-
|
|
5
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Yg=Fg(`CharSizeService`),Xg=Fg(`CoreBrowserService`),Zg=Fg(`MouseService`),Qg=Fg(`RenderService`),$g=Fg(`SelectionService`),e_=Fg(`CharacterJoinerService`),t_=Fg(`ThemeService`),n_=Fg(`LinkProviderService`),r_=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?l_.isErrorNoTelemetry(e)?new l_(e.message+`
|
|
6
|
-
|
|
7
|
-
`+e.stack):Error(e.message+`
|
|
8
|
-
|
|
9
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function i_(e){o_(e)||r_.onUnexpectedError(e)}var a_=`Canceled`;function o_(e){return e instanceof s_?!0:e instanceof Error&&e.name===a_&&e.message===a_}var s_=class extends Error{constructor(){super(a_),this.name=this.message}};function c_(e){return e?Error(`Illegal argument: ${e}`):Error(`Illegal argument`)}var l_=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},u_=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function d_(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var f_=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=d_(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};f_.assertInvariants=!1;function p_(e,t=0){return e[e.length-(1+t)]}var m_;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(m_||={});function h_(e,t){return(n,r)=>t(e(n),e(r))}var g_=(e,t)=>e-t,__=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||m_.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};__.empty=new __(e=>{});function v_(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var y_=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function b_(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var x_;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(x_||={});var S_=!1,C_=null,w_=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
10
|
-
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new y_;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
11
|
-
`),e)}n.sort(h_(e=>e.idx,g_));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
12
|
-
`)).size}/${n.length} leaks) at ${a}`;let o=v_([...i.get(e.slice(0,t).join(`
|
|
13
|
-
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
17
|
-
${s.join(`
|
|
18
|
-
`)}
|
|
19
|
-
============================================================
|
|
20
|
-
|
|
21
|
-
`}return n.length>e&&(a+=`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
... and ${n.length-e} more leaking disposables
|
|
25
|
-
|
|
26
|
-
`),{leaks:n,details:a}}};w_.idx=0;function T_(e){C_=e}if(S_){let e=`__is_disposable_tracked__`;T_(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==J.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==J.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function E_(e){return C_?.trackDisposable(e),e}function D_(e){C_?.markAsDisposed(e)}function O_(e,t){C_?.setParent(e,t)}function k_(e,t){if(C_)for(let n of e)C_.setParent(n,t)}function A_(e){return C_?.markAsSingleton(e),e}function j_(e){if(x_.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function M_(...e){let t=N_(()=>j_(e));return k_(e,t),t}function N_(e){let t=E_({dispose:b_(()=>{D_(t),e()})});return t}var P_=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,E_(this)}dispose(){this._isDisposed||(D_(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{j_(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return O_(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),O_(e,null))}};P_.DISABLE_DISPOSED_WARNING=!1;var F_=P_,J=class{constructor(){this._store=new F_,E_(this),O_(this._store,this)}dispose(){D_(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};J.None=Object.freeze({dispose(){}});var I_=class{constructor(){this._isDisposed=!1,E_(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&O_(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,D_(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&O_(e,null),e}},L_=typeof window==`object`?window:globalThis,R_=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};R_.Undefined=new R_(void 0);var z_=R_,B_=class{constructor(){this._first=z_.Undefined,this._last=z_.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===z_.Undefined}clear(){let e=this._first;for(;e!==z_.Undefined;){let t=e.next;e.prev=z_.Undefined,e.next=z_.Undefined,e=t}this._first=z_.Undefined,this._last=z_.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new z_(e);if(this._first===z_.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==z_.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==z_.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==z_.Undefined&&e.next!==z_.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===z_.Undefined&&e.next===z_.Undefined?(this._first=z_.Undefined,this._last=z_.Undefined):e.next===z_.Undefined?(this._last=this._last.prev,this._last.next=z_.Undefined):e.prev===z_.Undefined&&(this._first=this._first.next,this._first.prev=z_.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==z_.Undefined;)yield e.element,e=e.next}},V_=globalThis.performance&&typeof globalThis.performance.now==`function`,H_=class e{static create(t){return new e(t)}constructor(e){this._now=V_&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},U_=!1,W_=!1,G_=!1,K_;(e=>{e.None=()=>J.None;function t(e){if(G_){let{onDidAddListener:t}=e,n=Q_.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(M_(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Y(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Y(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Y({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Y({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Y({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function C(e){let t=new Y;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=C;function w(e,t){return e(e=>t.fire(e))}e.forward=w;function T(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=T;class E{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Y(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(e,t){return new E(e,t).emitter.event}e.fromObservable=D;function ee(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof F_?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=ee})(K_||={});var q_=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new H_,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};q_.all=new Set,q_._idPool=0;var J_=q_,Y_=-1,X_=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new $_(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};X_._idPool=1;var Z_=X_,Q_=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
27
|
-
`).slice(2).join(`
|
|
28
|
-
`))}},$_=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},ev=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},tv=0,nv=class{constructor(e){this.value=e,this.id=tv++}},rv=2,iv=(e,t)=>{if(e instanceof nv)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},av;if(U_){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
29
|
-
`)),e.length=0)},3e3),av=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Y=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Y_>0||this._options?.leakWarningThreshold?new Z_(e?.onListenerError??i_,this._options?.leakWarningThreshold??Y_):void 0,this._perfMon=this._options?._profName?new J_(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(W_){let e=this._listeners;queueMicrotask(()=>{iv(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new ev(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||i_)(n),J.None}if(this._disposed)return J.None;t&&(e=e.bind(t));let r=new nv(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Q_.create(),i=this._leakageMon.check(r.stack,this._size+1)),W_&&(r.stack=Q_.create()),this._listeners?this._listeners instanceof nv?(this._deliveryQueue??=new ov,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=N_(()=>{av?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof F_?n.add(a):Array.isArray(n)&&n.push(a),av){let e=Error().stack.split(`
|
|
30
|
-
`).slice(2,3).join(`
|
|
31
|
-
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);av.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*rv<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||i_;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof nv)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ov=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sv=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Y,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Y,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};sv.INSTANCE=new sv;var cv=sv;function lv(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}cv.INSTANCE.onDidChangeZoomLevel;function uv(e){return cv.INSTANCE.getZoomFactor(e)}cv.INSTANCE.onDidChangeFullscreen;var dv=typeof navigator==`object`?navigator.userAgent:``,fv=dv.indexOf(`Firefox`)>=0,pv=dv.indexOf(`AppleWebKit`)>=0,mv=dv.indexOf(`Chrome`)>=0,hv=!mv&&dv.indexOf(`Safari`)>=0;dv.indexOf(`Electron/`),dv.indexOf(`Android`);var gv=!1;if(typeof L_.matchMedia==`function`){let e=L_.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=L_.matchMedia(`(display-mode: fullscreen)`);gv=e.matches,lv(L_,e,({matches:e})=>{gv&&t.matches||(gv=e)})}function _v(){return gv}var vv=`en`,yv=!1,bv=!1,xv=!1,Sv=!1,Cv=!1,wv=vv,Tv,Ev=globalThis,Dv;typeof Ev.vscode<`u`&&typeof Ev.vscode.process<`u`?Dv=Ev.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Dv=process);var Ov=typeof Dv?.versions?.electron==`string`&&Dv?.type===`renderer`;if(typeof Dv==`object`){yv=Dv.platform===`win32`,bv=Dv.platform===`darwin`,xv=Dv.platform===`linux`,xv&&Dv.env.SNAP&&Dv.env.SNAP_REVISION,Dv.env.CI||Dv.env.BUILD_ARTIFACTSTAGINGDIRECTORY,wv=vv;let e=Dv.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,wv=t.resolvedLanguage||vv,t.languagePack?.translationsConfigFile}catch{}Sv=!0}else typeof navigator==`object`&&!Ov?(Tv=navigator.userAgent,yv=Tv.indexOf(`Windows`)>=0,bv=Tv.indexOf(`Macintosh`)>=0,(Tv.indexOf(`Macintosh`)>=0||Tv.indexOf(`iPad`)>=0||Tv.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,xv=Tv.indexOf(`Linux`)>=0,Tv?.indexOf(`Mobi`),Cv=!0,wv=globalThis._VSCODE_NLS_LANGUAGE||vv,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var kv=yv,Av=bv,jv=xv,Mv=Sv;Cv&&typeof Ev.importScripts==`function`&&Ev.origin;var Nv=Tv,Pv=wv,Fv;(e=>{function t(){return Pv}e.value=t;function n(){return Pv.length===2?Pv===`en`:Pv.length>=3?Pv[0]===`e`&&Pv[1]===`n`&&Pv[2]===`-`:!1}e.isDefaultVariant=n;function r(){return Pv===`en`}e.isDefault=r})(Fv||={});var Iv=typeof Ev.postMessage==`function`&&!Ev.importScripts;(()=>{if(Iv){let e=[];Ev.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ev.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Lv=!!(Nv&&Nv.indexOf(`Chrome`)>=0);Nv&&Nv.indexOf(`Firefox`),!Lv&&Nv&&Nv.indexOf(`Safari`),Nv&&Nv.indexOf(`Edg/`),Nv&&Nv.indexOf(`Android`);var Rv=typeof navigator==`object`?navigator:{};Mv||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Rv&&Rv.clipboard&&Rv.clipboard.writeText,Mv||Rv&&Rv.clipboard&&Rv.clipboard.readText,Mv||_v()||Rv.keyboard,`ontouchstart`in L_||Rv.maxTouchPoints,L_.PointerEvent&&(`ontouchstart`in L_||navigator.maxTouchPoints);var zv=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bv=new zv,Vv=new zv,Hv=new zv,Uv=Array(230),Wv;(e=>{function t(e){return Bv.keyCodeToStr(e)}e.toString=t;function n(e){return Bv.strToKeyCode(e)}e.fromString=n;function r(e){return Vv.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Hv.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Vv.strToKeyCode(e)||Hv.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Bv.keyCodeToStr(e)}e.toElectronAccelerator=o})(Wv||={});var Gv=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Kv([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Kv=class{constructor(e){if(e.length===0)throw c_(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function qv(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Wv.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(fv)switch(t){case 59:return 85;case 60:if(jv)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Av)return 57;break}else if(pv&&(Av&&t===93||!Av&&t===92))return 57;return Uv[t]||0}var Jv=Av?256:2048,Yv=512,Xv=1024,Zv=Av?2048:256,Qv=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=qv(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Jv),this.altKey&&(t|=Yv),this.shiftKey&&(t|=Xv),this.metaKey&&(t|=Zv),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Gv(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},$v=new WeakMap;function ey(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var ty=class{static getSameOriginWindowChain(e){let t=$v.get(e);if(!t){t=[],$v.set(e,t);let n=e,r;do r=ey(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},ny=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=ty.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ry=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(mv){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?fv&&!Av?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)hv&&kv?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?fv&&!Av?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},iy=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ay;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof oy?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:K_.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:iy})})(ay||={});var oy=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?iy:(this._emitter||=new Y,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},sy=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new u_(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new u_(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},cy=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new u_(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=N_(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var ly;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(ly||={});var uy=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Y,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await K_.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};uy.EMPTY=uy.fromArray([]);function dy(e){return 55296<=e&&e<=56319}function fy(e){return 56320<=e&&e<=57343}function py(e,t){return(e-55296<<10)+(t-56320)+65536}function my(e){return hy(e,0)}function hy(e,t){switch(typeof e){case`object`:return e===null?gy(349,t):Array.isArray(e)?yy(e,t):by(e,t);case`string`:return vy(e,t);case`boolean`:return _y(e,t);case`number`:return gy(e,t);case`undefined`:return gy(937,t);default:return gy(617,t)}}function gy(e,t){return(t<<5)-t+e|0}function _y(e,t){return gy(e?433:863,t)}function vy(e,t){t=gy(149417,t);for(let n=0,r=e.length;n<r;n++)t=gy(e.charCodeAt(n),t);return t}function yy(e,t){return t=gy(104579,t),e.reduce((e,t)=>hy(t,e),t)}function by(e,t){return t=gy(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=vy(n,t),hy(e[n],t)),t)}function xy(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Sy(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Cy(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function wy(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Cy((e>>>0).toString(16),t/4)}var Ty=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(dy(a))if(o+1<t){let t=e.charCodeAt(o+1);fy(t)?(o++,s=py(a,t)):s=65533}else{i=a;break}else fy(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),wy(this._h0)+wy(this._h1)+wy(this._h2)+wy(this._h3)+wy(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Sy(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Sy(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,xy(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=xy(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=xy(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};Ty._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Ey,getWindow:Dy,getDocument:Oy,getWindows:ky,getWindowsCount:Ay,getWindowId:jy,getWindowById:My,hasWindow:Ny,onDidRegisterWindow:Py,onWillUnregisterWindow:Fy,onDidUnregisterWindow:Iy}=function(){let e=new Map,t={window:L_,disposables:new F_};e.set(L_.vscodeWindowId,t);let n=new Y,r=new Y,i=new Y;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return J.None;let a=new F_,o={window:t,disposables:a.add(new F_)};return e.set(t.vscodeWindowId,o),a.add(N_(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(X(t,Ky.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:L_},getDocument(e){return Dy(e).document}}}(),Ly=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function X(e,t,n,r){return new Ly(e,t,n,r)}function Ry(e,t){return function(n){return t(new ny(e,n))}}function zy(e){return function(t){return e(new Qv(t))}}var By=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Ry(Dy(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=zy(n)),X(e,t,i,r)},Vy,Hy=class extends cy{constructor(e){super(),this.defaultTarget=e&&Dy(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Uy=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){i_(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(Uy.sort),a.shift().execute();r.set(i,!1)};Vy=(t,r,a=0)=>{let o=jy(t),s=new Uy(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var Wy=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Wy.None=new Wy(0,0);function Gy(e){let t=e.getBoundingClientRect(),n=Dy(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=my(n),a=r.get(i);if(a)a.users+=1;else{let o=new Y,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(N_(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var Ky={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:pv?`webkitAnimationStart`:`animationstart`,ANIMATION_END:pv?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:pv?`webkitAnimationIteration`:`animationiteration`},qy=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Jy(e,t,n,...r){let i=qy.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function Yy(e,t,...n){return Jy(`http://www.w3.org/1999/xhtml`,e,t,...n)}Yy.SVG=function(e,t,...n){return Jy(`http://www.w3.org/2000/svg`,e,t,...n)};var Xy=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=Zy(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Zy(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Zy(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Zy(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Zy(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Zy(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Zy(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Zy(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Zy(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Zy(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Zy(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Zy(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Zy(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Zy(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Zy(e){return typeof e==`number`?`${e}px`:e}function Qy(e){return new Xy(e)}var $y=class{constructor(){this._hooks=new F_,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(N_(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Dy(e)}this._hooks.add(X(a,Ky.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(X(a,Ky.POINTER_UP,e=>this.stopMonitoring(!0)))}};function eb(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var tb;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(tb||={});var nb=class e extends J{constructor(){super(),this.dispatched=!1,this.targets=new B_,this.ignoreTargets=new B_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(K_.runAndSubscribe(Py,({window:e,disposables:t})=>{t.add(X(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(X(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(X(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:L_,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=A_(new e),N_(e.INSTANCE.targets.push(t))):J.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=A_(new e),N_(e.INSTANCE.ignoreTargets.push(t))):J.None}static isTouchDevice(){return`ontouchstart`in L_||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(tb.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-p_(s.rollingPageX))<30&&Math.abs(s.initialPageY-p_(s.rollingPageY))<30){let e=this.newGestureEvent(tb.Tap,s.initialTarget);e.pageX=p_(s.rollingPageX),e.pageY=p_(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-p_(s.rollingPageX))<30&&Math.abs(s.initialPageY-p_(s.rollingPageY))<30){let e=this.newGestureEvent(tb.Contextmenu,s.initialTarget);e.pageX=p_(s.rollingPageX),e.pageY=p_(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=p_(s.rollingPageX),n=p_(s.rollingPageY),i=p_(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(tb.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===tb.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===tb.Change||t.type===tb.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=Vy(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(tb.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(tb.Change,i.initialTarget);a.translationX=r.pageX-p_(i.rollingPageX),a.translationY=r.pageY-p_(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};nb.SCROLL_FRICTION=-.005,nb.HOLD_DELAY=700,nb.CLEAR_TAP_COUNT_TIME=400,ug([eb],nb,`isTouchDevice`,1);var rb=nb,ib=class extends J{onclick(e,t){this._register(X(e,Ky.CLICK,n=>t(new ny(Dy(e),n))))}onmousedown(e,t){this._register(X(e,Ky.MOUSE_DOWN,n=>t(new ny(Dy(e),n))))}onmouseover(e,t){this._register(X(e,Ky.MOUSE_OVER,n=>t(new ny(Dy(e),n))))}onmouseleave(e,t){this._register(X(e,Ky.MOUSE_LEAVE,n=>t(new ny(Dy(e),n))))}onkeydown(e,t){this._register(X(e,Ky.KEY_DOWN,e=>t(new Qv(e))))}onkeyup(e,t){this._register(X(e,Ky.KEY_UP,e=>t(new Qv(e))))}oninput(e,t){this._register(X(e,Ky.INPUT,t))}onblur(e,t){this._register(X(e,Ky.BLUR,t))}onfocus(e,t){this._register(X(e,Ky.FOCUS,t))}onchange(e,t){this._register(X(e,Ky.CHANGE,t))}ignoreGesture(e){return rb.ignoreTarget(e)}},ab=11,ob=class extends ib{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=ab+`px`,this.domNode.style.height=ab+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new $y),this._register(By(this.bgDomNode,Ky.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(By(this.domNode,Ky.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Hy),this._pointerdownScheduleRepeatTimer=this._register(new sy)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Dy(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},sb=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},cb=class extends J{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new sb(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new fb(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=fb.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},lb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function ub(e,t){let n=t-e;return function(t){return e+n*mb(t)}}function db(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var fb=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),db(ub(e,r),ub(i,t),.33)}return ub(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new lb(this.scrollLeft(t),this.scrollTop(t),!1):new lb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){return r+=10,new e(t,n,Date.now()-10,r)}};function pb(e){return e**3}function mb(e){return 1-pb(1-e)}var hb=class extends J{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new sy)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},gb=140,_b=class extends ib{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new hb(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $y),this._shouldRender=!0,this.domNode=Qy(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(X(this.domNode.domNode,Ky.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new ob(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Qy(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(X(this.slider.domNode,Ky.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=Gy(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(kv&&a>gb){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},vb=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},yb=class extends _b{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new vb(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},bb=class extends _b{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new vb(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},xb=500,Sb=50,Cb=!0,wb=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Tb=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(mv){let t=uv(Dy(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new wb(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Tb.INSTANCE=new Tb;var Eb=Tb,Db=class extends ib{constructor(e,t,n){super(),this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Y),this.onWillScroll=this._onWillScroll.event,this._options=kb(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new bb(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new yb(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Qy(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Qy(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Qy(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new sy),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=j_(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Av&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new ry(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=j_(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(X(this._listenOnDomNode,Ky.MOUSE_WHEEL,e=>{this._onMouseWheel(new ry(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Eb.INSTANCE;Cb&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Av&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Sb*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Sb*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Cb&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),xb)}},Ob=class extends Db{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function kb(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Av&&(t.className+=` mac`),t}var Ab=class extends J{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Y),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new cb({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Vy(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Ob(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(K_.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(N_(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(N_(()=>this._styleElement.remove())),this._register(K_.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
32
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Ab=ug([q(2,Lg),q(3,Xg),q(4,Rg),q(5,t_),q(6,Ug),q(7,Qg)],Ab);var jb=class extends J{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(N_(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};jb=ug([q(1,Lg),q(2,Xg),q(3,Kg),q(4,Qg)],jb);var Mb=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Nb={full:0,left:0,center:0,right:0},Pb={full:0,left:0,center:0,right:0},Fb={full:0,left:0,center:0,right:0},Ib=class extends J{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Mb,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(N_(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Pb.full=this._canvas.width,Pb.left=e,Pb.center=t,Pb.right=e,this._refreshDrawHeightConstants(),Fb.full=1,Fb.left=1,Fb.center=1+Pb.left,Fb.right=1+Pb.left+Pb.center}_refreshDrawHeightConstants(){Nb.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Nb.left=t,Nb.center=t,Nb.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Nb.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Nb.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Nb.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Nb.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Fb[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Nb[e.position||`full`]/2),Pb[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Nb[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Ib=ug([q(2,Lg),q(3,Kg),q(4,Qg),q(5,Ug),q(6,t_),q(7,Xg)],Ib);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
33
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var Lb;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(Lb||={});var Rb;(e=>e.ST=`${Z.ESC}\\`)(Rb||={});var zb=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};zb=ug([q(2,Lg),q(3,Ug),q(4,zg),q(5,Qg)],zb);var Bb=0,Vb=0,Hb=0,Ub=0,Wb={css:`#00000000`,rgba:0},Gb;(e=>{function t(e,t,n,r){return r===void 0?`#${Xb(e)}${Xb(t)}${Xb(n)}`:`#${Xb(e)}${Xb(t)}${Xb(n)}${Xb(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Gb||={});var Kb;(e=>{function t(e,t){if(Ub=(t.rgba&255)/255,Ub===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Bb=a+Math.round((n-a)*Ub),Vb=o+Math.round((r-o)*Ub),Hb=s+Math.round((i-s)*Ub),{css:Gb.toCss(Bb,Vb,Hb),rgba:Gb.toRgba(Bb,Vb,Hb)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Yb.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Gb.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Bb,Vb,Hb]=Yb.toChannels(t),{css:Gb.toCss(Bb,Vb,Hb),rgba:t}}e.opaque=i;function a(e,t){return Ub=Math.round(t*255),[Bb,Vb,Hb]=Yb.toChannels(e.rgba),{css:Gb.toCss(Bb,Vb,Hb,Ub),rgba:Gb.toRgba(Bb,Vb,Hb,Ub)}}e.opacity=a;function o(e,t){return Ub=e.rgba&255,a(e,Ub*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Kb||={});var qb;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Bb=parseInt(e.slice(1,2).repeat(2),16),Vb=parseInt(e.slice(2,3).repeat(2),16),Hb=parseInt(e.slice(3,4).repeat(2),16),Gb.toColor(Bb,Vb,Hb);case 5:return Bb=parseInt(e.slice(1,2).repeat(2),16),Vb=parseInt(e.slice(2,3).repeat(2),16),Hb=parseInt(e.slice(3,4).repeat(2),16),Ub=parseInt(e.slice(4,5).repeat(2),16),Gb.toColor(Bb,Vb,Hb,Ub);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Bb=parseInt(r[1]),Vb=parseInt(r[2]),Hb=parseInt(r[3]),Ub=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Gb.toColor(Bb,Vb,Hb,Ub);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Bb,Vb,Hb,Ub]=t.getImageData(0,0,1,1).data,Ub!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Gb.toRgba(Bb,Vb,Hb,Ub),css:e}}e.toColor=r})(qb||={});var Jb;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Jb||={});var Yb;(e=>{function t(e,t){if(Ub=(t&255)/255,Ub===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Bb=a+Math.round((n-a)*Ub),Vb=o+Math.round((r-o)*Ub),Hb=s+Math.round((i-s)*Ub),Gb.toRgba(Bb,Vb,Hb)}e.blend=t;function n(e,t,n){let a=Jb.relativeLuminance(e>>8),o=Jb.relativeLuminance(t>>8);if(Zb(a,o)<n){if(o<a){let o=r(e,t,n),s=Zb(a,Jb.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Zb(a,Jb.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Zb(a,Jb.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Zb(a,Jb.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Zb(Jb.relativeLuminance2(o,s,c),Jb.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=Zb(Jb.relativeLuminance2(o,s,c),Jb.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=Zb(Jb.relativeLuminance2(o,s,c),Jb.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=Zb(Jb.relativeLuminance2(o,s,c),Jb.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Yb||={});function Xb(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Zb(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Qb=class extends Og{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},$b=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ag}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Dg.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)$b._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Dg.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};$b=ug([q(0,Lg)],$b);function ex(e){return 57508<=e&&e<=57558}function tx(e){return 9472<=e&&e<=9631}function nx(e){return ex(e)||tx(e)}function rx(){return{css:{canvas:ix(),cell:ix()},device:{canvas:ix(),cell:ix(),char:{width:0,height:0,left:0,top:0}}}}function ix(){return{width:0,height:0}}var ax=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Ag,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],ee=l!==-1&&u!==-1;for(let O=0;O<m;O++){e.loadCell(O,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let te=!1,ne=O>=E,k=O,A=this._workCell;if(f.length>0&&O===f[0][0]&&ne){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)ne&&=i===this._isCellInSelection(v,t);ne&&=!n||a<r[0]||a>=r[1],ne?(te=!0,A=new Qb(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),k=r[1]-1,m=A.getWidth()):E=r[1]}let re=this._isCellInSelection(O,t),j=n&&O===a,ie=ee&&O>=l&&O<=u,ae=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{ae=!0});let oe=A.getChars()||Dg;if(oe===` `&&(A.isUnderline()||A.isOverline())&&(oe=`\xA0`),T=m*s-c.get(oe,A.isBold(),A.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(re&&w||!re&&!w&&A.bg===y)&&(re&&w&&p.selectionForeground||A.fg===b)&&A.extended.ext===x&&ie===S&&T===C&&!j&&!te&&!ae&&ne){A.isInvisible()?_+=Dg:_+=oe,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=A.bg,b=A.fg,x=A.extended.ext,S=ie,C=T,w=re,te&&a>=O&&a<=k&&(a=O),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(A.isBold()&&D.push(`xterm-bold`),A.isItalic()&&D.push(`xterm-italic`),A.isDim()&&D.push(`xterm-dim`),_=A.isInvisible()?Dg:A.getChars()||Dg,A.isUnderline()&&(D.push(`xterm-underline-${A.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!A.isUnderlineColorDefault()))if(A.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Og.toColorRGB(A.getUnderlineColor()).join(`,`)})`;else{let e=A.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&A.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}A.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),A.isStrikethrough()&&D.push(`xterm-strikethrough`),ie&&(h.style.textDecoration=`underline`);let se=A.getFgColor(),ce=A.getFgColorMode(),le=A.getBgColor(),ue=A.getBgColorMode(),de=!!A.isInverse();if(de){let e=se;se=le,le=e;let t=ce;ce=ue,ue=t}let fe,pe,me=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{e.options.layer!==`top`&&me||(e.backgroundColorRGB&&(ue=50331648,le=e.backgroundColorRGB.rgba>>8&16777215,fe=e.backgroundColorRGB),e.foregroundColorRGB&&(ce=50331648,se=e.foregroundColorRGB.rgba>>8&16777215,pe=e.foregroundColorRGB),me=e.options.layer===`top`)}),!me&&re&&(fe=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,le=fe.rgba>>8&16777215,ue=50331648,me=!0,p.selectionForeground&&(ce=50331648,se=p.selectionForeground.rgba>>8&16777215,pe=p.selectionForeground)),me&&D.push(`xterm-decoration-top`);let he;switch(ue){case 16777216:case 33554432:he=p.ansi[le],D.push(`xterm-bg-${le}`);break;case 50331648:he=Gb.toColor(le>>16,le>>8&255,le&255),this._addStyle(h,`background-color:#${ox((le>>>0).toString(16),`0`,6)}`);break;default:de?(he=p.foreground,D.push(`xterm-bg-257`)):he=p.background}switch(fe||A.isDim()&&(fe=Kb.multiplyOpacity(he,.5)),ce){case 16777216:case 33554432:A.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(h,he,p.ansi[se],A,fe,void 0)||D.push(`xterm-fg-${se}`);break;case 50331648:let e=Gb.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(h,he,e,A,fe,pe)||this._addStyle(h,`color:#${ox(se.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,he,p.foreground,A,fe,pe)||de&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!j&&!te&&!ae&&ne?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),O=k}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||nx(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=Kb.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};ax=ug([q(1,e_),q(2,Ug),q(3,Xg),q(4,zg),q(5,Kg),q(6,t_)],ax);function ox(e,t,n){for(;e.length<n;)e=t+e;return e}var sx=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},cx=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function lx(){return new cx}var ux=`xterm-dom-renderer-owner-`,dx=`xterm-rows`,fx=`xterm-fg-`,px=`xterm-bg-`,mx=`xterm-focus`,hx=`xterm-selection`,gx=1,_x=class extends J{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=gx++,this._rowElements=[],this._selectionRenderModel=lx(),this.onRequestRedraw=this._register(new Y).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(dx),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(hx),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=rx(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(ax,document),this._element.classList.add(ux+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(N_(()=>{this._element.classList.remove(ux+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new sx(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${dx} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${dx} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${dx} .xterm-dim { color: ${Kb.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${dx}.${mx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${dx}.${mx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${dx}.${mx} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${dx} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${dx} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${dx} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${dx} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${dx} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${hx} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${hx} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${hx} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${fx}${n} { color: ${r.css}; }${this._terminalSelector} .${fx}${n}.xterm-dim { color: ${Kb.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${px}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${fx}257 { color: ${Kb.opaque(e.background).css}; }${this._terminalSelector} .${fx}257.xterm-dim { color: ${Kb.multiplyOpacity(Kb.opaque(e.background),.5).css}; }${this._terminalSelector} .${px}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(mx),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(mx),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ux}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};_x=ug([q(7,Vg),q(8,Yg),q(9,Ug),q(10,Lg),q(11,zg),q(12,Xg),q(13,t_)],_x);var vx=class extends J{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Y),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new xx(this._optionsService))}catch{this._measureStrategy=this._register(new bx(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};vx=ug([q(2,Ug)],vx);var yx=class extends J{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},bx=class extends yx{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},xx=class extends yx{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Sx=class extends J{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Cx(this._window)),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Y),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(K_.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(X(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(X(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Cx=class extends J{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new I_),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(N_(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=X(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},wx=class extends J{constructor(){super(),this.linkProviders=[],this._register(N_(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Tx(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Ex(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Tx(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),i),l}var Dx=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Ex(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Tx(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Dx=ug([q(0,Qg),q(1,Yg)],Dx);var Ox=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},kx={};lg(kx,{getSafariVersion:()=>Ix,isChromeOS:()=>Hx,isFirefox:()=>Nx,isIpad:()=>Rx,isIphone:()=>zx,isLegacyEdge:()=>Px,isLinux:()=>Vx,isMac:()=>Lx,isNode:()=>Ax,isSafari:()=>Fx,isWindows:()=>Bx});var Ax=typeof process<`u`&&`title`in process,jx=Ax?`node`:navigator.userAgent,Mx=Ax?`node`:navigator.platform,Nx=jx.includes(`Firefox`),Px=jx.includes(`Edge`),Fx=/^((?!chrome|android).)*safari/i.test(jx);function Ix(){if(!Fx)return 0;let e=jx.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Lx=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Mx),Rx=Mx===`iPad`,zx=Mx===`iPhone`,Bx=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Mx),Vx=Mx.indexOf(`Linux`)>=0,Hx=/\bCrOS\b/.test(jx),Ux=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Wx=class extends Ux{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Gx=class extends Ux{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Kx=!Ax&&`requestIdleCallback`in window?Gx:Wx,qx=class{constructor(){this._queue=new Kx}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Jx=class extends J{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new I_),this._pausedResizeTask=new qx,this._observerDisposable=this._register(new I_),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Y),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Y),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Y),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ox((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Yx(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(N_(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=N_(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Jx=ug([q(2,Ug),q(3,Yg),q(4,zg),q(5,Kg),q(6,Lg),q(7,Xg),q(8,t_)],Jx);var Yx=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Xx(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return $x(i,a,e,t,n,r)+eS(a,t,n,r)+tS(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,cS(Math.abs(i-e),sS(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return cS(Qx(a>t?e:i,n)+(s-1)*n.cols+1+Zx(a>t?i:e,n),sS(o,r))}function Zx(e,t){return e-1}function Qx(e,t){return t.cols-e}function $x(e,t,n,r,i,a){return eS(t,r,i,a).length===0?``:cS(oS(e,t,e,t-rS(t,i),!1,i).length,sS(`D`,a))}function eS(e,t,n,r){let i=e-rS(e,n),a=t-rS(t,n);return cS(Math.abs(i-a)-nS(e,t,n),sS(aS(e,t),r))}function tS(e,t,n,r,i,a){let o;o=eS(t,r,i,a).length>0?r-rS(r,i):t;let s=r,c=iS(e,t,n,r,i,a);return cS(oS(e,o,n,s,c===`C`,i).length,sS(c,a))}function nS(e,t,n){let r=0,i=e-rS(e,n),a=t-rS(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=aS(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function rS(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function iS(e,t,n,r,i,a){let o;return o=eS(n,r,i,a).length>0?r-rS(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function aS(e,t){return e>t?`A`:`B`}function oS(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function sS(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function cS(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var lS=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function uS(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var dS=50,fS=15,pS=50,mS=500,hS=RegExp(`\xA0`,`g`),gS=class extends J{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ag,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Y),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Y),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Y),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new lS(this._bufferService),this._activeSelectionMode=0,this._register(N_(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(hS,` `)).join(Bx?`\r
|
|
34
|
-
`:`
|
|
35
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Vx&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=uS(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Tx(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-dS),dS),t/=dS,t/Math.abs(t)+Math.round(t*(fS-1)))}shouldForceSelection(e){return Lx?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),pS)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Lx&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<mS&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=Xx(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=uS(n,this._bufferService.cols)}};gS=ug([q(3,Lg),q(4,zg),q(5,Zg),q(6,Ug),q(7,Qg),q(8,Xg)],gS);var _S=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},vS=class{constructor(){this._color=new _S,this._css=new _S}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},yS=Object.freeze((()=>{let e=[qb.toColor(`#2e3436`),qb.toColor(`#cc0000`),qb.toColor(`#4e9a06`),qb.toColor(`#c4a000`),qb.toColor(`#3465a4`),qb.toColor(`#75507b`),qb.toColor(`#06989a`),qb.toColor(`#d3d7cf`),qb.toColor(`#555753`),qb.toColor(`#ef2929`),qb.toColor(`#8ae234`),qb.toColor(`#fce94f`),qb.toColor(`#729fcf`),qb.toColor(`#ad7fa8`),qb.toColor(`#34e2e2`),qb.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:Gb.toCss(r,i,a),rgba:Gb.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Gb.toCss(n,n,n),rgba:Gb.toRgba(n,n,n)})}return e})()),bS=qb.toColor(`#ffffff`),xS=qb.toColor(`#000000`),SS=qb.toColor(`#ffffff`),CS=xS,wS={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},TS=bS,ES=class extends J{constructor(e){super(),this._optionsService=e,this._contrastCache=new vS,this._halfContrastCache=new vS,this._onChangeColors=this._register(new Y),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:bS,background:xS,cursor:SS,cursorAccent:CS,selectionForeground:void 0,selectionBackgroundTransparent:wS,selectionBackgroundOpaque:Kb.blend(xS,wS),selectionInactiveBackgroundTransparent:wS,selectionInactiveBackgroundOpaque:Kb.blend(xS,wS),scrollbarSliderBackground:Kb.opacity(bS,.2),scrollbarSliderHoverBackground:Kb.opacity(bS,.4),scrollbarSliderActiveBackground:Kb.opacity(bS,.5),overviewRulerBorder:bS,ansi:yS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=DS(e.foreground,bS),t.background=DS(e.background,xS),t.cursor=Kb.blend(t.background,DS(e.cursor,SS)),t.cursorAccent=Kb.blend(t.background,DS(e.cursorAccent,CS)),t.selectionBackgroundTransparent=DS(e.selectionBackground,wS),t.selectionBackgroundOpaque=Kb.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=DS(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Kb.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?DS(e.selectionForeground,Wb):void 0,t.selectionForeground===Wb&&(t.selectionForeground=void 0),Kb.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Kb.opacity(t.selectionBackgroundTransparent,.3)),Kb.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Kb.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=DS(e.scrollbarSliderBackground,Kb.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=DS(e.scrollbarSliderHoverBackground,Kb.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=DS(e.scrollbarSliderActiveBackground,Kb.opacity(t.foreground,.5)),t.overviewRulerBorder=DS(e.overviewRulerBorder,TS),t.ansi=yS.slice(),t.ansi[0]=DS(e.black,yS[0]),t.ansi[1]=DS(e.red,yS[1]),t.ansi[2]=DS(e.green,yS[2]),t.ansi[3]=DS(e.yellow,yS[3]),t.ansi[4]=DS(e.blue,yS[4]),t.ansi[5]=DS(e.magenta,yS[5]),t.ansi[6]=DS(e.cyan,yS[6]),t.ansi[7]=DS(e.white,yS[7]),t.ansi[8]=DS(e.brightBlack,yS[8]),t.ansi[9]=DS(e.brightRed,yS[9]),t.ansi[10]=DS(e.brightGreen,yS[10]),t.ansi[11]=DS(e.brightYellow,yS[11]),t.ansi[12]=DS(e.brightBlue,yS[12]),t.ansi[13]=DS(e.brightMagenta,yS[13]),t.ansi[14]=DS(e.brightCyan,yS[14]),t.ansi[15]=DS(e.brightWhite,yS[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=DS(e.extendedAnsi[r],yS[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};ES=ug([q(0,Ug)],ES);function DS(e,t){if(e!==void 0)try{return qb.toColor(e)}catch{}return t}var OS=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},kS=class{constructor(){this._services=new OS,this._services.set(Vg,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Pg(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},AS={trace:0,debug:1,info:2,warn:3,error:4,off:5},jS=`xterm.js: `,MS=class extends J{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),NS=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=AS[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:jS)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};MS=ug([q(0,Ug)],MS);var NS,PS=class extends J{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Y),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Y),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Y),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Q=3,FS=Object.freeze(new Og),IS=0,LS=2,RS=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Q);let r=t||Ag.fromCharData([0,Eg,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Q+0],n=t&2097151;return[this._data[e*Q+1],t&2097152?this._combined[e]:n?Sg(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Q+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Q+0]=e|2097152|t[2]<<22):this._data[e*Q+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Q+0]>>22}hasWidth(e){return this._data[e*Q+0]&12582912}getFg(e){return this._data[e*Q+1]}getBg(e){return this._data[e*Q+2]}hasContent(e){return this._data[e*Q+0]&4194303}getCodePoint(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Q+0]&2097152}getString(e){let t=this._data[e*Q+0];return t&2097152?this._combined[e]:t&2097151?Sg(t&2097151):``}isProtected(e){return this._data[e*Q+2]&536870912}loadCell(e,t){return IS=e*Q,t.content=this._data[IS+0],t.fg=this._data[IS+1],t.bg=this._data[IS+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*Q+0]=t.content,this._data[e*Q+1]=t.fg,this._data[e*Q+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Q+0]=t|n<<22,this._data[e*Q+1]=r.fg,this._data[e*Q+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Q+0];r&2097152?this._combined[e]+=Sg(t):r&2097151?(this._combined[e]=Sg(r&2097151)+Sg(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Q+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Ag;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Ag;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*LS<this._data.buffer.byteLength;let n=e*Q;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*LS<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*LS<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Q+0]&4194303)return e+(this._data[e*Q+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Q+0]&4194303||this._data[e*Q+2]&50331648)return e+(this._data[e*Q+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<Q;e++)this._data[(n+i)*Q+e]=a[(t+i)*Q+e];a[(t+i)*Q+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Q;e++)this._data[(n+i)*Q+e]=a[(t+i)*Q+e];a[(t+i)*Q+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*Q+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Sg(n):Dg;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function zS(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=US(u,d,t),p=1,m=0;for(;p<u.length;){let e=US(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function BS(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function VS(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function HS(e,t,n){let r=[],i=e.map((n,r)=>US(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=US(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function US(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var WS=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Y),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),j_(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};WS._nextId=1;var GS=WS,KS={},qS=KS.B;KS[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},KS.A={"#":`£`},KS.B=void 0,KS[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},KS.C=KS[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},KS.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},KS.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},KS.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},KS.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},KS.E=KS[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},KS.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},KS.H=KS[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},KS[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var JS=4294967295,YS=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=FS.clone(),this.savedCharset=qS,this.markers=[],this._nullCell=Ag.fromCharData([0,Eg,1,0]),this._whitespaceCell=Ag.fromCharData([0,Dg,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Kx,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new PS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new kg),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new kg),this._whitespaceCell}getBlankLine(e,t){return new RS(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>JS?JS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=FS);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new PS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(FS),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new RS(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new RS(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=zS(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(FS),n);if(r.length>0){let n=BS(this.lines,r);VS(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(FS),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new RS(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(FS),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=HS(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(FS,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=US(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new GS(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},XS=class extends J{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Y),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new YS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new YS(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},ZS=2,QS=1,$S=class extends J{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ZS),this.rows=Math.max(e.rawOptions.rows||0,QS),this.buffers=this._register(new XS(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};$S=ug([q(0,Ug)],$S);var eC={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Lx,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},tC=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],nC=class extends J{constructor(e){super(),this._onOptionChange=this._register(new Y),this.onOptionChange=this._onOptionChange.event;let t={...eC};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(N_(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in eC))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in eC))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=eC[e],!rC(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=eC[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=tC.includes(t)?t:eC[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function rC(e){return e===`block`||e===`underline`||e===`bar`}function iC(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&iC(e[r],t-1);return n}var aC=Object.freeze({insertMode:!1}),oC=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),sC=class extends J{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Y),this.onData=this._onData.event,this._onUserInput=this._register(new Y),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Y),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=iC(aC),this.decPrivateModes=iC(oC)}reset(){this.modes=iC(aC),this.decPrivateModes=iC(oC)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};sC=ug([q(0,Lg),q(1,Hg),q(2,Ug)],sC);var cC={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function lC(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var uC=String.fromCharCode,dC={DEFAULT:e=>{let t=[lC(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${uC(t[0])}${uC(t[1])}${uC(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${lC(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${lC(e,!0)};${e.x};${e.y}${t}`}},fC=class extends J{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Y),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(cC))this.addProtocol(e,cC[e]);for(let e of Object.keys(dC))this.addEncoding(e,dC[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};fC=ug([q(0,Lg),q(1,zg),q(2,Ug)],fC);var pC=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],mC=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],hC;function gC(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var _C=class{constructor(){if(this.version=`6`,!hC){hC=new Uint8Array(65536),hC.fill(1),hC[0]=0,hC.fill(0,1,32),hC.fill(0,127,160),hC.fill(2,4352,4448),hC[9001]=2,hC[9002]=2,hC.fill(2,11904,42192),hC[12351]=1,hC.fill(2,44032,55204),hC.fill(2,63744,64256),hC.fill(2,65040,65050),hC.fill(2,65072,65136),hC.fill(2,65280,65377),hC.fill(2,65504,65511);for(let e=0;e<pC.length;++e)hC.fill(0,pC[e][0],pC[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?hC[e]:gC(e,mC)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=vC.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return vC.createPropertyValue(0,n,r)}},vC=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Y,this.onChange=this._onChange.event;let e=new _C;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},yC=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function bC(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var xC=2147483647,SC=256,CC=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>SC)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=Array.isArray(t[0])?1:0;e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>xC?xC:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>xC?xC:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,xC):e}},wC=[],TC=class{constructor(){this._state=0,this._active=wC,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=wC}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=wC,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||wC,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Cg(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=wC,this._id=-1,this._state=0}}},EC=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Cg(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},DC=[],OC=class{constructor(){this._handlers=Object.create(null),this._active=DC,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=DC}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=DC,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||DC,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Cg(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=DC,this._ident=0}},kC=new CC;kC.addParam(0);var AC=class{constructor(e){this._handler=e,this._data=``,this._params=kC,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():kC,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Cg(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=kC,this._data=``,this._hitLimit=!1,e));return this._params=kC,this._data=``,this._hitLimit=!1,t}},jC=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},MC=160,NC=function(){let e=new jC(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(MC,0,2,0),e.add(MC,8,5,8),e.add(MC,6,0,6),e.add(MC,11,0,11),e.add(MC,13,13,13),e}(),PC=class extends J{constructor(e=NC){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new CC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(N_(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new TC),this._dcsParser=this._register(new OC),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:MC)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<MC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<MC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<MC){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<MC){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<MC){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<MC){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},FC=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,IC=/^[\da-f]+$/;function LC(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=FC.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),IC.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function RC(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function zC(e,t=16){let[n,r,i]=e;return`rgb:${RC(n,t)}/${RC(r,t)}/${RC(i,t)}`}var BC={"(":0,")":1,"*":2,"+":3,"-":1,".":2},VC=131072,HC=10;function UC(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var WC=5e3,GC=0,KC=class extends J{constructor(e,t,n,r,i,a,o,s,c=new PC){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wg,this._utf8Decoder=new Tg,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=FS.clone(),this._eraseAttrDataInternal=FS.clone(),this._onRequestBell=this._register(new Y),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Y),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Y),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Y),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Y),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Y),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Y),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Y),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Y),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new qC(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Lb.IND,()=>this.index()),this._parser.setExecuteHandler(Lb.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Lb.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new EC(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new EC(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new EC(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new EC(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new EC(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new EC(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new EC(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new EC(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new EC(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new EC(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new EC(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new EC(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in KS)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new AC((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),WC))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${WC} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>VC&&(a=this._parseStack.position+VC)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<VC&&(this._parseBuffer=new Uint32Array(Math.min(e.length,VC))),o||this._dirtyRowTracker.clearRange(),e.length>VC)for(let t=a;t<e.length;t+=VC){let a=t+VC<e.length?t+VC:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=vC.extractWidth(t);let n=vC.extractShouldJoin(t),m=n?vC.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Sg(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof RS&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>UC(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new AC(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new EC(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(FS));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=vC.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,qS),this._charsetService.setgCharset(1,qS),this._charsetService.setgCharset(2,qS),this._charsetService.setgCharset(3,qS);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:c===132?1:0:0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Og.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=FS.fg,e.bg=FS.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=FS.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=FS.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=FS.fg&16777215,r.bg&=-67108864,r.bg|=FS.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=FS.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!UC(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>HC&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>HC&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(JC(n))if(r===`?`)t.push({type:0,index:n});else{let e=LC(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=LC(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);JC(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,qS),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(BC[e[0]],KS[e[1]]||qS),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=FS.clone(),this._eraseAttrDataInternal=FS.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ag;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},qC=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(GC=e,e=t,t=GC),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};qC=ug([q(0,Lg)],qC);function JC(e){return 0<=e&&e<256}var YC=5e7,XC=12,ZC=50,QC=class extends J{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Y),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>YC)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=XC?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=XC)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>ZC&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},$C=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};$C=ug([q(0,Lg)],$C);var ew=!1,tw=class extends J{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new I_),this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onData=this._register(new Y),this.onData=this._onData.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Y),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Y),this._instantiationService=new kS,this.optionsService=this._register(new nC(e)),this._instantiationService.setService(Ug,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance($S)),this._instantiationService.setService(Lg,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(MS)),this._instantiationService.setService(Hg,this._logService),this.coreService=this._register(this._instantiationService.createInstance(sC)),this._instantiationService.setService(zg,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(fC)),this._instantiationService.setService(Rg,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(vC)),this._instantiationService.setService(Gg,this.unicodeService),this._charsetService=this._instantiationService.createInstance(yC),this._instantiationService.setService(Bg,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($C),this._instantiationService.setService(Wg,this._oscLinkService),this._inputHandler=this._register(new KC(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(K_.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(K_.forward(this._bufferService.onResize,this._onResize)),this._register(K_.forward(this.coreService.onData,this._onData)),this._register(K_.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new QC((e,t)=>this._inputHandler.parse(e,t))),this._register(K_.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Y),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!ew&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),ew=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,ZS),t=Math.max(t,QS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(bC.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(bC(this._bufferService),!1))),this._windowsWrappingHeuristics.value=N_(()=>{for(let t of e)t.dispose()})}}},nw={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function rw(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=Z.ESC+`OA`:i.key=Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=Z.ESC+`OD`:i.key=Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=Z.ESC+`OC`:i.key=Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=Z.ESC+`OB`:i.key=Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`D`:t?i.key=Z.ESC+`OD`:i.key=Z.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`C`:t?i.key=Z.ESC+`OC`:i.key=Z.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`A`:t?i.key=Z.ESC+`OA`:i.key=Z.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`B`:t?i.key=Z.ESC+`OB`:i.key=Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:a?i.key=Z.ESC+`[3;`+(a+1)+`~`:i.key=Z.ESC+`[3~`;break;case 36:a?i.key=Z.ESC+`[1;`+(a+1)+`H`:t?i.key=Z.ESC+`OH`:i.key=Z.ESC+`[H`;break;case 35:a?i.key=Z.ESC+`[1;`+(a+1)+`F`:t?i.key=Z.ESC+`OF`:i.key=Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Z.ESC+`[5;`+(a+1)+`~`:i.key=Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Z.ESC+`[6;`+(a+1)+`~`:i.key=Z.ESC+`[6~`;break;case 112:a?i.key=Z.ESC+`[1;`+(a+1)+`P`:i.key=Z.ESC+`OP`;break;case 113:a?i.key=Z.ESC+`[1;`+(a+1)+`Q`:i.key=Z.ESC+`OQ`;break;case 114:a?i.key=Z.ESC+`[1;`+(a+1)+`R`:i.key=Z.ESC+`OR`;break;case 115:a?i.key=Z.ESC+`[1;`+(a+1)+`S`:i.key=Z.ESC+`OS`;break;case 116:a?i.key=Z.ESC+`[15;`+(a+1)+`~`:i.key=Z.ESC+`[15~`;break;case 117:a?i.key=Z.ESC+`[17;`+(a+1)+`~`:i.key=Z.ESC+`[17~`;break;case 118:a?i.key=Z.ESC+`[18;`+(a+1)+`~`:i.key=Z.ESC+`[18~`;break;case 119:a?i.key=Z.ESC+`[19;`+(a+1)+`~`:i.key=Z.ESC+`[19~`;break;case 120:a?i.key=Z.ESC+`[20;`+(a+1)+`~`:i.key=Z.ESC+`[20~`;break;case 121:a?i.key=Z.ESC+`[21;`+(a+1)+`~`:i.key=Z.ESC+`[21~`;break;case 122:a?i.key=Z.ESC+`[23;`+(a+1)+`~`:i.key=Z.ESC+`[23~`;break;case 123:a?i.key=Z.ESC+`[24;`+(a+1)+`~`:i.key=Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=nw[e.keyCode]?.[e.shiftKey?1:0];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL));break}return i}var iw=0,aw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Kx,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Kx,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(iw=this._search(t),iw===-1)||this._getKey(this._array[iw])!==t)return!1;do if(this._array[iw]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(iw),!0;while(++iw<this._array.length&&this._getKey(this._array[iw])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(iw=this._search(e),!(iw<0||iw>=this._array.length)&&this._getKey(this._array[iw])===e))do yield this._array[iw];while(++iw<this._array.length&&this._getKey(this._array[iw])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(iw=this._search(e),!(iw<0||iw>=this._array.length)&&this._getKey(this._array[iw])===e))do t(this._array[iw]);while(++iw<this._array.length&&this._getKey(this._array[iw])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},ow=0,sw=0,cw=class extends J{constructor(){super(),this._decorations=new aw(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Y),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Y),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(N_(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new lw(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{ow=t.options.x??0,sw=ow+(t.options.width??1),e>=ow&&e<sw&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},lw=class extends F_{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Y),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Y),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=qb.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=qb.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},uw=1e3,dw=class{constructor(e,t=uw){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},fw=20,pw=!1,mw=class extends J{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new dw(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);pw?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
36
|
-
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(X(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(N_(()=>{pw?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<fw+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
37
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===fw+1&&(this._liveRegion.textContent+=mg.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};mw=ug([q(1,Vg),q(2,Xg),q(3,Qg)],mw);var hw=class extends J{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Y),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Y),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(N_(()=>{j_(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(X(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(X(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(X(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(X(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&gw(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,j_(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};hw=ug([q(1,Zg),q(2,Qg),q(3,Lg),q(4,n_)],hw);function gw(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var _w=class extends tw{constructor(e={}){super(e),this._linkifier=this._register(new I_),this.browser=kx,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new I_),this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Y),this.onKey=this._onKey.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Y),this.onBell=this._onBell.event,this._onFocus=this._register(new Y),this._onBlur=this._register(new Y),this._onA11yCharEmitter=this._register(new Y),this._onA11yTabEmitter=this._register(new Y),this._onWillOpen=this._register(new Y),this._setup(),this._decorationService=this._instantiationService.createInstance(cw),this._instantiationService.setService(Kg,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(wx),this._instantiationService.setService(n_,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(qg)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(K_.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(K_.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(K_.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(K_.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(N_(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=Kb.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${zC(r)}${Rb.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Gb.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Gb.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(mw,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(X(this.element,`copy`,e=>{this.hasSelection()&&_g(e,this._selectionService)}));let e=e=>vg(e,this.textarea,this.coreService,this.optionsService);this._register(X(this.textarea,`paste`,e)),this._register(X(this.element,`paste`,e)),Nx?this._register(X(this.element,`mousedown`,e=>{e.button===2&&xg(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(X(this.element,`contextmenu`,e=>{xg(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Vx&&this._register(X(this.element,`auxclick`,e=>{e.button===1&&bg(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(X(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(X(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(X(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(X(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(X(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(X(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(X(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(X(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,fg.get()),Hx||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Sx,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Xg,this._coreBrowserService),this._register(X(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(X(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(vx,this._document,this._helperContainer),this._instantiationService.setService(Yg,this._charSizeService),this._themeService=this._instantiationService.createInstance(ES),this._instantiationService.setService(t_,this._themeService),this._characterJoinerService=this._instantiationService.createInstance($b),this._instantiationService.setService(e_,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Jx,this.rows,this.screenElement)),this._instantiationService.setService(Qg,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(zb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Dx),this._instantiationService.setService(Zg,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(hw,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ab,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(gS,this.element,this.screenElement,r)),this._instantiationService.setService($g,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(K_.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(jb,this.screenElement)),this._register(X(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(mw,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ib,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ib,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(_x,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(X(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(X(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){yg(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=rw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(vw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(FS));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function vw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var yw=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},bw=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new Ag)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},xw=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new bw(t)}getNullCell(){return new Ag}},Sw=class extends J{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Y),this.onBufferChange=this._onBufferChange.event,this._normal=new xw(this._core.buffers.normal,`normal`),this._alternate=new xw(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Cw=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},ww=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Tw=[`cols`,`rows`],Ew=0,Dw=class extends J{constructor(e){super(),this._core=this._register(new _w(e)),this._addonManager=this._register(new yw),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Tw.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new Cw(this._core),this._parser}get unicode(){return this._checkProposedApi(),new ww(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new Sw(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
38
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return fg.get()},set promptLabel(e){fg.set(e)},get tooMuchOutput(){return mg.get()},set tooMuchOutput(e){mg.set(e)}}}_verifyIntegers(...e){for(Ew of e)if(Ew===1/0||isNaN(Ew)||Ew%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Ew of e)if(Ew&&(Ew===1/0||isNaN(Ew)||Ew%1!=0||Ew<0))throw Error(`This API only accepts positive integers`)}},Ow=2,kw=1,Aw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Ow,Math.floor(u/e.css.cell.width)),rows:Math.max(kw,Math.floor(l/e.css.cell.height))}}},jw={class:`flex flex-col h-full`},Mw={class:`flex items-stretch border-b border-border overflow-x-auto`},Nw=[`onClick`],Pw=[`onClick`],Fw={class:`truncate`},Iw={key:0,class:`px-3 py-1 text-[11px] text-danger bg-danger-dim`},Lw={key:`terminal`,label:`Terminal`,icon:`pixelarticons:terminal`,color:`#c5cdd8`,component:kr({__name:`window`,setup(e){let t=new Set,{state:n,set:r,setTitle:i,close:a}=ru(),{confirm:o}=uu(),s=Kt([]),c=F(null),l=F(null),u=F(``),d=null,f=0;L(()=>s.find(e=>e.id===c.value)?.label,e=>{i(e?`Terminal — ${e}`:`Terminal`)});let p={background:`#0a0e14`,foreground:`#c5cdd8`,cursor:`#39bae6`,cursorAccent:`#0a0e14`,selectionBackground:`#112a3a`,black:`#0a0e14`,red:`#e6564d`,green:`#7fd962`,yellow:`#e5a535`,blue:`#39bae6`,magenta:`#c586c0`,cyan:`#39bae6`,white:`#c5cdd8`,brightBlack:`#5c6773`,brightRed:`#e6564d`,brightGreen:`#7fd962`,brightYellow:`#e5a535`,brightBlue:`#39bae6`,brightMagenta:`#c586c0`,brightCyan:`#39bae6`,brightWhite:`#ffffff`},m={background:`#ffffff`,foreground:`#1d1d1f`,cursor:`#0077cc`,cursorAccent:`#ffffff`,selectionBackground:`#ddf4ff`,black:`#1d1d1f`,red:`#d1242f`,green:`#2da44e`,yellow:`#bf8700`,blue:`#0077cc`,magenta:`#8250df`,cyan:`#0077cc`,white:`#f5f5f7`,brightBlack:`#86868b`,brightRed:`#d1242f`,brightGreen:`#2da44e`,brightYellow:`#bf8700`,brightBlue:`#0077cc`,brightMagenta:`#8250df`,brightCyan:`#0077cc`,brightWhite:`#ffffff`},{effective:h}=dd();function g(){return h.value===`light`?m:p}let _={fontFamily:`'JetBrains Mono', 'Fira Code', monospace`,fontSize:13,lineHeight:1.2,theme:g(),cursorBlink:!0,cursorStyle:`bar`,allowProposedApi:!0};L(h,()=>{let e=g();for(let t of s)t.terminal.options.theme=e});function v(){return s.find(e=>e.id===c.value)}function y(e,n){if(t.has(e))return;t.add(e);let r=document.createElement(`div`);r.style.cssText=`width:100%;height:100%;display:none;overflow:hidden`;let i=new Dw(_),a=new Aw;i.loadAddon(a),l.value?.appendChild(r),i.open(r);let o=String(++f),c=Kt({id:o,sessionId:e,label:n,connected:!1,terminal:i,fitAddon:a,eventSource:null,containerEl:r});i.onTitleChange(e=>{let t=e.split(`/`).pop()||e;c.label=t,fetch(`/api/terminal/${c.sessionId}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({label:t})})}),i.onData(e=>{fetch(`/api/terminal/${c.sessionId}/input`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:e})})});let u=new EventSource(`/api/terminal/${e}/stream`);u.onmessage=e=>{let t=Uint8Array.from(atob(e.data),e=>e.charCodeAt(0));c.terminal.write(t)},u.onopen=()=>{c.connected=!0,Nn(()=>x(c))},u.onerror=()=>{u.close(),c.connected=!1,w(o)},c.eventSource=u,s.push(c),S(o)}async function b(){u.value=``;let e=await gu(`/api/terminal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:80,rows:24})});if(!e){u.value=`failed to create terminal session`;return}y(e.id,e.label??`shell`)}function x(e){e.fitAddon.fit(),fetch(`/api/terminal/${e.sessionId}/resize`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cols:e.terminal.cols,rows:e.terminal.rows})}).then(()=>{fetch(`/api/terminal/${e.sessionId}/nudge`,{method:`POST`})})}function S(e){for(let t of s)t.containerEl.style.display=t.id===e?`block`:`none`;c.value=e;let t=s.find(t=>t.id===e);t&&r({tab:t.sessionId}),Nn(()=>{t&&(x(t),t.terminal.focus())})}async function C(e){if(!await o(`Close this terminal session?`))return;let n=s.findIndex(t=>t.id===e);if(n<0)return;let r=s[n];if(r.eventSource?.close(),r.terminal.dispose(),r.containerEl.remove(),t.delete(r.sessionId),fetch(`/api/terminal/${r.sessionId}`,{method:`DELETE`}),s.splice(n,1),s.length===0){a();return}if(c.value===e){let e=s[Math.min(n,s.length-1)];e?S(e.id):c.value=null}}function w(e){let n=s.findIndex(t=>t.id===e);if(n<0)return;let r=s[n];if(r.eventSource?.close(),r.terminal.dispose(),r.containerEl.remove(),t.delete(r.sessionId),s.splice(n,1),s.length===0){a();return}if(c.value===e){let e=s[Math.min(n,s.length-1)];e?S(e.id):c.value=null}}return Wr(async()=>{await Nn(),d=new ResizeObserver(()=>{let e=v();e&&x(e)}),l.value&&d.observe(l.value);let e=n.value.tab,r=await gu(`/api/terminal`);if(r&&r.length>0){let n=r.filter(e=>!t.has(e.id)).sort((e,t)=>e.createdAt-t.createdAt);if(n.length>0){for(let e of n)y(e.id,e.label);if(e){let t=s.find(t=>t.sessionId===e);t&&S(t.id)}}else await b()}else await b()}),Jr(()=>{d?.disconnect();for(let e of s)e.eventSource?.close(),e.terminal.dispose(),t.delete(e.sessionId);s.length=0}),(e,t)=>(z(),B(`div`,jw,[V(`div`,Mw,[(z(!0),B(R,null,ai(s,e=>(z(),B(`button`,{key:e.id,type:`button`,class:M([`group relative flex-1 min-w-0 flex items-center justify-center gap-1.5 py-2 text-[13px] border-r border-border rounded-none active:transform-none transition-colors`,e.id===c.value?`bg-surface text-text`:`text-muted hover:text-text hover:bg-surface`]),onClick:t=>S(e.id)},[V(`span`,{class:M([`absolute left-2 w-4 h-4 flex items-center justify-center text-[11px] text-muted group-hover:opacity-100 hover:text-danger! transition-all`,e.id===c.value?`opacity-100`:`opacity-0`]),onClick:As(t=>C(e.id),[`stop`])},`×`,10,Pw),V(`span`,{class:M([`inline-block w-1.5 h-1.5 rounded-full shrink-0`,e.id===c.value?e.connected?`bg-ok`:`bg-danger`:`bg-muted`])},null,2),V(`span`,Fw,N(e.label),1)],10,Nw))),128)),V(`button`,{type:`button`,class:`shrink-0 px-3 py-2 text-[13px] text-muted hover:text-accent rounded-none active:transform-none transition-colors`,title:`new terminal`,onClick:b},` + `)]),u.value?(z(),B(`div`,Iw,N(u.value),1)):W(``,!0),V(`div`,{ref_key:`hostRef`,ref:l,class:`flex-1 min-h-0 bg-bg`},null,512)]))}}),window:{width:800,height:520,minwidth:480,minheight:300},multi:!1},Rw={class:`flex items-center justify-center h-full bg-bg overflow-auto p-4`},zw=[`src`,`alt`],Bw=[`src`],Vw=[`src`],Hw={key:3,class:`text-muted text-[12px]`},Uw=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`avif`]),Ww=new Set([`mp4`,`webm`,`mov`,`avi`]),Gw=new Set([`mp3`,`wav`,`ogg`,`flac`]);const Kw=new Set([...Uw,...Ww,...Gw]);var qw=kr({__name:`MediaViewer`,props:{folder:{},path:{}},setup(e){let t=e,n=G(()=>`/api/files/raw?${new URLSearchParams({folder:t.folder,path:t.path})}`),r=G(()=>t.path.split(`.`).pop()?.toLowerCase()??``),i=G(()=>Uw.has(r.value)?`image`:Ww.has(r.value)?`video`:Gw.has(r.value)?`audio`:`unknown`);return(t,r)=>(z(),B(`div`,Rw,[i.value===`image`?(z(),B(`img`,{key:0,src:n.value,alt:e.path,class:`max-w-full max-h-full object-contain rounded`},null,8,zw)):i.value===`video`?(z(),B(`video`,{key:1,src:n.value,controls:``,class:`max-w-full max-h-full rounded`},null,8,Bw)):i.value===`audio`?(z(),B(`audio`,{key:2,src:n.value,controls:``,class:`w-full max-w-md`},null,8,Vw)):(z(),B(`div`,Hw,`unsupported media format`))]))}}),Jw={class:`flex flex-col h-full`},Yw={key:0,class:`px-3 py-1.5 border-b border-border flex items-center gap-2 text-[11px]`},Xw={class:`text-muted/60 text-[10px] uppercase tracking-wide`},Zw={class:`text-muted font-mono truncate`},Qw={key:0,class:`text-warn text-[10px]`},$w={class:`ml-auto flex gap-2 flex-shrink-0`},eT=[`disabled`],tT={key:0,class:`text-[9px] opacity-60`},nT={key:3,class:`flex-1 flex items-center justify-center text-muted text-[12px]`},rT={key:`viewer`,label:`Viewer`,icon:`pixelarticons:file`,color:`#39bae6`,component:kr({__name:`window`,setup(e){let{confirm:t}=uu(),{state:n,set:r,setTitle:i}=ru(),a=F(``),o=F(``),s=F(``),c=F(!1),l=F(!1),u=G(()=>{let e=o.value.split(`.`).pop()?.toLowerCase()??``;return Kw.has(e)}),d=G(()=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,html:`html`,css:`css`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`,py:`python`,rs:`rust`,go:`go`,sql:`sql`,xml:`xml`})[o.value.split(`.`).pop()?.toLowerCase()??``]??`plaintext`);async function f(){if(!a.value||!o.value)return;if(u.value){s.value=``,c.value=!1;return}let e=await gu(`/api/files/read?${new URLSearchParams({folder:a.value,path:o.value})}`);e&&(s.value=e.content,c.value=!1)}async function p(){!o.value||l.value||(l.value=!0,await hu(`/api/files/write`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folder:a.value,path:o.value,content:s.value})}),c.value=!1,l.value=!1)}return L(o,e=>{let t=e.split(`/`).pop();i(t?`Viewer — ${t}`:`Viewer`)}),L(()=>[n.value.folder,n.value.path],async([e,n])=>{if(!(e===a.value&&n===o.value)){if(c.value&&!await t(`discard unsaved changes?`)){r({folder:a.value,path:o.value});return}a.value=e||``,o.value=n||``,await f()}},{immediate:!0}),(e,t)=>(z(),B(`div`,Jw,[o.value?(z(),B(`div`,Yw,[V(`span`,Xw,N(d.value),1),V(`span`,Zw,N(a.value)+`/`+N(o.value),1),c.value?(z(),B(`span`,Qw,`~`)):W(``,!0),V(`div`,$w,[V(`button`,{type:`button`,class:`btn-sm hover:bg-surface`,onClick:f},[...t[1]||=[U(` refresh `,-1),V(`span`,{class:`text-[9px] opacity-60`},`⌘R`,-1)]]),u.value?W(``,!0):(z(),B(`button`,{key:0,type:`button`,class:`btn-sm bg-accent-dim text-accent border-accent-dim hover:bg-accent-dimmer`,disabled:l.value,onClick:p},[U(N(l.value?`saving...`:`save`)+` `,1),l.value?W(``,!0):(z(),B(`span`,tT,`⌘S`))],8,eT))])])):W(``,!0),o.value&&u.value?(z(),Aa(qw,{key:1,folder:a.value,path:o.value,class:`flex-1`},null,8,[`folder`,`path`])):o.value?(z(),Aa(gd,{key:2,"model-value":s.value,language:d.value,class:`flex-1`,"onUpdate:modelValue":t[0]||=e=>{s.value=e,c.value=!0},onSave:p},null,8,[`model-value`,`language`])):(z(),B(`div`,nT,` no file open `))]))}}),window:{width:720,height:520,minwidth:400,minheight:300},multi:!0,hidden:!0},iT={class:`flex flex-col h-full p-4 gap-4 overflow-y-auto select-none`},aT={class:`border border-border rounded-lg p-3 flex items-center justify-between gap-3 bg-surface`},oT={class:`grid grid-cols-2 gap-3`},sT={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},cT={class:`flex items-center gap-2`},lT={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},uT={class:`flex items-center gap-2`},dT={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},fT={class:`flex items-center gap-2`},pT=[`disabled`],mT={class:`border border-border rounded-lg p-3 flex flex-col gap-2`},hT={class:`flex items-center gap-2`},gT={class:`grid grid-cols-5 gap-2`},_T=[`onClick`],vT={class:`text-[10px] font-medium`};const yT=[wp,bh,lf,Bh,bm,og,im,rT,Lw,eh,{key:`welcome`,label:`Welcome`,icon:`pixelarticons:briefcase-plus`,color:`#e5a535`,component:kr({__name:`window`,setup(e){let t=new Set([`agent`,`telegram`,`chat`,`settings`,`welcome`]),n=yT.filter(e=>!e.hidden&&!t.has(e.key)),{openWindow:r}=ru(),i=F(null),a=F(null);async function o(){let[e,t]=await Promise.all([gu(`/api/pi/status`),gu(`/api/telegram/status`)]);e&&(i.value=e),t&&(a.value=t)}yu(o,5e3);let s=G(()=>(i.value?.auth.configuredProviders.length??0)>0||i.value?.auth.providers.some(e=>e.hasAuth)),c=G(()=>a.value?.connected??!1);function l(){r(`agent`,{tab:`auth`})}function u(){r(`telegram`)}function d(){r(`chat`)}function f(){r(`settings`,{tab:`wallpaper`})}return(e,t)=>(z(),B(`div`,iT,[t[9]||=V(`div`,{class:`text-center`},[V(`div`,{class:`text-[18px] font-medium text-text mb-1`},`welcome to piclaw`),V(`div`,{class:`text-[12px] text-muted`},`follow these steps to get started`)],-1),V(`div`,aT,[t[0]||=V(`div`,{class:`flex flex-col gap-1`},[V(`div`,{class:`text-[12px] text-text`},`for the best experience, install piclaw`)],-1),H(Wl,{"inline-install":``})]),V(`div`,oT,[V(`div`,sT,[V(`div`,cT,[H(I(K),{icon:s.value?`lucide:check`:`lucide:cpu`,class:M([`text-[16px] shrink-0`,s.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:M([`text-[13px] font-medium`,s.value?`text-ok`:`text-text`])},` connect ai provider `,2)]),t[1]||=V(`div`,{class:`text-[11px] text-muted`},` set up a provider (anthropic, openai, etc.) to power your agents `,-1),V(`button`,{type:`button`,class:M([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors`,s.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`]),onClick:l},N(s.value?`connected — manage`:`open agent settings`),3)]),V(`div`,lT,[V(`div`,uT,[H(I(K),{icon:c.value?`lucide:check`:`lucide:send`,class:M([`text-[16px] shrink-0`,c.value?`text-ok`:`text-muted`])},null,8,[`icon`,`class`]),V(`div`,{class:M([`text-[13px] font-medium`,c.value?`text-ok`:`text-text`])},[...t[2]||=[U(` connect telegram `,-1),V(`span`,{class:`text-[10px] text-muted font-normal ml-1`},`optional`,-1)]],2)]),t[3]||=V(`div`,{class:`text-[11px] text-muted`},`link a telegram bot to chat from telegram`,-1),V(`button`,{type:`button`,class:M([`mt-auto px-3 py-1.5 rounded text-[11px] font-medium cursor-pointer transition-colors`,c.value?`bg-ok-dim text-ok border border-ok-dim hover:text-text`:`bg-accent-dim text-accent border border-accent-dim hover:bg-accent-dimmer`]),onClick:u},N(c.value?`connected — @${a.value?.botUsername}`:`set up telegram bot`),3)]),V(`div`,dT,[V(`div`,fT,[H(I(K),{icon:`lucide:message-circle`,class:`text-[16px] shrink-0 text-muted`}),t[4]||=V(`div`,{class:`text-[13px] font-medium text-text`},`start your first chat`,-1)]),t[5]||=V(`div`,{class:`text-[11px] text-muted`},`register a group and send your first message`,-1),V(`button`,{type:`button`,class:M([`mt-auto btn-primary text-[11px]`,{"opacity-50 cursor-not-allowed":!s.value}]),disabled:!s.value,onClick:d},` open chat `,10,pT)]),V(`div`,mT,[V(`div`,hT,[H(I(K),{icon:`lucide:palette`,class:`text-[16px] shrink-0 text-muted`}),t[6]||=V(`div`,{class:`text-[13px] font-medium text-text`},`customize your desktop`,-1)]),t[7]||=V(`div`,{class:`text-[11px] text-muted`},`pick a wallpaper to personalize your dashboard`,-1),V(`button`,{type:`button`,class:`mt-auto btn-primary text-[11px]`,onClick:f},` open wallpaper settings `)])]),V(`div`,null,[t[8]||=V(`div`,{class:`label mb-2`},`discover more`,-1),V(`div`,gT,[(z(!0),B(R,null,ai(I(n),e=>(z(),B(`button`,{key:e.key,type:`button`,class:`flex flex-col items-center justify-center gap-1 py-2 rounded-lg border border-border bg-surface cursor-pointer transition-colors hover:border-muted hover:text-text text-muted`,onClick:t=>I(r)(e.key)},[H(I(K),{icon:e.icon,class:`text-[16px]`,style:_e({color:e.color})},null,8,[`icon`,`style`]),V(`span`,vT,N(e.label.toLowerCase()),1)],8,_T))),128))])])]))}}),window:{width:480,height:520,minwidth:380,minheight:400}}];var bT={class:`flex justify-center pb-1.5 pt-0.5 sticky bottom-0 z-[1001] pointer-events-none max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:pb-0 max-md:pt-0`},xT={key:0,class:`w-px h-5 bg-white/10 mx-0.5`},ST=[`title`,`onClick`,`onContextmenu`,`onTouchstart`],CT={key:1,class:`w-px h-5 bg-white/10 mx-0.5`},wT={key:0,class:`font-pixel text-[13px] text-white/80 select-none leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.8)]`},TT=[`title`],ET={class:`grid grid-cols-3 gap-8 p-8 pt-16 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6`},DT=[`onClick`],OT={class:`flex items-center justify-center w-14 h-14 sm:w-21 sm:h-21 rounded-2xl bg-surface border border-border shadow-md transition-transform group-hover:scale-110`},kT={class:`text-[11px] text-white/80 group-hover:text-white transition-colors`,style:{"text-shadow":`0 1px 3px rgba(0, 0, 0, 0.8),
|
|
39
|
-
0 0 6px rgba(0, 0, 0, 0.4)`}},AT={key:0,class:`w-1 h-1 rounded-full bg-accent`},jT={key:0,class:`col-span-full text-center text-white/60 text-sm py-4`,style:{"text-shadow":`0 1px 3px rgba(0, 0, 0, 0.8)`}},MT={key:0,class:`fixed inset-0 z-[1200] flex flex-col items-center justify-center backdrop-blur-xl bg-bg/60 select-none`},NT={class:`flex flex-col items-center gap-4`},PT=kr({__name:`DashPanel`,props:{openInstances:{},minimized:{},focusedWindow:{}},emits:[`launch`,`focus`,`minimize`,`close`],setup(e,{emit:t}){let n=e,r=t,{settings:i}=eu(),a={small:{bar:40,item:34,icon:16},medium:{bar:48,item:40,icon:20},large:{bar:56,item:46,icon:24}},o=G(()=>{let e=a[i.dockSize]||a.medium;return{"--dock-h":`${e.bar}px`,"--dock-item":`${e.item}px`,"--dock-icon":`${e.icon}px`}}),s=F(!1),c=F(``),l,{menu:u,onContext:d,onTouchStart:f,cancelLongPress:p,close:m}=Gl();function h(){u.value&&r(`minimize`,u.value.data),m()}function g(){u.value&&r(`close`,u.value.data),m()}let{menu:_,onContext:v,close:y}=Gl();function b(){y(),r(`launch`,`settings`,{tab:`dash`})}let x=G(()=>new Set(n.openInstances.map(e=>e.appKey))),S=F(``),C=F(),w=F(!1),T=vu(),E=G(()=>{let e=S.value.toLowerCase().trim(),t=yT.filter(e=>!e.hidden);return e?t.filter(t=>t.label.toLowerCase().includes(e)):t}),{showInstall:D,handleInstallClick:ee}=Ll(),O=F(!0),te=F(!1);yu(async()=>{let e=!O.value;O.value=await hu(`/api/health`)!==null,e&&O.value&&(te.value=!1)},3e4);function ne(){s.value=!s.value,S.value=``,w.value=!1,s.value&&!T.value&&Nn(()=>C.value?.focus())}function k(){w.value=!0,Nn(()=>C.value?.focus())}function A(e){e.key===`Enter`&&E.value.length===1&&re(E.value[0].key)}function re(e){r(`launch`,e),s.value=!1}function j(){c.value=new Date().toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:i.clockFormat===`12h`})}function ie(e){if(e.key===`Escape`&&u.value){m(),e.preventDefault();return}e.key===`Escape`&&s.value&&(s.value=!1,e.preventDefault()),(e.key===` `||e.key===`k`)&&(e.ctrlKey||e.metaKey)&&(ne(),e.preventDefault())}return Wr(()=>{j(),l=setInterval(j,1e4),document.addEventListener(`keydown`,ie)}),Jr(()=>{clearInterval(l),document.removeEventListener(`keydown`,ie)}),(t,n)=>(z(),B(R,null,[V(`div`,bT,[V(`div`,{class:`dock-bar force-dark pointer-events-auto px-2 rounded-2xl flex items-center gap-1 text-[12px] select-none max-md:w-full max-md:rounded-none`,style:_e(o.value),onContextmenu:n[4]||=e=>I(v)(e,void 0)},[V(`button`,{type:`button`,class:M([`dock-item`,s.value?`text-accent`:`text-white/70`]),title:`Apps (Ctrl+Space / Ctrl+K)`,onClick:ne,onContextmenu:n[0]||=e=>I(v)(e,void 0)},[H(I(K),{icon:`lucide:layout-grid`,class:`dock-icon`})],34),e.openInstances.length?(z(),B(`div`,xT)):W(``,!0),(z(!0),B(R,null,ai(e.openInstances,t=>(z(),B(`button`,{key:t.id,type:`button`,class:M([`dock-item text-white/70`,{"!text-white":e.focusedWindow===t.id,"opacity-50":e.minimized[t.id]}]),title:t.app.label.toLowerCase(),onClick:e=>r(`focus`,t.id),onContextmenu:As(e=>I(d)(e,t.id),[`stop`]),onTouchstart:e=>I(f)(e,t.id),onTouchend:n[1]||=(...e)=>I(p)&&I(p)(...e),onTouchmove:n[2]||=(...e)=>I(p)&&I(p)(...e)},[H(I(K),{icon:t.app.icon,class:`dock-icon`,"aria-hidden":`true`,style:_e({color:t.app.color})},null,8,[`icon`,`style`]),V(`span`,{class:M([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,e.focusedWindow===t.id?`bg-accent opacity-100`:`bg-muted opacity-50`])},null,2)],42,ST))),128)),n[11]||=V(`div`,{class:`flex-1`},null,-1),e.openInstances.length&&(I(i).showClock||I(i).showStatus)?(z(),B(`div`,CT)):W(``,!0),I(i).showClock||I(i).showStatus?(z(),B(`div`,{key:2,class:`dock-item !cursor-default !w-auto px-1.5 text-white/70 hover:!bg-transparent hover:!transform-none`,onContextmenu:n[3]||=e=>I(v)(e,void 0)},[I(i).showClock?(z(),B(`span`,wT,N(c.value),1)):W(``,!0),I(i).showStatus?(z(),B(`span`,{key:1,class:M([`absolute -bottom-0.5 w-1 h-1 rounded-full transition-opacity`,O.value?`bg-ok`:`bg-danger`]),title:O.value?`server healthy`:`server unreachable`},null,10,TT)):W(``,!0)],32)):W(``,!0)],36)]),(z(),Aa(dr,{to:`body`},[H(Oo,{name:`launchpad`},{default:Gn(()=>[s.value?(z(),B(`div`,{key:0,class:M([`force-dark fixed inset-0 z-[1100] flex justify-center backdrop-blur-sm bg-transparent backdrop-saturate-150`,w.value?`items-start pt-16`:`items-center`]),onClick:n[8]||=e=>s.value=!1},[!I(T)||w.value?Kn((z(),B(`input`,{key:0,ref_key:`searchInput`,ref:C,"onUpdate:modelValue":n[5]||=e=>S.value=e,class:`absolute top-6 left-1/2 -translate-x-1/2 w-48 px-3 py-1.5 bg-surface/90 border border-border rounded-lg text-sm text-text backdrop-blur-md outline-none text-center`,placeholder:`search apps...`,"aria-label":`Search apps`,onClick:n[6]||=As(()=>{},[`stop`]),onKeydown:A},null,544)),[[ws,S.value]]):W(``,!0),V(`button`,{type:`button`,class:`absolute top-6 left-6 p-2 text-white/50 hover:text-white transition-colors`,title:`close`,onClick:n[7]||=e=>s.value=!1},[H(I(K),{icon:`lucide:x`,class:`text-lg`})]),I(T)&&!w.value?(z(),B(`button`,{key:1,type:`button`,class:`absolute top-6 right-6 p-2 bg-surface/80 border border-border rounded-lg text-muted hover:text-text backdrop-blur-md transition-colors`,onClick:As(k,[`stop`])},[H(I(K),{icon:`lucide:search`,class:`text-base`})])):W(``,!0),V(`div`,ET,[(z(!0),B(R,null,ai(E.value,e=>(z(),B(`button`,{key:`launcher-${e.key}`,type:`button`,class:`group flex flex-col items-center gap-2 p-4 rounded-xl transition-all`,onClick:t=>re(e.key)},[V(`span`,OT,[H(I(K),{icon:e.icon,class:`text-2xl sm:text-4xl`,"aria-hidden":`true`,style:_e({color:e.color})},null,8,[`icon`,`style`])]),V(`span`,kT,N(e.label),1),x.value.has(e.key)?(z(),B(`span`,AT)):W(``,!0)],8,DT))),128)),S.value&&!E.value.length?(z(),B(`div`,jT,` No apps found `)):W(``,!0)])],2)):W(``,!0)]),_:1})])),(z(),Aa(dr,{to:`body`},[H(Oo,{name:`launchpad`},{default:Gn(()=>[!O.value&&!te.value?(z(),B(`div`,MT,[V(`div`,NT,[n[13]||=V(`span`,{class:`inline-block w-3 h-3 rounded-full bg-danger animate-pulse`},null,-1),n[14]||=V(`p`,{class:`text-muted text-[13px] tracking-wide`},`server unreachable`,-1),V(`button`,{type:`button`,class:`mt-2 px-4 py-1.5 text-[11px] font-medium bg-bg text-muted border border-border rounded hover:text-text transition-colors`,onClick:n[9]||=e=>te.value=!0},` dismiss `),I(D)?(z(),B(`button`,{key:0,type:`button`,class:`mt-1 px-4 py-1.5 text-[11px] font-medium text-accent border border-accent/30 rounded hover:bg-accent/10 transition-colors inline-flex items-center gap-1.5`,onClick:n[10]||=e=>I(ee)()},[H(I(K),{icon:`lucide:download`,class:`text-[13px]`}),n[12]||=U(` install app `,-1)])):W(``,!0)])])):W(``,!0)]),_:1})])),H(wl,{pos:I(u)??null,transform:`translateY(-100%)`},{default:Gn(()=>[V(`button`,{type:`button`,class:`w-full px-3 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:h},` Minimize `),V(`button`,{type:`button`,class:`w-full px-3 py-1.5 text-left text-[12px] text-text hover:bg-danger-dim hover:text-danger transition-colors cursor-pointer`,onClick:g},` Close `)]),_:1},8,[`pos`]),H(wl,{pos:I(_)??null,transform:`translateY(-100%)`},{default:Gn(()=>[V(`button`,{type:`button`,class:`w-full px-3 py-1.5 text-left text-[12px] text-text hover:bg-accent-dim hover:text-accent transition-colors cursor-pointer`,onClick:b},` Dash settings `)]),_:1},8,[`pos`])],64))}}),FT=`#ff5f57`,IT=`#febc2e`,LT=`#28c840`,RT=`var(--color-tl-inactive)`,zT=12,BT=`width 0.2s, height 0.2s, left 0.2s, top 0.2s`,VT=`ease-out`,HT={display:`inline-block`,width:`${zT}px`,height:`${zT}px`,borderRadius:`50%`,cursor:`pointer`,flexShrink:`0`},UT={"wb-n":{top:`-5px`,left:`0`,right:`0`,height:`10px`},"wb-s":{bottom:`-5px`,left:`0`,right:`0`,height:`10px`},"wb-w":{top:`0`,left:`-5px`,bottom:`0`,width:`10px`},"wb-e":{top:`0`,right:`-5px`,bottom:`0`,width:`10px`},"wb-nw":{top:`-5px`,left:`-5px`,width:`15px`,height:`15px`},"wb-ne":{top:`-5px`,right:`-5px`,width:`15px`,height:`15px`},"wb-sw":{bottom:`-5px`,left:`-5px`,width:`15px`,height:`15px`},"wb-se":{bottom:`-5px`,right:`-5px`,width:`15px`,height:`15px`}},WT={"wb-n":`n-resize`,"wb-s":`n-resize`,"wb-w":`w-resize`,"wb-e":`w-resize`,"wb-nw":`nw-resize`,"wb-ne":`ne-resize`,"wb-sw":`ne-resize`,"wb-se":`nw-resize`},GT=Object.keys(UT);function KT(e,t,n,r){e?.addEventListener(t,n,r||!1)}function qT(e,t,n,r){e?.removeEventListener(t,n,r||!1)}function JT(e,t){e.stopPropagation(),t&&e.preventDefault()}function $(e,t){return e.getElementsByClassName(t)[0]}function YT(e,t){e.classList.add(t)}function XT(e,t){return e.classList.contains(t)}function ZT(e,t){e.classList.remove(t)}function QT(e,t,n){let r=e,i=String(n),a=`_s_${t}`;r[a]!==i&&(e.style.setProperty(t,i),r[a]=i)}function $T(e,t){let n=e.firstChild;n?n.nodeValue=t:e.textContent=t}var eE=document.createElement(`div`);eE.innerHTML=`<div class=wb-modal-bg></div><div class=wb-modal-overlay></div><div class=wb-header><div class=wb-control><span class=wb-close></span><span class=wb-min></span><span class=wb-max></span><span class=wb-full></span></div><div class=wb-drag><div class=wb-icon></div><div class=wb-title></div></div></div><div class=wb-body></div><div class=wb-n></div><div class=wb-s></div><div class=wb-w></div><div class=wb-e></div><div class=wb-nw></div><div class=wb-ne></div><div class=wb-se></div><div class=wb-sw></div>`;var tE=[],nE=[],rE={capture:!0,passive:!1},iE={capture:!0,passive:!0},aE,oE=0,sE=10,cE,lE=``,uE=``,dE=0,fE=0,pE=!1,mE=class e{static new(t){return new e(t)}static stack(){return nE}dom;window;body;header;id;title=``;x=0;y=0;width=0;height=0;minwidth=150;minheight=35;maxwidth=0;maxheight=0;top=0;right=0;bottom=0;left=0;index=0;overflow=!1;min=!1;max=!1;full=!1;hidden=!1;focused=!1;noAnimation=!1;noMove=!1;noMax=!1;_optionHidden=new Set;onclose;onfocus;onblur;onmove;onresize;onfullscreen;onmaximize;onminimize;onrestore;onhide;onshow;constructor(e,t){aE??TE();let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v=!1,y,b,x,S,C,w,T=!1,E=!1,D=!1,ee=!1,O,te,ne,k,A,re=null;if(e&&(t&&(o=String(e),e=t),typeof e==`string`?o=e:(n=e.id,r=e.index,i=e.root,a=e.template,o??=e.title,s=e.icon,c=e.mount,l=e.html,u=e.url,d=e.width,f=e.height,p=e.minwidth,m=e.minheight,h=e.maxwidth,g=e.maxheight,_=e.autosize,v=!!e.overflow,T=!!e.min,E=!!e.max,D=!!e.hidden,ee=!!e.modal,y=e.x??(ee?`center`:0),b=e.y??(ee?`center`:0),x=e.top,S=e.left,C=e.bottom,w=e.right,O=e.background,te=e.border,ne=e.header,k=e.class,A=e.oncreate,this.onclose=e.onclose,this.onfocus=e.onfocus,this.onblur=e.onblur,this.onmove=e.onmove,this.onresize=e.onresize,this.onfullscreen=e.onfullscreen,this.onmaximize=e.onmaximize,this.onminimize=e.onminimize,this.onrestore=e.onrestore,this.onhide=e.onhide,this.onshow=e.onshow,re=e.onload??null)),this.dom=hE(a),this.id=n||`winbox-${++oE}`,this.dom.id=this.id,this.dom.className=`winbox`,this.dom.winbox=this,this.window=this.dom,this.body=$(this.dom,`wb-body`),this.header=ne||35,_E(this.dom),k){let e=Array.isArray(k)?k:k.split(` `);bE(this,this.dom,e)}if(ee&&CE(this.dom,!0),nE.push(this),O&&this.setBackground(O),te?QT(this.body,`margin`,`${te}${Number.isNaN(Number(te))?``:`px`}`):te=0,ne){let e=$(this.dom,`wb-header`);QT(e,`height`,`${ne}px`),QT(e,`line-height`,`${ne}px`),QT(this.body,`top`,`${ne}px`)}o&&this.setTitle(o),s&&this.setIcon(s),c?this.mount(c):l?this.body.innerHTML=l:u&&this.setUrl(u,re);let j=x?gE(x,fE):0,ie=C?gE(C,fE):0,ae=S?gE(S,dE):0,oe=w?gE(w,dE):0,se=dE-ae-oe,ce=fE-j-ie,le=h?gE(h,se):se,ue=g?gE(g,ce):ce,de=p?gE(p,le):150,fe=m?gE(m,ue):this.header,pe,me;_?((i||aE).appendChild(this.body),pe=Math.max(Math.min(this.body.clientWidth+Number(te)*2+1,le),de),me=Math.max(Math.min(this.body.clientHeight+this.header+Number(te)+1,ue),fe),this.dom.appendChild(this.body)):(pe=d?gE(d,le):Math.max(le/2|0,de),me=f?gE(f,ue):Math.max(ue/2|0,fe));let he=y===void 0?ae:gE(y,se,pe),ge=b===void 0?j:gE(b,ce,me);this.x=he,this.y=ge,this.width=pe,this.height=me,this.minwidth=de,this.minheight=fe,this.maxwidth=le,this.maxheight=ue,this.top=j,this.right=oe,this.bottom=ie,this.left=ae,this.index=r??this.index,this.overflow=v,D?this.hide():this.focus(),r!==void 0&&(this.index=r,QT(this.dom,`z-index`,String(r)),r>sE&&(sE=r)),E?this.maximize():T?this.minimize():this.resize().move(),EE(this),(i||aE).appendChild(this.dom),A?.call(this,e)}mount(e){return this.unmount(),e?(e._backstore||=e.parentNode,this.body.textContent=``,this.body.appendChild(e),this):this}unmount(e){let t=this.body.firstChild;return t&&((e??t._backstore)?.appendChild(t),t._backstore=e),this}setTitle(e){return $T($(this.dom,`wb-title`),this.title=e),this}setIcon(e){let t=$(this.dom,`wb-icon`);return QT(t,`background-image`,`url(${e})`),QT(t,`display`,`inline-block`),this}setBackground(e){return QT(this.dom,`background`,e),this}setUrl(e,t){let n=this.body.firstChild;if(n&&n.tagName.toLowerCase()===`iframe`)n.src=e;else{this.body.innerHTML=`<iframe src="${e}"></iframe>`;let n=this.body.firstChild;n&&(Object.assign(n.style,{position:`absolute`,width:`100%`,height:`100%`,border:`0`}),n.onload=t??null)}return this}focus(e){if(e===!1)return this.blur();if(!this.focused){let e=nE.length;if(e>1)for(let t=1;t<=e;t++){let n=nE[e-t];if(n?.focused){n.blur();let e=nE.indexOf(this);e>=0&&nE.push(nE.splice(e,1)[0]);break}}QT(this.dom,`z-index`,String(++sE)),this.index=sE,this.focused=!0,yE(this.dom,!0),this.onfocus?.()}return this}blur(e){return e===!1?this.focus():(this.focused&&(this.focused=!1,yE(this.dom,!1),this.onblur?.()),this)}hide(e){return e===!1?this.show():(this.hidden||(this.onhide?.(),this.hidden=!0,this.dom.style.display=`none`),this)}show(e){return e===!1?this.hide():(this.hidden&&=(this.onshow?.(),!1),this.dom.style.display=``,this)}minimize(e){if(e===!1)return this.restore();if(cE&&NE(),this.max&&=(xE(this,this.dom,!1),!1),!this.min){tE.push(this),this.dom.title=this.title,SE(this,this.dom,!0),this.min=!0;let e=this.header,t=(dE-200)/2|0,n=fE-e;this.resize(200,e,!0).move(t,n,!0);let r=this.dom,i=()=>{r.removeEventListener(`transitionend`,i),this.min&&(r.style.display=`none`)};r.addEventListener(`transitionend`,i),this.focused&&(this.blur(),jE()),this.onminimize?.()}return this}restore(){return cE&&NE(),this.min&&(this.dom.style.display=``,DE(this),this.resize().move(),this.onrestore?.()),this.max&&(this.max=!1,xE(this,this.dom,!1),this.resize().move(),this.onrestore?.()),this}maximize(e){return e===!1?this.restore():(cE&&NE(),this.min&&DE(this),this.max||(xE(this,this.dom,!0),this.resize(dE-this.left-this.right,fE-this.top-this.bottom,!0).move(this.left,this.top,!0),this.max=!0,this.onmaximize?.()),this)}fullscreen(e){if(this.min&&(DE(this),this.resize().move()),!cE||!NE()){let e=this.body,t=e[lE];typeof t==`function`&&t.call(e),cE=this,this.full=!0,this.onfullscreen?.()}else if(e===!1)return this.restore();return this}close(e){if(this.onclose?.(e))return!0;this.min&&DE(this);let t=nE.indexOf(this);t>=0&&nE.splice(t,1),this.unmount(),this.dom.remove(),this.dom.textContent=``,this.dom.winbox=null;let n=this.focused;this.focused=!1,this.body=null,this.dom=null,n&&jE()}move(e,t,n){let r,i;return e===void 0&&e!==0?(r=this.x,i=this.y):n?(r=Number(e??this.x),i=Number(t??this.y)):(r=e?gE(e,dE-this.left-this.right,this.width):0,i=t?gE(t,fE-this.top-this.bottom,this.height):0,this.x=r,this.y=i),QT(this.dom,`left`,`${r}px`),QT(this.dom,`top`,`${i}px`),this.onmove?.(r,i),this}resize(e,t,n){let r,i;return e===void 0&&e!==0?(r=this.width,i=this.height):n?(r=Number(e??this.width),i=Number(t??this.height)):(r=e?gE(e,this.maxwidth):0,i=t?gE(t,this.maxheight):0,r=Math.max(r,this.minwidth),i=Math.max(i,this.minheight),this.width=r,this.height=i),QT(this.dom,`width`,`${r}px`),QT(this.dom,`height`,`${i}px`),this.onresize?.(r,i),this}addControl(e){let t=e.class,n=e.image,r=e.click,i=e.index,a=document.createElement(`span`),o=$(this.dom,`wb-control`),s=this;return Object.assign(a.style,HT,{background:RT}),t&&(a.className=t),n&&QT(a,`background-image`,`url(${n})`),r&&(a.onclick=function(e){r.call(this,e,s)}),o.insertBefore(a,o.childNodes[i||0]??null),this}removeControl(e){return $(this.dom,e)?.remove(),this}addClass(e){return YT(this.dom,e),this}removeClass(e){return ZT(this.dom,e),this}hasClass(e){return XT(this.dom,e)}toggleClass(e){return this.hasClass(e)?this.removeClass(e):this.addClass(e)}};function hE(e){return e?e.cloneNode(!0):eE.cloneNode(!0)}function gE(e,t,n=0){if(typeof e==`string`){if(e===`center`)return(t-n)/2+.5|0;if(e===`right`||e===`bottom`)return t-n;let r=parseFloat(e),i=String(r);return(i===e?``:e.slice(i.length))===`%`?t/100*r+.5|0:r}return e}function _E(e){Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,background:`var(--color-surface)`,border:`1px solid var(--color-border)`,borderRadius:`10px`,boxShadow:`var(--shadow-window)`,transition:BT,transitionTimingFunction:VT,contain:`layout size`,textAlign:`left`,touchAction:`none`});let t=$(e,`wb-modal-bg`);Object.assign(t.style,{display:`none`,position:`absolute`,top:`0`,left:`0`,right:`0`,bottom:`0`,background:`inherit`,borderRadius:`inherit`});let n=$(e,`wb-modal-overlay`);Object.assign(n.style,{display:`none`,position:`absolute`,top:`-50vh`,left:`-50vw`,right:`-50vw`,bottom:`-50vh`,background:`var(--color-bg)`,zIndex:`-1`});let r=$(e,`wb-header`);Object.assign(r.style,{position:`absolute`,left:`0`,top:`0`,width:`100%`,height:`38px`,lineHeight:`38px`,color:`var(--color-muted)`,borderBottom:`1px solid var(--color-border)`,background:`var(--color-surface)`,borderRadius:`10px 10px 0 0`,overflow:`hidden`,zIndex:`1`});let i=$(e,`wb-body`);Object.assign(i.style,{position:`absolute`,top:`38px`,left:`0`,right:`0`,bottom:`0`,overflow:`auto`,willChange:`contents`,marginTop:`0`,contain:`layout size`,zIndex:`0`,background:`var(--color-bg)`,borderRadius:`0 0 10px 10px`,color:`var(--color-text, inherit)`,textAlign:`initial`,touchAction:`auto`,cursor:`auto`}),i.style.webkitOverflowScrolling=`touch`;let a=$(e,`wb-control`);Object.assign(a.style,{float:`left`,height:`100%`,display:`flex`,alignItems:`center`,gap:`8px`,paddingLeft:`14px`});let o=$(e,`wb-drag`);Object.assign(o.style,{height:`100%`,cursor:`default`,overflow:`hidden`});let s=$(e,`wb-title`);Object.assign(s.style,{fontFamily:`'Geist', 'Geist Variable', sans-serif`,fontSize:`13px`,fontWeight:`500`,letterSpacing:`0`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,textAlign:`center`,paddingRight:`60px`});let c=$(e,`wb-icon`);Object.assign(c.style,{display:`none`,width:`20px`,height:`100%`,margin:`-1px 8px 0 -3px`,float:`left`,backgroundRepeat:`no-repeat`,backgroundSize:`100%`,backgroundPosition:`center`});let l=$(e,`wb-close`);Object.assign(l.style,HT,{background:FT});let u=$(e,`wb-min`);Object.assign(u.style,HT,{background:IT});let d=$(e,`wb-max`);Object.assign(d.style,HT,{background:LT});let f=$(e,`wb-full`);Object.assign(f.style,HT,{background:LT,display:`none`}),vE(a,l,u,d,f);for(let t of GT){let n=$(e,t);n&&Object.assign(n.style,{position:`absolute`,zIndex:`2`},UT[t])}}function vE(e,t,n,r,i){let a=e=>`url("data:image/svg+xml,${encodeURIComponent(e)}")`,o=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><g fill="#460804" fill-rule="evenodd" clip-rule="evenodd"><path d="M22.5 57.8l35.3-35.3c1.4-1.4 3.6-1.4 5 0l.1.1c1.4 1.4 1.4 3.6 0 5L27.6 62.9c-1.4 1.4-3.6 1.4-5 0l-.1-.1c-1.3-1.4-1.3-3.6 0-5z"/><path d="M27.6 22.5l35.3 35.3c1.4 1.4 1.4 3.6 0 5l-.1.1c-1.4 1.4-3.6 1.4-5 0L22.5 27.6c-1.4-1.4-1.4-3.6 0-5l.1-.1c1.4-1.3 3.6-1.3 5 0z"/></g></svg>`),s=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><path fill="#90591d" fill-rule="evenodd" clip-rule="evenodd" d="M17.8 39.1h49.9c1.9 0 3.5 1.6 3.5 3.5v.1c0 1.9-1.6 3.5-3.5 3.5H17.8c-1.9 0-3.5-1.6-3.5-3.5v-.1c0-1.9 1.5-3.5 3.5-3.5z"/></svg>`),c=a(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 85.4 85.4"><path fill="#006500" fill-rule="evenodd" clip-rule="evenodd" d="M31.2 20.8h26.7c3.6 0 6.5 2.9 6.5 6.5v26.7zm23.2 43.7H27.6c-3.6 0-6.5-2.9-6.5-6.5V31.2z"/></svg>`),l=e=>{t.style.backgroundImage=e?o:`none`,n.style.backgroundImage=e?s:`none`,r.style.backgroundImage=e?c:`none`,i.style.backgroundImage=e?c:`none`;for(let e of[t,n,r,i])e.style.backgroundSize=`100%`,e.style.backgroundPosition=`center`,e.style.backgroundRepeat=`no-repeat`};l(!1),e.addEventListener(`mouseenter`,()=>l(!0)),e.addEventListener(`mouseleave`,()=>l(!1))}function yE(e,t){let n=$(e,`wb-close`),r=$(e,`wb-min`),i=$(e,`wb-max`),a=$(e,`wb-full`);if(t)n.style.background=FT,r.style.background=IT,i.style.background=LT,a.style.background=LT;else{let e=RT;n.style.background=e,r.style.background=e,i.style.background=e,a.style.background=e}}function bE(e,t,n){for(let r of n)switch(r){case`no-animation`:t.style.transition=`none`,e.noAnimation=!0;break;case`no-shadow`:t.style.boxShadow=`none`;break;case`no-header`:{$(t,`wb-header`).style.display=`none`;let e=$(t,`wb-body`);e.style.top=`0`,e.style.borderRadius=`10px`;break}case`no-min`:$(t,`wb-min`).style.display=`none`,e._optionHidden.add(`wb-min`);break;case`no-max`:$(t,`wb-max`).style.display=`none`,e._optionHidden.add(`wb-max`),e.noMax=!0;break;case`no-full`:$(t,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`);break;case`no-close`:$(t,`wb-close`).style.display=`none`,e._optionHidden.add(`wb-close`);break;case`no-resize`:for(let e of GT)$(t,e).style.display=`none`;break;case`no-move`:e.noMove=!0;break}}function xE(e,t,n){let r=$(t,`wb-body`),i=$(t,`wb-header`);n?(t.style.boxShadow=`none`,t.style.borderRadius=`0`,i.style.borderRadius=`0`,r.style.borderRadius=`0`,r.style.margin=`0`,wE(t,`none`)):(t.style.boxShadow=`var(--shadow-window)`,t.style.borderRadius=`10px`,i.style.borderRadius=`10px 10px 0 0`,r.style.borderRadius=`0 0 10px 10px`,r.style.margin=``,wE(t,``))}function SE(e,t,n){let r=$(t,`wb-full`),i=$(t,`wb-min`),a=$(t,`wb-body`);if(n){r.style.display=`none`,i.style.display=`none`;for(let e of Array.from(a.children))e.style.display=`none`;wE(t,`none`)}else{e._optionHidden.has(`wb-full`)||(r.style.display=``),e._optionHidden.has(`wb-min`)||(i.style.display=``);for(let e of Array.from(a.children))e.style.display=``;wE(t,``)}}function CE(e,t){let n=$(e,`wb-modal-bg`),r=$(e,`wb-modal-overlay`),i=$(e,`wb-drag`),a=$(e,`wb-min`),o=$(e,`wb-max`),s=$(e,`wb-full`);t?(n.style.display=`block`,r.style.display=`block`,r.animate([{opacity:0},{opacity:1}],{duration:200,easing:`ease-out`,fill:`forwards`}),i.style.pointerEvents=`none`,a.style.display=`none`,o.style.display=`none`,s.style.display=`none`,wE(e,`none`)):(n.style.display=`none`,r.style.display=`none`,i.style.pointerEvents=``,a.style.display=``,o.style.display=``,s.style.display=``,wE(e,``))}function wE(e,t){for(let n of GT){let r=$(e,n);r&&(r.style.pointerEvents=t)}}function TE(){aE=document.body;let e=aE;lE=typeof e.requestFullscreen==`function`?`requestFullscreen`:typeof e.msRequestFullscreen==`function`?`msRequestFullscreen`:typeof e.webkitRequestFullscreen==`function`?`webkitRequestFullscreen`:typeof e.mozRequestFullscreen==`function`?`mozRequestFullscreen`:``,uE=lE?lE.replace(`request`,`exit`).replace(`mozRequest`,`mozCancel`).replace(`Request`,`Exit`):``,KT(window,`resize`,()=>{AE(),OE()}),KT(aE,`mousedown`,()=>{pE=!1},!0),KT(aE,`mousedown`,()=>{if(!pE)for(let e=nE.length-1;e>=0;e--){let t=nE[e];if(t?.focused){t.blur();break}}}),AE()}function EE(e){kE(e,`drag`),kE(e,`n`),kE(e,`s`),kE(e,`w`),kE(e,`e`),kE(e,`nw`),kE(e,`ne`),kE(e,`se`),kE(e,`sw`),KT($(e.dom,`wb-min`),`click`,t=>{JT(t),e.min?e.restore().focus():e.minimize()}),KT($(e.dom,`wb-max`),`click`,t=>{JT(t),e.max?e.restore().focus():e.maximize().focus()}),lE?KT($(e.dom,`wb-full`),`click`,t=>{JT(t),e.fullscreen().focus()}):($(e.dom,`wb-full`).style.display=`none`,e._optionHidden.add(`wb-full`)),KT($(e.dom,`wb-close`),`click`,t=>{JT(t),e.close()}),KT(e.dom,`mousedown`,()=>{pE=!0},!0),KT(e.body,`mousedown`,()=>{e.focus()},!0)}function DE(e){let t=tE.indexOf(e);t>=0&&tE.splice(t,1),OE(),SE(e,e.dom,!1),e.min=!1,e.dom.title=``}function OE(){let e={},t={};for(let n=0;n<tE.length;n++){let r=tE[n],i=`${r.left}:${r.top}`;t[i]?t[i]+=1:(e[i]=0,t[i]=1)}for(let n=0;n<tE.length;n++){let r=tE[n],i=`${r.left}:${r.top}`,a=t[i]||1,o=Math.min((dE-r.left-r.right)/a,250);r.resize(o+1|0,r.header,!0).move(r.left+(e[i]||0)*o|0,fE-r.bottom-r.header,!0),e[i]=(e[i]||0)+1}}function kE(e,t){let n=$(e.dom,`wb-${t}`);if(!n)return;let r,i=0,a=0,o=!1,s=!1,c=0;KT(n,`mousedown`,u,rE),KT(n,`touchstart`,u,rE);function l(){requestAnimationFrame(l),s&&=(e.resize(),!1),o&&=(e.move(),!1)}function u(o){if(JT(o,!0),e.focus(),t===`drag`){if(e.min){e.restore();return}if(!e.noMax){let t=Date.now(),n=t-c;if(c=t,n<300){e.max?e.restore():e.maximize();return}}}if(!e.min){e.dom.style.willChange=`left, top, width, height`,e.dom.style.transition=`none`;for(let e of document.querySelectorAll(`iframe`))e.style.pointerEvents=`none`;t===`drag`?n.style.cursor=`grabbing`:n.style.cursor=WT[`wb-${t}`]||``;let s=o;r=o.touches?.[0],r?(KT(window,`touchmove`,d,iE),KT(window,`touchend`,f,iE)):(KT(window,`mousemove`,d,iE),KT(window,`mouseup`,f,iE)),i=r?r.pageX:s.pageX,a=r?r.pageY:s.pageY}}function d(n){JT(n);let o=r?n.touches[0]:n;if(!o)return;let s=o.pageX,c=o.pageY,l=s-i,u=c-a,d=e.width,f=e.height,p=e.x,m=e.y,h=!1,g=!1,_=!1,v=!1;if(t===`drag`){if(e.noMove)return;e.x+=l,e.y+=u,_=!0,v=!0}else t===`e`||t===`se`||t===`ne`?(e.width+=l,h=!0):(t===`w`||t===`sw`||t===`nw`)&&(e.x+=l,e.width-=l,h=!0,_=!0),t===`s`||t===`se`||t===`sw`?(e.height+=u,g=!0):(t===`n`||t===`ne`||t===`nw`)&&(e.y+=u,e.height-=u,g=!0,v=!0);h&&=(e.width=Math.max(Math.min(e.width,e.maxwidth,dE-e.x-e.right),e.minwidth),e.width!==d),g&&=(e.height=Math.max(Math.min(e.height,e.maxheight,fE-e.y-e.bottom),e.minheight),e.height!==f),(h||g)&&e.resize(),_&&=(e.max&&(e.x=(s<dE/3?e.left:s>dE/3*2?dE-e.width-e.right:dE/2-e.width/2)+l),e.x=Math.max(Math.min(e.x,e.overflow?dE-30:dE-e.width-e.right),e.overflow?30-e.width:e.left),e.x!==p),v&&=(e.max&&(e.y=e.top+u),e.y=Math.max(Math.min(e.y,e.overflow?fE-e.header:fE-e.height-e.bottom),e.top),e.y!==m),(_||v)&&(e.max&&e.restore(),e.move()),(h||_)&&(i=s),(g||v)&&(a=c)}function f(t){JT(t),e.dom.style.willChange=``,e.noAnimation||(e.dom.style.transition=BT,e.dom.style.transitionTimingFunction=VT);for(let e of document.querySelectorAll(`iframe`))e.style.pointerEvents=``;n.style.cursor=``,r?(qT(window,`touchmove`,d,iE),qT(window,`touchend`,f,iE)):(qT(window,`mousemove`,d,iE),qT(window,`mouseup`,f,iE)),r=void 0}}function AE(){let e=document.documentElement;dE=e.clientWidth,fE=e.clientHeight}function jE(){for(let e=nE.length-1;e>=0;e--){let t=nE[e];if(t&&!t.min){t.focus();break}}}function ME(){let e=document;return!!(e.fullscreen||e.fullscreenElement||e.webkitFullscreenElement||e.mozFullScreenElement)}function NE(){if(cE&&(cE.full=!1,ME()&&uE)){let e=document,t=e[uE];if(typeof t==`function`)return t.call(e),!0}}function PE(e){let t=new Map,n=null,r=location.hash.replace(/^#/,``);if(!r)return{windows:t,focus:n};try{let i=JSON.parse(atob(r));for(let[n,r]of Object.entries(i)){if(n===`_f`||!Array.isArray(r)||r.length<4)continue;let i=n.includes(`:`)?n.split(`:`)[0]:n;if(!e.has(i))continue;let[a,o,s,c,l,u]=r;if(![a,o,s,c].every(e=>typeof e==`number`&&Number.isFinite(e)))continue;let d={x:a,y:o,w:s,h:c};typeof l==`number`?(d.max=l===1,u&&typeof u==`object`&&!Array.isArray(u)&&(d.state=u)):l&&typeof l==`object`&&!Array.isArray(l)&&(d.state=l),t.set(n,d)}if(typeof i._f==`string`){let r=i._f.includes(`:`)?i._f.split(`:`)[0]:i._f;e.has(r)&&t.has(i._f)&&(n=i._f)}}catch{}return{windows:t,focus:n}}function FE(e,t,n,r){let i={};for(let r of e){let e=t.get(r.id);if(!e)continue;let a=[Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height),e.max?1:0],o=n[r.id];o&&Object.keys(o).length>0&&a.push(o),i[r.id]=a}r&&t.has(r)&&(i._f=r);let a=Object.keys(i).length>0?`#${btoa(JSON.stringify(i))}`:``;location.hash!==a&&history.replaceState(null,``,a||location.pathname+location.search)}function IE(e){return Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue(e))||0}function LE(e){let t=e.indexOf(`:`);return t>=0?e.slice(0,t):e}function RE(e){let t=vu(),n=new Map(e.map(e=>[e.key,e])),{windows:r,focus:i}=PE(new Set(e.map(e=>e.key))),a=new Map,o=Kt([]),s=Kt({}),c=F(null),l=Kt({});for(let[e,t]of r)t.state&&(l[e]=t.state);let u=new Map,d;function f(){clearTimeout(d),d=setTimeout(()=>FE(o,u,l,c.value),300)}function p(e,t){let n=u.get(e);n&&n.setTitle(t)}function m(e,t){let n=l[e];n?Object.assign(n,t):l[e]={...t},f()}function h(e){if(!n.get(e)?.multi)return e;let t=(a.get(e)??0)+1;return a.set(e,t),`${e}:${t}`}function g(e){for(let t=o.length-1;t>=0;t--)if(o[t].appKey===e)return o[t].id;return null}function _(e,t){let r=LE(e),i=n.get(r);if(!i||typeof window>`u`)return null;if(!i.multi){let e=g(r);if(e){let n=u.get(e);if(n)return t&&m(e,t),s[e]=!1,n.min&&n.restore(),n.show(),n.focus(),f(),e}}let c=e.includes(`:`)?e:h(r);if(i.multi&&c.includes(`:`)){let e=Number(c.split(`:`)[1]);e>=(a.get(r)??0)&&a.set(r,e)}let d=C(c,i);if(!d)return null;t&&(l[c]={...l[c],...t});let p=Kt({id:c,appKey:r,app:i,mountTarget:d.body});return o.push(p),s[c]=!1,d.show(),d.focus(),f(),c}function v(e){if(u.has(e)){let t=u.get(e);t.min&&(s[e]=!1,t.restore()),t.show(),t.focus();return}let t=LE(e);if(!n.get(t))return;let r=g(t);if(r){let e=u.get(r);e.min&&(s[r]=!1,e.restore()),e.show(),e.focus();return}_(t)}function y(e){let t=u.get(e);t&&!t.min&&t.minimize()}function b(e){let t=u.get(e);if(!t){x(e);return}t.close()}function x(e){let t=o.findIndex(t=>t.id===e);t>=0&&o.splice(t,1),delete s[e],delete l[e],u.delete(e),T(),f()}function S(e,t){let n=window.innerWidth,r=window.innerHeight,i=[];for(let e of u.values())i.push({x:e.x,y:e.y,r:e.x+e.width,b:e.y+e.height});if(i.length===0)return{x:Math.max(0,n*.55-e/2),y:Math.max(0,(r-t)/2)};let a=(r,a)=>{let o=0;for(let n of i){let i=Math.max(0,Math.min(r+e,n.r)-Math.max(r,n.x)),s=Math.max(0,Math.min(a+t,n.b)-Math.max(a,n.y));o+=i*s}let s=Math.max(0,1-r/n)*e*t*.15;return o+s},o=[];for(let n of i)o.push({x:n.r+16,y:n.y}),o.push({x:n.r+16,y:Math.max(0,n.y+n.b-n.y)/2}),o.push({x:n.x,y:n.b+16}),o.push({x:n.x-e-16,y:n.y}),o.push({x:n.x,y:n.y-t-16});o.push({x:n-e-16,y:16}),o.push({x:n-e-16,y:(r-t)/2}),o.push({x:n-e-16,y:r-t-16}),o.push({x:Math.max(0,(n-e)/2),y:Math.max(0,(r-t)/2)}),o.push({x:16,y:16});let s=o.filter(i=>i.x>=0&&i.y>=0&&i.x+e<=n&&i.y+t<=r);if(s.length>0){let e=s[0],t=a(e.x,e.y);for(let n=1;n<s.length;n++){let r=s[n],i=a(r.x,r.y);i<t&&(e=r,t=i)}return e}let c=i.length%Math.max(1,Math.floor((r-t)/32));return{x:Math.max(16,n-e-16-c*32),y:Math.max(16,16+c*32)}}function C(e,n){if(typeof window>`u`)return null;let i=n.window,a=r.get(e),o=t.value,l=a?.max||o,d=a?a.w:Math.min(i.width,window.innerWidth-32),p=a?a.h:Math.min(i.height,window.innerHeight-64),m=a?{x:a.x,y:a.y}:S(d,p),h=IE(`--sat`),g=IE(`--sab`),_=IE(`--sal`),v=IE(`--sar`),y=new mE({id:`piclaw-${e}`,title:n.label,width:d,height:p,minwidth:i.minwidth,minheight:i.minheight,x:m.x,y:m.y,max:l,top:h,bottom:o?44:g,left:_,right:v,class:`no-full`,header:o?32:38,onfocus:()=>{c.value=e,f()},onblur:()=>{T()},onmove:()=>{f()},onresize:()=>{f()},onminimize:()=>{s[e]=!0,T(),f()},onmaximize:()=>{f()},onrestore:()=>{s[e]=!1,f()},onclose:()=>{x(e)}});return y.body.style.margin=`0`,u.set(e,y),y}function w(){if(r.size!==0){for(let[e]of r)_(e,r.get(e)?.state);i&&r.has(i)&&v(i)}}function T(){for(let e=o.length-1;e>=0;e--){let t=o[e];if(!s[t.id]&&u.has(t.id)){c.value=t.id;return}}c.value=null}function E(e=!1){let t=o.filter(e=>!s[e.id]);if(t.length<=1)return;let n=t[(t.findIndex(e=>e.id===c.value)+(e?-1:1)+t.length)%t.length];v(n.id)}function D(e){e.altKey&&e.key===`Tab`?(e.preventDefault(),E(e.shiftKey)):e.altKey&&(e.code===`KeyW`||e.code===`KeyQ`)&&(e.preventDefault(),c.value&&b(c.value))}return window.addEventListener(`keydown`,D),qr(()=>{clearTimeout(d),window.removeEventListener(`keydown`,D);for(let e of u.values())e.close(!0);u.clear(),o.length=0}),{openInstances:o,minimized:s,focusedWindow:c,windowState:l,setWindowState:m,setWindowTitle:p,openWindow:_,bringToFront:v,minimizeWindow:y,closeWindow:b,restoreFromHash:w}}var zE=kr({__name:`App`,setup(e){let{openInstances:t,minimized:n,focusedWindow:r,windowState:i,setWindowState:a,setWindowTitle:o,bringToFront:s,minimizeWindow:c,openWindow:l,closeWindow:u,restoreFromHash:d}=RE(yT);Jn(tu,{windowState:i,setWindowState:a,setWindowTitle:o,bringToFront:s,openWindow:l,closeWindow:u});let f=F();function p(e){e.preventDefault()}return Jr(()=>window.removeEventListener(`beforeunload`,p)),Wr(async()=>{window.addEventListener(`beforeunload`,p),await Nn(),d(),t.length===0&&(localStorage.getItem(`piclaw:visited`)||(localStorage.setItem(`piclaw:visited`,`1`),l(`welcome`)))}),(e,i)=>(z(),B(`div`,{class:`bg-bg text-text font-sans leading-normal flex flex-col relative text-[13px]`,style:{height:`100%`},onContextmenu:i[1]||=As(()=>{},[`prevent`]),onClick:i[2]||=e=>f.value?.closeCtxMenu()},[H(cu,{ref_key:`desktop`,ref:f,apps:I(yT),"open-instances":I(t),onLaunch:I(l),onCtxAction:i[0]||=e=>{e===`settings`&&I(l)(`settings`)}},null,8,[`apps`,`open-instances`,`onLaunch`]),H(PT,{"open-instances":I(t),minimized:I(n),"focused-window":I(r),onLaunch:I(l),onFocus:I(s),onMinimize:I(c),onClose:I(u)},null,8,[`open-instances`,`minimized`,`focused-window`,`onLaunch`,`onFocus`,`onMinimize`,`onClose`]),H(pu)],32))}});dd(),Is(zE).mount(`#app`),`serviceWorker`in navigator&&navigator.serviceWorker.register(`/sw.js`);export{o as n,hd as t};
|