@vinihcrosa/lumem-os 0.2.0 → 0.3.0
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/bin/lumem.mjs +15 -3
- package/dist/server/main.mjs +520 -137
- package/dist/web/assets/{codemirror-setup-qkhLO-HV.js → codemirror-setup-CHk_6JnB.js} +1 -1
- package/dist/web/assets/{index-BkIky5Mw.css → index-C5PMQN0Q.css} +1 -1
- package/dist/web/assets/index-Cft1ygtm.js +101 -0
- package/dist/web/index.html +2 -2
- package/drizzle/0013_consumo_por_agente.sql +1 -0
- package/drizzle/meta/0013_snapshot.json +1688 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/dist/web/assets/index-CKedNrvw.js +0 -101
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var zb=e=>{throw TypeError(e)};var Qf=(e,t,i)=>t.has(e)||zb("Cannot "+i);var E=(e,t,i)=>(Qf(e,t,"read from private field"),i?i.call(e):t.get(e)),pe=(e,t,i)=>t.has(e)?zb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ce=(e,t,i,n)=>(Qf(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),Ce=(e,t,i)=>(Qf(e,t,"access private method"),i);var Nu=(e,t,i,n)=>({set _(a){ce(e,t,a,i)},get _(){return E(e,t,n)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function i(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(a){if(a.ep)return;a.ep=!0;const c=i(a);fetch(a.href,c)}})();const Tk="modulepreload",Ok=function(e){return"/"+e},qb={},Ut=function(t,i,n){let a=Promise.resolve();if(i&&i.length>0){let h=function(m){return Promise.all(m.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=h(i.map(m=>{if(m=Ok(m),m in qb)return;qb[m]=!0;const g=m.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Tk,g||(b.as="script"),b.crossOrigin="",b.href=m,f&&b.setAttribute("nonce",f),document.head.appendChild(b),g)return new Promise((S,x)=>{b.addEventListener("load",S),b.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(h){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=h,window.dispatchEvent(d),!d.defaultPrevented)throw h}return a.then(h=>{for(const d of h||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})};var Zf={exports:{}},So={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var Pb;function Ak(){if(Pb)return So;Pb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(n,a,c){var h=null;if(c!==void 0&&(h=""+c),a.key!==void 0&&(h=""+a.key),"key"in a){c={};for(var d in a)d!=="key"&&(c[d]=a[d])}else c=a;return a=c.ref,{$$typeof:e,type:n,key:h,ref:a!==void 0?a:null,props:c}}return So.Fragment=t,So.jsx=i,So.jsxs=i,So}var Hb;function Rk(){return Hb||(Hb=1,Zf.exports=Ak()),Zf.exports}var o=Rk(),ua=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fn,Jr,il,ox,Mk=(ox=class extends ua{constructor(){super();pe(this,Fn);pe(this,Jr);pe(this,il);ce(this,il,t=>{if(typeof window<"u"&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){E(this,Jr)||this.setEventListener(E(this,il))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Jr))==null||t.call(this),ce(this,Jr,void 0))}setEventListener(t){var i;ce(this,il,t),(i=E(this,Jr))==null||i.call(this),ce(this,Jr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Fn)!==t&&(ce(this,Fn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof E(this,Fn)=="boolean"?E(this,Fn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Fn=new WeakMap,Jr=new WeakMap,il=new WeakMap,ox),Zp=new Mk,Dk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},en,Qp,cx,Bk=(cx=class{constructor(){pe(this,en,Dk);pe(this,Qp,!1)}setTimeoutProvider(e){ce(this,en,e)}setTimeout(e,t){return E(this,en).setTimeout(e,t)}clearTimeout(e){E(this,en).clearTimeout(e)}setInterval(e,t){return E(this,en).setInterval(e,t)}clearInterval(e){E(this,en).clearInterval(e)}},en=new WeakMap,Qp=new WeakMap,cx),In=new Bk;function Lk(e){setTimeout(e,0)}var zk=typeof window>"u"||"Deno"in globalThis;function fs(){}function qk(e,t){return typeof e=="function"?e(t):e}function Tm(e){return typeof e=="number"&&e>=0&&e!==1/0}function wx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mn(e,t){return typeof e=="function"?e(t):e}function Vs(e,t){return typeof e=="function"?e(t):e}function Ib(e,t){const{type:i="all",exact:n,fetchStatus:a,predicate:c,queryKey:h,stale:d}=e;if(h){if(n){if(t.queryHash!==Xp(h,t.options))return!1}else if(!vl(t.queryKey,h))return!1}if(i!=="all"){const f=t.isActive();if(i==="active"&&!f||i==="inactive"&&f)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||a&&a!==t.state.fetchStatus||c&&!c(t))}function Ub(e,t){const{exact:i,status:n,predicate:a,mutationKey:c}=e;if(c){if(!t.options.mutationKey)return!1;if(i){if(ea(t.options.mutationKey)!==ea(c))return!1}else if(!vl(t.options.mutationKey,c))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function Xp(e,t){return((t==null?void 0:t.queryKeyHashFn)||ea)(e)}function ea(e){return JSON.stringify(e,(t,i)=>Om(i)?Object.keys(i).sort().reduce((n,a)=>(n[a]=i[a],n),{}):i)}function vl(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<t.length;n++)if(!vl(e[n],t[n]))return!1;return!0}const i=Object.keys(t);for(const n of i)if(!vl(e[n],t[n]))return!1;return!0}return!1}var Pk=Object.prototype.hasOwnProperty;function Jp(e,t,i=0){if(e===t)return e;if(i>500)return t;const n=Fb(e)&&Fb(t);if(!n&&!(Om(e)&&Om(t)))return t;const c=(n?e:Object.keys(e)).length,h=n?t:Object.keys(t),d=h.length,f=n?new Array(d):{};let m=0;for(let g=0;g<d;g++){const v=n?g:h[g],b=e[v],S=t[v];if(b===S){f[v]=b,(n?g<c:Pk.call(e,v))&&m++;continue}if(b===null||S===null||typeof b!="object"||typeof S!="object"){f[v]=S;continue}const x=Jp(b,S,i+1);f[v]=x,x===b&&m++}return c===d&&m===c?e:f}function Po(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function Fb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Om(e){if(!Kb(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!Kb(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Kb(e){return Object.prototype.toString.call(e)==="[object Object]"}function Hk(e){return new Promise(t=>{In.setTimeout(t,e)})}function Am(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?Jp(e,t):t}function Ik(e,t,i=0){const n=[...e,t];return i&&n.length>i?n.slice(1):n}function Uk(e,t,i=0){const n=[t,...e];return i&&n.length>i?n.slice(0,-1):n}var e_=Symbol();function Cx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===e_?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function t_(e,t){return typeof e=="function"?e(...t):!!e}function Fk(e,t,i){let n=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),n||(n=!0,a.aborted?i():a.addEventListener("abort",i,{once:!0})),a)}),e}var Ho=(()=>{let e=()=>zk;return{isServer(){return e()},setIsServer(t){e=t}}})();function Rm(){let e,t;const i=new Promise((a,c)=>{e=a,t=c});i.status="pending",i.catch(()=>{});function n(a){Object.assign(i,a),delete i.resolve,delete i.reject}return i.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},i.reject=a=>{n({status:"rejected",reason:a}),t(a)},i}var Kk=Lk;function $k(){let e=[],t=0,i=d=>{d()},n=d=>{d()},a=Kk;const c=d=>{t?e.push(d):a(()=>{i(d)})},h=()=>{const d=e;e=[],d.length&&a(()=>{n(()=>{d.forEach(f=>{i(f)})})})};return{batch:d=>{let f;t++;try{f=d()}finally{t--,t||h()}return f},batchCalls:d=>(...f)=>{c(()=>{d(...f)})},schedule:c,setNotifyFunction:d=>{i=d},setBatchNotifyFunction:d=>{n=d},setScheduler:d=>{a=d}}}var Ct=$k(),rl,tn,nl,ux,Wk=(ux=class extends ua{constructor(){super();pe(this,rl,!0);pe(this,tn);pe(this,nl);ce(this,nl,t=>{if(typeof window<"u"&&window.addEventListener){const i=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,tn)||this.setEventListener(E(this,nl))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,tn))==null||t.call(this),ce(this,tn,void 0))}setEventListener(t){var i;ce(this,nl,t),(i=E(this,tn))==null||i.call(this),ce(this,tn,t(this.setOnline.bind(this)))}setOnline(t){E(this,rl)!==t&&(ce(this,rl,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,rl)}},rl=new WeakMap,tn=new WeakMap,nl=new WeakMap,ux),rh=new Wk;function Vk(e){return Math.min(1e3*2**e,3e4)}function jx(e){return(e??"online")==="online"?rh.isOnline():!0}var Mm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function kx(e){let t=!1,i=0,n;const a=Rm(),c=()=>a.status!=="pending",h=C=>{var k;if(!c()){const N=new Mm(C);b(N),(k=e.onCancel)==null||k.call(e,N)}},d=()=>{t=!0},f=()=>{t=!1},m=()=>Zp.isFocused()&&(e.networkMode==="always"||rh.isOnline())&&e.canRun(),g=()=>jx(e.networkMode)&&e.canRun(),v=C=>{c()||(n==null||n(),a.resolve(C))},b=C=>{c()||(n==null||n(),a.reject(C))},S=()=>new Promise(C=>{var k;n=N=>{(c()||m())&&C(N)},(k=e.onPause)==null||k.call(e)}).then(()=>{var C;n=void 0,c()||(C=e.onContinue)==null||C.call(e)}),x=()=>{if(c())return;let C;const k=i===0?e.initialPromise:void 0;try{C=k??e.fn()}catch(N){C=Promise.reject(N)}Promise.resolve(C).then(v).catch(N=>{var Z;if(c())return;const L=e.retry??(Ho.isServer()?0:3),D=e.retryDelay??Vk,M=typeof D=="function"?D(i,N):D,Y=L===!0||typeof L=="number"&&i<L||typeof L=="function"&&L(i,N);if(t||!Y){b(N);return}i++,(Z=e.onFail)==null||Z.call(e,i,N),Hk(M).then(()=>m()?void 0:S()).then(()=>{t?b(N):x()})})};return{promise:a,status:()=>a.status,cancel:h,continue:()=>(n==null||n(),a),cancelRetry:d,continueRetry:f,canStart:g,start:()=>(g()?x():S().then(x),a)}}var Kn,hx,Ex=(hx=class{constructor(){pe(this,Kn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Tm(this.gcTime)&&ce(this,Kn,In.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ho.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Kn)!==void 0&&(In.clearTimeout(E(this,Kn)),ce(this,Kn,void 0))}},Kn=new WeakMap,hx);function Yk(e){return{onFetch:(t,i)=>{var g,v,b,S,x;const n=t.options,a=(b=(v=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:v.fetchMore)==null?void 0:b.direction,c=((S=t.state.data)==null?void 0:S.pages)||[],h=((x=t.state.data)==null?void 0:x.pageParams)||[];let d={pages:[],pageParams:[]},f=0;const m=async()=>{let C=!1;const k=D=>{Fk(D,()=>t.signal,()=>C=!0)},N=Cx(t.options,t.fetchOptions),L=async(D,M,Y)=>{if(C)return Promise.reject(t.signal.reason);if(M==null&&D.pages.length)return Promise.resolve(D);const W=(()=>{const le={client:t.client,queryKey:t.queryKey,pageParam:M,direction:Y?"backward":"forward",meta:t.options.meta};return k(le),le})(),ee=await N(W),{maxPages:I}=t.options,ae=Y?Uk:Ik;return{pages:ae(D.pages,ee,I),pageParams:ae(D.pageParams,M,I)}};if(a&&c.length){const D=a==="backward",M=D?Gk:$b,Y={pages:c,pageParams:h},Z=M(n,Y);d=await L(Y,Z,D)}else{const D=e??c.length;do{const M=f===0?h[0]??n.initialPageParam:$b(n,d);if(f>0&&M==null)break;d=await L(d,M),f++}while(f<D)}return d};t.options.persister?t.fetchFn=()=>{var C,k;return(k=(C=t.options).persister)==null?void 0:k.call(C,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=m}}}function $b(e,{pages:t,pageParams:i}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,i[n],i):void 0}function Gk(e,{pages:t,pageParams:i}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,i[0],i):void 0}var al,$n,ll,ci,Wn,Vt,Go,Vn,Ws,Nx,lr,dx,Qk=(dx=class extends Ex{constructor(t){super();pe(this,Ws);pe(this,al);pe(this,$n);pe(this,ll);pe(this,ci);pe(this,Wn);pe(this,Vt);pe(this,Go);pe(this,Vn);ce(this,Vn,!1),ce(this,Go,t.defaultOptions),this.setOptions(t.options),this.observers=[],ce(this,Wn,t.client),ce(this,ci,E(this,Wn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ce(this,$n,Vb(this.options)),this.state=t.state??E(this,$n),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,al)}get promise(){var t;return(t=E(this,Vt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Go),...t},t!=null&&t._type&&ce(this,al,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=Vb(this.options);i.data!==void 0&&(this.setState(Wb(i.data,i.dataUpdatedAt)),ce(this,$n,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,ci).remove(this)}setData(t,i){const n=Am(this.state.data,t,this.options);return Ce(this,Ws,lr).call(this,{data:n,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),n}setState(t){Ce(this,Ws,lr).call(this,{type:"setState",state:t})}cancel(t){var n,a;const i=(n=E(this,Vt))==null?void 0:n.promise;return(a=E(this,Vt))==null||a.cancel(t),i?i.then(fs).catch(fs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,$n)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Vs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===e_||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>mn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!wx(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=E(this,Vt))==null||i.continue()}onOnline(){var i;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=E(this,Vt))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,ci).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(E(this,Vt)&&(E(this,Vn)||Ce(this,Ws,Nx).call(this)?E(this,Vt).cancel({revert:!0}):E(this,Vt).cancelRetry()),this.scheduleGc()),E(this,ci).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ce(this,Ws,lr).call(this,{type:"invalidate"})}async fetch(t,i){var m,g,v,b,S,x,C,k,N,L,D;if(this.state.fetchStatus!=="idle"&&((m=E(this,Vt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(E(this,Vt))return E(this,Vt).continueRetry(),E(this,Vt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find(Y=>Y.options.queryFn);M&&this.setOptions(M.options)}const n=new AbortController,a=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(ce(this,Vn,!0),n.signal)})},c=()=>{const M=Cx(this.options,i),Z=(()=>{const W={client:E(this,Wn),queryKey:this.queryKey,meta:this.meta};return a(W),W})();return ce(this,Vn,!1),this.options.persister?this.options.persister(M,Z,this):M(Z)},d=(()=>{const M={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:E(this,Wn),state:this.state,fetchFn:c};return a(M),M})(),f=E(this,al)==="infinite"?Yk(this.options.pages):this.options.behavior;f==null||f.onFetch(d,this),ce(this,ll,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&Ce(this,Ws,lr).call(this,{type:"fetch",meta:(v=d.fetchOptions)==null?void 0:v.meta}),ce(this,Vt,kx({initialPromise:i==null?void 0:i.initialPromise,fn:d.fetchFn,onCancel:M=>{M instanceof Mm&&M.revert&&this.setState({...E(this,ll),fetchStatus:"idle"}),n.abort()},onFail:(M,Y)=>{Ce(this,Ws,lr).call(this,{type:"failed",failureCount:M,error:Y})},onPause:()=>{Ce(this,Ws,lr).call(this,{type:"pause"})},onContinue:()=>{Ce(this,Ws,lr).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const M=await E(this,Vt).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(S=(b=E(this,ci).config).onSuccess)==null||S.call(b,M,this),(C=(x=E(this,ci).config).onSettled)==null||C.call(x,M,this.state.error,this),M}catch(M){if(M instanceof Mm){if(M.silent)return E(this,Vt).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Ce(this,Ws,lr).call(this,{type:"error",error:M}),(N=(k=E(this,ci).config).onError)==null||N.call(k,M,this),(D=(L=E(this,ci).config).onSettled)==null||D.call(L,this.state.data,M,this),M}finally{this.scheduleGc()}}},al=new WeakMap,$n=new WeakMap,ll=new WeakMap,ci=new WeakMap,Wn=new WeakMap,Vt=new WeakMap,Go=new WeakMap,Vn=new WeakMap,Ws=new WeakSet,Nx=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},lr=function(t){const i=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Tx(n.data,this.options),fetchMeta:t.meta??null};case"success":const a={...n,...Wb(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ce(this,ll,t.manual?a:void 0),a;case"error":const c=t.error;return{...n,error:c,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=i(this.state),Ct.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,ci).notify({query:this,type:"updated",action:t})})},dx);function Tx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Wb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Vb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,n=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:i?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var Ts,Ye,Qo,gs,Yn,ol,cr,sn,Zo,cl,ul,Gn,Qn,rn,hl,rt,To,Dm,Bm,Lm,zm,qm,Pm,Hm,Ox,fx,s_=(fx=class extends ua{constructor(t,i){super();pe(this,rt);pe(this,Ts);pe(this,Ye);pe(this,Qo);pe(this,gs);pe(this,Yn);pe(this,ol);pe(this,cr);pe(this,sn);pe(this,Zo);pe(this,cl);pe(this,ul);pe(this,Gn);pe(this,Qn);pe(this,rn);pe(this,hl,new Set);this.options=i,ce(this,Ts,t),ce(this,sn,null),ce(this,cr,Rm()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,Ye).addObserver(this),Yb(E(this,Ye),this.options)?Ce(this,rt,To).call(this):this.updateResult(),Ce(this,rt,zm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Im(E(this,Ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Im(E(this,Ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ce(this,rt,qm).call(this),Ce(this,rt,Pm).call(this),E(this,Ye).removeObserver(this)}setOptions(t){const i=this.options,n=E(this,Ye);if(this.options=E(this,Ts).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Vs(this.options.enabled,E(this,Ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ce(this,rt,Hm).call(this),E(this,Ye).setOptions(this.options),i._defaulted&&!Po(this.options,i)&&E(this,Ts).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,Ye),observer:this});const a=this.hasListeners();a&&Gb(E(this,Ye),n,this.options,i)&&Ce(this,rt,To).call(this),this.updateResult(),a&&(E(this,Ye)!==n||Vs(this.options.enabled,E(this,Ye))!==Vs(i.enabled,E(this,Ye))||mn(this.options.staleTime,E(this,Ye))!==mn(i.staleTime,E(this,Ye)))&&Ce(this,rt,Dm).call(this);const c=Ce(this,rt,Bm).call(this);a&&(E(this,Ye)!==n||Vs(this.options.enabled,E(this,Ye))!==Vs(i.enabled,E(this,Ye))||c!==E(this,rn))&&Ce(this,rt,Lm).call(this,c)}getOptimisticResult(t){const i=E(this,Ts).getQueryCache().build(E(this,Ts),t),n=this.createResult(i,t);return Xk(this,n)&&(ce(this,gs,n),ce(this,ol,this.options),ce(this,Yn,E(this,Ye).state)),n}getCurrentResult(){return E(this,gs)}trackResult(t,i){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),i==null||i(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,cr).status==="pending"&&E(this,cr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(t){E(this,hl).add(t)}getCurrentQuery(){return E(this,Ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=E(this,Ts).defaultQueryOptions(t),n=E(this,Ts).getQueryCache().build(E(this,Ts),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(t){return Ce(this,rt,To).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,gs)))}createResult(t,i){var I;const n=E(this,Ye),a=this.options,c=E(this,gs),h=E(this,Yn),d=E(this,ol),m=t!==n?t.state:E(this,Qo),{state:g}=t;let v={...g},b=!1,S;if(i._optimisticResults){const ae=this.hasListeners(),le=!ae&&Yb(t,i),H=ae&&Gb(t,n,i,a);(le||H)&&(v={...v,...Tx(g.data,t.options)}),i._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:x,errorUpdatedAt:C,status:k}=v;S=v.data;let N=!1;if(i.placeholderData!==void 0&&S===void 0&&k==="pending"){let ae;c!=null&&c.isPlaceholderData&&i.placeholderData===(d==null?void 0:d.placeholderData)?(ae=c.data,N=!0):ae=typeof i.placeholderData=="function"?i.placeholderData((I=E(this,ul))==null?void 0:I.state.data,E(this,ul)):i.placeholderData,ae!==void 0&&(k="success",S=Am(c==null?void 0:c.data,ae,i),b=!0)}if(i.select&&S!==void 0&&!N)if(c&&S===(h==null?void 0:h.data)&&i.select===E(this,Zo))S=E(this,cl);else try{ce(this,Zo,i.select),S=i.select(S),S=Am(c==null?void 0:c.data,S,i),ce(this,cl,S),ce(this,sn,null)}catch(ae){ce(this,sn,ae)}E(this,sn)&&(x=E(this,sn),S=E(this,cl),C=Date.now(),k="error");const L=v.fetchStatus==="fetching",D=k==="pending",M=k==="error",Y=D&&L,Z=S!==void 0,ee={status:k,fetchStatus:v.fetchStatus,isPending:D,isSuccess:k==="success",isError:M,isInitialLoading:Y,isLoading:Y,data:S,dataUpdatedAt:v.dataUpdatedAt,error:x,errorUpdatedAt:C,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:L,isRefetching:L&&!D,isLoadingError:M&&!Z,isPaused:v.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:M&&Z,isStale:i_(t,i),refetch:this.refetch,promise:E(this,cr),isEnabled:Vs(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const ae=ee.data!==void 0,le=ee.status==="error"&&!ae,H=se=>{le?se.reject(ee.error):ae&&se.resolve(ee.data)},z=()=>{const se=ce(this,cr,ee.promise=Rm());H(se)},re=E(this,cr);switch(re.status){case"pending":t.queryHash===n.queryHash&&H(re);break;case"fulfilled":(le||ee.data!==re.value)&&z();break;case"rejected":(!le||ee.error!==re.reason)&&z();break}}return ee}updateResult(){const t=E(this,gs),i=this.createResult(E(this,Ye),this.options);if(ce(this,Yn,E(this,Ye).state),ce(this,ol,this.options),E(this,Yn).data!==void 0&&ce(this,ul,E(this,Ye)),Po(i,t))return;ce(this,gs,i);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,c=typeof a=="function"?a():a;if(c==="all"||!c&&!E(this,hl).size)return!0;const h=new Set(c??E(this,hl));return this.options.throwOnError&&h.add("error"),Object.keys(E(this,gs)).some(d=>{const f=d;return E(this,gs)[f]!==t[f]&&h.has(f)})};Ce(this,rt,Ox).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ce(this,rt,zm).call(this)}},Ts=new WeakMap,Ye=new WeakMap,Qo=new WeakMap,gs=new WeakMap,Yn=new WeakMap,ol=new WeakMap,cr=new WeakMap,sn=new WeakMap,Zo=new WeakMap,cl=new WeakMap,ul=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,rn=new WeakMap,hl=new WeakMap,rt=new WeakSet,To=function(t){Ce(this,rt,Hm).call(this);let i=E(this,Ye).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(fs)),i},Dm=function(){Ce(this,rt,qm).call(this);const t=mn(this.options.staleTime,E(this,Ye));if(Ho.isServer()||E(this,gs).isStale||!Tm(t))return;const n=wx(E(this,gs).dataUpdatedAt,t)+1;ce(this,Gn,In.setTimeout(()=>{E(this,gs).isStale||this.updateResult()},n))},Bm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,Ye)):this.options.refetchInterval)??!1},Lm=function(t){Ce(this,rt,Pm).call(this),ce(this,rn,t),!(Ho.isServer()||Vs(this.options.enabled,E(this,Ye))===!1||!Tm(E(this,rn))||E(this,rn)===0)&&ce(this,Qn,In.setInterval(()=>{(this.options.refetchIntervalInBackground||Zp.isFocused())&&Ce(this,rt,To).call(this)},E(this,rn)))},zm=function(){Ce(this,rt,Dm).call(this),Ce(this,rt,Lm).call(this,Ce(this,rt,Bm).call(this))},qm=function(){E(this,Gn)!==void 0&&(In.clearTimeout(E(this,Gn)),ce(this,Gn,void 0))},Pm=function(){E(this,Qn)!==void 0&&(In.clearInterval(E(this,Qn)),ce(this,Qn,void 0))},Hm=function(){const t=E(this,Ts).getQueryCache().build(E(this,Ts),this.options);if(t===E(this,Ye))return;const i=E(this,Ye);ce(this,Ye,t),ce(this,Qo,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},Ox=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(E(this,gs))}),E(this,Ts).getQueryCache().notify({query:E(this,Ye),type:"observerResultsUpdated"})})},fx);function Zk(e,t){return Vs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Vs(t.retryOnMount,e)===!1)}function Yb(e,t){return Zk(e,t)||e.state.data!==void 0&&Im(e,t,t.refetchOnMount)}function Im(e,t,i){if(Vs(t.enabled,e)!==!1&&mn(t.staleTime,e)!=="static"){const n=typeof i=="function"?i(e):i;return n==="always"||n!==!1&&i_(e,t)}return!1}function Gb(e,t,i,n){return(e!==t||Vs(n.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&i_(e,i)}function i_(e,t){return Vs(t.enabled,e)!==!1&&e.isStaleByTime(mn(t.staleTime,e))}function Xk(e,t){return!Po(e.getCurrentResult(),t)}var Xo,Ai,ds,Zn,Ri,Yr,mx,Jk=(mx=class extends Ex{constructor(t){super();pe(this,Ri);pe(this,Xo);pe(this,Ai);pe(this,ds);pe(this,Zn);ce(this,Xo,t.client),this.mutationId=t.mutationId,ce(this,ds,t.mutationCache),ce(this,Ai,[]),this.state=t.state||Ax(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Ai).includes(t)||(E(this,Ai).push(t),this.clearGcTimeout(),E(this,ds).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ce(this,Ai,E(this,Ai).filter(i=>i!==t)),this.scheduleGc(),E(this,ds).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Ai).length||(this.state.status==="pending"?this.scheduleGc():E(this,ds).remove(this))}continue(){var t;return((t=E(this,Zn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,d,f,m,g,v,b,S,x,C,k,N,L,D,M,Y,Z,W;const i=()=>{Ce(this,Ri,Yr).call(this,{type:"continue"})},n={client:E(this,Xo),meta:this.options.meta,mutationKey:this.options.mutationKey};ce(this,Zn,kx({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(ee,I)=>{Ce(this,Ri,Yr).call(this,{type:"failed",failureCount:ee,error:I})},onPause:()=>{Ce(this,Ri,Yr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>E(this,ds).canRun(this)}));const a=this.state.status==="pending",c=!E(this,Zn).canStart();try{if(a)i();else{Ce(this,Ri,Yr).call(this,{type:"pending",variables:t,isPaused:c}),E(this,ds).config.onMutate&&await E(this,ds).config.onMutate(t,this,n);const I=await((d=(h=this.options).onMutate)==null?void 0:d.call(h,t,n));I!==this.state.context&&Ce(this,Ri,Yr).call(this,{type:"pending",context:I,variables:t,isPaused:c})}const ee=await E(this,Zn).start();return await((m=(f=E(this,ds).config).onSuccess)==null?void 0:m.call(f,ee,t,this.state.context,this,n)),await((v=(g=this.options).onSuccess)==null?void 0:v.call(g,ee,t,this.state.context,n)),await((S=(b=E(this,ds).config).onSettled)==null?void 0:S.call(b,ee,null,this.state.variables,this.state.context,this,n)),await((C=(x=this.options).onSettled)==null?void 0:C.call(x,ee,null,t,this.state.context,n)),Ce(this,Ri,Yr).call(this,{type:"success",data:ee}),ee}catch(ee){try{await((N=(k=E(this,ds).config).onError)==null?void 0:N.call(k,ee,t,this.state.context,this,n))}catch(I){Promise.reject(I)}try{await((D=(L=this.options).onError)==null?void 0:D.call(L,ee,t,this.state.context,n))}catch(I){Promise.reject(I)}try{await((Y=(M=E(this,ds).config).onSettled)==null?void 0:Y.call(M,void 0,ee,this.state.variables,this.state.context,this,n))}catch(I){Promise.reject(I)}try{await((W=(Z=this.options).onSettled)==null?void 0:W.call(Z,void 0,ee,t,this.state.context,n))}catch(I){Promise.reject(I)}throw Ce(this,Ri,Yr).call(this,{type:"error",error:ee}),ee}finally{E(this,ds).runNext(this)}}},Xo=new WeakMap,Ai=new WeakMap,ds=new WeakMap,Zn=new WeakMap,Ri=new WeakSet,Yr=function(t){const i=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Ct.batch(()=>{E(this,Ai).forEach(n=>{n.onMutationUpdate(t)}),E(this,ds).notify({mutation:this,type:"updated",action:t})})},mx);function Ax(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ur,yi,Jo,px,eE=(px=class extends ua{constructor(t={}){super();pe(this,ur);pe(this,yi);pe(this,Jo);this.config=t,ce(this,ur,new Set),ce(this,yi,new Map),ce(this,Jo,0)}build(t,i,n){const a=new Jk({client:t,mutationCache:this,mutationId:++Nu(this,Jo)._,options:t.defaultMutationOptions(i),state:n});return this.add(a),a}add(t){E(this,ur).add(t);const i=Tu(t);if(typeof i=="string"){const n=E(this,yi).get(i);n?n.push(t):E(this,yi).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,ur).delete(t)){const i=Tu(t);if(typeof i=="string"){const n=E(this,yi).get(i);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&E(this,yi).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Tu(t);if(typeof i=="string"){const n=E(this,yi).get(i),a=n==null?void 0:n.find(c=>c.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const i=Tu(t);if(typeof i=="string"){const a=(n=E(this,yi).get(i))==null?void 0:n.find(c=>c!==t&&c.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ct.batch(()=>{E(this,ur).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,ur).clear(),E(this,yi).clear()})}getAll(){return Array.from(E(this,ur))}find(t){const i={exact:!0,...t};return this.getAll().find(n=>Ub(i,n))}findAll(t={}){return this.getAll().filter(i=>Ub(t,i))}notify(t){Ct.batch(()=>{this.listeners.forEach(i=>{i(t)})})}resumePausedMutations(){const t=this.getAll().filter(i=>i.state.isPaused);return Ct.batch(()=>Promise.all(t.map(i=>i.continue().catch(fs))))}},ur=new WeakMap,yi=new WeakMap,Jo=new WeakMap,px);function Tu(e){var t;return(t=e.options.scope)==null?void 0:t.id}var hr,nn,Os,dr,_r,Qu,Um,_x,tE=(_x=class extends ua{constructor(i,n){super();pe(this,_r);pe(this,hr);pe(this,nn);pe(this,Os);pe(this,dr);ce(this,hr,i),this.setOptions(n),this.bindMethods(),Ce(this,_r,Qu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var a;const n=this.options;this.options=E(this,hr).defaultMutationOptions(i),Po(this.options,n)||E(this,hr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:E(this,Os),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ea(n.mutationKey)!==ea(this.options.mutationKey)?this.reset():((a=E(this,Os))==null?void 0:a.state.status)==="pending"&&E(this,Os).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=E(this,Os))==null||i.removeObserver(this)}onMutationUpdate(i){Ce(this,_r,Qu).call(this),Ce(this,_r,Um).call(this,i)}getCurrentResult(){return E(this,nn)}reset(){var i;(i=E(this,Os))==null||i.removeObserver(this),ce(this,Os,void 0),Ce(this,_r,Qu).call(this),Ce(this,_r,Um).call(this)}mutate(i,n){var a;return ce(this,dr,n),(a=E(this,Os))==null||a.removeObserver(this),ce(this,Os,E(this,hr).getMutationCache().build(E(this,hr),this.options)),E(this,Os).addObserver(this),E(this,Os).execute(i)}},hr=new WeakMap,nn=new WeakMap,Os=new WeakMap,dr=new WeakMap,_r=new WeakSet,Qu=function(){var n;const i=((n=E(this,Os))==null?void 0:n.state)??Ax();ce(this,nn,{...i,isPending:i.status==="pending",isSuccess:i.status==="success",isError:i.status==="error",isIdle:i.status==="idle",mutate:this.mutate,reset:this.reset})},Um=function(i){Ct.batch(()=>{var n,a,c,h,d,f,m,g;if(E(this,dr)&&this.hasListeners()){const v=E(this,nn).variables,b=E(this,nn).context,S={client:E(this,hr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(a=(n=E(this,dr)).onSuccess)==null||a.call(n,i.data,v,b,S)}catch(x){Promise.reject(x)}try{(h=(c=E(this,dr)).onSettled)==null||h.call(c,i.data,null,v,b,S)}catch(x){Promise.reject(x)}}else if((i==null?void 0:i.type)==="error"){try{(f=(d=E(this,dr)).onError)==null||f.call(d,i.error,v,b,S)}catch(x){Promise.reject(x)}try{(g=(m=E(this,dr)).onSettled)==null||g.call(m,void 0,i.error,v,b,S)}catch(x){Promise.reject(x)}}}this.listeners.forEach(v=>{v(E(this,nn))})})},_x);function Qb(e,t){const i=new Set(t);return e.filter(n=>!i.has(n))}function sE(e,t,i){const n=e.slice(0);return n[t]=i,n}var dl,As,fl,Xn,$s,an,ec,tc,sc,ic,Kt,Fm,Km,Rx,$m,Wm,Vm,gx,iE=(gx=class extends ua{constructor(t,i,n){super();pe(this,Kt);pe(this,dl);pe(this,As);pe(this,fl);pe(this,Xn);pe(this,$s);pe(this,an);pe(this,ec);pe(this,tc);pe(this,sc);pe(this,ic,[]);ce(this,dl,t),ce(this,Xn,n),ce(this,fl,[]),ce(this,$s,[]),ce(this,As,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&E(this,$s).forEach(t=>{t.subscribe(i=>{Ce(this,Kt,Wm).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,E(this,$s).forEach(t=>{t.destroy()})}setQueries(t,i){ce(this,fl,t),ce(this,Xn,i),Ct.batch(()=>{const n=E(this,$s),a=Ce(this,Kt,$m).call(this,E(this,fl));a.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const c=a.map(v=>v.observer),h=c.map(v=>v.getCurrentResult()),d=n.length!==c.length,f=c.some((v,b)=>v!==n[b]),m=d||f,g=m?!0:h.some((v,b)=>{const S=E(this,As)[b];return!S||!Po(v,S)});!m&&!g||(m&&(ce(this,ic,a),ce(this,$s,c)),ce(this,As,h),this.hasListeners()&&(m&&(Qb(n,c).forEach(v=>{v.destroy()}),Qb(c,n).forEach(v=>{v.subscribe(b=>{Ce(this,Kt,Wm).call(this,v,b)})})),Ce(this,Kt,Vm).call(this)))})}getCurrentResult(){return E(this,As)}getQueries(){return E(this,$s).map(t=>t.getCurrentQuery())}getObservers(){return E(this,$s)}getOptimisticResult(t,i){const n=Ce(this,Kt,$m).call(this,t),a=n.map(h=>h.observer.getOptimisticResult(h.defaultedQueryOptions)),c=n.map(h=>h.defaultedQueryOptions.queryHash);return[a,h=>Ce(this,Kt,Km).call(this,h??a,i,c),()=>Ce(this,Kt,Fm).call(this,a,n)]}},dl=new WeakMap,As=new WeakMap,fl=new WeakMap,Xn=new WeakMap,$s=new WeakMap,an=new WeakMap,ec=new WeakMap,tc=new WeakMap,sc=new WeakMap,ic=new WeakMap,Kt=new WeakSet,Fm=function(t,i){return i.map((n,a)=>{const c=t[a];return n.defaultedQueryOptions.notifyOnChangeProps?c:n.observer.trackResult(c,h=>{i.forEach(d=>{d.observer.trackProp(h)})})})},Km=function(t,i,n){if(i){const a=E(this,sc),c=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((h,d)=>h!==a[d]));return(!E(this,an)||E(this,As)!==E(this,tc)||c||i!==E(this,ec))&&(ce(this,ec,i),ce(this,tc,E(this,As)),n!==void 0&&ce(this,sc,n),ce(this,an,Jp(E(this,an),i(t)))),E(this,an)}return t},Rx=function(){var t;return((t=E(this,Xn))==null?void 0:t.combine)!==void 0&&E(this,$s).some((i,n)=>{var a;return i.options.suspense&&((a=E(this,As)[n])==null?void 0:a.data)===void 0})},$m=function(t){const i=new Map;E(this,$s).forEach(a=>{const c=a.options.queryHash;if(!c)return;const h=i.get(c);h?h.push(a):i.set(c,[a])});const n=[];return t.forEach(a=>{var f;const c=E(this,dl).defaultQueryOptions(a),d=((f=i.get(c.queryHash))==null?void 0:f.shift())??new s_(E(this,dl),c);n.push({defaultedQueryOptions:c,observer:d})}),n},Wm=function(t,i){const n=E(this,$s).indexOf(t);n!==-1&&(ce(this,As,sE(E(this,As),n,i)),Ce(this,Kt,Vm).call(this))},Vm=function(){var t;if(this.hasListeners()){const i=Ce(this,Kt,Fm).call(this,E(this,As),E(this,ic)),n=Ce(this,Kt,Rx).call(this),a=E(this,an),c=n?a:Ce(this,Kt,Km).call(this,i,(t=E(this,Xn))==null?void 0:t.combine);(n||a!==c)&&Ct.batch(()=>{this.listeners.forEach(h=>{h(E(this,As))})})}},gx),Mi,vx,rE=(vx=class extends ua{constructor(t={}){super();pe(this,Mi);this.config=t,ce(this,Mi,new Map)}build(t,i,n){const a=i.queryKey,c=i.queryHash??Xp(a,i);let h=this.get(c);return h||(h=new Qk({client:t,queryKey:a,queryHash:c,options:t.defaultQueryOptions(i),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(h)),h}add(t){E(this,Mi).has(t.queryHash)||(E(this,Mi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=E(this,Mi).get(t.queryHash);i&&(t.destroy(),i===t&&E(this,Mi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Mi).get(t)}getAll(){return[...E(this,Mi).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(n=>Ib(i,n))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(n=>Ib(t,n)):i}notify(t){Ct.batch(()=>{this.listeners.forEach(i=>{i(t)})})}onFocus(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Mi=new WeakMap,vx),xt,ln,on,ml,pl,cn,_l,gl,yx,nE=(yx=class{constructor(e={}){pe(this,xt);pe(this,ln);pe(this,on);pe(this,ml);pe(this,pl);pe(this,cn);pe(this,_l);pe(this,gl);ce(this,xt,e.queryCache||new rE),ce(this,ln,e.mutationCache||new eE),ce(this,on,e.defaultOptions||{}),ce(this,ml,new Map),ce(this,pl,new Map),ce(this,cn,0)}mount(){Nu(this,cn)._++,E(this,cn)===1&&(ce(this,_l,Zp.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,xt).onFocus())})),ce(this,gl,rh.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,xt).onOnline())})))}unmount(){var e,t;Nu(this,cn)._--,E(this,cn)===0&&((e=E(this,_l))==null||e.call(this),ce(this,_l,void 0),(t=E(this,gl))==null||t.call(this),ce(this,gl,void 0))}isFetching(e){return E(this,xt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,ln).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=E(this,xt).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=E(this,xt).build(this,t),n=i.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(mn(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,xt).findAll(e).map(({queryKey:t,state:i})=>{const n=i.data;return[t,n]})}setQueryData(e,t,i){const n=this.defaultQueryOptions({queryKey:e}),a=E(this,xt).get(n.queryHash),c=a==null?void 0:a.state.data,h=qk(t,c);if(h!==void 0)return E(this,xt).build(this,n).setData(h,{...i,manual:!0})}setQueriesData(e,t,i){return Ct.batch(()=>E(this,xt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=E(this,xt).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=E(this,xt);Ct.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=E(this,xt);return Ct.batch(()=>(i.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},n=Ct.batch(()=>E(this,xt).findAll(e).map(a=>a.cancel(i)));return Promise.all(n).then(fs).catch(fs)}invalidateQueries(e,t={}){return Ct.batch(()=>(E(this,xt).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},n=Ct.batch(()=>E(this,xt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let c=a.fetch(void 0,i);return i.throwOnError||(c=c.catch(fs)),a.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(n).then(fs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=E(this,xt).build(this,t);return i.isStaleByTime(mn(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(fs).catch(fs)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(fs).catch(fs)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return rh.isOnline()?E(this,ln).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,xt)}getMutationCache(){return E(this,ln)}getDefaultOptions(){return E(this,on)}setDefaultOptions(e){ce(this,on,e)}setQueryDefaults(e,t){E(this,ml).set(ea(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,ml).values()],i={};return t.forEach(n=>{vl(e,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(e,t){E(this,pl).set(ea(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,pl).values()],i={};return t.forEach(n=>{vl(e,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,on).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Xp(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===e_&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,on).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,xt).clear(),E(this,ln).clear()}},xt=new WeakMap,ln=new WeakMap,on=new WeakMap,ml=new WeakMap,pl=new WeakMap,cn=new WeakMap,_l=new WeakMap,gl=new WeakMap,yx),Xf={exports:{}},Me={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Zb;function aE(){if(Zb)return Me;Zb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function S(T){return T===null||typeof T!="object"?null:(T=b&&T[b]||T["@@iterator"],typeof T=="function"?T:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function N(T,K,ne){this.props=T,this.context=K,this.refs=k,this.updater=ne||x}N.prototype.isReactComponent={},N.prototype.setState=function(T,K){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,K,"setState")},N.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function L(){}L.prototype=N.prototype;function D(T,K,ne){this.props=T,this.context=K,this.refs=k,this.updater=ne||x}var M=D.prototype=new L;M.constructor=D,C(M,N.prototype),M.isPureReactComponent=!0;var Y=Array.isArray;function Z(){}var W={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function I(T,K,ne){var $=ne.ref;return{$$typeof:e,type:T,key:K,ref:$!==void 0?$:null,props:ne}}function ae(T,K){return I(T.type,K,T.props)}function le(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function H(T){var K={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ne){return K[ne]})}var z=/\/+/g;function re(T,K){return typeof T=="object"&&T!==null&&T.key!=null?H(""+T.key):K.toString(36)}function se(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(Z,Z):(T.status="pending",T.then(function(K){T.status==="pending"&&(T.status="fulfilled",T.value=K)},function(K){T.status==="pending"&&(T.status="rejected",T.reason=K)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function A(T,K,ne,$,ue){var _e=typeof T;(_e==="undefined"||_e==="boolean")&&(T=null);var Ee=!1;if(T===null)Ee=!0;else switch(_e){case"bigint":case"string":case"number":Ee=!0;break;case"object":switch(T.$$typeof){case e:case t:Ee=!0;break;case g:return Ee=T._init,A(Ee(T._payload),K,ne,$,ue)}}if(Ee)return ue=ue(T),Ee=$===""?"."+re(T,0):$,Y(ue)?(ne="",Ee!=null&&(ne=Ee.replace(z,"$&/")+"/"),A(ue,K,ne,"",function(Rs){return Rs})):ue!=null&&(le(ue)&&(ue=ae(ue,ne+(ue.key==null||T&&T.key===ue.key?"":(""+ue.key).replace(z,"$&/")+"/")+Ee)),K.push(ue)),1;Ee=0;var kt=$===""?".":$+":";if(Y(T))for(var Xe=0;Xe<T.length;Xe++)$=T[Xe],_e=kt+re($,Xe),Ee+=A($,K,ne,_e,ue);else if(Xe=S(T),typeof Xe=="function")for(T=Xe.call(T),Xe=0;!($=T.next()).done;)$=$.value,_e=kt+re($,Xe++),Ee+=A($,K,ne,_e,ue);else if(_e==="object"){if(typeof T.then=="function")return A(se(T),K,ne,$,ue);throw K=String(T),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ee}function F(T,K,ne){if(T==null)return T;var $=[],ue=0;return A(T,$,"","",function(_e){return K.call(ne,_e,ue++)}),$}function G(T){if(T._status===-1){var K=T._result;K=K(),K.then(function(ne){(T._status===0||T._status===-1)&&(T._status=1,T._result=ne)},function(ne){(T._status===0||T._status===-1)&&(T._status=2,T._result=ne)}),T._status===-1&&(T._status=0,T._result=K)}if(T._status===1)return T._result.default;throw T._result}var Se=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ke={map:F,forEach:function(T,K,ne){F(T,function(){K.apply(this,arguments)},ne)},count:function(T){var K=0;return F(T,function(){K++}),K},toArray:function(T){return F(T,function(K){return K})||[]},only:function(T){if(!le(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Me.Activity=v,Me.Children=ke,Me.Component=N,Me.Fragment=i,Me.Profiler=a,Me.PureComponent=D,Me.StrictMode=n,Me.Suspense=f,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=W,Me.__COMPILER_RUNTIME={__proto__:null,c:function(T){return W.H.useMemoCache(T)}},Me.cache=function(T){return function(){return T.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(T,K,ne){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var $=C({},T.props),ue=T.key;if(K!=null)for(_e in K.key!==void 0&&(ue=""+K.key),K)!ee.call(K,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&K.ref===void 0||($[_e]=K[_e]);var _e=arguments.length-2;if(_e===1)$.children=ne;else if(1<_e){for(var Ee=Array(_e),kt=0;kt<_e;kt++)Ee[kt]=arguments[kt+2];$.children=Ee}return I(T.type,ue,$)},Me.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},Me.createElement=function(T,K,ne){var $,ue={},_e=null;if(K!=null)for($ in K.key!==void 0&&(_e=""+K.key),K)ee.call(K,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(ue[$]=K[$]);var Ee=arguments.length-2;if(Ee===1)ue.children=ne;else if(1<Ee){for(var kt=Array(Ee),Xe=0;Xe<Ee;Xe++)kt[Xe]=arguments[Xe+2];ue.children=kt}if(T&&T.defaultProps)for($ in Ee=T.defaultProps,Ee)ue[$]===void 0&&(ue[$]=Ee[$]);return I(T,_e,ue)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(T){return{$$typeof:d,render:T}},Me.isValidElement=le,Me.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:G}},Me.memo=function(T,K){return{$$typeof:m,type:T,compare:K===void 0?null:K}},Me.startTransition=function(T){var K=W.T,ne={};W.T=ne;try{var $=T(),ue=W.S;ue!==null&&ue(ne,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(Z,Se)}catch(_e){Se(_e)}finally{K!==null&&ne.types!==null&&(K.types=ne.types),W.T=K}},Me.unstable_useCacheRefresh=function(){return W.H.useCacheRefresh()},Me.use=function(T){return W.H.use(T)},Me.useActionState=function(T,K,ne){return W.H.useActionState(T,K,ne)},Me.useCallback=function(T,K){return W.H.useCallback(T,K)},Me.useContext=function(T){return W.H.useContext(T)},Me.useDebugValue=function(){},Me.useDeferredValue=function(T,K){return W.H.useDeferredValue(T,K)},Me.useEffect=function(T,K){return W.H.useEffect(T,K)},Me.useEffectEvent=function(T){return W.H.useEffectEvent(T)},Me.useId=function(){return W.H.useId()},Me.useImperativeHandle=function(T,K,ne){return W.H.useImperativeHandle(T,K,ne)},Me.useInsertionEffect=function(T,K){return W.H.useInsertionEffect(T,K)},Me.useLayoutEffect=function(T,K){return W.H.useLayoutEffect(T,K)},Me.useMemo=function(T,K){return W.H.useMemo(T,K)},Me.useOptimistic=function(T,K){return W.H.useOptimistic(T,K)},Me.useReducer=function(T,K,ne){return W.H.useReducer(T,K,ne)},Me.useRef=function(T){return W.H.useRef(T)},Me.useState=function(T){return W.H.useState(T)},Me.useSyncExternalStore=function(T,K,ne){return W.H.useSyncExternalStore(T,K,ne)},Me.useTransition=function(){return W.H.useTransition()},Me.version="19.2.8",Me}var Xb;function r_(){return Xb||(Xb=1,Xf.exports=aE()),Xf.exports}var j=r_(),Mx=j.createContext(void 0),We=e=>{const t=j.useContext(Mx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},lE=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Mx.Provider,{value:e,children:t})),Dx=j.createContext(!1),Bx=()=>j.useContext(Dx);Dx.Provider;function oE(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var cE=j.createContext(oE()),Lx=()=>j.useContext(cE),zx=(e,t,i)=>{const n=i!=null&&i.state.error&&typeof e.throwOnError=="function"?t_(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},qx=e=>{j.useEffect(()=>{e.clearReset()},[e])},Px=({result:e,errorResetBoundary:t,throwOnError:i,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||t_(i,[e.error,n])),Hx=e=>{if(e.suspense){const i=a=>a==="static"?a:Math.max(a??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...a)=>i(n(...a)):i(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},uE=(e,t)=>e.isLoading&&e.isFetching&&!t,Ym=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Gm=(e,t,i)=>t.fetchOptimistic(e).catch(()=>{i.clearReset()});function Ix({queries:e,...t},i){const n=We(),a=Bx(),c=Lx(),h=j.useMemo(()=>e.map(C=>{const k=n.defaultQueryOptions(C);return k._optimisticResults=a?"isRestoring":"optimistic",k}),[e,n,a]);h.forEach(C=>{Hx(C);const k=n.getQueryCache().get(C.queryHash);zx(C,c,k)}),qx(c);const[d]=j.useState(()=>new iE(n,h,t)),[f,m,g]=d.getOptimisticResult(h,t.combine),v=!a&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(C=>v?d.subscribe(Ct.batchCalls(C)):fs,[d,v]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),j.useEffect(()=>{d.setQueries(h,t)},[h,t,d]);const S=f.some((C,k)=>Ym(h[k],C))?f.flatMap((C,k)=>{const N=h[k];if(N&&Ym(N,C)){const L=new s_(n,N);return Gm(N,L,c)}return[]}):[];if(S.length>0)throw Promise.all(S);const x=f.find((C,k)=>{const N=h[k];return N&&Px({result:C,errorResetBoundary:c,throwOnError:N.throwOnError,query:n.getQueryCache().get(N.queryHash),suspense:N.suspense})});if(x!=null&&x.error)throw x.error;return m(g())}function hE(e,t,i){var S,x,C,k;const n=Bx(),a=Lx(),c=We(),h=c.defaultQueryOptions(e);(x=(S=c.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||x.call(S,h);const d=c.getQueryCache().get(h.queryHash),f=e.subscribed!==!1;h._optimisticResults=n?"isRestoring":f?"optimistic":void 0,Hx(h),zx(h,a,d),qx(a);const m=!c.getQueryCache().get(h.queryHash),[g]=j.useState(()=>new t(c,h)),v=g.getOptimisticResult(h),b=!n&&f;if(j.useSyncExternalStore(j.useCallback(N=>{const L=b?g.subscribe(Ct.batchCalls(N)):fs;return g.updateResult(),L},[g,b]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),j.useEffect(()=>{g.setOptions(h)},[h,g]),Ym(h,v))throw Gm(h,g,a);if(Px({result:v,errorResetBoundary:a,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw v.error;if((k=(C=c.getDefaultOptions().queries)==null?void 0:C._experimental_afterQuery)==null||k.call(C,h,v),h.experimental_prefetchInRender&&!Ho.isServer()&&uE(v,n)){const N=m?Gm(h,g,a):d==null?void 0:d.promise;N==null||N.catch(fs).finally(()=>{g.updateResult()})}return h.notifyOnChangeProps?v:g.trackResult(v)}function Ne(e,t){return hE(e,s_)}function He(e,t){const i=We(),[n]=j.useState(()=>new tE(i,e));j.useEffect(()=>{n.setOptions(e)},[n,e]);const a=j.useSyncExternalStore(j.useCallback(h=>n.subscribe(Ct.batchCalls(h)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),c=j.useCallback((h,d)=>{n.mutate(h,d).catch(fs)},[n]);if(a.error&&t_(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:c,mutateAsync:a.mutate}}var Jf={exports:{}},xo={},em={exports:{}},tm={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var Jb;function dE(){return Jb||(Jb=1,(function(e){function t(A,F){var G=A.length;A.push(F);e:for(;0<G;){var Se=G-1>>>1,ke=A[Se];if(0<a(ke,F))A[Se]=F,A[G]=ke,G=Se;else break e}}function i(A){return A.length===0?null:A[0]}function n(A){if(A.length===0)return null;var F=A[0],G=A.pop();if(G!==F){A[0]=G;e:for(var Se=0,ke=A.length,T=ke>>>1;Se<T;){var K=2*(Se+1)-1,ne=A[K],$=K+1,ue=A[$];if(0>a(ne,G))$<ke&&0>a(ue,ne)?(A[Se]=ue,A[$]=G,Se=$):(A[Se]=ne,A[K]=G,Se=K);else if($<ke&&0>a(ue,G))A[Se]=ue,A[$]=G,Se=$;else break e}}return F}function a(A,F){var G=A.sortIndex-F.sortIndex;return G!==0?G:A.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var h=Date,d=h.now();e.unstable_now=function(){return h.now()-d}}var f=[],m=[],g=1,v=null,b=3,S=!1,x=!1,C=!1,k=!1,N=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function M(A){for(var F=i(m);F!==null;){if(F.callback===null)n(m);else if(F.startTime<=A)n(m),F.sortIndex=F.expirationTime,t(f,F);else break;F=i(m)}}function Y(A){if(C=!1,M(A),!x)if(i(f)!==null)x=!0,Z||(Z=!0,H());else{var F=i(m);F!==null&&se(Y,F.startTime-A)}}var Z=!1,W=-1,ee=5,I=-1;function ae(){return k?!0:!(e.unstable_now()-I<ee)}function le(){if(k=!1,Z){var A=e.unstable_now();I=A;var F=!0;try{e:{x=!1,C&&(C=!1,L(W),W=-1),S=!0;var G=b;try{t:{for(M(A),v=i(f);v!==null&&!(v.expirationTime>A&&ae());){var Se=v.callback;if(typeof Se=="function"){v.callback=null,b=v.priorityLevel;var ke=Se(v.expirationTime<=A);if(A=e.unstable_now(),typeof ke=="function"){v.callback=ke,M(A),F=!0;break t}v===i(f)&&n(f),M(A)}else n(f);v=i(f)}if(v!==null)F=!0;else{var T=i(m);T!==null&&se(Y,T.startTime-A),F=!1}}break e}finally{v=null,b=G,S=!1}F=void 0}}finally{F?H():Z=!1}}}var H;if(typeof D=="function")H=function(){D(le)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,re=z.port2;z.port1.onmessage=le,H=function(){re.postMessage(null)}}else H=function(){N(le,0)};function se(A,F){W=N(function(){A(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var F=3;break;default:F=b}var G=b;b=F;try{return A()}finally{b=G}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(A,F){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var G=b;b=A;try{return F()}finally{b=G}},e.unstable_scheduleCallback=function(A,F,G){var Se=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?Se+G:Se):G=Se,A){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=G+ke,A={id:g++,callback:F,priorityLevel:A,startTime:G,expirationTime:ke,sortIndex:-1},G>Se?(A.sortIndex=G,t(m,A),i(f)===null&&A===i(m)&&(C?(L(W),W=-1):C=!0,se(Y,G-Se))):(A.sortIndex=ke,t(f,A),x||S||(x=!0,Z||(Z=!0,H()))),A},e.unstable_shouldYield=ae,e.unstable_wrapCallback=function(A){var F=b;return function(){var G=b;b=F;try{return A.apply(this,arguments)}finally{b=G}}}})(tm)),tm}var e0;function fE(){return e0||(e0=1,em.exports=dE()),em.exports}var sm={exports:{}},us={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var t0;function mE(){if(t0)return us;t0=1;var e=r_();function t(f){var m="https://react.dev/errors/"+f;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)m+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},a=Symbol.for("react.portal");function c(f,m,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:v==null?null:""+v,children:f,containerInfo:m,implementation:g}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,m){if(f==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return us.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,us.createPortal=function(f,m){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return c(f,m,null,g)},us.flushSync=function(f){var m=h.T,g=n.p;try{if(h.T=null,n.p=2,f)return f()}finally{h.T=m,n.p=g,n.d.f()}},us.preconnect=function(f,m){typeof f=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,n.d.C(f,m))},us.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},us.preinit=function(f,m){if(typeof f=="string"&&m&&typeof m.as=="string"){var g=m.as,v=d(g,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;g==="style"?n.d.S(f,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:S}):g==="script"&&n.d.X(f,{crossOrigin:v,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},us.preinitModule=function(f,m){if(typeof f=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var g=d(m.as,m.crossOrigin);n.d.M(f,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&n.d.M(f)},us.preload=function(f,m){if(typeof f=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var g=m.as,v=d(g,m.crossOrigin);n.d.L(f,g,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},us.preloadModule=function(f,m){if(typeof f=="string")if(m){var g=d(m.as,m.crossOrigin);n.d.m(f,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else n.d.m(f)},us.requestFormReset=function(f){n.d.r(f)},us.unstable_batchedUpdates=function(f,m){return f(m)},us.useFormState=function(f,m,g){return h.H.useFormState(f,m,g)},us.useFormStatus=function(){return h.H.useHostTransitionStatus()},us.version="19.2.8",us}var s0;function pE(){if(s0)return sm.exports;s0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),sm.exports=mE(),sm.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var i0;function _E(){if(i0)return xo;i0=1;var e=fE(),t=r_(),i=pE();function n(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var r=s,l=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(l=r.return),s=r.return;while(s)}return r.tag===3?l:null}function h(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function d(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(c(s)!==s)throw Error(n(188))}function m(s){var r=s.alternate;if(!r){if(r=c(s),r===null)throw Error(n(188));return r!==s?null:s}for(var l=s,u=r;;){var p=l.return;if(p===null)break;var _=p.alternate;if(_===null){if(u=p.return,u!==null){l=u;continue}break}if(p.child===_.child){for(_=p.child;_;){if(_===l)return f(p),s;if(_===u)return f(p),r;_=_.sibling}throw Error(n(188))}if(l.return!==u.return)l=p,u=_;else{for(var y=!1,w=p.child;w;){if(w===l){y=!0,l=p,u=_;break}if(w===u){y=!0,u=p,l=_;break}w=w.sibling}if(!y){for(w=_.child;w;){if(w===l){y=!0,l=_,u=p;break}if(w===u){y=!0,u=_,l=p;break}w=w.sibling}if(!y)throw Error(n(189))}}if(l.alternate!==u)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?s:r}function g(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=g(s),r!==null)return r;s=s.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),D=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function H(s){return s===null||typeof s!="object"?null:(s=le&&s[le]||s["@@iterator"],typeof s=="function"?s:null)}var z=Symbol.for("react.client.reference");function re(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===z?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case N:return"Profiler";case k:return"StrictMode";case Y:return"Suspense";case Z:return"SuspenseList";case I:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case D:return s.displayName||"Context";case L:return(s._context.displayName||"Context")+".Consumer";case M:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case W:return r=s.displayName||null,r!==null?r:re(s.type)||"Memo";case ee:r=s._payload,s=s._init;try{return re(s(r))}catch{}}return null}var se=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},Se=[],ke=-1;function T(s){return{current:s}}function K(s){0>ke||(s.current=Se[ke],Se[ke]=null,ke--)}function ne(s,r){ke++,Se[ke]=s.current,s.current=r}var $=T(null),ue=T(null),_e=T(null),Ee=T(null);function kt(s,r){switch(ne(_e,r),ne(ue,s),ne($,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?ab(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=ab(r),s=lb(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K($),ne($,s)}function Xe(){K($),K(ue),K(_e)}function Rs(s){s.memoizedState!==null&&ne(Ee,s);var r=$.current,l=lb(r,s.type);r!==l&&(ne(ue,s),ne($,l))}function xi(s){ue.current===s&&(K($),K(ue)),Ee.current===s&&(K(Ee),go._currentValue=G)}var Qs,et;function mi(s){if(Qs===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);Qs=r&&r[1]||"",et=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Qs+s+et}var Rh=!1;function Mh(s,r){if(!s||Rh)return"";Rh=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var J=function(){throw Error()};if(Object.defineProperty(J.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(J,[])}catch(V){var U=V}Reflect.construct(s,[],J)}else{try{J.call()}catch(V){U=V}s.call(J.prototype)}}else{try{throw Error()}catch(V){U=V}(J=s())&&typeof J.catch=="function"&&J.catch(function(){})}}catch(V){if(V&&U&&typeof V.stack=="string")return[V.stack,U.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),y=_[0],w=_[1];if(y&&w){var O=y.split(`
|
|
45
|
+
`),P=w.split(`
|
|
46
|
+
`);for(p=u=0;u<O.length&&!O[u].includes("DetermineComponentFrameRoot");)u++;for(;p<P.length&&!P[p].includes("DetermineComponentFrameRoot");)p++;if(u===O.length||p===P.length)for(u=O.length-1,p=P.length-1;1<=u&&0<=p&&O[u]!==P[p];)p--;for(;1<=u&&0<=p;u--,p--)if(O[u]!==P[p]){if(u!==1||p!==1)do if(u--,p--,0>p||O[u]!==P[p]){var Q=`
|
|
47
|
+
`+O[u].replace(" at new "," at ");return s.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",s.displayName)),Q}while(1<=u&&0<=p);break}}}finally{Rh=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?mi(l):""}function aC(s,r){switch(s.tag){case 26:case 27:case 5:return mi(s.type);case 16:return mi("Lazy");case 13:return s.child!==r&&r!==null?mi("Suspense Fallback"):mi("Suspense");case 19:return mi("SuspenseList");case 0:case 15:return Mh(s.type,!1);case 11:return Mh(s.type.render,!1);case 1:return Mh(s.type,!0);case 31:return mi("Activity");default:return""}}function z_(s){try{var r="",l=null;do r+=aC(s,l),l=s,s=s.return;while(s);return r}catch(u){return`
|
|
48
|
+
Error generating stack: `+u.message+`
|
|
49
|
+
`+u.stack}}var Dh=Object.prototype.hasOwnProperty,Bh=e.unstable_scheduleCallback,Lh=e.unstable_cancelCallback,lC=e.unstable_shouldYield,oC=e.unstable_requestPaint,Ms=e.unstable_now,cC=e.unstable_getCurrentPriorityLevel,q_=e.unstable_ImmediatePriority,P_=e.unstable_UserBlockingPriority,hc=e.unstable_NormalPriority,uC=e.unstable_LowPriority,H_=e.unstable_IdlePriority,hC=e.log,dC=e.unstable_setDisableYieldValue,Nl=null,Ds=null;function br(s){if(typeof hC=="function"&&dC(s),Ds&&typeof Ds.setStrictMode=="function")try{Ds.setStrictMode(Nl,s)}catch{}}var Bs=Math.clz32?Math.clz32:pC,fC=Math.log,mC=Math.LN2;function pC(s){return s>>>=0,s===0?32:31-(fC(s)/mC|0)|0}var dc=256,fc=262144,mc=4194304;function yn(s){var r=s&42;if(r!==0)return r;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function pc(s,r,l){var u=s.pendingLanes;if(u===0)return 0;var p=0,_=s.suspendedLanes,y=s.pingedLanes;s=s.warmLanes;var w=u&134217727;return w!==0?(u=w&~_,u!==0?p=yn(u):(y&=w,y!==0?p=yn(y):l||(l=w&~s,l!==0&&(p=yn(l))))):(w=u&~_,w!==0?p=yn(w):y!==0?p=yn(y):l||(l=u&~s,l!==0&&(p=yn(l)))),p===0?0:r!==0&&r!==p&&(r&_)===0&&(_=p&-p,l=r&-r,_>=l||_===32&&(l&4194048)!==0)?r:p}function Tl(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function _C(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function I_(){var s=mc;return mc<<=1,(mc&62914560)===0&&(mc=4194304),s}function zh(s){for(var r=[],l=0;31>l;l++)r.push(s);return r}function Ol(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function gC(s,r,l,u,p,_){var y=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var w=s.entanglements,O=s.expirationTimes,P=s.hiddenUpdates;for(l=y&~l;0<l;){var Q=31-Bs(l),J=1<<Q;w[Q]=0,O[Q]=-1;var U=P[Q];if(U!==null)for(P[Q]=null,Q=0;Q<U.length;Q++){var V=U[Q];V!==null&&(V.lane&=-536870913)}l&=~J}u!==0&&U_(s,u,0),_!==0&&p===0&&s.tag!==0&&(s.suspendedLanes|=_&~(y&~r))}function U_(s,r,l){s.pendingLanes|=r,s.suspendedLanes&=~r;var u=31-Bs(r);s.entangledLanes|=r,s.entanglements[u]=s.entanglements[u]|1073741824|l&261930}function F_(s,r){var l=s.entangledLanes|=r;for(s=s.entanglements;l;){var u=31-Bs(l),p=1<<u;p&r|s[u]&r&&(s[u]|=r),l&=~p}}function K_(s,r){var l=r&-r;return l=(l&42)!==0?1:qh(l),(l&(s.suspendedLanes|r))!==0?0:l}function qh(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ph(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function $_(){var s=F.p;return s!==0?s:(s=window.event,s===void 0?32:Ob(s.type))}function W_(s,r){var l=F.p;try{return F.p=s,r()}finally{F.p=l}}var Sr=Math.random().toString(36).slice(2),es="__reactFiber$"+Sr,Ss="__reactProps$"+Sr,ma="__reactContainer$"+Sr,Hh="__reactEvents$"+Sr,vC="__reactListeners$"+Sr,yC="__reactHandles$"+Sr,V_="__reactResources$"+Sr,Al="__reactMarker$"+Sr;function Ih(s){delete s[es],delete s[Ss],delete s[Hh],delete s[vC],delete s[yC]}function pa(s){var r=s[es];if(r)return r;for(var l=s.parentNode;l;){if(r=l[ma]||l[es]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(s=mb(s);s!==null;){if(l=s[es])return l;s=mb(s)}return r}s=l,l=s.parentNode}return null}function _a(s){if(s=s[es]||s[ma]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Rl(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(n(33))}function ga(s){var r=s[V_];return r||(r=s[V_]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function $t(s){s[Al]=!0}var Y_=new Set,G_={};function bn(s,r){va(s,r),va(s+"Capture",r)}function va(s,r){for(G_[s]=r,s=0;s<r.length;s++)Y_.add(r[s])}var bC=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Q_={},Z_={};function SC(s){return Dh.call(Z_,s)?!0:Dh.call(Q_,s)?!1:bC.test(s)?Z_[s]=!0:(Q_[s]=!0,!1)}function _c(s,r,l){if(SC(r))if(l===null)s.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var u=r.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+l)}}function gc(s,r,l){if(l===null)s.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+l)}}function Ui(s,r,l,u){if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(r,l,""+u)}}function Zs(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function X_(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function xC(s,r,l){var u=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,_=u.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return p.call(this)},set:function(y){l=""+y,_.call(this,y)}}),Object.defineProperty(s,r,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Uh(s){if(!s._valueTracker){var r=X_(s)?"checked":"value";s._valueTracker=xC(s,r,""+s[r])}}function J_(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return s&&(u=X_(s)?s.checked?"true":"false":s.value),s=u,s!==l?(r.setValue(s),!0):!1}function vc(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var wC=/[\n"\\]/g;function Xs(s){return s.replace(wC,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Fh(s,r,l,u,p,_,y,w){s.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?s.type=y:s.removeAttribute("type"),r!=null?y==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Zs(r)):s.value!==""+Zs(r)&&(s.value=""+Zs(r)):y!=="submit"&&y!=="reset"||s.removeAttribute("value"),r!=null?Kh(s,y,Zs(r)):l!=null?Kh(s,y,Zs(l)):u!=null&&s.removeAttribute("value"),p==null&&_!=null&&(s.defaultChecked=!!_),p!=null&&(s.checked=p&&typeof p!="function"&&typeof p!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?s.name=""+Zs(w):s.removeAttribute("name")}function eg(s,r,l,u,p,_,y,w){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.type=_),r!=null||l!=null){if(!(_!=="submit"&&_!=="reset"||r!=null)){Uh(s);return}l=l!=null?""+Zs(l):"",r=r!=null?""+Zs(r):l,w||r===s.value||(s.value=r),s.defaultValue=r}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=w?s.checked:!!u,s.defaultChecked=!!u,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.name=y),Uh(s)}function Kh(s,r,l){r==="number"&&vc(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function ya(s,r,l,u){if(s=s.options,r){r={};for(var p=0;p<l.length;p++)r["$"+l[p]]=!0;for(l=0;l<s.length;l++)p=r.hasOwnProperty("$"+s[l].value),s[l].selected!==p&&(s[l].selected=p),p&&u&&(s[l].defaultSelected=!0)}else{for(l=""+Zs(l),r=null,p=0;p<s.length;p++){if(s[p].value===l){s[p].selected=!0,u&&(s[p].defaultSelected=!0);return}r!==null||s[p].disabled||(r=s[p])}r!==null&&(r.selected=!0)}}function tg(s,r,l){if(r!=null&&(r=""+Zs(r),r!==s.value&&(s.value=r),l==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=l!=null?""+Zs(l):""}function sg(s,r,l,u){if(r==null){if(u!=null){if(l!=null)throw Error(n(92));if(se(u)){if(1<u.length)throw Error(n(93));u=u[0]}l=u}l==null&&(l=""),r=l}l=Zs(r),s.defaultValue=l,u=s.textContent,u===l&&u!==""&&u!==null&&(s.value=u),Uh(s)}function ba(s,r){if(r){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=r;return}}s.textContent=r}var CC=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ig(s,r,l){var u=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":u?s.setProperty(r,l):typeof l!="number"||l===0||CC.has(r)?r==="float"?s.cssFloat=l:s[r]=(""+l).trim():s[r]=l+"px"}function rg(s,r,l){if(r!=null&&typeof r!="object")throw Error(n(62));if(s=s.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="");for(var p in r)u=r[p],r.hasOwnProperty(p)&&l[p]!==u&&ig(s,p,u)}else for(var _ in r)r.hasOwnProperty(_)&&ig(s,_,r[_])}function $h(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),kC=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function yc(s){return kC.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Fi(){}var Wh=null;function Vh(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Sa=null,xa=null;function ng(s){var r=_a(s);if(r&&(s=r.stateNode)){var l=s[Ss]||null;e:switch(s=r.stateNode,r.type){case"input":if(Fh(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Xs(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var u=l[r];if(u!==s&&u.form===s.form){var p=u[Ss]||null;if(!p)throw Error(n(90));Fh(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===s.form&&J_(u)}break e;case"textarea":tg(s,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&ya(s,!!l.multiple,r,!1)}}}var Yh=!1;function ag(s,r,l){if(Yh)return s(r,l);Yh=!0;try{var u=s(r);return u}finally{if(Yh=!1,(Sa!==null||xa!==null)&&(au(),Sa&&(r=Sa,s=xa,xa=Sa=null,ng(r),s)))for(r=0;r<s.length;r++)ng(s[r])}}function Ml(s,r){var l=s.stateNode;if(l===null)return null;var u=l[Ss]||null;if(u===null)return null;l=u[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(s=s.type,u=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!u;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(n(231,r,typeof l));return l}var Ki=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gh=!1;if(Ki)try{var Dl={};Object.defineProperty(Dl,"passive",{get:function(){Gh=!0}}),window.addEventListener("test",Dl,Dl),window.removeEventListener("test",Dl,Dl)}catch{Gh=!1}var xr=null,Qh=null,bc=null;function lg(){if(bc)return bc;var s,r=Qh,l=r.length,u,p="value"in xr?xr.value:xr.textContent,_=p.length;for(s=0;s<l&&r[s]===p[s];s++);var y=l-s;for(u=1;u<=y&&r[l-u]===p[_-u];u++);return bc=p.slice(s,1<u?1-u:void 0)}function Sc(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function xc(){return!0}function og(){return!1}function xs(s){function r(l,u,p,_,y){this._reactName=l,this._targetInst=p,this.type=u,this.nativeEvent=_,this.target=y,this.currentTarget=null;for(var w in s)s.hasOwnProperty(w)&&(l=s[w],this[w]=l?l(_):_[w]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?xc:og,this.isPropagationStopped=og,this}return v(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=xc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=xc)},persist:function(){},isPersistent:xc}),r}var Sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wc=xs(Sn),Bl=v({},Sn,{view:0,detail:0}),EC=xs(Bl),Zh,Xh,Ll,Cc=v({},Bl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ed,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Ll&&(Ll&&s.type==="mousemove"?(Zh=s.screenX-Ll.screenX,Xh=s.screenY-Ll.screenY):Xh=Zh=0,Ll=s),Zh)},movementY:function(s){return"movementY"in s?s.movementY:Xh}}),cg=xs(Cc),NC=v({},Cc,{dataTransfer:0}),TC=xs(NC),OC=v({},Bl,{relatedTarget:0}),Jh=xs(OC),AC=v({},Sn,{animationName:0,elapsedTime:0,pseudoElement:0}),RC=xs(AC),MC=v({},Sn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),DC=xs(MC),BC=v({},Sn,{data:0}),ug=xs(BC),LC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zC={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},qC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function PC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=qC[s])?!!r[s]:!1}function ed(){return PC}var HC=v({},Bl,{key:function(s){if(s.key){var r=LC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Sc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?zC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ed,charCode:function(s){return s.type==="keypress"?Sc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Sc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),IC=xs(HC),UC=v({},Cc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hg=xs(UC),FC=v({},Bl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ed}),KC=xs(FC),$C=v({},Sn,{propertyName:0,elapsedTime:0,pseudoElement:0}),WC=xs($C),VC=v({},Cc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),YC=xs(VC),GC=v({},Sn,{newState:0,oldState:0}),QC=xs(GC),ZC=[9,13,27,32],td=Ki&&"CompositionEvent"in window,zl=null;Ki&&"documentMode"in document&&(zl=document.documentMode);var XC=Ki&&"TextEvent"in window&&!zl,dg=Ki&&(!td||zl&&8<zl&&11>=zl),fg=" ",mg=!1;function pg(s,r){switch(s){case"keyup":return ZC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _g(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var wa=!1;function JC(s,r){switch(s){case"compositionend":return _g(r);case"keypress":return r.which!==32?null:(mg=!0,fg);case"textInput":return s=r.data,s===fg&&mg?null:s;default:return null}}function ej(s,r){if(wa)return s==="compositionend"||!td&&pg(s,r)?(s=lg(),bc=Qh=xr=null,wa=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return dg&&r.locale!=="ko"?null:r.data;default:return null}}var tj={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gg(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!tj[s.type]:r==="textarea"}function vg(s,r,l,u){Sa?xa?xa.push(u):xa=[u]:Sa=u,r=fu(r,"onChange"),0<r.length&&(l=new wc("onChange","change",null,l,u),s.push({event:l,listeners:r}))}var ql=null,Pl=null;function sj(s){eb(s,0)}function jc(s){var r=Rl(s);if(J_(r))return s}function yg(s,r){if(s==="change")return r}var bg=!1;if(Ki){var sd;if(Ki){var id="oninput"in document;if(!id){var Sg=document.createElement("div");Sg.setAttribute("oninput","return;"),id=typeof Sg.oninput=="function"}sd=id}else sd=!1;bg=sd&&(!document.documentMode||9<document.documentMode)}function xg(){ql&&(ql.detachEvent("onpropertychange",wg),Pl=ql=null)}function wg(s){if(s.propertyName==="value"&&jc(Pl)){var r=[];vg(r,Pl,s,Vh(s)),ag(sj,r)}}function ij(s,r,l){s==="focusin"?(xg(),ql=r,Pl=l,ql.attachEvent("onpropertychange",wg)):s==="focusout"&&xg()}function rj(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return jc(Pl)}function nj(s,r){if(s==="click")return jc(r)}function aj(s,r){if(s==="input"||s==="change")return jc(r)}function lj(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Ls=typeof Object.is=="function"?Object.is:lj;function Hl(s,r){if(Ls(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var l=Object.keys(s),u=Object.keys(r);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var p=l[u];if(!Dh.call(r,p)||!Ls(s[p],r[p]))return!1}return!0}function Cg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function jg(s,r){var l=Cg(s);s=0;for(var u;l;){if(l.nodeType===3){if(u=s+l.textContent.length,s<=r&&u>=r)return{node:l,offset:r-s};s=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Cg(l)}}function kg(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?kg(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Eg(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=vc(s.document);r instanceof s.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)s=r.contentWindow;else break;r=vc(s.document)}return r}function rd(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var oj=Ki&&"documentMode"in document&&11>=document.documentMode,Ca=null,nd=null,Il=null,ad=!1;function Ng(s,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ad||Ca==null||Ca!==vc(u)||(u=Ca,"selectionStart"in u&&rd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Il&&Hl(Il,u)||(Il=u,u=fu(nd,"onSelect"),0<u.length&&(r=new wc("onSelect","select",null,r,l),s.push({event:r,listeners:u}),r.target=Ca)))}function xn(s,r){var l={};return l[s.toLowerCase()]=r.toLowerCase(),l["Webkit"+s]="webkit"+r,l["Moz"+s]="moz"+r,l}var ja={animationend:xn("Animation","AnimationEnd"),animationiteration:xn("Animation","AnimationIteration"),animationstart:xn("Animation","AnimationStart"),transitionrun:xn("Transition","TransitionRun"),transitionstart:xn("Transition","TransitionStart"),transitioncancel:xn("Transition","TransitionCancel"),transitionend:xn("Transition","TransitionEnd")},ld={},Tg={};Ki&&(Tg=document.createElement("div").style,"AnimationEvent"in window||(delete ja.animationend.animation,delete ja.animationiteration.animation,delete ja.animationstart.animation),"TransitionEvent"in window||delete ja.transitionend.transition);function wn(s){if(ld[s])return ld[s];if(!ja[s])return s;var r=ja[s],l;for(l in r)if(r.hasOwnProperty(l)&&l in Tg)return ld[s]=r[l];return s}var Og=wn("animationend"),Ag=wn("animationiteration"),Rg=wn("animationstart"),cj=wn("transitionrun"),uj=wn("transitionstart"),hj=wn("transitioncancel"),Mg=wn("transitionend"),Dg=new Map,od="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");od.push("scrollEnd");function pi(s,r){Dg.set(s,r),bn(r,[s])}var kc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Js=[],ka=0,cd=0;function Ec(){for(var s=ka,r=cd=ka=0;r<s;){var l=Js[r];Js[r++]=null;var u=Js[r];Js[r++]=null;var p=Js[r];Js[r++]=null;var _=Js[r];if(Js[r++]=null,u!==null&&p!==null){var y=u.pending;y===null?p.next=p:(p.next=y.next,y.next=p),u.pending=p}_!==0&&Bg(l,p,_)}}function Nc(s,r,l,u){Js[ka++]=s,Js[ka++]=r,Js[ka++]=l,Js[ka++]=u,cd|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function ud(s,r,l,u){return Nc(s,r,l,u),Tc(s)}function Cn(s,r){return Nc(s,null,null,r),Tc(s)}function Bg(s,r,l){s.lanes|=l;var u=s.alternate;u!==null&&(u.lanes|=l);for(var p=!1,_=s.return;_!==null;)_.childLanes|=l,u=_.alternate,u!==null&&(u.childLanes|=l),_.tag===22&&(s=_.stateNode,s===null||s._visibility&1||(p=!0)),s=_,_=_.return;return s.tag===3?(_=s.stateNode,p&&r!==null&&(p=31-Bs(l),s=_.hiddenUpdates,u=s[p],u===null?s[p]=[r]:u.push(r),r.lane=l|536870912),_):null}function Tc(s){if(50<co)throw co=0,bf=null,Error(n(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var Ea={};function dj(s,r,l,u){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zs(s,r,l,u){return new dj(s,r,l,u)}function hd(s){return s=s.prototype,!(!s||!s.isReactComponent)}function $i(s,r){var l=s.alternate;return l===null?(l=zs(s.tag,r,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=r,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,r=s.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function Lg(s,r){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,r=l.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Oc(s,r,l,u,p,_){var y=0;if(u=s,typeof s=="function")hd(s)&&(y=1);else if(typeof s=="string")y=gk(s,l,$.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case I:return s=zs(31,l,r,p),s.elementType=I,s.lanes=_,s;case C:return jn(l.children,p,_,r);case k:y=8,p|=24;break;case N:return s=zs(12,l,r,p|2),s.elementType=N,s.lanes=_,s;case Y:return s=zs(13,l,r,p),s.elementType=Y,s.lanes=_,s;case Z:return s=zs(19,l,r,p),s.elementType=Z,s.lanes=_,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case D:y=10;break e;case L:y=9;break e;case M:y=11;break e;case W:y=14;break e;case ee:y=16,u=null;break e}y=29,l=Error(n(130,s===null?"null":typeof s,"")),u=null}return r=zs(y,l,r,p),r.elementType=s,r.type=u,r.lanes=_,r}function jn(s,r,l,u){return s=zs(7,s,u,r),s.lanes=l,s}function dd(s,r,l){return s=zs(6,s,null,r),s.lanes=l,s}function zg(s){var r=zs(18,null,null,0);return r.stateNode=s,r}function fd(s,r,l){return r=zs(4,s.children!==null?s.children:[],s.key,r),r.lanes=l,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var qg=new WeakMap;function ei(s,r){if(typeof s=="object"&&s!==null){var l=qg.get(s);return l!==void 0?l:(r={value:s,source:r,stack:z_(r)},qg.set(s,r),r)}return{value:s,source:r,stack:z_(r)}}var Na=[],Ta=0,Ac=null,Ul=0,ti=[],si=0,wr=null,wi=1,Ci="";function Wi(s,r){Na[Ta++]=Ul,Na[Ta++]=Ac,Ac=s,Ul=r}function Pg(s,r,l){ti[si++]=wi,ti[si++]=Ci,ti[si++]=wr,wr=s;var u=wi;s=Ci;var p=32-Bs(u)-1;u&=~(1<<p),l+=1;var _=32-Bs(r)+p;if(30<_){var y=p-p%5;_=(u&(1<<y)-1).toString(32),u>>=y,p-=y,wi=1<<32-Bs(r)+p|l<<p|u,Ci=_+s}else wi=1<<_|l<<p|u,Ci=s}function md(s){s.return!==null&&(Wi(s,1),Pg(s,1,0))}function pd(s){for(;s===Ac;)Ac=Na[--Ta],Na[Ta]=null,Ul=Na[--Ta],Na[Ta]=null;for(;s===wr;)wr=ti[--si],ti[si]=null,Ci=ti[--si],ti[si]=null,wi=ti[--si],ti[si]=null}function Hg(s,r){ti[si++]=wi,ti[si++]=Ci,ti[si++]=wr,wi=r.id,Ci=r.overflow,wr=s}var ts=null,ft=null,Ve=!1,Cr=null,ii=!1,_d=Error(n(519));function jr(s){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fl(ei(r,s)),_d}function Ig(s){var r=s.stateNode,l=s.type,u=s.memoizedProps;switch(r[es]=s,r[Ss]=u,l){case"dialog":Fe("cancel",r),Fe("close",r);break;case"iframe":case"object":case"embed":Fe("load",r);break;case"video":case"audio":for(l=0;l<ho.length;l++)Fe(ho[l],r);break;case"source":Fe("error",r);break;case"img":case"image":case"link":Fe("error",r),Fe("load",r);break;case"details":Fe("toggle",r);break;case"input":Fe("invalid",r),eg(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Fe("invalid",r);break;case"textarea":Fe("invalid",r),sg(r,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||u.suppressHydrationWarning===!0||rb(r.textContent,l)?(u.popover!=null&&(Fe("beforetoggle",r),Fe("toggle",r)),u.onScroll!=null&&Fe("scroll",r),u.onScrollEnd!=null&&Fe("scrollend",r),u.onClick!=null&&(r.onclick=Fi),r=!0):r=!1,r||jr(s,!0)}function Ug(s){for(ts=s.return;ts;)switch(ts.tag){case 5:case 31:case 13:ii=!1;return;case 27:case 3:ii=!0;return;default:ts=ts.return}}function Oa(s){if(s!==ts)return!1;if(!Ve)return Ug(s),Ve=!0,!1;var r=s.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||Bf(s.type,s.memoizedProps)),l=!l),l&&ft&&jr(s),Ug(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));ft=fb(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));ft=fb(s)}else r===27?(r=ft,Pr(s.type)?(s=Hf,Hf=null,ft=s):ft=r):ft=ts?ni(s.stateNode.nextSibling):null;return!0}function kn(){ft=ts=null,Ve=!1}function gd(){var s=Cr;return s!==null&&(ks===null?ks=s:ks.push.apply(ks,s),Cr=null),s}function Fl(s){Cr===null?Cr=[s]:Cr.push(s)}var vd=T(null),En=null,Vi=null;function kr(s,r,l){ne(vd,r._currentValue),r._currentValue=l}function Yi(s){s._currentValue=vd.current,K(vd)}function yd(s,r,l){for(;s!==null;){var u=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,u!==null&&(u.childLanes|=r)):u!==null&&(u.childLanes&r)!==r&&(u.childLanes|=r),s===l)break;s=s.return}}function bd(s,r,l,u){var p=s.child;for(p!==null&&(p.return=s);p!==null;){var _=p.dependencies;if(_!==null){var y=p.child;_=_.firstContext;e:for(;_!==null;){var w=_;_=p;for(var O=0;O<r.length;O++)if(w.context===r[O]){_.lanes|=l,w=_.alternate,w!==null&&(w.lanes|=l),yd(_.return,l,s),u||(y=null);break e}_=w.next}}else if(p.tag===18){if(y=p.return,y===null)throw Error(n(341));y.lanes|=l,_=y.alternate,_!==null&&(_.lanes|=l),yd(y,l,s),y=null}else y=p.child;if(y!==null)y.return=p;else for(y=p;y!==null;){if(y===s){y=null;break}if(p=y.sibling,p!==null){p.return=y.return,y=p;break}y=y.return}p=y}}function Aa(s,r,l,u){s=null;for(var p=r,_=!1;p!==null;){if(!_){if((p.flags&524288)!==0)_=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var y=p.alternate;if(y===null)throw Error(n(387));if(y=y.memoizedProps,y!==null){var w=p.type;Ls(p.pendingProps.value,y.value)||(s!==null?s.push(w):s=[w])}}else if(p===Ee.current){if(y=p.alternate,y===null)throw Error(n(387));y.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(s!==null?s.push(go):s=[go])}p=p.return}s!==null&&bd(r,s,l,u),r.flags|=262144}function Rc(s){for(s=s.firstContext;s!==null;){if(!Ls(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Nn(s){En=s,Vi=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function ss(s){return Fg(En,s)}function Mc(s,r){return En===null&&Nn(s),Fg(s,r)}function Fg(s,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},Vi===null){if(s===null)throw Error(n(308));Vi=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else Vi=Vi.next=r;return l}var fj=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(l,u){s.push(u)}};this.abort=function(){r.aborted=!0,s.forEach(function(l){return l()})}},mj=e.unstable_scheduleCallback,pj=e.unstable_NormalPriority,At={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sd(){return{controller:new fj,data:new Map,refCount:0}}function Kl(s){s.refCount--,s.refCount===0&&mj(pj,function(){s.controller.abort()})}var $l=null,xd=0,Ra=0,Ma=null;function _j(s,r){if($l===null){var l=$l=[];xd=0,Ra=kf(),Ma={status:"pending",value:void 0,then:function(u){l.push(u)}}}return xd++,r.then(Kg,Kg),r}function Kg(){if(--xd===0&&$l!==null){Ma!==null&&(Ma.status="fulfilled");var s=$l;$l=null,Ra=0,Ma=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function gj(s,r){var l=[],u={status:"pending",value:null,reason:null,then:function(p){l.push(p)}};return s.then(function(){u.status="fulfilled",u.value=r;for(var p=0;p<l.length;p++)(0,l[p])(r)},function(p){for(u.status="rejected",u.reason=p,p=0;p<l.length;p++)(0,l[p])(void 0)}),u}var $g=A.S;A.S=function(s,r){Ny=Ms(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&_j(s,r),$g!==null&&$g(s,r)};var Tn=T(null);function wd(){var s=Tn.current;return s!==null?s:ht.pooledCache}function Dc(s,r){r===null?ne(Tn,Tn.current):ne(Tn,r.pool)}function Wg(){var s=wd();return s===null?null:{parent:At._currentValue,pool:s}}var Da=Error(n(460)),Cd=Error(n(474)),Bc=Error(n(542)),Lc={then:function(){}};function Vg(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Yg(s,r,l){switch(l=s[l],l===void 0?s.push(r):l!==r&&(r.then(Fi,Fi),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Qg(s),s;default:if(typeof r.status=="string")r.then(Fi,Fi);else{if(s=ht,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=r,s.status="pending",s.then(function(u){if(r.status==="pending"){var p=r;p.status="fulfilled",p.value=u}},function(u){if(r.status==="pending"){var p=r;p.status="rejected",p.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Qg(s),s}throw An=r,Da}}function On(s){try{var r=s._init;return r(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(An=l,Da):l}}var An=null;function Gg(){if(An===null)throw Error(n(459));var s=An;return An=null,s}function Qg(s){if(s===Da||s===Bc)throw Error(n(483))}var Ba=null,Wl=0;function zc(s){var r=Wl;return Wl+=1,Ba===null&&(Ba=[]),Yg(Ba,s,r)}function Vl(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function qc(s,r){throw r.$$typeof===b?Error(n(525)):(s=Object.prototype.toString.call(r),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Zg(s){function r(B,R){if(s){var q=B.deletions;q===null?(B.deletions=[R],B.flags|=16):q.push(R)}}function l(B,R){if(!s)return null;for(;R!==null;)r(B,R),R=R.sibling;return null}function u(B){for(var R=new Map;B!==null;)B.key!==null?R.set(B.key,B):R.set(B.index,B),B=B.sibling;return R}function p(B,R){return B=$i(B,R),B.index=0,B.sibling=null,B}function _(B,R,q){return B.index=q,s?(q=B.alternate,q!==null?(q=q.index,q<R?(B.flags|=67108866,R):q):(B.flags|=67108866,R)):(B.flags|=1048576,R)}function y(B){return s&&B.alternate===null&&(B.flags|=67108866),B}function w(B,R,q,X){return R===null||R.tag!==6?(R=dd(q,B.mode,X),R.return=B,R):(R=p(R,q),R.return=B,R)}function O(B,R,q,X){var we=q.type;return we===C?Q(B,R,q.props.children,X,q.key):R!==null&&(R.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ee&&On(we)===R.type)?(R=p(R,q.props),Vl(R,q),R.return=B,R):(R=Oc(q.type,q.key,q.props,null,B.mode,X),Vl(R,q),R.return=B,R)}function P(B,R,q,X){return R===null||R.tag!==4||R.stateNode.containerInfo!==q.containerInfo||R.stateNode.implementation!==q.implementation?(R=fd(q,B.mode,X),R.return=B,R):(R=p(R,q.children||[]),R.return=B,R)}function Q(B,R,q,X,we){return R===null||R.tag!==7?(R=jn(q,B.mode,X,we),R.return=B,R):(R=p(R,q),R.return=B,R)}function J(B,R,q){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=dd(""+R,B.mode,q),R.return=B,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return q=Oc(R.type,R.key,R.props,null,B.mode,q),Vl(q,R),q.return=B,q;case x:return R=fd(R,B.mode,q),R.return=B,R;case ee:return R=On(R),J(B,R,q)}if(se(R)||H(R))return R=jn(R,B.mode,q,null),R.return=B,R;if(typeof R.then=="function")return J(B,zc(R),q);if(R.$$typeof===D)return J(B,Mc(B,R),q);qc(B,R)}return null}function U(B,R,q,X){var we=R!==null?R.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return we!==null?null:w(B,R,""+q,X);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case S:return q.key===we?O(B,R,q,X):null;case x:return q.key===we?P(B,R,q,X):null;case ee:return q=On(q),U(B,R,q,X)}if(se(q)||H(q))return we!==null?null:Q(B,R,q,X,null);if(typeof q.then=="function")return U(B,R,zc(q),X);if(q.$$typeof===D)return U(B,R,Mc(B,q),X);qc(B,q)}return null}function V(B,R,q,X,we){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return B=B.get(q)||null,w(R,B,""+X,we);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return B=B.get(X.key===null?q:X.key)||null,O(R,B,X,we);case x:return B=B.get(X.key===null?q:X.key)||null,P(R,B,X,we);case ee:return X=On(X),V(B,R,q,X,we)}if(se(X)||H(X))return B=B.get(q)||null,Q(R,B,X,we,null);if(typeof X.then=="function")return V(B,R,q,zc(X),we);if(X.$$typeof===D)return V(B,R,q,Mc(R,X),we);qc(R,X)}return null}function ge(B,R,q,X){for(var we=null,tt=null,ye=R,Le=R=0,$e=null;ye!==null&&Le<q.length;Le++){ye.index>Le?($e=ye,ye=null):$e=ye.sibling;var st=U(B,ye,q[Le],X);if(st===null){ye===null&&(ye=$e);break}s&&ye&&st.alternate===null&&r(B,ye),R=_(st,R,Le),tt===null?we=st:tt.sibling=st,tt=st,ye=$e}if(Le===q.length)return l(B,ye),Ve&&Wi(B,Le),we;if(ye===null){for(;Le<q.length;Le++)ye=J(B,q[Le],X),ye!==null&&(R=_(ye,R,Le),tt===null?we=ye:tt.sibling=ye,tt=ye);return Ve&&Wi(B,Le),we}for(ye=u(ye);Le<q.length;Le++)$e=V(ye,B,Le,q[Le],X),$e!==null&&(s&&$e.alternate!==null&&ye.delete($e.key===null?Le:$e.key),R=_($e,R,Le),tt===null?we=$e:tt.sibling=$e,tt=$e);return s&&ye.forEach(function(Kr){return r(B,Kr)}),Ve&&Wi(B,Le),we}function je(B,R,q,X){if(q==null)throw Error(n(151));for(var we=null,tt=null,ye=R,Le=R=0,$e=null,st=q.next();ye!==null&&!st.done;Le++,st=q.next()){ye.index>Le?($e=ye,ye=null):$e=ye.sibling;var Kr=U(B,ye,st.value,X);if(Kr===null){ye===null&&(ye=$e);break}s&&ye&&Kr.alternate===null&&r(B,ye),R=_(Kr,R,Le),tt===null?we=Kr:tt.sibling=Kr,tt=Kr,ye=$e}if(st.done)return l(B,ye),Ve&&Wi(B,Le),we;if(ye===null){for(;!st.done;Le++,st=q.next())st=J(B,st.value,X),st!==null&&(R=_(st,R,Le),tt===null?we=st:tt.sibling=st,tt=st);return Ve&&Wi(B,Le),we}for(ye=u(ye);!st.done;Le++,st=q.next())st=V(ye,B,Le,st.value,X),st!==null&&(s&&st.alternate!==null&&ye.delete(st.key===null?Le:st.key),R=_(st,R,Le),tt===null?we=st:tt.sibling=st,tt=st);return s&&ye.forEach(function(Nk){return r(B,Nk)}),Ve&&Wi(B,Le),we}function ct(B,R,q,X){if(typeof q=="object"&&q!==null&&q.type===C&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case S:e:{for(var we=q.key;R!==null;){if(R.key===we){if(we=q.type,we===C){if(R.tag===7){l(B,R.sibling),X=p(R,q.props.children),X.return=B,B=X;break e}}else if(R.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===ee&&On(we)===R.type){l(B,R.sibling),X=p(R,q.props),Vl(X,q),X.return=B,B=X;break e}l(B,R);break}else r(B,R);R=R.sibling}q.type===C?(X=jn(q.props.children,B.mode,X,q.key),X.return=B,B=X):(X=Oc(q.type,q.key,q.props,null,B.mode,X),Vl(X,q),X.return=B,B=X)}return y(B);case x:e:{for(we=q.key;R!==null;){if(R.key===we)if(R.tag===4&&R.stateNode.containerInfo===q.containerInfo&&R.stateNode.implementation===q.implementation){l(B,R.sibling),X=p(R,q.children||[]),X.return=B,B=X;break e}else{l(B,R);break}else r(B,R);R=R.sibling}X=fd(q,B.mode,X),X.return=B,B=X}return y(B);case ee:return q=On(q),ct(B,R,q,X)}if(se(q))return ge(B,R,q,X);if(H(q)){if(we=H(q),typeof we!="function")throw Error(n(150));return q=we.call(q),je(B,R,q,X)}if(typeof q.then=="function")return ct(B,R,zc(q),X);if(q.$$typeof===D)return ct(B,R,Mc(B,q),X);qc(B,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,R!==null&&R.tag===6?(l(B,R.sibling),X=p(R,q),X.return=B,B=X):(l(B,R),X=dd(q,B.mode,X),X.return=B,B=X),y(B)):l(B,R)}return function(B,R,q,X){try{Wl=0;var we=ct(B,R,q,X);return Ba=null,we}catch(ye){if(ye===Da||ye===Bc)throw ye;var tt=zs(29,ye,null,B.mode);return tt.lanes=X,tt.return=B,tt}finally{}}}var Rn=Zg(!0),Xg=Zg(!1),Er=!1;function jd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kd(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Nr(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Tr(s,r,l){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(it&2)!==0){var p=u.pending;return p===null?r.next=r:(r.next=p.next,p.next=r),u.pending=r,r=Tc(s),Bg(s,null,l),r}return Nc(s,u,r,l),Tc(s)}function Yl(s,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var u=r.lanes;u&=s.pendingLanes,l|=u,r.lanes=l,F_(s,l)}}function Ed(s,r){var l=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var p=null,_=null;if(l=l.firstBaseUpdate,l!==null){do{var y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};_===null?p=_=y:_=_.next=y,l=l.next}while(l!==null);_===null?p=_=r:_=_.next=r}else p=_=r;l={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:_,shared:u.shared,callbacks:u.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=r:s.next=r,l.lastBaseUpdate=r}var Nd=!1;function Gl(){if(Nd){var s=Ma;if(s!==null)throw s}}function Ql(s,r,l,u){Nd=!1;var p=s.updateQueue;Er=!1;var _=p.firstBaseUpdate,y=p.lastBaseUpdate,w=p.shared.pending;if(w!==null){p.shared.pending=null;var O=w,P=O.next;O.next=null,y===null?_=P:y.next=P,y=O;var Q=s.alternate;Q!==null&&(Q=Q.updateQueue,w=Q.lastBaseUpdate,w!==y&&(w===null?Q.firstBaseUpdate=P:w.next=P,Q.lastBaseUpdate=O))}if(_!==null){var J=p.baseState;y=0,Q=P=O=null,w=_;do{var U=w.lane&-536870913,V=U!==w.lane;if(V?(Ke&U)===U:(u&U)===U){U!==0&&U===Ra&&(Nd=!0),Q!==null&&(Q=Q.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ge=s,je=w;U=r;var ct=l;switch(je.tag){case 1:if(ge=je.payload,typeof ge=="function"){J=ge.call(ct,J,U);break e}J=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=je.payload,U=typeof ge=="function"?ge.call(ct,J,U):ge,U==null)break e;J=v({},J,U);break e;case 2:Er=!0}}U=w.callback,U!==null&&(s.flags|=64,V&&(s.flags|=8192),V=p.callbacks,V===null?p.callbacks=[U]:V.push(U))}else V={lane:U,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Q===null?(P=Q=V,O=J):Q=Q.next=V,y|=U;if(w=w.next,w===null){if(w=p.shared.pending,w===null)break;V=w,w=V.next,V.next=null,p.lastBaseUpdate=V,p.shared.pending=null}}while(!0);Q===null&&(O=J),p.baseState=O,p.firstBaseUpdate=P,p.lastBaseUpdate=Q,_===null&&(p.shared.lanes=0),Dr|=y,s.lanes=y,s.memoizedState=J}}function Jg(s,r){if(typeof s!="function")throw Error(n(191,s));s.call(r)}function ev(s,r){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)Jg(l[s],r)}var La=T(null),Pc=T(0);function tv(s,r){s=ir,ne(Pc,s),ne(La,r),ir=s|r.baseLanes}function Td(){ne(Pc,ir),ne(La,La.current)}function Od(){ir=Pc.current,K(La),K(Pc)}var qs=T(null),ri=null;function Or(s){var r=s.alternate;ne(Et,Et.current&1),ne(qs,s),ri===null&&(r===null||La.current!==null||r.memoizedState!==null)&&(ri=s)}function Ad(s){ne(Et,Et.current),ne(qs,s),ri===null&&(ri=s)}function sv(s){s.tag===22?(ne(Et,Et.current),ne(qs,s),ri===null&&(ri=s)):Ar()}function Ar(){ne(Et,Et.current),ne(qs,qs.current)}function Ps(s){K(qs),ri===s&&(ri=null),K(Et)}var Et=T(0);function Hc(s){for(var r=s;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||qf(l)||Pf(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Gi=0,Be=null,lt=null,Rt=null,Ic=!1,za=!1,Mn=!1,Uc=0,Zl=0,qa=null,vj=0;function bt(){throw Error(n(321))}function Rd(s,r){if(r===null)return!1;for(var l=0;l<r.length&&l<s.length;l++)if(!Ls(s[l],r[l]))return!1;return!0}function Md(s,r,l,u,p,_){return Gi=_,Be=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,A.H=s===null||s.memoizedState===null?Pv:Yd,Mn=!1,_=l(u,p),Mn=!1,za&&(_=rv(r,l,u,p)),iv(s),_}function iv(s){A.H=eo;var r=lt!==null&<.next!==null;if(Gi=0,Rt=lt=Be=null,Ic=!1,Zl=0,qa=null,r)throw Error(n(300));s===null||Mt||(s=s.dependencies,s!==null&&Rc(s)&&(Mt=!0))}function rv(s,r,l,u){Be=s;var p=0;do{if(za&&(qa=null),Zl=0,za=!1,25<=p)throw Error(n(301));if(p+=1,Rt=lt=null,s.updateQueue!=null){var _=s.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}A.H=Hv,_=r(l,u)}while(za);return _}function yj(){var s=A.H,r=s.useState()[0];return r=typeof r.then=="function"?Xl(r):r,s=s.useState()[0],(lt!==null?lt.memoizedState:null)!==s&&(Be.flags|=1024),r}function Dd(){var s=Uc!==0;return Uc=0,s}function Bd(s,r,l){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~l}function Ld(s){if(Ic){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Ic=!1}Gi=0,Rt=lt=Be=null,za=!1,Zl=Uc=0,qa=null}function ps(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Be.memoizedState=Rt=s:Rt=Rt.next=s,Rt}function Nt(){if(lt===null){var s=Be.alternate;s=s!==null?s.memoizedState:null}else s=lt.next;var r=Rt===null?Be.memoizedState:Rt.next;if(r!==null)Rt=r,lt=s;else{if(s===null)throw Be.alternate===null?Error(n(467)):Error(n(310));lt=s,s={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},Rt===null?Be.memoizedState=Rt=s:Rt=Rt.next=s}return Rt}function Fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xl(s){var r=Zl;return Zl+=1,qa===null&&(qa=[]),s=Yg(qa,s,r),r=Be,(Rt===null?r.memoizedState:Rt.next)===null&&(r=r.alternate,A.H=r===null||r.memoizedState===null?Pv:Yd),s}function Kc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Xl(s);if(s.$$typeof===D)return ss(s)}throw Error(n(438,String(s)))}function zd(s){var r=null,l=Be.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var u=Be.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(p){return p.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=Fc(),Be.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(s),u=0;u<s;u++)l[u]=ae;return r.index++,l}function Qi(s,r){return typeof r=="function"?r(s):r}function $c(s){var r=Nt();return qd(r,lt,s)}function qd(s,r,l){var u=s.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=l;var p=s.baseQueue,_=u.pending;if(_!==null){if(p!==null){var y=p.next;p.next=_.next,_.next=y}r.baseQueue=p=_,u.pending=null}if(_=s.baseState,p===null)s.memoizedState=_;else{r=p.next;var w=y=null,O=null,P=r,Q=!1;do{var J=P.lane&-536870913;if(J!==P.lane?(Ke&J)===J:(Gi&J)===J){var U=P.revertLane;if(U===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),J===Ra&&(Q=!0);else if((Gi&U)===U){P=P.next,U===Ra&&(Q=!0);continue}else J={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},O===null?(w=O=J,y=_):O=O.next=J,Be.lanes|=U,Dr|=U;J=P.action,Mn&&l(_,J),_=P.hasEagerState?P.eagerState:l(_,J)}else U={lane:J,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},O===null?(w=O=U,y=_):O=O.next=U,Be.lanes|=J,Dr|=J;P=P.next}while(P!==null&&P!==r);if(O===null?y=_:O.next=w,!Ls(_,s.memoizedState)&&(Mt=!0,Q&&(l=Ma,l!==null)))throw l;s.memoizedState=_,s.baseState=y,s.baseQueue=O,u.lastRenderedState=_}return p===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function Pd(s){var r=Nt(),l=r.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=s;var u=l.dispatch,p=l.pending,_=r.memoizedState;if(p!==null){l.pending=null;var y=p=p.next;do _=s(_,y.action),y=y.next;while(y!==p);Ls(_,r.memoizedState)||(Mt=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),l.lastRenderedState=_}return[_,u]}function nv(s,r,l){var u=Be,p=Nt(),_=Ve;if(_){if(l===void 0)throw Error(n(407));l=l()}else l=r();var y=!Ls((lt||p).memoizedState,l);if(y&&(p.memoizedState=l,Mt=!0),p=p.queue,Ud(ov.bind(null,u,p,s),[s]),p.getSnapshot!==r||y||Rt!==null&&Rt.memoizedState.tag&1){if(u.flags|=2048,Pa(9,{destroy:void 0},lv.bind(null,u,p,l,r),null),ht===null)throw Error(n(349));_||(Gi&127)!==0||av(u,r,l)}return l}function av(s,r,l){s.flags|=16384,s={getSnapshot:r,value:l},r=Be.updateQueue,r===null?(r=Fc(),Be.updateQueue=r,r.stores=[s]):(l=r.stores,l===null?r.stores=[s]:l.push(s))}function lv(s,r,l,u){r.value=l,r.getSnapshot=u,cv(r)&&uv(s)}function ov(s,r,l){return l(function(){cv(r)&&uv(s)})}function cv(s){var r=s.getSnapshot;s=s.value;try{var l=r();return!Ls(s,l)}catch{return!0}}function uv(s){var r=Cn(s,2);r!==null&&Es(r,s,2)}function Hd(s){var r=ps();if(typeof s=="function"){var l=s;if(s=l(),Mn){br(!0);try{l()}finally{br(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:s},r}function hv(s,r,l,u){return s.baseState=l,qd(s,lt,typeof u=="function"?u:Qi)}function bj(s,r,l,u,p){if(Yc(s))throw Error(n(485));if(s=r.action,s!==null){var _={payload:p,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){_.listeners.push(y)}};A.T!==null?l(!0):_.isTransition=!1,u(_),l=r.pending,l===null?(_.next=r.pending=_,dv(r,_)):(_.next=l.next,r.pending=l.next=_)}}function dv(s,r){var l=r.action,u=r.payload,p=s.state;if(r.isTransition){var _=A.T,y={};A.T=y;try{var w=l(p,u),O=A.S;O!==null&&O(y,w),fv(s,r,w)}catch(P){Id(s,r,P)}finally{_!==null&&y.types!==null&&(_.types=y.types),A.T=_}}else try{_=l(p,u),fv(s,r,_)}catch(P){Id(s,r,P)}}function fv(s,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){mv(s,r,u)},function(u){return Id(s,r,u)}):mv(s,r,l)}function mv(s,r,l){r.status="fulfilled",r.value=l,pv(r),s.state=l,r=s.pending,r!==null&&(l=r.next,l===r?s.pending=null:(l=l.next,r.next=l,dv(s,l)))}function Id(s,r,l){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,pv(r),r=r.next;while(r!==u)}s.action=null}function pv(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function _v(s,r){return r}function gv(s,r){if(Ve){var l=ht.formState;if(l!==null){e:{var u=Be;if(Ve){if(ft){t:{for(var p=ft,_=ii;p.nodeType!==8;){if(!_){p=null;break t}if(p=ni(p.nextSibling),p===null){p=null;break t}}_=p.data,p=_==="F!"||_==="F"?p:null}if(p){ft=ni(p.nextSibling),u=p.data==="F!";break e}}jr(u)}u=!1}u&&(r=l[0])}}return l=ps(),l.memoizedState=l.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_v,lastRenderedState:r},l.queue=u,l=Lv.bind(null,Be,u),u.dispatch=l,u=Hd(!1),_=Vd.bind(null,Be,!1,u.queue),u=ps(),p={state:r,dispatch:null,action:s,pending:null},u.queue=p,l=bj.bind(null,Be,p,_,l),p.dispatch=l,u.memoizedState=s,[r,l,!1]}function vv(s){var r=Nt();return yv(r,lt,s)}function yv(s,r,l){if(r=qd(s,r,_v)[0],s=$c(Qi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Xl(r)}catch(y){throw y===Da?Bc:y}else u=r;r=Nt();var p=r.queue,_=p.dispatch;return l!==r.memoizedState&&(Be.flags|=2048,Pa(9,{destroy:void 0},Sj.bind(null,p,l),null)),[u,_,s]}function Sj(s,r){s.action=r}function bv(s){var r=Nt(),l=lt;if(l!==null)return yv(r,l,s);Nt(),r=r.memoizedState,l=Nt();var u=l.queue.dispatch;return l.memoizedState=s,[r,u,!1]}function Pa(s,r,l,u){return s={tag:s,create:l,deps:u,inst:r,next:null},r=Be.updateQueue,r===null&&(r=Fc(),Be.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=s.next=s:(u=l.next,l.next=s,s.next=u,r.lastEffect=s),s}function Sv(){return Nt().memoizedState}function Wc(s,r,l,u){var p=ps();Be.flags|=s,p.memoizedState=Pa(1|r,{destroy:void 0},l,u===void 0?null:u)}function Vc(s,r,l,u){var p=Nt();u=u===void 0?null:u;var _=p.memoizedState.inst;lt!==null&&u!==null&&Rd(u,lt.memoizedState.deps)?p.memoizedState=Pa(r,_,l,u):(Be.flags|=s,p.memoizedState=Pa(1|r,_,l,u))}function xv(s,r){Wc(8390656,8,s,r)}function Ud(s,r){Vc(2048,8,s,r)}function xj(s){Be.flags|=4;var r=Be.updateQueue;if(r===null)r=Fc(),Be.updateQueue=r,r.events=[s];else{var l=r.events;l===null?r.events=[s]:l.push(s)}}function wv(s){var r=Nt().memoizedState;return xj({ref:r,nextImpl:s}),function(){if((it&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function Cv(s,r){return Vc(4,2,s,r)}function jv(s,r){return Vc(4,4,s,r)}function kv(s,r){if(typeof r=="function"){s=s();var l=r(s);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function Ev(s,r,l){l=l!=null?l.concat([s]):null,Vc(4,4,kv.bind(null,r,s),l)}function Fd(){}function Nv(s,r){var l=Nt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&Rd(r,u[1])?u[0]:(l.memoizedState=[s,r],s)}function Tv(s,r){var l=Nt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&Rd(r,u[1]))return u[0];if(u=s(),Mn){br(!0);try{s()}finally{br(!1)}}return l.memoizedState=[u,r],u}function Kd(s,r,l){return l===void 0||(Gi&1073741824)!==0&&(Ke&261930)===0?s.memoizedState=r:(s.memoizedState=l,s=Oy(),Be.lanes|=s,Dr|=s,l)}function Ov(s,r,l,u){return Ls(l,r)?l:La.current!==null?(s=Kd(s,l,u),Ls(s,r)||(Mt=!0),s):(Gi&42)===0||(Gi&1073741824)!==0&&(Ke&261930)===0?(Mt=!0,s.memoizedState=l):(s=Oy(),Be.lanes|=s,Dr|=s,r)}function Av(s,r,l,u,p){var _=F.p;F.p=_!==0&&8>_?_:8;var y=A.T,w={};A.T=w,Vd(s,!1,r,l);try{var O=p(),P=A.S;if(P!==null&&P(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Q=gj(O,u);Jl(s,r,Q,Us(s))}else Jl(s,r,u,Us(s))}catch(J){Jl(s,r,{then:function(){},status:"rejected",reason:J},Us())}finally{F.p=_,y!==null&&w.types!==null&&(y.types=w.types),A.T=y}}function wj(){}function $d(s,r,l,u){if(s.tag!==5)throw Error(n(476));var p=Rv(s).queue;Av(s,p,r,G,l===null?wj:function(){return Mv(s),l(u)})}function Rv(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:G},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:l},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function Mv(s){var r=Rv(s);r.next===null&&(r=s.alternate.memoizedState),Jl(s,r.next.queue,{},Us())}function Wd(){return ss(go)}function Dv(){return Nt().memoizedState}function Bv(){return Nt().memoizedState}function Cj(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var l=Us();s=Nr(l);var u=Tr(r,s,l);u!==null&&(Es(u,r,l),Yl(u,r,l)),r={cache:Sd()},s.payload=r;return}r=r.return}}function jj(s,r,l){var u=Us();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Yc(s)?zv(r,l):(l=ud(s,r,l,u),l!==null&&(Es(l,s,u),qv(l,r,u)))}function Lv(s,r,l){var u=Us();Jl(s,r,l,u)}function Jl(s,r,l,u){var p={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Yc(s))zv(r,p);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var y=r.lastRenderedState,w=_(y,l);if(p.hasEagerState=!0,p.eagerState=w,Ls(w,y))return Nc(s,r,p,0),ht===null&&Ec(),!1}catch{}finally{}if(l=ud(s,r,p,u),l!==null)return Es(l,s,u),qv(l,r,u),!0}return!1}function Vd(s,r,l,u){if(u={lane:2,revertLane:kf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Yc(s)){if(r)throw Error(n(479))}else r=ud(s,l,u,2),r!==null&&Es(r,s,2)}function Yc(s){var r=s.alternate;return s===Be||r!==null&&r===Be}function zv(s,r){za=Ic=!0;var l=s.pending;l===null?r.next=r:(r.next=l.next,l.next=r),s.pending=r}function qv(s,r,l){if((l&4194048)!==0){var u=r.lanes;u&=s.pendingLanes,l|=u,r.lanes=l,F_(s,l)}}var eo={readContext:ss,use:Kc,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};eo.useEffectEvent=bt;var Pv={readContext:ss,use:Kc,useCallback:function(s,r){return ps().memoizedState=[s,r===void 0?null:r],s},useContext:ss,useEffect:xv,useImperativeHandle:function(s,r,l){l=l!=null?l.concat([s]):null,Wc(4194308,4,kv.bind(null,r,s),l)},useLayoutEffect:function(s,r){return Wc(4194308,4,s,r)},useInsertionEffect:function(s,r){Wc(4,2,s,r)},useMemo:function(s,r){var l=ps();r=r===void 0?null:r;var u=s();if(Mn){br(!0);try{s()}finally{br(!1)}}return l.memoizedState=[u,r],u},useReducer:function(s,r,l){var u=ps();if(l!==void 0){var p=l(r);if(Mn){br(!0);try{l(r)}finally{br(!1)}}}else p=r;return u.memoizedState=u.baseState=p,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:p},u.queue=s,s=s.dispatch=jj.bind(null,Be,s),[u.memoizedState,s]},useRef:function(s){var r=ps();return s={current:s},r.memoizedState=s},useState:function(s){s=Hd(s);var r=s.queue,l=Lv.bind(null,Be,r);return r.dispatch=l,[s.memoizedState,l]},useDebugValue:Fd,useDeferredValue:function(s,r){var l=ps();return Kd(l,s,r)},useTransition:function(){var s=Hd(!1);return s=Av.bind(null,Be,s.queue,!0,!1),ps().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,l){var u=Be,p=ps();if(Ve){if(l===void 0)throw Error(n(407));l=l()}else{if(l=r(),ht===null)throw Error(n(349));(Ke&127)!==0||av(u,r,l)}p.memoizedState=l;var _={value:l,getSnapshot:r};return p.queue=_,xv(ov.bind(null,u,_,s),[s]),u.flags|=2048,Pa(9,{destroy:void 0},lv.bind(null,u,_,l,r),null),l},useId:function(){var s=ps(),r=ht.identifierPrefix;if(Ve){var l=Ci,u=wi;l=(u&~(1<<32-Bs(u)-1)).toString(32)+l,r="_"+r+"R_"+l,l=Uc++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=vj++,r="_"+r+"r_"+l.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Wd,useFormState:gv,useActionState:gv,useOptimistic:function(s){var r=ps();r.memoizedState=r.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Vd.bind(null,Be,!0,l),l.dispatch=r,[s,r]},useMemoCache:zd,useCacheRefresh:function(){return ps().memoizedState=Cj.bind(null,Be)},useEffectEvent:function(s){var r=ps(),l={impl:s};return r.memoizedState=l,function(){if((it&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}},Yd={readContext:ss,use:Kc,useCallback:Nv,useContext:ss,useEffect:Ud,useImperativeHandle:Ev,useInsertionEffect:Cv,useLayoutEffect:jv,useMemo:Tv,useReducer:$c,useRef:Sv,useState:function(){return $c(Qi)},useDebugValue:Fd,useDeferredValue:function(s,r){var l=Nt();return Ov(l,lt.memoizedState,s,r)},useTransition:function(){var s=$c(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Xl(s),r]},useSyncExternalStore:nv,useId:Dv,useHostTransitionStatus:Wd,useFormState:vv,useActionState:vv,useOptimistic:function(s,r){var l=Nt();return hv(l,lt,s,r)},useMemoCache:zd,useCacheRefresh:Bv};Yd.useEffectEvent=wv;var Hv={readContext:ss,use:Kc,useCallback:Nv,useContext:ss,useEffect:Ud,useImperativeHandle:Ev,useInsertionEffect:Cv,useLayoutEffect:jv,useMemo:Tv,useReducer:Pd,useRef:Sv,useState:function(){return Pd(Qi)},useDebugValue:Fd,useDeferredValue:function(s,r){var l=Nt();return lt===null?Kd(l,s,r):Ov(l,lt.memoizedState,s,r)},useTransition:function(){var s=Pd(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Xl(s),r]},useSyncExternalStore:nv,useId:Dv,useHostTransitionStatus:Wd,useFormState:bv,useActionState:bv,useOptimistic:function(s,r){var l=Nt();return lt!==null?hv(l,lt,s,r):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:zd,useCacheRefresh:Bv};Hv.useEffectEvent=wv;function Gd(s,r,l,u){r=s.memoizedState,l=l(u,r),l=l==null?r:v({},r,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Qd={enqueueSetState:function(s,r,l){s=s._reactInternals;var u=Us(),p=Nr(u);p.payload=r,l!=null&&(p.callback=l),r=Tr(s,p,u),r!==null&&(Es(r,s,u),Yl(r,s,u))},enqueueReplaceState:function(s,r,l){s=s._reactInternals;var u=Us(),p=Nr(u);p.tag=1,p.payload=r,l!=null&&(p.callback=l),r=Tr(s,p,u),r!==null&&(Es(r,s,u),Yl(r,s,u))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var l=Us(),u=Nr(l);u.tag=2,r!=null&&(u.callback=r),r=Tr(s,u,l),r!==null&&(Es(r,s,l),Yl(r,s,l))}};function Iv(s,r,l,u,p,_,y){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,_,y):r.prototype&&r.prototype.isPureReactComponent?!Hl(l,u)||!Hl(p,_):!0}function Uv(s,r,l,u){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,u),r.state!==s&&Qd.enqueueReplaceState(r,r.state,null)}function Dn(s,r){var l=r;if("ref"in r){l={};for(var u in r)u!=="ref"&&(l[u]=r[u])}if(s=s.defaultProps){l===r&&(l=v({},l));for(var p in s)l[p]===void 0&&(l[p]=s[p])}return l}function Fv(s){kc(s)}function Kv(s){console.error(s)}function $v(s){kc(s)}function Gc(s,r){try{var l=s.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function Wv(s,r,l){try{var u=s.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Zd(s,r,l){return l=Nr(l),l.tag=3,l.payload={element:null},l.callback=function(){Gc(s,r)},l}function Vv(s){return s=Nr(s),s.tag=3,s}function Yv(s,r,l,u){var p=l.type.getDerivedStateFromError;if(typeof p=="function"){var _=u.value;s.payload=function(){return p(_)},s.callback=function(){Wv(r,l,u)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(s.callback=function(){Wv(r,l,u),typeof p!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}function kj(s,r,l,u,p){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&Aa(r,l,p,!0),l=qs.current,l!==null){switch(l.tag){case 31:case 13:return ri===null?lu():l.alternate===null&&St===0&&(St=3),l.flags&=-257,l.flags|=65536,l.lanes=p,u===Lc?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),wf(s,u,p)),!1;case 22:return l.flags|=65536,u===Lc?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([u]):l.add(u)),wf(s,u,p)),!1}throw Error(n(435,l.tag))}return wf(s,u,p),lu(),!1}if(Ve)return r=qs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=p,u!==_d&&(s=Error(n(422),{cause:u}),Fl(ei(s,l)))):(u!==_d&&(r=Error(n(423),{cause:u}),Fl(ei(r,l))),s=s.current.alternate,s.flags|=65536,p&=-p,s.lanes|=p,u=ei(u,l),p=Zd(s.stateNode,u,p),Ed(s,p),St!==4&&(St=2)),!1;var _=Error(n(520),{cause:u});if(_=ei(_,l),oo===null?oo=[_]:oo.push(_),St!==4&&(St=2),r===null)return!0;u=ei(u,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,s=p&-p,l.lanes|=s,s=Zd(l.stateNode,u,s),Ed(l,s),!1;case 1:if(r=l.type,_=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(Br===null||!Br.has(_))))return l.flags|=65536,p&=-p,l.lanes|=p,p=Vv(p),Yv(p,s,l,u),Ed(l,p),!1}l=l.return}while(l!==null);return!1}var Xd=Error(n(461)),Mt=!1;function is(s,r,l,u){r.child=s===null?Xg(r,null,l,u):Rn(r,s.child,l,u)}function Gv(s,r,l,u,p){l=l.render;var _=r.ref;if("ref"in u){var y={};for(var w in u)w!=="ref"&&(y[w]=u[w])}else y=u;return Nn(r),u=Md(s,r,l,y,_,p),w=Dd(),s!==null&&!Mt?(Bd(s,r,p),Zi(s,r,p)):(Ve&&w&&md(r),r.flags|=1,is(s,r,u,p),r.child)}function Qv(s,r,l,u,p){if(s===null){var _=l.type;return typeof _=="function"&&!hd(_)&&_.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=_,Zv(s,r,_,u,p)):(s=Oc(l.type,null,u,r,r.mode,p),s.ref=r.ref,s.return=r,r.child=s)}if(_=s.child,!lf(s,p)){var y=_.memoizedProps;if(l=l.compare,l=l!==null?l:Hl,l(y,u)&&s.ref===r.ref)return Zi(s,r,p)}return r.flags|=1,s=$i(_,u),s.ref=r.ref,s.return=r,r.child=s}function Zv(s,r,l,u,p){if(s!==null){var _=s.memoizedProps;if(Hl(_,u)&&s.ref===r.ref)if(Mt=!1,r.pendingProps=u=_,lf(s,p))(s.flags&131072)!==0&&(Mt=!0);else return r.lanes=s.lanes,Zi(s,r,p)}return Jd(s,r,l,u,p)}function Xv(s,r,l,u){var p=u.children,_=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((r.flags&128)!==0){if(_=_!==null?_.baseLanes|l:l,s!==null){for(u=r.child=s.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~_}else u=0,r.child=null;return Jv(s,r,_,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Dc(r,_!==null?_.cachePool:null),_!==null?tv(r,_):Td(),sv(r);else return u=r.lanes=536870912,Jv(s,r,_!==null?_.baseLanes|l:l,l,u)}else _!==null?(Dc(r,_.cachePool),tv(r,_),Ar(),r.memoizedState=null):(s!==null&&Dc(r,null),Td(),Ar());return is(s,r,p,l),r.child}function to(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Jv(s,r,l,u,p){var _=wd();return _=_===null?null:{parent:At._currentValue,pool:_},r.memoizedState={baseLanes:l,cachePool:_},s!==null&&Dc(r,null),Td(),sv(r),s!==null&&Aa(s,r,u,!0),r.childLanes=p,null}function Qc(s,r){return r=Xc({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function ey(s,r,l){return Rn(r,s.child,null,l),s=Qc(r,r.pendingProps),s.flags|=2,Ps(r),r.memoizedState=null,s}function Ej(s,r,l){var u=r.pendingProps,p=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(Ve){if(u.mode==="hidden")return s=Qc(r,u),r.lanes=536870912,to(null,s);if(Ad(r),(s=ft)?(s=db(s,ii),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:wr!==null?{id:wi,overflow:Ci}:null,retryLane:536870912,hydrationErrors:null},l=zg(s),l.return=r,r.child=l,ts=r,ft=null)):s=null,s===null)throw jr(r);return r.lanes=536870912,null}return Qc(r,u)}var _=s.memoizedState;if(_!==null){var y=_.dehydrated;if(Ad(r),p)if(r.flags&256)r.flags&=-257,r=ey(s,r,l);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(n(558));else if(Mt||Aa(s,r,l,!1),p=(l&s.childLanes)!==0,Mt||p){if(u=ht,u!==null&&(y=K_(u,l),y!==0&&y!==_.retryLane))throw _.retryLane=y,Cn(s,y),Es(u,s,y),Xd;lu(),r=ey(s,r,l)}else s=_.treeContext,ft=ni(y.nextSibling),ts=r,Ve=!0,Cr=null,ii=!1,s!==null&&Hg(r,s),r=Qc(r,u),r.flags|=4096;return r}return s=$i(s.child,{mode:u.mode,children:u.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Zc(s,r){var l=r.ref;if(l===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(n(284));(s===null||s.ref!==l)&&(r.flags|=4194816)}}function Jd(s,r,l,u,p){return Nn(r),l=Md(s,r,l,u,void 0,p),u=Dd(),s!==null&&!Mt?(Bd(s,r,p),Zi(s,r,p)):(Ve&&u&&md(r),r.flags|=1,is(s,r,l,p),r.child)}function ty(s,r,l,u,p,_){return Nn(r),r.updateQueue=null,l=rv(r,u,l,p),iv(s),u=Dd(),s!==null&&!Mt?(Bd(s,r,_),Zi(s,r,_)):(Ve&&u&&md(r),r.flags|=1,is(s,r,l,_),r.child)}function sy(s,r,l,u,p){if(Nn(r),r.stateNode===null){var _=Ea,y=l.contextType;typeof y=="object"&&y!==null&&(_=ss(y)),_=new l(u,_),r.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Qd,r.stateNode=_,_._reactInternals=r,_=r.stateNode,_.props=u,_.state=r.memoizedState,_.refs={},jd(r),y=l.contextType,_.context=typeof y=="object"&&y!==null?ss(y):Ea,_.state=r.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Gd(r,l,y,u),_.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(y=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),y!==_.state&&Qd.enqueueReplaceState(_,_.state,null),Ql(r,u,_,p),Gl(),_.state=r.memoizedState),typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(s===null){_=r.stateNode;var w=r.memoizedProps,O=Dn(l,w);_.props=O;var P=_.context,Q=l.contextType;y=Ea,typeof Q=="object"&&Q!==null&&(y=ss(Q));var J=l.getDerivedStateFromProps;Q=typeof J=="function"||typeof _.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,Q||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(w||P!==y)&&Uv(r,_,u,y),Er=!1;var U=r.memoizedState;_.state=U,Ql(r,u,_,p),Gl(),P=r.memoizedState,w||U!==P||Er?(typeof J=="function"&&(Gd(r,l,J,u),P=r.memoizedState),(O=Er||Iv(r,l,O,u,U,P,y))?(Q||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(r.flags|=4194308)):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=P),_.props=u,_.state=P,_.context=y,u=O):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{_=r.stateNode,kd(s,r),y=r.memoizedProps,Q=Dn(l,y),_.props=Q,J=r.pendingProps,U=_.context,P=l.contextType,O=Ea,typeof P=="object"&&P!==null&&(O=ss(P)),w=l.getDerivedStateFromProps,(P=typeof w=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(y!==J||U!==O)&&Uv(r,_,u,O),Er=!1,U=r.memoizedState,_.state=U,Ql(r,u,_,p),Gl();var V=r.memoizedState;y!==J||U!==V||Er||s!==null&&s.dependencies!==null&&Rc(s.dependencies)?(typeof w=="function"&&(Gd(r,l,w,u),V=r.memoizedState),(Q=Er||Iv(r,l,Q,u,U,V,O)||s!==null&&s.dependencies!==null&&Rc(s.dependencies))?(P||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,V,O),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,V,O)),typeof _.componentDidUpdate=="function"&&(r.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof _.componentDidUpdate!="function"||y===s.memoizedProps&&U===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&U===s.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=V),_.props=u,_.state=V,_.context=O,u=Q):(typeof _.componentDidUpdate!="function"||y===s.memoizedProps&&U===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&U===s.memoizedState||(r.flags|=1024),u=!1)}return _=u,Zc(s,r),u=(r.flags&128)!==0,_||u?(_=r.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:_.render(),r.flags|=1,s!==null&&u?(r.child=Rn(r,s.child,null,p),r.child=Rn(r,null,l,p)):is(s,r,l,p),r.memoizedState=_.state,s=r.child):s=Zi(s,r,p),s}function iy(s,r,l,u){return kn(),r.flags|=256,is(s,r,l,u),r.child}var ef={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function tf(s){return{baseLanes:s,cachePool:Wg()}}function sf(s,r,l){return s=s!==null?s.childLanes&~l:0,r&&(s|=Is),s}function ry(s,r,l){var u=r.pendingProps,p=!1,_=(r.flags&128)!==0,y;if((y=_)||(y=s!==null&&s.memoizedState===null?!1:(Et.current&2)!==0),y&&(p=!0,r.flags&=-129),y=(r.flags&32)!==0,r.flags&=-33,s===null){if(Ve){if(p?Or(r):Ar(),(s=ft)?(s=db(s,ii),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:wr!==null?{id:wi,overflow:Ci}:null,retryLane:536870912,hydrationErrors:null},l=zg(s),l.return=r,r.child=l,ts=r,ft=null)):s=null,s===null)throw jr(r);return Pf(s)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,p?(Ar(),p=r.mode,w=Xc({mode:"hidden",children:w},p),u=jn(u,p,l,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=tf(l),u.childLanes=sf(s,y,l),r.memoizedState=ef,to(null,u)):(Or(r),rf(r,w))}var O=s.memoizedState;if(O!==null&&(w=O.dehydrated,w!==null)){if(_)r.flags&256?(Or(r),r.flags&=-257,r=nf(s,r,l)):r.memoizedState!==null?(Ar(),r.child=s.child,r.flags|=128,r=null):(Ar(),w=u.fallback,p=r.mode,u=Xc({mode:"visible",children:u.children},p),w=jn(w,p,l,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Rn(r,s.child,null,l),u=r.child,u.memoizedState=tf(l),u.childLanes=sf(s,y,l),r.memoizedState=ef,r=to(null,u));else if(Or(r),Pf(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var P=y.dgst;y=P,u=Error(n(419)),u.stack="",u.digest=y,Fl({value:u,source:null,stack:null}),r=nf(s,r,l)}else if(Mt||Aa(s,r,l,!1),y=(l&s.childLanes)!==0,Mt||y){if(y=ht,y!==null&&(u=K_(y,l),u!==0&&u!==O.retryLane))throw O.retryLane=u,Cn(s,u),Es(y,s,u),Xd;qf(w)||lu(),r=nf(s,r,l)}else qf(w)?(r.flags|=192,r.child=s.child,r=null):(s=O.treeContext,ft=ni(w.nextSibling),ts=r,Ve=!0,Cr=null,ii=!1,s!==null&&Hg(r,s),r=rf(r,u.children),r.flags|=4096);return r}return p?(Ar(),w=u.fallback,p=r.mode,O=s.child,P=O.sibling,u=$i(O,{mode:"hidden",children:u.children}),u.subtreeFlags=O.subtreeFlags&65011712,P!==null?w=$i(P,w):(w=jn(w,p,l,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,to(null,u),u=r.child,w=s.child.memoizedState,w===null?w=tf(l):(p=w.cachePool,p!==null?(O=At._currentValue,p=p.parent!==O?{parent:O,pool:O}:p):p=Wg(),w={baseLanes:w.baseLanes|l,cachePool:p}),u.memoizedState=w,u.childLanes=sf(s,y,l),r.memoizedState=ef,to(s.child,u)):(Or(r),l=s.child,s=l.sibling,l=$i(l,{mode:"visible",children:u.children}),l.return=r,l.sibling=null,s!==null&&(y=r.deletions,y===null?(r.deletions=[s],r.flags|=16):y.push(s)),r.child=l,r.memoizedState=null,l)}function rf(s,r){return r=Xc({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Xc(s,r){return s=zs(22,s,null,r),s.lanes=0,s}function nf(s,r,l){return Rn(r,s.child,null,l),s=rf(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function ny(s,r,l){s.lanes|=r;var u=s.alternate;u!==null&&(u.lanes|=r),yd(s.return,r,l)}function af(s,r,l,u,p,_){var y=s.memoizedState;y===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:p,treeForkCount:_}:(y.isBackwards=r,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=l,y.tailMode=p,y.treeForkCount=_)}function ay(s,r,l){var u=r.pendingProps,p=u.revealOrder,_=u.tail;u=u.children;var y=Et.current,w=(y&2)!==0;if(w?(y=y&1|2,r.flags|=128):y&=1,ne(Et,y),is(s,r,u,l),u=Ve?Ul:0,!w&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&ny(s,l,r);else if(s.tag===19)ny(s,l,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(p){case"forwards":for(l=r.child,p=null;l!==null;)s=l.alternate,s!==null&&Hc(s)===null&&(p=l),l=l.sibling;l=p,l===null?(p=r.child,r.child=null):(p=l.sibling,l.sibling=null),af(r,!1,p,l,_,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,p=r.child,r.child=null;p!==null;){if(s=p.alternate,s!==null&&Hc(s)===null){r.child=p;break}s=p.sibling,p.sibling=l,l=p,p=s}af(r,!0,l,null,_,u);break;case"together":af(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function Zi(s,r,l){if(s!==null&&(r.dependencies=s.dependencies),Dr|=r.lanes,(l&r.childLanes)===0)if(s!==null){if(Aa(s,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(n(153));if(r.child!==null){for(s=r.child,l=$i(s,s.pendingProps),r.child=l,l.return=r;s.sibling!==null;)s=s.sibling,l=l.sibling=$i(s,s.pendingProps),l.return=r;l.sibling=null}return r.child}function lf(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Rc(s)))}function Nj(s,r,l){switch(r.tag){case 3:kt(r,r.stateNode.containerInfo),kr(r,At,s.memoizedState.cache),kn();break;case 27:case 5:Rs(r);break;case 4:kt(r,r.stateNode.containerInfo);break;case 10:kr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Ad(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Or(r),r.flags|=128,null):(l&r.child.childLanes)!==0?ry(s,r,l):(Or(r),s=Zi(s,r,l),s!==null?s.sibling:null);Or(r);break;case 19:var p=(s.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(Aa(s,r,l,!1),u=(l&r.childLanes)!==0),p){if(u)return ay(s,r,l);r.flags|=128}if(p=r.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ne(Et,Et.current),u)break;return null;case 22:return r.lanes=0,Xv(s,r,l,r.pendingProps);case 24:kr(r,At,s.memoizedState.cache)}return Zi(s,r,l)}function ly(s,r,l){if(s!==null)if(s.memoizedProps!==r.pendingProps)Mt=!0;else{if(!lf(s,l)&&(r.flags&128)===0)return Mt=!1,Nj(s,r,l);Mt=(s.flags&131072)!==0}else Mt=!1,Ve&&(r.flags&1048576)!==0&&Pg(r,Ul,r.index);switch(r.lanes=0,r.tag){case 16:e:{var u=r.pendingProps;if(s=On(r.elementType),r.type=s,typeof s=="function")hd(s)?(u=Dn(s,u),r.tag=1,r=sy(null,r,s,u,l)):(r.tag=0,r=Jd(null,r,s,u,l));else{if(s!=null){var p=s.$$typeof;if(p===M){r.tag=11,r=Gv(null,r,s,u,l);break e}else if(p===W){r.tag=14,r=Qv(null,r,s,u,l);break e}}throw r=re(s)||s,Error(n(306,r,""))}}return r;case 0:return Jd(s,r,r.type,r.pendingProps,l);case 1:return u=r.type,p=Dn(u,r.pendingProps),sy(s,r,u,p,l);case 3:e:{if(kt(r,r.stateNode.containerInfo),s===null)throw Error(n(387));u=r.pendingProps;var _=r.memoizedState;p=_.element,kd(s,r),Ql(r,u,null,l);var y=r.memoizedState;if(u=y.cache,kr(r,At,u),u!==_.cache&&bd(r,[At],l,!0),Gl(),u=y.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:y.cache},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){r=iy(s,r,u,l);break e}else if(u!==p){p=ei(Error(n(424)),r),Fl(p),r=iy(s,r,u,l);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(ft=ni(s.firstChild),ts=r,Ve=!0,Cr=null,ii=!0,l=Xg(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(kn(),u===p){r=Zi(s,r,l);break e}is(s,r,u,l)}r=r.child}return r;case 26:return Zc(s,r),s===null?(l=vb(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ve||(l=r.type,s=r.pendingProps,u=mu(_e.current).createElement(l),u[es]=r,u[Ss]=s,rs(u,l,s),$t(u),r.stateNode=u):r.memoizedState=vb(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Rs(r),s===null&&Ve&&(u=r.stateNode=pb(r.type,r.pendingProps,_e.current),ts=r,ii=!0,p=ft,Pr(r.type)?(Hf=p,ft=ni(u.firstChild)):ft=p),is(s,r,r.pendingProps.children,l),Zc(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&Ve&&((p=u=ft)&&(u=rk(u,r.type,r.pendingProps,ii),u!==null?(r.stateNode=u,ts=r,ft=ni(u.firstChild),ii=!1,p=!0):p=!1),p||jr(r)),Rs(r),p=r.type,_=r.pendingProps,y=s!==null?s.memoizedProps:null,u=_.children,Bf(p,_)?u=null:y!==null&&Bf(p,y)&&(r.flags|=32),r.memoizedState!==null&&(p=Md(s,r,yj,null,null,l),go._currentValue=p),Zc(s,r),is(s,r,u,l),r.child;case 6:return s===null&&Ve&&((s=l=ft)&&(l=nk(l,r.pendingProps,ii),l!==null?(r.stateNode=l,ts=r,ft=null,s=!0):s=!1),s||jr(r)),null;case 13:return ry(s,r,l);case 4:return kt(r,r.stateNode.containerInfo),u=r.pendingProps,s===null?r.child=Rn(r,null,u,l):is(s,r,u,l),r.child;case 11:return Gv(s,r,r.type,r.pendingProps,l);case 7:return is(s,r,r.pendingProps,l),r.child;case 8:return is(s,r,r.pendingProps.children,l),r.child;case 12:return is(s,r,r.pendingProps.children,l),r.child;case 10:return u=r.pendingProps,kr(r,r.type,u.value),is(s,r,u.children,l),r.child;case 9:return p=r.type._context,u=r.pendingProps.children,Nn(r),p=ss(p),u=u(p),r.flags|=1,is(s,r,u,l),r.child;case 14:return Qv(s,r,r.type,r.pendingProps,l);case 15:return Zv(s,r,r.type,r.pendingProps,l);case 19:return ay(s,r,l);case 31:return Ej(s,r,l);case 22:return Xv(s,r,l,r.pendingProps);case 24:return Nn(r),u=ss(At),s===null?(p=wd(),p===null&&(p=ht,_=Sd(),p.pooledCache=_,_.refCount++,_!==null&&(p.pooledCacheLanes|=l),p=_),r.memoizedState={parent:u,cache:p},jd(r),kr(r,At,p)):((s.lanes&l)!==0&&(kd(s,r),Ql(r,null,null,l),Gl()),p=s.memoizedState,_=r.memoizedState,p.parent!==u?(p={parent:u,cache:u},r.memoizedState=p,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=p),kr(r,At,u)):(u=_.cache,kr(r,At,u),u!==p.cache&&bd(r,[At],l,!0))),is(s,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(n(156,r.tag))}function Xi(s){s.flags|=4}function of(s,r,l,u,p){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(p&335544128)===p)if(s.stateNode.complete)s.flags|=8192;else if(Dy())s.flags|=8192;else throw An=Lc,Cd}else s.flags&=-16777217}function oy(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!wb(r))if(Dy())s.flags|=8192;else throw An=Lc,Cd}function Jc(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?I_():536870912,s.lanes|=r,Fa|=r)}function so(s,r){if(!Ve)switch(s.tailMode){case"hidden":r=s.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:u.sibling=null}}function mt(s){var r=s.alternate!==null&&s.alternate.child===s.child,l=0,u=0;if(r)for(var p=s.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=s,p=p.sibling;else for(p=s.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=s,p=p.sibling;return s.subtreeFlags|=u,s.childLanes=l,r}function Tj(s,r,l){var u=r.pendingProps;switch(pd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(r),null;case 1:return mt(r),null;case 3:return l=r.stateNode,u=null,s!==null&&(u=s.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Yi(At),Xe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(Oa(r)?Xi(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,gd())),mt(r),null;case 26:var p=r.type,_=r.memoizedState;return s===null?(Xi(r),_!==null?(mt(r),oy(r,_)):(mt(r),of(r,p,null,u,l))):_?_!==s.memoizedState?(Xi(r),mt(r),oy(r,_)):(mt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==u&&Xi(r),mt(r),of(r,p,s,u,l)),null;case 27:if(xi(r),l=_e.current,p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==u&&Xi(r);else{if(!u){if(r.stateNode===null)throw Error(n(166));return mt(r),null}s=$.current,Oa(r)?Ig(r):(s=pb(p,u,l),r.stateNode=s,Xi(r))}return mt(r),null;case 5:if(xi(r),p=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==u&&Xi(r);else{if(!u){if(r.stateNode===null)throw Error(n(166));return mt(r),null}if(_=$.current,Oa(r))Ig(r);else{var y=mu(_e.current);switch(_){case 1:_=y.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:_=y.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":_=y.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":_=y.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":_=y.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof u.is=="string"?y.createElement("select",{is:u.is}):y.createElement("select"),u.multiple?_.multiple=!0:u.size&&(_.size=u.size);break;default:_=typeof u.is=="string"?y.createElement(p,{is:u.is}):y.createElement(p)}}_[es]=r,_[Ss]=u;e:for(y=r.child;y!==null;){if(y.tag===5||y.tag===6)_.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===r)break e;for(;y.sibling===null;){if(y.return===null||y.return===r)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}r.stateNode=_;e:switch(rs(_,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Xi(r)}}return mt(r),of(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,l),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==u&&Xi(r);else{if(typeof u!="string"&&r.stateNode===null)throw Error(n(166));if(s=_e.current,Oa(r)){if(s=r.stateNode,l=r.memoizedProps,u=null,p=ts,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}s[es]=r,s=!!(s.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||rb(s.nodeValue,l)),s||jr(r,!0)}else s=mu(s).createTextNode(u),s[es]=r,r.stateNode=s}return mt(r),null;case 31:if(l=r.memoizedState,s===null||s.memoizedState!==null){if(u=Oa(r),l!==null){if(s===null){if(!u)throw Error(n(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[es]=r}else kn(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),s=!1}else l=gd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return r.flags&256?(Ps(r),r):(Ps(r),null);if((r.flags&128)!==0)throw Error(n(558))}return mt(r),null;case 13:if(u=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(p=Oa(r),u!==null&&u.dehydrated!==null){if(s===null){if(!p)throw Error(n(318));if(p=r.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(n(317));p[es]=r}else kn(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),p=!1}else p=gd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),p=!0;if(!p)return r.flags&256?(Ps(r),r):(Ps(r),null)}return Ps(r),(r.flags&128)!==0?(r.lanes=l,r):(l=u!==null,s=s!==null&&s.memoizedState!==null,l&&(u=r.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==p&&(u.flags|=2048)),l!==s&&l&&(r.child.flags|=8192),Jc(r,r.updateQueue),mt(r),null);case 4:return Xe(),s===null&&Of(r.stateNode.containerInfo),mt(r),null;case 10:return Yi(r.type),mt(r),null;case 19:if(K(Et),u=r.memoizedState,u===null)return mt(r),null;if(p=(r.flags&128)!==0,_=u.rendering,_===null)if(p)so(u,!1);else{if(St!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(_=Hc(s),_!==null){for(r.flags|=128,so(u,!1),s=_.updateQueue,r.updateQueue=s,Jc(r,s),r.subtreeFlags=0,s=l,l=r.child;l!==null;)Lg(l,s),l=l.sibling;return ne(Et,Et.current&1|2),Ve&&Wi(r,u.treeForkCount),r.child}s=s.sibling}u.tail!==null&&Ms()>ru&&(r.flags|=128,p=!0,so(u,!1),r.lanes=4194304)}else{if(!p)if(s=Hc(_),s!==null){if(r.flags|=128,p=!0,s=s.updateQueue,r.updateQueue=s,Jc(r,s),so(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Ve)return mt(r),null}else 2*Ms()-u.renderingStartTime>ru&&l!==536870912&&(r.flags|=128,p=!0,so(u,!1),r.lanes=4194304);u.isBackwards?(_.sibling=r.child,r.child=_):(s=u.last,s!==null?s.sibling=_:r.child=_,u.last=_)}return u.tail!==null?(s=u.tail,u.rendering=s,u.tail=s.sibling,u.renderingStartTime=Ms(),s.sibling=null,l=Et.current,ne(Et,p?l&1|2:l&1),Ve&&Wi(r,u.treeForkCount),s):(mt(r),null);case 22:case 23:return Ps(r),Od(),u=r.memoizedState!==null,s!==null?s.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(l&536870912)!==0&&(r.flags&128)===0&&(mt(r),r.subtreeFlags&6&&(r.flags|=8192)):mt(r),l=r.updateQueue,l!==null&&Jc(r,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==l&&(r.flags|=2048),s!==null&&K(Tn),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Yi(At),mt(r),null;case 25:return null;case 30:return null}throw Error(n(156,r.tag))}function Oj(s,r){switch(pd(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Yi(At),Xe(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return xi(r),null;case 31:if(r.memoizedState!==null){if(Ps(r),r.alternate===null)throw Error(n(340));kn()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(Ps(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(n(340));kn()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return K(Et),null;case 4:return Xe(),null;case 10:return Yi(r.type),null;case 22:case 23:return Ps(r),Od(),s!==null&&K(Tn),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Yi(At),null;case 25:return null;default:return null}}function cy(s,r){switch(pd(r),r.tag){case 3:Yi(At),Xe();break;case 26:case 27:case 5:xi(r);break;case 4:Xe();break;case 31:r.memoizedState!==null&&Ps(r);break;case 13:Ps(r);break;case 19:K(Et);break;case 10:Yi(r.type);break;case 22:case 23:Ps(r),Od(),s!==null&&K(Tn);break;case 24:Yi(At)}}function io(s,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&s)===s){u=void 0;var _=l.create,y=l.inst;u=_(),y.destroy=u}l=l.next}while(l!==p)}}catch(w){at(r,r.return,w)}}function Rr(s,r,l){try{var u=r.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var _=p.next;u=_;do{if((u.tag&s)===s){var y=u.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,p=r;var O=l,P=w;try{P()}catch(Q){at(p,O,Q)}}}u=u.next}while(u!==_)}}catch(Q){at(r,r.return,Q)}}function uy(s){var r=s.updateQueue;if(r!==null){var l=s.stateNode;try{ev(r,l)}catch(u){at(s,s.return,u)}}}function hy(s,r,l){l.props=Dn(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(u){at(s,r,u)}}function ro(s,r){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var u=s.stateNode;break;case 30:u=s.stateNode;break;default:u=s.stateNode}typeof l=="function"?s.refCleanup=l(u):l.current=u}}catch(p){at(s,r,p)}}function ji(s,r){var l=s.ref,u=s.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(p){at(s,r,p)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(p){at(s,r,p)}else l.current=null}function dy(s){var r=s.type,l=s.memoizedProps,u=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(p){at(s,s.return,p)}}function cf(s,r,l){try{var u=s.stateNode;Xj(u,s.type,l,r),u[Ss]=r}catch(p){at(s,s.return,p)}}function fy(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Pr(s.type)||s.tag===4}function uf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||fy(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Pr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function hf(s,r,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(s),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=Fi));else if(u!==4&&(u===27&&Pr(s.type)&&(l=s.stateNode,r=null),s=s.child,s!==null))for(hf(s,r,l),s=s.sibling;s!==null;)hf(s,r,l),s=s.sibling}function eu(s,r,l){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?l.insertBefore(s,r):l.appendChild(s);else if(u!==4&&(u===27&&Pr(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(eu(s,r,l),s=s.sibling;s!==null;)eu(s,r,l),s=s.sibling}function my(s){var r=s.stateNode,l=s.memoizedProps;try{for(var u=s.type,p=r.attributes;p.length;)r.removeAttributeNode(p[0]);rs(r,u,l),r[es]=s,r[Ss]=l}catch(_){at(s,s.return,_)}}var Ji=!1,Dt=!1,df=!1,py=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function Aj(s,r){if(s=s.containerInfo,Mf=Su,s=Eg(s),rd(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var p=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var y=0,w=-1,O=-1,P=0,Q=0,J=s,U=null;t:for(;;){for(var V;J!==l||p!==0&&J.nodeType!==3||(w=y+p),J!==_||u!==0&&J.nodeType!==3||(O=y+u),J.nodeType===3&&(y+=J.nodeValue.length),(V=J.firstChild)!==null;)U=J,J=V;for(;;){if(J===s)break t;if(U===l&&++P===p&&(w=y),U===_&&++Q===u&&(O=y),(V=J.nextSibling)!==null)break;J=U,U=J.parentNode}J=V}l=w===-1||O===-1?null:{start:w,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(Df={focusedElem:s,selectionRange:l},Su=!1,Wt=r;Wt!==null;)if(r=Wt,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,Wt=s;else for(;Wt!==null;){switch(r=Wt,_=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)p=s[l],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&_!==null){s=void 0,l=r,p=_.memoizedProps,_=_.memoizedState,u=l.stateNode;try{var ge=Dn(l.type,p);s=u.getSnapshotBeforeUpdate(ge,_),u.__reactInternalSnapshotBeforeUpdate=s}catch(je){at(l,l.return,je)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,l=s.nodeType,l===9)zf(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":zf(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=r.sibling,s!==null){s.return=r.return,Wt=s;break}Wt=r.return}}function _y(s,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:tr(s,l),u&4&&io(5,l);break;case 1:if(tr(s,l),u&4)if(s=l.stateNode,r===null)try{s.componentDidMount()}catch(y){at(l,l.return,y)}else{var p=Dn(l.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(p,r,s.__reactInternalSnapshotBeforeUpdate)}catch(y){at(l,l.return,y)}}u&64&&uy(l),u&512&&ro(l,l.return);break;case 3:if(tr(s,l),u&64&&(s=l.updateQueue,s!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{ev(s,r)}catch(y){at(l,l.return,y)}}break;case 27:r===null&&u&4&&my(l);case 26:case 5:tr(s,l),r===null&&u&4&&dy(l),u&512&&ro(l,l.return);break;case 12:tr(s,l);break;case 31:tr(s,l),u&4&&yy(s,l);break;case 13:tr(s,l),u&4&&by(s,l),u&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=Hj.bind(null,l),ak(s,l))));break;case 22:if(u=l.memoizedState!==null||Ji,!u){r=r!==null&&r.memoizedState!==null||Dt,p=Ji;var _=Dt;Ji=u,(Dt=r)&&!_?sr(s,l,(l.subtreeFlags&8772)!==0):tr(s,l),Ji=p,Dt=_}break;case 30:break;default:tr(s,l)}}function gy(s){var r=s.alternate;r!==null&&(s.alternate=null,gy(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&Ih(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var _t=null,ws=!1;function er(s,r,l){for(l=l.child;l!==null;)vy(s,r,l),l=l.sibling}function vy(s,r,l){if(Ds&&typeof Ds.onCommitFiberUnmount=="function")try{Ds.onCommitFiberUnmount(Nl,l)}catch{}switch(l.tag){case 26:Dt||ji(l,r),er(s,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Dt||ji(l,r);var u=_t,p=ws;Pr(l.type)&&(_t=l.stateNode,ws=!1),er(s,r,l),mo(l.stateNode),_t=u,ws=p;break;case 5:Dt||ji(l,r);case 6:if(u=_t,p=ws,_t=null,er(s,r,l),_t=u,ws=p,_t!==null)if(ws)try{(_t.nodeType===9?_t.body:_t.nodeName==="HTML"?_t.ownerDocument.body:_t).removeChild(l.stateNode)}catch(_){at(l,r,_)}else try{_t.removeChild(l.stateNode)}catch(_){at(l,r,_)}break;case 18:_t!==null&&(ws?(s=_t,ub(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Za(s)):ub(_t,l.stateNode));break;case 4:u=_t,p=ws,_t=l.stateNode.containerInfo,ws=!0,er(s,r,l),_t=u,ws=p;break;case 0:case 11:case 14:case 15:Rr(2,l,r),Dt||Rr(4,l,r),er(s,r,l);break;case 1:Dt||(ji(l,r),u=l.stateNode,typeof u.componentWillUnmount=="function"&&hy(l,r,u)),er(s,r,l);break;case 21:er(s,r,l);break;case 22:Dt=(u=Dt)||l.memoizedState!==null,er(s,r,l),Dt=u;break;default:er(s,r,l)}}function yy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Za(s)}catch(l){at(r,r.return,l)}}}function by(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Za(s)}catch(l){at(r,r.return,l)}}function Rj(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new py),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new py),r;default:throw Error(n(435,s.tag))}}function tu(s,r){var l=Rj(s);r.forEach(function(u){if(!l.has(u)){l.add(u);var p=Ij.bind(null,s,u);u.then(p,p)}})}function Cs(s,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var p=l[u],_=s,y=r,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(Pr(w.type)){_t=w.stateNode,ws=!1;break e}break;case 5:_t=w.stateNode,ws=!1;break e;case 3:case 4:_t=w.stateNode.containerInfo,ws=!0;break e}w=w.return}if(_t===null)throw Error(n(160));vy(_,y,p),_t=null,ws=!1,_=p.alternate,_!==null&&(_.return=null),p.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)Sy(r,s),r=r.sibling}var _i=null;function Sy(s,r){var l=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Cs(r,s),js(s),u&4&&(Rr(3,s,s.return),io(3,s),Rr(5,s,s.return));break;case 1:Cs(r,s),js(s),u&512&&(Dt||l===null||ji(l,l.return)),u&64&&Ji&&(s=s.updateQueue,s!==null&&(u=s.callbacks,u!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var p=_i;if(Cs(r,s),js(s),u&512&&(Dt||l===null||ji(l,l.return)),u&4){var _=l!==null?l.memoizedState:null;if(u=s.memoizedState,l===null)if(u===null)if(s.stateNode===null){e:{u=s.type,l=s.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":_=p.getElementsByTagName("title")[0],(!_||_[Al]||_[es]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=p.createElement(u),p.head.insertBefore(_,p.querySelector("head > title"))),rs(_,u,l),_[es]=s,$t(_),u=_;break e;case"link":var y=Sb("link","href",p).get(u+(l.href||""));if(y){for(var w=0;w<y.length;w++)if(_=y[w],_.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&_.getAttribute("rel")===(l.rel==null?null:l.rel)&&_.getAttribute("title")===(l.title==null?null:l.title)&&_.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){y.splice(w,1);break t}}_=p.createElement(u),rs(_,u,l),p.head.appendChild(_);break;case"meta":if(y=Sb("meta","content",p).get(u+(l.content||""))){for(w=0;w<y.length;w++)if(_=y[w],_.getAttribute("content")===(l.content==null?null:""+l.content)&&_.getAttribute("name")===(l.name==null?null:l.name)&&_.getAttribute("property")===(l.property==null?null:l.property)&&_.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&_.getAttribute("charset")===(l.charSet==null?null:l.charSet)){y.splice(w,1);break t}}_=p.createElement(u),rs(_,u,l),p.head.appendChild(_);break;default:throw Error(n(468,u))}_[es]=s,$t(_),u=_}s.stateNode=u}else xb(p,s.type,s.stateNode);else s.stateNode=bb(p,u,s.memoizedProps);else _!==u?(_===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):_.count--,u===null?xb(p,s.type,s.stateNode):bb(p,u,s.memoizedProps)):u===null&&s.stateNode!==null&&cf(s,s.memoizedProps,l.memoizedProps)}break;case 27:Cs(r,s),js(s),u&512&&(Dt||l===null||ji(l,l.return)),l!==null&&u&4&&cf(s,s.memoizedProps,l.memoizedProps);break;case 5:if(Cs(r,s),js(s),u&512&&(Dt||l===null||ji(l,l.return)),s.flags&32){p=s.stateNode;try{ba(p,"")}catch(ge){at(s,s.return,ge)}}u&4&&s.stateNode!=null&&(p=s.memoizedProps,cf(s,p,l!==null?l.memoizedProps:p)),u&1024&&(df=!0);break;case 6:if(Cs(r,s),js(s),u&4){if(s.stateNode===null)throw Error(n(162));u=s.memoizedProps,l=s.stateNode;try{l.nodeValue=u}catch(ge){at(s,s.return,ge)}}break;case 3:if(gu=null,p=_i,_i=pu(r.containerInfo),Cs(r,s),_i=p,js(s),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Za(r.containerInfo)}catch(ge){at(s,s.return,ge)}df&&(df=!1,xy(s));break;case 4:u=_i,_i=pu(s.stateNode.containerInfo),Cs(r,s),js(s),_i=u;break;case 12:Cs(r,s),js(s);break;case 31:Cs(r,s),js(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 13:Cs(r,s),js(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(iu=Ms()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 22:p=s.memoizedState!==null;var O=l!==null&&l.memoizedState!==null,P=Ji,Q=Dt;if(Ji=P||p,Dt=Q||O,Cs(r,s),Dt=Q,Ji=P,js(s),u&8192)e:for(r=s.stateNode,r._visibility=p?r._visibility&-2:r._visibility|1,p&&(l===null||O||Ji||Dt||Bn(s)),l=null,r=s;;){if(r.tag===5||r.tag===26){if(l===null){O=l=r;try{if(_=O.stateNode,p)y=_.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=O.stateNode;var J=O.memoizedProps.style,U=J!=null&&J.hasOwnProperty("display")?J.display:null;w.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ge){at(O,O.return,ge)}}}else if(r.tag===6){if(l===null){O=r;try{O.stateNode.nodeValue=p?"":O.memoizedProps}catch(ge){at(O,O.return,ge)}}}else if(r.tag===18){if(l===null){O=r;try{var V=O.stateNode;p?hb(V,!0):hb(O.stateNode,!1)}catch(ge){at(O,O.return,ge)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=s.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,tu(s,l))));break;case 19:Cs(r,s),js(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 30:break;case 21:break;default:Cs(r,s),js(s)}}function js(s){var r=s.flags;if(r&2){try{for(var l,u=s.return;u!==null;){if(fy(u)){l=u;break}u=u.return}if(l==null)throw Error(n(160));switch(l.tag){case 27:var p=l.stateNode,_=uf(s);eu(s,_,p);break;case 5:var y=l.stateNode;l.flags&32&&(ba(y,""),l.flags&=-33);var w=uf(s);eu(s,w,y);break;case 3:case 4:var O=l.stateNode.containerInfo,P=uf(s);hf(s,P,O);break;default:throw Error(n(161))}}catch(Q){at(s,s.return,Q)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function xy(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;xy(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function tr(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)_y(s,r.alternate,r),r=r.sibling}function Bn(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:Rr(4,r,r.return),Bn(r);break;case 1:ji(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&hy(r,r.return,l),Bn(r);break;case 27:mo(r.stateNode);case 26:case 5:ji(r,r.return),Bn(r);break;case 22:r.memoizedState===null&&Bn(r);break;case 30:Bn(r);break;default:Bn(r)}s=s.sibling}}function sr(s,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,p=s,_=r,y=_.flags;switch(_.tag){case 0:case 11:case 15:sr(p,_,l),io(4,_);break;case 1:if(sr(p,_,l),u=_,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(P){at(u,u.return,P)}if(u=_,p=u.updateQueue,p!==null){var w=u.stateNode;try{var O=p.shared.hiddenCallbacks;if(O!==null)for(p.shared.hiddenCallbacks=null,p=0;p<O.length;p++)Jg(O[p],w)}catch(P){at(u,u.return,P)}}l&&y&64&&uy(_),ro(_,_.return);break;case 27:my(_);case 26:case 5:sr(p,_,l),l&&u===null&&y&4&&dy(_),ro(_,_.return);break;case 12:sr(p,_,l);break;case 31:sr(p,_,l),l&&y&4&&yy(p,_);break;case 13:sr(p,_,l),l&&y&4&&by(p,_);break;case 22:_.memoizedState===null&&sr(p,_,l),ro(_,_.return);break;case 30:break;default:sr(p,_,l)}r=r.sibling}}function ff(s,r){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Kl(l))}function mf(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Kl(s))}function gi(s,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)wy(s,r,l,u),r=r.sibling}function wy(s,r,l,u){var p=r.flags;switch(r.tag){case 0:case 11:case 15:gi(s,r,l,u),p&2048&&io(9,r);break;case 1:gi(s,r,l,u);break;case 3:gi(s,r,l,u),p&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Kl(s)));break;case 12:if(p&2048){gi(s,r,l,u),s=r.stateNode;try{var _=r.memoizedProps,y=_.id,w=_.onPostCommit;typeof w=="function"&&w(y,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(O){at(r,r.return,O)}}else gi(s,r,l,u);break;case 31:gi(s,r,l,u);break;case 13:gi(s,r,l,u);break;case 23:break;case 22:_=r.stateNode,y=r.alternate,r.memoizedState!==null?_._visibility&2?gi(s,r,l,u):no(s,r):_._visibility&2?gi(s,r,l,u):(_._visibility|=2,Ha(s,r,l,u,(r.subtreeFlags&10256)!==0||!1)),p&2048&&ff(y,r);break;case 24:gi(s,r,l,u),p&2048&&mf(r.alternate,r);break;default:gi(s,r,l,u)}}function Ha(s,r,l,u,p){for(p=p&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var _=s,y=r,w=l,O=u,P=y.flags;switch(y.tag){case 0:case 11:case 15:Ha(_,y,w,O,p),io(8,y);break;case 23:break;case 22:var Q=y.stateNode;y.memoizedState!==null?Q._visibility&2?Ha(_,y,w,O,p):no(_,y):(Q._visibility|=2,Ha(_,y,w,O,p)),p&&P&2048&&ff(y.alternate,y);break;case 24:Ha(_,y,w,O,p),p&&P&2048&&mf(y.alternate,y);break;default:Ha(_,y,w,O,p)}r=r.sibling}}function no(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=s,u=r,p=u.flags;switch(u.tag){case 22:no(l,u),p&2048&&ff(u.alternate,u);break;case 24:no(l,u),p&2048&&mf(u.alternate,u);break;default:no(l,u)}r=r.sibling}}var ao=8192;function Ia(s,r,l){if(s.subtreeFlags&ao)for(s=s.child;s!==null;)Cy(s,r,l),s=s.sibling}function Cy(s,r,l){switch(s.tag){case 26:Ia(s,r,l),s.flags&ao&&s.memoizedState!==null&&vk(l,_i,s.memoizedState,s.memoizedProps);break;case 5:Ia(s,r,l);break;case 3:case 4:var u=_i;_i=pu(s.stateNode.containerInfo),Ia(s,r,l),_i=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=ao,ao=16777216,Ia(s,r,l),ao=u):Ia(s,r,l));break;default:Ia(s,r,l)}}function jy(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function lo(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Wt=u,Ey(u,s)}jy(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ky(s),s=s.sibling}function ky(s){switch(s.tag){case 0:case 11:case 15:lo(s),s.flags&2048&&Rr(9,s,s.return);break;case 3:lo(s);break;case 12:lo(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,su(s)):lo(s);break;default:lo(s)}}function su(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var u=r[l];Wt=u,Ey(u,s)}jy(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Rr(8,r,r.return),su(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,su(r));break;default:su(r)}s=s.sibling}}function Ey(s,r){for(;Wt!==null;){var l=Wt;switch(l.tag){case 0:case 11:case 15:Rr(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Kl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Wt=u;else e:for(l=s;Wt!==null;){u=Wt;var p=u.sibling,_=u.return;if(gy(u),u===l){Wt=null;break e}if(p!==null){p.return=_,Wt=p;break e}Wt=_}}}var Mj={getCacheForType:function(s){var r=ss(At),l=r.data.get(s);return l===void 0&&(l=s(),r.data.set(s,l)),l},cacheSignal:function(){return ss(At).controller.signal}},Dj=typeof WeakMap=="function"?WeakMap:Map,it=0,ht=null,Ue=null,Ke=0,nt=0,Hs=null,Mr=!1,Ua=!1,pf=!1,ir=0,St=0,Dr=0,Ln=0,_f=0,Is=0,Fa=0,oo=null,ks=null,gf=!1,iu=0,Ny=0,ru=1/0,nu=null,Br=null,Pt=0,Lr=null,Ka=null,rr=0,vf=0,yf=null,Ty=null,co=0,bf=null;function Us(){return(it&2)!==0&&Ke!==0?Ke&-Ke:A.T!==null?kf():$_()}function Oy(){if(Is===0)if((Ke&536870912)===0||Ve){var s=fc;fc<<=1,(fc&3932160)===0&&(fc=262144),Is=s}else Is=536870912;return s=qs.current,s!==null&&(s.flags|=32),Is}function Es(s,r,l){(s===ht&&(nt===2||nt===9)||s.cancelPendingCommit!==null)&&($a(s,0),zr(s,Ke,Is,!1)),Ol(s,l),((it&2)===0||s!==ht)&&(s===ht&&((it&2)===0&&(Ln|=l),St===4&&zr(s,Ke,Is,!1)),ki(s))}function Ay(s,r,l){if((it&6)!==0)throw Error(n(327));var u=!l&&(r&127)===0&&(r&s.expiredLanes)===0||Tl(s,r),p=u?zj(s,r):xf(s,r,!0),_=u;do{if(p===0){Ua&&!u&&zr(s,r,0,!1);break}else{if(l=s.current.alternate,_&&!Bj(l)){p=xf(s,r,!1),_=!1;continue}if(p===2){if(_=r,s.errorRecoveryDisabledLanes&_)var y=0;else y=s.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){r=y;e:{var w=s;p=oo;var O=w.current.memoizedState.isDehydrated;if(O&&($a(w,y).flags|=256),y=xf(w,y,!1),y!==2){if(pf&&!O){w.errorRecoveryDisabledLanes|=_,Ln|=_,p=4;break e}_=ks,ks=p,_!==null&&(ks===null?ks=_:ks.push.apply(ks,_))}p=y}if(_=!1,p!==2)continue}}if(p===1){$a(s,0),zr(s,r,0,!0);break}e:{switch(u=s,_=p,_){case 0:case 1:throw Error(n(345));case 4:if((r&4194048)!==r)break;case 6:zr(u,r,Is,!Mr);break e;case 2:ks=null;break;case 3:case 5:break;default:throw Error(n(329))}if((r&62914560)===r&&(p=iu+300-Ms(),10<p)){if(zr(u,r,Is,!Mr),pc(u,0,!0)!==0)break e;rr=r,u.timeoutHandle=ob(Ry.bind(null,u,l,ks,nu,gf,r,Is,Ln,Fa,Mr,_,"Throttled",-0,0),p);break e}Ry(u,l,ks,nu,gf,r,Is,Ln,Fa,Mr,_,null,-0,0)}}break}while(!0);ki(s)}function Ry(s,r,l,u,p,_,y,w,O,P,Q,J,U,V){if(s.timeoutHandle=-1,J=r.subtreeFlags,J&8192||(J&16785408)===16785408){J={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fi},Cy(r,_,J);var ge=(_&62914560)===_?iu-Ms():(_&4194048)===_?Ny-Ms():0;if(ge=yk(J,ge),ge!==null){rr=_,s.cancelPendingCommit=ge(Hy.bind(null,s,r,_,l,u,p,y,w,O,Q,J,null,U,V)),zr(s,_,y,!P);return}}Hy(s,r,_,l,u,p,y,w,O)}function Bj(s){for(var r=s;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var p=l[u],_=p.getSnapshot;p=p.value;try{if(!Ls(_(),p))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function zr(s,r,l,u){r&=~_f,r&=~Ln,s.suspendedLanes|=r,s.pingedLanes&=~r,u&&(s.warmLanes|=r),u=s.expirationTimes;for(var p=r;0<p;){var _=31-Bs(p),y=1<<_;u[_]=-1,p&=~y}l!==0&&U_(s,l,r)}function au(){return(it&6)===0?(uo(0),!1):!0}function Sf(){if(Ue!==null){if(nt===0)var s=Ue.return;else s=Ue,Vi=En=null,Ld(s),Ba=null,Wl=0,s=Ue;for(;s!==null;)cy(s.alternate,s),s=s.return;Ue=null}}function $a(s,r){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,tk(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),rr=0,Sf(),ht=s,Ue=l=$i(s.current,null),Ke=r,nt=0,Hs=null,Mr=!1,Ua=Tl(s,r),pf=!1,Fa=Is=_f=Ln=Dr=St=0,ks=oo=null,gf=!1,(r&8)!==0&&(r|=r&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=r;0<u;){var p=31-Bs(u),_=1<<p;r|=s[p],u&=~_}return ir=r,Ec(),l}function My(s,r){Be=null,A.H=eo,r===Da||r===Bc?(r=Gg(),nt=3):r===Cd?(r=Gg(),nt=4):nt=r===Xd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Hs=r,Ue===null&&(St=1,Gc(s,ei(r,s.current)))}function Dy(){var s=qs.current;return s===null?!0:(Ke&4194048)===Ke?ri===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?s===ri:!1}function By(){var s=A.H;return A.H=eo,s===null?eo:s}function Ly(){var s=A.A;return A.A=Mj,s}function lu(){St=4,Mr||(Ke&4194048)!==Ke&&qs.current!==null||(Ua=!0),(Dr&134217727)===0&&(Ln&134217727)===0||ht===null||zr(ht,Ke,Is,!1)}function xf(s,r,l){var u=it;it|=2;var p=By(),_=Ly();(ht!==s||Ke!==r)&&(nu=null,$a(s,r)),r=!1;var y=St;e:do try{if(nt!==0&&Ue!==null){var w=Ue,O=Hs;switch(nt){case 8:Sf(),y=6;break e;case 3:case 2:case 9:case 6:qs.current===null&&(r=!0);var P=nt;if(nt=0,Hs=null,Wa(s,w,O,P),l&&Ua){y=0;break e}break;default:P=nt,nt=0,Hs=null,Wa(s,w,O,P)}}Lj(),y=St;break}catch(Q){My(s,Q)}while(!0);return r&&s.shellSuspendCounter++,Vi=En=null,it=u,A.H=p,A.A=_,Ue===null&&(ht=null,Ke=0,Ec()),y}function Lj(){for(;Ue!==null;)zy(Ue)}function zj(s,r){var l=it;it|=2;var u=By(),p=Ly();ht!==s||Ke!==r?(nu=null,ru=Ms()+500,$a(s,r)):Ua=Tl(s,r);e:do try{if(nt!==0&&Ue!==null){r=Ue;var _=Hs;t:switch(nt){case 1:nt=0,Hs=null,Wa(s,r,_,1);break;case 2:case 9:if(Vg(_)){nt=0,Hs=null,qy(r);break}r=function(){nt!==2&&nt!==9||ht!==s||(nt=7),ki(s)},_.then(r,r);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:Vg(_)?(nt=0,Hs=null,qy(r)):(nt=0,Hs=null,Wa(s,r,_,7));break;case 5:var y=null;switch(Ue.tag){case 26:y=Ue.memoizedState;case 5:case 27:var w=Ue;if(y?wb(y):w.stateNode.complete){nt=0,Hs=null;var O=w.sibling;if(O!==null)Ue=O;else{var P=w.return;P!==null?(Ue=P,ou(P)):Ue=null}break t}}nt=0,Hs=null,Wa(s,r,_,5);break;case 6:nt=0,Hs=null,Wa(s,r,_,6);break;case 8:Sf(),St=6;break e;default:throw Error(n(462))}}qj();break}catch(Q){My(s,Q)}while(!0);return Vi=En=null,A.H=u,A.A=p,it=l,Ue!==null?0:(ht=null,Ke=0,Ec(),St)}function qj(){for(;Ue!==null&&!lC();)zy(Ue)}function zy(s){var r=ly(s.alternate,s,ir);s.memoizedProps=s.pendingProps,r===null?ou(s):Ue=r}function qy(s){var r=s,l=r.alternate;switch(r.tag){case 15:case 0:r=ty(l,r,r.pendingProps,r.type,void 0,Ke);break;case 11:r=ty(l,r,r.pendingProps,r.type.render,r.ref,Ke);break;case 5:Ld(r);default:cy(l,r),r=Ue=Lg(r,ir),r=ly(l,r,ir)}s.memoizedProps=s.pendingProps,r===null?ou(s):Ue=r}function Wa(s,r,l,u){Vi=En=null,Ld(r),Ba=null,Wl=0;var p=r.return;try{if(kj(s,p,r,l,Ke)){St=1,Gc(s,ei(l,s.current)),Ue=null;return}}catch(_){if(p!==null)throw Ue=p,_;St=1,Gc(s,ei(l,s.current)),Ue=null;return}r.flags&32768?(Ve||u===1?s=!0:Ua||(Ke&536870912)!==0?s=!1:(Mr=s=!0,(u===2||u===9||u===3||u===6)&&(u=qs.current,u!==null&&u.tag===13&&(u.flags|=16384))),Py(r,s)):ou(r)}function ou(s){var r=s;do{if((r.flags&32768)!==0){Py(r,Mr);return}s=r.return;var l=Tj(r.alternate,r,ir);if(l!==null){Ue=l;return}if(r=r.sibling,r!==null){Ue=r;return}Ue=r=s}while(r!==null);St===0&&(St=5)}function Py(s,r){do{var l=Oj(s.alternate,s);if(l!==null){l.flags&=32767,Ue=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(s=s.sibling,s!==null)){Ue=s;return}Ue=s=l}while(s!==null);St=6,Ue=null}function Hy(s,r,l,u,p,_,y,w,O){s.cancelPendingCommit=null;do cu();while(Pt!==0);if((it&6)!==0)throw Error(n(327));if(r!==null){if(r===s.current)throw Error(n(177));if(_=r.lanes|r.childLanes,_|=cd,gC(s,l,_,y,w,O),s===ht&&(Ue=ht=null,Ke=0),Ka=r,Lr=s,rr=l,vf=_,yf=p,Ty=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,Uj(hc,function(){return $y(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=A.T,A.T=null,p=F.p,F.p=2,y=it,it|=4;try{Aj(s,r,l)}finally{it=y,F.p=p,A.T=u}}Pt=1,Iy(),Uy(),Fy()}}function Iy(){if(Pt===1){Pt=0;var s=Lr,r=Ka,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=A.T,A.T=null;var u=F.p;F.p=2;var p=it;it|=4;try{Sy(r,s);var _=Df,y=Eg(s.containerInfo),w=_.focusedElem,O=_.selectionRange;if(y!==w&&w&&w.ownerDocument&&kg(w.ownerDocument.documentElement,w)){if(O!==null&&rd(w)){var P=O.start,Q=O.end;if(Q===void 0&&(Q=P),"selectionStart"in w)w.selectionStart=P,w.selectionEnd=Math.min(Q,w.value.length);else{var J=w.ownerDocument||document,U=J&&J.defaultView||window;if(U.getSelection){var V=U.getSelection(),ge=w.textContent.length,je=Math.min(O.start,ge),ct=O.end===void 0?je:Math.min(O.end,ge);!V.extend&&je>ct&&(y=ct,ct=je,je=y);var B=jg(w,je),R=jg(w,ct);if(B&&R&&(V.rangeCount!==1||V.anchorNode!==B.node||V.anchorOffset!==B.offset||V.focusNode!==R.node||V.focusOffset!==R.offset)){var q=J.createRange();q.setStart(B.node,B.offset),V.removeAllRanges(),je>ct?(V.addRange(q),V.extend(R.node,R.offset)):(q.setEnd(R.node,R.offset),V.addRange(q))}}}}for(J=[],V=w;V=V.parentNode;)V.nodeType===1&&J.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<J.length;w++){var X=J[w];X.element.scrollLeft=X.left,X.element.scrollTop=X.top}}Su=!!Mf,Df=Mf=null}finally{it=p,F.p=u,A.T=l}}s.current=r,Pt=2}}function Uy(){if(Pt===2){Pt=0;var s=Lr,r=Ka,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=A.T,A.T=null;var u=F.p;F.p=2;var p=it;it|=4;try{_y(s,r.alternate,r)}finally{it=p,F.p=u,A.T=l}}Pt=3}}function Fy(){if(Pt===4||Pt===3){Pt=0,oC();var s=Lr,r=Ka,l=rr,u=Ty;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Pt=5:(Pt=0,Ka=Lr=null,Ky(s,s.pendingLanes));var p=s.pendingLanes;if(p===0&&(Br=null),Ph(l),r=r.stateNode,Ds&&typeof Ds.onCommitFiberRoot=="function")try{Ds.onCommitFiberRoot(Nl,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=A.T,p=F.p,F.p=2,A.T=null;try{for(var _=s.onRecoverableError,y=0;y<u.length;y++){var w=u[y];_(w.value,{componentStack:w.stack})}}finally{A.T=r,F.p=p}}(rr&3)!==0&&cu(),ki(s),p=s.pendingLanes,(l&261930)!==0&&(p&42)!==0?s===bf?co++:(co=0,bf=s):co=0,uo(0)}}function Ky(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Kl(r)))}function cu(){return Iy(),Uy(),Fy(),$y()}function $y(){if(Pt!==5)return!1;var s=Lr,r=vf;vf=0;var l=Ph(rr),u=A.T,p=F.p;try{F.p=32>l?32:l,A.T=null,l=yf,yf=null;var _=Lr,y=rr;if(Pt=0,Ka=Lr=null,rr=0,(it&6)!==0)throw Error(n(331));var w=it;if(it|=4,ky(_.current),wy(_,_.current,y,l),it=w,uo(0,!1),Ds&&typeof Ds.onPostCommitFiberRoot=="function")try{Ds.onPostCommitFiberRoot(Nl,_)}catch{}return!0}finally{F.p=p,A.T=u,Ky(s,r)}}function Wy(s,r,l){r=ei(l,r),r=Zd(s.stateNode,r,2),s=Tr(s,r,2),s!==null&&(Ol(s,2),ki(s))}function at(s,r,l){if(s.tag===3)Wy(s,s,l);else for(;r!==null;){if(r.tag===3){Wy(r,s,l);break}else if(r.tag===1){var u=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Br===null||!Br.has(u))){s=ei(l,s),l=Vv(2),u=Tr(r,l,2),u!==null&&(Yv(l,u,r,s),Ol(u,2),ki(u));break}}r=r.return}}function wf(s,r,l){var u=s.pingCache;if(u===null){u=s.pingCache=new Dj;var p=new Set;u.set(r,p)}else p=u.get(r),p===void 0&&(p=new Set,u.set(r,p));p.has(l)||(pf=!0,p.add(l),s=Pj.bind(null,s,r,l),r.then(s,s))}function Pj(s,r,l){var u=s.pingCache;u!==null&&u.delete(r),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,ht===s&&(Ke&l)===l&&(St===4||St===3&&(Ke&62914560)===Ke&&300>Ms()-iu?(it&2)===0&&$a(s,0):_f|=l,Fa===Ke&&(Fa=0)),ki(s)}function Vy(s,r){r===0&&(r=I_()),s=Cn(s,r),s!==null&&(Ol(s,r),ki(s))}function Hj(s){var r=s.memoizedState,l=0;r!==null&&(l=r.retryLane),Vy(s,l)}function Ij(s,r){var l=0;switch(s.tag){case 31:case 13:var u=s.stateNode,p=s.memoizedState;p!==null&&(l=p.retryLane);break;case 19:u=s.stateNode;break;case 22:u=s.stateNode._retryCache;break;default:throw Error(n(314))}u!==null&&u.delete(r),Vy(s,l)}function Uj(s,r){return Bh(s,r)}var uu=null,Va=null,Cf=!1,hu=!1,jf=!1,qr=0;function ki(s){s!==Va&&s.next===null&&(Va===null?uu=Va=s:Va=Va.next=s),hu=!0,Cf||(Cf=!0,Kj())}function uo(s,r){if(!jf&&hu){jf=!0;do for(var l=!1,u=uu;u!==null;){if(s!==0){var p=u.pendingLanes;if(p===0)var _=0;else{var y=u.suspendedLanes,w=u.pingedLanes;_=(1<<31-Bs(42|s)+1)-1,_&=p&~(y&~w),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(l=!0,Zy(u,_))}else _=Ke,_=pc(u,u===ht?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Tl(u,_)||(l=!0,Zy(u,_));u=u.next}while(l);jf=!1}}function Fj(){Yy()}function Yy(){hu=Cf=!1;var s=0;qr!==0&&ek()&&(s=qr);for(var r=Ms(),l=null,u=uu;u!==null;){var p=u.next,_=Gy(u,r);_===0?(u.next=null,l===null?uu=p:l.next=p,p===null&&(Va=l)):(l=u,(s!==0||(_&3)!==0)&&(hu=!0)),u=p}Pt!==0&&Pt!==5||uo(s),qr!==0&&(qr=0)}function Gy(s,r){for(var l=s.suspendedLanes,u=s.pingedLanes,p=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var y=31-Bs(_),w=1<<y,O=p[y];O===-1?((w&l)===0||(w&u)!==0)&&(p[y]=_C(w,r)):O<=r&&(s.expiredLanes|=w),_&=~w}if(r=ht,l=Ke,l=pc(s,s===r?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u=s.callbackNode,l===0||s===r&&(nt===2||nt===9)||s.cancelPendingCommit!==null)return u!==null&&u!==null&&Lh(u),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||Tl(s,l)){if(r=l&-l,r===s.callbackPriority)return r;switch(u!==null&&Lh(u),Ph(l)){case 2:case 8:l=P_;break;case 32:l=hc;break;case 268435456:l=H_;break;default:l=hc}return u=Qy.bind(null,s),l=Bh(l,u),s.callbackPriority=r,s.callbackNode=l,r}return u!==null&&u!==null&&Lh(u),s.callbackPriority=2,s.callbackNode=null,2}function Qy(s,r){if(Pt!==0&&Pt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(cu()&&s.callbackNode!==l)return null;var u=Ke;return u=pc(s,s===ht?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(Ay(s,u,r),Gy(s,Ms()),s.callbackNode!=null&&s.callbackNode===l?Qy.bind(null,s):null)}function Zy(s,r){if(cu())return null;Ay(s,r,!0)}function Kj(){sk(function(){(it&6)!==0?Bh(q_,Fj):Yy()})}function kf(){if(qr===0){var s=Ra;s===0&&(s=dc,dc<<=1,(dc&261888)===0&&(dc=256)),qr=s}return qr}function Xy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:yc(""+s)}function Jy(s,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,s.id&&l.setAttribute("form",s.id),r.parentNode.insertBefore(l,r),s=new FormData(s),l.parentNode.removeChild(l),s}function $j(s,r,l,u,p){if(r==="submit"&&l&&l.stateNode===p){var _=Xy((p[Ss]||null).action),y=u.submitter;y&&(r=(r=y[Ss]||null)?Xy(r.formAction):y.getAttribute("formAction"),r!==null&&(_=r,y=null));var w=new wc("action","action",null,u,p);s.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(qr!==0){var O=y?Jy(p,y):new FormData(p);$d(l,{pending:!0,data:O,method:p.method,action:_},null,O)}}else typeof _=="function"&&(w.preventDefault(),O=y?Jy(p,y):new FormData(p),$d(l,{pending:!0,data:O,method:p.method,action:_},_,O))},currentTarget:p}]})}}for(var Ef=0;Ef<od.length;Ef++){var Nf=od[Ef],Wj=Nf.toLowerCase(),Vj=Nf[0].toUpperCase()+Nf.slice(1);pi(Wj,"on"+Vj)}pi(Og,"onAnimationEnd"),pi(Ag,"onAnimationIteration"),pi(Rg,"onAnimationStart"),pi("dblclick","onDoubleClick"),pi("focusin","onFocus"),pi("focusout","onBlur"),pi(cj,"onTransitionRun"),pi(uj,"onTransitionStart"),pi(hj,"onTransitionCancel"),pi(Mg,"onTransitionEnd"),va("onMouseEnter",["mouseout","mouseover"]),va("onMouseLeave",["mouseout","mouseover"]),va("onPointerEnter",["pointerout","pointerover"]),va("onPointerLeave",["pointerout","pointerover"]),bn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bn("onBeforeInput",["compositionend","keypress","textInput","paste"]),bn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ho="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Yj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ho));function eb(s,r){r=(r&4)!==0;for(var l=0;l<s.length;l++){var u=s[l],p=u.event;u=u.listeners;e:{var _=void 0;if(r)for(var y=u.length-1;0<=y;y--){var w=u[y],O=w.instance,P=w.currentTarget;if(w=w.listener,O!==_&&p.isPropagationStopped())break e;_=w,p.currentTarget=P;try{_(p)}catch(Q){kc(Q)}p.currentTarget=null,_=O}else for(y=0;y<u.length;y++){if(w=u[y],O=w.instance,P=w.currentTarget,w=w.listener,O!==_&&p.isPropagationStopped())break e;_=w,p.currentTarget=P;try{_(p)}catch(Q){kc(Q)}p.currentTarget=null,_=O}}}}function Fe(s,r){var l=r[Hh];l===void 0&&(l=r[Hh]=new Set);var u=s+"__bubble";l.has(u)||(tb(r,s,2,!1),l.add(u))}function Tf(s,r,l){var u=0;r&&(u|=4),tb(l,s,u,r)}var du="_reactListening"+Math.random().toString(36).slice(2);function Of(s){if(!s[du]){s[du]=!0,Y_.forEach(function(l){l!=="selectionchange"&&(Yj.has(l)||Tf(l,!1,s),Tf(l,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[du]||(r[du]=!0,Tf("selectionchange",!1,r))}}function tb(s,r,l,u){switch(Ob(r)){case 2:var p=xk;break;case 8:p=wk;break;default:p=$f}l=p.bind(null,r,l,s),p=void 0,!Gh||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(p=!0),u?p!==void 0?s.addEventListener(r,l,{capture:!0,passive:p}):s.addEventListener(r,l,!0):p!==void 0?s.addEventListener(r,l,{passive:p}):s.addEventListener(r,l,!1)}function Af(s,r,l,u,p){var _=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var y=u.tag;if(y===3||y===4){var w=u.stateNode.containerInfo;if(w===p)break;if(y===4)for(y=u.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===p)return;y=y.return}for(;w!==null;){if(y=pa(w),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){u=_=y;continue e}w=w.parentNode}}u=u.return}ag(function(){var P=_,Q=Vh(l),J=[];e:{var U=Dg.get(s);if(U!==void 0){var V=wc,ge=s;switch(s){case"keypress":if(Sc(l)===0)break e;case"keydown":case"keyup":V=IC;break;case"focusin":ge="focus",V=Jh;break;case"focusout":ge="blur",V=Jh;break;case"beforeblur":case"afterblur":V=Jh;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":V=cg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":V=TC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":V=KC;break;case Og:case Ag:case Rg:V=RC;break;case Mg:V=WC;break;case"scroll":case"scrollend":V=EC;break;case"wheel":V=YC;break;case"copy":case"cut":case"paste":V=DC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":V=hg;break;case"toggle":case"beforetoggle":V=QC}var je=(r&4)!==0,ct=!je&&(s==="scroll"||s==="scrollend"),B=je?U!==null?U+"Capture":null:U;je=[];for(var R=P,q;R!==null;){var X=R;if(q=X.stateNode,X=X.tag,X!==5&&X!==26&&X!==27||q===null||B===null||(X=Ml(R,B),X!=null&&je.push(fo(R,X,q))),ct)break;R=R.return}0<je.length&&(U=new V(U,ge,null,l,Q),J.push({event:U,listeners:je}))}}if((r&7)===0){e:{if(U=s==="mouseover"||s==="pointerover",V=s==="mouseout"||s==="pointerout",U&&l!==Wh&&(ge=l.relatedTarget||l.fromElement)&&(pa(ge)||ge[ma]))break e;if((V||U)&&(U=Q.window===Q?Q:(U=Q.ownerDocument)?U.defaultView||U.parentWindow:window,V?(ge=l.relatedTarget||l.toElement,V=P,ge=ge?pa(ge):null,ge!==null&&(ct=c(ge),je=ge.tag,ge!==ct||je!==5&&je!==27&&je!==6)&&(ge=null)):(V=null,ge=P),V!==ge)){if(je=cg,X="onMouseLeave",B="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(je=hg,X="onPointerLeave",B="onPointerEnter",R="pointer"),ct=V==null?U:Rl(V),q=ge==null?U:Rl(ge),U=new je(X,R+"leave",V,l,Q),U.target=ct,U.relatedTarget=q,X=null,pa(Q)===P&&(je=new je(B,R+"enter",ge,l,Q),je.target=q,je.relatedTarget=ct,X=je),ct=X,V&&ge)t:{for(je=Gj,B=V,R=ge,q=0,X=B;X;X=je(X))q++;X=0;for(var we=R;we;we=je(we))X++;for(;0<q-X;)B=je(B),q--;for(;0<X-q;)R=je(R),X--;for(;q--;){if(B===R||R!==null&&B===R.alternate){je=B;break t}B=je(B),R=je(R)}je=null}else je=null;V!==null&&sb(J,U,V,je,!1),ge!==null&&ct!==null&&sb(J,ct,ge,je,!0)}}e:{if(U=P?Rl(P):window,V=U.nodeName&&U.nodeName.toLowerCase(),V==="select"||V==="input"&&U.type==="file")var tt=yg;else if(gg(U))if(bg)tt=aj;else{tt=rj;var ye=ij}else V=U.nodeName,!V||V.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?P&&$h(P.elementType)&&(tt=yg):tt=nj;if(tt&&(tt=tt(s,P))){vg(J,tt,l,Q);break e}ye&&ye(s,U,P),s==="focusout"&&P&&U.type==="number"&&P.memoizedProps.value!=null&&Kh(U,"number",U.value)}switch(ye=P?Rl(P):window,s){case"focusin":(gg(ye)||ye.contentEditable==="true")&&(Ca=ye,nd=P,Il=null);break;case"focusout":Il=nd=Ca=null;break;case"mousedown":ad=!0;break;case"contextmenu":case"mouseup":case"dragend":ad=!1,Ng(J,l,Q);break;case"selectionchange":if(oj)break;case"keydown":case"keyup":Ng(J,l,Q)}var Le;if(td)e:{switch(s){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else wa?pg(s,l)&&($e="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&($e="onCompositionStart");$e&&(dg&&l.locale!=="ko"&&(wa||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&wa&&(Le=lg()):(xr=Q,Qh="value"in xr?xr.value:xr.textContent,wa=!0)),ye=fu(P,$e),0<ye.length&&($e=new ug($e,s,null,l,Q),J.push({event:$e,listeners:ye}),Le?$e.data=Le:(Le=_g(l),Le!==null&&($e.data=Le)))),(Le=XC?JC(s,l):ej(s,l))&&($e=fu(P,"onBeforeInput"),0<$e.length&&(ye=new ug("onBeforeInput","beforeinput",null,l,Q),J.push({event:ye,listeners:$e}),ye.data=Le)),$j(J,s,P,l,Q)}eb(J,r)})}function fo(s,r,l){return{instance:s,listener:r,currentTarget:l}}function fu(s,r){for(var l=r+"Capture",u=[];s!==null;){var p=s,_=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||_===null||(p=Ml(s,l),p!=null&&u.unshift(fo(s,p,_)),p=Ml(s,r),p!=null&&u.push(fo(s,p,_))),s.tag===3)return u;s=s.return}return[]}function Gj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function sb(s,r,l,u,p){for(var _=r._reactName,y=[];l!==null&&l!==u;){var w=l,O=w.alternate,P=w.stateNode;if(w=w.tag,O!==null&&O===u)break;w!==5&&w!==26&&w!==27||P===null||(O=P,p?(P=Ml(l,_),P!=null&&y.unshift(fo(l,P,O))):p||(P=Ml(l,_),P!=null&&y.push(fo(l,P,O)))),l=l.return}y.length!==0&&s.push({event:r,listeners:y})}var Qj=/\r\n?/g,Zj=/\u0000|\uFFFD/g;function ib(s){return(typeof s=="string"?s:""+s).replace(Qj,`
|
|
50
|
+
`).replace(Zj,"")}function rb(s,r){return r=ib(r),ib(s)===r}function ot(s,r,l,u,p,_){switch(l){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ba(s,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ba(s,""+u);break;case"className":gc(s,"class",u);break;case"tabIndex":gc(s,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":gc(s,l,u);break;case"style":rg(s,u,_);break;case"data":if(r!=="object"){gc(s,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||l!=="href")){s.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(l);break}u=yc(""+u),s.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(l==="formAction"?(r!=="input"&&ot(s,r,"name",p.name,p,null),ot(s,r,"formEncType",p.formEncType,p,null),ot(s,r,"formMethod",p.formMethod,p,null),ot(s,r,"formTarget",p.formTarget,p,null)):(ot(s,r,"encType",p.encType,p,null),ot(s,r,"method",p.method,p,null),ot(s,r,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(l);break}u=yc(""+u),s.setAttribute(l,u);break;case"onClick":u!=null&&(s.onclick=Fi);break;case"onScroll":u!=null&&Fe("scroll",s);break;case"onScrollEnd":u!=null&&Fe("scrollend",s);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(n(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(n(60));s.innerHTML=l}}break;case"multiple":s.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":s.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){s.removeAttribute("xlink:href");break}l=yc(""+u),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(l,""+u):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":u===!0?s.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(l,u):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?s.setAttribute(l,u):s.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?s.removeAttribute(l):s.setAttribute(l,u);break;case"popover":Fe("beforetoggle",s),Fe("toggle",s),_c(s,"popover",u);break;case"xlinkActuate":Ui(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ui(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ui(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ui(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ui(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ui(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":_c(s,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=jC.get(l)||l,_c(s,l,u))}}function Rf(s,r,l,u,p,_){switch(l){case"style":rg(s,u,_);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(n(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(n(60));s.innerHTML=l}}break;case"children":typeof u=="string"?ba(s,u):(typeof u=="number"||typeof u=="bigint")&&ba(s,""+u);break;case"onScroll":u!=null&&Fe("scroll",s);break;case"onScrollEnd":u!=null&&Fe("scrollend",s);break;case"onClick":u!=null&&(s.onclick=Fi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!G_.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(p=l.endsWith("Capture"),r=l.slice(2,p?l.length-7:void 0),_=s[Ss]||null,_=_!=null?_[l]:null,typeof _=="function"&&s.removeEventListener(r,_,p),typeof u=="function")){typeof _!="function"&&_!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(r,u,p);break e}l in s?s[l]=u:u===!0?s.setAttribute(l,""):_c(s,l,u)}}}function rs(s,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",s),Fe("load",s);var u=!1,p=!1,_;for(_ in l)if(l.hasOwnProperty(_)){var y=l[_];if(y!=null)switch(_){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:ot(s,r,_,y,l,null)}}p&&ot(s,r,"srcSet",l.srcSet,l,null),u&&ot(s,r,"src",l.src,l,null);return;case"input":Fe("invalid",s);var w=_=y=p=null,O=null,P=null;for(u in l)if(l.hasOwnProperty(u)){var Q=l[u];if(Q!=null)switch(u){case"name":p=Q;break;case"type":y=Q;break;case"checked":O=Q;break;case"defaultChecked":P=Q;break;case"value":_=Q;break;case"defaultValue":w=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(n(137,r));break;default:ot(s,r,u,Q,l,null)}}eg(s,_,w,O,P,y,p,!1);return;case"select":Fe("invalid",s),u=y=_=null;for(p in l)if(l.hasOwnProperty(p)&&(w=l[p],w!=null))switch(p){case"value":_=w;break;case"defaultValue":y=w;break;case"multiple":u=w;default:ot(s,r,p,w,l,null)}r=_,l=y,s.multiple=!!u,r!=null?ya(s,!!u,r,!1):l!=null&&ya(s,!!u,l,!0);return;case"textarea":Fe("invalid",s),_=p=u=null;for(y in l)if(l.hasOwnProperty(y)&&(w=l[y],w!=null))switch(y){case"value":u=w;break;case"defaultValue":p=w;break;case"children":_=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(n(91));break;default:ot(s,r,y,w,l,null)}sg(s,u,p,_);return;case"option":for(O in l)if(l.hasOwnProperty(O)&&(u=l[O],u!=null))switch(O){case"selected":s.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:ot(s,r,O,u,l,null)}return;case"dialog":Fe("beforetoggle",s),Fe("toggle",s),Fe("cancel",s),Fe("close",s);break;case"iframe":case"object":Fe("load",s);break;case"video":case"audio":for(u=0;u<ho.length;u++)Fe(ho[u],s);break;case"image":Fe("error",s),Fe("load",s);break;case"details":Fe("toggle",s);break;case"embed":case"source":case"link":Fe("error",s),Fe("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in l)if(l.hasOwnProperty(P)&&(u=l[P],u!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:ot(s,r,P,u,l,null)}return;default:if($h(r)){for(Q in l)l.hasOwnProperty(Q)&&(u=l[Q],u!==void 0&&Rf(s,r,Q,u,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(u=l[w],u!=null&&ot(s,r,w,u,l,null))}function Xj(s,r,l,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,_=null,y=null,w=null,O=null,P=null,Q=null;for(V in l){var J=l[V];if(l.hasOwnProperty(V)&&J!=null)switch(V){case"checked":break;case"value":break;case"defaultValue":O=J;default:u.hasOwnProperty(V)||ot(s,r,V,null,u,J)}}for(var U in u){var V=u[U];if(J=l[U],u.hasOwnProperty(U)&&(V!=null||J!=null))switch(U){case"type":_=V;break;case"name":p=V;break;case"checked":P=V;break;case"defaultChecked":Q=V;break;case"value":y=V;break;case"defaultValue":w=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(n(137,r));break;default:V!==J&&ot(s,r,U,V,u,J)}}Fh(s,y,w,O,P,Q,_,p);return;case"select":V=y=w=U=null;for(_ in l)if(O=l[_],l.hasOwnProperty(_)&&O!=null)switch(_){case"value":break;case"multiple":V=O;default:u.hasOwnProperty(_)||ot(s,r,_,null,u,O)}for(p in u)if(_=u[p],O=l[p],u.hasOwnProperty(p)&&(_!=null||O!=null))switch(p){case"value":U=_;break;case"defaultValue":w=_;break;case"multiple":y=_;default:_!==O&&ot(s,r,p,_,u,O)}r=w,l=y,u=V,U!=null?ya(s,!!l,U,!1):!!u!=!!l&&(r!=null?ya(s,!!l,r,!0):ya(s,!!l,l?[]:"",!1));return;case"textarea":V=U=null;for(w in l)if(p=l[w],l.hasOwnProperty(w)&&p!=null&&!u.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ot(s,r,w,null,u,p)}for(y in u)if(p=u[y],_=l[y],u.hasOwnProperty(y)&&(p!=null||_!=null))switch(y){case"value":U=p;break;case"defaultValue":V=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(n(91));break;default:p!==_&&ot(s,r,y,p,u,_)}tg(s,U,V);return;case"option":for(var ge in l)if(U=l[ge],l.hasOwnProperty(ge)&&U!=null&&!u.hasOwnProperty(ge))switch(ge){case"selected":s.selected=!1;break;default:ot(s,r,ge,null,u,U)}for(O in u)if(U=u[O],V=l[O],u.hasOwnProperty(O)&&U!==V&&(U!=null||V!=null))switch(O){case"selected":s.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:ot(s,r,O,U,u,V)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var je in l)U=l[je],l.hasOwnProperty(je)&&U!=null&&!u.hasOwnProperty(je)&&ot(s,r,je,null,u,U);for(P in u)if(U=u[P],V=l[P],u.hasOwnProperty(P)&&U!==V&&(U!=null||V!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(137,r));break;default:ot(s,r,P,U,u,V)}return;default:if($h(r)){for(var ct in l)U=l[ct],l.hasOwnProperty(ct)&&U!==void 0&&!u.hasOwnProperty(ct)&&Rf(s,r,ct,void 0,u,U);for(Q in u)U=u[Q],V=l[Q],!u.hasOwnProperty(Q)||U===V||U===void 0&&V===void 0||Rf(s,r,Q,U,u,V);return}}for(var B in l)U=l[B],l.hasOwnProperty(B)&&U!=null&&!u.hasOwnProperty(B)&&ot(s,r,B,null,u,U);for(J in u)U=u[J],V=l[J],!u.hasOwnProperty(J)||U===V||U==null&&V==null||ot(s,r,J,U,u,V)}function nb(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jj(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var p=l[u],_=p.transferSize,y=p.initiatorType,w=p.duration;if(_&&w&&nb(y)){for(y=0,w=p.responseEnd,u+=1;u<l.length;u++){var O=l[u],P=O.startTime;if(P>w)break;var Q=O.transferSize,J=O.initiatorType;Q&&nb(J)&&(O=O.responseEnd,y+=Q*(O<w?1:(w-P)/(O-P)))}if(--u,r+=8*(_+y)/(p.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Mf=null,Df=null;function mu(s){return s.nodeType===9?s:s.ownerDocument}function ab(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function lb(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function Bf(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Lf=null;function ek(){var s=window.event;return s&&s.type==="popstate"?s===Lf?!1:(Lf=s,!0):(Lf=null,!1)}var ob=typeof setTimeout=="function"?setTimeout:void 0,tk=typeof clearTimeout=="function"?clearTimeout:void 0,cb=typeof Promise=="function"?Promise:void 0,sk=typeof queueMicrotask=="function"?queueMicrotask:typeof cb<"u"?function(s){return cb.resolve(null).then(s).catch(ik)}:ob;function ik(s){setTimeout(function(){throw s})}function Pr(s){return s==="head"}function ub(s,r){var l=r,u=0;do{var p=l.nextSibling;if(s.removeChild(l),p&&p.nodeType===8)if(l=p.data,l==="/$"||l==="/&"){if(u===0){s.removeChild(p),Za(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")mo(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,mo(l);for(var _=l.firstChild;_;){var y=_.nextSibling,w=_.nodeName;_[Al]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&_.rel.toLowerCase()==="stylesheet"||l.removeChild(_),_=y}}else l==="body"&&mo(s.ownerDocument.body);l=p}while(l);Za(r)}function hb(s,r){var l=s;s=0;do{var u=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=u}while(l)}function zf(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":zf(l),Ih(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function rk(s,r,l,u){for(;s.nodeType===1;){var p=l;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[Al])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(_=s.getAttribute("rel"),_==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(_!==p.rel||s.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||s.getAttribute("title")!==(p.title==null?null:p.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(_=s.getAttribute("src"),(_!==(p.src==null?null:p.src)||s.getAttribute("type")!==(p.type==null?null:p.type)||s.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&_&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var _=p.name==null?null:""+p.name;if(p.type==="hidden"&&s.getAttribute("name")===_)return s}else return s;if(s=ni(s.nextSibling),s===null)break}return null}function nk(s,r,l){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=ni(s.nextSibling),s===null))return null;return s}function db(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=ni(s.nextSibling),s===null))return null;return s}function qf(s){return s.data==="$?"||s.data==="$~"}function Pf(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function ak(s,r){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||l.readyState!=="loading")r();else{var u=function(){r(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),s._reactRetry=u}}function ni(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Hf=null;function fb(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(r===0)return ni(s.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}s=s.nextSibling}return null}function mb(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return s;r--}else l!=="/$"&&l!=="/&"||r++}s=s.previousSibling}return null}function pb(s,r,l){switch(r=mu(l),s){case"html":if(s=r.documentElement,!s)throw Error(n(452));return s;case"head":if(s=r.head,!s)throw Error(n(453));return s;case"body":if(s=r.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function mo(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);Ih(s)}var ai=new Map,_b=new Set;function pu(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var nr=F.d;F.d={f:lk,r:ok,D:ck,C:uk,L:hk,m:dk,X:mk,S:fk,M:pk};function lk(){var s=nr.f(),r=au();return s||r}function ok(s){var r=_a(s);r!==null&&r.tag===5&&r.type==="form"?Mv(r):nr.r(s)}var Ya=typeof document>"u"?null:document;function gb(s,r,l){var u=Ya;if(u&&typeof r=="string"&&r){var p=Xs(r);p='link[rel="'+s+'"][href="'+p+'"]',typeof l=="string"&&(p+='[crossorigin="'+l+'"]'),_b.has(p)||(_b.add(p),s={rel:s,crossOrigin:l,href:r},u.querySelector(p)===null&&(r=u.createElement("link"),rs(r,"link",s),$t(r),u.head.appendChild(r)))}}function ck(s){nr.D(s),gb("dns-prefetch",s,null)}function uk(s,r){nr.C(s,r),gb("preconnect",s,r)}function hk(s,r,l){nr.L(s,r,l);var u=Ya;if(u&&s&&r){var p='link[rel="preload"][as="'+Xs(r)+'"]';r==="image"&&l&&l.imageSrcSet?(p+='[imagesrcset="'+Xs(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(p+='[imagesizes="'+Xs(l.imageSizes)+'"]')):p+='[href="'+Xs(s)+'"]';var _=p;switch(r){case"style":_=Ga(s);break;case"script":_=Qa(s)}ai.has(_)||(s=v({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:s,as:r},l),ai.set(_,s),u.querySelector(p)!==null||r==="style"&&u.querySelector(po(_))||r==="script"&&u.querySelector(_o(_))||(r=u.createElement("link"),rs(r,"link",s),$t(r),u.head.appendChild(r)))}}function dk(s,r){nr.m(s,r);var l=Ya;if(l&&s){var u=r&&typeof r.as=="string"?r.as:"script",p='link[rel="modulepreload"][as="'+Xs(u)+'"][href="'+Xs(s)+'"]',_=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=Qa(s)}if(!ai.has(_)&&(s=v({rel:"modulepreload",href:s},r),ai.set(_,s),l.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(_o(_)))return}u=l.createElement("link"),rs(u,"link",s),$t(u),l.head.appendChild(u)}}}function fk(s,r,l){nr.S(s,r,l);var u=Ya;if(u&&s){var p=ga(u).hoistableStyles,_=Ga(s);r=r||"default";var y=p.get(_);if(!y){var w={loading:0,preload:null};if(y=u.querySelector(po(_)))w.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":r},l),(l=ai.get(_))&&If(s,l);var O=y=u.createElement("link");$t(O),rs(O,"link",s),O._p=new Promise(function(P,Q){O.onload=P,O.onerror=Q}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,_u(y,r,u)}y={type:"stylesheet",instance:y,count:1,state:w},p.set(_,y)}}}function mk(s,r){nr.X(s,r);var l=Ya;if(l&&s){var u=ga(l).hoistableScripts,p=Qa(s),_=u.get(p);_||(_=l.querySelector(_o(p)),_||(s=v({src:s,async:!0},r),(r=ai.get(p))&&Uf(s,r),_=l.createElement("script"),$t(_),rs(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function pk(s,r){nr.M(s,r);var l=Ya;if(l&&s){var u=ga(l).hoistableScripts,p=Qa(s),_=u.get(p);_||(_=l.querySelector(_o(p)),_||(s=v({src:s,async:!0,type:"module"},r),(r=ai.get(p))&&Uf(s,r),_=l.createElement("script"),$t(_),rs(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(p,_))}}function vb(s,r,l,u){var p=(p=_e.current)?pu(p):null;if(!p)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=Ga(l.href),l=ga(p).hoistableStyles,u=l.get(r),u||(u={type:"style",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=Ga(l.href);var _=ga(p).hoistableStyles,y=_.get(s);if(y||(p=p.ownerDocument||p,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(s,y),(_=p.querySelector(po(s)))&&!_._p&&(y.instance=_,y.state.loading=5),ai.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},ai.set(s,l),_||_k(p,s,l,y.state))),r&&u===null)throw Error(n(528,""));return y}if(r&&u!==null)throw Error(n(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Qa(l),l=ga(p).hoistableScripts,u=l.get(r),u||(u={type:"script",instance:null,count:0,state:null},l.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Ga(s){return'href="'+Xs(s)+'"'}function po(s){return'link[rel="stylesheet"]['+s+"]"}function yb(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function _k(s,r,l,u){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?u.loading=1:(r=s.createElement("link"),u.preload=r,r.addEventListener("load",function(){return u.loading|=1}),r.addEventListener("error",function(){return u.loading|=2}),rs(r,"link",l),$t(r),s.head.appendChild(r))}function Qa(s){return'[src="'+Xs(s)+'"]'}function _o(s){return"script[async]"+s}function bb(s,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var u=s.querySelector('style[data-href~="'+Xs(l.href)+'"]');if(u)return r.instance=u,$t(u),u;var p=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(s.ownerDocument||s).createElement("style"),$t(u),rs(u,"style",p),_u(u,l.precedence,s),r.instance=u;case"stylesheet":p=Ga(l.href);var _=s.querySelector(po(p));if(_)return r.state.loading|=4,r.instance=_,$t(_),_;u=yb(l),(p=ai.get(p))&&If(u,p),_=(s.ownerDocument||s).createElement("link"),$t(_);var y=_;return y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),rs(_,"link",u),r.state.loading|=4,_u(_,l.precedence,s),r.instance=_;case"script":return _=Qa(l.src),(p=s.querySelector(_o(_)))?(r.instance=p,$t(p),p):(u=l,(p=ai.get(_))&&(u=v({},l),Uf(u,p)),s=s.ownerDocument||s,p=s.createElement("script"),$t(p),rs(p,"link",u),s.head.appendChild(p),r.instance=p);case"void":return null;default:throw Error(n(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(u=r.instance,r.state.loading|=4,_u(u,l.precedence,s));return r.instance}function _u(s,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,_=p,y=0;y<u.length;y++){var w=u[y];if(w.dataset.precedence===r)_=w;else if(_!==p)break}_?_.parentNode.insertBefore(s,_.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(s,r.firstChild))}function If(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Uf(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var gu=null;function Sb(s,r,l){if(gu===null){var u=new Map,p=gu=new Map;p.set(l,u)}else p=gu,u=p.get(l),u||(u=new Map,p.set(l,u));if(u.has(s))return u;for(u.set(s,null),l=l.getElementsByTagName(s),p=0;p<l.length;p++){var _=l[p];if(!(_[Al]||_[es]||s==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var y=_.getAttribute(r)||"";y=s+y;var w=u.get(y);w?w.push(_):u.set(y,[_])}}return u}function xb(s,r,l){s=s.ownerDocument||s,s.head.insertBefore(l,r==="title"?s.querySelector("head > title"):null)}function gk(s,r,l){if(l===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function wb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function vk(s,r,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var p=Ga(u.href),_=r.querySelector(po(p));if(_){r=_._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=vu.bind(s),r.then(s,s)),l.state.loading|=4,l.instance=_,$t(_);return}_=r.ownerDocument||r,u=yb(u),(p=ai.get(p))&&If(u,p),_=_.createElement("link"),$t(_);var y=_;y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),rs(_,"link",u),l.instance=_}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=vu.bind(s),r.addEventListener("load",l),r.addEventListener("error",l))}}var Ff=0;function yk(s,r){return s.stylesheets&&s.count===0&&bu(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var u=setTimeout(function(){if(s.stylesheets&&bu(s,s.stylesheets),s.unsuspend){var _=s.unsuspend;s.unsuspend=null,_()}},6e4+r);0<s.imgBytes&&Ff===0&&(Ff=62500*Jj());var p=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&bu(s,s.stylesheets),s.unsuspend)){var _=s.unsuspend;s.unsuspend=null,_()}},(s.imgBytes>Ff?50:800)+r);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function vu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var yu=null;function bu(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,yu=new Map,r.forEach(bk,s),yu=null,vu.call(s))}function bk(s,r){if(!(r.state.loading&4)){var l=yu.get(s);if(l)var u=l.get(null);else{l=new Map,yu.set(s,l);for(var p=s.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<p.length;_++){var y=p[_];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),u=y)}u&&l.set(null,u)}p=r.instance,y=p.getAttribute("data-precedence"),_=l.get(y)||u,_===u&&l.set(null,p),l.set(y,p),this.count++,u=vu.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),_?_.parentNode.insertBefore(p,_.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(p,s.firstChild)),r.state.loading|=4}}var go={$$typeof:D,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function Sk(s,r,l,u,p,_,y,w,O){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zh(0),this.hiddenUpdates=zh(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=_,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function Cb(s,r,l,u,p,_,y,w,O,P,Q,J){return s=new Sk(s,r,l,y,O,P,Q,J,w),r=1,_===!0&&(r|=24),_=zs(3,null,null,r),s.current=_,_.stateNode=s,r=Sd(),r.refCount++,s.pooledCache=r,r.refCount++,_.memoizedState={element:u,isDehydrated:l,cache:r},jd(_),s}function jb(s){return s?(s=Ea,s):Ea}function kb(s,r,l,u,p,_){p=jb(p),u.context===null?u.context=p:u.pendingContext=p,u=Nr(r),u.payload={element:l},_=_===void 0?null:_,_!==null&&(u.callback=_),l=Tr(s,u,r),l!==null&&(Es(l,s,r),Yl(l,s,r))}function Eb(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<r?l:r}}function Kf(s,r){Eb(s,r),(s=s.alternate)&&Eb(s,r)}function Nb(s){if(s.tag===13||s.tag===31){var r=Cn(s,67108864);r!==null&&Es(r,s,67108864),Kf(s,67108864)}}function Tb(s){if(s.tag===13||s.tag===31){var r=Us();r=qh(r);var l=Cn(s,r);l!==null&&Es(l,s,r),Kf(s,r)}}var Su=!0;function xk(s,r,l,u){var p=A.T;A.T=null;var _=F.p;try{F.p=2,$f(s,r,l,u)}finally{F.p=_,A.T=p}}function wk(s,r,l,u){var p=A.T;A.T=null;var _=F.p;try{F.p=8,$f(s,r,l,u)}finally{F.p=_,A.T=p}}function $f(s,r,l,u){if(Su){var p=Wf(u);if(p===null)Af(s,r,u,xu,l),Ab(s,u);else if(jk(p,s,r,l,u))u.stopPropagation();else if(Ab(s,u),r&4&&-1<Ck.indexOf(s)){for(;p!==null;){var _=_a(p);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var y=yn(_.pendingLanes);if(y!==0){var w=_;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var O=1<<31-Bs(y);w.entanglements[1]|=O,y&=~O}ki(_),(it&6)===0&&(ru=Ms()+500,uo(0))}}break;case 31:case 13:w=Cn(_,2),w!==null&&Es(w,_,2),au(),Kf(_,2)}if(_=Wf(u),_===null&&Af(s,r,u,xu,l),_===p)break;p=_}p!==null&&u.stopPropagation()}else Af(s,r,u,null,l)}}function Wf(s){return s=Vh(s),Vf(s)}var xu=null;function Vf(s){if(xu=null,s=pa(s),s!==null){var r=c(s);if(r===null)s=null;else{var l=r.tag;if(l===13){if(s=h(r),s!==null)return s;s=null}else if(l===31){if(s=d(r),s!==null)return s;s=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return xu=s,null}function Ob(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(cC()){case q_:return 2;case P_:return 8;case hc:case uC:return 32;case H_:return 268435456;default:return 32}default:return 32}}var Yf=!1,Hr=null,Ir=null,Ur=null,vo=new Map,yo=new Map,Fr=[],Ck="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ab(s,r){switch(s){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Ur=null;break;case"pointerover":case"pointerout":vo.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":yo.delete(r.pointerId)}}function bo(s,r,l,u,p,_){return s===null||s.nativeEvent!==_?(s={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:_,targetContainers:[p]},r!==null&&(r=_a(r),r!==null&&Nb(r)),s):(s.eventSystemFlags|=u,r=s.targetContainers,p!==null&&r.indexOf(p)===-1&&r.push(p),s)}function jk(s,r,l,u,p){switch(r){case"focusin":return Hr=bo(Hr,s,r,l,u,p),!0;case"dragenter":return Ir=bo(Ir,s,r,l,u,p),!0;case"mouseover":return Ur=bo(Ur,s,r,l,u,p),!0;case"pointerover":var _=p.pointerId;return vo.set(_,bo(vo.get(_)||null,s,r,l,u,p)),!0;case"gotpointercapture":return _=p.pointerId,yo.set(_,bo(yo.get(_)||null,s,r,l,u,p)),!0}return!1}function Rb(s){var r=pa(s.target);if(r!==null){var l=c(r);if(l!==null){if(r=l.tag,r===13){if(r=h(l),r!==null){s.blockedOn=r,W_(s.priority,function(){Tb(l)});return}}else if(r===31){if(r=d(l),r!==null){s.blockedOn=r,W_(s.priority,function(){Tb(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function wu(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var l=Wf(s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);Wh=u,l.target.dispatchEvent(u),Wh=null}else return r=_a(l),r!==null&&Nb(r),s.blockedOn=l,!1;r.shift()}return!0}function Mb(s,r,l){wu(s)&&l.delete(r)}function kk(){Yf=!1,Hr!==null&&wu(Hr)&&(Hr=null),Ir!==null&&wu(Ir)&&(Ir=null),Ur!==null&&wu(Ur)&&(Ur=null),vo.forEach(Mb),yo.forEach(Mb)}function Cu(s,r){s.blockedOn===r&&(s.blockedOn=null,Yf||(Yf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,kk)))}var ju=null;function Db(s){ju!==s&&(ju=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ju===s&&(ju=null);for(var r=0;r<s.length;r+=3){var l=s[r],u=s[r+1],p=s[r+2];if(typeof u!="function"){if(Vf(u||l)===null)continue;break}var _=_a(l);_!==null&&(s.splice(r,3),r-=3,$d(_,{pending:!0,data:p,method:l.method,action:u},u,p))}}))}function Za(s){function r(O){return Cu(O,s)}Hr!==null&&Cu(Hr,s),Ir!==null&&Cu(Ir,s),Ur!==null&&Cu(Ur,s),vo.forEach(r),yo.forEach(r);for(var l=0;l<Fr.length;l++){var u=Fr[l];u.blockedOn===s&&(u.blockedOn=null)}for(;0<Fr.length&&(l=Fr[0],l.blockedOn===null);)Rb(l),l.blockedOn===null&&Fr.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var p=l[u],_=l[u+1],y=p[Ss]||null;if(typeof _=="function")y||Db(l);else if(y){var w=null;if(_&&_.hasAttribute("formAction")){if(p=_,y=_[Ss]||null)w=y.formAction;else if(Vf(p)!==null)continue}else w=y.action;typeof w=="function"?l[u+1]=w:(l.splice(u,3),u-=3),Db(l)}}}function Bb(){function s(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(y){return p=y})},focusReset:"manual",scroll:"manual"})}function r(){p!==null&&(p(),p=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,p=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),p!==null&&(p(),p=null)}}}function Gf(s){this._internalRoot=s}ku.prototype.render=Gf.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(n(409));var l=r.current,u=Us();kb(l,u,s,r,null,null)},ku.prototype.unmount=Gf.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;kb(s.current,2,null,s,null,null),au(),r[ma]=null}};function ku(s){this._internalRoot=s}ku.prototype.unstable_scheduleHydration=function(s){if(s){var r=$_();s={blockedOn:null,target:s,priority:r};for(var l=0;l<Fr.length&&r!==0&&r<Fr[l].priority;l++);Fr.splice(l,0,s),l===0&&Rb(s)}};var Lb=t.version;if(Lb!=="19.2.8")throw Error(n(527,Lb,"19.2.8"));F.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=m(r),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var Ek={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Eu.isDisabled&&Eu.supportsFiber)try{Nl=Eu.inject(Ek),Ds=Eu}catch{}}return xo.createRoot=function(s,r){if(!a(s))throw Error(n(299));var l=!1,u="",p=Fv,_=Kv,y=$v;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(p=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError)),r=Cb(s,1,!1,null,null,l,u,null,p,_,y,Bb),s[ma]=r.current,Of(s),new Gf(r)},xo.hydrateRoot=function(s,r,l){if(!a(s))throw Error(n(299));var u=!1,p="",_=Fv,y=Kv,w=$v,O=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(_=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(O=l.formState)),r=Cb(s,1,!0,r,l??null,u,p,O,_,y,w,Bb),r.context=jb(null),l=r.current,u=Us(),u=qh(u),p=Nr(u),p.callback=null,Tr(l,p,u),l=u,r.current.lanes=l,Ol(r,l),ki(r),s[ma]=r.current,Of(s),new ku(r)},xo.version="19.2.8",xo}var r0;function gE(){if(r0)return Jf.exports;r0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Jf.exports=_E(),Jf.exports}var vE=gE();const mr=["workspace","list"];function ta(e){return["project","listByWorkspace",e]}function sa(e){return["worktree","listByProject",e]}function yE(e){return["project","detail",e]}function n_(e){return["worktree","detail",e]}function Hi(e,t){return["session","listByScope",e,t]}function Ux(e,t){return["scripts","status",e,t]}function a_(e,t,i){return["files","listDir",e,t,i]}function Ou(e,t,i){return["files","read",e,t,i]}function bE(e,t,i){return["files","deletePreview",e,t,i]}function SE(e,t,i){return["changes","list",e,t,i]}function xE(e,t,i,n){return["changes","patch",e,t,i,n]}function wE(e,t){return["memory","list",e??"-",t??"-"]}function CE(e){return["memory","proposals",e]}function jE(e,t){return["memory","core",e??"-",t??"-"]}function kE(e,t,i){return["memory","search",e??"-",t??"-",i]}const EE=["memory","decisions"],NE=["memory","usage"],TE=["memory","settings"];function OE(e,t){return["usage","byProject",e,t]}function AE(e,t){return["usage","byWorktree",e,t]}function RE(e,t){return["usage","byProjectAndAgent",e,t]}function ME(e,t){return["memory","playbooks",e??"-",t?"arquivados":"ativos"]}function nh(e){return["project","cloneJobs",e]}function DE(e){return["pr","getByWorktree",e]}function BE(e){return["pr","listByProject",e]}function LE(e){return["pr","draft",e]}var zE=Object.create,Fx=Object.defineProperty,qE=Object.getOwnPropertyDescriptor,Kx=Object.getOwnPropertyNames,PE=Object.getPrototypeOf,HE=Object.prototype.hasOwnProperty,Ii=(e,t)=>function(){return t||(0,e[Kx(e)[0]])((t={exports:{}}).exports,t),t.exports},IE=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Kx(t),c=0,h=a.length,d;c<h;c++)d=a[c],!HE.call(e,d)&&d!==i&&Fx(e,d,{get:(f=>t[f]).bind(null,d),enumerable:!(n=qE(t,d))||n.enumerable});return e},Ot=(e,t,i)=>(i=e!=null?zE(PE(e)):{},IE(t||!e||!e.__esModule?Fx(i,"default",{value:e,enumerable:!0}):i,e)),$x=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function i(n){"@babel/helpers - typeof";return t.exports=i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},t.exports.__esModule=!0,t.exports.default=t.exports,i(n)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),UE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=$x().default;function n(a,c){if(i(a)!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var d=h.call(a,c||"default");if(i(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),FE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=$x().default,n=UE();function a(c){var h=n(c,"string");return i(h)=="symbol"?h:h+""}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),ha=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var i=FE();function n(a,c,h){return(c=i(c))in a?Object.defineProperty(a,c,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[c]=h,a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),bi=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var i=ha();function n(c,h){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(c);h&&(f=f.filter(function(m){return Object.getOwnPropertyDescriptor(c,m).enumerable})),d.push.apply(d,f)}return d}function a(c){for(var h=1;h<arguments.length;h++){var d=arguments[h]!=null?arguments[h]:{};h%2?n(Object(d),!0).forEach(function(f){i(c,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):n(Object(d)).forEach(function(f){Object.defineProperty(c,f,Object.getOwnPropertyDescriptor(d,f))})}return c}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});function xl(e){const t={subscribe(i){let n=null,a=!1,c=!1,h=!1;function d(){if(n===null){h=!0;return}c||(c=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=e({next(f){var m;a||(m=i.next)===null||m===void 0||m.call(i,f)},error(f){var m;a||(a=!0,(m=i.error)===null||m===void 0||m.call(i,f),d())},complete(){var f;a||(a=!0,(f=i.complete)===null||f===void 0||f.call(i),d())}}),h&&d(),{unsubscribe:d}},pipe(...i){return i.reduce(KE,t)}};return t}function KE(e,t){return t(e)}function $E(e){const t=new AbortController;return new Promise((n,a)=>{let c=!1;function h(){c||(c=!0,d.unsubscribe())}t.signal.addEventListener("abort",()=>{a(t.signal.reason)});const d=e.subscribe({next(f){c=!0,n(f),h()},error(f){a(f)},complete(){t.abort(),h()}})})}function WE(e){return t=>{let i=0,n=null;const a=[];function c(){n||(n=t.subscribe({next(d){for(const m of a){var f;(f=m.next)===null||f===void 0||f.call(m,d)}},error(d){for(const m of a){var f;(f=m.error)===null||f===void 0||f.call(m,d)}},complete(){for(const f of a){var d;(d=f.complete)===null||d===void 0||d.call(f)}}}))}function h(){if(i===0&&n){const d=n;n=null,d.unsubscribe()}}return xl(d=>(i++,a.push(d),c(),{unsubscribe(){i--,h();const f=a.findIndex(m=>m===d);f>-1&&a.splice(f,1)}}))}}function Wx(e){let t=e;const i=[],n=h=>{t!==void 0&&h.next(t),i.push(h)},a=h=>{i.splice(i.indexOf(h),1)},c=xl(h=>(n(h),()=>{a(h)}));return c.next=h=>{if(t!==h){t=h;for(const d of i)d.next(h)}},c.get=()=>t,c}function Vx(e){return xl(t=>{function i(a=0,c=e.op){const h=e.links[a];if(!h)throw new Error("No more links to execute - did you forget to add an ending link?");return h({op:c,next(f){return i(a+1,f)}})}return i().subscribe(t)})}function n0(e){return Array.isArray(e)?e:[e]}function VE(e){return t=>{const i=n0(e.true).map(a=>a(t)),n=n0(e.false).map(a=>a(t));return a=>xl(c=>{const h=e.condition(a.op)?i:n;return Vx({op:a.op,links:h}).subscribe(c)})}}function Io(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Yx(){return Object.create(null)}const Gx=e=>e(),Au={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},YE=[Au.BAD_GATEWAY,Au.SERVICE_UNAVAILABLE,Au.GATEWAY_TIMEOUT,Au.INTERNAL_SERVER_ERROR];var GE=Object.create,Qx=Object.defineProperty,QE=Object.getOwnPropertyDescriptor,Zx=Object.getOwnPropertyNames,ZE=Object.getPrototypeOf,XE=Object.prototype.hasOwnProperty,Si=(e,t)=>function(){return t||(0,e[Zx(e)[0]])((t={exports:{}}).exports,t),t.exports},JE=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Zx(t),c=0,h=a.length,d;c<h;c++)d=a[c],!XE.call(e,d)&&d!==i&&Qx(e,d,{get:(f=>t[f]).bind(null,d),enumerable:!(n=QE(t,d))||n.enumerable});return e},dt=(e,t,i)=>(i=e!=null?GE(ZE(e)):{},JE(Qx(i,"default",{value:e,enumerable:!0}),e));const Xx=()=>{},a0=e=>{Object.freeze&&Object.freeze(e)};function Jx(e,t,i){var n;const a=t.join(".");return(n=i[a])!==null&&n!==void 0||(i[a]=new Proxy(Xx,{get(c,h){if(!(typeof h!="string"||h==="then"))return Jx(e,[...t,h],i)},apply(c,h,d){const f=t[t.length-1];if(f==="valueOf"||f==="toString"||f==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let m={args:d,path:t};return f==="call"?m={args:d.length>=2?[d[1]]:[],path:t.slice(0,-1)}:f==="apply"&&(m={args:d.length>=2?d[1]:[],path:t.slice(0,-1)}),a0(m.args),a0(m.path),e(m)}})),i[a]}const eN=e=>Jx(e,[],Yx()),tN=e=>new Proxy(Xx,{get(t,i){if(i!=="then")return e(i)}});var ew=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function i(n){"@babel/helpers - typeof";return t.exports=i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},t.exports.__esModule=!0,t.exports.default=t.exports,i(n)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),sN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=ew().default;function n(a,c){if(i(a)!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var d=h.call(a,c||"default");if(i(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),iN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=ew().default,n=sN();function a(c){var h=n(c,"string");return i(h)=="symbol"?h:h+""}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),l_=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var i=iN();function n(a,c,h){return(c=i(c))in a?Object.defineProperty(a,c,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[c]=h,a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),rc=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var i=l_();function n(c,h){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(c);h&&(f=f.filter(function(m){return Object.getOwnPropertyDescriptor(c,m).enumerable})),d.push.apply(d,f)}return d}function a(c){for(var h=1;h<arguments.length;h++){var d=arguments[h]!=null?arguments[h]:{};h%2?n(Object(d),!0).forEach(function(f){i(c,f,d[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):n(Object(d)).forEach(function(f){Object.defineProperty(c,f,Object.getOwnPropertyDescriptor(d,f))})}return c}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(rc());dt(l_());var Ru=dt(rc());function rN(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Ru.default)((0,Ru.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Ru.default)((0,Ru.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var im=class extends Error{constructor(){super("Unable to transform response from server")}};function nN(e,t){let i;try{i=rN(e,t)}catch{throw new im}if(!i.ok&&(!Io(i.error.error)||typeof i.error.error.code!="number"))throw new im;if(i.ok&&!Io(i.result))throw new im;return i}dt(rc());dt(rc());var Mu=dt(l_());let tw;const rm=new WeakMap,aN=()=>{};tw=Symbol.toStringTag;var sw=class qn{constructor(t){(0,Mu.default)(this,"promise",void 0),(0,Mu.default)(this,"subscribers",[]),(0,Mu.default)(this,"settlement",null),(0,Mu.default)(this,tw,"Unpromise"),typeof t=="function"?this.promise=new Promise(t):this.promise=t;const i=this.promise.then(n=>{const{subscribers:a}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:n},a==null||a.forEach(({resolve:c})=>{c(n)})});"catch"in i&&i.catch(n=>{const{subscribers:a}=this;this.subscribers=null,this.settlement={status:"rejected",reason:n},a==null||a.forEach(({reject:c})=>{c(n)})})}subscribe(){let t,i;const{settlement:n}=this;if(n===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const a=oN();this.subscribers=cN(this.subscribers,a),t=a.promise,i=()=>{this.subscribers!==null&&(this.subscribers=hN(this.subscribers,a))}}else{const{status:a}=n;a==="fulfilled"?t=Promise.resolve(n.value):t=Promise.reject(n.reason),i=aN}return Object.assign(t,{unsubscribe:i})}then(t,i){const n=this.subscribe(),{unsubscribe:a}=n;return Object.assign(n.then(t,i),{unsubscribe:a})}catch(t){const i=this.subscribe(),{unsubscribe:n}=i;return Object.assign(i.catch(t),{unsubscribe:n})}finally(t){const i=this.subscribe(),{unsubscribe:n}=i;return Object.assign(i.finally(t),{unsubscribe:n})}static proxy(t){const i=qn.getSubscribablePromise(t);return typeof i<"u"?i:qn.createSubscribablePromise(t)}static createSubscribablePromise(t){const i=new qn(t);return rm.set(t,i),rm.set(i,i),i}static getSubscribablePromise(t){return rm.get(t)}static resolve(t){const i=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return qn.proxy(i).subscribe()}static async any(t){const n=(Array.isArray(t)?t:[...t]).map(qn.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:a})=>{a()})}}static async race(t){const n=(Array.isArray(t)?t:[...t]).map(qn.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:a})=>{a()})}}static async raceReferences(t){const i=t.map(lN);try{return await Promise.race(i)}finally{for(const n of i)n.unsubscribe()}}};function lN(e){return sw.proxy(e).then(()=>[e])}function oN(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}function cN(e,t){return[...e,t]}function uN(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function hN(e,t){const i=e.indexOf(t);return i!==-1?uN(e,i):e}var l0,o0,c0,u0;(o0=(l0=Symbol).dispose)!==null&&o0!==void 0||(l0.dispose=Symbol());(u0=(c0=Symbol).asyncDispose)!==null&&u0!==void 0||(c0.asyncDispose=Symbol());function dN(e,t){const i=e,n=i[Symbol.dispose];return i[Symbol.dispose]=()=>{t(),n==null||n()},i}function fN(e,t){const i=e,n=i[Symbol.asyncDispose];return i[Symbol.asyncDispose]=async()=>{await t(),await(n==null?void 0:n())},i}const iw=Symbol();function mN(e){let t=null;return dN({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(iw),e)})}},()=>{t&&clearTimeout(t)})}var nc=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function i(){var n=typeof SuppressedError=="function"?SuppressedError:function(d,f){var m=Error();return m.name="SuppressedError",m.error=d,m.suppressed=f,m},a={},c=[];function h(d,f){if(f!=null){if(Object(f)!==f)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var m=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=f[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var g=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");g&&(m=function(){try{g.call(f)}catch(b){return Promise.reject(b)}}),c.push({v:f,d:m,a:d})}else d&&c.push({d:f,a:d});return f}return{e:a,u:h.bind(null,!1),a:h.bind(null,!0),d:function(){var f,m=this.e,g=0;function v(){for(;f=c.pop();)try{if(!f.a&&g===1)return g=0,c.push(f),Promise.resolve().then(v);if(f.d){var S=f.d.call(f.v);if(f.a)return g|=2,Promise.resolve(S).then(v,b)}else g|=1}catch(x){return b(x)}if(g===1)return m!==a?Promise.reject(m):Promise.resolve();if(m!==a)throw m}function b(S){return m=m!==a?new n(S,m):S,v()}return v()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),o_=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function i(n,a){this.v=n,this.k=a}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),ac=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=o_();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),wl=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=o_();function n(c){return function(){return new a(c.apply(this,arguments))}}function a(c){var h,d;function f(g,v){try{var b=c[g](v),S=b.value,x=S instanceof i;Promise.resolve(x?S.v:S).then(function(C){if(x){var k=g==="return"?"return":"next";if(!S.k||C.done)return f(k,C);C=c[k](C).value}m(b.done?"return":"normal",C)},function(C){f("throw",C)})}catch(C){m("throw",C)}}function m(g,v){switch(g){case"return":h.resolve({value:v,done:!0});break;case"throw":h.reject(v);break;default:h.resolve({value:v,done:!1})}(h=h.next)?f(h.key,h.arg):d=null}this._invoke=function(g,v){return new Promise(function(b,S){var x={key:g,arg:v,resolve:b,reject:S,next:null};d?d=d.next=x:(h=d=x,f(g,v))})},typeof c.return!="function"&&(this.return=void 0)}a.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(c){return this._invoke("next",c)},a.prototype.throw=function(c){return this._invoke("throw",c)},a.prototype.return=function(c){return this._invoke("return",c)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(nc());dt(ac());dt(wl());dt(nc());dt(ac());dt(wl());dt(nc());dt(ac());dt(wl());var rw=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function i(a){var c,h,d,f=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,d=Symbol.iterator);f--;){if(h&&(c=a[h])!=null)return c.call(a);if(d&&(c=a[d])!=null)return new n(c.call(a));h="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function n(a){function c(h){if(Object(h)!==h)return Promise.reject(new TypeError(h+" is not an object."));var d=h.done;return Promise.resolve(h.value).then(function(f){return{value:f,done:d}})}return n=function(d){this.s=d,this.n=d.next},n.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var f=this.s.return;return f===void 0?Promise.resolve({value:d,done:!0}):c(f.apply(this.s,arguments))},throw:function(d){var f=this.s.return;return f===void 0?Promise.reject(d):c(f.apply(this.s,arguments))}},new n(a)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(ac());dt(wl());dt(nc());dt(rw());var pN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(e,t){var i=o_();function n(a){var c={},h=!1;function d(f,m){return h=!0,m=new Promise(function(g){g(a[f](m))}),{done:!1,value:new i(m,1)}}return c[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},c.next=function(f){return h?(h=!1,f):d("next",f)},typeof a.throw=="function"&&(c.throw=function(f){if(h)throw h=!1,f;return d("throw",f)}),typeof a.return=="function"&&(c.return=function(f){return h?(h=!1,f):d("return",f)}),c}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(rw());var h0=dt(ac()),_N=dt(wl());dt(pN());var nw=dt(nc());const gN="ping",vN="serialized-error",yN="connected",bN="return";async function SN(e){try{var t=(0,nw.default)();const i=t.u(mN(e.timeoutMs)),n=await sw.race([e.promise,i.start()]);return n===iw?await e.onTimeout():n}catch(i){t.e=i}finally{t.d()}}function xN(e){const{deserialize:t=d=>d}=e;let i=Yx();const n=e.signal;let a=null;const c=()=>new ReadableStream({async start(d){const[f,m]=await Promise.all([e.url(),e.init()]),g=a=new e.EventSource(f,m);d.enqueue({type:"connecting",eventSource:a,event:null}),g.addEventListener(yN,b=>{const x=JSON.parse(b.data);i=x,d.enqueue({type:"connected",options:x,eventSource:g})}),g.addEventListener(vN,b=>{const S=b;d.enqueue({type:"serialized-error",error:t(JSON.parse(S.data)),eventSource:g})}),g.addEventListener(gN,()=>{d.enqueue({type:"ping",eventSource:g})}),g.addEventListener(bN,()=>{g.close(),d.close(),a=null}),g.addEventListener("error",b=>{g.readyState===g.CLOSED?d.error(b):d.enqueue({type:"connecting",eventSource:g,event:b})}),g.addEventListener("message",b=>{const S=b,C={data:t(JSON.parse(S.data))};S.lastEventId&&(C.id=S.lastEventId),d.enqueue({type:"data",data:C,eventSource:g})});const v=()=>{try{g.close(),d.close()}catch{}};n.aborted?v():n.addEventListener("abort",v)},cancel(){a==null||a.close()}}),h=()=>{let d=c(),f=d.getReader();async function m(){await f.cancel(),a=null}return fN({read(){return f.read()},async recreate(){await m(),d=c(),f=d.getReader()}},m)};return Gx((0,_N.default)(function*(){try{var d=(0,nw.default)();const f=d.a(h());for(;;){let m=f.read();const g=i.reconnectAfterInactivityMs;g&&(m=SN({promise:m,timeoutMs:g,onTimeout:async()=>{const b={value:{type:"timeout",ms:g,eventSource:a},done:!1};return await f.recreate(),b}}));const v=yield(0,h0.default)(m);if(v.done)return v.value;yield v.value}}catch(f){d.e=f}finally{yield(0,h0.default)(d.d())}}))}dt(wl());dt(rc());var Du=Ot(ha(),1),Xa=Ot(bi(),1);function wN(e){return e instanceof un}function CN(e){return Io(e)&&Io(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function jN(e,t){return typeof e=="string"?e:Io(e)&&typeof e.message=="string"?e.message:t}var un=class Zu extends Error{constructor(t,i){var n,a;const c=i==null?void 0:i.cause;super(t,{cause:c}),(0,Du.default)(this,"cause",void 0),(0,Du.default)(this,"shape",void 0),(0,Du.default)(this,"data",void 0),(0,Du.default)(this,"meta",void 0),this.meta=i==null?void 0:i.meta,this.cause=c,this.shape=i==null||(n=i.result)===null||n===void 0?void 0:n.error,this.data=i==null||(a=i.result)===null||a===void 0?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Zu.prototype)}static from(t,i={}){const n=t;return wN(n)?(i.meta&&(n.meta=(0,Xa.default)((0,Xa.default)({},n.meta),i.meta)),n):CN(n)?new Zu(n.error.message,(0,Xa.default)((0,Xa.default)({},i),{},{result:n,cause:i.cause})):new Zu(jN(n,"Unknown error"),(0,Xa.default)((0,Xa.default)({},i),{},{cause:n}))}};function aw(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:i=>i,deserialize:i=>i},output:{serialize:i=>i,deserialize:i=>i}}}const d0=e=>typeof e=="function";function kN(e){if(e)return e;if(typeof window<"u"&&d0(window.fetch))return window.fetch;if(typeof globalThis<"u"&&d0(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var zo=Ot(bi());function EN(e){return{url:e.url.toString(),fetch:e.fetch,transformer:aw(e.transformer),methodOverride:e.methodOverride}}function NN(e){const t={};for(let i=0;i<e.length;i++){const n=e[i];t[i]=n}return t}const TN={query:"GET",mutation:"POST",subscription:"PATCH"};function lw(e){return"input"in e?e.transformer.input.serialize(e.input):NN(e.inputs.map(t=>e.transformer.input.serialize(t)))}const c_=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const a=[];if(t[1]&&a.push(t[1]),"inputs"in e&&a.push("batch=1"),e.type==="query"||e.type==="subscription"){const c=lw(e);c!==void 0&&e.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(c))}`)}return a.length&&(n+="?"+a.join("&")),n},ON=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=lw(e);return t!==void 0?JSON.stringify(t):void 0},AN=e=>BN((0,zo.default)((0,zo.default)({},e),{},{contentTypeHeader:"application/json",getUrl:c_,getBody:ON}));var RN=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const MN=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new RN};async function DN(e){var t,i;MN(e.signal);const n=e.getUrl(e),a=e.getBody(e),c=(t=e.methodOverride)!==null&&t!==void 0?t:TN[e.type],h=await(async()=>{const f=await e.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),d=(0,zo.default)((0,zo.default)((0,zo.default)({},e.contentTypeHeader&&c!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(i=e.trpcAcceptHeaderKey)!==null&&i!==void 0?i:"trpc-accept"]:e.trpcAcceptHeader}:void 0),h);return kN(e.fetch)(n,{method:c,signal:e.signal,body:a,headers:d})}async function BN(e){const t={},i=await DN(e);t.response=i;const n=await i.json();return t.responseJSON=n,{json:n,meta:t}}Ot(bi(),1);const f0=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function m0(e){let t=null,i=null;const n=()=>{clearTimeout(i),i=null,t=null};function a(d){const f=[[]];let m=0;for(;;){const b=d[m];if(!b)break;const S=f[f.length-1];if(b.aborted){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Aborted")),m++;continue}if(e.validate(S.concat(b).map(C=>C.key))){S.push(b),m++;continue}if(S.length===0){var v;(v=b.reject)===null||v===void 0||v.call(b,new Error("Input is too big for a single dispatch")),m++;continue}f.push([])}return f}function c(){const d=a(t);n();for(const f of d){if(!f.length)continue;const m={items:f};for(const v of f)v.batch=m;e.fetch(m.items.map(v=>v.key)).then(async v=>{await Promise.all(v.map(async(S,x)=>{const C=m.items[x];try{var k;const L=await Promise.resolve(S);(k=C.resolve)===null||k===void 0||k.call(C,L)}catch(L){var N;(N=C.reject)===null||N===void 0||N.call(C,L)}C.batch=null,C.reject=null,C.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(v=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,v),S.batch=null}})}}function h(d){var f;const m={aborted:!1,key:d,batch:null,resolve:f0,reject:f0},g=new Promise((v,b)=>{var S;m.reject=b,m.resolve=v,(S=t)!==null&&S!==void 0||(t=[]),t.push(m)});return(f=i)!==null&&f!==void 0||(i=setTimeout(c)),g}return{load:h}}function LN(...e){const t=new AbortController,i=e.length;let n=0;const a=()=>{++n===i&&t.abort()};for(const c of e)c!=null&&c.aborted?a():c==null||c.addEventListener("abort",a,{once:!0});return t.signal}function zN(...e){const t=new AbortController;for(const i of e)i!=null&&i.aborted?t.abort():i==null||i.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}var Bu=Ot(bi(),1);function qN(e){var t,i;const n=EN(e),a=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,c=(i=e.maxItems)!==null&&i!==void 0?i:1/0;return()=>{const h=g=>({validate(v){if(a===1/0&&c===1/0)return!0;if(v.length>c)return!1;const b=v.map(C=>C.path).join(","),S=v.map(C=>C.input);return c_((0,Bu.default)((0,Bu.default)({},n),{},{type:g,path:b,inputs:S,signal:null})).length<=a},async fetch(v){const b=v.map(L=>L.path).join(","),S=v.map(L=>L.input),x=LN(...v.map(L=>L.signal)),C=await AN((0,Bu.default)((0,Bu.default)({},n),{},{path:b,inputs:S,type:g,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:v}):e.headers:{}},signal:x}));return(Array.isArray(C.json)?C.json:v.map(()=>C.json)).map(L=>({meta:C.meta,json:L}))}}),d=m0(h("query")),f=m0(h("mutation")),m={query:d,mutation:f};return({op:g})=>xl(v=>{/* istanbul ignore if -- @preserve */if(g.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[g.type].load(g);let x;return S.then(C=>{x=C;const k=nN(C.json,n.transformer.output);if(!k.ok){v.error(un.from(k.error,{meta:C.meta}));return}v.next({context:C.meta,result:k.result}),v.complete()}).catch(C=>{v.error(un.from(C,{meta:x==null?void 0:x.meta}))}),()=>{}})}}Ot(bi(),1);const Uo=(e,...t)=>typeof e=="function"?e(...t):e;Ot(ha(),1);function PN(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}async function HN(e){const t=await Uo(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}async function IN(e,t){const i={method:"connectionParams",data:await Uo(e)};return t.encode(i)}Ot(ha(),1);var Gr=Ot(ha(),1);function UN(e){const{promise:t,resolve:i,reject:n}=PN();return e.addEventListener("open",()=>{e.removeEventListener("error",n),i()}),e.addEventListener("error",n),t}function FN(e,{intervalMs:t,pongTimeoutMs:i}){let n,a;function c(){n=setTimeout(()=>{e.send("PING"),a=setTimeout(()=>{e.close()},i)},t)}function h(){clearTimeout(n),c()}function d(){clearTimeout(a),h()}e.addEventListener("open",c),e.addEventListener("message",({data:f})=>{clearTimeout(n),c(),f==="PONG"&&d()}),e.addEventListener("close",()=>{clearTimeout(n),clearTimeout(a)})}var KN=class Qm{constructor(t){var i;if((0,Gr.default)(this,"id",++Qm.connectCount),(0,Gr.default)(this,"WebSocketPonyfill",void 0),(0,Gr.default)(this,"urlOptions",void 0),(0,Gr.default)(this,"keepAliveOpts",void 0),(0,Gr.default)(this,"encoder",void 0),(0,Gr.default)(this,"wsObservable",Wx(null)),(0,Gr.default)(this,"openPromise",null),this.WebSocketPonyfill=(i=t.WebSocketPonyfill)!==null&&i!==void 0?i:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var t=this;if(t.openPromise)return t.openPromise;t.id=++Qm.connectCount;const i=HN(t.urlOptions).then(n=>new t.WebSocketPonyfill(n));t.openPromise=i.then(async n=>{t.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:a}){a==="PING"&&this.send("PONG")}),t.keepAliveOpts.enabled&&FN(n,t.keepAliveOpts),n.addEventListener("close",()=>{t.ws===n&&(t.ws=null)}),await UN(n),t.urlOptions.connectionParams&&n.send(await IN(t.urlOptions.connectionParams,t.encoder))});try{await t.openPromise}finally{t.openPromise=null}}async close(){var t=this;try{await t.openPromise}finally{var i;(i=t.ws)===null||i===void 0||i.close()}}};(0,Gr.default)(KN,"connectCount",0);Ot(ha(),1);Ot(bi(),1);var nm=Ot(ha(),1),p0=Ot(bi(),1),$N=class{constructor(e){(0,nm.default)(this,"links",void 0),(0,nm.default)(this,"runtime",void 0),(0,nm.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Vx({links:this.links,op:(0,p0.default)((0,p0.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(WE())}async requestAsPromise(e){var t=this;try{const i=t.$request(e);return(await $E(i)).result.data}catch(i){throw un.from(i)}}query(e,t,i){return this.requestAsPromise({type:"query",path:e,input:t,context:i==null?void 0:i.context,signal:i==null?void 0:i.signal})}mutation(e,t,i){return this.requestAsPromise({type:"mutation",path:e,input:t,context:i==null?void 0:i.context,signal:i==null?void 0:i.signal})}subscription(e,t,i){return this.$request({type:"subscription",path:e,input:t,context:i.context,signal:i.signal}).subscribe({next(a){switch(a.result.type){case"state":{var c;(c=i.onConnectionStateChange)===null||c===void 0||c.call(i,a.result);break}case"started":{var h;(h=i.onStarted)===null||h===void 0||h.call(i,{context:a.context});break}case"stopped":{var d;(d=i.onStopped)===null||d===void 0||d.call(i);break}case"data":case void 0:{var f;(f=i.onData)===null||f===void 0||f.call(i,a.result.data);break}}},error(a){var c;(c=i.onError)===null||c===void 0||c.call(i,a)},complete(){var a;(a=i.onComplete)===null||a===void 0||a.call(i)}})}};const WN=Symbol.for("trpc_untypedClient"),VN={query:"query",mutate:"mutation",subscribe:"subscription"},YN=e=>VN[e];function GN(e){const t=eN(({path:i,args:n})=>{const a=[...i],c=YN(a.pop()),h=a.join(".");return e[c](h,...n)});return tN(i=>i===WN?e:t[i])}function QN(e){const t=new $N(e);return GN(t)}Ot(bi(),1);var _0=Ot(bi(),1);function ZN(e,t){return!t||e!=null&&typeof e!="object"?e:(0,_0.default)((0,_0.default)({},e??{}),{},{lastEventId:t})}var XN=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function i(a){var c,h,d,f=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,d=Symbol.iterator);f--;){if(h&&(c=a[h])!=null)return c.call(a);if(d&&(c=a[d])!=null)return new n(c.call(a));h="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function n(a){function c(h){if(Object(h)!==h)return Promise.reject(new TypeError(h+" is not an object."));var d=h.done;return Promise.resolve(h.value).then(function(f){return{value:f,done:d}})}return n=function(d){this.s=d,this.n=d.next},n.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var f=this.s.return;return f===void 0?Promise.resolve({value:d,done:!0}):c(f.apply(this.s,arguments))},throw:function(d){var f=this.s.return;return f===void 0?Promise.reject(d):c(f.apply(this.s,arguments))}},new n(a)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),JN=Ot(XN(),1);async function e2(e){let t=await Uo(e.url);if(e.connectionParams){const i=await Uo(e.connectionParams),n=t.includes("?")?"&":"?";t+=n+"connectionParams="+encodeURIComponent(JSON.stringify(i))}return t}function t2(e){const t=aw(e.transformer);return()=>({op:i})=>xl(n=>{var a;const{type:c,path:h,input:d}=i;/* istanbul ignore if -- @preserve */if(c!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let f;const m=new AbortController,g=zN(i.signal,m.signal),v=xN({url:async()=>c_({transformer:t,url:await e2(e),input:ZN(d,f),path:h,type:c,signal:null}),init:()=>Uo(e.eventSourceOptions,{op:i}),signal:g,deserialize:x=>t.output.deserialize(x),EventSource:(a=e.EventSource)!==null&&a!==void 0?a:globalThis.EventSource}),b=Wx({type:"state",state:"connecting",error:null}),S=b.subscribe({next(x){n.next({result:x})}});return Gx(async()=>{var x=!1,C=!1,k;try{for(var N=(0,JN.default)(v),L;x=!(L=await N.next()).done;x=!1){const D=L.value;switch(D.type){case"ping":break;case"data":const M=D.data;let Y;M.id?(f=M.id,Y={id:M.id,data:M}):Y={data:M.data},n.next({result:Y,context:{eventSource:D.eventSource}});break;case"connected":{n.next({result:{type:"started"},context:{eventSource:D.eventSource}}),b.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const Z=un.from({error:D.error});if(YE.includes(D.error.code)){b.next({type:"state",state:"connecting",error:Z});break}throw Z}case"connecting":{const Z=b.get(),W=D.event&&un.from(D.event);if(!W&&Z.state==="connecting")break;b.next({type:"state",state:"connecting",error:W});break}case"timeout":b.next({type:"state",state:"connecting",error:new un(`Timeout of ${D.ms}ms reached while waiting for a response`)})}}}catch(D){C=!0,k=D}finally{try{x&&N.return!=null&&await N.return()}finally{if(C)throw k}}n.next({result:{type:"stopped"}}),b.next({type:"state",state:"idle",error:null}),n.complete()}).catch(x=>{n.error(un.from(x))}),()=>{n.complete(),m.abort(),S.unsubscribe()}})}Ot(bi(),1);var s2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function i(){var n=typeof SuppressedError=="function"?SuppressedError:function(d,f){var m=Error();return m.name="SuppressedError",m.error=d,m.suppressed=f,m},a={},c=[];function h(d,f){if(f!=null){if(Object(f)!==f)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var m=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=f[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var g=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");g&&(m=function(){try{g.call(f)}catch(b){return Promise.reject(b)}}),c.push({v:f,d:m,a:d})}else d&&c.push({d:f,a:d});return f}return{e:a,u:h.bind(null,!1),a:h.bind(null,!0),d:function(){var f,m=this.e,g=0;function v(){for(;f=c.pop();)try{if(!f.a&&g===1)return g=0,c.push(f),Promise.resolve().then(v);if(f.d){var S=f.d.call(f.v);if(f.a)return g|=2,Promise.resolve(S).then(v,b)}else g|=1}catch(x){return b(x)}if(g===1)return m!==a?Promise.reject(m):Promise.resolve();if(m!==a)throw m}function b(S){return m=m!==a?new n(S,m):S,v()}return v()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),ow=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function i(n,a){this.v=n,this.k=a}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),i2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=ow();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),r2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=ow();function n(c){return function(){return new a(c.apply(this,arguments))}}function a(c){var h,d;function f(g,v){try{var b=c[g](v),S=b.value,x=S instanceof i;Promise.resolve(x?S.v:S).then(function(C){if(x){var k=g==="return"?"return":"next";if(!S.k||C.done)return f(k,C);C=c[k](C).value}m(b.done?"return":"normal",C)},function(C){f("throw",C)})}catch(C){m("throw",C)}}function m(g,v){switch(g){case"return":h.resolve({value:v,done:!0});break;case"throw":h.reject(v);break;default:h.resolve({value:v,done:!1})}(h=h.next)?f(h.key,h.arg):d=null}this._invoke=function(g,v){return new Promise(function(b,S){var x={key:g,arg:v,resolve:b,reject:S,next:null};d?d=d.next=x:(h=d=x,f(g,v))})},typeof c.return!="function"&&(this.return=void 0)}a.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(c){return this._invoke("next",c)},a.prototype.throw=function(c){return this._invoke("throw",c)},a.prototype.return=function(c){return this._invoke("return",c)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});Ot(s2(),1);Ot(i2(),1);Ot(r2(),1);Ot(bi(),1);const ie=QN({links:[VE({condition:e=>e.type==="subscription",true:t2({url:"/trpc"}),false:qN({url:"/trpc"})})]}),n2={connecting:"conectando",counting:"contando objetos",compressing:"comprimindo",receiving:"recebendo objetos",resolving:"resolvendo deltas",checkout:"preparando arquivos"},a2=new Set(["done","failed","cancelled"]);function ah(e){return a2.has(e)}function l2(e){const t=Ne({queryKey:nh(e),queryFn:()=>ie.project.cloneJobs.query({workspaceId:e})});return o2(t.data??[])}function o2(e){const t=e.find(i=>!ah(i.state));return t!==void 0?t:e.reduce((i,n)=>i===null||n.updatedAt>i.updatedAt?n:i,null)}function c2(e){const t=We(),i=l2(e),n=i!==null&&!ah(i.state)?i.id:null;return j.useEffect(()=>{if(n===null)return;const a=ie.project.cloneProgress.subscribe({jobId:n},{onData:c=>{const h=c;t.setQueryData(nh(e),d=>[...(d??[]).filter(m=>m.id!==h.id),h])}});return()=>a.unsubscribe()},[n,e,t]),i}const u2={info:"◆",warning:"⚠",danger:"⚠"};function Ae({tone:e,children:t,actions:i}){return o.jsxs("div",{className:`banner banner--${e}`,role:e==="danger"?"alert":"status",children:[o.jsx("span",{className:"banner__glyph","aria-hidden":"true",children:u2[e]}),o.jsx("span",{children:t}),i!==void 0&&o.jsx("span",{className:"banner__actions",children:i})]})}function de({variant:e="default",size:t="md",glyph:i,className:n,children:a,type:c="button",...h}){const d=["btn",e==="default"?"":`btn--${e}`,t==="sm"?"btn--sm":"",n??""].filter(Boolean).join(" ");return o.jsxs("button",{type:c,className:d,...h,children:[i,a]})}function cw({title:e,lede:t,children:i}){return o.jsxs("div",{className:"card",children:[e!==void 0&&o.jsx("h2",{className:"card__title",children:e}),t!==void 0&&o.jsx("p",{className:"card__lede",children:t}),i]})}const h2={ok:"✓",warn:"⚠",fail:"✕",running:"◐"};function Ys({state:e,what:t,value:i,status:n,action:a}){return o.jsxs("div",{className:`ck ck--${e}`,children:[o.jsx("span",{className:"ck__glyph","aria-hidden":"true",children:h2[e]}),o.jsx("span",{className:"ck__what",children:t}),o.jsx("span",{className:"ck__val",children:i}),o.jsx("span",{className:"ck__st",children:n}),a!==void 0&&o.jsx("span",{className:"ck__act",children:a})]})}function Fo({label:e,children:t}){return o.jsx("div",{className:"check",role:"group","aria-label":e,children:t})}function as({tone:e="neutral",dot:t=!1,children:i}){const n=e==="neutral"?"":` chip--${e}`;return o.jsxs("span",{className:`chip${n}`,children:[t&&o.jsx("span",{className:"chip__dot","aria-hidden":"true"}),i]})}function g0({title:e,description:t,meta:i,glyph:n,selected:a,onSelect:c,disabled:h=!1}){return o.jsxs("button",{type:"button",role:"radio","aria-checked":a,className:`choice${a?" is-on":""}`,disabled:h,onClick:c,children:[o.jsxs("span",{className:"choice__top",children:[n,o.jsx("span",{className:"choice__t",children:e}),o.jsx("span",{className:"choice__mark","aria-hidden":"true",children:a?"◉":"○"})]}),t!==void 0&&o.jsx("span",{className:"choice__d",children:t}),i!==void 0&&o.jsx("span",{className:"choice__meta",children:i})]})}function d2({label:e,columns:t=2,children:i}){return o.jsx("div",{className:`choices${t===2?" choices--2":""}`,role:"radiogroup","aria-label":e,children:i})}function f2({title:e,children:t,onUnderstood:i,onNever:n}){return o.jsxs("div",{className:"coach",role:"note",children:[o.jsxs("span",{className:"coach__t",children:[o.jsx("span",{"aria-hidden":"true",children:"◆"}),e]}),o.jsx("span",{className:"coach__b",children:t}),o.jsxs("span",{className:"coach__acts",children:[o.jsx(de,{size:"sm",variant:"primary",onClick:i,children:"entendi"}),n!==void 0&&o.jsx(de,{size:"sm",variant:"ghost",onClick:n,children:"não mostrar de novo"})]})]})}function u_({command:e}){const[t,i]=j.useState(!1);j.useEffect(()=>i(!1),[e]),j.useEffect(()=>{if(!t)return;const a=setTimeout(()=>i(!1),1500);return()=>clearTimeout(a)},[t]);const n=navigator.clipboard;return o.jsxs("div",{className:"copy",children:[o.jsx("code",{className:"copy__cmd",children:e}),n!==void 0&&o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>{n.writeText(e).then(()=>i(!0),()=>i(!1))},children:t?"copiado":"copiar"})]})}function uw({path:e}){const[t,i]=j.useState(!1);j.useEffect(()=>i(!1),[e]),j.useEffect(()=>{if(!t)return;const a=setTimeout(()=>i(!1),1500);return()=>clearTimeout(a)},[t]);const n=navigator.clipboard;return o.jsxs("span",{className:"path",children:[o.jsx("span",{className:"path__value",children:e}),n!==void 0&&o.jsx("button",{type:"button",className:"path__copy","aria-label":t?"caminho copiado":"copiar caminho",onClick:()=>{n.writeText(e).then(()=>i(!0),()=>i(!1))},children:o.jsx("span",{"aria-hidden":"true",children:t?"✓":"⧉"})})]})}function ms({title:e,children:t,action:i}){return o.jsxs("div",{className:"empty",children:[o.jsx("span",{className:"empty__title",children:e}),t!==void 0&&o.jsx("span",{children:t}),i]})}function di({widths:e=["70%","40%","100%","70%"],label:t="carregando"}){return o.jsx("div",{role:"status","aria-label":t,children:e.map((i,n)=>o.jsx("div",{className:"skeleton",style:{width:i}},n))})}function Xt({id:e,label:t,error:i,children:n}){return o.jsxs("div",{className:"field",children:[o.jsx("label",{className:"field__label",htmlFor:e,children:t}),n,i!==void 0&&o.jsx("span",{className:"field__error",id:`${e}-error`,role:"alert",children:i})]})}function cs({invalid:e=!1,className:t,id:i,...n}){const a=["input",e?"input--error":"",t??""].filter(Boolean).join(" ");return o.jsx("input",{id:i,className:a,"aria-invalid":e||void 0,"aria-describedby":e&&i!==void 0?`${i}-error`:void 0,...n})}function Qe({tone:e="none",children:t}){const i=e==="none"?"":` glyph--${e}`;return o.jsx("span",{className:`glyph${i}`,"aria-hidden":"true",children:t})}function hw({name:e,glyph:t,detail:i,state:n,age:a,onSelect:c,action:h}){const d=o.jsxs(o.Fragment,{children:[t,o.jsx("span",{className:"item__name",children:e}),i!==void 0&&o.jsx("span",{className:"item__detail",title:i,children:i}),n!==void 0&&o.jsx("span",{className:`item__state state--${n.tone}`,children:n.label}),a!==void 0&&o.jsx("span",{className:"item__age",children:a})]});return o.jsxs("div",{className:"item",children:[c===void 0?o.jsx("span",{className:"item__main",children:d}):o.jsx("button",{type:"button",className:"item__main",onClick:c,children:d}),h!==void 0&&o.jsx("span",{className:"item__act",children:h})]})}function h_({label:e,children:t}){return o.jsx("div",{className:"menu",role:"menu","aria-label":e,children:t})}function hn({children:e,onSelect:t,glyph:i,hint:n,disabled:a=!1}){return o.jsxs("button",{type:"button",role:"menuitem",className:"menu__item",disabled:a,onClick:t,children:[i,e,n!==void 0&&o.jsx("span",{className:"menu__hint",children:n})]})}const v0='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function dw({open:e,title:t,where:i,onClose:n,dismissible:a=!0,reason:c,footer:h,children:d}){const f=j.useRef(null),m=j.useRef(null);if(j.useEffect(()=>{var b;if(!e)return;m.current=document.activeElement;const v=(b=f.current)==null?void 0:b.querySelector(v0);return v==null||v.focus(),()=>{var S;(S=m.current)==null||S.focus(),m.current=null}},[e]),j.useEffect(()=>{if(!e)return;const v=b=>{var N,L;if(b.key==="Escape"){if(!a)return;b.preventDefault(),n();return}if(b.key!=="Tab")return;const S=[...((N=f.current)==null?void 0:N.querySelectorAll(v0))??[]];if(S.length===0)return;const x=S[0],C=S[S.length-1],k=document.activeElement;b.shiftKey&&(k===x||!((L=f.current)!=null&&L.contains(k)))?(b.preventDefault(),C.focus()):!b.shiftKey&&k===C&&(b.preventDefault(),x.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,a,n]),!e)return null;const g=`modal-title-${t.replace(/\s+/g,"-").toLowerCase()}`;return o.jsxs("div",{className:"modal",children:[o.jsx("div",{className:"modal__scrim","aria-hidden":"true",onClick:a?n:void 0}),o.jsxs("div",{className:"modal__card",ref:f,role:"dialog","aria-modal":"true","aria-labelledby":g,children:[o.jsx("div",{className:"modal__head",children:o.jsxs("div",{className:"modal__head-b",children:[o.jsx("h3",{className:"modal__t",id:g,children:t}),i!==void 0&&o.jsx("p",{className:"modal__where",children:i})]})}),o.jsx("div",{className:"modal__body",children:d}),o.jsxs("div",{className:"modal__foot",children:[h,o.jsx("span",{className:a?"modal__esc":"modal__esc modal__esc--held",children:a?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"kbd",children:"Esc"})," fecha"]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"kbd",children:"Esc"})," ",c??"não fecha agora"]})})]}),o.jsx("button",{type:"button",className:"modal__close","aria-label":"fechar",disabled:!a,onClick:n,children:"✕"})]})]})}function da({entries:e,variant:t="meta"}){return t==="recap"?o.jsx("dl",{className:"recap",children:e.map(i=>o.jsxs("div",{className:"recap__r",children:[o.jsx("dt",{className:"recap__k",children:i.label}),o.jsx("dd",{className:"recap__v",title:i.title,children:i.value})]},i.label))}):o.jsx("dl",{className:"meta",children:e.map(i=>o.jsxs(j.Fragment,{children:[o.jsx("dt",{children:i.label}),o.jsx("dd",{title:i.title,children:i.value})]},i.label))})}function d_({depth:e,label:t,onSelect:i,selected:n=!1,muted:a=!1,emphasis:c=!1,expanded:h,onToggle:d,glyph:f,meta:m,count:g,countTone:v="running",action:b,reserveAction:S=!1}){const x=["row",n?"row--selected":"",a?"row--muted":"",c?"row--emphasis":""].filter(Boolean).join(" "),C=h!==void 0&&d!==void 0;return o.jsxs("div",{className:x,style:{"--depth":e},children:[C?o.jsx("button",{type:"button",className:"row__twist","aria-expanded":h,"aria-label":`${h?"recolher":"expandir"} ${t}`,onClick:d,children:o.jsx("span",{"aria-hidden":"true",children:h?"▾":"▸"})}):o.jsx("span",{className:"row__twist row__twist--empty","aria-hidden":"true"}),o.jsxs("button",{type:"button",className:"row__main","aria-current":n,onClick:i,children:[f,o.jsx("span",{className:"row__label",children:t}),m!==void 0&&o.jsx("span",{className:"row__meta",children:m}),g!==void 0&&g>0&&o.jsxs("span",{className:`row__count row__count--${v}`,children:[o.jsx("span",{className:"row__count__dot","aria-hidden":"true"}),g,o.jsx("span",{className:"sr-only",children:v==="asking"?g===1?" sessão esperando permissão":" sessões esperando permissão":g===1?" sessão rodando":" sessões rodando"})]})]}),b??(S?o.jsx("span",{className:"row__slot","aria-hidden":"true"}):null)]})}function kh({title:e,count:t,aside:i}){return o.jsxs("div",{className:"section-head",children:[o.jsx("span",{className:"section-head__title",children:e}),t!==void 0&&o.jsx("span",{className:"section-head__count",children:t}),i!==void 0&&o.jsx("span",{className:"section-head__aside",children:i})]})}function m2({steps:e,current:t}){return o.jsx("div",{className:"steps","aria-hidden":"true",children:e.map((i,n)=>{const a=n<t?" steps__i--done":n===t?" steps__i--now":"";return o.jsxs(j.Fragment,{children:[o.jsxs("span",{className:`steps__i${a}`,children:[o.jsx("span",{className:"steps__n",children:n<t?"✓":n+1}),o.jsx("span",{className:"steps__l",children:i})]}),n<e.length-1&&o.jsx("span",{className:"steps__bar"})]},i)})})}function y0({label:e,onSelect:t,glyph:i,ordinal:n,active:a=!1,state:c,stateLabel:h,note:d,onClose:f}){return o.jsxs("div",{className:`tab-item${a?" tab-item--active":""}`,children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":a,className:"tab-item__main",onClick:t,children:[i,o.jsx("span",{className:"tab-item__label",children:e}),n!==void 0&&o.jsx("span",{className:"tab-item__ord",children:n}),d!==void 0&&o.jsx("span",{className:"tab-item__note",children:d}),c!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`tab-item__dot tab-item__dot--${c}`}),h!==void 0&&o.jsx("span",{className:"sr-only",children:h})]})]}),f!==void 0&&o.jsx("button",{type:"button",className:"tab-item__close","aria-label":`fechar ${e}`,onClick:f,children:o.jsx("span",{"aria-hidden":"true",children:"✕"})})]})}function p2({label:e,lead:t,children:i,action:n,end:a}){return o.jsxs("div",{className:"tabs-bar",role:"tablist","aria-label":e,children:[t!==void 0&&o.jsxs(o.Fragment,{children:[t,o.jsx("span",{className:"tabs-bar__sep","aria-hidden":"true"})]}),o.jsx("div",{className:"tabs-bar__scroll",children:i}),n!==void 0&&o.jsx("span",{className:"tabs-bar__action",children:n}),a!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"tabs-bar__sep","aria-hidden":"true"}),o.jsx("span",{className:"tabs-bar__end",children:a})]})]})}function _2({label:e,pressed:t,onToggle:i,children:n}){return o.jsx("button",{type:"button",className:"tab-toggle","aria-pressed":t,"aria-label":`${t?"fechar":"abrir"} ${e}`,onClick:i,children:o.jsx("span",{"aria-hidden":"true",children:n})})}function g2({eyebrow:e,title:t,lede:i,narrow:n=!1,children:a,footer:c}){return o.jsxs("div",{className:`wizard__card${n?" wizard__card--narrow":""}`,children:[o.jsxs("div",{className:"wizard__head",children:[e!==void 0&&o.jsx("span",{className:"wizard__eyebrow",children:e}),o.jsx("h2",{className:"wizard__title",children:t}),i!==void 0&&o.jsx("p",{className:"wizard__lede",children:i})]}),a,c!==void 0&&o.jsx("div",{className:"wizard__foot",children:c})]})}function ia({title:e,children:t}){return o.jsxs("section",{className:"wizard__sec",children:[o.jsx("span",{className:"wizard__sec-t",children:e}),t]})}function v2({job:e}){const t=e.percent,i=e.phase===null?null:n2[e.phase]??e.phase;return o.jsxs("div",{className:"modal__work","data-state":e.state,"aria-label":`clonando ${e.name}`,children:[o.jsxs("div",{className:"modal__work-top",children:[o.jsx(Qe,{tone:"project",children:"■"}),o.jsx("span",{className:"modal__work-name",children:e.name}),t!==null&&o.jsxs("span",{className:"modal__work-pct",children:[t,"%"]})]}),o.jsx("div",{className:t===null?"bar bar--unknown":"bar",children:o.jsx("div",{className:"bar__fill",style:t===null?void 0:{width:`${t}%`}})}),o.jsx("p",{className:"modal__work-phase",children:e.state==="registering"?"registrando":i??"conectando"})]})}function b0(e){return e.state==="cancelled"?!1:e.state!=="done"?!0:e.message!==null&&e.message.includes("registrado como")}function y2({job:e,onDismiss:t,onRetry:i}){if(e.state==="done")return e.message===null||!e.message.includes("registrado como")?null:o.jsxs("div",{className:"clone-outcome clone-outcome--done",role:"status",children:[o.jsx("p",{className:"clone-outcome__body",children:e.message}),o.jsx(de,{variant:"ghost",size:"sm",onClick:t,children:"entendi"})]});const n=e.failure==="auth"?S2(e.url):null;return o.jsxs("div",{className:"clone-outcome clone-outcome--failed",role:"alert",children:[o.jsx("p",{className:"clone-outcome__title",children:e.failure==="auth"?`não consegui autenticar em ${b2(e.url)}`:`não deu para clonar ${e.name}`}),e.failure==="auth"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"clone-outcome__body",children:"O Lumem usa as credenciais que já estão na sua máquina — ele não guarda token nenhum. Duas saídas:"}),o.jsxs("ul",{className:"clone-outcome__ways",children:[o.jsx("li",{children:"usar a URL ssh do mesmo repositório, com a chave no ssh-agent;"}),o.jsx("li",{children:"configurar um credential.helper para https."})]})]}),e.message!==null&&o.jsx("code",{className:"clone-outcome__git",children:e.message}),o.jsxs("div",{className:"clone-outcome__actions",children:[n!==null&&i!==void 0&&o.jsx(de,{variant:"primary",size:"sm",onClick:()=>i(n),children:"tentar por ssh"}),o.jsx(de,{variant:"ghost",size:"sm",onClick:t,children:"dispensar"})]}),n!==null&&o.jsx("p",{className:"clone-outcome__path",children:n})]})}function b2(e){try{return new URL(e).host}catch{return e}}function S2(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const i=t.pathname.replace(/^\/+/,"");return i===""?null:t.port!==""?`ssh://git@${t.hostname}:${t.port}/${i}`:`git@${t.hostname}:${i}`}const x2=250;function w2({workspaceId:e,workspaceName:t,open:i,onClose:n,onRequestOpen:a,onAdded:c,prefill:h=null,onPrefillConsumed:d}){const f=We(),[m,g]=j.useState(""),[v,b]=j.useState(""),[S,x]=j.useState(null),[C,k]=j.useState(null),N=c2(e),L=N!==null&&!ah(N.state)?N:null,D=N!==null&&N.id!==S&&ah(N.state)&&b0(N)?N:null,M=j2(e,m,v);j.useEffect(()=>{h!==null&&(g(h),b(""),d==null||d())},[h,d]),j.useEffect(()=>{i||(L!==null||D!==null)&&a()},[L,D,i,a]),j.useEffect(()=>{L!==null&&k(L.id)},[L==null?void 0:L.id]);const Y=He({mutationFn:()=>ie.project.add.mutate({workspaceId:e,path:(M==null?void 0:M.kind)==="path"?M.path:m.trim(),...v.trim()===""?{}:{name:v.trim()}}),onSuccess:async F=>{await f.invalidateQueries({queryKey:ta(e)}),c(F.id),ee()}}),Z=He({mutationFn:()=>ie.project.clone.mutate({workspaceId:e,source:m.trim(),...v.trim()===""?{}:{name:v.trim()}}),onSuccess:async()=>{x(null),await f.invalidateQueries({queryKey:nh(e)})}}),W=He({mutationFn:F=>ie.project.cloneCancel.mutate({jobId:F}),onSuccess:()=>f.invalidateQueries({queryKey:nh(e)})});j.useEffect(()=>{!i||N===null||N.id!==C||N.state!=="done"||b0(N)&&N.id!==S||(f.invalidateQueries({queryKey:ta(e)}),k(null),ee())},[i,C,N==null?void 0:N.id,N==null?void 0:N.state,S]);function ee(){D!==null&&x(D.id),g(""),b(""),Y.reset(),Z.reset(),n()}const I=(M==null?void 0:M.kind)==="url",ae=(M==null?void 0:M.kind)==="refused",le=m.trim().startsWith("/")||m.trim().startsWith("~"),H=M===null&&!le&&m.trim()!=="",z=Y.isPending||Z.isPending,re=Y.isError?Y.error.message:Z.isError?Z.error.message:void 0,se=L!==null,A=F=>{F.preventDefault(),!(m.trim()===""||ae||H)&&(I?Z.mutate():Y.mutate())};return o.jsxs(dw,{open:i,title:"Adicionar projeto",where:o.jsxs(o.Fragment,{children:["no workspace",o.jsx(Qe,{tone:"workspace",children:"◈"}),o.jsx("b",{children:t})]}),onClose:ee,dismissible:!se,reason:"não fecha enquanto clona",footer:se?L.state==="cloning"?o.jsx(de,{variant:"ghost",onClick:()=>W.mutate(L.id),children:"cancelar o clone"}):null:o.jsxs(o.Fragment,{children:[o.jsx(de,{type:"submit",form:S0,variant:"primary",disabled:z||m.trim()===""||ae||H,children:Y.isPending?"validando…":I?"clonar":"adicionar"}),o.jsx(de,{variant:"ghost",onClick:ee,children:"cancelar"})]}),children:[D!==null&&o.jsx(y2,{job:D,onDismiss:()=>x(D.id),onRetry:F=>{x(D.id),g(F)}}),se?o.jsx(v2,{job:L}):o.jsxs("form",{id:S0,className:"add-project",onSubmit:A,children:[o.jsx(Xt,{id:"project-source",label:"Caminho ou URL",error:re,children:o.jsx(cs,{id:"project-source",value:m,onChange:F=>g(F.target.value),placeholder:"git@gitlab.interno:time/api.git",invalid:ae||Y.isError||Z.isError})}),M!==null&&o.jsx(C2,{plan:M}),o.jsx(Xt,{id:"project-name",label:"Nome",children:o.jsx(cs,{id:"project-name",value:v,onChange:F=>b(F.target.value),placeholder:I?M.name??"o nome do repositório":"o nome da pasta"})}),I&&o.jsxs("p",{className:"add-project__answer",children:[o.jsx("span",{className:"add-project__answer-label",children:"Vai em"}),o.jsx("span",{className:"add-project__answer-path",children:M.targetPath})]})]})]})}const S0="add-project";function C2({plan:e}){return e.kind==="refused"?o.jsxs("p",{className:"echo echo--refused",role:"status",children:[o.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),e.message]}):e.kind==="path"?o.jsxs("p",{className:"echo",children:[o.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"registrar o repositório em ",o.jsx("strong",{children:e.path})]}):o.jsxs("p",{className:"echo",children:[o.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"clonar via ",e.scheme,e.insecure===!0&&o.jsx(as,{tone:"insecure",children:"sem TLS"})]})}function j2(e,t,i){const[n,a]=j.useState("");return j.useEffect(()=>{const h=setTimeout(()=>a(t.trim()),x2);return()=>clearTimeout(h)},[t]),Ne({queryKey:["project","parseSource",e,n,i.trim()],queryFn:()=>ie.project.parseSource.query({workspaceId:e,source:n,...i.trim()===""?{}:{name:i.trim()}}),enabled:n!==""}).data??null}var Je;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function i(a){throw new Error}e.assertNever=i,e.arrayToEnum=a=>{const c={};for(const h of a)c[h]=h;return c},e.getValidEnumValues=a=>{const c=e.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),h={};for(const d of c)h[d]=a[d];return e.objectValues(h)},e.objectValues=a=>e.objectKeys(a).map(function(c){return a[c]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const c=[];for(const h in a)Object.prototype.hasOwnProperty.call(a,h)&&c.push(h);return c},e.find=(a,c)=>{for(const h of a)if(c(h))return h},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,c=" | "){return a.map(h=>typeof h=="string"?`'${h}'`:h).join(c)}e.joinValues=n,e.jsonStringifyReplacer=(a,c)=>typeof c=="bigint"?c.toString():c})(Je||(Je={}));var x0;(function(e){e.mergeShapes=(t,i)=>({...t,...i})})(x0||(x0={}));const ve=Je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},oe=Je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class gr extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=t}format(t){const i=t||function(c){return c.message},n={_errors:[]},a=c=>{for(const h of c.issues)if(h.code==="invalid_union")h.unionErrors.map(a);else if(h.code==="invalid_return_type")a(h.returnTypeError);else if(h.code==="invalid_arguments")a(h.argumentsError);else if(h.path.length===0)n._errors.push(i(h));else{let d=n,f=0;for(;f<h.path.length;){const m=h.path[f];f===h.path.length-1?(d[m]=d[m]||{_errors:[]},d[m]._errors.push(i(h))):d[m]=d[m]||{_errors:[]},d=d[m],f++}}};return a(this),n}static assert(t){if(!(t instanceof gr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=i=>i.message){const i={},n=[];for(const a of this.issues)if(a.path.length>0){const c=a.path[0];i[c]=i[c]||[],i[c].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:i}}get formErrors(){return this.flatten()}}gr.create=e=>new gr(e);const Zm=(e,t)=>{let i;switch(e.code){case oe.invalid_type:e.received===ve.undefined?i="Required":i=`Expected ${e.expected}, received ${e.received}`;break;case oe.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,Je.jsonStringifyReplacer)}`;break;case oe.unrecognized_keys:i=`Unrecognized key(s) in object: ${Je.joinValues(e.keys,", ")}`;break;case oe.invalid_union:i="Invalid input";break;case oe.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Je.joinValues(e.options)}`;break;case oe.invalid_enum_value:i=`Invalid enum value. Expected ${Je.joinValues(e.options)}, received '${e.received}'`;break;case oe.invalid_arguments:i="Invalid function arguments";break;case oe.invalid_return_type:i="Invalid function return type";break;case oe.invalid_date:i="Invalid date";break;case oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(i=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?i=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?i=`Invalid input: must end with "${e.validation.endsWith}"`:Je.assertNever(e.validation):e.validation!=="regex"?i=`Invalid ${e.validation}`:i="Invalid";break;case oe.too_small:e.type==="array"?i=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?i=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?i=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?i=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?i=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:i="Invalid input";break;case oe.too_big:e.type==="array"?i=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?i=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?i=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?i=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?i=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:i="Invalid input";break;case oe.custom:i="Invalid input";break;case oe.invalid_intersection_types:i="Intersection results could not be merged";break;case oe.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case oe.not_finite:i="Number must be finite";break;default:i=t.defaultError,Je.assertNever(e)}return{message:i}};let k2=Zm;function E2(){return k2}const N2=e=>{const{data:t,path:i,errorMaps:n,issueData:a}=e,c=[...i,...a.path||[]],h={...a,path:c};if(a.message!==void 0)return{...a,path:c,message:a.message};let d="";const f=n.filter(m=>!!m).slice().reverse();for(const m of f)d=m(h,{data:t,defaultError:d}).message;return{...a,path:c,message:d}};function fe(e,t){const i=E2(),n=N2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Zm?void 0:Zm].filter(a=>!!a)});e.common.issues.push(n)}class Gs{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,i){const n=[];for(const a of i){if(a.status==="aborted")return Oe;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,i){const n=[];for(const a of i){const c=await a.key,h=await a.value;n.push({key:c,value:h})}return Gs.mergeObjectSync(t,n)}static mergeObjectSync(t,i){const n={};for(const a of i){const{key:c,value:h}=a;if(c.status==="aborted"||h.status==="aborted")return Oe;c.status==="dirty"&&t.dirty(),h.status==="dirty"&&t.dirty(),c.value!=="__proto__"&&(typeof h.value<"u"||a.alwaysSet)&&(n[c.value]=h.value)}return{status:t.value,value:n}}}const Oe=Object.freeze({status:"aborted"}),Oo=e=>({status:"dirty",value:e}),fi=e=>({status:"valid",value:e}),w0=e=>e.status==="aborted",C0=e=>e.status==="dirty",yl=e=>e.status==="valid",lh=e=>typeof Promise<"u"&&e instanceof Promise;var xe;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(xe||(xe={}));class _n{constructor(t,i,n,a){this._cachedPath=[],this.parent=t,this.data=i,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const j0=(e,t)=>{if(yl(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new gr(e.common.issues);return this._error=i,this._error}}};function Pe(e){if(!e)return{};const{errorMap:t,invalid_type_error:i,required_error:n,description:a}=e;if(t&&(i||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(h,d)=>{const{message:f}=e;return h.code==="invalid_enum_value"?{message:f??d.defaultError}:typeof d.data>"u"?{message:f??n??d.defaultError}:h.code!=="invalid_type"?{message:d.defaultError}:{message:f??i??d.defaultError}},description:a}}class Ze{get description(){return this._def.description}_getType(t){return Qr(t.data)}_getOrReturnCtx(t,i){return i||{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Gs,ctx:{common:t.parent.common,data:t.data,parsedType:Qr(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const i=this._parse(t);if(lh(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(t){const i=this._parse(t);return Promise.resolve(i)}parse(t,i){const n=this.safeParse(t,i);if(n.success)return n.data;throw n.error}safeParse(t,i){const n={common:{issues:[],async:(i==null?void 0:i.async)??!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qr(t)},a=this._parseSync({data:t,path:n.path,parent:n});return j0(n,a)}"~validate"(t){var n,a;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qr(t)};if(!this["~standard"].async)try{const c=this._parseSync({data:t,path:[],parent:i});return yl(c)?{value:c.value}:{issues:i.common.issues}}catch(c){(a=(n=c==null?void 0:c.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:i}).then(c=>yl(c)?{value:c.value}:{issues:i.common.issues})}async parseAsync(t,i){const n=await this.safeParseAsync(t,i);if(n.success)return n.data;throw n.error}async safeParseAsync(t,i){const n={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qr(t)},a=this._parse({data:t,path:n.path,parent:n}),c=await(lh(a)?a:Promise.resolve(a));return j0(n,c)}refine(t,i){const n=a=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(a):i;return this._refinement((a,c)=>{const h=t(a),d=()=>c.addIssue({code:oe.custom,...n(a)});return typeof Promise<"u"&&h instanceof Promise?h.then(f=>f?!0:(d(),!1)):h?!0:(d(),!1)})}refinement(t,i){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof i=="function"?i(n,a):i),!1))}_refinement(t){return new aa({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return pr.create(this,this._def)}nullable(){return la.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zi.create(this)}promise(){return dh.create(this,this._def)}or(t){return ch.create([this,t],this._def)}and(t){return uh.create(this,t,this._def)}transform(t){return new aa({...Pe(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const i=typeof t=="function"?t:()=>t;return new fh({...Pe(this._def),innerType:this,defaultValue:i,typeName:Re.ZodDefault})}brand(){return new _w({typeName:Re.ZodBranded,type:this,...Pe(this._def)})}catch(t){const i=typeof t=="function"?t:()=>t;return new mh({...Pe(this._def),innerType:this,catchValue:i,typeName:Re.ZodCatch})}describe(t){const i=this.constructor;return new i({...this._def,description:t})}pipe(t){return m_.create(this,t)}readonly(){return ph.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const T2=/^c[^\s-]{8,}$/i,O2=/^[0-9a-z]+$/,A2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R2=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,M2=/^[a-z0-9_-]{21}$/i,D2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,B2=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,L2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let am;const q2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,P2=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,H2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,I2=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,U2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,F2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fw="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",K2=new RegExp(`^${fw}$`);function mw(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const i=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${i}`}function $2(e){return new RegExp(`^${mw(e)}$`)}function W2(e){let t=`${fw}T${mw(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${i.join("|")})`,new RegExp(`^${t}$`)}function V2(e,t){return!!((t==="v4"||!t)&&q2.test(e)||(t==="v6"||!t)&&H2.test(e))}function Y2(e,t){if(!D2.test(e))return!1;try{const[i]=e.split(".");if(!i)return!1;const n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function G2(e,t){return!!((t==="v4"||!t)&&P2.test(e)||(t==="v6"||!t)&&I2.test(e))}class dn extends Ze{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ve.string){const c=this._getOrReturnCtx(t);return fe(c,{code:oe.invalid_type,expected:ve.string,received:c.parsedType}),Oe}const n=new Gs;let a;for(const c of this._def.checks)if(c.kind==="min")t.data.length<c.value&&(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="max")t.data.length>c.value&&(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),n.dirty());else if(c.kind==="length"){const h=t.data.length>c.value,d=t.data.length<c.value;(h||d)&&(a=this._getOrReturnCtx(t,a),h?fe(a,{code:oe.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&fe(a,{code:oe.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")L2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"email",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="emoji")am||(am=new RegExp(z2,"u")),am.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"emoji",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")R2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"uuid",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="nanoid")M2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"nanoid",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")T2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"cuid",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid2")O2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"cuid2",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="ulid")A2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"ulid",code:oe.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),fe(a,{validation:"url",code:oe.invalid_string,message:c.message}),n.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"regex",code:oe.invalid_string,message:c.message}),n.dirty())):c.kind==="trim"?t.data=t.data.trim():c.kind==="includes"?t.data.includes(c.value,c.position)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),n.dirty()):c.kind==="toLowerCase"?t.data=t.data.toLowerCase():c.kind==="toUpperCase"?t.data=t.data.toUpperCase():c.kind==="startsWith"?t.data.startsWith(c.value)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?t.data.endsWith(c.value)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?W2(c).test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:"datetime",message:c.message}),n.dirty()):c.kind==="date"?K2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:"date",message:c.message}),n.dirty()):c.kind==="time"?$2(c).test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.invalid_string,validation:"time",message:c.message}),n.dirty()):c.kind==="duration"?B2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"duration",code:oe.invalid_string,message:c.message}),n.dirty()):c.kind==="ip"?V2(t.data,c.version)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"ip",code:oe.invalid_string,message:c.message}),n.dirty()):c.kind==="jwt"?Y2(t.data,c.alg)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"jwt",code:oe.invalid_string,message:c.message}),n.dirty()):c.kind==="cidr"?G2(t.data,c.version)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"cidr",code:oe.invalid_string,message:c.message}),n.dirty()):c.kind==="base64"?U2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"base64",code:oe.invalid_string,message:c.message}),n.dirty()):c.kind==="base64url"?F2.test(t.data)||(a=this._getOrReturnCtx(t,a),fe(a,{validation:"base64url",code:oe.invalid_string,message:c.message}),n.dirty()):Je.assertNever(c);return{status:n.value,value:t.data}}_regex(t,i,n){return this.refinement(a=>t.test(a),{validation:i,code:oe.invalid_string,...xe.errToObj(n)})}_addCheck(t){return new dn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...xe.errToObj(t)})}url(t){return this._addCheck({kind:"url",...xe.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...xe.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...xe.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...xe.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...xe.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...xe.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...xe.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...xe.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...xe.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...xe.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...xe.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...xe.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...xe.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...xe.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...xe.errToObj(t)})}regex(t,i){return this._addCheck({kind:"regex",regex:t,...xe.errToObj(i)})}includes(t,i){return this._addCheck({kind:"includes",value:t,position:i==null?void 0:i.position,...xe.errToObj(i==null?void 0:i.message)})}startsWith(t,i){return this._addCheck({kind:"startsWith",value:t,...xe.errToObj(i)})}endsWith(t,i){return this._addCheck({kind:"endsWith",value:t,...xe.errToObj(i)})}min(t,i){return this._addCheck({kind:"min",value:t,...xe.errToObj(i)})}max(t,i){return this._addCheck({kind:"max",value:t,...xe.errToObj(i)})}length(t,i){return this._addCheck({kind:"length",value:t,...xe.errToObj(i)})}nonempty(t){return this.min(1,xe.errToObj(t))}trim(){return new dn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new dn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new dn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const i of this._def.checks)i.kind==="min"&&(t===null||i.value>t)&&(t=i.value);return t}get maxLength(){let t=null;for(const i of this._def.checks)i.kind==="max"&&(t===null||i.value<t)&&(t=i.value);return t}}dn.create=e=>new dn({checks:[],typeName:Re.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Pe(e)});function Q2(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=i>n?i:n,c=Number.parseInt(e.toFixed(a).replace(".","")),h=Number.parseInt(t.toFixed(a).replace(".",""));return c%h/10**a}class bl extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ve.number){const c=this._getOrReturnCtx(t);return fe(c,{code:oe.invalid_type,expected:ve.number,received:c.parsedType}),Oe}let n;const a=new Gs;for(const c of this._def.checks)c.kind==="int"?Je.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.invalid_type,expected:"integer",received:"float",message:c.message}),a.dirty()):c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),a.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),a.dirty()):c.kind==="multipleOf"?Q2(t.data,c.value)!==0&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.not_multiple_of,multipleOf:c.value,message:c.message}),a.dirty()):c.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.not_finite,message:c.message}),a.dirty()):Je.assertNever(c);return{status:a.value,value:t.data}}gte(t,i){return this.setLimit("min",t,!0,xe.toString(i))}gt(t,i){return this.setLimit("min",t,!1,xe.toString(i))}lte(t,i){return this.setLimit("max",t,!0,xe.toString(i))}lt(t,i){return this.setLimit("max",t,!1,xe.toString(i))}setLimit(t,i,n,a){return new bl({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:xe.toString(a)}]})}_addCheck(t){return new bl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:xe.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xe.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:xe.toString(i)})}finite(t){return this._addCheck({kind:"finite",message:xe.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xe.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xe.toString(t)})}get minValue(){let t=null;for(const i of this._def.checks)i.kind==="min"&&(t===null||i.value>t)&&(t=i.value);return t}get maxValue(){let t=null;for(const i of this._def.checks)i.kind==="max"&&(t===null||i.value<t)&&(t=i.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Je.isInteger(t.value))}get isFinite(){let t=null,i=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(i===null||n.value>i)&&(i=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(i)&&Number.isFinite(t)}}bl.create=e=>new bl({checks:[],typeName:Re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class Ko extends Ze{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ve.bigint)return this._getInvalidInput(t);let n;const a=new Gs;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?t.data<c.value:t.data<=c.value)&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),a.dirty()):c.kind==="max"?(c.inclusive?t.data>c.value:t.data>=c.value)&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),a.dirty()):c.kind==="multipleOf"?t.data%c.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),fe(n,{code:oe.not_multiple_of,multipleOf:c.value,message:c.message}),a.dirty()):Je.assertNever(c);return{status:a.value,value:t.data}}_getInvalidInput(t){const i=this._getOrReturnCtx(t);return fe(i,{code:oe.invalid_type,expected:ve.bigint,received:i.parsedType}),Oe}gte(t,i){return this.setLimit("min",t,!0,xe.toString(i))}gt(t,i){return this.setLimit("min",t,!1,xe.toString(i))}lte(t,i){return this.setLimit("max",t,!0,xe.toString(i))}lt(t,i){return this.setLimit("max",t,!1,xe.toString(i))}setLimit(t,i,n,a){return new Ko({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:xe.toString(a)}]})}_addCheck(t){return new Ko({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xe.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xe.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xe.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xe.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:xe.toString(i)})}get minValue(){let t=null;for(const i of this._def.checks)i.kind==="min"&&(t===null||i.value>t)&&(t=i.value);return t}get maxValue(){let t=null;for(const i of this._def.checks)i.kind==="max"&&(t===null||i.value<t)&&(t=i.value);return t}}Ko.create=e=>new Ko({checks:[],typeName:Re.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Pe(e)});class Xm extends Ze{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ve.boolean){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.boolean,received:n.parsedType}),Oe}return fi(t.data)}}Xm.create=e=>new Xm({typeName:Re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class oh extends Ze{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ve.date){const c=this._getOrReturnCtx(t);return fe(c,{code:oe.invalid_type,expected:ve.date,received:c.parsedType}),Oe}if(Number.isNaN(t.data.getTime())){const c=this._getOrReturnCtx(t);return fe(c,{code:oe.invalid_date}),Oe}const n=new Gs;let a;for(const c of this._def.checks)c.kind==="min"?t.data.getTime()<c.value&&(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),n.dirty()):c.kind==="max"?t.data.getTime()>c.value&&(a=this._getOrReturnCtx(t,a),fe(a,{code:oe.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),n.dirty()):Je.assertNever(c);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new oh({...this._def,checks:[...this._def.checks,t]})}min(t,i){return this._addCheck({kind:"min",value:t.getTime(),message:xe.toString(i)})}max(t,i){return this._addCheck({kind:"max",value:t.getTime(),message:xe.toString(i)})}get minDate(){let t=null;for(const i of this._def.checks)i.kind==="min"&&(t===null||i.value>t)&&(t=i.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const i of this._def.checks)i.kind==="max"&&(t===null||i.value<t)&&(t=i.value);return t!=null?new Date(t):null}}oh.create=e=>new oh({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Re.ZodDate,...Pe(e)});class k0 extends Ze{_parse(t){if(this._getType(t)!==ve.symbol){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.symbol,received:n.parsedType}),Oe}return fi(t.data)}}k0.create=e=>new k0({typeName:Re.ZodSymbol,...Pe(e)});class Jm extends Ze{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.undefined,received:n.parsedType}),Oe}return fi(t.data)}}Jm.create=e=>new Jm({typeName:Re.ZodUndefined,...Pe(e)});class ep extends Ze{_parse(t){if(this._getType(t)!==ve.null){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.null,received:n.parsedType}),Oe}return fi(t.data)}}ep.create=e=>new ep({typeName:Re.ZodNull,...Pe(e)});class E0 extends Ze{constructor(){super(...arguments),this._any=!0}_parse(t){return fi(t.data)}}E0.create=e=>new E0({typeName:Re.ZodAny,...Pe(e)});class N0 extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(t){return fi(t.data)}}N0.create=e=>new N0({typeName:Re.ZodUnknown,...Pe(e)});class gn extends Ze{_parse(t){const i=this._getOrReturnCtx(t);return fe(i,{code:oe.invalid_type,expected:ve.never,received:i.parsedType}),Oe}}gn.create=e=>new gn({typeName:Re.ZodNever,...Pe(e)});class T0 extends Ze{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.void,received:n.parsedType}),Oe}return fi(t.data)}}T0.create=e=>new T0({typeName:Re.ZodVoid,...Pe(e)});class zi extends Ze{_parse(t){const{ctx:i,status:n}=this._processInputParams(t),a=this._def;if(i.parsedType!==ve.array)return fe(i,{code:oe.invalid_type,expected:ve.array,received:i.parsedType}),Oe;if(a.exactLength!==null){const h=i.data.length>a.exactLength.value,d=i.data.length<a.exactLength.value;(h||d)&&(fe(i,{code:h?oe.too_big:oe.too_small,minimum:d?a.exactLength.value:void 0,maximum:h?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&i.data.length<a.minLength.value&&(fe(i,{code:oe.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&i.data.length>a.maxLength.value&&(fe(i,{code:oe.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),i.common.async)return Promise.all([...i.data].map((h,d)=>a.type._parseAsync(new _n(i,h,i.path,d)))).then(h=>Gs.mergeArray(n,h));const c=[...i.data].map((h,d)=>a.type._parseSync(new _n(i,h,i.path,d)));return Gs.mergeArray(n,c)}get element(){return this._def.type}min(t,i){return new zi({...this._def,minLength:{value:t,message:xe.toString(i)}})}max(t,i){return new zi({...this._def,maxLength:{value:t,message:xe.toString(i)}})}length(t,i){return new zi({...this._def,exactLength:{value:t,message:xe.toString(i)}})}nonempty(t){return this.min(1,t)}}zi.create=(e,t)=>new zi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...Pe(t)});function tl(e){if(e instanceof zt){const t={};for(const i in e.shape){const n=e.shape[i];t[i]=pr.create(tl(n))}return new zt({...e._def,shape:()=>t})}else return e instanceof zi?new zi({...e._def,type:tl(e.element)}):e instanceof pr?pr.create(tl(e.unwrap())):e instanceof la?la.create(tl(e.unwrap())):e instanceof ra?ra.create(e.items.map(t=>tl(t))):e}class zt extends Ze{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),i=Je.objectKeys(t);return this._cached={shape:t,keys:i},this._cached}_parse(t){if(this._getType(t)!==ve.object){const m=this._getOrReturnCtx(t);return fe(m,{code:oe.invalid_type,expected:ve.object,received:m.parsedType}),Oe}const{status:n,ctx:a}=this._processInputParams(t),{shape:c,keys:h}=this._getCached(),d=[];if(!(this._def.catchall instanceof gn&&this._def.unknownKeys==="strip"))for(const m in a.data)h.includes(m)||d.push(m);const f=[];for(const m of h){const g=c[m],v=a.data[m];f.push({key:{status:"valid",value:m},value:g._parse(new _n(a,v,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof gn){const m=this._def.unknownKeys;if(m==="passthrough")for(const g of d)f.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(m==="strict")d.length>0&&(fe(a,{code:oe.unrecognized_keys,keys:d}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const g of d){const v=a.data[g];f.push({key:{status:"valid",value:g},value:m._parse(new _n(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const m=[];for(const g of f){const v=await g.key,b=await g.value;m.push({key:v,value:b,alwaysSet:g.alwaysSet})}return m}).then(m=>Gs.mergeObjectSync(n,m)):Gs.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return xe.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(i,n)=>{var c,h;const a=((h=(c=this._def).errorMap)==null?void 0:h.call(c,i,n).message)??n.defaultError;return i.code==="unrecognized_keys"?{message:xe.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(t){return new zt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new zt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Re.ZodObject})}setKey(t,i){return this.augment({[t]:i})}catchall(t){return new zt({...this._def,catchall:t})}pick(t){const i={};for(const n of Je.objectKeys(t))t[n]&&this.shape[n]&&(i[n]=this.shape[n]);return new zt({...this._def,shape:()=>i})}omit(t){const i={};for(const n of Je.objectKeys(this.shape))t[n]||(i[n]=this.shape[n]);return new zt({...this._def,shape:()=>i})}deepPartial(){return tl(this)}partial(t){const i={};for(const n of Je.objectKeys(this.shape)){const a=this.shape[n];t&&!t[n]?i[n]=a:i[n]=a.optional()}return new zt({...this._def,shape:()=>i})}required(t){const i={};for(const n of Je.objectKeys(this.shape))if(t&&!t[n])i[n]=this.shape[n];else{let c=this.shape[n];for(;c instanceof pr;)c=c._def.innerType;i[n]=c}return new zt({...this._def,shape:()=>i})}keyof(){return pw(Je.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:gn.create(),typeName:Re.ZodObject,...Pe(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:gn.create(),typeName:Re.ZodObject,...Pe(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:gn.create(),typeName:Re.ZodObject,...Pe(t)});class ch extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t),n=this._def.options;function a(c){for(const d of c)if(d.result.status==="valid")return d.result;for(const d of c)if(d.result.status==="dirty")return i.common.issues.push(...d.ctx.common.issues),d.result;const h=c.map(d=>new gr(d.ctx.common.issues));return fe(i,{code:oe.invalid_union,unionErrors:h}),Oe}if(i.common.async)return Promise.all(n.map(async c=>{const h={...i,common:{...i.common,issues:[]},parent:null};return{result:await c._parseAsync({data:i.data,path:i.path,parent:h}),ctx:h}})).then(a);{let c;const h=[];for(const f of n){const m={...i,common:{...i.common,issues:[]},parent:null},g=f._parseSync({data:i.data,path:i.path,parent:m});if(g.status==="valid")return g;g.status==="dirty"&&!c&&(c={result:g,ctx:m}),m.common.issues.length&&h.push(m.common.issues)}if(c)return i.common.issues.push(...c.ctx.common.issues),c.result;const d=h.map(f=>new gr(f));return fe(i,{code:oe.invalid_union,unionErrors:d}),Oe}}get options(){return this._def.options}}ch.create=(e,t)=>new ch({options:e,typeName:Re.ZodUnion,...Pe(t)});const or=e=>e instanceof sp?or(e.schema):e instanceof aa?or(e.innerType()):e instanceof hh?[e.value]:e instanceof na?e.options:e instanceof ip?Je.objectValues(e.enum):e instanceof fh?or(e._def.innerType):e instanceof Jm?[void 0]:e instanceof ep?[null]:e instanceof pr?[void 0,...or(e.unwrap())]:e instanceof la?[null,...or(e.unwrap())]:e instanceof _w||e instanceof ph?or(e.unwrap()):e instanceof mh?or(e._def.innerType):[];class f_ extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ve.object)return fe(i,{code:oe.invalid_type,expected:ve.object,received:i.parsedType}),Oe;const n=this.discriminator,a=i.data[n],c=this.optionsMap.get(a);return c?i.common.async?c._parseAsync({data:i.data,path:i.path,parent:i}):c._parseSync({data:i.data,path:i.path,parent:i}):(fe(i,{code:oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,i,n){const a=new Map;for(const c of i){const h=or(c.shape[t]);if(!h.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const d of h){if(a.has(d))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(d)}`);a.set(d,c)}}return new f_({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:i,optionsMap:a,...Pe(n)})}}function tp(e,t){const i=Qr(e),n=Qr(t);if(e===t)return{valid:!0,data:e};if(i===ve.object&&n===ve.object){const a=Je.objectKeys(t),c=Je.objectKeys(e).filter(d=>a.indexOf(d)!==-1),h={...e,...t};for(const d of c){const f=tp(e[d],t[d]);if(!f.valid)return{valid:!1};h[d]=f.data}return{valid:!0,data:h}}else if(i===ve.array&&n===ve.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let c=0;c<e.length;c++){const h=e[c],d=t[c],f=tp(h,d);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return i===ve.date&&n===ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class uh extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t),a=(c,h)=>{if(w0(c)||w0(h))return Oe;const d=tp(c.value,h.value);return d.valid?((C0(c)||C0(h))&&i.dirty(),{status:i.value,value:d.data}):(fe(n,{code:oe.invalid_intersection_types}),Oe)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([c,h])=>a(c,h)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}uh.create=(e,t,i)=>new uh({left:e,right:t,typeName:Re.ZodIntersection,...Pe(i)});class ra extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.array)return fe(n,{code:oe.invalid_type,expected:ve.array,received:n.parsedType}),Oe;if(n.data.length<this._def.items.length)return fe(n,{code:oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&n.data.length>this._def.items.length&&(fe(n,{code:oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const c=[...n.data].map((h,d)=>{const f=this._def.items[d]||this._def.rest;return f?f._parse(new _n(n,h,n.path,d)):null}).filter(h=>!!h);return n.common.async?Promise.all(c).then(h=>Gs.mergeArray(i,h)):Gs.mergeArray(i,c)}get items(){return this._def.items}rest(t){return new ra({...this._def,rest:t})}}ra.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ra({items:e,typeName:Re.ZodTuple,rest:null,...Pe(t)})};class O0 extends Ze{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.map)return fe(n,{code:oe.invalid_type,expected:ve.map,received:n.parsedType}),Oe;const a=this._def.keyType,c=this._def.valueType,h=[...n.data.entries()].map(([d,f],m)=>({key:a._parse(new _n(n,d,n.path,[m,"key"])),value:c._parse(new _n(n,f,n.path,[m,"value"]))}));if(n.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of h){const m=await f.key,g=await f.value;if(m.status==="aborted"||g.status==="aborted")return Oe;(m.status==="dirty"||g.status==="dirty")&&i.dirty(),d.set(m.value,g.value)}return{status:i.value,value:d}})}else{const d=new Map;for(const f of h){const m=f.key,g=f.value;if(m.status==="aborted"||g.status==="aborted")return Oe;(m.status==="dirty"||g.status==="dirty")&&i.dirty(),d.set(m.value,g.value)}return{status:i.value,value:d}}}}O0.create=(e,t,i)=>new O0({valueType:t,keyType:e,typeName:Re.ZodMap,...Pe(i)});class $o extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.set)return fe(n,{code:oe.invalid_type,expected:ve.set,received:n.parsedType}),Oe;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(fe(n,{code:oe.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),i.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(fe(n,{code:oe.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),i.dirty());const c=this._def.valueType;function h(f){const m=new Set;for(const g of f){if(g.status==="aborted")return Oe;g.status==="dirty"&&i.dirty(),m.add(g.value)}return{status:i.value,value:m}}const d=[...n.data.values()].map((f,m)=>c._parse(new _n(n,f,n.path,m)));return n.common.async?Promise.all(d).then(f=>h(f)):h(d)}min(t,i){return new $o({...this._def,minSize:{value:t,message:xe.toString(i)}})}max(t,i){return new $o({...this._def,maxSize:{value:t,message:xe.toString(i)}})}size(t,i){return this.min(t,i).max(t,i)}nonempty(t){return this.min(1,t)}}$o.create=(e,t)=>new $o({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...Pe(t)});class sp extends Ze{get schema(){return this._def.getter()}_parse(t){const{ctx:i}=this._processInputParams(t);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}sp.create=(e,t)=>new sp({getter:e,typeName:Re.ZodLazy,...Pe(t)});class hh extends Ze{_parse(t){if(t.data!==this._def.value){const i=this._getOrReturnCtx(t);return fe(i,{received:i.data,code:oe.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:t.data}}get value(){return this._def.value}}hh.create=(e,t)=>new hh({value:e,typeName:Re.ZodLiteral,...Pe(t)});function pw(e,t){return new na({values:e,typeName:Re.ZodEnum,...Pe(t)})}class na extends Ze{_parse(t){if(typeof t.data!="string"){const i=this._getOrReturnCtx(t),n=this._def.values;return fe(i,{expected:Je.joinValues(n),received:i.parsedType,code:oe.invalid_type}),Oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const i=this._getOrReturnCtx(t),n=this._def.values;return fe(i,{received:i.data,code:oe.invalid_enum_value,options:n}),Oe}return fi(t.data)}get options(){return this._def.values}get enum(){const t={};for(const i of this._def.values)t[i]=i;return t}get Values(){const t={};for(const i of this._def.values)t[i]=i;return t}get Enum(){const t={};for(const i of this._def.values)t[i]=i;return t}extract(t,i=this._def){return na.create(t,{...this._def,...i})}exclude(t,i=this._def){return na.create(this.options.filter(n=>!t.includes(n)),{...this._def,...i})}}na.create=pw;class ip extends Ze{_parse(t){const i=Je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ve.string&&n.parsedType!==ve.number){const a=Je.objectValues(i);return fe(n,{expected:Je.joinValues(a),received:n.parsedType,code:oe.invalid_type}),Oe}if(this._cache||(this._cache=new Set(Je.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=Je.objectValues(i);return fe(n,{received:n.data,code:oe.invalid_enum_value,options:a}),Oe}return fi(t.data)}get enum(){return this._def.values}}ip.create=(e,t)=>new ip({values:e,typeName:Re.ZodNativeEnum,...Pe(t)});class dh extends Ze{unwrap(){return this._def.type}_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ve.promise&&i.common.async===!1)return fe(i,{code:oe.invalid_type,expected:ve.promise,received:i.parsedType}),Oe;const n=i.parsedType===ve.promise?i.data:Promise.resolve(i.data);return fi(n.then(a=>this._def.type.parseAsync(a,{path:i.path,errorMap:i.common.contextualErrorMap})))}}dh.create=(e,t)=>new dh({type:e,typeName:Re.ZodPromise,...Pe(t)});class aa extends Ze{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:i,ctx:n}=this._processInputParams(t),a=this._def.effect||null,c={addIssue:h=>{fe(n,h),h.fatal?i.abort():i.dirty()},get path(){return n.path}};if(c.addIssue=c.addIssue.bind(c),a.type==="preprocess"){const h=a.transform(n.data,c);if(n.common.async)return Promise.resolve(h).then(async d=>{if(i.value==="aborted")return Oe;const f=await this._def.schema._parseAsync({data:d,path:n.path,parent:n});return f.status==="aborted"?Oe:f.status==="dirty"||i.value==="dirty"?Oo(f.value):f});{if(i.value==="aborted")return Oe;const d=this._def.schema._parseSync({data:h,path:n.path,parent:n});return d.status==="aborted"?Oe:d.status==="dirty"||i.value==="dirty"?Oo(d.value):d}}if(a.type==="refinement"){const h=d=>{const f=a.refinement(d,c);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return d};if(n.common.async===!1){const d=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return d.status==="aborted"?Oe:(d.status==="dirty"&&i.dirty(),h(d.value),{status:i.value,value:d.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(d=>d.status==="aborted"?Oe:(d.status==="dirty"&&i.dirty(),h(d.value).then(()=>({status:i.value,value:d.value}))))}if(a.type==="transform")if(n.common.async===!1){const h=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yl(h))return Oe;const d=a.transform(h.value,c);if(d instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:d}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(h=>yl(h)?Promise.resolve(a.transform(h.value,c)).then(d=>({status:i.value,value:d})):Oe);Je.assertNever(a)}}aa.create=(e,t,i)=>new aa({schema:e,typeName:Re.ZodEffects,effect:t,...Pe(i)});aa.createWithPreprocess=(e,t,i)=>new aa({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...Pe(i)});class pr extends Ze{_parse(t){return this._getType(t)===ve.undefined?fi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}pr.create=(e,t)=>new pr({innerType:e,typeName:Re.ZodOptional,...Pe(t)});class la extends Ze{_parse(t){return this._getType(t)===ve.null?fi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}la.create=(e,t)=>new la({innerType:e,typeName:Re.ZodNullable,...Pe(t)});class fh extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t);let n=i.data;return i.parsedType===ve.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}fh.create=(e,t)=>new fh({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pe(t)});class mh extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t),n={...i,common:{...i.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return lh(a)?a.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new gr(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new gr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}mh.create=(e,t)=>new mh({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pe(t)});class A0 extends Ze{_parse(t){if(this._getType(t)!==ve.nan){const n=this._getOrReturnCtx(t);return fe(n,{code:oe.invalid_type,expected:ve.nan,received:n.parsedType}),Oe}return{status:"valid",value:t.data}}}A0.create=e=>new A0({typeName:Re.ZodNaN,...Pe(e)});class _w extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t),n=i.data;return this._def.type._parse({data:n,path:i.path,parent:i})}unwrap(){return this._def.type}}class m_ extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?Oe:c.status==="dirty"?(i.dirty(),Oo(c.value)):this._def.out._parseAsync({data:c.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Oe:a.status==="dirty"?(i.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,i){return new m_({in:t,out:i,typeName:Re.ZodPipeline})}}class ph extends Ze{_parse(t){const i=this._def.innerType._parse(t),n=a=>(yl(a)&&(a.value=Object.freeze(a.value)),a);return lh(i)?i.then(a=>n(a)):n(i)}unwrap(){return this._def.innerType}}ph.create=(e,t)=>new ph({innerType:e,typeName:Re.ZodReadonly,...Pe(t)});var Re;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Re||(Re={}));const be=dn.create,ls=bl.create,gw=Xm.create;gn.create;const Oi=zi.create,De=zt.create,Z2=ch.create,Cl=f_.create;uh.create;ra.create;const Ge=hh.create,vs=na.create;dh.create;pr.create;la.create;const X2="/acp",J2="session",eT=4404,tT=vs(["running","exited"]),R0=vs(["pending","running","ok","failed","cancelled"]),sT=vs(["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"]),M0=De({path:be(),line:ls().int().nullish()}),iT=Cl("type",[De({type:Ge("content"),text:be()}),De({type:Ge("diff"),path:be(),oldText:be().nullish(),newText:be()}),De({type:Ge("terminal"),terminalId:be()})]),rT=vs(["allow_once","allow_always","reject_once","reject_always"]),p_=vs(["ask","auto","free"]),vw=vs(["ask","auto"]),yw=vs(["agent","lumem"]),nT=De({optionId:be(),name:be(),kind:rT}),aT=vs(["end_turn","max_tokens","max_turn_requests","refusal","cancelled"]),lT=vs(["pending","in_progress","completed"]),oT=De({content:be(),status:lT,priority:vs(["high","medium","low"]).nullish()}),cT=De({utilization:ls(),surpassedThreshold:ls().nullish(),isUsingOverage:gw(),resetsAt:ls().int().nullish(),kind:be().nullish()}),uT=De({value:be(),name:be(),description:be().nullish()}),bw=De({id:be(),name:be(),category:be().nullish(),currentValue:be(),choices:Oi(uT)}),hT=De({name:be(),description:be(),takesInput:gw()}),Sw=Cl("type",[De({type:Ge("message"),messageId:be(),role:vs(["user","agent"]),text:be()}),De({type:Ge("thought"),messageId:be(),text:be()}),De({type:Ge("tool_call"),toolCallId:be(),title:be(),name:be().nullish(),kind:sT,status:R0,locations:Oi(M0).default([])}),De({type:Ge("tool_call_update"),toolCallId:be(),status:R0.optional(),title:be().optional(),content:Oi(iT).optional(),locations:Oi(M0).optional()}),De({type:Ge("permission_request"),requestId:be(),toolCallId:be(),title:be(),command:be().nullish(),cwd:be(),options:Oi(nT).min(1),policyReason:be().nullable().default(null)}),De({type:Ge("permission_resolved"),requestId:be(),outcome:Z2([Ge("cancelled"),De({optionId:be()})]),by:vs(["user","lumem"]).default("user"),reason:be().nullable().default(null)}),De({type:Ge("plan"),entries:Oi(oT)}),De({type:Ge("plan_removed")}),De({type:Ge("usage"),used:ls().int().nonnegative(),size:ls().int().positive(),cost:De({amount:ls(),currency:be()}).nullish(),rateLimit:cT.nullish()}),De({type:Ge("config"),mode:be(),options:Oi(bw),modeOwner:yw.default("agent"),lumemMode:p_.default("ask"),lumemModeDefault:vw.default("ask")}),De({type:Ge("commands"),commands:Oi(hT)}),De({type:Ge("terminal"),terminalId:be(),ptySessionId:be(),command:be()}),De({type:Ge("turn_end"),stopReason:aT}),De({type:Ge("resumed"),fromSessionId:be()}),De({type:Ge("memory_core"),entries:ls().int().nonnegative(),chars:ls().int().nonnegative()}),De({type:Ge("unknown"),sessionUpdate:be()})]),dT=De({at:ls().int().nonnegative(),event:Sw}),fT=vs(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","ADAPTER_UNAVAILABLE","INTERNAL"]),mT=Cl("type",[De({type:Ge("prompt"),text:be().min(1)}),De({type:Ge("cancel")}),De({type:Ge("permission_response"),requestId:be(),optionId:be()}),De({type:Ge("set_config"),optionId:be().min(1),value:be().min(1)}),De({type:Ge("set_lumem_mode"),mode:p_})]),pT=Cl("type",[De({type:Ge("attached"),sessionId:be(),state:tT,acpSessionId:be(),model:be(),mode:be(),configOptions:Oi(bw).default([]),modeOwner:yw.default("agent"),lumemMode:p_.default("ask"),lumemModeDefault:vw.default("ask"),cwd:be().default(""),transcript:Oi(dT)}),De({type:Ge("event"),at:ls().int().nonnegative(),event:Sw}),De({type:Ge("error"),code:fT,message:be(),remedy:be().optional()})]);function _T(e,t){let i;try{i=JSON.parse(t)}catch(a){return{ok:!1,error:`not valid JSON: ${a.message}`}}const n=e.safeParse(i);return n.success?{ok:!0,message:n.data}:{ok:!1,error:n.error.issues.map(c=>`${c.path.join(".")||"<root>"}: ${c.message}`).join("; ")}}function gT(e){return _T(pT,e)}function vT(e){return JSON.stringify(e)}const __={id:"claude",label:"Claude Code",package:"@agentclientprotocol/claude-agent-acp",command:"claude-agent-acp",pinnedVersion:"0.40.0",cli:{command:"claude",install:null},apiKeyEnv:["ANTHROPIC_API_KEY"]},yT={id:"codex",label:"Codex",package:"@agentclientprotocol/codex-acp",command:"codex-acp",pinnedVersion:"1.10.0",cli:null,apiKeyEnv:["CODEX_API_KEY","OPENAI_API_KEY"]},bT=[__,yT],ST=__.id,xT="/pty",wT="session",CT=vs(["running","exited"]),jT=vs(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","INTERNAL"]),D0=5e3;Cl("type",[De({type:Ge("input"),data:be()}),De({type:Ge("resize"),cols:ls().int().min(1).max(D0),rows:ls().int().min(1).max(D0)})]);const kT=Cl("type",[De({type:Ge("attached"),sessionId:be(),state:CT,cols:ls().int(),rows:ls().int(),snapshot:be()}),De({type:Ge("output"),data:be()}),De({type:Ge("exit"),exitCode:ls().int(),signal:ls().int().nullable()}),De({type:Ge("error"),code:jT,message:be()})]);function ET(e,t){let i;try{i=JSON.parse(t)}catch(a){return{ok:!1,error:`not valid JSON: ${a.message}`}}const n=e.safeParse(i);return n.success?{ok:!0,message:n.data}:{ok:!1,error:n.error.issues.map(c=>`${c.path.join(".")||"<root>"}: ${c.message}`).join("; ")}}function NT(e){return ET(kT,e)}function B0(e){return JSON.stringify(e)}const TT=1;function OT(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${xT}?${wT}=${encodeURIComponent(e)}`}function xw(e,t,i={}){const{createWebSocket:n=d=>new WebSocket(d),origin:a=window.location}=i,c=n(OT(e,a));let h=[];return c.onopen=()=>{const d=h;h=[];for(const f of d)c.send(B0(f))},c.onmessage=d=>{var m;const f=NT(String(d.data));f.ok?t.onMessage(f.message):(m=t.onDecodeError)==null||m.call(t,f.error)},c.onclose=d=>{var f;h=[],(f=t.onClose)==null||f.call(t,{code:d.code,clean:d.wasClean})},c.onerror=()=>{},{send(d){c.readyState===TT?c.send(B0(d)):h.push(d)},close(){c.onmessage=null,c.onclose=null,c.onopen=null,h=[],c.close()}}}const L0=12;function AT({ptySessionId:e,onFinished:t,connect:i=xw}){const[n,a]=j.useState([]),[c,h]=j.useState(null),[d,f]=j.useState(!1),m=j.useRef(t);return m.current=t,j.useEffect(()=>{if(e===null)return;a([]),h(null),f(!0);const g=i(e,{onMessage:v=>{if(v.type==="attached"||v.type==="output"){const b=v.type==="attached"?v.snapshot:v.data;a(S=>z0([...S,...RT(b)]));return}if(v.type==="exit"){f(!1),h(v.exitCode),m.current(v.exitCode);return}v.type==="error"&&a(b=>z0([...b,v.message]))},onClose:()=>f(!1)});return()=>g.close()},[e,i]),{output:n,exitCode:c,running:d}}function RT(e){return e.replace(/\u001B\[[0-9;?]*[A-Za-z]/g,"").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,"").split(/\r?\n/).map(t=>t.trim()).filter(t=>t!=="")}function z0(e){return e.length<=L0?e:e.slice(e.length-L0)}const lm=["agentConfig","list"];function MT({embedded:e=!1,onClose:t}={}){const i=We(),[n,a]=j.useState(e),c=Ne({queryKey:lm,queryFn:()=>ie.agentConfig.list.query(),enabled:n}),[h,d]=j.useState(""),[f,m]=j.useState(""),[g,v]=j.useState(""),[b,S]=j.useState("acp"),[x,C]=j.useState(""),[k,N]=j.useState(null),L=He({mutationFn:()=>ie.agentConfig.create.mutate({name:h.trim(),command:f.trim(),args:g.trim()===""?[]:g.trim().split(/\s+/),transport:b,...b==="acp"?{adapterVersion:x.trim()}:{}}),onSuccess:async()=>{await i.invalidateQueries({queryKey:lm}),d(""),m(""),v(""),C("")}}),D=He({mutationFn:W=>ie.agentConfig.remove.mutate({id:W}),onSuccess:async()=>{N(null),await i.invalidateQueries({queryKey:lm})}}),M=h.trim()!==""&&f.trim()!==""&&(b==="pty"||x.trim()!==""),Y=W=>{W.preventDefault(),M&&L.mutate()};if(!n)return o.jsxs("button",{type:"button",className:"sidebar__add",onClick:()=>a(!0),children:[o.jsx(Qe,{tone:"agent",children:"◆"}),"agentes"]});const Z=c.data??[];return o.jsx("div",{className:"agents",children:o.jsxs(cw,{children:[Z.length===0&&!c.isPending&&o.jsx("p",{className:"agents__empty",children:"nenhum agente configurado"}),Z.map(W=>{const ee=W.transport==="acp";return o.jsxs("div",{className:"agents__row",children:[o.jsxs("div",{className:"agents__head",children:[o.jsx(Qe,{tone:ee?"agent":"shell",children:ee?"◆":"●"}),o.jsx("span",{className:"agents__name",children:W.name}),o.jsx(as,{children:ee?"conversa":"terminal"}),!W.available&&o.jsx(as,{tone:"missing",children:"fora do PATH"})]}),o.jsxs("div",{className:"agents__foot",children:[o.jsxs("span",{className:"agents__cmd",title:W.command,children:[W.command,ee&&W.adapterVersion?` @${W.adapterVersion}`:""]}),k===W.id?o.jsx(de,{size:"sm",variant:"danger",disabled:D.isPending,onClick:()=>D.mutate(W.id),children:"confirmar"}):o.jsxs(de,{size:"sm",variant:"ghost",onClick:()=>N(W.id),children:["remover ",o.jsx("span",{className:"sr-only",children:W.name})]})]})]},W.id)}),D.isError&&o.jsx(Ae,{tone:"danger",children:D.error.message}),o.jsxs("form",{className:"agents__form",onSubmit:Y,children:[o.jsx(Xt,{id:"agent-name",label:"Nome",error:L.isError?L.error.message:void 0,children:o.jsx(cs,{id:"agent-name",value:h,onChange:W=>d(W.target.value),placeholder:"claude-acp",invalid:L.isError,autoFocus:!0})}),o.jsx(Xt,{id:"agent-transport",label:"Transporte",children:o.jsxs("select",{id:"agent-transport",className:"input",value:b,onChange:W=>S(W.target.value),children:[o.jsx("option",{value:"acp",children:"conversa (ACP)"}),o.jsx("option",{value:"pty",children:"terminal (PTY)"})]})}),o.jsx(Xt,{id:"agent-command",label:"Comando",children:o.jsx(cs,{id:"agent-command",value:f,onChange:W=>m(W.target.value),placeholder:b==="acp"?"claude-agent-acp":"claude"})}),o.jsx(Xt,{id:"agent-args",label:"Argumentos (opcional)",children:o.jsx(cs,{id:"agent-args",value:g,onChange:W=>v(W.target.value),placeholder:"--flag valor"})}),b==="acp"&&o.jsx(Xt,{id:"agent-version",label:"Versão do adaptador",children:o.jsx(cs,{id:"agent-version",value:x,onChange:W=>C(W.target.value),placeholder:"0.40.0"})}),o.jsxs("div",{className:"agents__actions",children:[o.jsx(de,{type:"submit",variant:"primary",disabled:L.isPending||!M,children:L.isPending?"criando…":"adicionar"}),o.jsx(de,{variant:"ghost",onClick:()=>{e?t==null||t():a(!1)},children:"fechar"})]})]})]})})}const ww=["agentConfig","list"],q0=["setup","agents"],Cw=["setup","probe"];function DT(){const[e,t]=j.useState(null),[i,n]=j.useState(!1),c=(Ne({queryKey:ww,queryFn:()=>ie.agentConfig.list.query()}).data??[]).filter(f=>f.transport==="acp"),h=(e==null?void 0:e.kind)==="agent"?c.find(f=>f.id===e.id):void 0,d=j.useCallback(()=>t(null),[]);return o.jsxs(o.Fragment,{children:[i&&o.jsxs("div",{className:"setup",role:"group","aria-label":"outro agente ACP",children:[o.jsxs("div",{className:"setup__head",children:[o.jsx("span",{className:"setup__t",children:"Outro agente ACP"}),o.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:()=>n(!1),children:"✕"})]}),o.jsx(MT,{embedded:!0,onClose:()=>n(!1)})]}),!i&&(e==null?void 0:e.kind)==="connect"&&o.jsx(zT,{configured:c.map(f=>f.command),onClose:d,onCustom:()=>{n(!0),t(null)},onConnected:f=>t({kind:"agent",id:f})}),!i&&h!==void 0&&o.jsx(HT,{config:h,onClose:d,onCustom:()=>n(!0)}),o.jsxs("div",{className:"foot-head",children:[o.jsx("span",{className:"foot-head__label",children:"Agentes"}),o.jsx("button",{type:"button",className:"act",title:"conectar um agente","aria-label":"conectar um agente",onClick:()=>t({kind:"connect"}),children:"+"})]}),c.length===0?o.jsx("span",{className:"foot-empty",children:"nenhum agente conectado"}):c.map(f=>o.jsx(LT,{config:f,open:(e==null?void 0:e.kind)==="agent"&&e.id===f.id,onOpen:()=>t({kind:"agent",id:f.id})},f.id))]})}function jw(e){return Ne({queryKey:[...Cw,e.command,e.args.join(" ")],queryFn:()=>ie.setup.probe.query({command:e.command,args:[...e.args]}),retry:!1,refetchOnWindowFocus:!1,staleTime:5*6e4})}function BT(e){var t;return e.isPending?{tone:"off",word:"verificando"}:e.isError?{tone:"err",word:"falhou"}:((t=e.data)==null?void 0:t.authRequired)===!0?{tone:"warn",word:"entrar"}:{tone:"on",word:"conectado"}}function LT({config:e,open:t,onOpen:i}){const n=jw(e),{tone:a,word:c}=BT(n);return o.jsxs("button",{type:"button",className:`foot-row foot-row--${a}${t?" is-open":""}`,"aria-label":`${e.name}: ${c}`,onClick:i,children:[o.jsx(Qe,{tone:"agent",children:"◆"}),o.jsx("span",{className:"foot-row__label",children:e.name}),o.jsx("span",{className:"pip"}),o.jsx("span",{className:"foot-row__st",children:c})]})}function zT({configured:e,onClose:t,onCustom:i,onConnected:n}){const a=We(),[c,h]=j.useState("idle"),[d,f]=j.useState(null),m=Ne({queryKey:q0,queryFn:()=>ie.setup.agents.query(),refetchOnWindowFocus:!1}),g=He({mutationFn:async v=>{var k;f(v);const b=om(m.data,v.id);let S=(b==null?void 0:b.adapter.path)??null;S===null&&(h("installing"),S=(await ie.setup.installAdapter.mutate({adapterId:v.id})).path),h("handshaking");const x=await ie.setup.probe.query({command:S});return(await ie.agentConfig.create.mutate({name:v.id,command:S,args:[],transport:"acp",adapterVersion:((k=x.agentInfo)==null?void 0:k.version)??v.pinnedVersion})).id},onSettled:async()=>{h("idle"),await a.invalidateQueries({queryKey:ww}),await a.invalidateQueries({queryKey:q0})},onSuccess:v=>n(v)});return o.jsxs("div",{className:"setup",role:"group","aria-label":"conectar agente",children:[o.jsxs("div",{className:"setup__head",children:[o.jsx("span",{className:"setup__t",children:g.isPending?`Preparando o ${(d==null?void 0:d.label)??"agente"}`:"Conectar agente"}),!g.isPending&&o.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),g.isPending?o.jsx(PT,{spec:d,stage:c,entry:om(m.data,d==null?void 0:d.id)}):o.jsxs(o.Fragment,{children:[bT.map((v,b)=>{const S=om(m.data,v.id),x=(S==null?void 0:S.adapter.path)!=null&&e.includes(S.adapter.path);return o.jsxs("button",{type:"button",className:b===0&&!x?"opt opt--primary":"opt",disabled:x||g.isPending||m.isPending,onClick:()=>g.mutate(v),children:[o.jsxs("span",{className:"opt__t",children:[o.jsx("span",{className:"opt__g","aria-hidden":"true",children:"◆"}),v.label]}),o.jsx("span",{className:"opt__d",children:qT(v,S,x===!0,m.isPending)})]},v.id)}),o.jsx("button",{type:"button",className:"linkbtn",onClick:i,children:"outro agente ACP…"}),o.jsxs("span",{className:"setup__note",children:["A lista é o ",o.jsx("b",{children:"catálogo do daemon"}),". O adaptador é instalado"," ",o.jsx("b",{children:"dentro da pasta do app"})," e fixado numa versão — nunca ",o.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]}),g.isError&&o.jsx(Ae,{tone:"danger",children:g.error.message})]})]})}function om(e,t){if(t!==void 0)return e==null?void 0:e.adapters.find(i=>i.id===t)}function qT(e,t,i,n){var a;return i?"já conectado":n?"procurando na sua máquina…":e.cli!==null?((a=t==null?void 0:t.cli)==null?void 0:a.path)==null?`o CLI ${e.cli.command} não está no PATH — o adaptador precisa dele`:`${e.cli.command} encontrado · ${t.cli.version??"versão não lida"}`:(t==null?void 0:t.adapter.path)==null?"o adaptador traz o próprio agente dentro":`instalado · ${t.adapter.version??"versão não lida"}`}function PT({spec:e,stage:t,entry:i}){var a;const n=[];return(e==null?void 0:e.cli)!=null&&n.push([`${e.cli.command} encontrado`,((a=i==null?void 0:i.cli)==null?void 0:a.path)==null?"wait":"done"]),n.push(["instalando o adaptador",t==="installing"?"now":t==="handshaking"?"done":"wait"]),n.push(["handshake",t==="handshaking"?"now":"wait"]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"prep",children:n.map(([c,h])=>o.jsxs("div",{className:`prep__r prep__r--${h}`,children:[o.jsx("span",{className:"prep__m","aria-hidden":"true",children:h==="done"?"✓":h==="now"?"◐":"○"}),c]},c))}),o.jsx("span",{className:"setup__note",children:e!==null&&e.cli===null?o.jsxs(o.Fragment,{children:["Duas linhas, e não três: este adaptador ",o.jsx("b",{children:"não precisa de CLI no PATH"})," — ele traz o próprio. Não há o que procurar na sua máquina."]}):o.jsxs(o.Fragment,{children:["Nada para rodar no terminal: o adaptador é instalado ",o.jsx("b",{children:"dentro da pasta do app"})," e fixado numa versão."]})})]})}function HT({config:e,onClose:t,onCustom:i}){var x,C;const n=We(),[a,c]=j.useState(!1),h=jw(e),d=j.useCallback(async()=>{await n.invalidateQueries({queryKey:Cw})},[n]),f=((C=(x=h.data)==null?void 0:x.agentInfo)==null?void 0:C.title)??e.name;return o.jsxs("div",{className:"setup",role:"group","aria-label":`agente ${e.name}`,children:[o.jsxs("div",{className:"setup__head",children:[o.jsx("span",{className:"setup__t",children:m()}),o.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),g()]});function m(){var k;return a?"Adaptador":h.isError?"Não deu para conectar":((k=h.data)==null?void 0:k.authRequired)===!0?`Entrar no ${f}`:f}function g(){var k;return a?b():h.isError?S(h.error.message):((k=h.data)==null?void 0:k.authRequired)===!0?o.jsx(IT,{config:e,methods:h.data.authMethods,onDone:()=>void d()}):v()}function v(){const k=h.data;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"acct",children:[o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"agente"}),o.jsxs("span",{className:"acct__v",children:[o.jsx("b",{children:f}),(k==null?void 0:k.agentInfo)!=null&&o.jsxs(o.Fragment,{children:[" · ",k.agentInfo.version]})]})]}),o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"entrada"}),o.jsx("span",{className:"acct__v",children:(k==null?void 0:k.authMethods.length)===0?"credencial local, já válida":"credencial local"})]}),o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"padrão"}),o.jsx("span",{className:"acct__v",children:(k==null?void 0:k.currentMode)??"o padrão do agente"})]})]}),o.jsxs("div",{className:"setup__acts",children:[o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>void d(),children:"verificar de novo"}),o.jsx("button",{type:"button",className:"linkbtn",onClick:()=>c(!0),children:"avançado"})]}),o.jsxs("span",{className:"setup__note",children:["Trocar de conta é ",o.jsx("code",{children:"/logout"})," no seu agente: o Lumem ainda não chama a capacidade"," ",o.jsx("code",{children:"auth.logout"}),", então um botão aqui não faria nada."]})]})}function b(){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"acct",children:[o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"comando"}),o.jsx("span",{className:"acct__v",children:e.command})]}),o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"args"}),o.jsx("span",{className:"acct__v",children:e.args.length?e.args.join(" "):"nenhum"})]}),o.jsxs("div",{className:"acct__r",children:[o.jsx("span",{className:"acct__k",children:"versão"}),o.jsx("span",{className:"acct__v",children:e.adapterVersion??"não fixada"})]})]}),o.jsxs("span",{className:"setup__note",children:["Só para quem mantém o próprio adaptador. O Lumem usa o que instalou e a versão que fixou — para trocar, remova esta configuração em ",o.jsx("b",{children:"outro agente ACP…"})," e crie a sua."]}),o.jsx("button",{type:"button",className:"linkbtn",onClick:()=>c(!1),children:"voltar"})]})}function S(k){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"fail",children:[o.jsxs("span",{className:"fail__title",children:[o.jsx("span",{"aria-hidden":"true",children:"✕"}),"não deu para conectar"]}),o.jsx("span",{className:"fail__body",children:"O adaptador não respondeu ao handshake. O que ele disse está abaixo."}),o.jsx("div",{className:"fail__cmd",children:k})]}),o.jsxs("div",{className:"setup__acts",children:[o.jsx(de,{size:"sm",variant:"primary",onClick:()=>void d(),children:"tentar de novo"}),o.jsx("button",{type:"button",className:"linkbtn",onClick:i,children:"outro agente ACP…"})]})]})}}function IT({config:e,methods:t,onDone:i}){var W,ee;const[n,a]=j.useState(null),[c,h]=j.useState(null),[d,f]=j.useState(""),[m,g]=j.useState(null),v=AT({ptySessionId:n,onFinished:()=>{a(null),i()}}),b={command:e.command,args:[...e.args]},S=He({mutationFn:I=>ie.setup.login.mutate({methodId:I,...b}),onSuccess:I=>a(I.ptySessionId)}),x=He({mutationFn:I=>ie.setup.authenticate.mutate({...I,...b}),onSuccess:I=>g(I.id)}),C=Ne({queryKey:["setup","authState",m],queryFn:()=>ie.setup.authState.query({loginId:m??""}),enabled:m!==null,refetchInterval:I=>I.state.data===void 0||I.state.data.state==="running"?700:!1}),k=He({mutationFn:()=>ie.setup.cancelAuth.mutate({loginId:m??""}),onSuccess:()=>g(null)}),N=(W=C.data)==null?void 0:W.state;if(n!==null||v.running)return D();if(m!==null&&N==="ok")return Y();if(m!==null&&(N==="running"||N===void 0))return M();if(c!==null)return Z(c);const L=t.filter(I=>I.type!=="terminal"||I.command!==null);if(L.length===0)return o.jsxs(o.Fragment,{children:[o.jsxs(Ae,{tone:"warning",children:["O adaptador não ofereceu nenhuma forma de entrar que o Lumem saiba executar",t.length>0&&o.jsxs(o.Fragment,{children:[" — ele listou ",t.length,", e nenhuma delas dá para rodar"]}),"."]}),o.jsx(de,{size:"sm",variant:"ghost",onClick:i,children:"verificar de novo"})]});return o.jsxs(o.Fragment,{children:[L.map((I,ae)=>o.jsxs("button",{type:"button",className:ae===0?"opt opt--primary":"opt",disabled:S.isPending||x.isPending,onClick:()=>{if(I.type==="terminal"){S.mutate(I.id);return}if(UT(I)){h(I);return}x.mutate({methodId:I.id})},children:[o.jsxs("span",{className:"opt__t",children:[o.jsx("span",{className:"opt__g","aria-hidden":"true",children:ae===0?"◆":"◇"}),I.name]}),o.jsx("span",{className:"opt__d",children:FT(I)})]},I.id)),o.jsxs("span",{className:"setup__note",children:["Estas opções vieram ",o.jsx("b",{children:"do próprio adaptador"}),", no handshake. O Lumem não inventa método de login."]}),S.isError&&o.jsx(Ae,{tone:"danger",children:S.error.message}),x.isError&&o.jsx(Ae,{tone:"danger",children:x.error.message}),N==="failed"&&((ee=C.data)==null?void 0:ee.message)!=null&&o.jsx(Ae,{tone:"danger",children:C.data.message})]});function D(){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"prep",children:[o.jsxs("div",{className:"prep__r prep__r--done",children:[o.jsx("span",{className:"prep__m","aria-hidden":"true",children:"✓"}),"adaptador de pé"]}),o.jsxs("div",{className:"prep__r prep__r--now",children:[o.jsx("span",{className:"prep__m","aria-hidden":"true",children:"◐"}),"autorize no navegador e volte"]})]}),v.output.length>0&&o.jsx("div",{className:"out out--short",children:v.output.map((I,ae)=>o.jsx("span",{className:"l",children:I},ae))}),o.jsx("div",{className:"setup__acts",children:o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>a(null),children:"cancelar"})}),o.jsx("span",{className:"setup__note",children:"Terminou lá? Este painel muda sozinho — quem confirma é o adaptador respondendo, não você dizendo que entrou."})]})}function M(){var ae;const I=((ae=C.data)==null?void 0:ae.elicitation)??null;return o.jsxs(o.Fragment,{children:[I!==null&&o.jsxs("div",{className:"dcode",children:[o.jsx("span",{className:"dcode__k",children:"abra em qualquer aparelho"}),o.jsx(u_,{command:I.url}),I.code!==null&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"dcode__k",children:"e digite este código"}),o.jsx("span",{className:"dcode__v",children:I.code})]}),o.jsx("span",{className:"setup__note",children:I.message})]}),o.jsx("div",{className:"prep",children:o.jsxs("div",{className:"prep__r prep__r--now",children:[o.jsx("span",{className:"prep__m","aria-hidden":"true",children:"◐"}),I===null?"entrando…":"esperando você autorizar"]})}),o.jsx("div",{className:"setup__acts",children:o.jsx(de,{size:"sm",variant:"ghost",disabled:k.isPending,onClick:()=>k.mutate(),children:"cancelar"})}),o.jsx("span",{className:"setup__note",children:I===null?"Terminou lá? Este painel muda sozinho — quem confirma é o adaptador respondendo.":"Nada abre aqui, e é de propósito: o daemon pode estar noutra máquina."})]})}function Y(){return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"prep",children:o.jsxs("div",{className:"prep__r prep__r--done",children:[o.jsx("span",{className:"prep__m","aria-hidden":"true",children:"✓"}),"credencial aceita pelo adaptador"]})}),o.jsx("div",{className:"setup__acts",children:o.jsx(de,{size:"sm",variant:"primary",onClick:()=>{g(null),i()},children:"continuar"})})]})}function Z(I){return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"key-in",children:[o.jsx(cs,{type:"password","aria-label":"chave de API",placeholder:"sk-…",value:d,onChange:ae=>f(ae.target.value)}),o.jsx(de,{size:"sm",variant:"primary",disabled:d.trim()===""||x.isPending,onClick:()=>{x.mutate({methodId:I.id,apiKey:d.trim()}),f(""),h(null)},children:"usar"})]}),o.jsxs("span",{className:"setup__note",children:["Ela ",o.jsx("b",{children:"atravessa"})," o daemon e vai para o adaptador. O Lumem não grava chave: não vai para o ",o.jsx("code",{children:"~/.lumem"}),", não vai para log, e não volta para esta tela."]}),o.jsx("button",{type:"button",className:"linkbtn",onClick:()=>h(null),children:"voltar aos jeitos de entrar"})]})}}function UT(e){return e.type==="env_var"||/api[- ]?key/i.test(e.id)}function FT(e){return e.description!==null&&e.description!==""?e.description:e.type==="terminal"?"roda um comando num terminal do daemon":"abre o navegador nesta máquina"}const kw=[{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"1m",label:"1m"},{id:"6m",label:"6m"},{id:"1y",label:"1a"}];function KT(e,t){return Ne({queryKey:OE(e,t),queryFn:()=>ie.usage.byProject.query({workspaceId:e,period:t})})}function $T(e,t){return Ne({queryKey:AE(e,t),queryFn:()=>ie.usage.byWorktree.query({projectId:e,period:t})})}function WT(e,t,i){return Ne({queryKey:RE(e,t),queryFn:()=>ie.usage.byProjectAndAgent.query({workspaceId:e,period:t}),enabled:i})}function VT(e){return Ne({queryKey:wE(e.workspaceId,e.projectId),queryFn:()=>ie.memory.list.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function g_(e="pending"){return Ne({queryKey:CE(e),queryFn:()=>ie.memory.proposals.query({status:e})})}function YT(e,t){const i=t.trim();return Ne({queryKey:kE(e.workspaceId,e.projectId,i),queryFn:()=>ie.memory.search.query({query:i,...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}}),enabled:i!==""})}function GT(){return Ne({queryKey:EE,queryFn:()=>ie.memory.decisions.query()})}function QT(e){return Ne({queryKey:jE(e.workspaceId,e.projectId),queryFn:()=>ie.memory.core.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function ZT(){const e=We();return He({mutationFn:t=>ie.memory.pin.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function XT(){return Ne({queryKey:TE,queryFn:()=>ie.memory.settings.query()})}function JT(e){const t=e.archived??!1;return Ne({queryKey:ME(e.workspaceId,t),queryFn:()=>ie.memory.playbooks.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},archived:t})})}function eO(){const e=We();return He({mutationFn:t=>ie.memory.archivePlaybook.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function tO(){return Ne({queryKey:NE,queryFn:()=>ie.memory.usage.query()})}function sO(){const e=We(),t=()=>e.invalidateQueries({queryKey:["memory"]}),i=He({mutationFn:a=>ie.memory.approveProposal.mutate(a),onSuccess:t}),n=He({mutationFn:a=>ie.memory.rejectProposal.mutate(a),onSuccess:t});return{approve:i,reject:n}}const iO=[{id:"entries",label:"Memória"},{id:"inbox",label:"Propostas"},{id:"playbooks",label:"Playbooks"},{id:"timeline",label:"Histórico"},{id:"numbers",label:"Números"}];function Ew({workspaceId:e,projectId:t,tab:i,onTabChange:n}){const[a,c]=j.useState("entries"),h=i??a,d=g=>{c(g),n==null||n(g)},f=VT({workspaceId:e,projectId:t}),m=QT({workspaceId:e,projectId:t});return g_("pending"),o.jsxs("section",{className:"mem-panel","aria-label":"Memória do workspace",children:[o.jsx("header",{className:"mem-head",children:o.jsx("div",{role:"tablist","aria-label":"Vistas da memória",className:"mem-tabs",children:iO.map(g=>o.jsx("button",{type:"button",role:"tab",id:`mem-tab-${g.id}`,"aria-selected":h===g.id,"aria-controls":"mem-panel-body",className:`mem-tab${h===g.id?" mem-tab--active":""}`,onClick:()=>{d(g.id)},children:g.label},g.id))})}),o.jsxs("div",{className:"mem-body",id:"mem-panel-body",role:"tabpanel","aria-labelledby":`mem-tab-${h}`,children:[h==="entries"?o.jsx(rO,{query:f,core:m,scope:{workspaceId:e,projectId:t}}):null,h==="inbox"?o.jsx(cO,{}):null,h==="playbooks"?o.jsx(SO,{workspaceId:e,projectId:t}):null,h==="timeline"?o.jsx(vO,{}):null,h==="numbers"?o.jsx(wO,{core:m}):null]})]})}const P0=4e3,Nw={low:"baixa",medium:"média",high:"alta"},rp={human:"você",agent:"agente",distiller:"destilação",auto_research:"auto-learn",import:"importação"},v_={global:"você · atravessa workspace",workspace:"workspace",project:"projeto"};function rO({query:e,core:t,scope:i}){var S;const[n,a]=j.useState(""),c=YT(i,n),h=o.jsx("div",{className:"mem-find",children:o.jsx("input",{type:"search",className:"focus-ring",placeholder:"buscar na memória…","aria-label":"Buscar na memória",value:n,onChange:x=>a(x.target.value)})});if(n.trim()!=="")return o.jsxs(o.Fragment,{children:[h,o.jsx(aO,{found:c})]});if(e.isPending)return o.jsx("p",{className:"mem-meta",children:"carregando…"});if(e.isError)return o.jsx(ms,{title:"Não deu para ler a memória",children:e.error.message});const{entries:d,shadowed:f}=e.data;if(d.length===0)return o.jsx(ms,{title:"Nada aprendido ainda",children:"A memória aparece aqui quando algo durável for salvo."});const m=new Map;for(const x of f)m.set(x.winner,[...m.get(x.winner)??[],x.identity]);const g=new Map((((S=t.data)==null?void 0:S.entries)??[]).map(x=>[x.path,x.chars])),b=["project","workspace","global"].map(x=>({scope:x,rows:d.filter(C=>C.scope===x)})).filter(x=>x.rows.length>0);return o.jsxs(o.Fragment,{children:[h,b.map(x=>o.jsxs("section",{children:[o.jsxs("h3",{className:"mem-group__t",children:[o.jsx("span",{className:"mem-scope","data-scope":x.scope,children:v_[x.scope]??x.scope}),o.jsx("span",{className:"mem-group__n",children:x.rows.length})]}),o.jsx("ul",{className:"mem-list",children:x.rows.map(C=>{var k;return o.jsxs("li",{className:"mem-item",children:[o.jsx(lO,{entry:C}),o.jsx("p",{className:"mem-desc",children:C.description}),o.jsxs("p",{className:"mem-meta",children:[o.jsx("span",{children:rp[C.sourceActor]??C.sourceActor}),o.jsxs("span",{children:["confiança ",Nw[C.confidence]??C.confidence]}),o.jsx(nO,{entry:C}),C.pinned&&g.get(C.path)!==void 0?o.jsxs("span",{className:"mem-pin-cost",children:[(g.get(C.path)??0).toLocaleString("pt-BR")," car."]}):null]}),(k=m.get(C.path))==null?void 0:k.map(N=>o.jsxs("p",{className:"mem-shadow-note",children:["sombreia ",o.jsx("strong",{children:N})," — continua no disco"]},N))]},C.path)})})]},x.scope))]})}function nO({entry:e}){const t=ZT();return o.jsx("button",{type:"button",className:"mem-pin focus-ring","aria-pressed":e.pinned,disabled:t.isPending,onClick:()=>t.mutate({path:e.path,pinned:!e.pinned}),children:e.pinned?"no núcleo":"fixar no núcleo"})}function aO({found:e}){return e.isPending?o.jsx("p",{className:"mem-meta",children:"buscando…"}):e.isError?o.jsx(ms,{title:"Não deu para buscar",children:e.error.message}):e.data.skipped==="trivial_query"?o.jsx(ms,{title:"Busca não realizada",children:"Menos de dois termos significativos — dizer que não buscou é diferente de dizer que não achou."}):o.jsxs(o.Fragment,{children:[e.data.staleIndex?o.jsx("p",{className:"mem-stale",children:"índice desatualizado — o resultado pode estar curto"}):null,e.data.hits.length===0?o.jsx(ms,{title:"Nada encontrado",children:"Nenhuma memória casa com esses termos no escopo ativo."}):o.jsx("ul",{className:"mem-list",children:e.data.hits.map(t=>o.jsxs("li",{className:"mem-item",children:[o.jsxs("p",{className:"mem-row",children:[o.jsx("span",{className:"mem-scope","data-scope":t.entry.scope,children:v_[t.entry.scope]??t.entry.scope}),o.jsx("span",{className:"mem-kind",children:t.entry.type}),o.jsx("span",{className:"mem-name",children:t.entry.name})]}),o.jsx("p",{className:"mem-desc",children:t.entry.description}),o.jsx("p",{className:"mem-why",children:t.why.map(i=>o.jsx("span",{children:i},i))})]},t.entry.path))})]})}function lO({entry:e}){return o.jsxs("p",{className:"mem-row",children:[o.jsx("span",{className:"mem-kind",children:e.type}),o.jsx("span",{className:"mem-name",children:e.name})]})}const oO=[{id:"pending",label:"Pendentes"},{id:"resolved",label:"Resolvidas"}];function cO(){const[e,t]=j.useState("pending"),i=g_(e);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mem-seg",role:"group","aria-label":"Propostas por estado",children:oO.map(n=>o.jsx("button",{type:"button",className:`mem-seg__item${e===n.id?" mem-seg__item--active":""}`,"aria-pressed":e===n.id,onClick:()=>{t(n.id)},children:n.label},n.id))}),o.jsx(uO,{query:i,status:e})]})}function uO({query:e,status:t}){return e.isPending?o.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?o.jsx(ms,{title:"Não deu para ler as propostas",children:e.error.message}):e.data.length===0?t==="pending"?o.jsx(ms,{title:"Nenhuma proposta pendente",children:"Escrita de workspace feita por agente cai aqui antes de valer."}):o.jsx(ms,{title:"Nada decidido ainda",children:"Aprovar ou rejeitar move a proposta para cá — recusar é histórico, não apagamento."}):o.jsx("ul",{className:"mem-list",children:e.data.map(i=>o.jsx("li",{className:"mem-item",children:i.status==="pending"?o.jsx(dO,{proposal:i}):o.jsx(pO,{proposal:i})},i.id))})}function hO({current:e,proposal:t}){return o.jsxs("div",{className:"mem-conflict",children:[o.jsxs("p",{className:"mem-conflict__t",children:[o.jsx("span",{className:"mem-warn",children:"conflito no mesmo escopo"}),"já existe memória aqui — aprovar substitui"]}),o.jsxs("div",{className:"mem-split",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"A que está valendo"}),o.jsx("p",{className:"mem-desc",children:e.description}),o.jsxs("p",{className:"mem-meta",children:[o.jsx("span",{children:rp[e.sourceActor]??e.sourceActor}),o.jsxs("span",{children:["confiança ",Nw[e.confidence]??e.confidence]})]})]}),o.jsxs("div",{children:[o.jsx("strong",{children:"A que chegou"}),o.jsx("p",{className:"mem-desc",children:t.description}),o.jsxs("p",{className:"mem-meta",children:[o.jsx("span",{children:rp[t.actor]??t.actor}),o.jsx("span",{children:t.evidence===null?"sem evidência":"com evidência"})]})]})]})]})}function dO({proposal:e}){const{approve:t,reject:i}=sO(),[n,a]=j.useState("none");return o.jsxs(o.Fragment,{children:[o.jsx(Tw,{proposal:e}),o.jsx("p",{className:"mem-desc",children:e.description}),o.jsx("pre",{className:"mem-body-text",children:e.body===""?"(sem corpo — só nome e descrição)":e.body}),o.jsx(_O,{proposal:e}),e.current===null?null:o.jsx(hO,{current:e.current,proposal:e}),n==="edit"?o.jsx(fO,{proposal:e,approve:t,onCancel:()=>{a("none")}}):n==="reject"?o.jsx(mO,{proposal:e,reject:i,onCancel:()=>{a("none")}}):o.jsxs("div",{className:"mem-actions",children:[o.jsx(de,{variant:"primary",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id})},children:"Aprovar"}),o.jsx(de,{onClick:()=>{a("edit")},children:"Editar e aprovar"}),o.jsx(de,{variant:"ghost",onClick:()=>{a("reject")},children:"Rejeitar"})]}),t.isError?o.jsxs(Ae,{tone:"danger",children:["não deu para aprovar: ",t.error.message]}):null,i.isError?o.jsxs(Ae,{tone:"danger",children:["não deu para rejeitar: ",i.error.message]}):null]})}function fO({proposal:e,approve:t,onCancel:i}){const[n,a]=j.useState(e.name),[c,h]=j.useState(e.description),[d,f]=j.useState(e.body),m=n.trim()===""||c.trim()==="";return o.jsxs("div",{className:"mem-form",children:[o.jsx(Xt,{id:`prop-${e.id}-name`,label:"Nome",children:o.jsx(cs,{id:`prop-${e.id}-name`,value:n,onChange:g=>{a(g.target.value)}})}),o.jsx(Xt,{id:`prop-${e.id}-description`,label:"Descrição",children:o.jsx(cs,{id:`prop-${e.id}-description`,value:c,onChange:g=>{h(g.target.value)}})}),o.jsx(Xt,{id:`prop-${e.id}-body`,label:"Corpo",children:o.jsx("textarea",{id:`prop-${e.id}-body`,className:"mem-textarea",rows:6,value:d,onChange:g=>{f(g.target.value)}})}),o.jsxs("div",{className:"mem-actions",children:[o.jsx(de,{variant:"primary",disabled:t.isPending||m,onClick:()=>{t.mutate({id:e.id,...n===e.name?{}:{name:n},...c===e.description?{}:{description:c},...d===e.body?{}:{body:d}})},children:"Aprovar com edição"}),o.jsx(de,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function mO({proposal:e,reject:t,onCancel:i}){const[n,a]=j.useState("");return o.jsxs("div",{className:"mem-form",children:[o.jsx(Ae,{tone:"warning",children:"Rejeitar não tem volta: a proposta fica no histórico como recusada, e não há como reabri-la."}),o.jsx(Xt,{id:`prop-${e.id}-note`,label:"Por que não? (fica registrado)",children:o.jsx(cs,{id:`prop-${e.id}-note`,value:n,maxLength:500,placeholder:"isso é regra do api, não do produto",onChange:c=>{a(c.target.value)}})}),o.jsxs("div",{className:"mem-actions",children:[o.jsx(de,{variant:"danger",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id,...n.trim()===""?{}:{note:n.trim()}})},children:"Rejeitar"}),o.jsx(de,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function pO({proposal:e}){return o.jsxs(o.Fragment,{children:[o.jsx(Tw,{proposal:e}),o.jsx("p",{className:"mem-desc",children:e.description}),o.jsxs("p",{className:"mem-meta",children:[o.jsx("span",{className:"mem-verdict","data-status":e.status,children:e.status==="approved"?"aprovada":"rejeitada"}),o.jsxs("span",{children:["proposta por ",e.actor]}),e.resolvedAt===null?null:o.jsx("span",{children:Ow(e.resolvedAt)})]}),e.resolutionNote===null?null:o.jsx("p",{className:"mem-shadow-note",children:e.resolutionNote})]})}function _O({proposal:e}){return o.jsxs("div",{className:"mem-evidence",children:[e.evidence===null?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"Sem evidência verificável"})," — o agente concluiu. Conclusão vira proposta; fato vira memória."]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"Evidência"})," — ",o.jsx("code",{children:e.evidence})]}),o.jsx("br",{}),"proposta por ",o.jsx("strong",{children:e.actor}),e.fromProjectId===null?null:o.jsxs(o.Fragment,{children:[" · projeto ",e.fromProjectId]})]})}function Tw({proposal:e}){return o.jsxs("p",{className:"mem-row",children:[o.jsx("span",{className:"mem-scope","data-scope":e.scope,children:e.scope==="global"?"você":e.scope}),o.jsx("span",{className:"mem-kind",children:e.type}),o.jsx("span",{className:"mem-name",children:e.name})]})}const gO={applied:"aprendeu",rejected:"recusou",noop:"nada a fazer"};function vO(){const e=GT();return e.isPending?o.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?o.jsx(ms,{title:"Não deu para ler o histórico",children:e.error.message}):e.data.length===0?o.jsx(ms,{title:"Nada decidido ainda",children:"Cada escrita — e cada recusa — aparece aqui."}):o.jsx("ol",{className:"mem-tl",children:e.data.map(t=>o.jsxs("li",{className:"mem-tl-item","data-outcome":t.outcome,children:[o.jsx("span",{className:"mem-tl-when",children:yO(t)}),o.jsx("span",{className:"mem-tl-dot",children:t.outcome==="rejected"?"▲":"●"}),o.jsxs("span",{children:[o.jsx("span",{className:"mem-tl-verb",children:gO[t.outcome]??t.outcome})," ",o.jsx("span",{children:t.path}),t.reason===null?null:o.jsxs(o.Fragment,{children:[" — ",o.jsx("em",{children:t.reason})]})]})]},t.id))})}function yO(e){return Ow(e.createdAt)}function Ow(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const bO={active:"ativo",stale:"parado",archived:"arquivado"};function SO({workspaceId:e,projectId:t}){var h,d;const[i,n]=j.useState(!1),a=JT({workspaceId:e,archived:i}),c=eO();return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mem-seg",role:"group","aria-label":"Vista dos playbooks",children:[{label:"ativos",value:!1},{label:"arquivados",value:!0}].map(f=>o.jsx("button",{type:"button",className:`mem-seg__item${i===f.value?" mem-seg__item--active":""}`,"aria-pressed":i===f.value,onClick:()=>n(f.value),children:f.label},f.label))}),a.isPending?o.jsx("p",{className:"mem-meta",children:"carregando…"}):null,a.isError?o.jsx(ms,{title:"Não deu para ler os playbooks",children:a.error.message}):null,((h=a.data)==null?void 0:h.length)===0?o.jsx(ms,{title:i?"Nenhum playbook arquivado":"Nenhum playbook ainda",children:i?"Arquivar não apaga: o que for arquivado aparece aqui.":"Playbook é procedimento — o caminho que já funcionou, para a próxima vez."}):null,(d=a.data)==null?void 0:d.map(f=>o.jsxs("div",{className:"pb",children:[o.jsxs("p",{className:"pb__row",children:[o.jsx("span",{className:"life","data-life":f.lifecycle,children:bO[f.lifecycle]??f.lifecycle}),o.jsx("span",{className:"pb__class",children:f.taskClass})]}),o.jsx("p",{className:"pb__desc",children:f.description}),o.jsxs("p",{className:"pb__use",children:[o.jsxs("span",{className:"pb__loads",children:[f.loads,"×"]}),o.jsx("span",{children:f.lastLoadedAt===null?"nunca carregado":xO(f.lastLoadedAt)}),o.jsx("span",{className:"mem-scope","data-scope":f.scope,children:v_[f.scope]??f.scope}),o.jsx("button",{type:"button",className:"pb__act focus-ring",disabled:c.isPending,onClick:()=>c.mutate({path:f.path,archived:!f.archived}),children:f.archived?"desarquivar":"arquivar"})]}),f.lifecycle==="stale"?o.jsx("p",{className:"pb__suggest",children:"parado há muito tempo — talvez o procedimento tenha mudado. Arquivar não apaga: carregar de novo reativa."}):null]},f.path))]})}function xO(e){const t=Math.floor((Date.now()-new Date(e).getTime())/864e5);return t<=0?"último uso hoje":t===1?"último uso ontem":`último uso há ${String(t)} dias`}function wO({core:e}){const t=tO(),i=XT();if(t.isPending)return o.jsx("p",{className:"mem-meta",children:"carregando…"});if(t.isError)return o.jsx(ms,{title:"Não deu para ler os números",children:t.error.message});const n=e.data;return o.jsxs("div",{className:"mem-stats",children:[n!==void 0&&n.entries.length>0?o.jsxs("div",{className:`mem-stat${n.chars>P0?" mem-stat--warn":""}`,children:[o.jsx("div",{className:"n",children:n.chars.toLocaleString("pt-BR")}),o.jsx("div",{className:"l",children:"caracteres no núcleo"}),o.jsxs("div",{className:"hint",children:[n.entries.length," ",n.entries.length===1?"diretriz fixada":"diretrizes fixadas",n.recentChars>0?` · ${n.recentChars.toLocaleString("pt-BR")} entraram em 30 dias`:"",n.chars>P0?" · hora de consolidar":""]})]}):null,i.data!==void 0?o.jsxs("div",{className:"mem-stat",children:[o.jsx("div",{className:"n",children:i.data.distill?"on":"off"}),o.jsx("div",{className:"l",children:"destilação de fim de sessão"}),o.jsx("div",{className:"hint",children:i.data.distill?"cada sessão de agente que termina custa uma sessão de destilação":"ligue com LUMEM_MEMORY_DISTILL=1"})]}):null,i.data!==void 0?o.jsxs("div",{className:"mem-stat",children:[o.jsx("div",{className:"n",children:i.data.autoLearn?"on":"off"}),o.jsx("div",{className:"l",children:"pesquisa automática"}),o.jsx("div",{className:"hint",children:i.data.autoLearn?`pergunta sem resposta sobe um agente · até ${String(i.data.autoLearnBudget)} por sessão`:"ligue com LUMEM_MEMORY_AUTO_LEARN=1"})]}):null,t.data.map(a=>o.jsxs("div",{className:"mem-stat",children:[o.jsx("div",{className:"n",children:a.events}),o.jsxs("div",{className:"l",children:[a.kind," · ",a.totalAmount," no total · ",a.averageDurationMs," ms"]})]},a.kind)),t.data.length===0?o.jsxs("div",{className:"mem-stat",children:[o.jsx("div",{className:"n",children:"0"}),o.jsx("div",{className:"l",children:"uso registrado"}),o.jsx("div",{className:"hint",children:"os números aparecem depois da primeira busca"})]}):null]})}function H0(e,t){return t<=0?"0%":`${(Math.min(1,Math.max(0,e/t))*100).toFixed(2)}%`}function _h(e){if(e<1e3)return String(e);if(e<1e6){const i=e/1e3;return`${i>=100?Math.round(i):i.toFixed(1).replace(".",",")}k`}const t=e/1e6;return`${t>=10?Math.round(t):t.toFixed(1).replace(".",",").replace(",0","")}M`}function I0(e,t){return`${t==="USD"?"US$":`${t} `} ${e.toFixed(4).replace(".",",")}`}function CO(e,t){const i=e-Math.round(t/1e3);if(i<=0)return"resetou";const n=i/3600;if(n>=24)return`reseta em ${Math.round(n/24)} d`;if(n>=6)return`reseta em ${Math.round(n)} h`;const a=new Date(e*1e3);return`reseta ${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function jO(e){if(!e)return"quiet";if(e.isUsingOverage)return"over";const t=e.surpassedThreshold;return t!=null&&e.utilization>=t?"warn":"quiet"}function kO({usage:e,now:t=Date.now()}){var a;const{rateLimit:i}=e,n=jO(i);return o.jsxs(o.Fragment,{children:[n==="over"&&o.jsxs("div",{className:"overage",role:"status",children:[o.jsx("span",{"aria-hidden":"true",children:"⚠"}),o.jsxs("span",{children:["Você entrou no ",o.jsx("b",{children:"overage"})," do ciclo. A partir daqui a sessão cobra fora da assinatura."]})]}),o.jsxs("div",{className:"usage",children:[o.jsxs("span",{className:"u",children:[o.jsx("span",{className:"u__k",children:"janela"}),_h(e.used)," / ",_h(e.size),o.jsx(U0,{fraction:H0(e.used,e.size)})]}),o.jsxs("span",{className:`u${e.cost?" u--cost":""}`,children:[o.jsx("span",{className:"u__k",children:"turno"}),e.cost?I0(e.cost.amount,e.cost.currency):"—",e.currency&&e.totalCost>(((a=e.cost)==null?void 0:a.amount)??0)&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"u__k",children:"sessão"}),I0(e.totalCost,e.currency)]})]}),o.jsx("span",{className:"usage__spacer"}),i&&o.jsxs("span",{className:`u${n==="quiet"?"":` u--${n}`}`,children:[o.jsx("span",{className:"u__k",children:"assinatura"}),Math.round(i.utilization*100),"%",o.jsx(U0,{fraction:H0(i.utilization,1)}),i.isUsingOverage?"em overage":i.resetsAt!==null&&i.resetsAt!==void 0?CO(i.resetsAt,t):null]})]})]})}function U0({fraction:e}){return o.jsx("span",{className:"meter","data-fill":e,children:o.jsx("span",{className:"meter__f",style:{"--w":e}})})}function Aw({rows:e}){const t=Math.max(...e.map(c=>c.tokens),0),i=e.some(c=>{var h;return(((h=c.agents)==null?void 0:h.length)??0)>0}),[n,a]=j.useState(new Set);return o.jsx("div",{className:`spend${i?" spend--split":""}`,children:e.map(c=>{const h=c.agents??[],d=h.length>0,f=n.has(c.id),m=d?"div":j.Fragment,g=d?{className:"spend__group"}:{};return o.jsxs(m,{...g,children:[o.jsxs("div",{className:`spend__row${c.tokens===0?" spend__row--idle":""}${c.outside===!0?" spend__row--outside":""}`,children:[i&&o.jsx(o.Fragment,{children:d?o.jsx("button",{type:"button",className:"spend__twist","aria-expanded":f,"aria-label":`${f?"fechar":"abrir"} a divisão por agente de ${c.name}`,onClick:()=>a(v=>{const b=new Set(v);return b.delete(c.id)||b.add(c.id),b}),children:f?"▾":"▸"}):o.jsx("span",{className:"spend__twist"})}),o.jsx(Qe,{tone:c.tokens===0?"off":c.kind,children:c.kind==="worktree"?"◫":"▣"}),o.jsx("span",{className:"spend__name",children:c.name}),o.jsx("span",{className:"spend__bar",children:t>0&&c.tokens>0&&o.jsx("span",{className:"spend__fill",style:{"--w":`${String(Math.round(c.tokens/t*100))}%`}})}),o.jsx("span",{className:"spend__tok",children:_h(c.tokens)}),c.cost===null?o.jsx("span",{className:"spend__cost spend__cost--none",children:"sem custo reportado"}):o.jsx("span",{className:"spend__cost",children:F0(c.cost,c.currency)}),o.jsx("span",{className:"spend__turns",children:c.turns===0?"nenhum turno":`${String(c.turns)} turnos`})]}),f&&h.map(v=>o.jsxs("div",{className:`spend__row spend__row--agent${v.name===null?" spend__row--idle":""}`,children:[o.jsx("span",{className:"spend__twist"}),o.jsx(Qe,{tone:v.name===null?"off":"agent",children:"◆"}),o.jsx("span",{className:"spend__name",children:v.name??"antes desta versão"}),o.jsx("span",{className:"spend__bar",children:c.tokens>0&&v.tokens>0&&o.jsx("span",{className:"spend__fill",style:{"--w":`${String(Math.round(v.tokens/c.tokens*100))}%`}})}),o.jsx("span",{className:"spend__tok",children:_h(v.tokens)}),v.cost===null?o.jsx("span",{className:"spend__cost spend__cost--none",children:"sem custo reportado"}):o.jsx("span",{className:"spend__cost",children:F0(v.cost,v.currency)}),o.jsx("span",{className:"spend__turns",children:v.turns===0?"nenhum turno":`${String(v.turns)} turnos`})]},v.id))]},c.id)})})}function F0(e,t){const i=e.toFixed(4).replace(".",",");return t==="USD"||t===null?`US$ ${i}`:`${t} ${i}`}function EO({workspaceId:e,workspaceName:t,onRemoved:i}){const[n,a]=j.useState("7d"),c=Ne({queryKey:ta(e),queryFn:()=>ie.project.listByWorkspace.query({workspaceId:e})}),h=KT(e,n),f=(Ne({queryKey:OO,queryFn:()=>ie.agentConfig.list.query()}).data??[]).filter(b=>b.transport==="acp").length>1,m=WT(e,n,f),g=c.data??[],v=(h.data??[]).map(b=>({id:b.projectId,name:b.name,tokens:b.tokens,cost:b.cost,currency:b.currency,turns:b.turns,kind:"project",...AO(m.data,b.projectId)}));return o.jsxs("div",{className:"pane wsp",children:[o.jsxs("div",{className:"detail__title",children:[o.jsx("h2",{children:t}),o.jsx("span",{className:"wsp__kind",children:"workspace"}),o.jsx("span",{className:"actions__spacer"}),o.jsx(NO,{id:e,name:t}),o.jsx(TO,{id:e,projects:c.isPending?"unknown":g.length,onRemoved:i})]}),o.jsx("div",{className:"chips",children:o.jsxs(as,{children:[g.length," ",g.length===1?"projeto":"projetos"]})}),c.isError&&o.jsx("div",{className:"detail__banner",children:o.jsx(Ae,{tone:"danger",children:c.error.message})}),c.isPending?o.jsx(di,{label:"carregando os projetos",widths:["70%","50%"]}):g.length===0?o.jsx(ms,{title:"Nenhum projeto ainda",children:"Um workspace é um conjunto de projetos que se conhecem. Adicione o primeiro pela barra da esquerda — e o que você ensinar aqui já vale para todos eles."}):o.jsx(da,{entries:[{label:"projetos",value:String(g.length)},{label:"sem diretório",value:g.filter(b=>!b.available).length===0?o.jsx("span",{className:"dim",children:"nenhum"}):`${String(g.filter(b=>!b.available).length)} de ${String(g.length)}`}]}),o.jsxs("section",{className:"section",children:[o.jsx(kh,{title:"Consumo",aside:o.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo",children:kw.map(b=>o.jsx("button",{type:"button",className:"seg__btn","aria-pressed":n===b.id,onClick:()=>a(b.id),children:b.label},b.id))})}),h.isError?o.jsx(Ae,{tone:"danger",children:h.error.message}):h.isPending?o.jsx(di,{label:"somando o consumo",widths:["90%","70%"]}):v.length===0?o.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste workspace"}):o.jsx(Aw,{rows:v})]}),o.jsx("section",{className:"section",children:o.jsx(Ew,{workspaceId:e,projectId:null})})]})}function NO({id:e,name:t}){const[i,n]=j.useState(!1),[a,c]=j.useState(t),h=We(),d=He({mutationFn:f=>ie.workspace.rename.mutate({id:e,name:f}),onSuccess:async()=>{await h.invalidateQueries({queryKey:mr}),n(!1)}});return i?o.jsxs("form",{className:"wsp__rename",onSubmit:f=>{f.preventDefault();const m=a.trim();if(m===""||m===t){n(!1);return}d.mutate(m)},children:[o.jsx("input",{className:"wsp__input focus-ring","aria-label":"Nome do workspace",value:a,autoFocus:!0,onChange:f=>c(f.target.value),onKeyDown:f=>{f.key==="Escape"&&n(!1)}}),o.jsx(de,{variant:"primary",size:"sm",type:"submit",disabled:d.isPending,children:"salvar"}),d.isError&&o.jsx(Ae,{tone:"danger",children:d.error.message})]}):o.jsx(de,{variant:"ghost",size:"sm",onClick:()=>{c(t),n(!0)},children:"renomear"})}function TO({id:e,projects:t,onRemoved:i}){const n=We(),a=He({mutationFn:()=>ie.workspace.remove.mutate({id:e}),onSuccess:async()=>{await n.invalidateQueries({queryKey:mr}),i()}});return o.jsxs(o.Fragment,{children:[o.jsx(de,{variant:"ghost",size:"sm",disabled:t==="unknown"||t>0||a.isPending,onClick:()=>a.mutate(),children:a.isPending?"removendo…":"remover workspace"}),typeof t=="number"&&t>0&&o.jsxs("span",{className:"wsp__why",children:[t," ",t===1?"projeto dentro":"projetos dentro"]}),a.isError&&o.jsx(Ae,{tone:"danger",children:a.error.message})]})}const OO=["agentConfig","list"];function AO(e,t){const i=(e??[]).filter(n=>n.projectId===t).map(n=>({id:n.agentConfigId??"sem-agente",name:n.name,tokens:n.tokens,cost:n.cost,currency:n.currency,turns:n.turns}));return i.length>0?{agents:i}:{}}function Rw(e,t="worktree"){return Ne({queryKey:SE(e.scopeType,e.scopeId,t),queryFn:()=>ie.changes.list.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:t}),refetchOnWindowFocus:!0})}function Mw(e){switch(e){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}}function Dw(e){switch(e){case"added":return"a";case"deleted":return"d";case"untracked":return"u";default:return"m"}}const RO=15e3,np=6e4;function MO(e){var t;return e.visible?e.status&&(((t=e.status.pull)==null?void 0:t.counts.running)??0)>0?RO:np:!1}function Bw(){const[e,t]=j.useState(()=>typeof document>"u"||!document.hidden);return j.useEffect(()=>{if(typeof document>"u")return;const i=()=>t(!document.hidden);return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[]),e}function DO(e,{panelOpen:t}){const i=Bw();return Ne({queryKey:DE(e??"-"),queryFn:()=>ie.pr.getByWorktree.query({worktreeId:e}),enabled:e!==null,refetchInterval:n=>MO({visible:i,status:n.state.data}),placeholderData:n=>n})}function BO(e){const t=Bw();return Ne({queryKey:BE(e??"-"),queryFn:()=>ie.pr.listByProject.query({projectId:e}),enabled:e!==null,refetchInterval:()=>t?np:!1,placeholderData:i=>i})}function LO(e){return Ne({queryKey:LE(e??"-"),queryFn:()=>ie.pr.draft.query({worktreeId:e}),enabled:e!==null,staleTime:Number.POSITIVE_INFINITY})}function zO(e){const t=We();return He({mutationFn:async()=>{await ie.pr.refresh.mutate(e)},onSettled:async()=>{await t.cancelQueries({queryKey:["pr"]}),await t.refetchQueries({queryKey:["pr"]})}})}const Lw="lumem.pr.dismissed";function qO(e){const[t,i]=j.useState(()=>PO());return{isDismissed:e!==null&&t.includes(e),dismiss:()=>{if(e===null)return;const n=[...new Set([...t,e])];i(n);try{localStorage.setItem(Lw,JSON.stringify(n))}catch{}}}}function PO(){try{const e=localStorage.getItem(Lw);if(e===null)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}const ap=new Set;function HO(e){ap.add(e);const t=()=>ap.delete(e);e.then(t,t)}async function IO(){await Promise.allSettled([...ap])}function K0(e,t,i){return`${e}:${t}:${i??"context"}`}const zw=j.createContext(null);function UO({children:e}){const[t,i]=j.useState(null),[n,a]=j.useState({}),c=j.useCallback(f=>{a(m=>t===null?m:{...m,[t]:f})},[t]),h=j.useCallback(f=>{a(m=>{if(!(f in m))return m;const g={...m};return delete g[f],g})},[]),d=j.useMemo(()=>({activeTab:t,setActiveTab:i,fileFor:f=>n[f]??null,open:c,close:h}),[t,n,c,h]);return o.jsx(zw.Provider,{value:d,children:e})}function y_(){const e=j.useContext(zw);if(e===null)throw new Error("useOpenFiles precisa de um OpenFilesProvider acima");return e}function Lu(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function $0(e,t){return t===e||t.startsWith(`${e}/`)}function FO(e){var I,ae,le;const t=We(),i=y_(),[n,a]=j.useState({kind:"idle"}),c=i.activeTab,h=c===null?null:i.fileFor(c),d=h!==null&&h.view==="file"?h.path:null,f=j.useRef(null),[m,g]=j.useState(0);j.useEffect(()=>{const H=f.current;H!==null&&(f.current=null,IO().then(H))},[m]);const v=j.useCallback(H=>{if(c===null){H();return}f.current=H,i.close(c),g(z=>z+1)},[i,c]),b=j.useCallback((...H)=>{t.invalidateQueries({queryKey:["changes"]});for(const z of new Set(H))t.invalidateQueries({queryKey:a_(e.scopeType,e.scopeId,z)})},[t,e.scopeType,e.scopeId]),S=He({mutationFn:H=>ie.files.create.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:H.path,kind:H.kind}),onSuccess:H=>{b(Lu(H.path)),a({kind:"idle"})}}),x=He({mutationFn:H=>ie.files.rename.mutate({scopeType:e.scopeType,scopeId:e.scopeId,from:H.from,to:H.to}),onSuccess:(H,z)=>{if(b(Lu(z.from),Lu(H.path)),z.reopen!==null){const re=z.reopen.slice(z.from.length);i.open({path:`${H.path}${re}`,view:"file"})}a({kind:"idle"})},onError:(H,z)=>{z.reopen!==null&&i.open({path:z.reopen,view:"file"})}}),C=He({mutationFn:H=>ie.files.remove.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:H.path,recursive:H.recursive}),onSuccess:(H,z)=>{b(Lu(z.path)),a({kind:"idle"})},onError:(H,z)=>{z.reopen!==null&&i.open({path:z.reopen,view:"file"})}}),k=n.kind==="delete"?n.path:null,N=Ne({queryKey:bE(e.scopeType,e.scopeId,k??""),queryFn:()=>ie.files.deletePreview.query({scopeType:e.scopeType,scopeId:e.scopeId,path:k??""}),enabled:k!==null,gcTime:0}),L=S.reset,D=x.reset,M=C.reset,Y=j.useCallback(H=>{L(),D(),M(),a(H)},[L,D,M]),Z=j.useCallback(()=>Y({kind:"idle"}),[Y]),W=j.useCallback(H=>{const z=H.trim();if(z==="")return;if(n.kind==="create"){const F=n.parent;S.mutate({path:F===""?z:`${F}/${z}`,kind:n.makes});return}if(n.kind!=="rename")return;const re=n.path,se=d!==null&&$0(re,d)?d:null,A=()=>x.mutate({from:re,to:z,reopen:se});se===null?A():v(A)},[S,n,v,x,d]),ee=j.useCallback(()=>{if(n.kind!=="delete")return;const H=n.path,z=d!==null&&$0(H,d)?d:null,re=()=>C.mutate({path:H,recursive:n.directory,reopen:z});z===null?re():v(re)},[n,v,C,d]);return{gesture:n,ask:Y,cancel:Z,refusal:((I=S.error)==null?void 0:I.message)??((ae=x.error)==null?void 0:ae.message)??((le=C.error)==null?void 0:le.message)??null,busy:S.isPending||x.isPending||C.isPending,submit:W,confirm:ee,preview:N}}function KO(e){var a,c;const t=Ne({queryKey:n_(e.scopeId),queryFn:()=>ie.worktree.getDetail.query({id:e.scopeId}),enabled:e.scopeType==="worktree"}),i=e.scopeType==="project"?e.scopeId:((a=t.data)==null?void 0:a.projectId)??null;return{workspaceId:((c=Ne({queryKey:yE(i??"-"),queryFn:()=>ie.project.get.query({id:i}),enabled:i!==null}).data)==null?void 0:c.workspaceId)??null,projectId:i}}function $O({scope:e,openPath:t,onOpenPatch:i,onRefChange:n}){var x,C;const[a,c]=j.useState("worktree"),h=Rw(e,a),d=a==="base"&&h.isError?h.error.message:null,f=j.useRef("base");j.useEffect(()=>{h.data!==void 0&&(f.current=h.data.baseBranch)},[h.data]);const m=((x=h.data)==null?void 0:x.baseBranch)??f.current,g=((C=h.data)==null?void 0:C.files)??[],v=g.reduce((k,N)=>k+N.additions,0),b=g.reduce((k,N)=>k+N.deletions,0);function S(k){c(k),n==null||n(k)}return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"seg-wrap",children:o.jsxs("div",{className:"seg",role:"group","aria-label":"o que comparar",children:[o.jsx("button",{type:"button",className:`seg__btn${a==="worktree"?" seg__btn--on":""}`,"aria-pressed":a==="worktree",onClick:()=>S("worktree"),children:"não commitado"}),o.jsxs("button",{type:"button",className:`seg__btn${a==="base"?" seg__btn--on":""}${d===null?"":" seg__btn--off"}`,"aria-pressed":a==="base",onClick:()=>S("base"),children:["vs ",m]})]})}),d!==null&&o.jsxs("p",{className:"fnote",role:"alert",children:[o.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),o.jsx("span",{children:d})]}),h.isPending?o.jsx("div",{className:"rp__scroll",children:o.jsx("p",{className:"fnote",children:"carregando…"})}):g.length===0&&d===null?VO(a,m):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"sum",children:[o.jsxs("span",{children:[g.length," ",g.length===1?"arquivo":"arquivos"]}),v>0&&o.jsxs("span",{className:"plus",children:["+",v]}),b>0&&o.jsxs("span",{className:"minus",children:["−",b]})]}),o.jsx("div",{className:"rp__scroll",children:g.map(k=>o.jsx(WO,{file:k,open:t===k.path,onOpen:()=>i(k.path,a)},k.path))})]})]})}function WO({file:e,open:t,onOpen:i}){const n=e.path.lastIndexOf("/"),a=n===-1?"":e.path.slice(0,n+1),c=e.path.slice(n+1);return o.jsxs("button",{type:"button",className:`drow${t?" drow--open":""}`,onClick:i,children:[o.jsx("span",{className:`mark mark--${Dw(e.status)}`,title:e.status,children:Mw(e.status)}),o.jsxs("span",{className:"dpath",title:e.path,children:[o.jsx("span",{className:"dpath__dir",children:a}),o.jsx("span",{className:"dpath__name",children:c})]}),e.binary?o.jsx("span",{className:"dstat",children:"binário"}):o.jsxs(o.Fragment,{children:[e.additions>0&&o.jsxs("span",{className:"dstat plus",children:["+",e.additions]}),e.deletions>0&&o.jsxs("span",{className:"dstat minus",children:["−",e.deletions]})]}),e.oldPath!==null&&o.jsxs("span",{className:"drow__was",children:["era ",e.oldPath]}),o.jsx("span",{className:"drow__gap"})]})}function VO(e,t){return o.jsxs("div",{className:"empty",children:[o.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"empty__title",children:e==="worktree"?"nada por commitar":`idêntica a ${t}`}),o.jsx("span",{className:"empty__why",children:e==="worktree"?"a árvore de trabalho está igual ao HEAD. O que já foi commitado aparece na outra vista.":"nada nesta worktree diverge da base — nem commitado, nem por commitar."})]})}function YO(e){switch(e){case"ready":return"ready";case"blocked":return"blocked";case"pending":return"pending";case"merged":return"merged";default:return"none"}}const zu=(e,t,i)=>`${String(e)} ${e===1?t:i}`;function qu(e,t=2){return e.slice(0,t)}function GO(e){const t=e.reason;switch(t.kind){case"conflict":return{state:"conflito com a base",why:[{text:"não mescla sozinha em "},{text:t.base,strong:!0}]};case"checks-failed":{const i=qu(t.names),n=t.names.length-i.length;return{state:zu(t.names.length,"verificação falhou","verificações falharam"),why:[...i.flatMap((a,c)=>[...c>0?[{text:", "}]:[],{text:a,strong:!0}]),...n>0?[{text:` e mais ${String(n)}`}]:[]]}}case"changes-requested":{const i=qu(t.by,1);return{state:"mudanças pedidas",why:i.length===0?[{text:"alguém pediu mudanças nesta pull request"}]:[{text:"por "},{text:i[0],strong:!0}]}}case"review-required":return{state:"falta revisão",why:[{text:"a regra da base exige aprovação"}]};case"behind":return{state:"atrás da base",why:[{text:"atualize a partir de "},{text:t.base,strong:!0}]};case"blocked-by-host":return{state:"bloqueada pelo GitHub",why:[{text:"uma regra da base impede o merge — o motivo está na pull request"}]};case"checks-running":{const i=qu(t.names,1),n=t.running+t.queued;return{state:zu(n,"verificação rodando","verificações rodando"),why:[...i.length>0?[{text:i[0],strong:!0}]:[],...t.queued>0?[{text:`${i.length>0?" · ":""}${String(t.queued)} na fila`}]:[]]}}case"mergeability-unknown":return{state:"verificando",why:[{text:"o GitHub ainda não disse se ela mescla"}]};case"ready":{const i=qu(t.approvedBy,1);return{state:"pronta para merge",why:[{text:t.passed===0?"nada impede":zu(t.passed,"verificação passou","verificações passaram")},...i.length>0?[{text:" · aprovada por "},{text:i[0],strong:!0}]:[]]}}case"draft":return{state:"rascunho",why:[{text:t.passed===0?"marque como pronta no GitHub":`${zu(t.passed,"verificação passou","verificações passaram")} · marque como pronta no GitHub`}]};case"merged":return{state:"mesclada",why:[{text:"em "},{text:t.base,strong:!0},{text:" · esta worktree pode ser removida"}]};case"closed":return{state:"fechada sem merge",why:[{text:"ninguém mesclou esta pull request"}]}}}function QO(e){return e.published?{state:"sem pull request",why:[{text:"publicada · ninguém abriu pull request para "},{text:e.base,strong:!0}]}:{state:"branch não publicada",why:[{text:"nenhum remoto conhece "},{text:e.branch,strong:!0}]}}function cm(e,t){switch(e.kind){case"no-binary":return{state:"sem integração com o GitHub",why:[{text:"instale o "},{text:"gh",strong:!0},{text:" para ver PR e verificações aqui"}],dismissible:!0};case"no-auth":return{state:"gh não autenticado",why:[{text:"rode "},{text:"gh auth login",strong:!0},{text:" num shell desta worktree"}],dismissible:!1};case"unsupported-host":return{state:t===null?"sem integração":`sem integração com ${t}`,why:[{text:"o v1 fala só GitHub · o adaptador de host é a porta para os outros"}],dismissible:!0};case"rate-limit":return{state:"limite do GitHub atingido",why:e.retryAt===null?[{text:"o dado acima é de antes · tente de novo mais tarde"}]:[{text:"volta a consultar às "},{text:ZO(e.retryAt),strong:!0},{text:" · o dado acima é de antes"}],dismissible:!1};case"not-a-repo":return{state:"sem integração",why:[{text:"este checkout não é um repositório git"}],dismissible:!0};case"offline":case"timeout":return{state:"sem conexão com o GitHub",why:[{text:"o dado acima é o último que deu para ler"}],dismissible:!1};default:return{state:"não deu para ler a pull request",why:[{text:e.message}],dismissible:!1}}}function ZO(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}const XO=12e4;function qw(e,t=Date.now()){if(e===null)return null;const i=Date.parse(e);if(Number.isNaN(i))return null;const n=Math.max(0,t-i);return{label:`há ${JO(n)}`,stale:n>XO}}function JO(e){const t=Math.floor(e/1e3);if(t<60)return`${String(t)} s`;const i=Math.floor(t/60);if(i<60)return`${String(i)} min`;const n=Math.floor(i/60);return n<24?`${String(n)} h`:`${String(Math.floor(n/24))} d`}function eA(e){if(e===null)return"—";const t=Math.round(e/1e3);if(t<60)return`${String(t)}s`;const i=Math.floor(t/60),n=t%60;return`${String(i)}m${String(n).padStart(2,"0")}s`}const tA=[{group:"failed",title:"precisa de você"},{group:"running",title:"em andamento"},{group:"passed",title:"passaram"},{group:"skipped",title:"ignoradas"}],sA={failed:{char:"✕",word:"falhou",suffix:"bad"},running:{char:"●",word:"rodando",suffix:"run"},passed:{char:"✓",word:"passou",suffix:"ok"},skipped:{char:"–",word:"pulada",suffix:"skip"}};function iA({pull:e,readAt:t,now:i}){const n=qw(t,i);return e.checks.length===0?o.jsx("div",{className:"checks",children:o.jsx(ms,{title:"Nenhuma verificação",children:"Esta pull request não tem verificação configurada, ou o host ainda não relatou nenhuma."})}):o.jsxs("div",{className:"checks",children:[tA.map(({group:a,title:c})=>{const h=e.checks.filter(d=>d.group===a);return h.length===0?null:o.jsxs("div",{children:[o.jsx("div",{className:"checks__group",children:c}),h.map(d=>o.jsx(rA,{check:d},`${a}:${d.name}`))]},a)}),o.jsxs("div",{className:"checks__foot",children:[n===null?"lido do gh":`lido do gh ${n.label}`," · reexecutar se faz no navegador"]})]})}function rA({check:e}){const t=sA[e.group],i=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"checks__glyph","aria-hidden":"true",children:t.char}),o.jsx("span",{className:"sr-only",children:t.word}),o.jsxs("span",{className:"checks__body",children:[o.jsx("span",{className:"checks__name",children:e.name}),e.app!==""&&o.jsx("span",{className:"checks__app",children:e.app})]}),o.jsx("span",{className:"checks__time",children:eA(e.durationMs)})]});return e.url===null?o.jsxs("div",{className:"checks__row",title:"o endereço desta execução não é do host do projeto",children:[i,o.jsx("span",{className:"checks__go","aria-hidden":"true"})]}):o.jsxs("a",{className:`checks__row checks__row--${t.suffix} focus-ring`,href:e.url,target:"_blank",rel:"noopener noreferrer",children:[i,o.jsx("span",{className:"checks__go","aria-hidden":"true",children:"↗"}),o.jsxs("span",{className:"sr-only",children:["abrir a execução de ",e.name]})]})}function nA(e){const{failed:t,running:i,passed:n}=e.counts;return t>0?{text:`✕${String(t)}`,tone:"bad"}:i>0?{text:`●${String(i)}`,tone:"run"}:{text:`✓${String(n)}`,tone:"ok"}}function b_(){const[e,t]=j.useState(!1),i=j.useRef(null),n=j.useRef(null),a=j.useCallback(()=>{t(h=>{var d;return h&&((d=i.current)==null||d.focus()),!1})},[]),c=j.useCallback(()=>t(h=>!h),[]);return j.useEffect(()=>{if(!e)return;const h=f=>{f.key==="Escape"&&a()},d=f=>{var g,v;const m=f.target;((g=n.current)==null?void 0:g.contains(m))!==!0&&((v=i.current)==null?void 0:v.contains(m))!==!0&&t(!1)};return document.addEventListener("keydown",h),document.addEventListener("pointerdown",d),()=>{document.removeEventListener("keydown",h),document.removeEventListener("pointerdown",d)}},[e,a]),{open:e,toggle:c,close:a,triggerRef:i,panelRef:n}}function aA({scope:e,openPath:t,onOpen:i,statusOf:n,edits:a}){const[c,h]=j.useState(new Set),d=j.useCallback(m=>{h(g=>{const v=new Set(g);return v.delete(m)||v.add(m),v})},[]),f=j.useCallback(m=>{h(g=>g.has(m)?g:new Set(g).add(m))},[]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rp__scroll",role:"tree","aria-label":"arquivos",children:o.jsx(Pw,{scope:e,path:"",depth:0,expanded:c,onToggle:d,onExpand:f,edits:a,openPath:t,onOpen:i,statusOf:n})}),o.jsx(cA,{edits:a})]})}function Pw({scope:e,path:t,depth:i,expanded:n,onToggle:a,onExpand:c,edits:h,openPath:d,onOpen:f,statusOf:m}){const[g,v]=j.useState(void 0),b=Ne({queryKey:[...a_(e.scopeType,e.scopeId,t),g??"default"],queryFn:()=>ie.files.listDir.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t,...g===void 0?{}:{limit:g}}),refetchOnWindowFocus:!0}),S=h.gesture,x=S.kind==="create"&&S.parent===t?o.jsx(W0,{depth:i,label:S.makes==="dir"?"nova pasta":"novo arquivo",initial:"",hint:o.jsxs(o.Fragment,{children:["enter cria em ",o.jsx("code",{children:t===""?"./":`${t}/`})," · esc cancela"]}),edits:h},`${t}:${S.makes}`):null;if(b.isPending)return o.jsxs(o.Fragment,{children:[x,o.jsx("p",{className:"fnote",style:{"--depth":i},children:"carregando…"})]});if(b.isError)return o.jsxs(o.Fragment,{children:[x,o.jsxs("p",{className:"fnote",style:{"--depth":i},role:"alert",children:[o.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),o.jsx("span",{children:b.error.message})]})]});const{entries:C,total:k,truncated:N}=b.data;return C.length===0?o.jsxs(o.Fragment,{children:[x,o.jsx("p",{className:"fnote",style:{"--depth":i},children:"vazio"})]}):o.jsxs(o.Fragment,{children:[x,C.map(L=>{const D=t===""?L.name:`${t}/${L.name}`,M=L.kind==="dir",Y=n.has(D),Z=m(D);return S.kind==="rename"&&S.path===D?o.jsx(W0,{depth:i,label:"renomear",initial:D,hint:o.jsx(o.Fragment,{children:"com barra, move · esc cancela"}),edits:h},D):o.jsxs("div",{role:"group",children:[o.jsxs("div",{className:"frow-wrap",children:[o.jsxs("button",{type:"button",className:["frow",M?"frow--dir":"",Z==="deleted"?"frow--dim":"",d===D?"frow--open":""].filter(Boolean).join(" "),"aria-expanded":M?Y:void 0,onClick:()=>M?a(D):f(D),children:[o.jsx("span",{className:"frow__twist",style:{"--depth":i},"aria-hidden":"true",children:M?Y?"▾":"▸":""}),o.jsx("span",{className:"frow__name",children:L.name}),Z!==void 0&&o.jsx("span",{className:`mark mark--${Dw(Z)}`,title:Z,children:Mw(Z)}),o.jsx("span",{className:"frow__gap"}),L.size!==null&&L.size>0&&o.jsx("span",{className:"frow__size",children:Ao(L.size)})]}),o.jsx(oA,{path:D,isDir:M,edits:h,onExpand:c})]}),M&&Y&&o.jsx(Pw,{scope:e,path:D,depth:i+1,expanded:n,onToggle:a,onExpand:c,edits:h,openPath:d,onOpen:f,statusOf:m})]},D)}),N&&o.jsxs("p",{className:"fnote",style:{"--depth":i},children:[o.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),o.jsxs("span",{children:[C.length," de ",k," entradas."," ",o.jsx("button",{type:"button",onClick:()=>v(k),children:"listar assim mesmo"})]})]})]})}function lA({edits:e}){const t=b_(),i=n=>()=>{t.close(),e.ask({kind:"create",parent:"",makes:n})};return o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",ref:t.triggerRef,className:"rp__icon","aria-haspopup":"menu","aria-expanded":t.open,"aria-label":"criar na raiz",title:"criar na raiz do checkout",onClick:t.toggle,children:"+"}),t.open&&o.jsx("div",{className:"rp__menu",ref:t.panelRef,children:o.jsxs(h_,{label:"criar na raiz",children:[o.jsx(hn,{glyph:o.jsx(Qe,{children:"+"}),onSelect:i("file"),children:"novo arquivo"}),o.jsx(hn,{glyph:o.jsx(Qe,{children:"▤"}),onSelect:i("dir"),children:"nova pasta"})]})})]})}function oA({path:e,isDir:t,edits:i,onExpand:n}){const a=b_(),c=h=>()=>{a.close(),n(e),i.ask({kind:"create",parent:e,makes:h})};return o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",ref:a.triggerRef,className:"fact","aria-haspopup":"menu","aria-expanded":a.open,"aria-label":`ações de ${e}`,onClick:a.toggle,children:"⋯"}),a.open&&o.jsx("div",{className:"frow-menu",ref:a.panelRef,children:o.jsxs(h_,{label:`ações de ${e}`,children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(hn,{glyph:o.jsx(Qe,{children:"+"}),onSelect:c("file"),children:"novo arquivo"}),o.jsx(hn,{glyph:o.jsx(Qe,{children:"▤"}),onSelect:c("dir"),children:"nova pasta"}),o.jsx("div",{className:"frow-menu__sep",role:"separator"})]}),o.jsx(hn,{glyph:o.jsx(Qe,{children:"✎"}),onSelect:()=>{a.close(),i.ask({kind:"rename",path:e})},children:"renomear"}),o.jsx(hn,{glyph:o.jsx(Qe,{tone:"warn",children:"✕"}),onSelect:()=>{a.close(),i.ask({kind:"delete",path:e,directory:t})},children:"apagar"})]})})]})}function W0({depth:e,label:t,initial:i,hint:n,edits:a}){const[c,h]=j.useState(i),d=a.refusal!==null;return o.jsxs(o.Fragment,{children:[o.jsxs("form",{className:"fedit",onSubmit:f=>{f.preventDefault(),a.submit(c)},children:[o.jsx("span",{className:"frow__twist",style:{"--depth":e},"aria-hidden":"true"}),o.jsx("input",{className:`finput${d?" finput--error":""}`,"aria-label":t,"aria-invalid":d,value:c,autoFocus:!0,disabled:a.busy,onChange:f=>h(f.target.value),onKeyDown:f=>{f.key==="Escape"&&a.cancel()}})]}),o.jsx("p",{className:`fhint${d?" fhint--error":""}`,style:{"--depth":e},role:d?"alert":void 0,children:a.refusal??n})]})}function cA({edits:e}){const{gesture:t,cancel:i}=e;if(j.useEffect(()=>{if(t.kind!=="delete")return;const f=m=>{m.key==="Escape"&&i()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[t.kind,i]),t.kind!=="delete")return null;const n=e.preview,a=n.data??null,c=a!==null&&a.kind==="dir"?a.files+a.dirs:null,h=a!==null&&a.kind==="dir"&&a.truncated,d=a===null?t.directory:a.kind==="dir";return o.jsx("div",{className:"fdim",role:"dialog","aria-modal":"true","aria-label":`apagar ${t.path}`,children:o.jsxs(cw,{title:d?"apagar esta pasta e o que tem dentro?":"apagar este arquivo?",children:[o.jsx("code",{className:"fdim__target",children:t.path}),n.isPending&&o.jsx("p",{className:"fdim__note",children:"consultando o git…"}),n.isError&&o.jsxs(Ae,{tone:"danger",children:["não deu para consultar o git: ",n.error.message,". Nada foi verificado sobre o que volta."]}),a!==null&&a.kind==="file"&&o.jsx(uA,{path:t.path,tracked:a.tracked}),a!==null&&a.kind==="dir"&&o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"fdim__note",children:[h?"pelo menos ":"",Xr(a.files)," ",a.files===1?"arquivo":"arquivos"," e"," ",Xr(a.dirs)," ",a.dirs===1?"pasta":"pastas",", contando os subdiretórios.",h?" A contagem parou no teto do daemon.":""]}),o.jsx(hA,{path:t.path,files:a.files,untracked:a.untracked,truncated:a.truncated})]}),o.jsxs("div",{className:"fdim__actions",children:[o.jsx(de,{variant:"ghost",onClick:i,children:"cancelar"}),o.jsx(de,{variant:"danger",disabled:e.busy,onClick:e.confirm,children:c===null?"apagar":`apagar ${h?"pelo menos ":"as "}${Xr(c)} ${c===1?"entrada":"entradas"}`})]}),e.refusal!==null&&o.jsx(Ae,{tone:"danger",children:e.refusal})]})})}function uA({path:e,tracked:t}){return t?o.jsxs(Ae,{tone:"info",children:["o git tem uma cópia: ",o.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]}):o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:"o git não confirmou ter uma cópia disto."})," Pode não haver nada que traga de volta — nem o histórico, nem esta janela."]})}function hA({path:e,files:t,untracked:i,truncated:n}){if(n)return o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:i>0?`de pelo menos ${Xr(t)}, ${Xr(i)} o git não confirmou ter.`:"o git não foi consultado sobre tudo que está aqui dentro."})," ","O que a caminhada não alcançou também não foi verificado, e nada aqui promete que volte."]});if(i===0)return o.jsxs(Ae,{tone:"info",children:["o git tem cópia do que está aqui dentro: ",o.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]});const a=t-i;return o.jsxs(Ae,{tone:"danger",children:[o.jsxs("strong",{children:["de ",Xr(t),", ",Xr(i)," o git não confirmou ter."]})," ",a>0?`Nada garante que voltem; ${Xr(a)} o git desfaz.`:"Nada garante que voltem."]})}function Xr(e){return e.toLocaleString("pt-BR")}function Ao(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1).replace(".",",")} MB`}const V0={squash:"squash",merge:"merge commit",rebase:"rebase"};function dA(e){const t=j.useRef(null);return j.useEffect(()=>{var i;return(i=t.current)==null?void 0:i.focus()},[]),o.jsx("div",{className:"prgate",role:"dialog","aria-modal":"true","aria-label":e.verb==="merge"?"mesclar a pull request":"abrir uma pull request",onKeyDown:i=>{i.key==="Escape"&&(i.stopPropagation(),e.onClose())},children:e.verb==="merge"?o.jsx(fA,{...e,cancelRef:t}):o.jsx(mA,{...e,cancelRef:t})})}function Hw(e){const t=We();return()=>(t.invalidateQueries({queryKey:["pr"]}),t.invalidateQueries({queryKey:["worktree"]}),t.invalidateQueries({queryKey:["changes"]}),e)}function fA({status:e,worktreeId:t,onClose:i,cancelRef:n}){const a=Hw(t),c=pA(e),[h,d]=j.useState(c[0]??"merge"),[f,m]=j.useState(e.merge.deleteBranchOnMerge),g=He({mutationFn:()=>ie.pr.merge.mutate({worktreeId:t,strategy:h,deleteBranch:f}),onSuccess:()=>{a(),i()}}),v=e.pull;return v===null?null:o.jsxs("form",{className:"prform",onSubmit:b=>{b.preventDefault(),g.mutate()},children:[o.jsxs("div",{className:"prgate__t",children:[o.jsx("span",{className:"prgate__g","aria-hidden":"true",children:"⚠"}),"Mesclar a #",v.number,"?"]}),o.jsxs("div",{className:"prform__what",children:[o.jsxs("span",{children:[o.jsx("b",{children:v.head})," entra em ",o.jsx("b",{children:v.base}),", por ",o.jsx("b",{children:V0[h]}),"."]}),o.jsx("span",{children:f?"A branch remota é apagada. A worktree local fica onde está.":"A branch remota fica. A worktree local também."})]}),o.jsxs("div",{className:"prform__field",children:[o.jsx("span",{className:"prform__label",children:"estratégia"}),o.jsx("div",{className:"prform__strategies",role:"radiogroup","aria-label":"estratégia de merge",children:c.map(b=>o.jsx(de,{size:"sm",variant:b===h?"primary":"default",role:"radio","aria-checked":b===h,onClick:()=>d(b),children:V0[b]},b))})]}),o.jsx("label",{className:"prform__field",children:o.jsxs("span",{children:[o.jsx("input",{type:"checkbox",checked:f,onChange:b=>m(b.target.checked)})," ","apagar a branch remota depois"]})}),g.isError&&o.jsx("p",{className:"prform__error",role:"alert",children:g.error.message}),o.jsxs("div",{className:"prform__acts",children:[o.jsx(de,{size:"sm",variant:"ghost",ref:n,onClick:i,children:"cancelar"}),o.jsx(de,{size:"sm",variant:"danger",type:"submit",disabled:g.isPending,children:g.isPending?"mesclando…":"mesclar"})]})]})}function mA({status:e,worktreeId:t,onClose:i,cancelRef:n}){var k;const a=Hw(t),c=LO(t),[h,d]=j.useState(null),f=h??((k=c.data)==null?void 0:k.title)??"",m=d,[g,v]=j.useState(""),[b,S]=j.useState(!1),x=He({mutationFn:()=>ie.pr.create.mutate({worktreeId:t,title:f.trim(),body:g,draft:b}),onSuccess:()=>{a(),i()}}),C=`pr-title-${t}`;return o.jsxs("form",{className:"prform",onSubmit:N=>{N.preventDefault(),f.trim()!==""&&x.mutate()},children:[o.jsx("div",{className:"prgate__t",children:"Abrir pull request"}),o.jsx("div",{className:"prform__what",children:o.jsxs("span",{children:[o.jsx("b",{children:e.branch})," para ",o.jsx("b",{children:e.base}),", em ",o.jsx("b",{children:e.host??"GitHub"}),"."]})}),o.jsx(Xt,{id:C,label:"Título",error:x.isError?x.error.message:void 0,children:o.jsx(cs,{id:C,value:f,onChange:N=>m(N.target.value),placeholder:"feat: o que esta branch faz",invalid:x.isError,autoFocus:!0})}),o.jsxs("div",{className:"prform__field",children:[o.jsx("label",{className:"prform__label",htmlFor:`${C}-body`,children:"descrição"}),o.jsx("textarea",{id:`${C}-body`,className:"prform__body",rows:5,value:g,onChange:N=>v(N.target.value)})]}),o.jsx("label",{className:"prform__field",children:o.jsxs("span",{children:[o.jsx("input",{type:"checkbox",checked:b,onChange:N=>S(N.target.checked)})," ","abrir como rascunho"]})}),o.jsxs("div",{className:"prform__acts",children:[o.jsx(de,{size:"sm",variant:"ghost",ref:n,onClick:i,children:"cancelar"}),o.jsx(de,{size:"sm",variant:"primary",type:"submit",disabled:x.isPending||f.trim()==="",children:x.isPending?"abrindo…":"abrir"}),e.compareUrl!==null&&o.jsxs("a",{className:"btn btn--ghost btn--sm focus-ring",href:e.compareUrl,target:"_blank",rel:"noopener noreferrer",children:["abrir no GitHub ",o.jsx("span",{"aria-hidden":"true",children:"↗"})]})]})]})}function pA(e){return["squash","merge","rebase"].filter(t=>e.merge[t])}function _A({words:e}){return o.jsx("span",{className:"prbar__why",children:e.map((t,i)=>t.strong===!0?o.jsx("b",{children:t.text},i):o.jsx("span",{children:t.text},i))})}function gA({status:e,worktreeId:t,now:i,onRetry:n,onDismiss:a}){const[c,h]=j.useState(null),d=e.pull,f=e.failure,m=d===null?"none":YO(d.verdict),g=d!==null?GO(d):f!==null?cm(f,e.host):QO(e),v=d!==null&&f!==null?cm(f,e.host):null,b=qw(e.readAt,i),S=d===null&&f!==null&&cm(f,e.host).dismissible,x=d!==null&&d.verdict==="ready"&&(e.merge.merge||e.merge.squash||e.merge.rebase),C=d===null&&e.published&&f===null&&e.host!==null;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`prbar prbar--${m}`,role:"status","aria-label":"estado da pull request",children:[o.jsxs("div",{className:"prbar__top",children:[d!==null&&o.jsx(vA,{pull:d}),o.jsxs("span",{className:"prbar__state",children:[o.jsx("span",{className:"prbar__dot","aria-hidden":"true"}),o.jsx("span",{className:"prbar__word",children:g.state})]})]}),o.jsxs("div",{className:"prbar__reason",children:[o.jsx(_A,{words:v===null?g.why:[...g.why,{text:" · "},...v.why]}),b!==null&&o.jsx("span",{className:`prbar__fresh${b.stale?" prbar__fresh--stale":""}`,children:b.label})]}),(x||C||e.compareUrl!==null||f!==null)&&o.jsxs("div",{className:"prbar__acts",children:[x&&o.jsx(de,{size:"sm",variant:"primary",onClick:()=>h("merge"),children:"mesclar"}),C&&o.jsx(de,{size:"sm",onClick:()=>h("create"),children:"abrir pull request"}),d===null&&e.compareUrl!==null&&o.jsxs("a",{className:"btn btn--sm focus-ring",href:e.compareUrl,target:"_blank",rel:"noopener noreferrer",children:["comparar no GitHub ",o.jsx("span",{"aria-hidden":"true",children:"↗"})]}),f!==null&&o.jsx(de,{size:"sm",variant:"ghost",onClick:n,children:"tentar de novo"}),S&&o.jsx(de,{size:"sm",variant:"ghost",onClick:a,children:"não mostrar mais"})]})]}),c!==null&&o.jsx(dA,{verb:c,status:e,worktreeId:t,onClose:()=>h(null)})]})}function vA({pull:e}){const t=`abrir a pull request ${String(e.number)} no navegador`;return o.jsxs(o.Fragment,{children:[e.url===null?o.jsx("span",{className:"prbar__pr",title:"o endereço desta pull request não é do host do projeto",children:o.jsxs("span",{className:"prbar__num",children:["#",e.number]})}):o.jsxs("a",{className:"prbar__pr focus-ring",href:e.url,target:"_blank",rel:"noopener noreferrer",children:[o.jsxs("span",{className:"prbar__num",children:["#",e.number]}),o.jsx("span",{className:"prbar__go","aria-hidden":"true",children:"↗"}),o.jsx("span",{className:"sr-only",children:t})]}),e.alsoOpen>0&&o.jsxs("span",{className:"prbar__more",title:"esta branch tem mais de uma pull request aberta",children:["+",e.alsoOpen]})]})}const Iw="lumem.rightPanel",yA=360,bA=260,SA=720;function xA(){const e={open:!1,width:yA};try{const t=window.localStorage.getItem(Iw);if(t===null)return e;const i=JSON.parse(t);if(typeof i!="object"||i===null)return e;const{open:n,width:a}=i;return{open:typeof n=="boolean"?n:e.open,width:typeof a=="number"?S_(a):e.width}}catch{return e}}function Y0(e){try{window.localStorage.setItem(Iw,JSON.stringify(e))}catch{}}function S_(e){return Math.min(SA,Math.max(bA,Math.round(e)))}function wA(){const[e,t]=j.useState(xA),i=j.useCallback(()=>{t(a=>{const c={...a,open:!a.open};return Y0(c),c})},[]),n=j.useCallback(a=>{t(c=>{const h={...c,width:S_(a)};return Y0(h),h})},[]);return{open:e.open,width:e.width,toggle:i,setWidth:n}}function CA({proposalCount:e=null,prBar:t,prBadge:i=null,tab:n,onSelectTab:a,changeCount:c,actions:h,onReload:d,onClose:f,onResize:m,dock:g,footLeft:v,footRight:b,children:S}){const x=j.useRef(!1),C=j.useRef(null),[k,N]=j.useState(!1),L=j.useCallback(D=>{var Y;const M=(Y=C.current)==null?void 0:Y.getBoundingClientRect().right;M===void 0||!Number.isFinite(D)||m(S_(M-D))},[m]);return j.useEffect(()=>{if(!k)return;const D=Y=>{x.current&&(Y.preventDefault(),L(Y.clientX))},M=()=>{x.current=!1,N(!1)};return window.addEventListener("pointermove",D),window.addEventListener("pointerup",M),()=>{window.removeEventListener("pointermove",D),window.removeEventListener("pointerup",M)}},[k,L]),o.jsxs("aside",{className:"rp","aria-label":"arquivos do checkout",ref:C,children:[o.jsx("span",{className:"rp__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura da coluna",onPointerDown:D=>{D.preventDefault(),x.current=!0,N(!0)}}),t,o.jsxs("div",{className:"rp__bar",role:"tablist","aria-label":"conteúdo da coluna",children:[o.jsx("button",{type:"button",role:"tab","aria-selected":n==="files",className:`rtab${n==="files"?" rtab--active":""}`,onClick:()=>a("files"),children:"Arquivos"}),o.jsxs("button",{type:"button",role:"tab","aria-selected":n==="changes",className:`rtab${n==="changes"?" rtab--active":""}`,onClick:()=>a("changes"),children:["Mudanças",c!==null&&c>0&&o.jsx("span",{className:"rtab__count",children:c})]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":n==="memory",className:`rtab${n==="memory"?" rtab--active":""}`,onClick:()=>a("memory"),children:["Memória",e!==null&&e>0&&o.jsx("span",{className:"rtab__count",children:e})]}),i!==null&&o.jsxs("button",{type:"button",role:"tab","aria-selected":n==="pr",className:`rtab${n==="pr"?" rtab--active":""}`,onClick:()=>a("pr"),children:["PR",o.jsx("span",{className:`rtab__count rtab__count--${i.tone}`,children:i.text})]}),o.jsx("span",{className:"rp__spacer"}),h,o.jsxs("button",{type:"button",className:"rp__icon",onClick:d,title:"recarregar",children:["⟳",o.jsx("span",{className:"sr-only",children:"recarregar"})]}),o.jsxs("button",{type:"button",className:"rp__icon",onClick:f,title:"fechar a coluna",children:["›",o.jsx("span",{className:"sr-only",children:"fechar a coluna"})]})]}),o.jsxs("div",{className:"rp__body",children:[S,o.jsxs("div",{className:"rp__foot",children:[o.jsx("span",{children:v}),o.jsx("span",{className:"rp__spacer"}),o.jsx("span",{children:b})]}),g]})]})}const jA=2e3;function Uw(e){return Ne({queryKey:Ux(e.scopeType,e.scopeId),queryFn:()=>ie.scripts.status.query(e),refetchInterval:t=>{const i=t.state.data;return i&&[i.setup,i.run,i.test,i.teardown].some(a=>{var c;return(c=a.last)==null?void 0:c.running})?jA:!1}})}function kA(e){const t=We(),i=()=>{t.invalidateQueries({queryKey:Ux(e.scopeType,e.scopeId)}),t.invalidateQueries({queryKey:["session"]})},n=He({mutationFn:h=>ie.scripts.start.mutate({...e,phase:h}),onSettled:i}),a=He({mutationFn:h=>ie.scripts.stop.mutate({...e,phase:h}),onSettled:i}),c=He({mutationFn:()=>ie.scripts.trust.mutate(e),onSettled:i});return{start:n,stop:a,trust:c}}const EA=3e3;function Fw(e){return{queryKey:Hi(e.scopeType,e.scopeId),queryFn:()=>ie.session.listByScope.query(e),refetchInterval:EA}}function x_(e){return Ne(Fw(e))}function w_(e){return Ix({queries:e.map(Fw),combine:t=>t.reduce((i,n)=>i+(n.data??[]).filter(a=>a.state==="running").length,0)})}function gh(e,t=Date.now()){const i=Date.parse(e);if(Number.isNaN(i))return"";const n=Math.max(0,Math.round((t-i)/1e3));if(n<60)return"agora";const a=Math.floor(n/60);if(a<60)return`${a} min`;const c=Math.floor(a/60);return c<24?`${c} h`:`${Math.floor(c/24)} d`}/**
|
|
51
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
52
|
+
* @license MIT
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
55
|
+
* @license MIT
|
|
56
|
+
*
|
|
57
|
+
* Originally forked from (with the author's permission):
|
|
58
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
59
|
+
* http://bellard.org/jslinux/
|
|
60
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
61
|
+
*/var NA=2,TA=1,OA=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(){var v;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:((v=this._terminal.options.overviewRuler)==null?void 0:v.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},d=h.top+h.bottom,f=h.right+h.left,m=n-d,g=a-f-t;return{cols:Math.max(NA,Math.floor(g/e.css.cell.width)),rows:Math.max(TA,Math.floor(m/e.css.cell.height))}}};/**
|
|
62
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
63
|
+
* @license MIT
|
|
64
|
+
*
|
|
65
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
66
|
+
* @license MIT
|
|
67
|
+
*
|
|
68
|
+
* Originally forked from (with the author's permission):
|
|
69
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
70
|
+
* http://bellard.org/jslinux/
|
|
71
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
72
|
+
*/var Kw=Object.defineProperty,AA=Object.getOwnPropertyDescriptor,RA=(e,t)=>{for(var i in t)Kw(e,i,{get:t[i],enumerable:!0})},jt=(e,t,i,n)=>{for(var a=n>1?void 0:n?AA(t,i):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(a=(n?h(t,i,a):h(a))||a);return n&&a&&Kw(t,i,a),a},me=(e,t)=>(i,n)=>t(i,n,e),G0="Terminal input",lp={get:()=>G0,set:e=>G0=e},Q0="Too much output to announce, navigate to rows manually to read",op={get:()=>Q0,set:e=>Q0=e};function MA(e){return e.replace(/\r?\n/g,"\r")}function DA(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function BA(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function LA(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");$w(a,t,i,n)}}function $w(e,t,i,n){e=MA(e),e=DA(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Ww(e,t,i){let n=i.getBoundingClientRect(),a=e.clientX-n.left-10,c=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Z0(e,t,i,n,a){Ww(e,t,i),a&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}function Zr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Eh(e,t=0,i=e.length){let n="";for(let a=t;a<i;++a){let c=e[a];c>65535?(c-=65536,n+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):n+=String.fromCharCode(c)}return n}var zA=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let n=0,a=0;if(this._interim){let c=e.charCodeAt(a++);56320<=c&&c<=57343?t[n++]=(this._interim-55296)*1024+c-56320+65536:(t[n++]=this._interim,t[n++]=c),this._interim=0}for(let c=a;c<i;++c){let h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=i)return this._interim=h,n;let d=e.charCodeAt(c);56320<=d&&d<=57343?t[n++]=(h-55296)*1024+d-56320+65536:(t[n++]=h,t[n++]=d);continue}h!==65279&&(t[n++]=h)}return n}},qA=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let n=0,a,c,h,d,f=0,m=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let x=0,C;for(;(C=this.interim[++x]&63)&&x<4;)S<<=6,S|=C;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=k-x;for(;m<N;){if(m>=i)return 0;if(C=e[m++],(C&192)!==128){m--,b=!0;break}else this.interim[x++]=C,S<<=6,S|=C&63}b||(k===2?S<128?m--:t[n++]=S:k===3?S<2048||S>=55296&&S<=57343||S===65279||(t[n++]=S):S<65536||S>1114111||(t[n++]=S)),this.interim.fill(0)}let g=i-4,v=m;for(;v<i;){for(;v<g&&!((a=e[v])&128)&&!((c=e[v+1])&128)&&!((h=e[v+2])&128)&&!((d=e[v+3])&128);)t[n++]=a,t[n++]=c,t[n++]=h,t[n++]=d,v+=4;if(a=e[v++],a<128)t[n++]=a;else if((a&224)===192){if(v>=i)return this.interim[0]=a,n;if(c=e[v++],(c&192)!==128){v--;continue}if(f=(a&31)<<6|c&63,f<128){v--;continue}t[n++]=f}else if((a&240)===224){if(v>=i)return this.interim[0]=a,n;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=i)return this.interim[0]=a,this.interim[1]=c,n;if(h=e[v++],(h&192)!==128){v--;continue}if(f=(a&15)<<12|(c&63)<<6|h&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[n++]=f}else if((a&248)===240){if(v>=i)return this.interim[0]=a,n;if(c=e[v++],(c&192)!==128){v--;continue}if(v>=i)return this.interim[0]=a,this.interim[1]=c,n;if(h=e[v++],(h&192)!==128){v--;continue}if(v>=i)return this.interim[0]=a,this.interim[1]=c,this.interim[2]=h,n;if(d=e[v++],(d&192)!==128){v--;continue}if(f=(a&7)<<18|(c&63)<<12|(h&63)<<6|d&63,f<65536||f>1114111)continue;t[n++]=f}}return n}},Vw="",fn=" ",lc=class Yw{constructor(){this.fg=0,this.bg=0,this.extended=new vh}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Yw;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}},vh=class Gw{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Gw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hi=class Qw extends lc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vh,this.combinedData=""}static fromCharData(t){let i=new Qw;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Zr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let n=t[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},X0="di$target",cp="di$dependencies",um=new Map;function PA(e){return e[cp]||[]}function Jt(e){if(um.has(e))return um.get(e);let t=function(i,n,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");HA(t,i,a)};return t._id=e,um.set(e,t),t}function HA(e,t,i){t[X0]===t?t[cp].push({id:e,index:i}):(t[cp]=[{id:e,index:i}],t[X0]=t)}var ys=Jt("BufferService"),Zw=Jt("CoreMouseService"),fa=Jt("CoreService"),IA=Jt("CharsetService"),C_=Jt("InstantiationService"),Xw=Jt("LogService"),bs=Jt("OptionsService"),Jw=Jt("OscLinkService"),UA=Jt("UnicodeService"),oc=Jt("DecorationService"),up=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var g;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],a=this._optionsService.rawOptions.linkHandler,c=new hi,h=i.getTrimmedLength(),d=-1,f=-1,m=!1;for(let v=0;v<h;v++)if(!(f===-1&&!i.hasContent(v))){if(i.loadCell(v,c),c.hasExtendedAttrs()&&c.extended.urlId)if(f===-1){f=v,d=c.extended.urlId;continue}else m=c.extended.urlId!==d;else f!==-1&&(m=!0);if(m||f!==-1&&v===h-1){let b=(g=this._oscLinkService.getLinkData(d))==null?void 0:g.uri;if(b){let S={start:{x:f+1,y:e},end:{x:v+(!m&&v===h-1?1:0),y:e}},x=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let C=new URL(b);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||n.push({text:b,range:S,activate:(C,k)=>a?a.activate(C,k,S):FA(C,k),hover:(C,k)=>{var N;return(N=a==null?void 0:a.hover)==null?void 0:N.call(a,C,k,S)},leave:(C,k)=>{var N;return(N=a==null?void 0:a.leave)==null?void 0:N.call(a,C,k,S)}})}m=!1,c.hasExtendedAttrs()&&c.extended.urlId?(f=v,d=c.extended.urlId):(f=-1,d=-1)}}t(n)}};up=jt([me(0,ys),me(1,bs),me(2,Jw)],up);function FA(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
73
|
+
|
|
74
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Nh=Jt("CharSizeService"),vr=Jt("CoreBrowserService"),j_=Jt("MouseService"),yr=Jt("RenderService"),KA=Jt("SelectionService"),e1=Jt("CharacterJoinerService"),jl=Jt("ThemeService"),t1=Jt("LinkProviderService"),$A=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?J0.isErrorNoTelemetry(e)?new J0(e.message+`
|
|
75
|
+
|
|
76
|
+
`+e.stack):new Error(e.message+`
|
|
77
|
+
|
|
78
|
+
`+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)}},WA=new $A;function Xu(e){VA(e)||WA.onUnexpectedError(e)}var hp="Canceled";function VA(e){return e instanceof YA?!0:e instanceof Error&&e.name===hp&&e.message===hp}var YA=class extends Error{constructor(){super(hp),this.name=this.message}};function GA(e){return new Error(`Illegal argument: ${e}`)}var J0=class dp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof dp)return t;let i=new dp;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},fp=class s1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,s1.prototype)}};function Fs(e,t=0){return e[e.length-(1+t)]}var QA;(e=>{function t(c){return c<0}e.isLessThan=t;function i(c){return c<=0}e.isLessThanOrEqual=i;function n(c){return c>0}e.isGreaterThan=n;function a(c){return c===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(QA||(QA={}));function ZA(e,t){let i=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(i,arguments))),a}}var i1;(e=>{function t(M){return M&&typeof M=="object"&&typeof M[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function n(){return i}e.empty=n;function*a(M){yield M}e.single=a;function c(M){return t(M)?M:a(M)}e.wrap=c;function h(M){return M||i}e.from=h;function*d(M){for(let Y=M.length-1;Y>=0;Y--)yield M[Y]}e.reverse=d;function f(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=f;function m(M){return M[Symbol.iterator]().next().value}e.first=m;function g(M,Y){let Z=0;for(let W of M)if(Y(W,Z++))return!0;return!1}e.some=g;function v(M,Y){for(let Z of M)if(Y(Z))return Z}e.find=v;function*b(M,Y){for(let Z of M)Y(Z)&&(yield Z)}e.filter=b;function*S(M,Y){let Z=0;for(let W of M)yield Y(W,Z++)}e.map=S;function*x(M,Y){let Z=0;for(let W of M)yield*Y(W,Z++)}e.flatMap=x;function*C(...M){for(let Y of M)yield*Y}e.concat=C;function k(M,Y,Z){let W=Z;for(let ee of M)W=Y(W,ee);return W}e.reduce=k;function*N(M,Y,Z=M.length){for(Y<0&&(Y+=M.length),Z<0?Z+=M.length:Z>M.length&&(Z=M.length);Y<Z;Y++)yield M[Y]}e.slice=N;function L(M,Y=Number.POSITIVE_INFINITY){let Z=[];if(Y===0)return[Z,M];let W=M[Symbol.iterator]();for(let ee=0;ee<Y;ee++){let I=W.next();if(I.done)return[Z,e.empty()];Z.push(I.value)}return[Z,{[Symbol.iterator](){return W}}]}e.consume=L;async function D(M){let Y=[];for await(let Z of M)Y.push(Z);return Promise.resolve(Y)}e.asyncToArray=D})(i1||(i1={}));function oa(e){if(i1.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function XA(...e){return gt(()=>oa(e))}function gt(e){return{dispose:ZA(()=>{e()})}}var r1=class n1{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{oa(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?n1.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};r1.DISABLE_DISPOSED_WARNING=!1;var pn=r1,Ie=class{constructor(){this._store=new pn,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ie.None=Object.freeze({dispose(){}});var Sl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},fr=typeof window=="object"?window:globalThis,mp=class pp{constructor(t){this.element=t,this.next=pp.Undefined,this.prev=pp.Undefined}};mp.Undefined=new mp(void 0);var vt=mp,eS=class{constructor(){this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===vt.Undefined}clear(){let e=this._first;for(;e!==vt.Undefined;){let t=e.next;e.prev=vt.Undefined,e.next=vt.Undefined,e=t}this._first=vt.Undefined,this._last=vt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new vt(e);if(this._first===vt.Undefined)this._first=i,this._last=i;else if(t){let a=this._last;this._last=i,i.prev=a,a.next=i}else{let a=this._first;this._first=i,i.next=a,a.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==vt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==vt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==vt.Undefined&&e.next!==vt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===vt.Undefined&&e.next===vt.Undefined?(this._first=vt.Undefined,this._last=vt.Undefined):e.next===vt.Undefined?(this._last=this._last.prev,this._last.next=vt.Undefined):e.prev===vt.Undefined&&(this._first=this._first.next,this._first.prev=vt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==vt.Undefined;)yield e.element,e=e.next}},JA=globalThis.performance&&typeof globalThis.performance.now=="function",eR=class a1{static create(t){return new a1(t)}constructor(t){this._now=JA&&t===!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._stopTime-this._startTime:this._now()-this._startTime}},os;(e=>{e.None=()=>Ie.None;function t(H,z){return v(H,()=>{},0,void 0,!0,void 0,z)}e.defer=t;function i(H){return(z,re=null,se)=>{let A=!1,F;return F=H(G=>{if(!A)return F?F.dispose():A=!0,z.call(re,G)},null,se),A&&F.dispose(),F}}e.once=i;function n(H,z,re){return m((se,A=null,F)=>H(G=>se.call(A,z(G)),null,F),re)}e.map=n;function a(H,z,re){return m((se,A=null,F)=>H(G=>{z(G),se.call(A,G)},null,F),re)}e.forEach=a;function c(H,z,re){return m((se,A=null,F)=>H(G=>z(G)&&se.call(A,G),null,F),re)}e.filter=c;function h(H){return H}e.signal=h;function d(...H){return(z,re=null,se)=>{let A=XA(...H.map(F=>F(G=>z.call(re,G))));return g(A,se)}}e.any=d;function f(H,z,re,se){let A=re;return n(H,F=>(A=z(A,F),A),se)}e.reduce=f;function m(H,z){let re,se={onWillAddFirstListener(){re=H(A.fire,A)},onDidRemoveLastListener(){re==null||re.dispose()}},A=new he(se);return z==null||z.add(A),A.event}function g(H,z){return z instanceof Array?z.push(H):z&&z.add(H),H}function v(H,z,re=100,se=!1,A=!1,F,G){let Se,ke,T,K=0,ne,$={leakWarningThreshold:F,onWillAddFirstListener(){Se=H(_e=>{K++,ke=z(ke,_e),se&&!T&&(ue.fire(ke),ke=void 0),ne=()=>{let Ee=ke;ke=void 0,T=void 0,(!se||K>1)&&ue.fire(Ee),K=0},typeof re=="number"?(clearTimeout(T),T=setTimeout(ne,re)):T===void 0&&(T=0,queueMicrotask(ne))})},onWillRemoveListener(){A&&K>0&&(ne==null||ne())},onDidRemoveLastListener(){ne=void 0,Se.dispose()}},ue=new he($);return G==null||G.add(ue),ue.event}e.debounce=v;function b(H,z=0,re){return e.debounce(H,(se,A)=>se?(se.push(A),se):[A],z,void 0,!0,void 0,re)}e.accumulate=b;function S(H,z=(se,A)=>se===A,re){let se=!0,A;return c(H,F=>{let G=se||!z(F,A);return se=!1,A=F,G},re)}e.latch=S;function x(H,z,re){return[e.filter(H,z,re),e.filter(H,se=>!z(se),re)]}e.split=x;function C(H,z=!1,re=[],se){let A=re.slice(),F=H(ke=>{A?A.push(ke):Se.fire(ke)});se&&se.add(F);let G=()=>{A==null||A.forEach(ke=>Se.fire(ke)),A=null},Se=new he({onWillAddFirstListener(){F||(F=H(ke=>Se.fire(ke)),se&&se.add(F))},onDidAddFirstListener(){A&&(z?setTimeout(G):G())},onDidRemoveLastListener(){F&&F.dispose(),F=null}});return se&&se.add(Se),Se.event}e.buffer=C;function k(H,z){return(re,se,A)=>{let F=z(new L);return H(function(G){let Se=F.evaluate(G);Se!==N&&re.call(se,Se)},void 0,A)}}e.chain=k;let N=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(z){return this.steps.push(z),this}forEach(z){return this.steps.push(re=>(z(re),re)),this}filter(z){return this.steps.push(re=>z(re)?re:N),this}reduce(z,re){let se=re;return this.steps.push(A=>(se=z(se,A),se)),this}latch(z=(re,se)=>re===se){let re=!0,se;return this.steps.push(A=>{let F=re||!z(A,se);return re=!1,se=A,F?A:N}),this}evaluate(z){for(let re of this.steps)if(z=re(z),z===N)break;return z}}function D(H,z,re=se=>se){let se=(...Se)=>G.fire(re(...Se)),A=()=>H.on(z,se),F=()=>H.removeListener(z,se),G=new he({onWillAddFirstListener:A,onDidRemoveLastListener:F});return G.event}e.fromNodeEventEmitter=D;function M(H,z,re=se=>se){let se=(...Se)=>G.fire(re(...Se)),A=()=>H.addEventListener(z,se),F=()=>H.removeEventListener(z,se),G=new he({onWillAddFirstListener:A,onDidRemoveLastListener:F});return G.event}e.fromDOMEventEmitter=M;function Y(H){return new Promise(z=>i(H)(z))}e.toPromise=Y;function Z(H){let z=new he;return H.then(re=>{z.fire(re)},()=>{z.fire(void 0)}).finally(()=>{z.dispose()}),z.event}e.fromPromise=Z;function W(H,z){return H(re=>z.fire(re))}e.forward=W;function ee(H,z,re){return z(re),H(se=>z(se))}e.runAndSubscribe=ee;class I{constructor(z,re){this._observable=z,this._counter=0,this._hasChanged=!1;let se={onWillAddFirstListener:()=>{z.addObserver(this)},onDidRemoveLastListener:()=>{z.removeObserver(this)}};this.emitter=new he(se),re&&re.add(this.emitter)}beginUpdate(z){this._counter++}handlePossibleChange(z){}handleChange(z,re){this._hasChanged=!0}endUpdate(z){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function ae(H,z){return new I(H,z).emitter.event}e.fromObservable=ae;function le(H){return(z,re,se)=>{let A=0,F=!1,G={beginUpdate(){A++},endUpdate(){A--,A===0&&(H.reportChanges(),F&&(F=!1,z.call(re)))},handlePossibleChange(){},handleChange(){F=!0}};H.addObserver(G),H.reportChanges();let Se={dispose(){H.removeObserver(G)}};return se instanceof pn?se.add(Se):Array.isArray(se)&&se.push(Se),Se}}e.fromObservableLight=le})(os||(os={}));var _p=class gp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${gp._idPool++}`,gp.all.add(this)}start(t){this._stopWatch=new eR,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};_p.all=new Set,_p._idPool=0;var tR=_p,sR=-1,l1=class o1{constructor(t,i,n=(o1._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[c,h]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${h}):`;console.warn(d),console.warn(c);let f=new nR(d,c);this._errorHandler(f)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[n,a]of this._stacks)(!t||i<a)&&(t=[n,a],i=a);return t}};l1._idPool=1;var iR=l1,rR=class c1{constructor(t){this.value=t}static create(){let t=new Error;return new c1(t.stack??"")}print(){console.warn(this.value.split(`
|
|
79
|
+
`).slice(2).join(`
|
|
80
|
+
`))}},nR=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},aR=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},lR=0,hm=class{constructor(e){this.value=e,this.id=lR++}},oR=2,cR,he=class{constructor(e){var t,i,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new iR((e==null?void 0:e.onListenerError)??Xu,((i=this._options)==null?void 0:i.leakWarningThreshold)??sR):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new tR(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var e,t,i,n;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(n=this._leakageMon)==null||n.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var h,d,f,m,g;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let v=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(v);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new aR(`${v}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Xu)(S),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let n=new hm(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=rR.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof hm?(this._deliveryQueue??(this._deliveryQueue=new uR),this._listeners=[this._listeners,n]):this._listeners.push(n):((f=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||f.call(d,this),this._listeners=n,(g=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||g.call(m,this)),this._size++;let c=gt(()=>{a==null||a(),this._removeListener(n)});return i instanceof pn?i.add(c):Array.isArray(i)&&i.push(c),c}),this._event}_removeListener(e){var a,c,h,d;if((c=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||c.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(d=(h=this._options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let n=this._deliveryQueue.current===this;if(this._size*oR<=t.length){let f=0;for(let m=0;m<t.length;m++)t[m]?t[f++]=t[m]:n&&(this._deliveryQueue.end--,f<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=f}}_deliver(e,t){var n;if(!e)return;let i=((n=this._options)==null?void 0:n.onListenerError)||Xu;if(!i){e.value(t);return}try{e.value(t)}catch(a){i(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,n,a;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(n=this._perfMon)==null||n.start(this._size),this._listeners)if(this._listeners instanceof hm)this._deliver(this._listeners,e);else{let c=this._deliveryQueue;c.enqueue(this,e,this._listeners.length),this._deliverQueue(c)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},uR=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},vp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new he,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new he,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,t),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,t),this._onDidChangeFullscreen.fire(n)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};vp.INSTANCE=new vp;var k_=vp;function hR(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}k_.INSTANCE.onDidChangeZoomLevel;function dR(e){return k_.INSTANCE.getZoomFactor(e)}k_.INSTANCE.onDidChangeFullscreen;var kl=typeof navigator=="object"?navigator.userAgent:"",yp=kl.indexOf("Firefox")>=0,fR=kl.indexOf("AppleWebKit")>=0,E_=kl.indexOf("Chrome")>=0,mR=!E_&&kl.indexOf("Safari")>=0;kl.indexOf("Electron/")>=0;kl.indexOf("Android")>=0;var dm=!1;if(typeof fr.matchMedia=="function"){let e=fr.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=fr.matchMedia("(display-mode: fullscreen)");dm=e.matches,hR(fr,e,({matches:i})=>{dm&&t.matches||(dm=i)})}var sl="en",bp=!1,Sp=!1,Ju=!1,u1=!1,Pu,eh=sl,tS=sl,pR,vi,Jn=globalThis,ns,bx;typeof Jn.vscode<"u"&&typeof Jn.vscode.process<"u"?ns=Jn.vscode.process:typeof process<"u"&&typeof((bx=process==null?void 0:process.versions)==null?void 0:bx.node)=="string"&&(ns=process);var Sx,_R=typeof((Sx=ns==null?void 0:ns.versions)==null?void 0:Sx.electron)=="string",gR=_R&&(ns==null?void 0:ns.type)==="renderer",xx;if(typeof ns=="object"){bp=ns.platform==="win32",Sp=ns.platform==="darwin",Ju=ns.platform==="linux",Ju&&ns.env.SNAP&&ns.env.SNAP_REVISION,ns.env.CI||ns.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Pu=sl,eh=sl;let e=ns.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Pu=t.userLocale,tS=t.osLocale,eh=t.resolvedLanguage||sl,pR=(xx=t.languagePack)==null?void 0:xx.translationsConfigFile}catch{}u1=!0}else typeof navigator=="object"&&!gR?(vi=navigator.userAgent,bp=vi.indexOf("Windows")>=0,Sp=vi.indexOf("Macintosh")>=0,(vi.indexOf("Macintosh")>=0||vi.indexOf("iPad")>=0||vi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ju=vi.indexOf("Linux")>=0,(vi==null?void 0:vi.indexOf("Mobi"))>=0,eh=globalThis._VSCODE_NLS_LANGUAGE||sl,Pu=navigator.language.toLowerCase(),tS=Pu):console.error("Unable to resolve platform.");var h1=bp,qi=Sp,vR=Ju,sS=u1,Pi=vi,$r=eh,yR;(e=>{function t(){return $r}e.value=t;function i(){return $r.length===2?$r==="en":$r.length>=3?$r[0]==="e"&&$r[1]==="n"&&$r[2]==="-":!1}e.isDefaultVariant=i;function n(){return $r==="en"}e.isDefault=n})(yR||(yR={}));var bR=typeof Jn.postMessage=="function"&&!Jn.importScripts;(()=>{if(bR){let e=[];Jn.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,a=e.length;n<a;n++){let c=e[n];if(c.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),c.callback();return}}});let t=0;return i=>{let n=++t;e.push({id:n,callback:i}),Jn.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var SR=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!SR&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var Ja=typeof navigator=="object"?navigator:{};sS||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ja&&Ja.clipboard&&Ja.clipboard.writeText,sS||Ja&&Ja.clipboard&&Ja.clipboard.readText;var N_=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}},fm=new N_,iS=new N_,rS=new N_,xR=new Array(230),d1;(e=>{function t(d){return fm.keyCodeToStr(d)}e.toString=t;function i(d){return fm.strToKeyCode(d)}e.fromString=i;function n(d){return iS.keyCodeToStr(d)}e.toUserSettingsUS=n;function a(d){return rS.keyCodeToStr(d)}e.toUserSettingsGeneral=a;function c(d){return iS.strToKeyCode(d)||rS.strToKeyCode(d)}e.fromUserSettings=c;function h(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return fm.keyCodeToStr(d)}e.toElectronAccelerator=h})(d1||(d1={}));var wR=class f1{constructor(t,i,n,a,c){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=a,this.keyCode=c}equals(t){return t instanceof f1&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${i}${n}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new CR([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},CR=class{constructor(e){if(e.length===0)throw GA("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 jR(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return d1.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(yp)switch(t){case 59:return 85;case 60:if(vR)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(qi)return 57;break}else if(fR&&(qi&&t===93||!qi&&t===92))return 57;return xR[t]||0}var kR=qi?256:2048,ER=512,NR=1024,TR=qi?2048:256,nS=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=jR(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|=kR),this.altKey&&(t|=ER),this.shiftKey&&(t|=NR),this.metaKey&&(t|=TR),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new wR(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},aS=new WeakMap;function OR(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var AR=class{static getSameOriginWindowChain(e){let t=aS.get(e);if(!t){t=[],aS.set(e,t);let i=e,n;do n=OR(i),n?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0,a=this.getSameOriginWindowChain(e);for(let c of a){let h=c.window.deref();if(i+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!c.iframeElement)break;let d=c.iframeElement.getBoundingClientRect();i+=d.top,n+=d.left}return{top:i,left:n}}},Hu=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 i=AR.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},lS=class{constructor(e,t=0,i=0){var a;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let n=!1;if(E_){let c=navigator.userAgent.match(/Chrome\/(\d+)/);n=(c?parseInt(c[1]):123)<=122}if(e){let c=e,h=e,d=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof c.wheelDeltaY<"u")n?this.deltaY=c.wheelDeltaY/(120*d):this.deltaY=c.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?yp&&!qi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof c.wheelDeltaX<"u")mR&&h1?this.deltaX=-(c.wheelDeltaX/120):n?this.deltaX=c.wheelDeltaX/(120*d):this.deltaX=c.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?yp&&!qi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},m1=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),RR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof MR?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:os.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:m1})})(RR||(RR={}));var MR=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?m1:(this._emitter||(this._emitter=new he),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},T_=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 fp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new fp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},DR=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new fp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=gt(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},BR;(e=>{async function t(n){let a,c=await Promise.all(n.map(h=>h.then(d=>d,d=>{a||(a=d)})));if(typeof a<"u")throw a;return c}e.settled=t;function i(n){return new Promise(async(a,c)=>{try{await n(a,c)}catch(h){c(h)}})}e.withAsyncBody=i})(BR||(BR={}));var oS=class oi{static fromArray(t){return new oi(i=>{i.emitMany(t)})}static fromPromise(t){return new oi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new oi(async i=>{await Promise.all(t.map(async n=>i.emitOne(await n)))})}static merge(t){return new oi(async i=>{await Promise.all(t.map(async n=>{for await(let a of n)i.emitOne(a)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new he,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await os.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new oi(async n=>{for await(let a of t)n.emitOne(i(a))})}map(t){return oi.map(this,t)}static filter(t,i){return new oi(async n=>{for await(let a of t)i(a)&&n.emitOne(a)})}filter(t){return oi.filter(this,t)}static coalesce(t){return oi.filter(t,i=>!!i)}coalesce(){return oi.coalesce(this)}static async toPromise(t){let i=[];for await(let n of t)i.push(n);return i}toPromise(){return oi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};oS.EMPTY=oS.fromArray([]);var{getWindow:Bi,getWindowId:LR,onDidRegisterWindow:zR}=(function(){let e=new Map,t={window:fr,disposables:new pn};e.set(fr.vscodeWindowId,t);let i=new he,n=new he,a=new he;function c(h,d){return(typeof h=="number"?e.get(h):void 0)??(d?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Ie.None;let d=new pn,f={window:h,disposables:d.add(new pn)};return e.set(h.vscodeWindowId,f),d.add(gt(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),d.add(Te(h,Yt.BEFORE_UNLOAD,()=>{a.fire(h)})),i.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){var m;let d=h;if((m=d==null?void 0:d.ownerDocument)!=null&&m.defaultView)return d.ownerDocument.defaultView.window;let f=h;return f!=null&&f.view?f.view.window:fr},getDocument(h){return Bi(h).document}}})(),qR=class{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!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,this._handler=null)}};function Te(e,t,i,n){return new qR(e,t,i,n)}var cS=function(e,t,i,n){return Te(e,t,i,n)},O_,PR=class extends DR{constructor(e){super(),this.defaultTarget=e&&Bi(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},uS=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){Xu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,n=new Map,a=c=>{i.set(c,!1);let h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),n.set(c,!0);h.length>0;)h.sort(uS.sort),h.shift().execute();n.set(c,!1)};O_=(c,h,d=0)=>{let f=LR(c),m=new uS(h,d),g=e.get(f);return g||(g=[],e.set(f,g)),g.push(m),i.get(f)||(i.set(f,!0),c.requestAnimationFrame(()=>a(f))),m}})();function HR(e){let t=e.getBoundingClientRect(),i=Bi(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Yt={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},IR=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=Ns(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ns(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ns(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ns(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ns(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ns(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ns(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ns(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ns(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ns(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ns(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=Ns(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=Ns(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ns(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 Ns(e){return typeof e=="number"?`${e}px`:e}function qo(e){return new IR(e)}var p1=class{constructor(){this._hooks=new pn,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=a;let c=e;try{e.setPointerCapture(t),this._hooks.add(gt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=Bi(e)}this._hooks.add(Te(c,Yt.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Te(c,Yt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function UR(e,t,i){let n=null,a=null;if(typeof i.value=="function"?(n="value",a=i.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",a=i.get),!a)throw new Error("not supported");let c=`$memoize$${t}`;i[n]=function(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[c]}}var Ti;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ti||(Ti={}));var Ro=class hs extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new eS,this.ignoreTargets=new eS,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(os.runAndSubscribe(zR,({window:t,disposables:i})=>{i.add(Te(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Te(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(Te(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:fr,disposables:this._store}))}static addTarget(t){if(!hs.isTouchDevice())return Ie.None;hs.INSTANCE||(hs.INSTANCE=new hs);let i=hs.INSTANCE.targets.push(t);return gt(i)}static ignoreTarget(t){if(!hs.isTouchDevice())return Ie.None;hs.INSTANCE||(hs.INSTANCE=new hs);let i=hs.INSTANCE.ignoreTargets.push(t);return gt(i)}static isTouchDevice(){return"ontouchstart"in fr||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,a=t.targetTouches.length;n<a;n++){let c=t.targetTouches.item(n);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:i,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[i],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let h=this.newGestureEvent(Ti.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let n=Date.now(),a=Object.keys(this.activeTouches).length;for(let c=0,h=i.changedTouches.length;c<h;c++){let d=i.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let f=this.activeTouches[d.identifier],m=Date.now()-f.initialTimeStamp;if(m<hs.HOLD_DELAY&&Math.abs(f.initialPageX-Fs(f.rollingPageX))<30&&Math.abs(f.initialPageY-Fs(f.rollingPageY))<30){let g=this.newGestureEvent(Ti.Tap,f.initialTarget);g.pageX=Fs(f.rollingPageX),g.pageY=Fs(f.rollingPageY),this.dispatchEvent(g)}else if(m>=hs.HOLD_DELAY&&Math.abs(f.initialPageX-Fs(f.rollingPageX))<30&&Math.abs(f.initialPageY-Fs(f.rollingPageY))<30){let g=this.newGestureEvent(Ti.Contextmenu,f.initialTarget);g.pageX=Fs(f.rollingPageX),g.pageY=Fs(f.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Fs(f.rollingPageX),v=Fs(f.rollingPageY),b=Fs(f.rollingTimestamps)-f.rollingTimestamps[0],S=g-f.rollingPageX[0],x=v-f.rollingPageY[0],C=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,C,n,Math.abs(S)/b,S>0?1:-1,g,Math.abs(x)/b,x>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(Ti.End,f.initialTarget)),delete this.activeTouches[d.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let n=document.createEvent("CustomEvent");return n.initEvent(t,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(t){if(t.type===Ti.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>hs.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,t.tapCount=n}else(t.type===Ti.Change||t.type===Ti.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(t.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let a=0,c=t.initialTarget;for(;c&&c!==n;)a++,c=c.parentElement;i.push([a,n])}i.sort((n,a)=>n[0]-a[0]);for(let[n,a]of i)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,n,a,c,h,d,f,m){this.handle=O_(t,()=>{let g=Date.now(),v=g-n,b=0,S=0,x=!0;a+=hs.SCROLL_FRICTION*v,d+=hs.SCROLL_FRICTION*v,a>0&&(x=!1,b=c*a*v),d>0&&(x=!1,S=f*d*v);let C=this.newGestureEvent(Ti.Change);C.translationX=b,C.translationY=S,i.forEach(k=>k.dispatchEvent(C)),x||this.inertia(t,i,g,a,c,h+b,d,f,m+S)})}onTouchMove(t){let i=Date.now();for(let n=0,a=t.changedTouches.length;n<a;n++){let c=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],d=this.newGestureEvent(Ti.Change,h.initialTarget);d.translationX=c.pageX-Fs(h.rollingPageX),d.translationY=c.pageY-Fs(h.rollingPageY),d.pageX=c.pageX,d.pageY=c.pageY,this.dispatchEvent(d),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Ro.SCROLL_FRICTION=-.005,Ro.HOLD_DELAY=700,Ro.CLEAR_TAP_COUNT_TIME=400,jt([UR],Ro,"isTouchDevice",1);var FR=Ro,A_=class extends Ie{onclick(e,t){this._register(Te(e,Yt.CLICK,i=>t(new Hu(Bi(e),i))))}onmousedown(e,t){this._register(Te(e,Yt.MOUSE_DOWN,i=>t(new Hu(Bi(e),i))))}onmouseover(e,t){this._register(Te(e,Yt.MOUSE_OVER,i=>t(new Hu(Bi(e),i))))}onmouseleave(e,t){this._register(Te(e,Yt.MOUSE_LEAVE,i=>t(new Hu(Bi(e),i))))}onkeydown(e,t){this._register(Te(e,Yt.KEY_DOWN,i=>t(new nS(i))))}onkeyup(e,t){this._register(Te(e,Yt.KEY_UP,i=>t(new nS(i))))}oninput(e,t){this._register(Te(e,Yt.INPUT,t))}onblur(e,t){this._register(Te(e,Yt.BLUR,t))}onfocus(e,t){this._register(Te(e,Yt.FOCUS,t))}onchange(e,t){this._register(Te(e,Yt.CHANGE,t))}ignoreGesture(e){return FR.ignoreTarget(e)}},hS=11,KR=class extends A_{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=hS+"px",this.domNode.style.height=hS+"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 p1),this._register(cS(this.bgDomNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(cS(this.domNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new PR),this._pointerdownScheduleRepeatTimer=this._register(new T_)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Bi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},$R=class xp{constructor(t,i,n,a,c,h,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,a=a|0,c=c|0,h=h|0,d=d|0),this.rawScrollLeft=a,this.rawScrollTop=d,i<0&&(i=0),a+i>n&&(a=n-i),a<0&&(a=0),c<0&&(c=0),d+c>h&&(d=h-c),d<0&&(d=0),this.width=i,this.scrollWidth=n,this.scrollLeft=a,this.height=c,this.scrollHeight=h,this.scrollTop=d}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new xp(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new xp(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(t,i){let n=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:a,scrollLeftChanged:c,heightChanged:h,scrollHeightChanged:d,scrollTopChanged:f}}},WR=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $R(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var n;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(n=this._smoothScrolling)==null||n.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(),this._smoothScrolling=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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new fS(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=fS.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},dS=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function mm(e,t){let i=t-e;return function(n){return e+i*GR(n)}}function VR(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}var fS=class wp{constructor(t,i,n,a){this.from=t,this.to=i,this.duration=a,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(t,i,n){if(Math.abs(t-i)>2.5*n){let a,c;return t<i?(a=t+.75*n,c=i-.75*n):(a=t-.75*n,c=i+.75*n),VR(mm(t,a),mm(c,i),.33)}return mm(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let n=this.scrollLeft(i),a=this.scrollTop(i);return new dS(n,a,!1)}return new dS(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,n){return wp.start(t,i,n)}static start(t,i,n){n=n+10;let a=Date.now()-10;return new wp(t,i,a,n)}};function YR(e){return Math.pow(e,3)}function GR(e){return 1-YR(1-e)}var QR=class extends Ie{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new T_)}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(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},ZR=140,_1=class extends A_{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 QR(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new p1),this._shouldRender=!0,this.domNode=qo(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(Te(this.domNode.domNode,Yt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new KR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=qo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Te(this.slider.domNode,Yt.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.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,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);i<=a&&a<=n?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let a=HR(this.domNode.domNode);t=e.pageX-a.left,i=e.pageY-a.top}let n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let c=this._sliderOrthogonalPointerPosition(a),h=Math.abs(c-i);if(h1&&h>ZR){this._setDesiredScrollPositionNow(n.getScrollPosition());return}let d=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(d))},()=>{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()}},g1=class Cp{constructor(t,i,n,a,c,h){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Cp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,n,a,c){let h=Math.max(0,n-t),d=Math.max(0,h-2*i),f=a>0&&a>n;if(!f)return{computedAvailableSize:Math.round(h),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(n*d/a))),g=(d-m)/(a-n),v=c*g;return{computedAvailableSize:Math.round(h),computedIsNeeded:f,computedSliderSize:Math.round(m),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=Cp._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(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,n=this._scrollPosition;return i<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},XR=class extends _1{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new g1(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new 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}},JR=class extends _1{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new g1(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new 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}},eM=500,mS=50,tM=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},jp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,n=1,a=this._rear;do{let c=a===this._front?t:Math.pow(2,-n);if(t-=c,i+=this._memory[a].score*c,a===this._front)break;a=(this._capacity+a-1)%this._capacity,n++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(E_){let i=Bi(t.browserEvent),n=dR(i);this.accept(Date.now(),t.deltaX*n,t.deltaY*n)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,n){let a=null,c=new tM(t,i,n);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(a=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]=c),c.score=this._computeScore(c,a)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(n+=.25),i){let a=Math.abs(t.deltaX),c=Math.abs(t.deltaY),h=Math.abs(i.deltaX),d=Math.abs(i.deltaY),f=Math.max(Math.min(a,h),1),m=Math.max(Math.min(c,d),1),g=Math.max(a,h),v=Math.max(c,d);g%f===0&&v%m===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};jp.INSTANCE=new jp;var sM=jp,iM=class extends A_{constructor(e,t,i){super(),this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new he),this.onWillScroll=this._onWillScroll.event,this._options=nM(t),this._scrollable=i,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let n={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new JR(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new XR(this._scrollable,this._options,n)),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=qo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=qo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=qo(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,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new T_),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=oa(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,qi&&(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 lS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=oa(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new lS(i))};this._mouseWheelToDispose.push(Te(this._listenOnDomNode,Yt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=sM.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let c=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+c===0?h=c=0:Math.abs(c)>=Math.abs(h)?h=0:c=0),this._options.flipAxes&&([c,h]=[h,c]);let d=!qi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=c,c=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,c=c*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),m={};if(c){let g=mS*c,v=f.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(m,v)}if(h){let g=mS*h,v=f.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(m,v)}m=this._scrollable.validateScrollPosition(m),(f.scrollLeft!==m.scrollLeft||f.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(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 new 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,i=e.scrollLeft>0,n=i?" left":"",a=t?" top":"",c=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${a}${n}`)}}_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(),eM)}},rM=class extends iM{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function nM(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,qi&&(t.className+=" mac"),t}var kp=class extends Ie{constructor(e,t,i,n,a,c,h,d){super(),this._bufferService=i,this._optionsService=h,this._renderService=d,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new WR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>O_(n.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new rM(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(os.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(gt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(gt(()=>this._styleElement.remove())),this._register(os.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
81
|
+
`)})),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(m=>this._handleScroll(m)))}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(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.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),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};kp=jt([me(2,ys),me(3,vr),me(4,Zw),me(5,jl),me(6,bs),me(7,yr)],kp);var Ep=class extends Ie{constructor(e,t,i,n,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=n,this._renderService=a,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(c=>this._removeDecoration(c))),this._register(gt(()=>{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){var n;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((n=e==null?void 0:e.options)==null?void 0:n.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Ep=jt([me(1,ys),me(2,vr),me(3,oc),me(4,yr)],Ep);var aM=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ei={full:0,left:0,center:0,right:0},Wr={full:0,left:0,center:0,right:0},wo={full:0,left:0,center:0,right:0},yh=class extends Ie{constructor(e,t,i,n,a,c,h,d){var m;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=a,this._optionsService=c,this._themeService=h,this._coreBrowserService=d,this._colorZoneStore=new aM,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(),(m=this._viewportElement.parentElement)==null||m.insertBefore(this._canvas,this._viewportElement),this._register(gt(()=>{var g;return(g=this._canvas)==null?void 0:g.remove()}));let f=this._canvas.getContext("2d");if(f)this._ctx=f;else throw new 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(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Wr.full=this._canvas.width,Wr.left=e,Wr.center=t,Wr.right=e,this._refreshDrawHeightConstants(),wo.full=1,wo.left=1,wo.center=1+Wr.left,wo.right=1+Wr.left+Wr.center}_refreshDrawHeightConstants(){Ei.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);Ei.left=t,Ei.center=t,Ei.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ei.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ei.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ei.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ei.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);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(wo[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ei[e.position||"full"]/2),Wr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ei[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}))}};yh=jt([me(2,ys),me(3,oc),me(4,yr),me(5,bs),me(6,jl),me(7,vr)],yh);var te;(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=`
|
|
82
|
+
`,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=""))(te||(te={}));var th;(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=""))(th||(th={}));var v1;(e=>e.ST=`${te.ESC}\\`)(v1||(v1={}));var Np=class{constructor(e,t,i,n,a,c){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._coreService=a,this._renderService=c,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${te.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 t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=n+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Np=jt([me(2,ys),me(3,bs),me(4,fa),me(5,yr)],Np);var Gt=0,Qt=0,Zt=0,wt=0,pS={css:"#00000000",rgba:0},qt;(e=>{function t(a,c,h,d){return d!==void 0?`#${zn(a)}${zn(c)}${zn(h)}${zn(d)}`:`#${zn(a)}${zn(c)}${zn(h)}`}e.toCss=t;function i(a,c,h,d=255){return(a<<24|c<<16|h<<8|d)>>>0}e.toRgba=i;function n(a,c,h,d){return{css:e.toCss(a,c,h,d),rgba:e.toRgba(a,c,h,d)}}e.toColor=n})(qt||(qt={}));var pt;(e=>{function t(f,m){if(wt=(m.rgba&255)/255,wt===1)return{css:m.css,rgba:m.rgba};let g=m.rgba>>24&255,v=m.rgba>>16&255,b=m.rgba>>8&255,S=f.rgba>>24&255,x=f.rgba>>16&255,C=f.rgba>>8&255;Gt=S+Math.round((g-S)*wt),Qt=x+Math.round((v-x)*wt),Zt=C+Math.round((b-C)*wt);let k=qt.toCss(Gt,Qt,Zt),N=qt.toRgba(Gt,Qt,Zt);return{css:k,rgba:N}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function n(f,m,g){let v=sh.ensureContrastRatio(f.rgba,m.rgba,g);if(v)return qt.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=n;function a(f){let m=(f.rgba|255)>>>0;return[Gt,Qt,Zt]=sh.toChannels(m),{css:qt.toCss(Gt,Qt,Zt),rgba:m}}e.opaque=a;function c(f,m){return wt=Math.round(m*255),[Gt,Qt,Zt]=sh.toChannels(f.rgba),{css:qt.toCss(Gt,Qt,Zt,wt),rgba:qt.toRgba(Gt,Qt,Zt,wt)}}e.opacity=c;function h(f,m){return wt=f.rgba&255,c(f,wt*m/255)}e.multiplyOpacity=h;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(pt||(pt={}));var yt;(e=>{let t,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Gt=parseInt(a.slice(1,2).repeat(2),16),Qt=parseInt(a.slice(2,3).repeat(2),16),Zt=parseInt(a.slice(3,4).repeat(2),16),qt.toColor(Gt,Qt,Zt);case 5:return Gt=parseInt(a.slice(1,2).repeat(2),16),Qt=parseInt(a.slice(2,3).repeat(2),16),Zt=parseInt(a.slice(3,4).repeat(2),16),wt=parseInt(a.slice(4,5).repeat(2),16),qt.toColor(Gt,Qt,Zt,wt);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let c=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return Gt=parseInt(c[1]),Qt=parseInt(c[2]),Zt=parseInt(c[3]),wt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),qt.toColor(Gt,Qt,Zt,wt);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Gt,Qt,Zt,wt]=t.getImageData(0,0,1,1).data,wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qt.toRgba(Gt,Qt,Zt,wt),css:a}}e.toColor=n})(yt||(yt={}));var _s;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,a,c){let h=n/255,d=a/255,f=c/255,m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),g=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return m*.2126+g*.7152+v*.0722}e.relativeLuminance2=i})(_s||(_s={}));var sh;(e=>{function t(h,d){if(wt=(d&255)/255,wt===1)return d;let f=d>>24&255,m=d>>16&255,g=d>>8&255,v=h>>24&255,b=h>>16&255,S=h>>8&255;return Gt=v+Math.round((f-v)*wt),Qt=b+Math.round((m-b)*wt),Zt=S+Math.round((g-S)*wt),qt.toRgba(Gt,Qt,Zt)}e.blend=t;function i(h,d,f){let m=_s.relativeLuminance(h>>8),g=_s.relativeLuminance(d>>8);if(ar(m,g)<f){if(g<m){let S=n(h,d,f),x=ar(m,_s.relativeLuminance(S>>8));if(x<f){let C=a(h,d,f),k=ar(m,_s.relativeLuminance(C>>8));return x>k?S:C}return S}let v=a(h,d,f),b=ar(m,_s.relativeLuminance(v>>8));if(b<f){let S=n(h,d,f),x=ar(m,_s.relativeLuminance(S>>8));return b>x?v:S}return v}}e.ensureContrastRatio=i;function n(h,d,f){let m=h>>24&255,g=h>>16&255,v=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,C=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(m,g,v));for(;C<f&&(b>0||S>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),x-=Math.max(0,Math.ceil(x*.1)),C=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(m,g,v));return(b<<24|S<<16|x<<8|255)>>>0}e.reduceLuminance=n;function a(h,d,f){let m=h>>24&255,g=h>>16&255,v=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,C=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(m,g,v));for(;C<f&&(b<255||S<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(m,g,v));return(b<<24|S<<16|x<<8|255)>>>0}e.increaseLuminance=a;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(sh||(sh={}));function zn(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ar(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var lM=class extends lc{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new hi}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 i=[],n=t.translateToString(!0),a=0,c=0,h=0,d=t.getFg(0),f=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==f){if(m-a>1){let g=this._getJoinedRanges(n,h,c,t,a);for(let v=0;v<g.length;v++)i.push(g[v])}a=m,h=c,d=this._workCell.fg,f=this._workCell.bg}c+=this._workCell.getChars().length||fn.length}if(this._bufferService.cols-a>1){let m=this._getJoinedRanges(n,h,c,t,a);for(let g=0;g<m.length;g++)i.push(m[g])}return i}_getJoinedRanges(e,t,i,n,a){let c=e.substring(t,i),h=[];try{h=this._characterJoiners[0].handler(c)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let f=this._characterJoiners[d].handler(c);for(let m=0;m<f.length;m++)bh._mergeRanges(h,f[m])}catch(f){console.error(f)}return this._stringRangesToCellRanges(h,n,a),h}_stringRangesToCellRanges(e,t,i){let n=0,a=!1,c=0,h=e[n];if(h){for(let d=i;d<this._bufferService.cols;d++){let f=t.getWidth(d),m=t.getString(d).length||fn.length;if(f!==0){if(!a&&h[0]<=c&&(h[0]=d,a=!0),h[1]<=c){if(h[1]=d,h=e[++n],!h)break;h[0]<=c?(h[0]=d,a=!0):a=!1}c+=m}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(t[1]<=a[0])return e[n-1][1]=t[1],e;if(t[1]<=a[1])return e[n-1][1]=Math.max(t[1],a[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=a[0])return e.splice(n,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};bh=jt([me(0,ys)],bh);function oM(e){return 57508<=e&&e<=57558}function cM(e){return 9472<=e&&e<=9631}function uM(e){return oM(e)||cM(e)}function hM(){return{css:{canvas:Iu(),cell:Iu()},device:{canvas:Iu(),cell:Iu(),char:{width:0,height:0,left:0,top:0}}}}function Iu(){return{width:0,height:0}}var Tp=class{constructor(e,t,i,n,a,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=n,this._coreService=a,this._decorationService=c,this._themeService=h,this._workCell=new hi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,n,a,c,h,d,f,m,g){let v=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,x=e.getNoBgTrimmedLength();i&&x<c+1&&(x=c+1);let C,k=0,N="",L=0,D=0,M=0,Y=0,Z=!1,W=0,ee=!1,I=0,ae=0,le=[],H=m!==-1&&g!==-1;for(let z=0;z<x;z++){e.loadCell(z,this._workCell);let re=this._workCell.getWidth();if(re===0)continue;let se=!1,A=z>=ae,F=z,G=this._workCell;if(b.length>0&&z===b[0][0]&&A){let et=b.shift(),mi=this._isCellInSelection(et[0],t);for(L=et[0]+1;L<et[1];L++)A&&(A=mi===this._isCellInSelection(L,t));A&&(A=!i||c<et[0]||c>=et[1]),A?(se=!0,G=new lM(this._workCell,e.translateToString(!0,et[0],et[1]),et[1]-et[0]),F=et[1]-1,re=G.getWidth()):ae=et[1]}let Se=this._isCellInSelection(z,t),ke=i&&z===c,T=H&&z>=m&&z<=g,K=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,et=>{K=!0});let ne=G.getChars()||fn;if(ne===" "&&(G.isUnderline()||G.isOverline())&&(ne=" "),I=re*d-f.get(ne,G.isBold(),G.isItalic()),!C)C=this._document.createElement("span");else if(k&&(Se&&ee||!Se&&!ee&&G.bg===D)&&(Se&&ee&&S.selectionForeground||G.fg===M)&&G.extended.ext===Y&&T===Z&&I===W&&!ke&&!se&&!K&&A){G.isInvisible()?N+=fn:N+=ne,k++;continue}else k&&(C.textContent=N),C=this._document.createElement("span"),k=0,N="";if(D=G.bg,M=G.fg,Y=G.extended.ext,Z=T,W=I,ee=Se,se&&c>=z&&c<=F&&(c=z),!this._coreService.isCursorHidden&&ke&&this._coreService.isCursorInitialized){if(le.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&le.push("xterm-cursor-blink"),le.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":le.push("xterm-cursor-outline");break;case"block":le.push("xterm-cursor-block");break;case"bar":le.push("xterm-cursor-bar");break;case"underline":le.push("xterm-cursor-underline");break}}if(G.isBold()&&le.push("xterm-bold"),G.isItalic()&&le.push("xterm-italic"),G.isDim()&&le.push("xterm-dim"),G.isInvisible()?N=fn:N=G.getChars()||fn,G.isUnderline()&&(le.push(`xterm-underline-${G.extended.underlineStyle}`),N===" "&&(N=" "),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${lc.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let et=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&et<8&&(et+=8),C.style.textDecorationColor=S.ansi[et].css}G.isOverline()&&(le.push("xterm-overline"),N===" "&&(N=" ")),G.isStrikethrough()&&le.push("xterm-strikethrough"),T&&(C.style.textDecoration="underline");let $=G.getFgColor(),ue=G.getFgColorMode(),_e=G.getBgColor(),Ee=G.getBgColorMode(),kt=!!G.isInverse();if(kt){let et=$;$=_e,_e=et;let mi=ue;ue=Ee,Ee=mi}let Xe,Rs,xi=!1;this._decorationService.forEachDecorationAtCell(z,t,void 0,et=>{et.options.layer!=="top"&&xi||(et.backgroundColorRGB&&(Ee=50331648,_e=et.backgroundColorRGB.rgba>>8&16777215,Xe=et.backgroundColorRGB),et.foregroundColorRGB&&(ue=50331648,$=et.foregroundColorRGB.rgba>>8&16777215,Rs=et.foregroundColorRGB),xi=et.options.layer==="top")}),!xi&&Se&&(Xe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,_e=Xe.rgba>>8&16777215,Ee=50331648,xi=!0,S.selectionForeground&&(ue=50331648,$=S.selectionForeground.rgba>>8&16777215,Rs=S.selectionForeground)),xi&&le.push("xterm-decoration-top");let Qs;switch(Ee){case 16777216:case 33554432:Qs=S.ansi[_e],le.push(`xterm-bg-${_e}`);break;case 50331648:Qs=qt.toColor(_e>>16,_e>>8&255,_e&255),this._addStyle(C,`background-color:#${_S((_e>>>0).toString(16),"0",6)}`);break;case 0:default:kt?(Qs=S.foreground,le.push("xterm-bg-257")):Qs=S.background}switch(Xe||G.isDim()&&(Xe=pt.multiplyOpacity(Qs,.5)),ue){case 16777216:case 33554432:G.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(C,Qs,S.ansi[$],G,Xe,void 0)||le.push(`xterm-fg-${$}`);break;case 50331648:let et=qt.toColor($>>16&255,$>>8&255,$&255);this._applyMinimumContrast(C,Qs,et,G,Xe,Rs)||this._addStyle(C,`color:#${_S($.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,Qs,S.foreground,G,Xe,Rs)||kt&&le.push("xterm-fg-257")}le.length&&(C.className=le.join(" "),le.length=0),!ke&&!se&&!K&&A?k++:C.textContent=N,I!==this.defaultSpacing&&(C.style.letterSpacing=`${I}px`),v.push(C),z=F}return C&&k&&(C.textContent=N),v}_applyMinimumContrast(e,t,i,n,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||uM(n.getCode()))return!1;let h=this._getContrastCache(n),d;if(!a&&!c&&(d=h.getColor(t.rgba,i.rgba)),d===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=pt.ensureContrastRatio(a||t,c||i,f),h.setColor((a||t).rgba,(c||i).rgba,d??null)}return d?(this._addStyle(e,`color:${d.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 i=this._selectionStart,n=this._selectionEnd;return!i||!n?!1:this._columnSelectMode?i[0]<=n[0]?e>=i[0]&&t>=i[1]&&e<n[0]&&t<=n[1]:e<i[0]&&t>=i[1]&&e>=n[0]&&t<=n[1]:t>i[1]&&t<n[1]||i[1]===n[1]&&t===i[1]&&e>=i[0]&&e<n[0]||i[1]<n[1]&&t===n[1]&&e<n[0]||i[1]<n[1]&&t===i[1]&&e>=i[0]}};Tp=jt([me(1,e1),me(2,bs),me(3,vr),me(4,fa),me(5,oc),me(6,jl)],Tp);function _S(e,t,i){for(;e.length<i;)e=t+e;return e}var dM=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[i,n,a,c],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(c),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,i,n){e===this._font&&t===this._fontSize&&i===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,i){let n=0;if(!t&&!i&&e.length===1&&(n=e.charCodeAt(0))<256){if(this._flat[n]!==-9999)return this._flat[n];let h=this._measure(e,0);return h>0&&(this._flat[n]=h),h}let a=e;t&&(a+="B"),i&&(a+="I");let c=this._holey.get(a);if(c===void 0){let h=0;t&&(h|=1),i&&(h|=2),c=this._measure(e,h),c>0&&this._holey.set(a,c)}return c}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},fM=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,i,n=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let a=e.buffers.active.ydisp,c=t[1]-a,h=i[1]-a,d=Math.max(c,0),f=Math.min(h,e.rows-1);if(d>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=d,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function mM(){return new fM}var pm="xterm-dom-renderer-owner-",li="xterm-rows",Uu="xterm-fg-",gS="xterm-bg-",Co="xterm-focus",Fu="xterm-selection",pM=1,Op=class extends Ie{constructor(e,t,i,n,a,c,h,d,f,m,g,v,b,S){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=a,this._helperContainer=c,this._linkifier2=h,this._charSizeService=f,this._optionsService=m,this._bufferService=g,this._coreService=v,this._coreBrowserService=b,this._themeService=S,this._terminalClass=pM++,this._rowElements=[],this._selectionRenderModel=mM(),this.onRequestRedraw=this._register(new he).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(li),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(Fu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=hM(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Tp,document),this._element.classList.add(pm+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(gt(()=>{this._element.classList.remove(pm+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new dM(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${li} 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} .${li} { 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} .${li} .xterm-dim { color: ${pt.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 i=`blink_underline_${this._terminalClass}`,n=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${n} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${li}.${Co} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${li}.${Co} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${li}.${Co} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${li} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${li} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${li} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${li} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${li} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Fu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Fu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Fu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${Uu}${c} { color: ${h.css}; }${this._terminalSelector} .${Uu}${c}.xterm-dim { color: ${pt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${gS}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${Uu}257 { color: ${pt.opaque(e.background).css}; }${this._terminalSelector} .${Uu}257.xterm-dim { color: ${pt.multiplyOpacity(pt.opaque(e.background),.5).css}; }${this._terminalSelector} .${gS}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 i=this._rowElements.length;i<=t;i++){let n=this._document.createElement("div");this._rowContainer.appendChild(n),this._rowElements.push(n)}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(Co),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Co),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let n=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(i){let f=e[0]>t[0];d.appendChild(this._createSelectionElement(c,f?t[0]:e[0],f?e[0]:t[0],h-c+1))}else{let f=n===c?e[0]:0,m=c===a?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,f,m));let g=h-c-1;if(d.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,g)),c!==h){let v=a===h?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,0,v))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,i,n=1){let a=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(i-t);return c+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-c),a.style.height=`${n*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${c}px`,a.style.width=`${h}px`,a}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 i=this._bufferService.buffer,n=i.ybase+i.y,a=Math.min(i.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let m=f+i.ydisp,g=this._rowElements[f],v=i.lines.get(m);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,m,m===n,h,d,a,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${pm}${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,i,n,a,c){i<0&&(e=0),n<0&&(t=0);let h=this._bufferService.rows-1;i=Math.max(Math.min(i,h),0),n=Math.max(Math.min(n,h),0),a=Math.min(a,this._bufferService.cols);let d=this._bufferService.buffer,f=d.ybase+d.y,m=Math.min(d.x,a-1),g=this._optionsService.rawOptions.cursorBlink,v=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=i;S<=n;++S){let x=S+d.ydisp,C=this._rowElements[S],k=d.lines.get(x);if(!C||!k)break;C.replaceChildren(...this._rowFactory.createRow(k,x,x===f,v,b,m,g,this.dimensions.css.cell.width,this._widthCache,c?S===i?e:0:-1,c?(S===n?t:a)-1:-1))}}};Op=jt([me(7,C_),me(8,Nh),me(9,bs),me(10,ys),me(11,fa),me(12,vr),me(13,jl)],Op);var Ap=class extends Ie{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new he),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new gM(this._optionsService))}catch{this._measureStrategy=this._register(new _M(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())}};Ap=jt([me(2,bs)],Ap);var y1=class extends Ie{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)}},_M=class extends y1{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},gM=class extends y1{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 new 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}},vM=class extends Ie{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new yM(this._window)),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new he),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(os.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Te(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Te(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}},yM=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Sl),this._onDprChange=this._register(new he),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(gt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Te(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.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)}},bM=class extends Ie{constructor(){super(),this.linkProviders=[],this._register(gt(()=>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 R_(e,t,i){let n=i.getBoundingClientRect(),a=e.getComputedStyle(i),c=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-c,t.clientY-n.top-h]}function SM(e,t,i,n,a,c,h,d,f){if(!c)return;let m=R_(e,t,i);if(m)return m[0]=Math.ceil((m[0]+(f?h/2:0))/h),m[1]=Math.ceil(m[1]/d),m[0]=Math.min(Math.max(m[0],1),n+(f?1:0)),m[1]=Math.min(Math.max(m[1],1),a),m}var Rp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,a){return SM(window,e,t,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let i=R_(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Rp=jt([me(0,yr),me(1,Nh)],Rp);var xM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):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=[]}},b1={};RA(b1,{getSafariVersion:()=>CM,isChromeOS:()=>C1,isFirefox:()=>S1,isIpad:()=>jM,isIphone:()=>kM,isLegacyEdge:()=>wM,isLinux:()=>M_,isMac:()=>Sh,isNode:()=>Th,isSafari:()=>x1,isWindows:()=>w1});var Th=typeof process<"u"&&"title"in process,cc=Th?"node":navigator.userAgent,uc=Th?"node":navigator.platform,S1=cc.includes("Firefox"),wM=cc.includes("Edge"),x1=/^((?!chrome|android).)*safari/i.test(cc);function CM(){if(!x1)return 0;let e=cc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Sh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uc),jM=uc==="iPad",kM=uc==="iPhone",w1=["Windows","Win16","Win32","WinCE"].includes(uc),M_=uc.indexOf("Linux")>=0,C1=/\bCrOS\b/.test(cc),j1=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),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),a=e.timeRemaining(),i*1.5>a){n-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=a}this.clear()}},EM=class extends j1{_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())}}},NM=class extends j1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},xh=!Th&&"requestIdleCallback"in window?NM:EM,TM=class{constructor(){this._queue=new xh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Mp=class extends Ie{constructor(e,t,i,n,a,c,h,d,f){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=a,this._coreBrowserService=d,this._renderer=this._register(new Sl),this._pausedResizeTask=new TM,this._observerDisposable=this._register(new Sl),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 he),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new he),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new he),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new xM((m,g)=>this._renderRows(m,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new OM(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(gt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var m;return(m=this._renderer.value)==null?void 0:m.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=gt(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let n=this._syncOutputHandler.flush();n&&(e=Math.min(e,n.start),t=Math.max(t,n.end)),i||(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),this._needsSelectionRefresh=!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(t=>this.refreshRows(t.start,t.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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(n=this._renderer.value)==null||n.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Mp=jt([me(2,bs),me(3,Nh),me(4,fa),me(5,oc),me(6,ys),me(7,vr),me(8,jl)],Mp);var OM=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 AM(e,t,i,n){let a=i.buffer.x,c=i.buffer.y;if(!i.buffer.hasScrollback)return DM(a,c,e,t,i,n)+Oh(c,t,i,n)+BM(a,c,e,t,i,n);let h;if(c===t)return h=a>e?"D":"C",Vo(Math.abs(a-e),Wo(h,n));h=c>t?"D":"C";let d=Math.abs(c-t),f=MM(c>t?e:a,i)+(d-1)*i.cols+1+RM(c>t?a:e);return Vo(f,Wo(h,n))}function RM(e,t){return e-1}function MM(e,t){return t.cols-e}function DM(e,t,i,n,a,c){return Oh(t,n,a,c).length===0?"":Vo(E1(e,t,e,t-ca(t,a),!1,a).length,Wo("D",c))}function Oh(e,t,i,n){let a=e-ca(e,i),c=t-ca(t,i),h=Math.abs(a-c)-LM(e,t,i);return Vo(h,Wo(k1(e,t),n))}function BM(e,t,i,n,a,c){let h;Oh(t,n,a,c).length>0?h=n-ca(n,a):h=t;let d=n,f=zM(e,t,i,n,a,c);return Vo(E1(e,h,i,d,f==="C",a).length,Wo(f,c))}function LM(e,t,i){var h;let n=0,a=e-ca(e,i),c=t-ca(t,i);for(let d=0;d<Math.abs(a-c);d++){let f=k1(e,t)==="A"?-1:1;(h=i.buffer.lines.get(a+f*d))!=null&&h.isWrapped&&n++}return n}function ca(e,t){let i=0,n=t.buffer.lines.get(e),a=n==null?void 0:n.isWrapped;for(;a&&e>=0&&e<t.rows;)i++,n=t.buffer.lines.get(--e),a=n==null?void 0:n.isWrapped;return i}function zM(e,t,i,n,a,c){let h;return Oh(i,n,a,c).length>0?h=n-ca(n,a):h=t,e<i&&h<=n||e>=i&&h<n?"C":"D"}function k1(e,t){return e>t?"A":"B"}function E1(e,t,i,n,a,c){let h=e,d=t,f="";for(;(h!==i||d!==n)&&d>=0&&d<c.buffer.lines.length;)h+=a?1:-1,a&&h>c.cols-1?(f+=c.buffer.translateBufferLineToString(d,!1,e,h),h=0,e=0,d++):!a&&h<0&&(f+=c.buffer.translateBufferLineToString(d,!1,0,e+1),h=c.cols-1,e=h,d--);return f+c.buffer.translateBufferLineToString(d,!1,e,h)}function Wo(e,t){let i=t?"O":"[";return te.ESC+i+e}function Vo(e,t){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=t;return i}var qM=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 vS(e,t){if(e.start.y>e.end.y)throw new 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 _m=50,PM=15,HM=50,IM=500,UM=" ",FM=new RegExp(UM,"g"),Dp=class extends Ie{constructor(e,t,i,n,a,c,h,d,f){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=a,this._mouseService=c,this._optionsService=h,this._renderService=d,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new hi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new he),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new he),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new he),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new qM(this._bufferService),this._activeSelectionMode=0,this._register(gt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.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 i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let d=i.translateBufferLineToString(h,!0,a,c);n.push(d)}}else{let a=e[1]===t[1]?t[0]:void 0;n.push(i.translateBufferLineToString(e[1],!0,e[0],a));for(let c=e[1]+1;c<=t[1]-1;c++){let h=i.lines.get(c),d=i.translateBufferLineToString(c,!0);h!=null&&h.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let c=i.lines.get(t[1]),h=i.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(a=>a.replace(FM," ")).join(w1?`\r
|
|
83
|
+
`:`
|
|
84
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),M_&&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),i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n||!t?!1:this._areCoordsInSelection(t,i,n)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!i||!n?!1:this._areCoordsInSelection([e,t],i,n)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var a,c;let i=(c=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:c.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=vS(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let n=this._getMouseBufferCoords(e);return n?(this._selectWordAt(n,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=R_(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-_m),_m),t/=_m,t/Math.abs(t)+Math.round(t*(PM-1)))}shouldForceSelection(e){return Sh?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(),HM)}_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&&!(Sh&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let n=i.lines.get(this._model.selectionEnd[1]);n&&n.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<IM&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let n=AM(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(n,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let n=0;t>=n;n++){let a=e.loadCell(n,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:a>1&&t!==n&&(i+=a-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,n=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,c=a.lines.get(e[1]);if(!c)return;let h=a.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(c,e[0]),f=d,m=e[0]-d,g=0,v=0,b=0,S=0;if(h.charAt(d)===" "){for(;d>0&&h.charAt(d-1)===" ";)d--;for(;f<h.length&&h.charAt(f+1)===" ";)f++}else{let k=e[0],N=e[0];c.getWidth(k)===0&&(g++,k--),c.getWidth(N)===2&&(v++,N++);let L=c.getString(N).length;for(L>1&&(S+=L-1,f+=L-1);k>0&&d>0&&!this._isCharWordSeparator(c.loadCell(k-1,this._workCell));){c.loadCell(k-1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,k--):D>1&&(b+=D-1,d-=D-1),d--,k--}for(;N<c.length&&f+1<h.length&&!this._isCharWordSeparator(c.loadCell(N+1,this._workCell));){c.loadCell(N+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,N++):D>1&&(S+=D-1,f+=D-1),f++,N++}}f++;let x=d+m-g+b,C=Math.min(this._bufferService.cols,f-d+g+v-b-S);if(!(!t&&h.slice(d,f).trim()==="")){if(i&&x===0&&c.getCodePoint(0)!==32){let k=a.lines.get(e[1]-1);if(k&&c.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let L=this._bufferService.cols-N.start;x-=L,C+=L}}}if(n&&x+C===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let k=a.lines.get(e[1]+1);if(k!=null&&k.isWrapped&&k.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(C+=N.length)}}return{start:x,length:C}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=vS(i,this._bufferService.cols)}};Dp=jt([me(3,ys),me(4,fa),me(5,j_),me(6,bs),me(7,yr),me(8,vr)],Dp);var yS=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},bS=class{constructor(){this._color=new yS,this._css=new yS}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ht=Object.freeze((()=>{let e=[yt.toColor("#2e3436"),yt.toColor("#cc0000"),yt.toColor("#4e9a06"),yt.toColor("#c4a000"),yt.toColor("#3465a4"),yt.toColor("#75507b"),yt.toColor("#06989a"),yt.toColor("#d3d7cf"),yt.toColor("#555753"),yt.toColor("#ef2929"),yt.toColor("#8ae234"),yt.toColor("#fce94f"),yt.toColor("#729fcf"),yt.toColor("#ad7fa8"),yt.toColor("#34e2e2"),yt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=t[i/36%6|0],a=t[i/6%6|0],c=t[i%6];e.push({css:qt.toCss(n,a,c),rgba:qt.toRgba(n,a,c)})}for(let i=0;i<24;i++){let n=8+i*10;e.push({css:qt.toCss(n,n,n),rgba:qt.toRgba(n,n,n)})}return e})()),Pn=yt.toColor("#ffffff"),Mo=yt.toColor("#000000"),SS=yt.toColor("#ffffff"),xS=Mo,jo={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},KM=Pn,Bp=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new bS,this._halfContrastCache=new bS,this._onChangeColors=this._register(new he),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pn,background:Mo,cursor:SS,cursorAccent:xS,selectionForeground:void 0,selectionBackgroundTransparent:jo,selectionBackgroundOpaque:pt.blend(Mo,jo),selectionInactiveBackgroundTransparent:jo,selectionInactiveBackgroundOpaque:pt.blend(Mo,jo),scrollbarSliderBackground:pt.opacity(Pn,.2),scrollbarSliderHoverBackground:pt.opacity(Pn,.4),scrollbarSliderActiveBackground:pt.opacity(Pn,.5),overviewRulerBorder:Pn,ansi:Ht.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=ut(e.foreground,Pn),t.background=ut(e.background,Mo),t.cursor=pt.blend(t.background,ut(e.cursor,SS)),t.cursorAccent=pt.blend(t.background,ut(e.cursorAccent,xS)),t.selectionBackgroundTransparent=ut(e.selectionBackground,jo),t.selectionBackgroundOpaque=pt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ut(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=pt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ut(e.selectionForeground,pS):void 0,t.selectionForeground===pS&&(t.selectionForeground=void 0),pt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=pt.opacity(t.selectionBackgroundTransparent,.3)),pt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=pt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ut(e.scrollbarSliderBackground,pt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ut(e.scrollbarSliderHoverBackground,pt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ut(e.scrollbarSliderActiveBackground,pt.opacity(t.foreground,.5)),t.overviewRulerBorder=ut(e.overviewRulerBorder,KM),t.ansi=Ht.slice(),t.ansi[0]=ut(e.black,Ht[0]),t.ansi[1]=ut(e.red,Ht[1]),t.ansi[2]=ut(e.green,Ht[2]),t.ansi[3]=ut(e.yellow,Ht[3]),t.ansi[4]=ut(e.blue,Ht[4]),t.ansi[5]=ut(e.magenta,Ht[5]),t.ansi[6]=ut(e.cyan,Ht[6]),t.ansi[7]=ut(e.white,Ht[7]),t.ansi[8]=ut(e.brightBlack,Ht[8]),t.ansi[9]=ut(e.brightRed,Ht[9]),t.ansi[10]=ut(e.brightGreen,Ht[10]),t.ansi[11]=ut(e.brightYellow,Ht[11]),t.ansi[12]=ut(e.brightBlue,Ht[12]),t.ansi[13]=ut(e.brightMagenta,Ht[13]),t.ansi[14]=ut(e.brightCyan,Ht[14]),t.ansi[15]=ut(e.brightWhite,Ht[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let n=0;n<i;n++)t.ansi[n+16]=ut(e.extendedAnsi[n],Ht[n+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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};Bp=jt([me(0,bs)],Bp);function ut(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var $M=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},WM=class{constructor(){this._services=new $M,this._services.set(C_,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=PA(e).sort((c,h)=>c.index-h.index),n=[];for(let c of i){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);n.push(h)}let a=i.length>0?i[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...n)}},VM={trace:0,debug:1,info:2,warn:3,error:4,off:5},YM="xterm.js: ",Lp=class extends Ie{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=VM[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":YM)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Lp=jt([me(0,bs)],Lp);var wS=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new he),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new he),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new he),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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 new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){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 n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+i.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<i.length;n++)this._array[this._getCyclicIndex(e+n)]=i[n];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let n=this._length+i.length-this._maxLength;this._startIndex+=n,this._length=this._maxLength,this.onTrimEmitter.fire(n)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let a=t-1;a>=0;a--)this.set(e+a+i,this.get(e+a));let n=e+t+i-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+i,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ze=3,Lt=Object.freeze(new lc),Ku=0,gm=2,Do=class N1{constructor(t,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let a=i||hi.fromCharData([0,Vw,1,0]);for(let c=0;c<t;++c)this.setCell(c,a);this.length=t}get(t){let i=this._data[t*ze+0],n=i&2097151;return[this._data[t*ze+1],i&2097152?this._combined[t]:n?Zr(n):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n]}set(t,i){this._data[t*ze+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*ze+0]=t|2097152|i[2]<<22):this._data[t*ze+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*ze+0]>>22}hasWidth(t){return this._data[t*ze+0]&12582912}getFg(t){return this._data[t*ze+1]}getBg(t){return this._data[t*ze+2]}hasContent(t){return this._data[t*ze+0]&4194303}getCodePoint(t){let i=this._data[t*ze+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*ze+0]&2097152}getString(t){let i=this._data[t*ze+0];return i&2097152?this._combined[t]:i&2097151?Zr(i&2097151):""}isProtected(t){return this._data[t*ze+2]&536870912}loadCell(t,i){return Ku=t*ze,i.content=this._data[Ku+0],i.fg=this._data[Ku+1],i.bg=this._data[Ku+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ze+0]=i.content,this._data[t*ze+1]=i.fg,this._data[t*ze+2]=i.bg}setCellFromCodepoint(t,i,n,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*ze+0]=i|n<<22,this._data[t*ze+1]=a.fg,this._data[t*ze+2]=a.bg}addCodepointToCell(t,i,n){let a=this._data[t*ze+0];a&2097152?this._combined[t]+=Zr(i):a&2097151?(this._combined[t]=Zr(a&2097151)+Zr(i),a&=-2097152,a|=2097152):a=i|1<<22,n&&(a&=-12582913,a|=n<<22),this._data[t*ze+0]=a}insertCells(t,i,n){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length-t){let a=new hi;for(let c=this.length-t-i-1;c>=0;--c)this.setCell(t+i+c,this.loadCell(t+c,a));for(let c=0;c<i;++c)this.setCell(t+c,n)}else for(let a=t;a<this.length;++a)this.setCell(a,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(t,i,n){if(t%=this.length,i<this.length-t){let a=new hi;for(let c=0;c<this.length-t-i;++c)this.setCell(t+c,this.loadCell(t+i+c,a));for(let c=this.length-i;c<this.length;++c)this.setCell(c,n)}else for(let a=t;a<this.length;++a)this.setCell(a,n);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,n)}replaceCells(t,i,n,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,n),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);t<i&&t<this.length;)this.setCell(t++,n)}resize(t,i){if(t===this.length)return this._data.length*4*gm<this._data.buffer.byteLength;let n=t*ze;if(t>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let a=new Uint32Array(n);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,i)}else{this._data=this._data.subarray(0,n);let a=Object.keys(this._combined);for(let h=0;h<a.length;h++){let d=parseInt(a[h],10);d>=t&&delete this._combined[d]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let d=parseInt(c[h],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,n*4*gm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*gm<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,t);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new N1(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303)return t+(this._data[t*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ze+0]&4194303||this._data[t*ze+2]&50331648)return t+(this._data[t*ze+0]>>22);return 0}copyCellsFrom(t,i,n,a,c){let h=t._data;if(c)for(let f=a-1;f>=0;f--){for(let m=0;m<ze;m++)this._data[(n+f)*ze+m]=h[(i+f)*ze+m];h[(i+f)*ze+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[i+f])}else for(let f=0;f<a;f++){for(let m=0;m<ze;m++)this._data[(n+f)*ze+m]=h[(i+f)*ze+m];h[(i+f)*ze+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[i+f])}let d=Object.keys(t._combined);for(let f=0;f<d.length;f++){let m=parseInt(d[f],10);m>=i&&(this._combined[m-i+n]=t._combined[m])}}translateToString(t,i,n,a){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let c="";for(;i<n;){let h=this._data[i*ze+0],d=h&2097151,f=h&2097152?this._combined[i]:d?Zr(d):fn;if(c+=f,a)for(let m=0;m<f.length;++m)a.push(i);i+=h>>22||1}return a&&a.push(i),c}};function GM(e,t,i,n,a,c){let h=[];for(let d=0;d<e.length-1;d++){let f=d,m=e.get(++f);if(!m.isWrapped)continue;let g=[e.get(d)];for(;f<e.length&&m.isWrapped;)g.push(m),m=e.get(++f);if(!c&&n>=d&&n<f){d+=g.length-1;continue}let v=0,b=Yo(g,v,t),S=1,x=0;for(;S<g.length;){let k=Yo(g,S,t),N=k-x,L=i-b,D=Math.min(N,L);g[v].copyCellsFrom(g[S],x,b,D,!1),b+=D,b===i&&(v++,b=0),x+=D,x===k&&(S++,x=0),b===0&&v!==0&&g[v-1].getWidth(i-1)===2&&(g[v].copyCellsFrom(g[v-1],i-1,b++,1,!1),g[v-1].setCell(i-1,a))}g[v].replaceCells(b,i,a);let C=0;for(let k=g.length-1;k>0&&(k>v||g[k].getTrimmedLength()===0);k--)C++;C>0&&(h.push(d+g.length-C),h.push(C)),d+=g.length-1}return h}function QM(e,t){let i=[],n=0,a=t[n],c=0;for(let h=0;h<e.length;h++)if(a===h){let d=t[++n];e.onDeleteEmitter.fire({index:h-c,amount:d}),h+=d-1,c+=d,a=t[++n]}else i.push(h);return{layout:i,countRemoved:c}}function ZM(e,t){let i=[];for(let n=0;n<t.length;n++)i.push(e.get(t[n]));for(let n=0;n<i.length;n++)e.set(n,i[n]);e.length=t.length}function XM(e,t,i){let n=[],a=e.map((f,m)=>Yo(e,m,t)).reduce((f,m)=>f+m),c=0,h=0,d=0;for(;d<a;){if(a-d<i){n.push(a-d);break}c+=i;let f=Yo(e,h,t);c>f&&(c-=f,h++);let m=e[h].getWidth(c-1)===2;m&&c--;let g=m?i-1:i;n.push(g),d+=g}return n}function Yo(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let n=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,a=e[t+1].getWidth(0)===2;return n&&a?i-1:i}var T1=class O1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=O1._nextId++,this._onDispose=this.register(new he),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),oa(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};T1._nextId=1;var JM=T1,Ft={},Hn=Ft.B;Ft[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ft.A={"#":"£"};Ft.B=void 0;Ft[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ft.C=Ft[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ft.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ft.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ft.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ft.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ft.E=Ft[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ft.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ft.H=Ft[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ft["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var CS=4294967295,jS=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Lt.clone(),this.savedCharset=Hn,this.markers=[],this._nullCell=hi.fromCharData([0,Vw,1,0]),this._whitespaceCell=hi.fromCharData([0,fn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new xh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new wS(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 vh),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 vh),this._whitespaceCell}getBlankLine(e,t){return new Do(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>CS?CS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Lt);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 wS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Lt),n=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)n+=+this.lines.get(h).resize(e,i);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 Do(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new Do(e,i)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let h=this.lines.length-a;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),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 c=0;c<this.lines.length;c++)n+=+this.lines.get(c).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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 i=this._optionsService.rawOptions.reflowCursorLine,n=GM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Lt),i);if(n.length>0){let a=QM(this.lines,n);ZM(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let n=this.getNullCell(Lt),a=i;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Do(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(Lt),a=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let d=this.lines.get(h);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let f=[d];for(;d.isWrapped&&h>0;)d=this.lines.get(--h),f.unshift(d);if(!i){let D=this.ybase+this.y;if(D>=h&&D<h+f.length)continue}let m=f[f.length-1].getTrimmedLength(),g=XM(f,this._cols,e),v=g.length-f.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+v):b=Math.max(0,this.lines.length-this.lines.maxLength+v);let S=[];for(let D=0;D<v;D++){let M=this.getBlankLine(Lt,!0);S.push(M)}S.length>0&&(a.push({start:h+f.length+c,newLines:S}),c+=S.length),f.push(...S);let x=g.length-1,C=g[x];C===0&&(x--,C=g[x]);let k=f.length-v-1,N=m;for(;k>=0;){let D=Math.min(N,C);if(f[x]===void 0)break;if(f[x].copyCellsFrom(f[k],N-D,C-D,D,!0),C-=D,C===0&&(x--,C=g[x]),N-=D,N===0){k--;let M=Math.max(k,0);N=Yo(f,M,this._cols)}}for(let D=0;D<f.length;D++)g[D]<e&&f[D].setCell(g[D],n);let L=v-b;for(;L-- >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+c)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+t-1)}if(a.length>0){let h=[],d=[];for(let C=0;C<this.lines.length;C++)d.push(this.lines.get(C));let f=this.lines.length,m=f-1,g=0,v=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let b=0;for(let C=Math.min(this.lines.maxLength-1,f+c-1);C>=0;C--)if(v&&v.start>m+b){for(let k=v.newLines.length-1;k>=0;k--)this.lines.set(C--,v.newLines[k]);C++,h.push({index:m+1,amount:v.newLines.length}),b+=v.newLines.length,v=a[++g]}else this.lines.set(C,d[m--]);let S=0;for(let C=h.length-1;C>=0;C--)h[C].index+=S,this.lines.onInsertEmitter.fire(h[C]),S+=h[C].amount;let x=Math.max(0,f+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,i=0,n){let a=this.lines.get(e);return a?a.translateToString(t,i,n):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(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 JM(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},eD=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new he),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 jS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new jS(!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)}},A1=2,R1=1,zp=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,A1),this.rows=Math.max(e.rawOptions.rows||0,R1),this.buffers=this._register(new eD(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,n=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,n;n=this._cachedBlankLine,(!n||n.length!==this.cols||n.getFg(0)!==e.fg||n.getBg(0)!==e.bg)&&(n=i.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;let a=i.ybase+i.scrollTop,c=i.ybase+i.scrollBottom;if(i.scrollTop===0){let h=i.lines.isFull;c===i.lines.length-1?h?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(c+1,0,n.clone()),h?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let h=c-a+1;i.lines.shiftElements(a+1,h-1,-1),i.lines.set(c,n.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let n=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),n!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};zp=jt([me(0,bs)],zp);var el={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:Sh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},tD=["normal","bold","100","200","300","400","500","600","700","800","900"],sD=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new he),this.onOptionChange=this._onOptionChange.event;let t={...el};for(let i in e)if(i in t)try{let n=e[i];t[i]=this._sanitizeAndValidateOption(i,n)}catch(n){console.error(n)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(gt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in el))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in el))throw new Error(`No option with key "${i}"`);n=this._sanitizeAndValidateOption(i,n),this.rawOptions[i]!==n&&(this.rawOptions[i]=n,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let n={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,n)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=el[e]),!iD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=el[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=tD.includes(t)?t:el[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new 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 new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function iD(e){return e==="block"||e==="underline"||e==="bar"}function Bo(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let n in e)i[n]=t<=1?e[n]:e[n]&&Bo(e[n],t-1);return i}var kS=Object.freeze({insertMode:!1}),ES=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),qp=class extends Ie{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new he),this.onData=this._onData.event,this._onUserInput=this._register(new he),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new he),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Bo(kS),this.decPrivateModes=Bo(ES)}reset(){this.modes=Bo(kS),this.decPrivateModes=Bo(ES)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(n=>n.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};qp=jt([me(0,ys),me(1,Xw),me(2,bs)],qp);var NS={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 vm(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var ym=String.fromCharCode,TS={DEFAULT:e=>{let t=[vm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${ym(t[0])}${ym(t[1])}${ym(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${vm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${vm(e,!0)};${e.x};${e.y}${t}`}},Pp=class extends Ie{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new he),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(NS))this.addProtocol(n,NS[n]);for(let n of Object.keys(TS))this.addEncoding(n,TS[n]);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 new 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 new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let n=t/i,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=n+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_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,i){if(i){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)}};Pp=jt([me(0,ys),me(1,fa),me(2,bs)],Pp);var bm=[[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]],rD=[[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]],It;function nD(e,t){let i=0,n=t.length-1,a;if(e<t[0][0]||e>t[n][1])return!1;for(;n>=i;)if(a=i+n>>1,e>t[a][1])i=a+1;else if(e<t[a][0])n=a-1;else return!0;return!1}var aD=class{constructor(){if(this.version="6",!It){It=new Uint8Array(65536),It.fill(1),It[0]=0,It.fill(0,1,32),It.fill(0,127,160),It.fill(2,4352,4448),It[9001]=2,It[9002]=2,It.fill(2,11904,42192),It[12351]=1,It.fill(2,44032,55204),It.fill(2,63744,64256),It.fill(2,65040,65050),It.fill(2,65072,65136),It.fill(2,65280,65377),It.fill(2,65504,65511);for(let e=0;e<bm.length;++e)It.fill(0,bm[e][0],bm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?It[e]:nD(e,rD)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let a=Un.extractWidth(t);a===0?n=!1:a>i&&(i=a)}return Un.createPropertyValue(0,i,n)}},Un=class ih{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new he,this.onChange=this._onChange.event;let t=new aD;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,n=!1){return(t&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,n=0,a=t.length;for(let c=0;c<a;++c){let h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=a)return i+this.wcwidth(h);let m=t.charCodeAt(c);56320<=m&&m<=57343?h=(h-55296)*1024+m-56320+65536:i+=this.wcwidth(m)}let d=this.charProperties(h,n),f=ih.extractWidth(d);ih.extractShouldJoin(d)&&(f-=ih.extractWidth(n)),i+=f,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},lD=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 OS(e){var n;let t=(n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:n.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var ko=2147483647,oD=256,M1=class Hp{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>oD)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new Hp;if(!t.length)return i;for(let n=Array.isArray(t[0])?1:0;n<t.length;++n){let a=t[n];if(Array.isArray(a))for(let c=0;c<a.length;++c)i.addSubParam(a[c]);else i.addParam(a)}return i}clone(){let t=new Hp(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 t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let n=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-n>0&&t.push(Array.prototype.slice.call(this._subParams,n,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>ko?ko:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>ko?ko:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,n=this._subParamsIdx[t]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-n>0&&(t[i]=this._subParams.slice(n,a))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,a=n[i-1];n[i-1]=~a?Math.min(a*10+t,ko):t}},Eo=[],cD=class{constructor(){this._state=0,this._active=Eo,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=Eo}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=Eo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Eo,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Eh(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){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&&i-t>0&&this._put(e,t,i)}}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 i=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&i===!1){for(;n>=0&&(i=this._active[n].end(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=Eo,this._id=-1,this._state=0}}},Ks=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Eh(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},No=[],uD=class{constructor(){this._handlers=Object.create(null),this._active=No,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=No}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let n=i.indexOf(t);n!==-1&&i.splice(n,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=No,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||No,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Eh(e,t,i));else for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,n=this._active.length-1,a=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&i===!1){for(;n>=0&&(i=this._active[n].unhook(e),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}this._active=No,this._ident=0}},Lo=new M1;Lo.addParam(0);var AS=class{constructor(e){this._handler=e,this._data="",this._params=Lo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Lo,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Eh(e,t,i),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(i=>(this._params=Lo,this._data="",this._hitLimit=!1,i));return this._params=Lo,this._data="",this._hitLimit=!1,t}},hD=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,n){this.table[t<<8|e]=i<<4|n}addMany(e,t,i,n){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=i<<4|n}},ui=160,dD=(function(){let e=new hD(4095),t=Array.apply(null,Array(256)).map((d,f)=>f),i=(d,f)=>t.slice(d,f),n=i(32,127),a=i(0,24);a.push(25),a.push.apply(a,i(28,32));let c=i(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(i(128,144),h,3,0),e.addMany(i(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ui,0,2,0),e.add(ui,8,5,8),e.add(ui,6,0,6),e.add(ui,11,0,11),e.add(ui,13,13,13),e})(),fD=class extends Ie{constructor(e=dD){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 M1,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,n)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(gt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new cD),this._dcsParser=this._register(new uD),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let c=e.intermediates.charCodeAt(a);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=n,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let n=this._escHandlers[i];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let n=this._csiHandlers[i];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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,i,n,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=n,this._parseStack.chunkPos=a}parse(e,t,i){let n=0,a=0,c=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let d=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&f>-1){for(;f>=0&&(h=d[f](this._params),h!==!0);f--)if(h instanceof Promise)return this._parseStack.handlerPos=f,h}this._parseStack.handlers=[];break;case 4:if(i===!1&&f>-1){for(;f>=0&&(h=d[f](),h!==!0);f--)if(h instanceof Promise)return this._parseStack.handlerPos=f,h}this._parseStack.handlers=[];break;case 6:if(n=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(n!==24&&n!==26,i),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(n=e[this._parseStack.chunkPos],h=this._oscParser.end(n!==24&&n!==26,i),h)return h;n===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=c;d<t;++d){switch(n=e[d],a=this._transitions.table[this.currentState<<8|(n<160?n:ui)],a>>4){case 2:for(let b=d+1;;++b){if(b>=t||(n=e[b])<32||n>126&&n<ui){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ui){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ui){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ui){this._printHandler(e,d,b),d=b-1;break}}break;case 3:this._executeHandlers[n]?this._executeHandlers[n]():this._executeHandlerFb(n),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:d,code:n,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|n],m=f?f.length-1:-1;for(;m>=0&&(h=f[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._preserveStack(3,f,m,a,d),h;m<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let g=this._escHandlers[this._collect<<8|n],v=g?g.length-1:-1;for(;v>=0&&(h=g[v](),h!==!0);v--)if(h instanceof Promise)return this._preserveStack(4,g,v,a,d),h;v<0&&this._escHandlerFb(this._collect<<8|n),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|n,this._params);break;case 13:for(let b=d+1;;++b)if(b>=t||(n=e[b])===24||n===26||n===27||n>127&&n<ui){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(h=this._dcsParser.unhook(n!==24&&n!==26),h)return this._preserveStack(6,[],0,a,d),h;n===27&&(a|=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 b=d+1;;b++)if(b>=t||(n=e[b])<32||n>127&&n<ui){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(h=this._oscParser.end(n!==24&&n!==26),h)return this._preserveStack(5,[],0,a,d),h;n===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},mD=/^([\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})$/,pD=/^[\da-f]+$/;function RS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=mD.exec(t);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),pD.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,n=[0,0,0];for(let a=0;a<3;++a){let c=parseInt(t.slice(i*a,i*a+i),16);n[a]=i===1?c<<4:i===2?c:i===3?c>>4:c>>8}return n}}function Sm(e,t){let i=e.toString(16),n=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function _D(e,t=16){let[i,n,a]=e;return`rgb:${Sm(i,t)}/${Sm(n,t)}/${Sm(a,t)}`}var gD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vr=131072,MS=10;function DS(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 BS=5e3,LS=0,vD=class extends Ie{constructor(e,t,i,n,a,c,h,d,f=new fD){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=n,this._optionsService=a,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=d,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new zA,this._utf8Decoder=new qA,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Lt.clone(),this._eraseAttrDataInternal=Lt.clone(),this._onRequestBell=this._register(new he),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new he),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new he),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new he),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new he),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new he),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new he),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new he),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new he),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new he),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 Ip(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:g.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,g,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:g,data:v})}),this._parser.setDcsHandlerFallback((m,g,v)=>{g==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:g,payload:v})}),this._parser.setPrintHandler((m,g,v)=>this.print(m,g,v)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(te.BEL,()=>this.bell()),this._parser.setExecuteHandler(te.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(te.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(te.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(te.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(te.BS,()=>this.backspace()),this._parser.setExecuteHandler(te.HT,()=>this.tab()),this._parser.setExecuteHandler(te.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(te.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(th.IND,()=>this.index()),this._parser.setExecuteHandler(th.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(th.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ks(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Ks(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Ks(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Ks(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Ks(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Ks(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Ks(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Ks(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Ks(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Ks(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Ks(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Ks(m=>this.restoreCursorColor(m))),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 m in Ft)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new AS((m,g)=>this.requestStatusString(m,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),BS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${BS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,a=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Vr&&(c=this._parseStack.position+Vr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vr))),h||this._dirtyRowTracker.clearRange(),e.length>Vr)for(let m=c;m<e.length;m+=Vr){let g=m+Vr<e.length?m+Vr:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(m,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,g),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,v))return this._preserveStack(n,a,v,m),this._logSlowResolvingAsync(i),i}else if(!h){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,m))return this._preserveStack(n,a,m,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,i){let n,a,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,g=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let b=this._parser.precedingJoinState;for(let S=t;S<i;++S){if(n=e[S],n<127&&c){let N=c[String.fromCharCode(n)];N&&(n=N.charCodeAt(0))}let x=this._unicodeService.charProperties(n,b);a=Un.extractWidth(x);let C=Un.extractShouldJoin(x),k=C?Un.extractWidth(b):0;if(b=x,h&&this._onA11yChar.fire(Zr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-k>d){if(f){let N=v,L=this._activeBuffer.x-k;for(this._activeBuffer.x=k,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),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&v instanceof Do&&v.copyCellsFrom(N,L,0,k,!1);L<d;)N.setCellFromCodepoint(L++,0,1,g)}else if(this._activeBuffer.x=d-1,a===2)continue}if(C&&this._activeBuffer.x){let N=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-N,n,a);for(let L=a-k;--L>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(m&&(v.insertCells(this._activeBuffer.x,a-k,this._activeBuffer.getNullCell(g)),v.getWidth(d-1)===2&&v.setCellFromCodepoint(d-1,0,1,g)),v.setCellFromCodepoint(this._activeBuffer.x++,n,a,g),a>0)for(;--a;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&i-t>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>DS(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new AS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Ks(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(){var e;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&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,i,n=!1,a=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),a),n&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&n.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,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 i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(i,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 i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(i,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}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(Lt));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);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 i=e.params[0]||1,n=Un.extractWidth(t),a=this._activeBuffer.x-n,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(c.length*i),d=0;for(let m=0;m<c.length;){let g=c.codePointAt(m)||0;h[d++]=g,m+=g>65535?2:1}let f=d;for(let m=1;m<i;++m)h.copyWithin(f,0,d),f+=d;return this.print(h,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(te.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(te.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(te.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(te.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(te.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,Hn),this._charsetService.setgCharset(1,Hn),this._charsetService.setgCharset(2,Hn),this._charsetService.setgCharset(3,Hn);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){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:d,cols:f}=this._bufferService,{active:m,alt:g}=d,v=this._optionsService.rawOptions,b=(C,k)=>(h.triggerDataEvent(`${te.ESC}[${t?"":"?"}${C};${k}$y`),!0),S=C=>C?1:2,x=e.params[0];return t?x===2?b(x,4):x===4?b(x,S(h.modes.insertMode)):x===12?b(x,3):x===20?b(x,S(v.convertEol)):b(x,0):x===1?b(x,S(n.applicationCursorKeys)):x===3?b(x,v.windowOptions.setWinLines?f===80?2:f===132?1:0:0):x===6?b(x,S(n.origin)):x===7?b(x,S(n.wraparound)):x===8?b(x,3):x===9?b(x,S(a==="X10")):x===12?b(x,S(v.cursorBlink)):x===25?b(x,S(!h.isCursorHidden)):x===45?b(x,S(n.reverseWraparound)):x===66?b(x,S(n.applicationKeypad)):x===67?b(x,4):x===1e3?b(x,S(a==="VT200")):x===1002?b(x,S(a==="DRAG")):x===1003?b(x,S(a==="ANY")):x===1004?b(x,S(n.sendFocus)):x===1005?b(x,4):x===1006?b(x,S(c==="SGR")):x===1015?b(x,4):x===1016?b(x,S(c==="SGR_PIXELS")):x===1048?b(x,1):x===47||x===1047||x===1049?b(x,S(m===g)):x===2004?b(x,S(n.bracketedPasteMode)):x===2026?b(x,S(n.synchronizedOutput)):b(x,0)}_updateAttrColor(e,t,i,n,a){return t===2?(e|=50331648,e&=-16777216,e|=lc.fromColorRGB([i,n,a])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let n=[0,0,-1,0,0,0],a=0,c=0;do{if(n[c+a]=e.params[t+c],e.hasSubParams(t+c)){let h=e.getSubParams(t+c),d=0;do n[1]===5&&(a=1),n[c+d+1+a]=h[d];while(++d<h.length&&d+c+1+a<n.length);break}if(n[1]===5&&c+a>=2||n[1]===2&&c+a>=5)break;n[1]&&(a=1)}while(++c+t<e.length&&c+a<n.length);for(let h=2;h<n.length;++h)n[h]===-1&&(n[h]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return c}_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=Lt.fg,e.bg=Lt.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,i,n=this._curAttrData;for(let a=0;a<t;a++)i=e.params[a],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=Lt.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=Lt.bg&16777215):i===38||i===48||i===58?a+=this._extractColor(e,a,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=Lt.fg&16777215,n.bg&=-67108864,n.bg|=Lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${te.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${te.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${te.ESC}[?${t};${i}R`);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=Lt.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!DS(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(`${te.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>MS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>MS&&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=[],i=e.split(";");for(;i.length>1;){let n=i.shift(),a=i.shift();if(/^\d+$/.exec(n)){let c=parseInt(n);if(zS(c))if(a==="?")t.push({type:0,index:c});else{let h=RS(a);h&&t.push({type:1,index:c,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),n=e.slice(t+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),n,a=i.findIndex(c=>c.startsWith("id="));return a!==-1&&(n=i[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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 i=e.split(";");for(let n=0;n<i.length&&!(t>=this._specialColors.length);++n,++t)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=RS(i[n]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}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=[],i=e.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let a=parseInt(i[n]);zS(a)&&t.push({type:2,index:a})}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,Hn),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(gD[e[0]],Ft[e[1]]||Hn),!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=Lt.clone(),this._eraseAttrDataInternal=Lt.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 hi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(i);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=h=>(this._coreService.triggerDataEvent(`${te.ESC}${h}${te.ESC}\\`),!0),n=this._bufferService.buffer,a=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Ip=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&&(LS=e,e=t,t=LS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Ip=jt([me(0,ys)],Ip);function zS(e){return 0<=e&&e<256}var yD=5e7,qS=12,bD=50,SD=class extends Ie{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 he),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let n=this._callbacks.shift();n&&n()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>yD)throw new 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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let n=this._writeBuffer[this._bufferOffset],a=this._action(n,t);if(a){let h=d=>performance.now()-i>=qS?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(i,d);a.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=qS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>bD&&(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()}},Up=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 d=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(f,d)),this._dataByLinkId.set(f.id,f),f.id}let i=e,n=this._getEntryIdKey(i),a=this._entriesWithId.get(n);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let c=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(n=>n.line!==t)){let n=this._bufferService.buffer.addMarker(t);i.lines.push(n),n.onDispose(()=>this._removeMarkerFromLink(i,n))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Up=jt([me(0,ys)],Up);var PS=!1,xD=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Sl),this._onBinary=this._register(new he),this.onBinary=this._onBinary.event,this._onData=this._register(new he),this.onData=this._onData.event,this._onLineFeed=this._register(new he),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new he),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new he),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new he),this._instantiationService=new WM,this.optionsService=this._register(new sD(e)),this._instantiationService.setService(bs,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(zp)),this._instantiationService.setService(ys,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Lp)),this._instantiationService.setService(Xw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(qp)),this._instantiationService.setService(fa,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Pp)),this._instantiationService.setService(Zw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Un)),this._instantiationService.setService(UA,this.unicodeService),this._charsetService=this._instantiationService.createInstance(lD),this._instantiationService.setService(IA,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Up),this._instantiationService.setService(Jw,this._oscLinkService),this._inputHandler=this._register(new vD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(os.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(os.forward(this._bufferService.onResize,this._onResize)),this._register(os.forward(this.coreService.onData,this._onData)),this._register(os.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 SD((t,i)=>this._inputHandler.parse(t,i))),this._register(os.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new he),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!PS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),PS=!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,A1),t=Math.max(t,R1),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(OS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(OS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=gt(()=>{for(let t of e)t.dispose()})}}},wD={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 CD(e,t,i,n){var h;let a={type:0,cancel:!1,key:void 0},c=(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?a.key=te.ESC+"OA":a.key=te.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=te.ESC+"OD":a.key=te.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=te.ESC+"OC":a.key=te.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=te.ESC+"OB":a.key=te.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":te.DEL,e.altKey&&(a.key=te.ESC+a.key);break;case 9:if(e.shiftKey){a.key=te.ESC+"[Z";break}a.key=te.HT,a.cancel=!0;break;case 13:a.key=e.altKey?te.ESC+te.CR:te.CR,a.cancel=!0;break;case 27:a.key=te.ESC,e.altKey&&(a.key=te.ESC+te.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;c?a.key=te.ESC+"[1;"+(c+1)+"D":t?a.key=te.ESC+"OD":a.key=te.ESC+"[D";break;case 39:if(e.metaKey)break;c?a.key=te.ESC+"[1;"+(c+1)+"C":t?a.key=te.ESC+"OC":a.key=te.ESC+"[C";break;case 38:if(e.metaKey)break;c?a.key=te.ESC+"[1;"+(c+1)+"A":t?a.key=te.ESC+"OA":a.key=te.ESC+"[A";break;case 40:if(e.metaKey)break;c?a.key=te.ESC+"[1;"+(c+1)+"B":t?a.key=te.ESC+"OB":a.key=te.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=te.ESC+"[2~");break;case 46:c?a.key=te.ESC+"[3;"+(c+1)+"~":a.key=te.ESC+"[3~";break;case 36:c?a.key=te.ESC+"[1;"+(c+1)+"H":t?a.key=te.ESC+"OH":a.key=te.ESC+"[H";break;case 35:c?a.key=te.ESC+"[1;"+(c+1)+"F":t?a.key=te.ESC+"OF":a.key=te.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=te.ESC+"[5;"+(c+1)+"~":a.key=te.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=te.ESC+"[6;"+(c+1)+"~":a.key=te.ESC+"[6~";break;case 112:c?a.key=te.ESC+"[1;"+(c+1)+"P":a.key=te.ESC+"OP";break;case 113:c?a.key=te.ESC+"[1;"+(c+1)+"Q":a.key=te.ESC+"OQ";break;case 114:c?a.key=te.ESC+"[1;"+(c+1)+"R":a.key=te.ESC+"OR";break;case 115:c?a.key=te.ESC+"[1;"+(c+1)+"S":a.key=te.ESC+"OS";break;case 116:c?a.key=te.ESC+"[15;"+(c+1)+"~":a.key=te.ESC+"[15~";break;case 117:c?a.key=te.ESC+"[17;"+(c+1)+"~":a.key=te.ESC+"[17~";break;case 118:c?a.key=te.ESC+"[18;"+(c+1)+"~":a.key=te.ESC+"[18~";break;case 119:c?a.key=te.ESC+"[19;"+(c+1)+"~":a.key=te.ESC+"[19~";break;case 120:c?a.key=te.ESC+"[20;"+(c+1)+"~":a.key=te.ESC+"[20~";break;case 121:c?a.key=te.ESC+"[21;"+(c+1)+"~":a.key=te.ESC+"[21~";break;case 122:c?a.key=te.ESC+"[23;"+(c+1)+"~":a.key=te.ESC+"[23~";break;case 123:c?a.key=te.ESC+"[24;"+(c+1)+"~":a.key=te.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=te.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=te.DEL:e.keyCode===219?a.key=te.ESC:e.keyCode===220?a.key=te.FS:e.keyCode===221&&(a.key=te.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let d=(h=wD[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(d)a.key=te.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(f);e.shiftKey&&(m=m.toUpperCase()),a.key=te.ESC+m}else if(e.keyCode===32)a.key=te.ESC+(e.ctrlKey?te.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),a.key=te.ESC+f,a.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=te.US),e.key==="@"&&(a.key=te.NUL));break}return a}var Tt=0,jD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new xh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new xh,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((a,c)=>this._getKey(a)-this._getKey(c)),t=0,i=0,n=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<n.length;a++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(n[a]=e[t],t++):n[a]=this._array[i++];this._array=n,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||(Tt=this._search(t),Tt===-1)||this._getKey(this._array[Tt])!==t)return!1;do if(this._array[Tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Tt),!0;while(++Tt<this._array.length&&this._getKey(this._array[Tt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,c)=>a-c),t=0,i=new Array(this._array.length-e.length),n=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:i[n++]=this._array[a];this._array=i,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&&(Tt=this._search(e),!(Tt<0||Tt>=this._array.length)&&this._getKey(this._array[Tt])===e))do yield this._array[Tt];while(++Tt<this._array.length&&this._getKey(this._array[Tt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Tt=this._search(e),!(Tt<0||Tt>=this._array.length)&&this._getKey(this._array[Tt])===e))do t(this._array[Tt]);while(++Tt<this._array.length&&this._getKey(this._array[Tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let n=t+i>>1,a=this._getKey(this._array[n]);if(a>e)i=n-1;else if(a<e)t=n+1;else{for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}}return t}},xm=0,HS=0,kD=class extends Ie{constructor(){super(),this._decorations=new jD(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new he),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new he),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(gt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new ED(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let n=0,a=0;for(let c of this._decorations.getKeyIterator(t))n=c.options.x??0,a=n+(c.options.width??1),e>=n&&e<a&&(!i||(c.options.layer??"bottom")===i)&&(yield c)}forEachDecorationAtCell(e,t,i,n){this._decorations.forEachByKey(t,a=>{xm=a.options.x??0,HS=xm+(a.options.width??1),e>=xm&&e<HS&&(!i||(a.options.layer??"bottom")===i)&&n(a)})}},ED=class extends pn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new he),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new he),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=yt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=yt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},ND=1e3,TD=class{constructor(e,t=ND){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let n=performance.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=n-this._lastRefreshMs,c=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_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)}},IS=20,wh=class extends Ie{constructor(e,t,i,n){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,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=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new TD(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
85
|
+
`))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Te(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(gt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<IS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
86
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===IS+1&&(this._liveRegion.textContent+=op.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,n=i.lines.length.toString();for(let a=e;a<=t;a++){let c=i.lines.get(i.ydisp+a),h=[],d=(c==null?void 0:c.translateToString(!0,void 0,void 0,h))||"",f=(i.ydisp+a+1).toString(),m=this._rowElements[a];m&&(d.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=d,this._rowColumns.set(m,h)),m.setAttribute("aria-posinset",f),m.setAttribute("aria-setsize",n),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],a=i.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===c||e.relatedTarget!==n)return;let h,d;if(t===0?(h=i,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(h=this._rowElements.shift(),d=i,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),d.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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(){var d;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:((d=n.textContent)==null?void 0:d.length)??0}),!this._rowContainer.contains(i.node))return;let a=({node:f,offset:m})=>{let g=f instanceof Text?f.parentNode:f,v=parseInt(g==null?void 0:g.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(g);if(!b)return console.warn("columns is null. Race condition?"),null;let S=m<b.length?b[m]:b.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},c=a(t),h=a(i);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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){var a,c;e.style.transform="";let t=e.getBoundingClientRect().width,i=(c=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:c[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};wh=jt([me(1,C_),me(2,vr),me(3,yr)],wh);var Fp=class extends Ie{constructor(e,t,i,n,a){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=n,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new he),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new he),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(gt(()=>{var c;oa(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(c=this._activeProviderReplies)==null||c.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Te(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Te(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Te(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Te(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 i=e.composedPath();for(let n=0;n<i.length;n++){let a=i[n];if(a.classList.contains("xterm"))break;if(a.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){var n,a;(!this._activeProviderReplies||!t)&&((n=this._activeProviderReplies)==null||n.forEach(c=>{c==null||c.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[c,h]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(c)&&(i=this._checkLinkProviderResult(c,e,i)):h.provideLinks(e.y,d=>{var m,g;if(this._isMouseOut)return;let f=d==null?void 0:d.map(v=>({link:v}));(m=this._activeProviderReplies)==null||m.set(c,f),i=this._checkLinkProviderResult(c,e,i),((g=this._activeProviderReplies)==null?void 0:g.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let n=0;n<t.size;n++){let a=t.get(n);if(a)for(let c=0;c<a.length;c++){let h=a[c],d=h.link.range.start.y<e?0:h.link.range.start.x,f=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let m=d;m<=f;m++){if(i.has(m)){a.splice(c--,1);break}i.add(m)}}}}_checkLinkProviderResult(e,t,i){var c;if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(e),a=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(a=!0);if(!a&&n){let h=n.find(d=>this._linkAtPosition(d.link,t));h&&(i=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let h=0;h<this._activeProviderReplies.size;h++){let d=(c=this._activeProviderReplies.get(h))==null?void 0:c.find(f=>this._linkAtPosition(f.link,t));if(d){i=!0,this._handleNewLink(d);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&OD(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,oa(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:()=>{var i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.pointerCursor},set:i=>{var n;(n=this._currentLink)!=null&&n.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,n;return(n=(i=this._currentLink)==null?void 0:i.state)==null?void 0:n.decorations.underline},set:i=>{var n,a,c;(n=this._currentLink)!=null&&n.state&&((c=(a=this._currentLink)==null?void 0:a.state)==null?void 0:c.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(n,a),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,i){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,n=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,i){var n;(n=this._currentLink)!=null&&n.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return i<=a&&a<=n}_positionFromMouseEvent(e,t,i){let n=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,n,a){return{x1:e,y1:t,x2:i,y2:n,cols:this._bufferService.cols,fg:a}}};Fp=jt([me(1,j_),me(2,yr),me(3,ys),me(4,t1)],Fp);function OD(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 AD=class extends xD{constructor(e={}){super(e),this._linkifier=this._register(new Sl),this.browser=b1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Sl),this._onCursorMove=this._register(new he),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new he),this.onKey=this._onKey.event,this._onRender=this._register(new he),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new he),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new he),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new he),this.onBell=this._onBell.event,this._onFocus=this._register(new he),this._onBlur=this._register(new he),this._onA11yCharEmitter=this._register(new he),this._onA11yTabEmitter=this._register(new he),this._onWillOpen=this._register(new he),this._setup(),this._decorationService=this._instantiationService.createInstance(kD),this._instantiationService.setService(oc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(bM),this._instantiationService.setService(t1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(up)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 0:t.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(os.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(os.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(os.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(os.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(gt(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,n="";switch(t.index){case 256:i="foreground",n="10";break;case 257:i="background",n="11";break;case 258:i="cursor",n="12";break;default:i="ansi",n="4;"+t.index}switch(t.type){case 0:let a=pt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${te.ESC}]${n};${_D(a)}${v1.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=qt.toColor(...t.color));else{let c=i;this._themeService.modifyColors(h=>h[c]=qt.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(wh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(te.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(te.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 i=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,a=t.getWidth(i),c=this._renderService.dimensions.css.cell.width*a,h=this.buffer.y*this._renderService.dimensions.css.cell.height,d=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=d+"px",this.textarea.style.top=h+"px",this.textarea.style.width=c+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Te(this.element,"copy",t=>{this.hasSelection()&&BA(t,this._selectionService)}));let e=t=>LA(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),S1?this._register(Te(this.element,"mousedown",t=>{t.button===2&&Z0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{Z0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),M_&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&Ww(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Te(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Te(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Te(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Te(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Te(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Te(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Te(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var a;if(!e)throw new 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"),((a=this.element)==null?void 0:a.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(Te(this.screenElement,"mousemove",c=>this.updateCursorStyle(c))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",lp.get()),C1||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(vM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(vr,this._coreBrowserService),this._register(Te(this.textarea,"focus",c=>this._handleTextAreaFocus(c))),this._register(Te(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Ap,this._document,this._helperContainer),this._instantiationService.setService(Nh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Bp),this._instantiationService.setService(jl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(bh),this._instantiationService.setService(e1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Mp,this.rows,this.screenElement)),this._instantiationService.setService(yr,this._renderService),this._register(this._renderService.onRenderedViewportChange(c=>this._onRender.fire(c))),this.onResize(c=>this._renderService.resize(c.cols,c.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Np,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Rp),this._instantiationService.setService(j_,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance(Fp,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(kp,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(c=>{super.scrollLines(c,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Dp,this.element,this.screenElement,n)),this._instantiationService.setService(KA,this._selectionService),this._register(this._selectionService.onRequestScrollLines(c=>this.scrollLines(c.amount,c.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(c=>this._renderService.handleSelectionChanged(c.start,c.end,c.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(c=>{this.textarea.value=c,this.textarea.focus(),this.textarea.select()})),this._register(os.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var c;this._selectionService.refresh(),(c=this._viewport)==null||c.queueSync()})),this._register(this._instantiationService.createInstance(Ep,this.screenElement)),this._register(Te(this.element,"mousedown",c=>this._selectionService.handleMouseDown(c))),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(wh,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",c=>this._handleScreenReaderModeOptionChange(c))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",c=>{!this._overviewRulerRenderer&&c&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(yh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Op,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(c){var m,g,v,b,S;let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let d,f;switch(c.overrideType||c.type){case"mousemove":f=32,c.buttons===void 0?(d=3,c.button!==void 0&&(d=c.button<3?c.button:3)):d=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":f=0,d=c.button<3?c.button:3;break;case"mousedown":f=1,d=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let x=c.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(c,(b=(v=(g=(m=e._renderService)==null?void 0:m.dimensions)==null?void 0:g.device)==null?void 0:v.cell)==null?void 0:b.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return!1;f=x<0?0:1,d=4;break;default:return!1}return f===void 0||d===void 0||d>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:d,action:f,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:c=>(i(c),c.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(c)),wheel:c=>(i(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&i(c)},mousemove:c=>{c.buttons||i(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?n.mousemove||(t.addEventListener("mousemove",a.mousemove),n.mousemove=a.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),c&16?n.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),n.wheel=a.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),c&2?n.mouseup||(n.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),c&4?n.mousedrag||(n.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Te(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return i(c),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(c)})),this._register(Te(t,"wheel",c=>{var h,d,f,m,g;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,(m=(f=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:f.cell)==null?void 0:m.height,(g=e._coreBrowserService)==null?void 0:g.dpr)===0)return this.cancel(c,!0);let v=te.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(v,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){$w(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 new 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 new 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,i){this._selectionService.setSelection(e,t,i)}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(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.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 i=CD(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let n=this.rows-1;return this.scrollLines(i.type===2?-n:n),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===te.ETX||i.key===te.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(RD(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){var i;(i=this._charSizeService)==null||i.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(Lt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(te.ESC+"[I"):this.coreService.triggerDataEvent(te.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${te.ESC}[4;${i};${t}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${te.ESC}[6;${a};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function RD(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var MD=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},DD=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 hi)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},US=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 DD(t)}getNullCell(){return new hi}},BD=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new he),this.onBufferChange=this._onBufferChange.event,this._normal=new US(this._core.buffers.normal,"normal"),this._alternate=new US(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 new 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)}},LD=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,n)=>t(i,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)}},zD=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}},qD=["cols","rows"],Ni=0,PD=class extends Ie{constructor(e){super(),this._core=this._register(new AD(e)),this._addonManager=this._register(new MD),this._publicOptions={...this._core.options};let t=n=>this._core.options[n],i=(n,a)=>{this._checkReadonlyOptions(n),this._core.options[n]=a};for(let n in this._core.options){let a={get:t.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,a)}}_checkReadonlyOptions(e){if(qD.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new 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||(this._parser=new LD(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new zD(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._buffer=this._register(new BD(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
87
|
+
`,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 lp.get()},set promptLabel(e){lp.set(e)},get tooMuchOutput(){return op.get()},set tooMuchOutput(e){op.set(e)}}}_verifyIntegers(...e){for(Ni of e)if(Ni===1/0||isNaN(Ni)||Ni%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ni of e)if(Ni&&(Ni===1/0||isNaN(Ni)||Ni%1!==0||Ni<0))throw new Error("This API only accepts positive integers")}};const qe={brand:{300:"#CCC2FF",400:"#B5A2FF",500:"#9774FD",900:"#321F5F",950:"#211441"},accent:{400:"#ABBE55"},neutral:{50:"#F8F7F9",300:"#CBCAD2",400:"#B2B1BB",500:"#91909B",600:"#73727C",900:"#2E2E33",925:"#26252C",960:"#19181F",980:"#100F15",1010:"#050408"},success:{300:"#91E0B3",400:"#60CC93",500:"#1AAC6E"},warning:{300:"#F4C273",500:"#BF8500"},danger:{300:"#FFB6AE",400:"#FF8D83",500:"#F0554F"},info:{200:"#BEE5FF",300:"#94D4FF",400:"#4FBEFF",500:"#009CE0"}},Bt={"bg/surface":qe.neutral[980],"bg/inset":qe.neutral[1010],"bg/active":qe.neutral[925],"bg/brand":qe.brand[500],"bg/brand-subtle":qe.brand[950],"bg/brand-muted":qe.brand[900],"text/primary":qe.neutral[50],"text/code":qe.neutral[300],"border/subtle":qe.neutral[960],"git/added":qe.success[400],"git/removed":qe.danger[400],"syntax/keyword":qe.brand[400],"syntax/string":qe.accent[400],"syntax/number":qe.warning[300],"syntax/comment":qe.neutral[600],"syntax/function":qe.info[400],"syntax/type":qe.success[300],"syntax/punctuation":qe.neutral[400],"editor/cursor":qe.brand[400],"editor/selection":qe.brand[900],"editor/active-line":qe.neutral[980],"editor/line-number":qe.neutral[500],"editor/line-number-active":qe.neutral[300]},bB={2:2,8:8,10:10,12:12},SB={"gutter/line":44},HD={background:Bt["bg/inset"],foreground:Bt["text/primary"],cursor:Bt["text/primary"],cursorAccent:Bt["bg/inset"],selectionBackground:`${Bt["bg/brand"]}55`,selectionInactiveBackground:`${Bt["bg/active"]}88`,black:qe.neutral[900],red:qe.danger[500],green:qe.success[500],yellow:qe.warning[500],blue:qe.info[500],magenta:qe.brand[500],cyan:qe.info[400],white:qe.neutral[300],brightBlack:qe.neutral[600],brightRed:qe.danger[300],brightGreen:qe.success[300],brightYellow:qe.warning[300],brightBlue:qe.info[300],brightMagenta:qe.brand[300],brightCyan:qe.info[200],brightWhite:qe.neutral[50]},ID=['"JetBrainsMono Nerd Font"','"MesloLGS NF"','"FiraCode Nerd Font"','"Hack Nerd Font"','"JetBrains Mono"',"ui-monospace","SFMono-Regular","Menlo","monospace"].join(", "),UD=13,FD=20/13;function Ah({sessionId:e,connect:t=xw,readOnly:i=!1,onReady:n,onMessage:a}){const c=j.useRef(null),h=j.useRef(null),d=j.useRef(i);d.current=i;const f=j.useRef(n),m=j.useRef(a);return f.current=n,m.current=a,j.useEffect(()=>{var L;const g=c.current;if(!g)return;const v=new PD({convertEol:!1,cursorBlink:!d.current,disableStdin:d.current,scrollback:1e4,theme:HD,fontFamily:ID,fontSize:UD,lineHeight:FD}),b=new OA;v.loadAddon(b),v.open(g),h.current=v,wm(b),d.current||v.focus();const S=t(e,{onMessage(D){var M;D.type==="attached"?(wm(b),v.reset(),v.write(D.snapshot)):D.type==="output"&&v.write(D.data),(M=m.current)==null||M.call(m,D)}}),x=v.onData(D=>{d.current||S.send({type:"input",data:D})}),C=v.onResize(({cols:D,rows:M})=>S.send({type:"resize",cols:D,rows:M})),k=()=>wm(b);window.addEventListener("resize",k);const N=typeof ResizeObserver>"u"?null:new ResizeObserver(k);return N==null||N.observe(g),(L=f.current)==null||L.call(f,v),()=>{N==null||N.disconnect(),window.removeEventListener("resize",k),x.dispose(),C.dispose(),S.close(),v.dispose(),h.current=null}},[e,t]),j.useEffect(()=>{var v;const g=h.current;g!==null&&(g.options.disableStdin=i,g.options.cursorBlink=!i,i&&((v=c.current)!=null&&v.contains(document.activeElement))&&g.blur())},[i]),o.jsx("div",{className:"terminal","data-testid":"terminal","data-readonly":i?"true":void 0,ref:c})}function wm(e){try{e.fit()}catch{}}function KD({scope:e,dock:t,onAskAgent:i}){var d,f,m;const[n,a]=j.useState("run"),c=Uw(e),h=kA(e);return t.open?o.jsxs("div",{className:"dock",style:{height:`${String(t.height)}px`},"data-testid":"run-dock",children:[o.jsx("span",{className:"dock__grip",role:"separator","aria-orientation":"horizontal","aria-label":"altura do rodapé",onPointerDown:t.beginResize}),o.jsxs("div",{className:"dock__bar",role:"tablist","aria-label":"execução do checkout",children:[o.jsx("button",{type:"button",className:"dock__fold",title:"recolher o rodapé","aria-label":"recolher o rodapé",onClick:t.toggle,children:"⌄"}),o.jsx($u,{label:"Setup",active:n==="setup",dot:Cm((d=c.data)==null?void 0:d.setup),onClick:()=>a("setup")}),o.jsx($u,{label:"Run",active:n==="run",dot:Cm((f=c.data)==null?void 0:f.run),onClick:()=>a("run")}),o.jsx($u,{label:"Testes",active:n==="test",dot:Cm((m=c.data)==null?void 0:m.test),onClick:()=>a("test")}),o.jsx($u,{label:"Terminal",active:n==="terminal",onClick:()=>a("terminal")}),o.jsx("span",{className:"dock__spacer"}),o.jsxs("div",{className:"dock__acts",children:[n==="run"&&o.jsx($D,{status:c.data,actions:h}),(n==="setup"||n==="test")&&o.jsx(WD,{phase:n,status:c.data,actions:h})]})]}),n==="terminal"?o.jsx(ZD,{scope:e}):c.isError?o.jsx("div",{className:"dock__idle",role:"alert",children:o.jsx("span",{children:c.error.message})}):o.jsx(VD,{scope:e,phase:n,status:c.data,actions:h,onAskAgent:i})]}):o.jsx(XD,{scope:e,status:c.data,onOpen:t.toggle})}function Cm(e){return e!=null&&e.last?e.last.running?"run":e.last.exitCode===0?"ok":"fail":null}function $u({label:e,active:t,dot:i=null,onClick:n}){return o.jsxs("button",{type:"button",role:"tab","aria-selected":t,className:`dtab${t?" dtab--active":""}`,onClick:n,children:[i!==null&&o.jsx("span",{className:`dtab__dot dtab__dot--${i}`,"data-testid":`dot-${e.toLowerCase()}`}),e]})}function $D({status:e,actions:t}){var a;const i=((a=e==null?void 0:e.run.last)==null?void 0:a.running)===!0,n=(e==null?void 0:e.port)??null;return i?o.jsxs(o.Fragment,{children:[n!==null&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"openbtn__from dock__note",children:n.source==="env"?"porta de LUMEM_RUN_PORT":"porta lida da saída"}),o.jsxs("a",{className:"openbtn",href:`http://127.0.0.1:${String(n.port)}`,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:"Abrir"}),o.jsxs("span",{className:"openbtn__port",children:[":",n.port]})]})]}),o.jsx(de,{size:"sm",glyph:o.jsx("span",{className:"stopglyph",children:"⏹"}),disabled:t.stop.isPending,onClick:()=>t.stop.mutate("run"),children:"parar"})]}):o.jsx(de,{size:"sm",variant:"primary",disabled:(e==null?void 0:e.run.command)===null||t.start.isPending,onClick:()=>t.start.mutate("run"),children:"▶ rodar"})}function WD({phase:e,status:t,actions:i}){if(t===void 0||t[e].command===null)return null;const n=t[e].last;if((n==null?void 0:n.running)===!0)return o.jsx(de,{size:"sm",glyph:o.jsx("span",{className:"stopglyph",children:"⏹"}),onClick:()=>i.stop.mutate(e),children:"parar"});const a=n!==null&&n.exitCode!==0;return o.jsxs(de,{size:"sm",variant:a?"primary":"default",disabled:i.start.isPending,onClick:()=>i.start.mutate(e),children:["▶ ",n===null?"rodar":a?"tentar de novo":"rodar de novo"]})}function VD({scope:e,phase:t,status:i,actions:n,onAskAgent:a}){if(!i)return o.jsx("div",{className:"dock__idle",children:"lendo o checkout…"});const c=i[t].command;if(c===null)return o.jsx(GD,{scope:e,status:i,onAskAgent:a});if(!i.trusted)return o.jsx(QD,{status:i,phase:t,actions:n});const h=i[t].last,d=h!==null&&!h.running&&h.exitCode!==0;return o.jsxs(o.Fragment,{children:[t==="setup"&&d&&o.jsxs("div",{className:"dock__banner",role:"status",children:[o.jsx(Qe,{tone:"warn",children:"⚠"}),o.jsxs("span",{children:[o.jsx("strong",{children:"A worktree foi criada; o setup dela falhou."})," Ela funciona — só não está preparada."]})]}),o.jsxs("div",{className:"dock__state",children:[h===null?o.jsx(as,{children:"nunca rodou"}):h.running?o.jsxs(as,{tone:"clean",dot:!0,children:["rodando · ",gh(h.startedAt)]}):o.jsxs(as,{dot:!0,children:["saiu ",h.exitCode??"?"," · ",gh(h.finishedAt??h.startedAt)]}),o.jsx("span",{className:"dock__cmd",children:c}),o.jsx("span",{className:"dock__spacer"}),o.jsx("span",{className:"dock__note",children:i.reservedPort===null?"":`porta reservada :${String(i.reservedPort)}`})]}),h!==null&&!h.outputAvailable?o.jsx("div",{className:"dock__idle",children:o.jsx("span",{children:"A saída desta execução não existe mais — ela vivia na memória do daemon, e ele reiniciou desde então."})}):h===null?o.jsx("div",{className:"dock__idle",children:o.jsxs("span",{children:["Este checkout ainda não rodou ",t==="test"?"os testes":`o ${t}`,". O botão está ali em cima."]})}):o.jsx("div",{className:"dock__out",children:o.jsx(Ah,{sessionId:h.sessionId,readOnly:!h.running},h.sessionId)})]})}function YD(e){return["Este checkout ainda não diz ao Lumem como rodar.","",`Escreva a tabela \`[scripts]\` em \`${e}\`, com as quatro fases:`,"","- `setup`: deixa um checkout novo pronto para trabalhar — instalar dependências, preparar banco, o que for. Precisa ser idempetente: rodar de novo não pode estragar nada.","- `run`: sobe a aplicação em primeiro plano (nada de daemon em background). Se ela aceitar porta configurável, use `$LUMEM_RUN_PORT` — é a porta que o Lumem reserva para este checkout, e é o que faz duas worktrees rodarem ao mesmo tempo.","- `test`: roda a suíte de testes do projeto, uma vez e até o fim (nada de modo watch — o rodapé quer um código de saída, não um processo que fica).","- `teardown`: desfaz o que sobrevive ao diretório — container, volume, porta presa. Se não houver nada assim, omita a linha.","","Antes de escrever, **leia o repositório** para descobrir os comandos de verdade: `package.json`, `Makefile`, `docker-compose.yml`, `README`, e o que mais existir. Não invente comando que não está lá; se não achar o de alguma fase, diga isso em vez de chutar.","","Cada valor é uma string só, executada pelo shell de login no diretório do checkout. Preserve o resto do arquivo — ele pode já ter o `id` do projeto dentro, e ele é do time.","","Não commite: eu reviso a mudança."].join(`
|
|
88
|
+
`)}function GD({scope:e,status:t,onAskAgent:i}){const n=We(),c=(Ne({queryKey:["agentConfig","list"],queryFn:()=>ie.agentConfig.list.query()}).data??[]).find(f=>f.transport==="acp")??null,h=He({mutationFn:async()=>{if(c===null)throw new Error("nenhum agente conectado");const f=await ie.session.createAgent.mutate({scopeType:e.scopeType,scopeId:e.scopeId,agentConfigId:c.id});return await n.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)}),f.id},onSuccess:f=>i==null?void 0:i(f,YD(t.file))}),d=j.useMemo(()=>["# o id já está aqui; o que falta é o resto",'id = "prj_…"',"","[scripts]",'setup = "./scripts/setup.sh"','run = "pnpm dev"','test = "pnpm test"','teardown = "./scripts/teardown.sh"'].join(`
|
|
89
|
+
`),[]);return o.jsxs("div",{className:"noscripts",children:[o.jsx("span",{className:"noscripts__t",children:"Este projeto não diz como rodar."}),o.jsxs("p",{className:"noscripts__d",children:["O Lumem lê os comandos de um arquivo ",o.jsx("strong",{children:"do repositório"}),", versionado junto com o código: quem clonar depois herda o mesmo setup, com Lumem ou sem. Enquanto ele não existir, as abas ",o.jsx("code",{children:"Setup"})," e ",o.jsx("code",{children:"Run"})," ficam vazias — o ",o.jsx("code",{children:"Terminal"})," continua funcionando."]}),o.jsx("span",{className:"noscripts__where",children:t.file}),o.jsx("pre",{className:"toml",children:d}),o.jsxs("div",{className:"noscripts__acts",children:[o.jsx(de,{size:"sm",variant:"primary",disabled:c===null||i===void 0||h.isPending,onClick:()=>h.mutate(),children:h.isPending?"abrindo a conversa…":"pedir para o agente criar"}),o.jsx(de,{size:"sm",onClick:()=>{var f;return void((f=navigator.clipboard)==null?void 0:f.writeText(d))},children:"copiar o exemplo"}),c===null&&o.jsx("span",{className:"trust__note",children:"conecte um agente na barra da esquerda para pedir — ou escreva o arquivo à mão"}),h.isError&&o.jsx("span",{className:"trust__note",role:"alert",children:h.error.message})]})]})}function QD({status:e,phase:t,actions:i}){return o.jsxs("div",{className:"trust",children:[o.jsxs("div",{className:"trust__head",children:[o.jsx("span",{className:"trust__glyph",children:"⚠"}),"Este comando vem do repositório, não de você."]}),o.jsx("p",{className:"trust__why",children:"Este projeto foi clonado de uma URL. O que está abaixo estava dentro dele, e vai rodar na sua máquina com as suas permissões."}),o.jsx("div",{className:"trust__cmd",children:e[t].command}),o.jsxs("div",{className:"trust__acts",children:[o.jsx(de,{size:"sm",variant:"primary",disabled:i.trust.isPending,onClick:()=>i.trust.mutate(),children:"confiar neste projeto"}),o.jsx("span",{className:"trust__note",children:"Vale para este projeto nesta máquina — e volta a perguntar se o comando mudar."})]})]})}function ZD({scope:e}){const t=We(),i=x_(e),[n,a]=j.useState(null),c=(i.data??[]).filter(f=>f.kind==="shell"&&f.state==="running"),h=c.find(f=>f.id===n)??c[0]??null;async function d(){const f=await ie.session.createShell.mutate(e);a(f.id),await t.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)})}return h==null?o.jsxs("div",{className:"dock__idle",children:[o.jsx("span",{children:"Nenhum terminal aberto neste checkout."}),o.jsx(de,{size:"sm",onClick:()=>void d(),children:"+ abrir terminal"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"dock__state",children:[o.jsxs(as,{tone:"clean",dot:!0,children:[c.length," viva",c.length>1?"s":""]}),o.jsxs("span",{className:"dock__cmd dock__cmd--dim",children:["cwd ",h.cwd]}),o.jsx("span",{className:"dock__spacer"}),o.jsx("button",{type:"button",className:"dock__new",onClick:()=>void d(),children:"+ outro terminal"})]}),o.jsx("div",{className:"dock__out",children:o.jsx(Ah,{sessionId:h.id},h.id)})]})}function XD({scope:e,status:t,onOpen:i}){var c;const n=((c=t==null?void 0:t.run.last)==null?void 0:c.running)===!0,a=(t==null?void 0:t.port)??null;return o.jsx("div",{className:"dock dock--collapsed","data-testid":"run-dock-folded",children:o.jsxs("div",{className:"dock__folded",children:[o.jsx("button",{type:"button",className:"dock__fold","aria-label":"abrir o rodapé",onClick:i,children:"⌃"}),n?o.jsxs("span",{className:"runmark",children:[o.jsx("span",{className:"runmark__glyph",children:"▶"}),a===null?"run":`run · :${String(a.port)}`]}):o.jsx("span",{children:"setup, run e terminal"}),o.jsx("span",{className:"dock__spacer"}),o.jsx("span",{className:"dock__note",children:e.scopeType==="worktree"?"worktree":"projeto"})]})})}function JD({scope:e,onClose:t,onResize:i,dock:n,onAskAgent:a}){var I,ae,le,H;const c=We(),[h,d]=j.useState("files"),[f,m]=j.useState("worktree"),g=y_(),v=FO(e),b=Rw(e,"worktree"),S=g_("pending"),x=KO(e),C=e.scopeType==="worktree"?e.scopeId:null,k=DO(C,{panelOpen:!0}),N=zO(e),L=qO(x.projectId),D=k.data??null,M=(D==null?void 0:D.pull)??null,Y=D!==null&&C!==null&&!L.isDismissed,Z=h==="pr"&&M===null?"files":h,W=new Map((((I=b.data)==null?void 0:I.files)??[]).map(z=>[z.path,z.status])),ee=g.activeTab===null?null:g.fileFor(g.activeTab);return o.jsxs(CA,{tab:Z,onSelectTab:d,changeCount:((ae=b.data)==null?void 0:ae.files.length)??null,proposalCount:((le=S.data)==null?void 0:le.length)??null,prBar:Y&&C!==null?o.jsx(gA,{status:D,worktreeId:C,onRetry:()=>N.mutate(),onDismiss:L.dismiss}):void 0,prBadge:M===null?null:nA(M),actions:Z==="files"?o.jsx(lA,{edits:v}):void 0,onReload:()=>{c.invalidateQueries({queryKey:["files"]}),c.invalidateQueries({queryKey:["changes"]}),N.mutate()},onClose:t,onResize:i,dock:o.jsx(KD,{scope:e,dock:n,onAskAgent:a}),footLeft:b.isError?"não deu para ler o checkout":void 0,footRight:Z==="changes"?f==="worktree"?"árvore de trabalho vs HEAD":`vs ${((H=b.data)==null?void 0:H.baseBranch)??"base"}`:void 0,children:[Z==="files"&&o.jsx(aA,{scope:e,openPath:(ee==null?void 0:ee.view)==="file"?ee.path:null,onOpen:z=>g.open({path:z,view:"file"}),statusOf:z=>W.get(z),edits:v}),Z==="changes"&&o.jsx($O,{scope:e,openPath:(ee==null?void 0:ee.view)==="patch"?ee.path:null,onOpenPatch:(z,re)=>g.open({path:z,view:"patch",ref:re}),onRefChange:m}),Z==="pr"&&M!==null&&o.jsx(iA,{pull:M,readAt:(D==null?void 0:D.readAt)??null}),Z==="memory"&&o.jsx(Ew,{workspaceId:x.workspaceId,projectId:x.projectId})]})}function e3({projectId:e,projectName:t,open:i,onClose:n,onCreated:a,hasCommits:c=null}){const h=We(),[d,f]=j.useState(""),m=He({mutationFn:()=>ie.worktree.create.mutate({projectId:e,name:d.trim()}),onSuccess:async x=>{await h.invalidateQueries({queryKey:sa(e)}),a(x.id),g()}});function g(){f(""),m.reset(),n()}const v=x=>{x.preventDefault(),d.trim()!==""&&m.mutate()},b=c===!1,S=`worktree-name-${e}`;return o.jsx(dw,{open:i,title:"Nova worktree",where:o.jsxs(o.Fragment,{children:["em",o.jsx(Qe,{tone:"project",children:"■"}),o.jsx("b",{children:t})]}),onClose:g,footer:o.jsxs(o.Fragment,{children:[o.jsx(de,{type:"submit",form:FS,variant:"primary",disabled:m.isPending||d.trim()===""||b,children:m.isPending?"criando…":"criar"}),o.jsx(de,{variant:"ghost",onClick:g,children:b?"fechar":"cancelar"})]}),children:o.jsxs("form",{id:FS,onSubmit:v,children:[o.jsx(Xt,{id:S,label:"Nome da worktree",error:m.isError?m.error.message:void 0,children:o.jsx(cs,{id:S,value:d,onChange:x=>f(x.target.value),placeholder:"teste-prd",invalid:m.isError})}),b?o.jsx(Ae,{tone:"warning",children:"este repositório ainda não tem nenhum commit — faça o primeiro para poder cortar worktrees"}):o.jsx("p",{className:"create-worktree__hint",children:"A branch tem o mesmo nome. Barra vira diretório aninhado."}),m.isPending&&o.jsx(Ae,{tone:"info",children:"copiando o checkout — em repositório grande isto leva alguns segundos"})]})})}const FS="create-worktree",D1=j.createContext(null);function t3({children:e}){const[t,i]=j.useState(new Set),n=j.useCallback((c,h)=>{i(d=>{if(d.has(c)===h)return d;const f=new Set(d);return h?f.add(c):f.delete(c),f})},[]),a=j.useMemo(()=>({isWaiting:c=>t.has(c),countIn:c=>c.filter(h=>t.has(h)).length,setWaiting:n}),[t,n]);return o.jsx(D1.Provider,{value:a,children:e})}function D_(){return j.useContext(D1)??{isWaiting:()=>!1,countIn:()=>0,setWaiting:()=>{}}}function s3(e){const t=x_(e),i=We(),[n,a]=j.useState(null),[c,h]=j.useState(new Set),[d,f]=j.useState(new Set),m=j.useMemo(()=>t.data??[],[t.data]),g=j.useMemo(()=>{const k=m.filter(L=>!d.has(L.id)&&(L.state==="running"||c.has(L.id))),N=new Map;return k.map(L=>{const D=L.agentName??"shell",M=(N.get(D)??0)+1;return N.set(D,M),{sessionId:L.id,label:D,kind:L.kind,state:L.state,exitCode:L.exitCode,command:L.command,transport:L.transport==="acp"?"acp":"pty",agentConfigId:L.agentConfigId,...M>1?{ordinal:M}:{}}})},[m,c,d]);j.useEffect(()=>{n!==null&&!g.some(k=>k.sessionId===n)&&a(null)},[g,n]);const v=j.useCallback(k=>a(k),[]),b=j.useCallback(k=>{const N=m.find(L=>L.id===k);N===void 0||N.state==="running"||(f(L=>new Set(L).add(k)),h(L=>{const D=new Set(L);return D.delete(k),D}))},[m]),S=j.useCallback(k=>{f(N=>{const L=new Set(N);return L.delete(k),L}),h(N=>new Set(N).add(k)),a(k)},[]),x=He({mutationFn:k=>ie.session.resume.mutate({id:k}),onSuccess:async k=>{await i.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)}),a(k.id)}}),C=j.useCallback(k=>x.mutate(k),[x]);return{tabs:g,activeId:n,select:v,close:b,reopen:S,resume:C,resuming:x.isPending?x.variables??null:null,sessions:t}}const i3=800;function KS(e,t){if(e===t)return{added:0,removed:0};const i=e.split(`
|
|
90
|
+
`),n=t.split(`
|
|
91
|
+
`);let a=0;for(;a<i.length&&a<n.length&&i[a]===n[a];)a++;let c=0;for(;c<i.length-a&&c<n.length-a&&i[i.length-1-c]===n[n.length-1-c];)c++;return{added:n.length-a-c,removed:i.length-a-c}}function Wu(e,t){return e.scopeType===t.scopeType&&e.scopeId===t.scopeId&&e.path===t.path}function r3(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function n3(e){return e instanceof Error?e.message:String(e)}function $S(e){return e===void 0||e.kind!=="text"?null:e}function a3({scope:e,path:t,active:i}){const n=We(),a=j.useRef(null),c=j.useRef(null),h=j.useRef({scopeType:e.scopeType,scopeId:e.scopeId,path:t}),d=j.useRef(null),f=j.useRef(0),m=j.useRef(0),g=j.useRef(null),v=j.useRef(!1),b=j.useRef(!1),S=j.useRef(null),x=j.useRef(null),C=j.useRef(!1),k=j.useRef([]),[N,L]=j.useState({kind:"clean"}),[D,M]=j.useState(!0),Y=j.useRef(!0),Z=Ou(e.scopeType,e.scopeId,t),W=Ne({queryKey:Z,queryFn:()=>{const $=n.getQueryData(Z);return!Y.current&&$!==void 0?(C.current=!0,$):ie.files.read.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t})},refetchOnWindowFocus:D}),ee=$S(W.data),I=j.useRef(!1);I.current=ee===null||ee.readOnly!==null;const ae=j.useCallback($=>{Y.current=$,M($)},[]),le=j.useCallback(()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null)},[]),H=j.useCallback($=>{S.current=$,L({kind:"stale",...$})},[]),z=j.useCallback(()=>!v.current&&(g.current===null||b.current),[]),re=j.useCallback(()=>{if(!z())return;const $=k.current;if($.length!==0){k.current=[];for(const ue of $)ue()}},[z]),se=j.useCallback($=>{n.invalidateQueries({queryKey:["changes"]}),n.invalidateQueries({queryKey:a_($.scopeType,$.scopeId,r3($.path))})},[n]),A=j.useCallback(()=>{if(v.current||b.current)return;const $=g.current;$!==null&&(g.current=null,v.current=!0,L({kind:"saving"}),n.cancelQueries({queryKey:Ou($.target.scopeType,$.target.scopeId,$.target.path)}),ie.files.write.mutate({scopeType:$.target.scopeType,scopeId:$.target.scopeId,path:$.target.path,text:$.text,baseRevision:$.baseRevision}).then(ue=>{var _e,Ee;if(!ue.ok){if(!Wu($.target,h.current))return;b.current=!0,le(),H({revision:ue.revision,changedAt:ue.changedAt,base:((_e=c.current)==null?void 0:_e.text)??$.text,mine:((Ee=a.current)==null?void 0:Ee.getDoc())??$.text,disk:null}),ie.files.read.query($.target).then(kt=>{const Xe=$S(kt),Rs=S.current;Xe===null||Rs===null||H({...Rs,disk:Xe})}).catch(()=>{});return}Wu($.target,h.current)&&(c.current={text:$.text,revision:ue.revision},f.current===$.version&&(m.current=$.version,ae(!0)),L({kind:"saved",at:Date.now()})),g.current!==null&&Wu(g.current.target,$.target)&&(g.current={...g.current,baseRevision:ue.revision}),se($.target)}).catch(ue=>{Wu($.target,h.current)&&L({kind:"failed",why:n3(ue)})}).finally(()=>{v.current=!1,A(),re()}))},[le,se,n,re,ae,H]),F=j.useCallback(()=>{le();const $=a.current,ue=c.current,_e=d.current;$===null||ue===null||_e===null||f.current!==m.current&&(g.current={target:_e,text:$.getDoc(),baseRevision:ue.revision,version:f.current},A())},[le,A]),G=j.useCallback(()=>{if(b.current||(F(),z()))return Promise.resolve();const $=new Promise(ue=>{k.current.push(ue)});return HO($),$},[z,F]),Se=j.useCallback(()=>{if(f.current+=1,d.current=h.current,ae(!1),b.current){const $=S.current,ue=a.current;$!==null&&ue!==null&&H({...$,mine:ue.getDoc()});return}le(),x.current=window.setTimeout(()=>{x.current=null,F()},i3)},[le,F,ae,H]),ke=j.useCallback($=>{var ue;if($===null){G(),(ue=a.current)==null||ue.onChange(null),a.current=null;return}a.current=$,!I.current&&$.onChange(Se)},[Se,G]),T=j.useCallback(()=>{F()},[F]),K=j.useCallback(()=>{const $=S.current,ue=d.current;if($===null||ue===null)return;S.current=null,b.current=!1,m.current=f.current,ae(!0),L({kind:"clean"});const _e=Ou(ue.scopeType,ue.scopeId,ue.path);if($.disk===null){n.invalidateQueries({queryKey:_e});return}n.setQueryData(_e,$.disk)},[n,ae]),ne=j.useCallback(()=>{const $=S.current,ue=a.current,_e=d.current;$===null||ue===null||_e===null||(S.current=null,b.current=!1,g.current={target:_e,text:ue.getDoc(),baseRevision:$.revision,version:f.current},A())},[A]);return j.useEffect(()=>{h.current={scopeType:e.scopeType,scopeId:e.scopeId,path:t},d.current=null,m.current=f.current,b.current=!1,S.current=null,c.current=null,ae(!0),L({kind:"clean"})},[e.scopeType,e.scopeId,t,ae]),j.useEffect(()=>{var $;ee!==null&&Y.current&&(c.current={text:ee.text,revision:ee.revision},($=a.current)==null||$.setDoc(ee.text))},[ee]),j.useEffect(()=>{!D||!C.current||(C.current=!1,n.invalidateQueries({queryKey:Ou(e.scopeType,e.scopeId,t)}))},[D,n,e.scopeType,e.scopeId,t]),j.useEffect(()=>{i||G()},[i,G]),j.useEffect(()=>{const $=()=>void G();return window.addEventListener("blur",$),()=>window.removeEventListener("blur",$)},[G]),j.useEffect(()=>le,[le]),{content:W,state:N,attach:ke,retry:T,reload:K,overwrite:ne}}const B1="lumem",l3={name:B1,type:"dark",colors:{"editor.background":Bt["bg/inset"],"editor.foreground":Bt["text/code"]},settings:[{settings:{background:Bt["bg/inset"],foreground:Bt["text/code"]}},{scope:["comment","punctuation.definition.comment","string.comment"],settings:{foreground:Bt["syntax/comment"]}},{scope:["string","string.quoted","constant.other.symbol","meta.embedded.line"],settings:{foreground:Bt["syntax/string"]}},{scope:["constant.numeric","constant.language","constant.character","keyword.other.unit"],settings:{foreground:Bt["syntax/number"]}},{scope:["keyword","storage","storage.type","keyword.operator.new","keyword.control"],settings:{foreground:Bt["syntax/keyword"]}},{scope:["entity.name.function","support.function","meta.function-call","variable.function"],settings:{foreground:Bt["syntax/function"]}},{scope:["entity.name.type","entity.name.class","support.type","support.class","entity.other.inherited-class"],settings:{foreground:Bt["syntax/type"]}},{scope:["punctuation","meta.brace","keyword.operator"],settings:{foreground:Bt["syntax/punctuation"]}},{scope:["markup.heading","entity.name.section"],settings:{foreground:Bt["syntax/keyword"]}},{scope:["markup.inserted"],settings:{foreground:Bt["git/added"]}},{scope:["markup.deleted"],settings:{foreground:Bt["git/removed"]}}]},o3={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",css:"css",html:"html",yml:"yaml",yaml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",py:"python",sql:"sql",toml:"toml",diff:"diff",patch:"diff"},c3={typescript:()=>Ut(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>Ut(()=>import("./tsx-COt5Ahok.js"),[]),javascript:()=>Ut(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>Ut(()=>import("./jsx-g9-lgVsj.js"),[]),json:()=>Ut(()=>import("./json-Cp-IABpG.js"),[]),markdown:()=>Ut(()=>import("./markdown-Cvjx9yec.js"),[]),css:()=>Ut(()=>import("./css-CLj8gQPS.js"),[]),html:()=>Ut(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2])),yaml:()=>Ut(()=>import("./yaml-Buea-lGh.js"),[]),shellscript:()=>Ut(()=>import("./shellscript-Yzrsuije.js"),[]),python:()=>Ut(()=>import("./python-B6aJPvgy.js"),[]),sql:()=>Ut(()=>import("./sql-CRqJ_cUM.js"),[]),toml:()=>Ut(()=>import("./toml-vGWfd6FD.js"),[]),diff:()=>Ut(()=>import("./diff-D97Zzqfu.js"),[]),docker:()=>Ut(()=>import("./docker-BcOcwvcX.js"),[]),make:()=>Ut(()=>import("./make-CHLpvVh8.js"),[])},WS={dockerfile:"docker",makefile:"make"};function u3(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(t in WS)return WS[t];const i=t.lastIndexOf(".");return i<=0?null:o3[t.slice(i+1)]??null}let Vu=null,jm=null;const VS=new Set;async function h3(){if(Vu!==null)return Vu;jm??(jm=d3());try{return Vu=await jm,Vu}catch(e){throw jm=null,e}}async function d3(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([Ut(()=>import("./core-rofTMs1b.js"),[]),Ut(()=>import("./engine-javascript-DBd1bXLz.js"),[])]);return e({themes:[l3],langs:[],engine:t()})}async function f3(e){try{const t=await h3();if(!VS.has(e)){const i=c3[e];if(i===void 0)return null;const n=await i();await t.loadLanguage(n.default),VS.add(e)}return t}catch{return null}}function L1({path:e,headExtra:t,wrap:i,onToggleWrap:n,onClose:a,footLeft:c,footRight:h,children:d}){const f=e.lastIndexOf("/"),m=f===-1?"":e.slice(0,f+1),g=e.slice(f+1);return o.jsxs("div",{className:"viewer",children:[o.jsxs("div",{className:"viewer__head",children:[o.jsxs("span",{className:"fpath",title:e,children:[o.jsx("span",{className:"fpath__dir",children:m}),o.jsx("span",{className:"fpath__name",children:g})]}),t,o.jsx("span",{className:"viewer__spacer"}),o.jsxs("button",{type:"button",className:`rp__icon${i?" rp__icon--on":""}`,"aria-pressed":i,onClick:n,title:"quebrar linhas longas",children:["⇄",o.jsx("span",{className:"sr-only",children:"quebrar linhas longas"})]}),o.jsxs("button",{type:"button",className:"rp__icon",onClick:a,title:"fechar",children:["✕",o.jsx("span",{className:"sr-only",children:"fechar"})]})]}),d,o.jsxs("div",{className:"viewer__foot",children:[c,h===void 0?null:o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"viewer__spacer"}),h]})]})]})}const YS={"inside-git":{chip:"dentro de .git",why:o.jsxs(o.Fragment,{children:["está dentro de ",o.jsx("code",{children:".git"}),": reescrever aqui destrói a worktree e o que ainda não foi commitado."]})},"not-writable":{chip:"sem permissão de escrita",why:o.jsx(o.Fragment,{children:"o daemon não consegue gravar neste arquivo, e a gravação atômica não serve de atalho para o modo que alguém deixou aqui."})},"not-utf8":{chip:"não é UTF-8",why:o.jsx(o.Fragment,{children:"os bytes deste arquivo não voltam iguais depois de uma ida e volta em UTF-8, e gravar trocaria o que não for representável por outra coisa."})}};function m3({scope:e,path:t,active:i,onClose:n}){const[a,c]=j.useState(!0),h=a3({scope:e,path:t,active:i}),d=h.content,f=u3(t),m=d.data,g=m===void 0?null:m.kind==="binary"?"binário":m.kind==="too-large"?"acima do teto":m.readOnly===null?null:YS[m.readOnly].chip,v=g===null&&(h.state.kind==="failed"||h.state.kind==="stale");return o.jsx(L1,{path:t,onClose:n,wrap:a,onToggleWrap:()=>c(S=>!S),footLeft:g===null?o.jsx(g3,{state:h.state,onRetry:h.retry}):o.jsxs("span",{className:"save save--readonly",children:[o.jsx("span",{className:"save__mark","aria-hidden":"true",children:"⊘"}),"somente leitura · ",g]}),footRight:v||m===void 0?void 0:m.kind==="text"?`${Ao(m.bytes)} · ${m.lines} linhas · ${f??"texto"}`:Ao(m.bytes),children:b()});function b(){if(d.isPending)return o.jsx("div",{className:"code",children:"carregando…"});if(d.isError)return o.jsxs("div",{className:"refuse",role:"alert",children:[o.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),o.jsx("span",{className:"refuse__title",children:"não deu para abrir"}),o.jsx("span",{className:"refuse__why",children:d.error.message})]});if(d.data.kind==="binary")return o.jsxs("div",{className:"refuse",children:[o.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),o.jsx("span",{className:"refuse__title",children:"arquivo binário"}),o.jsx("span",{className:"refuse__why",children:"tem bytes nulos nos primeiros KiB — o split não tenta desenhá-lo como texto, e não há buffer para editar."}),o.jsx("span",{className:"refuse__why",children:o.jsx("code",{children:t})})]});if(d.data.kind==="too-large")return o.jsxs("div",{className:"refuse",children:[o.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▤"}),o.jsxs("span",{className:"refuse__title",children:[Ao(d.data.bytes)," passa do teto de ",Ao(d.data.limit)]}),o.jsx("span",{className:"refuse__why",children:"o daemon não leu o arquivo — sem leitura não há revisão, e sem revisão não haveria contra o que gravar."}),o.jsx("span",{className:"refuse__why",children:o.jsx("code",{children:t})})]});const S=d.data.readOnly;return o.jsxs(o.Fragment,{children:[S!==null&&o.jsxs("div",{className:"robar",children:[o.jsx("span",{className:"robar__glyph","aria-hidden":"true",children:"⊘"}),o.jsx("span",{children:YS[S].why})]}),h.state.kind==="stale"&&o.jsx(p3,{conflict:h.state,onReload:h.reload,onOverwrite:h.overwrite}),o.jsx(v3,{path:t,text:d.data.text,language:f,readOnly:S!==null,wrap:a,onReady:h.attach})]})}}function p3({conflict:e,onReload:t,onOverwrite:i}){const n=KS(e.base,e.mine),a=e.disk===null?null:KS(e.base,e.disk.text);return o.jsxs("div",{className:"conflict",role:"alert",children:[o.jsxs("div",{className:"conflict__head",children:[o.jsx("span",{className:"conflict__glyph","aria-hidden":"true",children:"⚠"}),"o agente escreveu este arquivo há ",o.jsx(z1,{at:e.changedAt})]}),o.jsx("p",{className:"conflict__why",children:"O disco não é mais o que você abriu, e o que você digitou ainda não foi para lá."}),o.jsxs("div",{className:"conflict__exits",children:[o.jsxs("button",{type:"button",className:"exit",onClick:t,children:[o.jsx("span",{className:"exit__what",children:"recarregar do disco"}),o.jsxs("span",{className:"exit__cost",children:["perde ",_3(n)]})]}),o.jsxs("button",{type:"button",className:"exit",onClick:i,children:[o.jsx("span",{className:"exit__what",children:"sobrescrever"}),o.jsxs("span",{className:"exit__cost",children:["perde a edição do agente",a===null?"":` (+${a.added} −${a.removed})`]})]})]})]})}function _3(e){const t=e.added>0?"digitou":"apagou",i=e.added>0?e.added:e.removed;return i===0?"nada: o seu texto é igual ao que você abriu":i===1?`a linha que você ${t}`:`as ${i} linhas que você ${t}`}function g3({state:e,onRetry:t}){return e.kind==="clean"?null:e.kind==="saving"?o.jsx(Yu,{tone:"saving",children:"salvando…"}):e.kind==="saved"?o.jsxs(Yu,{tone:"saved",children:["salvo há ",o.jsx(z1,{at:e.at})]}):e.kind==="failed"?o.jsxs(o.Fragment,{children:[o.jsx(Yu,{tone:"failed",children:"não deu para salvar"}),o.jsx("span",{className:"save__why",title:e.why,children:e.why}),o.jsx("button",{type:"button",className:"save__act",onClick:t,children:"tentar de novo"})]}):o.jsxs(o.Fragment,{children:[o.jsx(Yu,{tone:"stale",children:"mudou no disco"}),o.jsx("span",{className:"save__why",children:"o autosave parou até você escolher"})]})}function Yu({tone:e,children:t}){return o.jsxs("span",{className:`save save--${e}`,children:[o.jsx("span",{className:"save__dot","aria-hidden":"true"}),t]})}function z1({at:e}){const[t,i]=j.useState(e);j.useEffect(()=>{i(Date.now());const a=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(a)},[e]);const n=Math.max(0,Math.round((t-e)/1e3));return o.jsx(o.Fragment,{children:n<60?`${n} s`:`${Math.floor(n/60)} min`})}function v3({path:e,text:t,language:i,readOnly:n,wrap:a,onReady:c}){const h=j.useRef(null),d=j.useRef(null),f=j.useRef(null),m=j.useRef({text:t,wrap:a});return j.useEffect(()=>{m.current.text=t},[t]),j.useEffect(()=>{var g;m.current.wrap=a,(g=d.current)==null||g.setWrap(a)},[a]),j.useEffect(()=>{const g=h.current;if(g===null)return;let v=!0;return Ut(async()=>{const{mountEditor:b}=await import("./codemirror-setup-CHk_6JnB.js");return{mountEditor:b}},[]).then(({mountEditor:b})=>{v&&(d.current=b(g,{doc:m.current.text,wrap:m.current.wrap,readOnly:n}),d.current.setHighlight(f.current),c(d.current))}),()=>{var b;v=!1,c(null),(b=d.current)==null||b.destroy(),d.current=null}},[e,n,c]),j.useEffect(()=>{var v;if(f.current=null,(v=d.current)==null||v.setHighlight(null),i===null)return;let g=!0;return f3(i).then(b=>{var S;!g||b===null||(f.current={highlighter:b,language:i,theme:B1},(S=d.current)==null||S.setHighlight(f.current))}),()=>{g=!1}},[i]),o.jsx("div",{className:"cmhost",ref:h,"data-testid":"editor"})}function y3({scopeType:e,scopeId:t,onCreated:i}){const n=We(),a=b_(),c=Ne({queryKey:["agentConfig","list"],queryFn:()=>ie.agentConfig.list.query()}),h=()=>n.invalidateQueries({queryKey:Hi(e,t)}),d=He({mutationFn:()=>ie.session.createShell.mutate({scopeType:e,scopeId:t}),onSuccess:async v=>{await h(),i(v.id)}}),f=He({mutationFn:v=>ie.session.createAgent.mutate({scopeType:e,scopeId:t,agentConfigId:v}),onSuccess:async v=>{a.close(),await h(),i(v.id)}}),m=d.error??f.error,g=c.data??[];return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"new-session",children:[o.jsxs("button",{type:"button",ref:a.triggerRef,className:"tabs-new","aria-haspopup":"menu","aria-expanded":a.open,disabled:f.isPending||d.isPending,onClick:a.toggle,children:[o.jsx("span",{"aria-hidden":"true",children:"+"})," nova sessão"]}),a.open&&o.jsx("div",{className:"new-session__panel",ref:a.panelRef,children:o.jsxs(h_,{label:"nova sessão",children:[o.jsx(hn,{glyph:o.jsx(Qe,{tone:"shell",children:"●"}),hint:"shell de login",onSelect:()=>{a.close(),d.mutate()},children:"shell"}),g.map(v=>o.jsx(hn,{glyph:o.jsx(Qe,{tone:"agent",children:"◆"}),disabled:!v.available||f.isPending,hint:v.available?v.command:"fora do PATH",onSelect:()=>f.mutate(v.id),children:v.name},v.id))]})})]}),m&&o.jsx("div",{className:"new-session__error",children:o.jsx(Ae,{tone:"danger",children:m.message})})]})}function q1({lines:e,wrap:t=!0}){return o.jsx("div",{className:`patch${t?"":" patch--nowrap"}`,children:e.map((i,n)=>i.kind==="hunk"?o.jsx("div",{className:"hunk",children:i.text},n):o.jsxs("div",{className:`dl${i.kind==="add"?" dl--add":i.kind==="del"?" dl--del":""}`,children:[o.jsx("span",{className:"dl__sig","aria-hidden":"true",children:i.kind==="add"?"+":i.kind==="del"?"−":" "}),o.jsx("span",{className:"dl__t",children:i.text})]},n))})}function b3(e,t){const i=GS(e??""),n=GS(t);let a=0;for(;a<i.length&&a<n.length&&i[a]===n[a];)a+=1;let c=0;for(;c<i.length-a&&c<n.length-a&&i[i.length-1-c]===n[n.length-1-c];)c+=1;const h=i.slice(a,i.length-c),d=n.slice(a,n.length-c),f=[];a>0&&f.push({kind:"context",text:`… ${a} linha(s) acima, sem mudança`});for(const m of h)f.push({kind:"del",text:m});for(const m of d)f.push({kind:"add",text:m});return c>0&&f.push({kind:"context",text:`… ${c} linha(s) abaixo, sem mudança`}),f}function GS(e){if(e==="")return[];const t=e.split(`
|
|
92
|
+
`);return t.at(-1)===""&&t.pop(),t}function S3({scope:e,path:t,changeRef:i,onClose:n}){const[a,c]=j.useState(!0),h=Ne({queryKey:xE(e.scopeType,e.scopeId,i,t),queryFn:()=>ie.changes.patch.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:i,path:t}),refetchOnWindowFocus:!0}),d=h.data===void 0?[]:x3(h.data.patch),f=d.filter(g=>g.kind==="hunk").length;return o.jsx(L1,{path:t,onClose:n,wrap:a,onToggleWrap:()=>c(g=>!g),footLeft:i==="worktree"?"não commitado · vs HEAD":"vs base",footRight:f===0?void 0:`${f} ${f===1?"hunk":"hunks"}`,children:m()});function m(){return h.isPending?o.jsx("div",{className:"patch",children:"carregando…"}):h.isError?o.jsxs("div",{className:"refuse",role:"alert",children:[o.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),o.jsx("span",{className:"refuse__title",children:"não deu para ler o diff"}),o.jsx("span",{className:"refuse__why",children:h.error.message})]}):h.data.binary?o.jsxs("div",{className:"refuse",children:[o.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),o.jsx("span",{className:"refuse__title",children:"arquivo binário"}),o.jsx("span",{className:"refuse__why",children:"o git conta linhas, e aqui não há linhas para contar."})]}):d.length===0?o.jsxs("div",{className:"empty",children:[o.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"empty__title",children:"sem diferenças neste arquivo"})]}):o.jsx(q1,{lines:d,wrap:a})}}function x3(e){var n,a;const t=[];let i=!1;for(const c of e.split(`
|
|
93
|
+
`)){if(c.startsWith("@@")){i=!0,t.push({kind:"hunk",text:c});continue}i&&(c.startsWith("\\")||(c.startsWith("+")?t.push({kind:"add",text:c.slice(1)}):c.startsWith("-")?t.push({kind:"del",text:c.slice(1)}):(c!==""||t.length>0)&&t.push({kind:"context",text:c.slice(1)})))}return((n=t.at(-1))==null?void 0:n.kind)==="context"&&((a=t.at(-1))==null?void 0:a.text)===""&&t.pop(),t}function P1(){return{turns:[],pendingPermission:null,streaming:!1,lastStopReason:null,orphanUpdates:0,plan:null,usage:null,mode:"",configOptions:[],modeOwner:"agent",lumemMode:"ask",lumemModeDefault:"ask",commands:[],terminals:[],turnTally:{auto:0,asked:0}}}function w3(e){return e.reduce(H1,P1())}function H1(e,{at:t,event:i}){var n,a,c,h,d;switch(i.type){case"message":return QS(i.role==="user"?C3(e):e,i.role,{kind:"message",messageId:i.messageId,text:i.text});case"thought":return QS(e,"agent",{kind:"thought",messageId:i.messageId,text:i.text});case"tool_call":return Gu(e,"agent",{kind:"tool",call:{toolCallId:i.toolCallId,title:i.title,name:i.name??null,kind:i.kind,status:i.status,locations:i.locations,content:[],elapsedMs:null,added:null,removed:null,verdict:null,verdictBy:"user",verdictReason:null,startedAt:t}});case"tool_call_update":return ZS(e,i.toolCallId,f=>({...f,...i.status?{status:i.status}:{},...i.title?{title:i.title}:{},...i.locations?{locations:i.locations}:{},...i.content?E3(f,i.content):{},elapsedMs:t-f.startedAt}));case"permission_request":{const f={requestId:i.requestId,toolCallId:i.toolCallId,title:i.title,command:i.command??null,cwd:i.cwd,options:i.options,policyReason:i.policyReason},m=Kp(e.turns,g=>g.kind==="permission"?null:g);return Gu({...e,turns:m,pendingPermission:f,turnTally:{...e.turnTally,asked:e.turnTally.asked+1}},"agent",{kind:"permission",request:f})}case"permission_resolved":{const f=k3(e.turns,i.requestId);if(!f)return{...e,orphanUpdates:e.orphanUpdates+1};const m=i.outcome==="cancelled"?null:i.outcome.optionId,g=m===null?null:f.options.find(S=>S.optionId===m)??null,v=Kp(e.turns,S=>S.kind==="permission"&&S.request.requestId===i.requestId?null:S),b={...e,turns:v,pendingPermission:((n=e.pendingPermission)==null?void 0:n.requestId)===i.requestId?null:e.pendingPermission,turnTally:i.by==="lumem"?{auto:e.turnTally.auto+1,asked:Math.max(0,e.turnTally.asked-1)}:e.turnTally};return g?ZS(b,f.toolCallId,S=>({...S,verdict:g,verdictBy:i.by,verdictReason:i.reason})):b}case"plan":return{...e,plan:i.entries};case"plan_removed":return{...e,plan:null};case"usage":{const f=((a=i.cost)==null?void 0:a.amount)??0;return{...e,usage:{used:i.used,size:i.size,cost:i.cost??null,rateLimit:i.rateLimit??null,totalCost:(((c=e.usage)==null?void 0:c.totalCost)??0)+f,currency:((h=i.cost)==null?void 0:h.currency)??((d=e.usage)==null?void 0:d.currency)??null}}}case"config":return{...e,mode:i.mode,configOptions:i.options,modeOwner:i.modeOwner,lumemMode:i.lumemMode,lumemModeDefault:i.lumemModeDefault};case"commands":return{...e,commands:i.commands};case"terminal":{const f=e.terminals.filter(m=>m.terminalId!==i.terminalId);return{...e,terminals:[...f,{terminalId:i.terminalId,ptySessionId:i.ptySessionId,command:i.command}]}}case"turn_end":{const f={...e,streaming:!1,lastStopReason:i.stopReason,turnTally:{auto:0,asked:0}};return e.turnTally.auto===0?f:Gu(f,"agent",{kind:"meta",text:j3(e.turnTally)})}case"resumed":return{...e,turns:[...e.turns,{role:"resumed",blocks:[],at:t,fromSessionId:i.fromSessionId}]};case"memory_core":return{...e,turns:[...e.turns,{role:"agent",blocks:[{kind:"meta",text:`memória do workspace: ${String(i.entries)} ${i.entries===1?"diretriz fixada":"diretrizes fixadas"} · ${i.chars.toLocaleString("pt-BR")} caracteres neste turno`}],at:t}]};case"unknown":return Gu(e,"agent",{kind:"note",text:`evento não reconhecido: ${i.sessionUpdate}`})}}function QS(e,t,i){const n=t==="user"?!0:e.streaming,a=[...e.turns],c=a.at(-1);if((c==null?void 0:c.role)===t){const h=[...c.blocks],d=h.at(-1);return(d==null?void 0:d.kind)===i.kind&&d.messageId===i.messageId?h[h.length-1]={...d,text:d.text+i.text}:h.push(i),a[a.length-1]={...c,blocks:h},{...e,turns:a,streaming:n}}return a.push({role:t,blocks:[i]}),{...e,turns:a,streaming:n}}function C3(e){return{...e,turns:Kp(e.turns,t=>t.kind==="meta"&&t.text.startsWith(I1)?null:t)}}const I1="◈ ";function j3({auto:e,asked:t}){const i=e===1?"1 pedido aprovado":`${e} pedidos aprovados`,n=t===1?"1 subiu para você":`${t} subiram para você`;return`${I1}${i} pelo Lumem, ${n} neste turno`}function Gu(e,t,i){const n=[...e.turns],a=n.at(-1);return(a==null?void 0:a.role)===t?n[n.length-1]={...a,blocks:[...a.blocks,i]}:n.push({role:t,blocks:[i]}),{...e,turns:n}}function ZS(e,t,i){let n=!1;const a=e.turns.map(c=>({...c,blocks:c.blocks.map(h=>h.kind!=="tool"||h.call.toolCallId!==t?h:(n=!0,{...h,call:i(h.call)}))}));return n?{...e,turns:a}:{...e,orphanUpdates:e.orphanUpdates+1}}function Kp(e,t){return e.map(i=>({...i,blocks:i.blocks.flatMap(n=>{const a=t(n);return a?[a]:[]})}))}function k3(e,t){for(const i of e)for(const n of i.blocks)if(n.kind==="permission"&&n.request.requestId===t)return n.request;return null}function E3(e,t){let i=0,n=0,a=!1;for(const c of t){if(c.type!=="diff")continue;a=!0;const h=XS(c.oldText??""),d=XS(c.newText),f=N3(h,d);i+=d.length-f,n+=h.length-f}return{content:t,added:a?i:e.added,removed:a?n:e.removed}}function XS(e){if(e==="")return[];const t=e.split(`
|
|
94
|
+
`);return t.at(-1)===""&&t.pop(),t}function N3(e,t){const i=new Map;for(const a of e)i.set(a,(i.get(a)??0)+1);let n=0;for(const a of t){const c=i.get(a)??0;c>0&&(i.set(a,c-1),n+=1)}return n}const T3=1;function O3(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${X2}?${J2}=${encodeURIComponent(e)}`}function A3(e,t,i={}){const{createWebSocket:n=h=>new WebSocket(h),origin:a=window.location}=i,c=n(O3(e,a));return c.onmessage=h=>{var f;const d=gT(String(h.data));d.ok?t.onMessage(d.message):(f=t.onDecodeError)==null||f.call(t,d.error)},c.onclose=h=>{var d;(d=t.onClose)==null||d.call(t,{code:h.code,clean:h.wasClean,refused:h.code===eT})},c.onerror=()=>{},{send(h){var f,m;const d=mT.safeParse(h);if(!d.success){(f=t.onSendRejected)==null||f.call(t,d.error.issues.map(g=>`${g.path.join(".")||"<root>"}: ${g.message}`).join("; "));return}if(c.readyState!==T3){(m=t.onSendRejected)==null||m.call(t,"o socket não está aberto");return}c.send(vT(d.data))},close(){c.onmessage=null,c.onclose=null,c.onopen=null,c.close()}}}const R3={auto:"auto",plan:"plan",bypassPermissions:"bypass"};function M3({mode:e,options:t,disabled:i=!1,onSwitch:n}){const[a,c]=j.useState(null);return o.jsx(o.Fragment,{children:t.map(h=>{const d=h.id==="mode"?e:h.currentValue,f=D3(h,d);return o.jsxs("span",{className:"config",children:[o.jsxs("button",{type:"button",className:`pill${B3(h,d)} focus-ring`,"aria-haspopup":"menu","aria-expanded":a===h.id,"aria-label":`${h.name}: ${f}`,disabled:i,title:i?"não dá para trocar no meio de um turno":`${h.name}: ${f}`,onClick:()=>c(a===h.id?null:h.id),children:[f,o.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]}),a===h.id&&o.jsx("div",{className:"slash",role:"menu","aria-label":h.name,children:h.choices.map(m=>o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m.value===d,className:`slash__row focus-ring${m.value===d?" slash__row--on":""}${m.value==="bypassPermissions"?" slash__row--danger":""}`,onClick:()=>{c(null),n(h.id,m.value)},children:[o.jsx("span",{className:"slash__cmd",children:m.value}),o.jsx("span",{className:"slash__desc",children:m.description??""})]},m.value))})]},h.id)})})}function D3(e,t){var i;return((i=e.choices.find(n=>n.value===t))==null?void 0:i.name)||t||e.name}function B3(e,t){if(e.id==="mode"){const i=R3[t];return i?` pill--${i}`:""}return e.id==="model"?" pill--model":""}function L3({cwd:e,onCancel:t,onConfirm:i}){const n=j.useRef(null);return j.useEffect(()=>{var a;return(a=n.current)==null?void 0:a.focus()},[]),o.jsxs("div",{className:"gate",role:"dialog","aria-modal":"true","aria-label":"liberar esta sessão",onKeyDown:a=>{a.key==="Escape"&&(a.stopPropagation(),t())},children:[o.jsxs("div",{className:"gate__t",children:[o.jsx("span",{className:"gate__g","aria-hidden":"true",children:"⚠"}),"Liberar esta sessão?"]}),o.jsxs("div",{className:"gate__b",children:["O Lumem vai ",o.jsx("b",{children:"parar de perguntar"})," e responder ",o.jsx("b",{children:"sim"})," a tudo que este agente pedir, até o fim desta conversa."]}),o.jsxs("ul",{className:"gate__list",children:[o.jsx("li",{children:"escrever e apagar arquivos"}),o.jsx("li",{children:"rodar qualquer comando de shell"}),o.jsx("li",{children:o.jsxs("span",{children:["tudo isso dentro de ",o.jsx("span",{className:"gate__scope",children:e})]})})]}),o.jsxs("div",{className:"gate__acts",children:[o.jsxs("button",{type:"button",className:"btn btn--ghost btn--sm focus-ring",ref:n,onClick:t,children:["cancelar ",o.jsx("span",{className:"kbd",children:"esc"})]}),o.jsx("span",{className:"spacer"}),o.jsx("button",{type:"button",className:"btn btn--danger btn--sm focus-ring",onClick:i,children:"liberar esta sessão"})]}),o.jsx("div",{className:"gate__note",children:"Vale só para esta conversa. Uma sessão nova volta a perguntar tudo."})]})}const $p=[{value:"ask",label:"Perguntar tudo",description:"Todo pedido para e espera por você. É o padrão, e nenhuma sessão nasce em outro.",tone:"pill--ask"},{value:"auto",label:"Automático",description:"Leitura de arquivo com caminho dentro do checkout passa sozinha, e aparece na conversa. Escrita e comando ainda perguntam.",tone:"pill--auto"},{value:"free",label:"Liberado",description:"Nada é perguntado dentro da worktree. Pede confirmação antes de valer.",tone:"pill--bypass"}],U1=e=>$p.find(t=>t.value===e)??$p[0];function z3({mode:e,disabled:t=!1,readOnly:i=!1,open:n=!1,onToggle:a}){const c=U1(e);return i?o.jsxs("span",{className:`pill ${c.tone}`,title:"conversa encerrada — o modo em que ela esteve",children:[o.jsx("span",{className:"pill__own","aria-hidden":"true",children:"◈"}),o.jsx("span",{className:"sr-only",children:"regra do Lumem, e a conversa terminou: "}),c.label]}):o.jsxs("button",{type:"button",className:`pill ${c.tone} focus-ring`,"aria-haspopup":"menu","aria-expanded":n,"aria-label":`regra do Lumem: ${c.label}`,disabled:t,title:t?"não dá para trocar no meio de um turno":"regra do Lumem — este agente não oferece modos",onClick:a,children:[o.jsx("span",{className:"pill__own","aria-hidden":"true",children:"◈"}),c.label,o.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]})}function q3({mode:e,workspaceDefault:t,onSwitch:i,onFreeRequested:n}){return o.jsxs("div",{className:"mmenu",role:"menu","aria-label":"regra do Lumem",children:[o.jsxs("div",{className:"mmenu__head",children:[o.jsxs("div",{className:"mmenu__who",children:[o.jsx("span",{"aria-hidden":"true",children:"◈"}),"Regra do Lumem"]}),o.jsxs("div",{className:"mmenu__why",children:["este agente não relatou modos. O que muda aqui é ",o.jsx("b",{children:"o que o daemon responde"})," a um pedido de permissão — o agente não fica sabendo."]})]}),$p.map(a=>o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a.value===e,className:`mopt focus-ring${a.value===e?" mopt--on":""}${a.value==="auto"?" mopt--auto":""}${a.value==="free"?" mopt--free":""}`,onClick:()=>{if(a.value==="free"){n();return}i(a.value)},children:[o.jsxs("span",{className:"mopt__t",children:[a.label,a.value===e&&o.jsx("span",{className:"mopt__mark","aria-hidden":"true",children:"✓"})]}),o.jsx("span",{className:"mopt__d",children:a.description})]},a.value)),o.jsxs("div",{className:"mmenu__foot",children:["padrão do workspace: ",o.jsx("b",{children:U1(t).label.toLowerCase()})]})]})}const Wp=/^\s{0,3}(?:```|~~~)\s*([\w+-]*)\s*$/,F1=/^\s{0,3}(#{1,6})\s+(.*)$/,K1=/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/,Vp=/^\s{0,3}>\s?(.*)$/,B_=/^(\s*)[-*+]\s+(.*)$/,Ch=/^(\s*)\d{1,9}[.)]\s+(.*)$/,jh=/^\s{0,3}\|(.+)\|\s*$/,P3=/^\s{0,3}\|[\s:|-]+\|\s*$/;function H3(e){const t=e.replace(/\r\n?/g,`
|
|
95
|
+
`).split(`
|
|
96
|
+
`),i=[];let n=0;for(;n<t.length;){const a=t[n];if(a.trim()===""){n+=1;continue}const c=Wp.exec(a);if(c){const f=c[1]===""?null:c[1],m=[];for(n+=1;n<t.length&&!Wp.test(t[n]);)m.push(t[n]),n+=1;n<t.length&&(n+=1),i.push({kind:"code",language:f,text:m.join(`
|
|
97
|
+
`)});continue}const h=F1.exec(a);if(h){i.push({kind:"heading",level:h[1].length,content:Li(h[2].trim())}),n+=1;continue}if(K1.test(a)){i.push({kind:"rule"}),n+=1;continue}if(Vp.test(a)){const f=[];for(;n<t.length;){const m=Vp.exec(t[n]);if(!m)break;f.push(m[1]),n+=1}i.push({kind:"quote",content:Li(f.join(`
|
|
98
|
+
`))});continue}if(jh.test(a)&&n+1<t.length&&P3.test(t[n+1])){const f=JS(a);n+=2;const m=[];for(;n<t.length&&jh.test(t[n]);)m.push(JS(t[n])),n+=1;i.push({kind:"table",header:f,rows:m});continue}if(B_.test(a)||Ch.test(a)){const f=Ch.test(a),{items:m,next:g}=U3(t,n,f);i.push({kind:"list",ordered:f,items:m}),n=g;continue}const d=[t[n].trim()];for(n+=1;n<t.length;){const f=t[n];if(f.trim()===""||I3(f))break;d.push(f.trim()),n+=1}i.push({kind:"paragraph",content:Li(d.join(`
|
|
99
|
+
`))})}return i}function I3(e){return Wp.test(e)||F1.test(e)||K1.test(e)||Vp.test(e)||B_.test(e)||Ch.test(e)||jh.test(e)}function JS(e){return jh.exec(e)[1].split("|").map(i=>Li(i.trim()))}function U3(e,t,i){const n=[];let a=t,c=null;for(;a<e.length;){const h=e[a];if(h.trim()===""){if(a+1<e.length&&ex(e[a+1])!==null){a+=1;continue}break}const d=ex(h);if(d===null||d.ordered!==i&&d.indent===(c??d.indent))break;if(c??(c=d.indent),d.indent>c){const f=n[n.length-1];if(f===void 0)break;f.children.push({content:Li(d.text),children:[]})}else n.push({content:Li(d.text),children:[]});a+=1}return{items:n,next:a}}function ex(e){const t=B_.exec(e);if(t)return{indent:t[1].length,text:t[2],ordered:!1};const i=Ch.exec(e);return i?{indent:i[1].length,text:i[2],ordered:!0}:null}function Li(e){const t=[];let i="";const n=()=>{if(i!==""){for(const[c,h]of i.split(`
|
|
100
|
+
`).entries())c>0&&t.push({kind:"break"}),h!==""&&t.push({kind:"text",text:h});i=""}};let a=0;for(;a<e.length;){const c=e.slice(a),h=/^(`+)([\s\S]*?)\1(?!`)/.exec(c);if(h){n(),t.push({kind:"code",text:h[2].trim()}),a+=h[0].length;continue}const d=/^\[([^\]]*)\]\(([^\s)]+)\)/.exec(c);if(d){n(),t.push({kind:"link",href:d[2],children:Li(d[1])}),a+=d[0].length;continue}const f=/^(\*\*|__)(?=\S)([\s\S]*?\S)\1/.exec(c);if(f){n(),t.push({kind:"strong",children:Li(f[2])}),a+=f[0].length;continue}const m=/^~~(?=\S)([\s\S]*?\S)~~/.exec(c);if(m){n(),t.push({kind:"strike",children:Li(m[1])}),a+=m[0].length;continue}const g=/^(\*)(?=\S)([\s\S]*?\S)\1|^(_)(?=\S)([\s\S]*?\S)\3(?![\w])/.exec(c);if(g&&(g[1]==="*"||a===0||/[^\w]/.test(e[a-1]))){n(),t.push({kind:"em",children:Li(g[2]??g[4])}),a+=g[0].length;continue}i+=e[a],a+=1}return n(),t}function $1({text:e,streaming:t=!1}){const i=H3(e),n=i.length-1,a=o.jsx("span",{className:"mcaret","aria-hidden":"true"});return i.length===0?t?o.jsx("p",{children:a}):null:o.jsx(o.Fragment,{children:i.map((c,h)=>o.jsx(j.Fragment,{children:F3(c,t&&h===n?a:null)},h))})}function F3(e,t){switch(e.kind){case"paragraph":return o.jsxs("p",{children:[o.jsx(Di,{nodes:e.content}),t]});case"heading":{const i=`h${String(Math.min(e.level,6))}`;return o.jsxs(i,{children:[o.jsx(Di,{nodes:e.content}),t]})}case"code":return o.jsxs(o.Fragment,{children:[o.jsx("pre",{children:o.jsx("code",{...e.language===null?{}:{"data-language":e.language},children:e.text})}),t]});case"quote":return o.jsxs("blockquote",{children:[o.jsx(Di,{nodes:e.content}),t]});case"list":{const i=e.ordered?"ol":"ul";return o.jsxs(o.Fragment,{children:[o.jsx(i,{children:e.items.map((n,a)=>o.jsx(W1,{item:n,ordered:e.ordered},a))}),t]})}case"table":return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"table-scroll",children:o.jsxs("table",{children:[o.jsx("thead",{children:o.jsx("tr",{children:e.header.map((i,n)=>o.jsx("th",{children:o.jsx(Di,{nodes:i})},n))})}),o.jsx("tbody",{children:e.rows.map((i,n)=>o.jsx("tr",{children:i.map((a,c)=>o.jsx("td",{children:o.jsx(Di,{nodes:a})},c))},n))})]})}),t]});case"rule":return o.jsxs(o.Fragment,{children:[o.jsx("hr",{}),t]})}}function W1({item:e,ordered:t}){const i=t?"ol":"ul";return o.jsxs("li",{children:[o.jsx(Di,{nodes:e.content}),e.children.length>0&&o.jsx(i,{children:e.children.map((n,a)=>o.jsx(W1,{item:n,ordered:t},a))})]})}function Di({nodes:e}){return o.jsx(o.Fragment,{children:e.map((t,i)=>o.jsx(j.Fragment,{children:K3(t)},i))})}function K3(e){switch(e.kind){case"text":return e.text;case"code":return o.jsx("code",{children:e.text});case"strong":return o.jsx("strong",{children:o.jsx(Di,{nodes:e.children})});case"em":return o.jsx("em",{children:o.jsx(Di,{nodes:e.children})});case"strike":return o.jsx("del",{children:o.jsx(Di,{nodes:e.children})});case"link":return o.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:o.jsx(Di,{nodes:e.children})});case"break":return o.jsx("br",{})}}function $3({role:e,children:t}){return o.jsxs("div",{className:`turn turn--${e}`,children:[o.jsx("span",{className:"turn__g",children:o.jsx(Qe,{tone:e==="agent"?"agent":"none",children:e==="agent"?"◆":"❯"})}),o.jsx("div",{className:"turn__b",children:t})]})}function W3({text:e,streaming:t=!1}){return o.jsx("div",{className:"msg",children:o.jsx($1,{text:e,streaming:t})})}function V3({text:e,open:t,onToggle:i,streaming:n=!1}){const a=n?"pensando…":"pensou";return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"thought focus-ring","aria-expanded":t,onClick:i,children:[o.jsx("span",{className:"thought__twist","aria-hidden":"true",children:t?"▾":"▸"}),a,!t&&e!==""&&o.jsxs("span",{className:"thought__peek",children:["· ",e]})]}),t&&o.jsx("div",{className:"thought__text",children:o.jsx($1,{text:e,streaming:n})})]})}function Y3({request:e,onRespond:t}){const[i,n]=j.useState(!1),a=j.useRef(null),c=km(e.options,"allow_once")??e.options[0],h=km(e.options,"reject_once"),d=km(e.options,"reject_always"),f=e.options.filter(g=>g!==c&&g!==h&&g!==d),m=g=>{i||(n(!0),t(g))};return j.useEffect(()=>{var g;(g=a.current)==null||g.focus()},[e.requestId]),j.useEffect(()=>{const g=v=>{if(v.key==="Enter"&&!v.shiftKey){v.preventDefault(),m(c.optionId);return}v.key==="Escape"&&h&&(v.preventDefault(),m(h.optionId))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)}),o.jsxs("div",{className:"perm",role:"group","aria-label":"pedido de permissão",children:[o.jsxs("div",{className:"perm__head",children:[o.jsx("span",{className:"perm__glyph","aria-hidden":"true",children:"⚠"}),"Permissão",o.jsx("span",{className:"spacer"}),o.jsx("span",{className:"kbd",children:i?"enviado":"o turno está parado aqui"})]}),o.jsxs("div",{className:"perm__body",children:[o.jsxs("div",{className:"perm__what",children:[o.jsx("div",{className:"perm__cmd",children:e.command??e.title}),o.jsxs("div",{className:"perm__where",children:["cwd ",e.cwd]})]}),e.policyReason!==null&&o.jsx("div",{className:"perm__why",children:e.policyReason}),o.jsxs("div",{className:"perm__opts",children:[o.jsxs(de,{ref:a,variant:"primary",size:"sm",disabled:i,onClick:()=>m(c.optionId),children:[c.name," ",o.jsx("span",{className:"kbd",children:"⏎"})]}),f.map(g=>o.jsx(de,{variant:"ghost",size:"sm",disabled:i,onClick:()=>m(g.optionId),children:g.name},g.optionId)),h&&o.jsxs(de,{variant:"ghost",size:"sm",disabled:i,onClick:()=>m(h.optionId),children:[h.name," ",o.jsx("span",{className:"kbd",children:"esc"})]}),d&&o.jsx(de,{variant:"danger",size:"sm",disabled:i,onClick:()=>m(d.optionId),children:d.name})]})]})]})}function km(e,t){return e.find(i=>i.kind===t)}const V1="lumem.coach.permission";function G3(){try{return window.localStorage.getItem(V1)==="seen"}catch{return!1}}function Q3(){try{window.localStorage.setItem(V1,"seen")}catch{}}function Z3(e){const[t,i]=j.useState(G3),[n,a]=j.useState(!1),c=j.useCallback(()=>a(!0),[]),h=j.useCallback(()=>{Q3(),i(!0)},[]);return{show:e&&!t&&!n,dismiss:c,never:h}}const X3={pending:"○",in_progress:"◐",completed:"✓"},J3={pending:"pending",in_progress:"active",completed:"done"};function e5({entries:e,defaultOpen:t=!1}){const i=e.filter(d=>d.status==="completed").length,n=e.length>0&&i===e.length,[a,c]=j.useState(t),h=!n||a;return o.jsxs("div",{className:"plan",children:[o.jsxs("div",{className:"plan__head",children:[o.jsx("span",{className:`plan__glyph${n?" plan__glyph--done":""}`,"aria-hidden":"true",children:n?"✓":"☰"}),"Plano",o.jsx("span",{className:"spacer"}),o.jsxs("span",{className:"plan__count",children:[i," de ",e.length]}),n&&o.jsx("button",{type:"button",className:"tc__twist focus-ring","aria-expanded":a,"aria-label":a?"esconder os passos":"mostrar os passos",onClick:()=>c(!a),children:a?"▾":"▸"})]}),h&&e.map((d,f)=>o.jsxs("div",{className:`plan__row plan__row--${J3[d.status]}`,children:[o.jsx("span",{className:"plan__mark","aria-hidden":"true",children:X3[d.status]}),o.jsx("span",{className:"plan__what",children:d.content}),d.status==="in_progress"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"spacer"}),o.jsx("span",{className:"plan__now",children:"agora"})]})]},f))]})}function t5(e){const t=/^\/([^\s]*)$/.exec(e);return t?t[1]:null}function Y1(e,t){if(t==="")return e;const i=t.toLowerCase();return e.filter(n=>n.name.toLowerCase().startsWith(i))}function s5({commands:e,query:t,onChoose:i,onDismiss:n}){const a=Y1(e,t),[c,h]=j.useState(0);j.useEffect(()=>h(0),[t,e]),j.useEffect(()=>{const f=m=>{if(a.length!==0){if(m.key==="ArrowDown"){m.preventDefault(),h(g=>(g+1)%a.length);return}if(m.key==="ArrowUp"){m.preventDefault(),h(g=>(g-1+a.length)%a.length);return}if(m.key==="Enter"&&!m.metaKey&&!m.ctrlKey){m.preventDefault(),m.stopPropagation(),d(a[c]);return}m.key==="Escape"&&(m.preventDefault(),n())}};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)});function d(f){i(`/${f.name}${f.takesInput?" ":""}`)}return a.length===0?null:o.jsx("div",{className:"slash",role:"listbox","aria-label":"comandos do agente",children:a.map((f,m)=>o.jsxs("button",{type:"button",role:"option","aria-selected":m===c,className:`slash__row focus-ring${m===c?" slash__row--on":""}`,onMouseDown:g=>{g.preventDefault(),d(f)},children:[o.jsxs("span",{className:"slash__cmd",children:["/",f.name]}),o.jsx("span",{className:"slash__desc",children:f.description})]},f.name))})}const i5={read:"▤",search:"▤",edit:"▣",delete:"▣",move:"▣",execute:"❯",fetch:"↓",think:"◈",switch_mode:"◈",other:"◈"},r5={pending:"na fila",running:"rodando",ok:"ok",failed:"falhou",cancelled:"interrompido"},n5=12;function a5({call:e,terminals:t=[],defaultOpen:i=!1}){const[n,a]=j.useState(i),c=l5(e),h=c5(e),d=o5(e,t);return o.jsxs("div",{className:`tc tc--${e.status}`,children:[o.jsxs("div",{className:"tc__head",children:[o.jsx("span",{className:"tc__glyph","aria-hidden":"true",children:i5[e.kind]}),o.jsx("span",{className:"tc__verb",children:e.name??h5(e.title)}),h?o.jsxs("span",{className:"tc__target",title:h.full,children:[o.jsx("span",{className:"tc__dir",children:h.dir}),o.jsx("span",{className:"tc__name",children:h.name})]}):o.jsx("span",{className:"tc__arg",title:e.title,children:u5(e)}),e.verdict&&o.jsx("span",{className:`verdict verdict--${e.verdictBy==="lumem"?"lumem":e.verdict.kind.startsWith("allow")?"allowed":"denied"}`,children:e.verdictBy==="lumem"?o.jsxs(o.Fragment,{children:[o.jsx("span",{"aria-hidden":"true",children:"◈"})," o Lumem aprovou"]}):o.jsxs(o.Fragment,{children:[e.verdict.kind.startsWith("allow")?"✓":"✕"," ",e.verdict.name]})}),(e.added!==null||e.removed!==null)&&o.jsxs("span",{className:"tc__delta",children:[e.added?o.jsxs("span",{className:"plus",children:["+",e.added]}):null,e.added&&e.removed?" ":null,e.removed?o.jsxs("span",{className:"minus",children:["−",e.removed]}):null]}),e.elapsedMs!==null&&o.jsx("span",{className:"tc__time",children:d5(e.elapsedMs)}),o.jsxs("span",{className:"tc__st",children:[o.jsx("span",{className:"tc__dot","aria-hidden":"true"}),r5[e.status]]}),(c||d)&&o.jsx("button",{type:"button",className:"tc__twist focus-ring","aria-expanded":n,"aria-label":n?"esconder o resultado":"mostrar o resultado",onClick:()=>a(!n),children:n?"▾":"▸"})]}),e.verdictBy==="lumem"&&e.verdictReason!==null&&o.jsx("div",{className:"tc__why",children:e.verdictReason}),n&&d&&o.jsx("div",{className:"tc__body",children:o.jsx("div",{className:"tc__term",children:o.jsx(Ah,{sessionId:d.ptySessionId})})}),n&&!d&&c&&o.jsxs("div",{className:"tc__body",children:[c.kind==="diff"?o.jsx(q1,{lines:c.lines,wrap:!1}):o.jsx("div",{className:"out",children:c.lines.map((f,m)=>o.jsx("span",{className:"l",children:f},m))}),c.hidden>0&&o.jsxs("div",{className:"tc__more",children:["▾ mostrar as ",c.hidden.toLocaleString("pt-BR")," linhas"]})]})]})}function l5(e){const t=e.content.find(c=>c.type==="diff");if((t==null?void 0:t.type)==="diff")return{kind:"diff",lines:b3(t.oldText,t.newText),hidden:0};const i=e.content.filter(c=>c.type==="content").map(c=>c.text).join("");if(i==="")return null;const n=i.split(`
|
|
101
|
+
`),a=n.slice(Math.max(0,n.length-n5));return{kind:"text",lines:a,hidden:n.length-a.length}}function o5(e,t){const i=e.content.find(n=>n.type==="terminal");return(i==null?void 0:i.type)!=="terminal"?null:t.find(n=>n.terminalId===i.terminalId)??null}function c5(e){const t=e.locations[0];if(!t)return null;const i=t.path.lastIndexOf("/");return i===-1?{dir:"",name:t.path,full:t.path}:{dir:t.path.slice(0,i+1),name:t.path.slice(i+1),full:t.path}}function u5(e){const t=e.name;return t&&e.title.startsWith(`${t} `)?e.title.slice(t.length+1):e.title}function h5(e){const t=e.indexOf(" ");return t===-1?e:e.slice(0,t)}function d5(e){if(e<1e3)return`${e} ms`;const t=e/1e3;if(t<60)return`${t.toFixed(1).replace(".",",")} s`;const i=Math.floor(t/60),n=Math.round(t-i*60);return n===0?`${i} min`:`${i} min ${n} s`}const G1={conversation:P1(),session:null,failure:null};function f5(e,t){if(t.kind==="reset")return G1;const i=t.message;switch(i.type){case"attached":return{conversation:{...w3(i.transcript),mode:i.mode,configOptions:i.configOptions,modeOwner:i.modeOwner,lumemMode:i.lumemMode,lumemModeDefault:i.lumemModeDefault},session:{acpSessionId:i.acpSessionId,model:i.model,mode:i.mode,state:i.state,cwd:i.cwd},failure:null};case"event":return{...e,conversation:H1(e.conversation,{at:i.at,event:i.event})};case"error":return{...e,failure:{message:i.message,remedy:i.remedy??null,fatal:i.code==="ADAPTER_UNAVAILABLE"||i.code==="SESSION_NOT_FOUND"}}}}const m5=e=>ie.session.transcript.query({id:e});function p5({sessionId:e,agentName:t="agente",live:i=!0,connect:n=A3,load:a=m5,onResume:c,resuming:h=!1,active:d=!0,initialPrompt:f}){const[m,g]=j.useReducer(f5,G1),[v,b]=j.useState(""),[S,x]=j.useState(!1),[C,k]=j.useState(!1),[N,L]=j.useState(new Set),D=j.useRef(null),M=D_(),{conversation:Y,session:Z,failure:W}=m,ee=Y.pendingPermission,I=Z3(ee!==null),ae=!i||(Z==null?void 0:Z.state)==="exited";j.useEffect(()=>{if(g({kind:"reset"}),!i){let K=!0;return a(e).then(ne=>{K&&g({kind:"message",message:ne})}).catch(ne=>{K&&g({kind:"message",message:{type:"error",code:"INTERNAL",message:ne instanceof Error?ne.message:"não deu para ler a conversa"}})}),()=>{K=!1}}const T=n(e,{onMessage:K=>g({kind:"message",message:K})});return D.current=T,()=>{D.current=null,T.close()}},[e,i,n,a]),j.useEffect(()=>{M.setWaiting(e,ee!==null)},[M,e,ee]);const le=j.useRef(M.setWaiting);le.current=M.setWaiting,j.useEffect(()=>()=>{le.current(e,!1)},[e]);const H=Z!==null,z=!Y.streaming&&H;j.useEffect(()=>{z||(k(!1),x(!1))},[z]);const re=j.useCallback(()=>{var K;const T=v.trim();T===""||ee!==null||ae||!H||((K=D.current)==null||K.send({type:"prompt",text:T}),b(""))},[H,v,ee,ae]),se=j.useRef(!1);j.useEffect(()=>{var T;f===void 0||se.current||!H||ae||(se.current=!0,(T=D.current)==null||T.send({type:"prompt",text:f}))},[H,f,ae]);const A=t5(v),F=j.useCallback(()=>{var T;(T=D.current)==null||T.send({type:"cancel"})},[]),G=Y.streaming,Se=A!==null&&Y1(Y.commands,A).length>0;j.useEffect(()=>{if(!d||ae||!G||ee!==null||Se)return;const T=K=>{K.key==="Escape"&&(K.preventDefault(),F())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[d,ae,G,ee,Se,F]);const ke=b5([Y.turns.length,Y.streaming]);return o.jsxs("div",{className:"conv",children:[o.jsxs("div",{className:"conv__head",children:[o.jsxs("span",{className:"conv__who",children:[o.jsx(Qe,{tone:"agent",children:"◆"}),t]}),Z&&o.jsxs("span",{className:"conv__adapter",children:["sessão ",Z.acpSessionId.slice(0,8)," · ",Z.model," · ",Z.mode]}),o.jsx("span",{className:"spacer"}),ae&&c&&o.jsx(de,{variant:"primary",size:"sm",disabled:h,onClick:c,children:h?"retomando…":"↻ retomar"}),Y.streaming&&!ae&&o.jsxs(de,{variant:"ghost",size:"sm",onClick:F,children:["■ interromper ",o.jsx("span",{className:"kbd",children:"esc"})]})]}),o.jsxs("div",{className:"conv__scroll",ref:ke,children:[(W==null?void 0:W.fatal)&&o.jsxs("div",{className:"fail",children:[o.jsxs("div",{className:"fail__title",children:[o.jsx("span",{"aria-hidden":"true",children:"⚠"}),W.remedy?"o adaptador ACP não subiu":"a sessão não está disponível"]}),o.jsx("div",{className:"fail__body",children:W.message}),W.remedy&&o.jsx("div",{className:"fail__cmd",children:W.remedy})]}),W&&!W.fatal&&o.jsx(Ae,{tone:"danger",children:W.message}),Y.turns.length===0&&!W&&o.jsx(y5,{ready:Z!==null}),Y.plan&&o.jsx(e5,{entries:Y.plan}),Y.turns.map((T,K)=>T.role==="resumed"?o.jsx(_5,{at:T.at??null},K):o.jsx($3,{role:T.role,children:T.blocks.map((ne,$)=>o.jsx(v5,{block:ne,terminals:Y.terminals,streaming:Y.streaming&&K===Y.turns.length-1&&$===T.blocks.length-1,openThoughts:N,onToggleThought:ue=>L(_e=>{const Ee=new Set(_e);return Ee.has(ue)?Ee.delete(ue):Ee.add(ue),Ee}),onRespond:ue=>{var Ee;const _e=Y.pendingPermission;_e&&((Ee=D.current)==null||Ee.send({type:"permission_response",requestId:_e.requestId,optionId:ue}))},coach:I},$))},K)),ae&&Z&&o.jsx("div",{className:"daysep",children:"conversa encerrada"})]}),Y.usage&&o.jsx(kO,{usage:Y.usage}),o.jsxs("div",{className:"composer",children:[Y.modeOwner==="lumem"&&C&&z&&o.jsx(q3,{mode:Y.lumemMode,workspaceDefault:Y.lumemModeDefault,onSwitch:T=>{var K;k(!1),(K=D.current)==null||K.send({type:"set_lumem_mode",mode:T})},onFreeRequested:()=>{k(!1),x(!0)}}),S&&z&&o.jsx(L3,{cwd:(Z==null?void 0:Z.cwd)??"",onCancel:()=>x(!1),onConfirm:()=>{var T;x(!1),(T=D.current)==null||T.send({type:"set_lumem_mode",mode:"free"})}}),o.jsxs("div",{className:"composer__box",children:[A!==null&&o.jsx(s5,{commands:Y.commands,query:A,onChoose:b,onDismiss:()=>b("")}),o.jsx("textarea",{className:`composer__in${v===""?" composer__in--empty":""}`,value:v,disabled:ee!==null||ae,placeholder:ae?"esta conversa terminou — retome para continuar":ee!==null?"responda o pedido de permissão para continuar":"escreva, ou / para comandos","aria-label":"mensagem para o agente",onChange:T=>b(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.shiftKey||T.nativeEvent.isComposing||(T.preventDefault(),re()))}}),o.jsxs("div",{className:"composer__bar",children:[Y.modeOwner==="lumem"&&o.jsx(z3,{mode:Y.lumemMode,disabled:!z,readOnly:ae,open:C,onToggle:()=>k(!C)}),o.jsx(M3,{mode:Y.mode,options:Y.configOptions,disabled:Y.streaming||ae,onSwitch:(T,K)=>{var ne;return(ne=D.current)==null?void 0:ne.send({type:"set_config",optionId:T,value:K})}}),o.jsx("span",{className:"spacer"}),o.jsxs(de,{variant:"primary",size:"sm",disabled:v.trim()===""||ee!==null||ae||!H,onClick:re,children:["enviar ",o.jsx("span",{className:"kbd",children:"⏎"})]})]})]})]})]})}function _5({at:e}){return o.jsxs("div",{className:"daysep",children:["retomada",e===null?"":` · ${g5(e)}`]})}function g5(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}function v5({block:e,terminals:t,streaming:i,openThoughts:n,onToggleThought:a,onRespond:c,coach:h}){switch(e.kind){case"message":return o.jsx(W3,{text:e.text,streaming:i});case"thought":return o.jsx(V3,{text:e.text,open:n.has(e.messageId),onToggle:()=>a(e.messageId),streaming:i});case"tool":return o.jsx(a5,{call:e.call,terminals:t});case"permission":return o.jsxs(o.Fragment,{children:[o.jsx(Y3,{request:e.request,onRespond:c}),h.show&&o.jsxs(f2,{title:"a primeira vez que isso aparece",onUnderstood:h.dismiss,onNever:h.never,children:["É assim que o Lumem te mantém no controle: o modo ",o.jsx("b",{children:"Auto"})," resolve sozinho o que é leitura e escrita dentro desta worktree, e para em tudo que sai disso — rede, comando global, arquivo fora dela. Para ver o plano antes de qualquer execução, troque para"," ",o.jsx("b",{children:"Plano"})," na barra acima."]})]});case"note":return o.jsx("div",{className:"unknown",children:e.text});case"meta":return o.jsx("div",{className:"meta",children:e.text})}}function y5({ready:e}){return o.jsxs("div",{className:"empty",children:[o.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"◆"}),o.jsx("span",{className:"empty__title",children:e?"sessão aberta, nada pedido ainda":"conectando…"}),e&&o.jsxs("span",{className:"empty__sub",children:["O adaptador subiu e o handshake passou sem consumir nada. O primeiro turno já entra com"," ",o.jsx("b",{children:"39,2k"})," de contexto — system prompt e ferramentas do próprio Claude Code, não do Lumem."]})]})}function b5(e){const t=j.useRef(null),i=j.useRef(!0),n=j.useCallback(a=>{if(t.current=a,!a)return;const c=()=>{i.current=a.scrollHeight-a.scrollTop-a.clientHeight<24};a.addEventListener("scroll",c)},[]);return j.useEffect(()=>{const a=t.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},e),n}const S5=.2,x5=.8;function Q1({children:e,viewer:t}){const[i,n]=j.useState(.5),a=j.useRef(null),[c,h]=j.useState(!1),d=j.useCallback(f=>{var v;const m=(v=a.current)==null?void 0:v.getBoundingClientRect();if(m===void 0||m.width===0||!Number.isFinite(f))return;const g=(f-m.left)/m.width;n(Math.min(x5,Math.max(S5,g)))},[]);return j.useEffect(()=>{if(!c)return;const f=g=>{g.preventDefault(),d(g.clientX)},m=()=>h(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",m),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",m)}},[c,d]),t===null?o.jsx(o.Fragment,{children:e}):o.jsxs("div",{className:"split",ref:a,children:[o.jsx("div",{className:"split__side split__side--term",style:{flexGrow:i},children:e}),o.jsx("span",{className:"split__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura do arquivo aberto",onPointerDown:f=>{f.preventDefault(),h(!0)}}),o.jsx("div",{className:"split__side split__side--viewer",style:{flexGrow:1-i},children:t})]})}function w5({tab:e,scope:t,cwd:i,active:n,viewer:a=null,onResume:c,resuming:h=!1,onStarted:d,initialPrompt:f}){const m=e.kind==="agent",g=e.transport==="acp",v=!g&&e.state!=="running";return o.jsx("div",{className:`pane ${g?"pane--conv":"pane--term"}`,role:"tabpanel",hidden:!n,"aria-label":v?`registro de ${e.label}`:`sessão ${e.label}`,children:o.jsxs(Q1,{viewer:a,children:[!g&&o.jsxs("div",{className:"term-head",children:[o.jsx(Qe,{tone:m?"agent":"shell",children:m?"◆":"●"}),o.jsxs("span",{className:"term-head__cmd",title:`${e.command} · cwd ${i}`,children:[e.command," ",o.jsxs("span",{className:"dim",children:["· cwd ",i]})]}),v?o.jsxs(o.Fragment,{children:[o.jsx(as,{tone:"neutral",children:"registro"}),o.jsxs(as,{tone:e.exitCode===0?"exited":"failed",dot:!0,children:["exited (",e.exitCode??"?",")"]})]}):o.jsx(as,{tone:"running",dot:!0,children:"running"})]}),v&&o.jsx(C5,{tab:e,scope:t,onStarted:d}),g?o.jsx(p5,{sessionId:e.sessionId,agentName:e.label,live:e.state==="running",active:n,...c?{onResume:c}:{},resuming:h,initialPrompt:f},e.sessionId):o.jsx(Ah,{sessionId:e.sessionId,readOnly:v},e.sessionId)]})})}function C5({tab:e,scope:t,onStarted:i}){const n=We(),a=He({mutationFn:()=>e.agentConfigId===null?ie.session.createShell.mutate(t):ie.session.createAgent.mutate({...t,agentConfigId:e.agentConfigId}),onSuccess:async c=>{await n.invalidateQueries({queryKey:Hi(t.scopeType,t.scopeId)}),i(c.id)}});return o.jsxs("div",{className:"term-note",children:[o.jsx(Ae,{tone:"info",actions:o.jsx(de,{size:"sm",variant:"default",disabled:a.isPending,onClick:()=>a.mutate(),children:"nova sessão igual"}),children:"Esta sessão encerrou. O que está abaixo é o registro do que ela imprimiu, somente leitura — o processo não existe mais e não há o que digitar."}),a.isError&&o.jsx(Ae,{tone:"danger",children:a.error.message})]})}function Yp({scope:e,crumb:t,checkout:i,context:n,filesPanel:a,cwd:c,openSessionId:h,initialPrompt:d}){const f=We(),{tabs:m,activeId:g,select:v,close:b,reopen:S,resume:x,resuming:C,sessions:k}=s3(e),N=D_(),L=y_(),D=j.useRef(!1);j.useEffect(()=>{h===void 0||D.current||m.some(I=>I.sessionId===h)&&(D.current=!0,v(h))},[h,m,v]);const M=K0(e.scopeType,e.scopeId,g);j.useEffect(()=>{L.setActiveTab(M)},[M,L.setActiveTab]);function Y(I){const ae=K0(e.scopeType,e.scopeId,I),le=L.fileFor(ae);return le===null?null:le.view==="patch"?o.jsx(S3,{scope:e,path:le.path,changeRef:le.ref??"worktree",onClose:()=>L.close(ae)}):o.jsx(m3,{scope:e,path:le.path,active:I===g,onClose:()=>L.close(ae)})}const Z=He({mutationFn:I=>ie.session.close.mutate({id:I}),onSuccess:()=>f.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)})}),W=k.data??[],ee=new Set(m.map(I=>I.sessionId));return o.jsxs("section",{className:"scope",children:[o.jsx("div",{className:"scope__crumb",children:t}),o.jsx(p2,{label:`sessões de ${c}`,lead:o.jsx(y0,{label:i.name,glyph:i.glyph,active:g===null,onSelect:()=>v(null),...i.state!==void 0?{state:i.state}:{},...i.stateLabel!==void 0?{stateLabel:i.stateLabel}:{}}),action:o.jsx(y3,{scopeType:e.scopeType,scopeId:e.scopeId,onCreated:I=>v(I)}),end:o.jsx(_2,{label:"a coluna de arquivos",pressed:a.open,onToggle:a.toggle,children:"▤"}),children:m.map(I=>o.jsx(y0,{label:I.label,ordinal:I.ordinal,glyph:o.jsx(Qe,{tone:I.kind==="agent"?"agent":"shell",children:I.kind==="agent"?"◆":"●"}),state:N.isWaiting(I.sessionId)?"asking":I.state==="running"?"running":I.exitCode===0?"exited":"failed",note:I.state==="running"?void 0:"registro",active:g===I.sessionId,onSelect:()=>v(I.sessionId),onClose:()=>{I.state==="running"?Z.mutate(I.sessionId):b(I.sessionId)}},I.sessionId))}),o.jsx("div",{className:"pane",role:"tabpanel",hidden:g!==null,"aria-label":i.name,children:o.jsxs(Q1,{viewer:Y(null),children:[Z.isError&&o.jsx("div",{className:"detail__banner",children:o.jsx(Ae,{tone:"danger",children:Z.error.message})}),n,o.jsxs("section",{className:"section",children:[o.jsx(kh,{title:"Sessões",count:W.length===0?0:`${W.length} · ${W.filter(I=>I.state==="running").length} rodando`}),W.length===0?o.jsx("p",{className:"detail__hint",children:"nenhuma sessão aberta aqui"}):W.map(I=>{const ae=I.state==="running",le=ee.has(I.id);return o.jsx(hw,{name:I.agentName??I.scriptName??"shell",glyph:o.jsx(Qe,{tone:I.kind==="agent"?"agent":"shell",children:I.kind==="agent"?"◆":I.kind==="script"?"▶":"●"}),detail:I.command,state:ae?{label:"running",tone:"running"}:{label:`exited (${I.exitCode??"?"})`,tone:I.exitCode===0?"exited":"failed"},age:gh(I.createdAt),onSelect:le?()=>v(I.id):void 0,action:le?void 0:o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>S(I.id),children:I.transport==="acp"?"reabrir":"ver registro"})},I.id)})]})]})}),m.map(I=>o.jsx(w5,{tab:I,scope:e,cwd:c,onStarted:v,active:g===I.sessionId,viewer:Y(I.sessionId),...I.transport==="acp"?{onResume:()=>x(I.sessionId)}:{},resuming:C===I.sessionId,initialPrompt:(d==null?void 0:d.sessionId)===I.sessionId?d.text:void 0},I.sessionId))]})}function j5({projectId:e}){var h,d;const[t,i]=j.useState("7d"),n=$T(e,t),a=[...(((h=n.data)==null?void 0:h.worktrees)??[]).map(f=>({id:f.worktreeId,name:f.name,tokens:f.tokens,cost:f.cost,currency:f.currency,turns:f.turns,kind:"worktree"}))],c=(d=n.data)==null?void 0:d.outside;return c!==void 0&&(c.turns>0||a.length>0)&&a.push({id:"__outside__",name:"direto no projeto",tokens:c.tokens,cost:c.cost,currency:c.currency,turns:c.turns,kind:"project",outside:!0}),o.jsxs("section",{className:"section",children:[o.jsx(kh,{title:"Consumo por worktree",aside:o.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo do projeto",children:kw.map(f=>o.jsx("button",{type:"button",className:"seg__btn","aria-pressed":t===f.id,onClick:()=>i(f.id),children:f.label},f.id))})}),n.isError?o.jsx(Ae,{tone:"danger",children:n.error.message}):n.isPending?o.jsx("p",{className:"detail__hint",children:"somando o consumo…"}):a.length===0?o.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste projeto"}):o.jsx(Aw,{rows:a})]})}function k5(e,t){if(t===null)return`remover ${e} da lista, e o registro das worktrees dele?`;if(t===0)return`remover ${e} da lista?`;const i=t===1?"1 worktree":`${t} worktrees`;return`remover ${e} da lista, e o registro de ${i}?`}function E5({projectId:e,workspaceId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onSelectWorktree:c,openSessionId:h,initialPrompt:d,filesPanel:f}){var Y,Z;const m=We(),g={scopeType:"project",scopeId:e},v=Ne({queryKey:["project","get",e],queryFn:()=>ie.project.get.query({id:e})}),b=Ne({queryKey:sa(e),queryFn:()=>ie.worktree.listByProject.query({projectId:e}),enabled:((Y=v.data)==null?void 0:Y.available)===!0}),[S,x]=j.useState(!1),C=He({mutationFn:()=>ie.project.remove.mutate({id:e}),onSuccess:async()=>{await m.invalidateQueries({queryKey:ta(t)}),n()}});if(S&&v.data)return o.jsx(N5,{project:v.data,worktrees:((Z=b.data)==null?void 0:Z.length)??null,pending:C.isPending,error:C.isError?C.error.message:null,onCancel:()=>{x(!1),C.reset()},onConfirm:()=>C.mutate()});if(v.isPending)return o.jsx("div",{className:"pane",children:o.jsx(di,{label:"carregando o projeto"})});if(!v.data)return o.jsx("div",{className:"pane",children:o.jsx("p",{role:"alert",children:"projeto não encontrado"})});const{name:k,path:N,defaultBranch:L,available:D}=v.data,M=b.data??[];return o.jsx(Yp,{scope:g,cwd:N,openSessionId:h,initialPrompt:d,filesPanel:f,crumb:o.jsxs("nav",{className:"crumb",children:[o.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:a,children:i}),o.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),k,o.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),o.jsx("span",{className:"crumb__here",children:"local"})]}),checkout:{name:"local",glyph:o.jsx(Qe,{tone:D?"project":"off",children:"▭"})},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Qe,{tone:D?"project":"off",children:"▭"})," local"]}),o.jsx("span",{className:"detail__kind",children:"checkout do projeto"}),o.jsx("span",{className:"actions__spacer"}),o.jsx(de,{variant:"ghost",size:"sm",onClick:()=>x(!0),disabled:C.isPending,children:C.isPending?"removendo…":"remover projeto"})]}),D?o.jsx("div",{className:"detail__banner",children:o.jsxs(Ae,{tone:"info",children:[o.jsx("strong",{children:"Este é o repositório em si, não uma worktree do Lumem."})," Remover o projeto tira o registro — o diretório e o que está dentro dele ficam no disco."]})}):o.jsx("div",{className:"detail__banner",children:o.jsxs(Ae,{tone:"danger",children:[o.jsxs("strong",{children:["O repositório não está mais em ",N,"."]})," As ações sobre ele ficam bloqueadas até que ele volte; o registro continua aqui."]})}),C.isError&&o.jsx("div",{className:"detail__banner",children:o.jsx(Ae,{tone:"danger",children:C.error.message})}),o.jsx(da,{entries:[{label:"branch base",value:o.jsxs(o.Fragment,{children:[o.jsx(as,{tone:"branch",dot:!0,children:L})," ",o.jsx("span",{className:"dim",children:"resolvida na adição"})]})},{label:"caminho",value:o.jsx(uw,{path:N})},...D?[{label:"worktrees",value:o.jsxs("span",{className:"dim",children:[M.length," ",M.length===1?"worktree":"worktrees"]})}]:[]]}),D&&o.jsxs(o.Fragment,{children:[o.jsx(j5,{projectId:e}),o.jsxs("section",{className:"section",children:[o.jsx(kh,{title:"Worktrees deste projeto",count:M.length}),M.length===0?o.jsx("p",{className:"detail__hint",children:"nenhuma worktree ainda"}):M.map(W=>o.jsx(hw,{name:W.name,glyph:o.jsx(Qe,{tone:W.state==="missing"?"warn":"worktree",children:W.state==="missing"?"⚠":"◇"}),detail:W.path,state:W.state==="missing"?{label:"ausente",tone:"missing"}:void 0,onSelect:()=>c(W.id)},W.id))]})]})]})})}function N5({project:e,worktrees:t,pending:i,error:n,onCancel:a,onConfirm:c}){return o.jsx("div",{className:"pane",children:o.jsxs("div",{className:"remove-confirm",role:"alertdialog","aria-label":"confirmar remoção",children:[e.managed?o.jsxs(o.Fragment,{children:[o.jsxs("h2",{className:"remove-confirm__title",children:["apagar ",e.name," do disco?"]}),o.jsxs("p",{className:"remove-confirm__body",children:["Este projeto foi clonado pelo Lumem. Remover tira do registro ",o.jsx("strong",{children:"e apaga o diretório"}),". Não dá para desfazer."]}),o.jsx("p",{className:"remove-confirm__path",children:e.path})]}):o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"remove-confirm__title",children:k5(e.name,t)}),o.jsxs("p",{className:"remove-confirm__body",children:["Este projeto aponta para um repositório ",o.jsx("strong",{children:"seu"}),". Sai da lista; o diretório fica exatamente onde está — o dele e o de cada worktree, com trabalho não commitado e tudo."]})]}),n!==null&&o.jsx(Ae,{tone:"danger",children:n}),o.jsxs("div",{className:"remove-confirm__actions",children:[o.jsx(de,{variant:e.managed?"danger":"primary",onClick:c,disabled:i,children:i?"removendo…":e.managed?"apagar":"remover"}),o.jsx(de,{variant:"ghost",onClick:a,children:"cancelar"})]})]})})}function T5(e){const t=Ne({queryKey:ta(e.workspaceId),queryFn:()=>ie.project.listByWorkspace.query({workspaceId:e.workspaceId})});return o.jsxs("div",{className:"tree","aria-label":"árvore de projetos",children:[o.jsxs("div",{className:"tree__head",children:[o.jsx("p",{className:"tree__label",children:"Projetos"}),o.jsx("button",{type:"button",className:"act","aria-label":"adicionar projeto",onClick:e.onAddProject,children:"+"})]}),i()]});function i(){if(t.isError)return o.jsx("p",{className:"tree__message",role:"alert",children:t.error.message});if(t.isPending)return o.jsx(di,{label:"carregando os projetos",widths:["80%","60%","70%"]});const n=t.data??[];return n.length===0?o.jsx(ms,{title:"Nenhum projeto aqui",children:"Aponte para a raiz de um repositório git no disco, ou cole uma URL para clonar."}):n.map(a=>o.jsx(O5,{project:a,...e},a.id))}}function O5({project:e,expansion:t,selection:i,onSelect:n,onCreateWorktree:a}){const c=t.isExpanded(e.id),h={scopeType:"project",scopeId:e.id},d=Ne({queryKey:sa(e.id),queryFn:()=>ie.worktree.listByProject.query({projectId:e.id}),enabled:e.available}),f=d.data??[],m=[h,...f.map(S=>({scopeType:"worktree",scopeId:S.id}))],g=w_(m),v=BO(e.available&&c?e.id:null),b=S=>(v.data??[]).find(x=>x.worktreeId===S);return o.jsxs(o.Fragment,{children:[o.jsx("div",{"data-kind":"project","data-state":e.available?"available":"missing",children:o.jsx(d_,{depth:0,emphasis:!0,label:e.name,glyph:o.jsx(Qe,{tone:e.available?"project":"off",children:"■"}),muted:!e.available,meta:e.available?void 0:"sem disco",count:!c&&g>0?g:void 0,expanded:c,onToggle:()=>t.toggle(e.id),reserveAction:!0,...e.available?{action:o.jsx("button",{type:"button",className:"row__act","aria-label":`nova worktree em ${e.name}`,onClick:()=>a(e),children:"+"})}:{},selected:!1,onSelect:()=>n(e.id,h)})}),c&&e.available&&o.jsxs(o.Fragment,{children:[o.jsx(A5,{projectId:e.id,selected:i.scopeType==="project"&&i.scopeId===e.id,onSelect:()=>n(e.id,h)}),d.isError&&o.jsx("p",{className:"tree__message",role:"alert",children:d.error.message}),f.map(S=>o.jsx(B5,{projectId:e.id,worktree:S,mark:b(S.id),selected:i.scopeType==="worktree"&&i.scopeId===S.id,onSelect:n},S.id))]})]})}function A5({projectId:e,selected:t,onSelect:i}){const n={scopeType:"project",scopeId:e},a=w_([n]);return o.jsx("div",{"data-kind":"local","data-state":"active",children:o.jsx(d_,{depth:1,label:"local",glyph:o.jsx(Qe,{tone:"project",children:"▭"}),meta:o.jsx(Z1,{scope:n}),count:a>0?a:void 0,selected:t,onSelect:i})})}function Z1({scope:e}){var a,c,h;const t=Uw(e),i=(a=t.data)==null?void 0:a.run.last,n=(c=t.data)==null?void 0:c.setup.last;if((i==null?void 0:i.running)===!0){const d=((h=t.data)==null?void 0:h.port)??null;return o.jsxs("span",{className:"runmark",children:[o.jsx("span",{className:"runmark__glyph",children:"▶"}),d===null?"run":`:${String(d.port)}`]})}return n&&!n.running&&n.exitCode!==0?o.jsx(o.Fragment,{children:"setup falhou"}):null}function R5(e){const t=[e.branch===e.name?null:e.branch,e.state==="missing"?"ausente":null].filter(i=>i!==null);return t.length===0?void 0:t.join(" · ")}function M5({mark:e}){return o.jsxs("span",{className:`prmark prmark--${e.verdict}`,children:[o.jsx("span",{className:"prmark__dot","aria-hidden":"true"}),"#",e.number,o.jsxs("span",{className:"sr-only",children:[" pull request ",D5[e.verdict]]})]})}const D5={ready:"pronta para merge",blocked:"bloqueada",pending:"verificando",draft:"em rascunho",merged:"mesclada",closed:"fechada sem merge"};function B5({projectId:e,worktree:t,mark:i,selected:n,onSelect:a}){const c=t.state==="missing",h={scopeType:"worktree",scopeId:t.id},d=w_([h]),f=D_(),m=x_(h),g=f.countIn((m.data??[]).map(v=>v.id));return o.jsx("div",{"data-kind":"worktree","data-state":t.state,children:o.jsx(d_,{depth:1,label:t.name,glyph:o.jsx(Qe,{tone:c?"warn":"worktree",children:c?"⚠":"◇"}),muted:c,meta:i!==void 0&&!c?o.jsx(M5,{mark:i}):R5(t)??(c?void 0:o.jsx(Z1,{scope:h}))??void 0,count:g>0?g:d>0?d:void 0,countTone:g>0?"asking":"running",selected:n,onSelect:()=>a(e,h)})})}function L5({workspaces:e,activeId:t,onSelect:i}){const n=We(),[a,c]=j.useState(!1),[h,d]=j.useState(""),f=He({mutationFn:g=>ie.workspace.create.mutate({name:g}),onSuccess:async g=>{await n.invalidateQueries({queryKey:mr}),i(g.id),c(!1),d("")}}),m=g=>{g.preventDefault(),h.trim()!==""&&f.mutate(h)};return o.jsxs("div",{className:"ws",children:[o.jsxs("div",{className:"ws__bar",children:[o.jsx("label",{className:"sr-only",htmlFor:"workspace-select",children:"Workspace"}),o.jsx("span",{className:"ws__glyph","aria-hidden":"true",children:"◈"}),o.jsx("select",{id:"workspace-select",className:"ws__select",value:t??"",onChange:g=>i(g.target.value),children:e.map(g=>o.jsx("option",{value:g.id,children:g.name},g.id))}),o.jsx("span",{className:"ws__caret","aria-hidden":"true",children:"▾"}),o.jsx(de,{size:"sm",variant:"ghost","aria-label":"novo workspace",title:"novo workspace",onClick:()=>c(!0),children:"+"})]}),a&&o.jsxs("form",{className:"ws__form",onSubmit:m,children:[o.jsx(Xt,{id:"new-workspace-name",label:"Nome do novo workspace",children:o.jsx(cs,{id:"new-workspace-name",value:h,onChange:g=>d(g.target.value),placeholder:"trabalho",autoFocus:!0})}),o.jsxs("div",{className:"ws__actions",children:[o.jsx(de,{type:"submit",variant:"primary",size:"sm",disabled:f.isPending||h.trim()==="",children:"criar"}),o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>c(!1),children:"cancelar"})]})]}),f.isError&&o.jsx("p",{className:"ws__error",role:"alert",children:f.error.message})]})}function z5({worktreeId:e,projectId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onOpenProject:c,openSessionId:h,initialPrompt:d,filesPanel:f}){var z,re;const m=We(),[g,v]=j.useState(!1),b=Ne({queryKey:n_(e),queryFn:()=>ie.worktree.getDetail.query({id:e})}),S=(z=m.getQueryData(sa(t)))==null?void 0:z.find(se=>se.id===e),x=Ne({queryKey:["project","get",t],queryFn:()=>ie.project.get.query({id:t})}),C=He({mutationFn:se=>ie.worktree.remove.mutate({id:e,force:se}),onSuccess:async()=>{await m.invalidateQueries({queryKey:sa(t)}),n()}}),k={scopeType:"worktree",scopeId:e};function N(se,A){var F;return o.jsxs("nav",{className:"crumb",children:[o.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:a,children:i}),o.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),o.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:c,children:((F=x.data)==null?void 0:F.name)??"…"}),o.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),o.jsx("span",{className:"crumb__here",children:se}),A!==se&&o.jsx("span",{className:"crumb__branch",children:A})]})}if(b.isPending)return S===void 0?o.jsx("div",{className:"pane",children:o.jsx(di,{label:"carregando a worktree"})}):o.jsx(Yp,{scope:k,cwd:S.path,openSessionId:h,initialPrompt:d,filesPanel:f,crumb:N(S.name,S.branch),checkout:{name:S.name,glyph:o.jsx(Qe,{tone:"worktree",children:"◇"})},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Qe,{tone:"worktree",children:"◇"})," ",S.name]}),o.jsx("span",{className:"detail__kind",children:"worktree"})]}),o.jsx(di,{label:"carregando a worktree"})]})});if(b.isError)return o.jsx("div",{className:"pane",children:o.jsx(Ae,{tone:"danger",children:b.error.message})});const{name:L,branch:D,path:M,state:Y,present:Z,status:W,aheadBehind:ee,baseBranch:I,createdAt:ae}=b.data,le=!Z||Y==="missing",H=le||W===null||W.clean?null:W.changedFiles;return o.jsx(Yp,{scope:k,cwd:M,openSessionId:h,initialPrompt:d,filesPanel:f,crumb:N(L,D),checkout:{name:L,glyph:o.jsx(Qe,{tone:le?"warn":"worktree",children:le?"⚠":"◇"}),...H===null?{}:{state:"dirty",stateLabel:`árvore suja · ${H} ${H===1?"arquivo":"arquivos"}`}},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Qe,{tone:le?"warn":"worktree",children:le?"⚠":"◇"})," ",L]}),o.jsx("span",{className:"detail__kind",children:le?"worktree ausente":"worktree"}),o.jsx("span",{className:"actions__spacer"}),o.jsx(de,{variant:"ghost",size:"sm",onClick:()=>C.mutate(!1,{onError:()=>v(!0)}),disabled:C.isPending,children:C.isPending?"removendo…":"remover worktree"})]}),g&&o.jsx("div",{className:"detail__banner",children:o.jsx(Ae,{tone:"danger",actions:o.jsxs(o.Fragment,{children:[o.jsx(de,{size:"sm",variant:"danger",onClick:()=>C.mutate(!0),disabled:C.isPending,children:"remover mesmo assim"}),o.jsx(de,{size:"sm",variant:"ghost",onClick:()=>v(!1),children:"cancelar"})]}),children:((re=C.error)==null?void 0:re.message)??"isso descarta as alterações não salvas."})}),le&&o.jsx("div",{className:"detail__banner",children:o.jsxs(Ae,{tone:"warning",children:["O diretório não está em ",o.jsx("code",{children:M}),". Remover aqui só apaga o registro; a branch ",o.jsx("code",{children:D})," continua existindo."]})}),o.jsx(da,{entries:[{label:"branch",value:o.jsxs(o.Fragment,{children:[o.jsx(as,{tone:"branch",dot:!0,children:D})," ",o.jsxs("span",{className:"dim",children:["nasceu de ",I]})]})},...le?[]:[{label:`em relação a ${I}`,value:ee===null?"desconhecido":o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"ahead",children:["↑",ee.ahead]})," ",o.jsxs("span",{className:"behind",children:["↓",ee.behind]})," ",o.jsxs("span",{className:"dim",children:[ee.ahead," à frente, ",ee.behind," atrás"]})]})}],{label:"estado",value:le?o.jsx(as,{tone:"missing",dot:!0,children:"ausente do disco"}):W===null?o.jsx(as,{children:"estado desconhecido"}):W.clean?o.jsx(as,{tone:"clean",dot:!0,children:"limpa"}):o.jsxs(as,{tone:"dirty",dot:!0,children:["suja · ",W.changedFiles," ",W.changedFiles===1?"arquivo":"arquivos"]})},{label:"caminho",value:o.jsx(uw,{path:M})},...le?[]:[{label:"criada",value:o.jsx("span",{className:"dim",children:gh(ae)})}]]}),o.jsx("p",{className:"detail__hint",children:"a branch não é apagada"})]})})}const Gp="lumem.activeWorkspaceId";function q5(){try{return window.localStorage.getItem(Gp)}catch{return null}}function tx(e){try{e===null?window.localStorage.removeItem(Gp):window.localStorage.setItem(Gp,e)}catch{}}function P5(e){var c,h;const[t,i]=j.useState(q5),n=((c=e.find(d=>d.id===t))==null?void 0:c.id)??((h=e[0])==null?void 0:h.id)??null;j.useEffect(()=>{n!==t&&tx(n)},[n,t]);const a=j.useCallback(d=>{tx(d),i(d)},[]);return{activeId:n,select:a}}function H5(e,t){switch(t.type){case"workspace.changed":e.invalidateQueries({queryKey:mr});return;case"project.changed":e.invalidateQueries({queryKey:ta(t.workspaceId)}),e.invalidateQueries({queryKey:["project","get"]});return;case"worktree.changed":e.invalidateQueries({queryKey:sa(t.projectId)}),e.invalidateQueries({queryKey:["worktree"]}),e.invalidateQueries({queryKey:["files"]}),e.invalidateQueries({queryKey:["changes"]});return;case"pr.changed":e.invalidateQueries({queryKey:["pr"]});return;case"session.changed":e.invalidateQueries({queryKey:Hi(t.scopeType,t.scopeId)}),e.invalidateQueries({queryKey:["session"]});return}}function I5(){const e=We();j.useEffect(()=>{const t=ie.events.onChange.subscribe(void 0,{onData:i=>H5(e,i),onConnectionStateChange:i=>{i.state==="idle"&&e.invalidateQueries()}});return()=>t.unsubscribe()},[e])}const X1="lumem.runDock",J1=96;function U5(e=window.innerHeight){return L_(Math.round(e/2),e)}function F5(e=window.innerHeight){return Math.max(J1,e-160)}const sx=640;function L_(e,t=window.innerHeight){return Math.min(F5(t),Math.max(J1,Math.round(e)))}function K5(){const e={open:!0,height:U5()};try{const t=window.localStorage.getItem(X1);if(t===null)return e;const i=JSON.parse(t);if(typeof i!="object"||i===null)return e;const{open:n,height:a}=i;return{open:typeof n=="boolean"?n:e.open,height:typeof a=="number"?L_(a):e.height}}catch{return e}}function ix(e){try{window.localStorage.setItem(X1,JSON.stringify(e))}catch{}}function $5(e,t){return{...e,toggle:()=>{!e.open&&t.width<sx&&t.setWidth(sx),e.toggle()}}}function W5(){const[e,t]=j.useState(K5),[i,n]=j.useState(!1),a=j.useCallback(d=>{t(f=>{const m={...f,height:L_(d)};return ix(m),m})},[]),c=j.useCallback(()=>{t(d=>{const f={...d,open:!d.open};return ix(f),f})},[]);j.useEffect(()=>{if(!i)return;const d=m=>{m.preventDefault(),a(window.innerHeight-m.clientY)},f=()=>n(!1);return window.addEventListener("pointermove",d),window.addEventListener("pointerup",f),()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",f)}},[i,a]);const h=j.useCallback(d=>{d.preventDefault(),n(!0)},[]);return{open:e.open,height:e.height,toggle:c,setHeight:a,beginResize:h}}const eC="lumem.collapsedNodes";function V5(){try{const e=window.localStorage.getItem(eC);if(e===null)return new Set;const t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(i=>typeof i=="string")):new Set}catch{return new Set}}function rx(e){try{window.localStorage.setItem(eC,JSON.stringify([...e]))}catch{}}function Y5(){const[e,t]=j.useState(V5),i=j.useCallback(c=>!e.has(c),[e]),n=j.useCallback(c=>{t(h=>{const d=new Set(h);return d.delete(c)||d.add(c),rx(d),d})},[]),a=j.useCallback(c=>{t(h=>{if(!h.has(c))return h;const d=new Set(h);return d.delete(c),rx(d),d})},[]);return{isExpanded:i,toggle:n,expand:a}}function G5({sidebar:e,children:t,fill:i=!1,right:n,rightWidth:a}){const c=n!==void 0&&a!==void 0?{"--right-width":`${a}px`}:void 0;return o.jsxs("div",{className:`app-shell${n!==void 0?" app-shell--right":""}`,style:c,children:[o.jsx("aside",{className:"app-shell__sidebar","aria-label":"navegação",children:e}),o.jsx("main",{className:`app-shell__main${i?" app-shell__main--fill":""}`,children:t}),n]})}function Q5({version:e,unreachable:t}){return o.jsxs("header",{className:"topbar",children:[o.jsxs("h1",{className:"wordmark",children:[o.jsx("span",{className:"wordmark__dot","aria-hidden":"true"}),"Lumem-OS"]}),o.jsx("span",{className:"topbar__spacer"}),t?o.jsxs("span",{className:"daemon daemon--off",role:"alert",children:[o.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon inacessível"]}):e!==null&&o.jsxs("span",{className:"daemon",children:[o.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon v",e]})]})}const tC=["máquina","agente","workspace","projeto","tarefa"],Z5={welcome:null,machine:0,agent:1,handshake:1,workspace:2,project:3,task:4,done:null};function sC(e){return Z5[e]}function El(e){const t=sC(e);return t===null?null:`passo ${t+1} de ${tC.length}`}function vn({eyebrow:e,title:t,lede:i,narrow:n,children:a,primary:c,onSubmit:h,onBack:d,onSkip:f,extra:m,hint:g}){const v=b=>{b.preventDefault(),!((c==null?void 0:c.disabled)===!0||(c==null?void 0:c.isPending)===!0)&&(h==null||h())};return o.jsx("form",{className:"wizard__form",onSubmit:v,children:o.jsx(g2,{...e===void 0?{}:{eyebrow:e},title:t,...i===void 0?{}:{lede:i},...n===void 0?{}:{narrow:n},footer:o.jsxs(o.Fragment,{children:[c!==void 0&&o.jsxs(de,{type:"submit",variant:"primary",disabled:c.disabled===!0||c.isPending===!0,children:[c.isPending===!0&&c.pending!==void 0?c.pending:c.label,c.isPending!==!0&&o.jsxs(o.Fragment,{children:[" ",o.jsx("span",{className:"kbd",children:"⏎"})]})]}),m,o.jsx("span",{className:"spacer"}),f!==void 0&&o.jsx(de,{variant:"ghost",onClick:f,children:"pular este passo"}),d!==void 0&&o.jsx(de,{variant:"ghost",onClick:d,children:"Voltar"}),g!==void 0&&o.jsx("span",{className:"hint",children:g})]}),children:a})})}const nx=["setup","agents"];function X5({onNext:e,onBack:t,onSkip:i}){var v;const n=We(),a=Ne({queryKey:nx,queryFn:()=>ie.setup.agents.query(),refetchOnWindowFocus:!1}),c=He({mutationFn:()=>ie.setup.installAdapter.mutate(),onSuccess:async()=>{await n.invalidateQueries({queryKey:nx})}}),h=(v=a.data)==null?void 0:v.adapters.find(b=>b.id===ST),d=h==null?void 0:h.adapter,f=(h==null?void 0:h.cli)??void 0,m=(h==null?void 0:h.apiKeyEnv)!==null&&(h==null?void 0:h.apiKeyEnv)!==void 0,g=(d==null?void 0:d.path)!=null;return o.jsxs(vn,{eyebrow:El("agent"),title:"Conecte o Claude Code",lede:o.jsxs(o.Fragment,{children:["O Lumem conversa com agentes por ",o.jsx("b",{children:"ACP"})," — o daemon sobe o adaptador como processo e troca mensagens por stdio. É o que faz ferramenta, plano e pedido de permissão chegarem como blocos, e não como texto rolando num terminal."]}),primary:{label:"Testar conexão",disabled:!g},onSubmit:e,onBack:t,onSkip:i,hint:g?void 0:o.jsx(o.Fragment,{children:"o botão libera quando o adaptador estiver no PATH"}),children:[a.isPending&&o.jsx(di,{label:"procurando os binários"}),a.isError&&o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:"Não deu para procurar os binários."})," ",a.error.message]}),a.data!==void 0&&f!==void 0&&d!==void 0&&o.jsxs(o.Fragment,{children:[o.jsxs(ia,{title:"o que foi encontrado na sua máquina",children:[o.jsxs(Fo,{label:"binários",children:[o.jsx(Ys,{state:f.path===null?"warn":"ok",what:f.command,value:f.path===null?"não está no PATH — o adaptador precisa dele para trabalhar":`${f.version??f.versionNote??"versão não lida"} · ${f.path}`,status:f.path===null?"falta":"ok"}),o.jsx(Ys,{state:d.path===null?"fail":"ok",what:d.command,value:d.path===null?"adaptador ACP não está no PATH":`${d.version??d.versionNote??"versão não lida"} · ${d.path}`,status:d.path===null?"falta":"ok"})]}),d.path===null&&o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"field__help",children:["Nada para rodar no terminal: o Lumem instala o adaptador ",o.jsx("b",{children:"dentro da pasta dele"}),", numa versão fixa — nunca ",o.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]}),o.jsxs("div",{className:"wizard__acts",children:[o.jsx(de,{variant:"primary",size:"sm",disabled:c.isPending,onClick:()=>c.mutate(),children:c.isPending?"instalando…":"Instalar o adaptador"}),o.jsx(de,{variant:"ghost",size:"sm",disabled:a.isFetching,onClick:()=>void a.refetch(),children:a.isFetching?"verificando…":"Já instalei — verificar"})]}),c.isError&&o.jsxs(o.Fragment,{children:[o.jsx(Ae,{tone:"danger",children:c.error.message}),d.install!==null&&o.jsx(u_,{command:d.install})]})]}),d.managed&&o.jsxs("span",{className:"field__help",children:["Instalado pelo Lumem, na pasta dele — é esta cópia que o daemon executa, e não uma que esteja no seu ",o.jsx("code",{children:"PATH"}),"."]})]}),o.jsxs(ia,{title:"como o Claude vai se autenticar — o que foi encontrado",children:[o.jsx(Fo,{label:"credencial",children:o.jsx(Ys,{state:m?"ok":"warn",what:(h==null?void 0:h.apiKeyEnv)??__.apiKeyEnv[0]??"",value:m?"presente no ambiente do daemon — cobrança por token":"ausente — o adaptador vai usar a credencial local do Claude",status:m?"chave":"assinatura"})}),o.jsxs("span",{className:"field__help",children:["Não é escolha sua nem do Lumem: o adaptador usa a credencial que ",o.jsx("b",{children:"encontrar"}),". É o passo seguinte que confirma se ela vale — e ele confirma sem gastar token."]})]}),o.jsxs("div",{className:"adv",children:[o.jsx("span",{className:"adv__k",children:"avançado"}),o.jsxs("span",{className:"adv__v",children:["comando: ",d.command," · args: nenhum · env herdado do daemon"]})]}),o.jsxs(Ae,{tone:"info",children:["Qualquer agente que fale ACP entra depois em ",o.jsx("b",{children:"agentes"}),", no rodapé da sidebar — o Lumem não é preso ao Claude. Pular este passo também é legítimo: sem agente ACP, a sessão é um terminal."]})]})]})}const J5=["agentConfig","list"];function eB({result:e,skipped:t,onOpen:i,onReview:n}){var S,x,C;const[a,c,h,d,f]=Ix({queries:[{queryKey:mr,queryFn:()=>ie.workspace.list.query()},{queryKey:J5,queryFn:()=>ie.agentConfig.list.query(),enabled:e.agentConfigId!==void 0},{queryKey:["project","get",e.projectId??""],queryFn:()=>ie.project.get.query({id:e.projectId??""}),enabled:e.projectId!==void 0},{queryKey:n_(e.worktreeId??""),queryFn:()=>ie.worktree.getDetail.query({id:e.worktreeId??""}),enabled:e.worktreeId!==void 0},{queryKey:Hi("worktree",e.worktreeId??""),queryFn:()=>ie.session.listByScope.query({scopeType:"worktree",scopeId:e.worktreeId??""}),enabled:e.worktreeId!==void 0}]}),m=(S=a.data)==null?void 0:S.find(k=>k.id===e.workspaceId),g=(x=c.data)==null?void 0:x.find(k=>k.id===e.agentConfigId),v=(C=f.data)==null?void 0:C.find(k=>k.kind==="agent"),b=[{label:"workspace",value:(m==null?void 0:m.name)??o.jsx(tB,{})},{label:"agente",value:g===void 0?o.jsx(Em,{step:"agent",skipped:t,onReview:n}):o.jsxs(o.Fragment,{children:[g.command,g.adapterVersion!==null&&` @${g.adapterVersion}`," ",o.jsxs("span",{className:"dim",children:["— ",g.transport==="acp"?"conversa":"terminal",g.available?"":" · fora do PATH"]})]})},{label:"projeto",value:h.data==null?o.jsx(Em,{step:"project",skipped:t,onReview:n}):o.jsxs(o.Fragment,{children:[h.data.path,!h.data.available&&o.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"worktree",value:d.data==null?o.jsx(Em,{step:"task",skipped:t,onReview:n}):o.jsxs(o.Fragment,{children:[d.data.path,!d.data.present&&o.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"sessão",value:v===void 0?o.jsx("span",{className:"dim",children:"nenhuma — abra uma quando quiser"}):o.jsxs(o.Fragment,{children:[v.agentName??"agente"," ",o.jsxs("span",{className:"dim",children:["— ",v.state]})]})}];return o.jsxs(vn,{narrow:!0,eyebrow:"tudo configurado",title:"Pronto. O resto acontece dentro do produto.",lede:"Foi isto que passou a existir na sua máquina:",primary:{label:"Abrir o workspace"},onSubmit:i,extra:o.jsx(de,{variant:"ghost",onClick:n,children:"Revisar a configuração"}),children:[o.jsx(da,{variant:"recap",entries:b}),o.jsxs("div",{className:"keys",children:[o.jsxs("div",{className:"key",children:[o.jsx("span",{className:"key__k",children:"⏎"}),o.jsxs("span",{className:"key__d",children:["enviar o turno — ",o.jsx("span",{className:"dim",children:"⇧⏎ faz linha nova"})]})]}),o.jsxs("div",{className:"key",children:[o.jsx("span",{className:"key__k",children:"esquerda"}),o.jsx("span",{className:"key__d",children:"projetos e worktrees; o rodapé adiciona projeto e configura agente"})]}),o.jsxs("div",{className:"key",children:[o.jsx("span",{className:"key__k",children:"abas"}),o.jsxs("span",{className:"key__d",children:["uma por sessão viva, mais ",o.jsx("b",{children:"contexto"})," — a worktree em si"]})]}),o.jsxs("div",{className:"key",children:[o.jsx("span",{className:"key__k",children:"direita"}),o.jsx("span",{className:"key__d",children:"arquivos do checkout e o que mudou neles, ao lado da conversa"})]})]})]})}function tB(){return o.jsx("span",{className:"dim",children:"lendo do daemon…"})}function Em({step:e,skipped:t,onReview:i}){const n={agent:"no rodapé da sidebar, em agentes",project:"na sidebar, no + ao lado de Projetos",task:"na sidebar, no + da linha do projeto"};return t.includes(e)?o.jsxs("span",{className:"dim",children:["pulado — dá para fazer ",n[e],","," ",o.jsx("button",{type:"button",className:"key__link",onClick:i,children:"ou voltar ao fluxo"})]}):o.jsx("span",{className:"dim",children:"nada foi criado"})}const sB=["setup","probe"],ax=["agentConfig","list"],lx="claude";function iB({onNext:e,onBack:t,onSkip:i}){const n=We(),a=Ne({queryKey:sB,queryFn:()=>ie.setup.probe.query(),refetchOnWindowFocus:!1,retry:!1}),c=Ne({queryKey:ax,queryFn:()=>ie.agentConfig.list.query()}),h=a.data,d=He({mutationFn:async()=>{var g,v;if(h===void 0)throw new Error("sem handshake não há o que salvar");const m=(g=c.data)==null?void 0:g.find(b=>b.transport==="acp"&&b.command===h.command);return m!==void 0?m:ie.agentConfig.create.mutate({name:lx,command:h.command,args:[...h.args],transport:"acp",adapterVersion:((v=h.agentInfo)==null?void 0:v.version)??null})},onSuccess:async m=>{await n.invalidateQueries({queryKey:ax}),e({agentConfigId:m.id,agentName:m.name,...m.adapterVersion===null?{}:{adapterVersion:m.adapterVersion}})}}),f=h===void 0?"":h.authMethods.length===0?"o adaptador não pediu autenticação: usou a credencial local":`o adaptador pede autenticação: ${h.authMethods.map(m=>m.name??m.id).join(", ")}`;return o.jsxs(vn,{eyebrow:`${El("handshake")??""} · conexão`,title:a.isError?"O adaptador não conectou":"Claude Code conectado",lede:a.isError?o.jsx(o.Fragment,{children:"Isto é o que o daemon tentou, e o que voltou."}):o.jsxs(o.Fragment,{children:["O daemon subiu o adaptador, trocou o ",o.jsx("code",{children:"initialize"})," e abriu uma sessão de teste. Isto é o que ele respondeu."]}),primary:{label:"Continuar",disabled:h===void 0,isPending:d.isPending,pending:"salvando…"},onSubmit:()=>d.mutate(),onBack:t,onSkip:i,extra:o.jsx(de,{variant:"ghost",disabled:a.isFetching,onClick:()=>void a.refetch(),children:a.isFetching?"testando…":"Testar de novo"}),hint:o.jsxs(o.Fragment,{children:["salvo como ",o.jsx("b",{children:lx})]}),children:[a.isPending&&o.jsx(di,{label:"subindo o adaptador"}),a.isError&&o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:"O handshake falhou."})," ",a.error.message]}),h!==void 0&&o.jsxs(o.Fragment,{children:[o.jsxs(Fo,{label:"o que o adaptador respondeu",children:[o.jsx(Ys,{state:"ok",what:"processo",value:`${h.command} · subiu em ${h.timings.spawnMs} ms`,status:"ok"}),o.jsx(Ys,{state:"ok",what:"protocolo",value:`ACP v${h.protocolVersion}${h.agentInfo===null?" · o adaptador não declarou nome nem versão":` · ${h.agentInfo.name} ${h.agentInfo.version}`}`,status:"ok"}),o.jsx(Ys,{state:h.authMethods.length===0?"ok":"warn",what:"autenticação",value:f,status:h.authMethods.length===0?"ok":"pede"}),o.jsx(Ys,{state:"ok",what:"capacidades",value:h.capabilities.length===0?"nenhuma declarada":h.capabilities.join(" · "),status:"ok"}),o.jsx(Ys,{state:"ok",what:"sessão",value:`session/new devolveu ${h.acpSessionId} em ${h.timings.sessionMs} ms`,status:"ok"})]}),o.jsx(ia,{title:"o que o daemon mandou e o que voltou",children:o.jsxs("div",{className:"wire",children:[o.jsxs("span",{className:"wire__l",children:[o.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),o.jsxs("span",{className:"wire__c",children:["initialize ","{"," protocolVersion: ",h.protocolVersion,", clientCapabilities:"," ","{"," fs: ","{"," readTextFile, writeTextFile ","}",", terminal ","}"," ","}"]})]}),o.jsxs("span",{className:"wire__l",children:[o.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),o.jsxs("span",{className:"wire__c",children:["{"," protocolVersion: ",h.protocolVersion,", agentInfo:"," ",h.agentInfo===null?"ausente":`${h.agentInfo.name}@${h.agentInfo.version}`,", authMethods: [",h.authMethods.map(m=>m.id).join(", "),"] ","}"]})]}),o.jsxs("span",{className:"wire__l",children:[o.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),o.jsxs("span",{className:"wire__c",children:["session/new ","{"," cwd: ~/.lumem/probe, mcpServers: [] ","}"]})]}),o.jsxs("span",{className:"wire__l",children:[o.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),o.jsxs("span",{className:"wire__c",children:["{"," sessionId: ",h.acpSessionId,", modes: [",h.modes.join(", "),"] ","}"]})]}),o.jsxs("span",{className:"wire__l",children:[o.jsx("span",{className:"wire__d","aria-hidden":"true",children:"·"}),o.jsx("span",{className:"wire__c",children:"sessão de teste encerrada. Nenhum token consumido — não houve session/prompt."})]})]})}),o.jsxs(ia,{title:"como as próximas sessões nascem",children:[o.jsx(da,{variant:"recap",entries:[{label:"modelo",value:o.jsxs(o.Fragment,{children:["o que o agente oferecer ",o.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"modo",value:h.currentMode===null?o.jsx("span",{className:"dim",children:"o padrão do agente"}):o.jsxs(o.Fragment,{children:[h.currentMode," ",o.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"versão",value:h.agentInfo===null?o.jsx("span",{className:"dim",children:"o adaptador não declarou — vai pedir para digitar"}):h.agentInfo.version}]}),o.jsx("span",{className:"field__help",children:"Leitura, não escolha: o Lumem não tem onde guardar um padrão seu, e a conversa já escolhe modelo e modo por sessão — com o agente como autoridade sobre a lista."})]}),d.isError&&o.jsx(Ae,{tone:"danger",children:d.error.message})]})]})}const iC=["setup","preflight"];function rB({onNext:e,onBack:t,onSkip:i}){var h;const n=Ne({queryKey:iC,queryFn:()=>ie.setup.preflight.query(),refetchOnWindowFocus:!1}),a=((h=n.data)==null?void 0:h.checks)??[],c=a.some(d=>d.id==="git"&&d.state==="fail");return o.jsxs(vn,{eyebrow:El("machine"),title:"O que o Lumem precisa da sua máquina",lede:"Cinco verificações, todas locais. Nenhuma delas instala nada.",primary:{label:"Continuar"},onSubmit:e,onBack:t,onSkip:i,extra:o.jsx(de,{variant:"ghost",disabled:n.isFetching,onClick:()=>void n.refetch(),children:n.isFetching?"verificando…":"Verificar de novo"}),hint:o.jsxs(o.Fragment,{children:[o.jsx("b",{children:"esc"})," volta"]}),children:[n.isPending&&o.jsx(di,{label:"lendo a máquina"}),n.isError&&o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:"O daemon não respondeu ao pré-voo."})," ",n.error.message]}),a.length>0&&o.jsx(Fo,{label:"o que o Lumem encontrou nesta máquina",children:a.map(d=>o.jsx(Ys,{state:n.isFetching?"running":d.state,what:d.label,value:d.value,status:n.isFetching?"lendo":nB(d.state),...d.fix===null?{}:{action:o.jsx(u_,{command:d.fix})}},d.id))}),c&&o.jsxs(Ae,{tone:"warning",children:["Git abaixo de ",o.jsx("strong",{children:"2.30"})," não serve: o Lumem usa ",o.jsx("code",{children:"git worktree"})," com"," ",o.jsx("code",{children:"--orphan"}),", e o comportamento muda antes dessa versão. Dá para continuar — a falha aparece na primeira worktree, com esta mesma frase."]})]})}function nB(e){return e==="ok"?"ok":e==="warn"?"atenção":"falha"}function rC(e,t=400){const[i,n]=j.useState(e);return j.useEffect(()=>{const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},[e,t]),i}function aB({workspaceId:e,onNext:t,onBack:i,onSkip:n}){const a=We(),[c,h]=j.useState(""),d=rC(c.trim()),f=Ne({queryKey:["project","inspect",d],queryFn:()=>ie.project.inspect.query({path:d}),enabled:d.startsWith("/")||d.startsWith("~"),retry:!1}),m=He({mutationFn:()=>{if(e===void 0)throw new Error("sem workspace não há onde adicionar");return ie.project.add.mutate({workspaceId:e,path:d})},onSuccess:async b=>{e!==void 0&&await a.invalidateQueries({queryKey:ta(e)}),t({projectId:b.id,projectPath:b.path})}}),g=f.data,v=(g==null?void 0:g.alreadyRegistered)??null;return o.jsxs(vn,{eyebrow:El("project"),title:"Adicione o primeiro projeto",lede:o.jsxs(o.Fragment,{children:["Projeto é um repositório git que ",o.jsx("b",{children:"já existe"})," na sua máquina. O Lumem não move nem reescreve nada dele — só passa a criar worktrees a partir dele. Clonar de uma URL é outra história: rede, credencial e progresso são feature, não um campo."]}),primary:{label:v===null?"Adicionar projeto":"Usar o que já está aqui",disabled:g===void 0,isPending:m.isPending,pending:"validando…"},onSubmit:()=>{if(v!==null){t({projectId:v.id,projectPath:d});return}m.mutate()},onBack:i,onSkip:n,children:[o.jsxs("div",{className:"wizard__body",children:[o.jsx(Xt,{id:"setup-project-path",label:"Pasta do projeto — caminho absoluto",error:m.isError?m.error.message:f.isError&&d!==""?f.error.message:void 0,children:o.jsx(cs,{id:"setup-project-path",value:c,onChange:b=>h(b.target.value),placeholder:"/Users/voce/Documents/GitHub/lorebase",invalid:m.isError||f.isError,autoFocus:!0})}),o.jsxs("span",{className:"field__help",children:["Digitado, não escolhido: o daemon pode estar em outra máquina, e o seletor de arquivo do navegador entrega arquivo, não caminho de servidor. Ele valida na hora e diz"," ",o.jsx("b",{children:"qual"})," verificação falhou."]})]}),f.isFetching&&o.jsx(di,{label:"lendo o repositório"}),g!==void 0&&o.jsxs(o.Fragment,{children:[o.jsxs(ia,{title:"o que o Lumem leu daí",children:[o.jsxs(Fo,{label:"o que o repositório é",children:[o.jsx(Ys,{state:"ok",what:"repositório",value:`git · ${g.commits} commit(s) · HEAD em ${g.head.branch??"HEAD destacado"}${g.head.shortSha===null?"":` · ${g.head.shortSha}`}`,status:"ok"}),o.jsx(Ys,{state:g.origin===null?"warn":"ok",what:"remoto",value:g.origin??"sem origin — worktree funciona igual, push é que não",status:g.origin===null?"sem":"ok"}),o.jsx(Ys,{state:g.clean?"ok":"warn",what:"árvore",value:g.clean?"limpa · nada por commitar":`${g.changedFiles} arquivo(s) por commitar — o Lumem não toca neles`,status:g.clean?"limpa":"suja"}),o.jsx(Ys,{state:g.worktrees.length===0?"ok":"warn",what:"worktrees",value:g.worktrees.length===0?"nenhuma além do checkout principal":`${g.worktrees.length} já registrada(s) neste repositório, criada(s) fora do Lumem`,status:g.worktrees.length===0?"ok":"atenção"})]}),g.worktrees.length>0&&o.jsx("span",{className:"field__help",children:"Elas continuam onde estão. O Lumem não mexe em nenhuma delas, e não passa a listá-las — ver e administrar worktree criada fora daqui é outra feature."})]}),v!==null&&o.jsxs(Ae,{tone:"info",children:["Este caminho já é o projeto ",o.jsx("strong",{children:v.name})," aqui. Nada será criado de novo — o fluxo segue com ele."]}),o.jsxs(Ae,{tone:"info",children:["Seu checkout em ",o.jsx("code",{children:g.root})," continua sendo seu. O agente trabalha nas worktrees irmãs, fora dele."]})]})]})}function lB({projectId:e,agentConfigId:t,onNext:i,onBack:n,onSkip:a}){const c=We(),[h,d]=j.useState("primeira-tarefa"),[f,m]=j.useState(!0),g=rC(h.trim()),v=Ne({queryKey:["worktree","plan",e??"",g],queryFn:()=>ie.worktree.plan.query({projectId:e??"",name:g}),enabled:e!==void 0&&g!=="",retry:!1}),b=He({mutationFn:async()=>{if(e===void 0)throw new Error("sem projeto não há de onde cortar worktree");const x=await ie.worktree.create.mutate({projectId:e,name:g});let C;return f&&t!==void 0&&(C=(await ie.session.createAgent.mutate({scopeType:"worktree",scopeId:x.id,agentConfigId:t})).id),{worktree:x,sessionId:C}},onSuccess:async({worktree:x,sessionId:C})=>{e!==void 0&&await c.invalidateQueries({queryKey:sa(e)}),await c.invalidateQueries({queryKey:Hi("worktree",x.id)}),i({worktreeId:x.id,worktreeName:x.name,sessionOpened:C!==void 0,...C===void 0?{}:{sessionId:C}})}}),S=v.data;return o.jsxs(vn,{eyebrow:El("task"),title:"Toda tarefa vira uma worktree",lede:"É a ideia central: em vez de trocar de branch no seu checkout, cada tarefa ganha uma branch e uma pasta próprias. Você pode ter três agentes trabalhando ao mesmo tempo e nenhum encosta no que o outro está fazendo.",primary:{label:f&&t!==void 0?"Criar e abrir a conversa":"Criar a worktree",disabled:S===void 0||S.refusal!==null,isPending:b.isPending,pending:"criando…"},onSubmit:()=>b.mutate(),onBack:n,onSkip:a,children:[o.jsxs("div",{className:"wizard__body",children:[o.jsx(Xt,{id:"setup-task-name",label:"Nome da tarefa",error:b.isError?b.error.message:v.isError?v.error.message:(S==null?void 0:S.refusal)??void 0,children:o.jsx(cs,{id:"setup-task-name",value:h,onChange:x=>d(x.target.value),placeholder:"primeira-tarefa",invalid:b.isError||v.isError||(S==null?void 0:S.refusal)!=null,autoFocus:!0})}),o.jsx("span",{className:"field__help",children:"Vira o nome da branch e o nome da pasta."}),S!==void 0&&o.jsx(da,{variant:"recap",entries:[{label:"branch",value:o.jsxs(o.Fragment,{children:[S.branch," ",o.jsxs("span",{className:"dim",children:["← ",S.baseBranch,S.baseSha===null?" · sem commit ainda":` · ${S.baseSha}`]})]})},{label:"pasta",value:S.path},{label:"comando",value:S.command}]})]}),o.jsx(ia,{title:"o que abre junto",children:o.jsxs(d2,{label:"o que abre junto",children:[o.jsx(g0,{title:"Uma sessão do Claude",description:t===void 0?"Precisa de um agente ACP configurado — o passo 2 foi pulado.":"Abre a conversa já dentro da worktree.",glyph:o.jsx(Qe,{tone:"agent",children:"◆"}),selected:f&&t!==void 0,onSelect:()=>m(!0),disabled:t===void 0}),o.jsx(g0,{title:"Só a worktree",description:"Cria a pasta e a branch. Você abre sessão quando quiser.",glyph:o.jsx(Qe,{tone:"shell",children:"●"}),selected:!f||t===void 0,onSelect:()=>m(!1)})]})}),e===void 0&&o.jsxs(Ae,{tone:"warning",children:["O passo do projeto foi pulado, então não há de onde cortar uma worktree. Pule este também — a linha do projeto na sidebar ganha um ",o.jsx("b",{children:"+"})," quando você adicionar um."]})]})}function oB({daemonVersion:e,daemonUnreachable:t,onStart:i}){return o.jsx(vn,{title:t?"O daemon não está respondendo.":"O daemon já está rodando. Falta dizer com o que ele trabalha.",lede:t?o.jsxs(o.Fragment,{children:["O Lumem roda inteiro na sua máquina, e o daemon é a parte que tem os processos. Sem ele nada aqui responde — nem este fluxo. Suba ",o.jsx("code",{children:"pnpm dev"})," e volte."]}):o.jsxs(o.Fragment,{children:["O Lumem roda inteiro na sua máquina: um daemon local",e!==null&&o.jsxs(o.Fragment,{children:[" (v",e,")"]}),", seus repositórios onde já estão, e agentes que você mesmo instalou. Nada sai daqui — o que vai para a Anthropic é o que você escrever para o Claude, pela sua própria conta."]}),primary:{label:"Configurar em 5 passos",disabled:t},onSubmit:i,hint:o.jsx(o.Fragment,{children:"leva ~2 min"}),children:o.jsxs("div",{className:"tri",children:[o.jsxs("div",{className:"tri__i",children:[o.jsx("span",{className:"tri__g glyph glyph--worktree","aria-hidden":"true",children:"◇"}),o.jsx("span",{className:"tri__t",children:"Uma tarefa, uma worktree"}),o.jsx("span",{className:"tri__d",children:"Cada tarefa ganha branch e pasta próprias. O agente trabalha lá; seu checkout não é tocado."})]}),o.jsxs("div",{className:"tri__i",children:[o.jsx("span",{className:"tri__g glyph glyph--agent","aria-hidden":"true",children:"◆"}),o.jsx("span",{className:"tri__t",children:"Agente por ACP"}),o.jsx("span",{className:"tri__d",children:"Claude Code entra por protocolo, não por terminal simulado. Ferramenta, plano e permissão viram blocos."})]}),o.jsxs("div",{className:"tri__i",children:[o.jsx("span",{className:"tri__g glyph glyph--project","aria-hidden":"true",children:"■"}),o.jsx("span",{className:"tri__t",children:"Vários ao mesmo tempo"}),o.jsx("span",{className:"tri__d",children:"Sessões paralelas em worktrees diferentes, sem uma pisar na outra."})]})]})})}function cB({onNext:e,onBack:t}){var f;const i=We(),[n,a]=j.useState("pessoal"),c=Ne({queryKey:iC,queryFn:()=>ie.setup.preflight.query(),refetchOnWindowFocus:!1}),h=He({mutationFn:()=>ie.workspace.create.mutate({name:n.trim()}),onSuccess:async m=>{await i.invalidateQueries({queryKey:mr}),e({workspaceId:m.id,workspaceName:m.name})}}),d=(f=c.data)==null?void 0:f.paths;return o.jsxs(vn,{eyebrow:El("workspace"),title:"Crie seu primeiro workspace",lede:"Um workspace agrupa projetos e guarda as worktrees deles num lugar só. Quem trabalha em coisas separadas — pessoal e cliente, por exemplo — mantém dois, e eles nunca se veem.",primary:{label:"Criar workspace",disabled:n.trim()==="",isPending:h.isPending,pending:"criando…"},onSubmit:()=>h.mutate(),onBack:t,children:[o.jsxs("div",{className:"wizard__body",children:[o.jsx(Xt,{id:"setup-workspace-name",label:"Nome",error:h.isError?h.error.message:void 0,children:o.jsx(cs,{id:"setup-workspace-name",value:n,onChange:m=>a(m.target.value),placeholder:"pessoal",invalid:h.isError,autoFocus:!0})}),o.jsx("span",{className:"field__help",children:"Aparece no topo da coluna da esquerda. Dá para renomear depois."}),d!==void 0&&o.jsx(Xt,{id:"setup-workspaces-dir",label:"Onde o Lumem escreve — leitura",children:o.jsx(cs,{id:"setup-workspaces-dir",value:d.workspacesDir,readOnly:!0})}),o.jsxs("span",{className:"field__help",children:["Uma árvore por workspace, com o clone e as worktrees de cada projeto debaixo dele. Fora dos seus repositórios, de propósito: worktree dentro do checkout suja"," ",o.jsx("code",{children:"git status"})," e acaba commitada por acidente. Quem muda o lugar é a variável"," ",o.jsx("code",{children:"LUMEM_STATE_DIR"})," do daemon."]})]}),d!==void 0&&o.jsx(ia,{title:"o que este passo escreve no disco",children:o.jsx(da,{variant:"recap",entries:[{label:"registro",value:d.databasePath},{label:"workspaces",value:d.workspacesDir},{label:"conversas",value:o.jsxs(o.Fragment,{children:[d.transcriptsDir," ",o.jsx("span",{className:"dim",children:"— só local"})]})}]})})]})}const Nm=["welcome","machine","agent","handshake","workspace","project","task","done"];function uB({daemonVersion:e,daemonUnreachable:t,onFinish:i}){const[n,a]=j.useState("welcome"),[c,h]=j.useState({}),[d,f]=j.useState([]),m=Nm.indexOf(n),g=j.useCallback(N=>{a(N),window.scrollTo(0,0)},[]),v=j.useCallback(N=>{N!==void 0&&h(D=>({...D,...N}));const L=Nm[m+1];L!==void 0&&g(L)},[g,m]),b=j.useCallback(()=>{const N=Nm[m-1];N!==void 0&&g(N)},[g,m]),S=j.useCallback(()=>{if(f(N=>N.includes(n)?N:[...N,n]),n==="agent"){f(N=>N.includes("handshake")?N:[...N,"handshake"]),g("workspace");return}v()},[v,g,n]);j.useEffect(()=>{const N=L=>{L.key==="Escape"&&b()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[b]);const x=sC(n),C=j.useMemo(()=>x===null?null:o.jsx(m2,{steps:tC,current:x}),[x]);return o.jsx("div",{className:"flow",children:o.jsxs("div",{className:"wizard",children:[C,k()]})});function k(){switch(n){case"welcome":return o.jsx(oB,{daemonVersion:e,daemonUnreachable:t,onStart:()=>v()});case"machine":return o.jsx(rB,{onNext:()=>v(),onBack:b,onSkip:S});case"agent":return o.jsx(X5,{onNext:()=>v(),onBack:b,onSkip:S});case"handshake":return o.jsx(iB,{onNext:N=>v(N),onBack:b,onSkip:S});case"workspace":return o.jsx(cB,{onNext:N=>v(N),onBack:b});case"project":return o.jsx(aB,{workspaceId:c.workspaceId,onNext:N=>v(N),onBack:b,onSkip:S});case"task":return o.jsx(lB,{projectId:c.projectId,agentConfigId:c.agentConfigId,onNext:N=>v(N),onBack:b,onSkip:S});case"done":return o.jsx(eB,{result:c,skipped:d,onOpen:()=>i(c),onReview:()=>g("welcome")})}}}function hB(){var W;const e=We(),[t,i]=j.useState(null),[n,a]=j.useState(null),[c,h]=j.useState(void 0),[d,f]=j.useState(null),[m,g]=j.useState(!1),[v,b]=j.useState(null),S=Y5(),x=wA(),C=W5(),k=Ne({queryKey:["health"],queryFn:()=>ie.health.query(),refetchInterval:5e3,retry:!1}),N=Ne({queryKey:mr,queryFn:()=>ie.workspace.list.query()}),{activeId:L,select:D}=P5(N.data??[]);return j.useEffect(()=>{n!==null||!N.isSuccess||a(N.data.length===0)},[n,N.isSuccess,N.data]),I5(),o.jsx(t3,{children:o.jsx(UO,{children:o.jsxs("div",{className:"app",children:[o.jsx(Q5,{version:((W=k.data)==null?void 0:W.version)??null,unreachable:k.isError}),k.isError&&o.jsx("div",{className:"app__banner",children:o.jsxs(Ae,{tone:"danger",children:[o.jsx("strong",{children:"Daemon inacessível."})," Nada aqui responde até ele voltar. As sessões continuam rodando no servidor — o que caiu é a conexão com ele."]})}),M()]})})});function M(){var ae,le;if(N.isPending)return o.jsx("div",{className:"pane",children:o.jsx(di,{label:"conectando ao daemon"})});if(N.isError)return o.jsx("div",{className:"pane",children:o.jsx("p",{role:"alert",children:N.error.message})});if(n===null)return o.jsx("div",{className:"pane",children:o.jsx(di,{label:"conectando ao daemon"})});if(n||N.data.length===0||L===null)return o.jsx(uB,{daemonVersion:((ae=k.data)==null?void 0:ae.version)??null,daemonUnreachable:k.isError,onFinish:async H=>{await e.invalidateQueries({queryKey:mr}),H.workspaceId!==void 0&&D(H.workspaceId),h(H.sessionId),H.projectId!==void 0&&i({projectId:H.projectId,scope:H.worktreeId===void 0?{scopeType:"project",scopeId:H.projectId}:{scopeType:"worktree",scopeId:H.worktreeId}}),a(!1)}});const ee=N.data,I=((le=ee.find(H=>H.id===L))==null?void 0:le.name)??"";return o.jsxs(o.Fragment,{children:[o.jsx(G5,{fill:!0,right:Y(),rightWidth:x.width,sidebar:o.jsxs(o.Fragment,{children:[o.jsx(L5,{workspaces:ee,activeId:L,onSelect:H=>{D(H),i(null)}}),o.jsx(T5,{workspaceId:L,expansion:S,selection:{scopeType:(t==null?void 0:t.scope.scopeType)??null,scopeId:(t==null?void 0:t.scope.scopeId)??null},onSelect:(H,z)=>i({projectId:H,scope:z}),onAddProject:()=>g(!0),onCreateWorktree:b}),o.jsx("div",{className:"sidebar__foot",children:o.jsx(DT,{})})]}),children:Z(L,I)}),o.jsx(w2,{workspaceId:L,workspaceName:I,open:m,onClose:()=>g(!1),onRequestOpen:()=>g(!0),onAdded:H=>i({projectId:H,scope:{scopeType:"project",scopeId:H}})}),v!==null&&o.jsx(e3,{projectId:v.id,projectName:v.name,hasCommits:v.hasCommits,open:!0,onClose:()=>b(null),onCreated:H=>{S.expand(v.id),i({projectId:v.id,scope:{scopeType:"worktree",scopeId:H}}),b(null)}},v.id)]})}function Y(){if(!(t===null||!x.open))return o.jsx(JD,{scope:t.scope,onClose:x.toggle,onResize:x.setWidth,onAskAgent:(ee,I)=>{f({sessionId:ee,text:I}),h(ee)},dock:$5(C,x)},`${t.scope.scopeType}:${t.scope.scopeId}`)}function Z(ee,I){if(t===null)return o.jsx(EO,{workspaceId:ee,workspaceName:I,onRemoved:async()=>{await e.invalidateQueries({queryKey:mr})}},ee);const{projectId:ae,scope:le}=t;return le.scopeType==="worktree"?o.jsx(z5,{worktreeId:le.scopeId,projectId:ae,openSessionId:c,initialPrompt:d??void 0,workspaceName:I,filesPanel:x,onRemoved:()=>i({projectId:ae,scope:{scopeType:"project",scopeId:ae}}),onOpenWorkspace:()=>i(null),onOpenProject:()=>i({projectId:ae,scope:{scopeType:"project",scopeId:ae}})},le.scopeId):o.jsx(E5,{projectId:ae,workspaceId:ee,workspaceName:I,openSessionId:c,initialPrompt:d??void 0,filesPanel:x,onRemoved:()=>i(null),onOpenWorkspace:()=>i(null),onSelectWorktree:H=>i({projectId:ae,scope:{scopeType:"worktree",scopeId:H}})},ae)}}const dB={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};async function fB(e=dB){}function mB(){return new nE({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})}const nC=document.getElementById("root");if(!nC)throw new Error("#root not found in index.html");const pB=vE.createRoot(nC);pB.render(o.jsx(j.StrictMode,{children:o.jsx(lE,{client:mB(),children:o.jsx(hB,{})})}));fB();export{SB as a,Bt as c,bB as s};
|