@vinihcrosa/lumem-os 0.3.1 → 0.4.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.
@@ -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 qb=e=>{throw TypeError(e)};var Zf=(e,t,i)=>t.has(e)||qb("Cannot "+i);var N=(e,t,i)=>(Zf(e,t,"read from private field"),i?i.call(e):t.get(e)),_e=(e,t,i)=>t.has(e)?qb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ue=(e,t,i,n)=>(Zf(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),je=(e,t,i)=>(Zf(e,t,"access private method"),i);var Tu=(e,t,i,n)=>({set _(a){ue(e,t,a,i)},get _(){return N(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 Ak="modulepreload",Rk=function(e){return"/"+e},Pb={},Ft=function(t,i,n){let a=Promise.resolve();if(i&&i.length>0){let h=function(p){return Promise.all(p.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(p=>{if(p=Rk(p),p in Pb)return;Pb[p]=!0;const g=p.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":Ak,g||(b.as="script"),b.crossOrigin="",b.href=p,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 ${p}`)))})}))}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 Xf={exports:{}},xo={};/**
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 Hb;function Mk(){if(Hb)return xo;Hb=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 xo.Fragment=t,xo.jsx=i,xo.jsxs=i,xo}var Ib;function Dk(){return Ib||(Ib=1,Xf.exports=Mk()),Xf.exports}var o=Dk(),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(){}},Un,Jr,rl,ux,Bk=(ux=class extends ua{constructor(){super();_e(this,Un);_e(this,Jr);_e(this,rl);ue(this,rl,t=>{if(typeof window<"u"&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){N(this,Jr)||this.setEventListener(N(this,rl))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Jr))==null||t.call(this),ue(this,Jr,void 0))}setEventListener(t){var i;ue(this,rl,t),(i=N(this,Jr))==null||i.call(this),ue(this,Jr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,Un)!==t&&(ue(this,Un,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof N(this,Un)=="boolean"?N(this,Un):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Un=new WeakMap,Jr=new WeakMap,rl=new WeakMap,ux),Jp=new Bk,Lk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},en,Xp,hx,zk=(hx=class{constructor(){_e(this,en,Lk);_e(this,Xp,!1)}setTimeoutProvider(e){ue(this,en,e)}setTimeout(e,t){return N(this,en).setTimeout(e,t)}clearTimeout(e){N(this,en).clearTimeout(e)}setInterval(e,t){return N(this,en).setInterval(e,t)}clearInterval(e){N(this,en).clearInterval(e)}},en=new WeakMap,Xp=new WeakMap,hx),In=new zk;function qk(e){setTimeout(e,0)}var Pk=typeof window>"u"||"Deno"in globalThis;function fs(){}function Hk(e,t){return typeof e=="function"?e(t):e}function Am(e){return typeof e=="number"&&e>=0&&e!==1/0}function jx(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 Fb(e,t){const{type:i="all",exact:n,fetchStatus:a,predicate:c,queryKey:h,stale:d}=e;if(h){if(n){if(t.queryHash!==e_(h,t.options))return!1}else if(!yl(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(!yl(t.options.mutationKey,c))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function e_(e,t){return((t==null?void 0:t.queryKeyHashFn)||ea)(e)}function ea(e){return JSON.stringify(e,(t,i)=>Rm(i)?Object.keys(i).sort().reduce((n,a)=>(n[a]=i[a],n),{}):i)}function yl(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(!yl(e[n],t[n]))return!1;return!0}const i=Object.keys(t);for(const n of i)if(!yl(e[n],t[n]))return!1;return!0}return!1}var Ik=Object.prototype.hasOwnProperty;function t_(e,t,i=0){if(e===t)return e;if(i>500)return t;const n=Kb(e)&&Kb(t);if(!n&&!(Rm(e)&&Rm(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 p=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:Ik.call(e,v))&&p++;continue}if(b===null||S===null||typeof b!="object"||typeof S!="object"){f[v]=S;continue}const x=t_(b,S,i+1);f[v]=x,x===b&&p++}return c===d&&p===c?e:f}function Ho(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 Kb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Rm(e){if(!$b(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!$b(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $b(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fk(e){return new Promise(t=>{In.setTimeout(t,e)})}function Mm(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?t_(e,t):t}function Uk(e,t,i=0){const n=[...e,t];return i&&n.length>i?n.slice(1):n}function Kk(e,t,i=0){const n=[t,...e];return i&&n.length>i?n.slice(0,-1):n}var s_=Symbol();function kx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===s_?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function i_(e,t){return typeof e=="function"?e(...t):!!e}function $k(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 Io=(()=>{let e=()=>Pk;return{isServer(){return e()},setIsServer(t){e=t}}})();function Dm(){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 Wk=qk;function Vk(){let e=[],t=0,i=d=>{d()},n=d=>{d()},a=Wk;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=Vk(),nl,tn,al,dx,Yk=(dx=class extends ua{constructor(){super();_e(this,nl,!0);_e(this,tn);_e(this,al);ue(this,al,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(){N(this,tn)||this.setEventListener(N(this,al))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,tn))==null||t.call(this),ue(this,tn,void 0))}setEventListener(t){var i;ue(this,al,t),(i=N(this,tn))==null||i.call(this),ue(this,tn,t(this.setOnline.bind(this)))}setOnline(t){N(this,nl)!==t&&(ue(this,nl,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,nl)}},nl=new WeakMap,tn=new WeakMap,al=new WeakMap,dx),nh=new Yk;function Gk(e){return Math.min(1e3*2**e,3e4)}function Ex(e){return(e??"online")==="online"?nh.isOnline():!0}var Bm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Nx(e){let t=!1,i=0,n;const a=Dm(),c=()=>a.status!=="pending",h=w=>{var k;if(!c()){const E=new Bm(w);b(E),(k=e.onCancel)==null||k.call(e,E)}},d=()=>{t=!0},f=()=>{t=!1},p=()=>Jp.isFocused()&&(e.networkMode==="always"||nh.isOnline())&&e.canRun(),g=()=>Ex(e.networkMode)&&e.canRun(),v=w=>{c()||(n==null||n(),a.resolve(w))},b=w=>{c()||(n==null||n(),a.reject(w))},S=()=>new Promise(w=>{var k;n=E=>{(c()||p())&&w(E)},(k=e.onPause)==null||k.call(e)}).then(()=>{var w;n=void 0,c()||(w=e.onContinue)==null||w.call(e)}),x=()=>{if(c())return;let w;const k=i===0?e.initialPromise:void 0;try{w=k??e.fn()}catch(E){w=Promise.reject(E)}Promise.resolve(w).then(v).catch(E=>{var Z;if(c())return;const L=e.retry??(Io.isServer()?0:3),D=e.retryDelay??Gk,M=typeof D=="function"?D(i,E):D,$=L===!0||typeof L=="number"&&i<L||typeof L=="function"&&L(i,E);if(t||!$){b(E);return}i++,(Z=e.onFail)==null||Z.call(e,i,E),Fk(M).then(()=>p()?void 0:S()).then(()=>{t?b(E):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,fx,Tx=(fx=class{constructor(){_e(this,Kn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Am(this.gcTime)&&ue(this,Kn,In.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Io.isServer()?1/0:300*1e3))}clearGcTimeout(){N(this,Kn)!==void 0&&(In.clearTimeout(N(this,Kn)),ue(this,Kn,void 0))}},Kn=new WeakMap,fx);function Qk(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 p=async()=>{let w=!1;const k=D=>{$k(D,()=>t.signal,()=>w=!0)},E=kx(t.options,t.fetchOptions),L=async(D,M,$)=>{if(w)return Promise.reject(t.signal.reason);if(M==null&&D.pages.length)return Promise.resolve(D);const K=(()=>{const oe={client:t.client,queryKey:t.queryKey,pageParam:M,direction:$?"backward":"forward",meta:t.options.meta};return k(oe),oe})(),X=await E(K),{maxPages:z}=t.options,le=$?Kk:Uk;return{pages:le(D.pages,X,z),pageParams:le(D.pageParams,M,z)}};if(a&&c.length){const D=a==="backward",M=D?Zk:Wb,$={pages:c,pageParams:h},Z=M(n,$);d=await L($,Z,D)}else{const D=e??c.length;do{const M=f===0?h[0]??n.initialPageParam:Wb(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 w,k;return(k=(w=t.options).persister)==null?void 0:k.call(w,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=p}}}function Wb(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 Zk(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 ll,$n,ol,ci,Wn,Vt,Qo,Vn,Ws,Ox,lr,mx,Xk=(mx=class extends Tx{constructor(t){super();_e(this,Ws);_e(this,ll);_e(this,$n);_e(this,ol);_e(this,ci);_e(this,Wn);_e(this,Vt);_e(this,Qo);_e(this,Vn);ue(this,Vn,!1),ue(this,Qo,t.defaultOptions),this.setOptions(t.options),this.observers=[],ue(this,Wn,t.client),ue(this,ci,N(this,Wn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ue(this,$n,Yb(this.options)),this.state=t.state??N(this,$n),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return N(this,ll)}get promise(){var t;return(t=N(this,Vt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,Qo),...t},t!=null&&t._type&&ue(this,ll,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=Yb(this.options);i.data!==void 0&&(this.setState(Vb(i.data,i.dataUpdatedAt)),ue(this,$n,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,ci).remove(this)}setData(t,i){const n=Mm(this.state.data,t,this.options);return je(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){je(this,Ws,lr).call(this,{type:"setState",state:t})}cancel(t){var n,a;const i=(n=N(this,Vt))==null?void 0:n.promise;return(a=N(this,Vt))==null||a.cancel(t),i?i.then(fs).catch(fs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return N(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===s_||!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:!jx(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=N(this,Vt))==null||i.continue()}onOnline(){var i;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=N(this,Vt))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(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||(N(this,Vt)&&(N(this,Vn)||je(this,Ws,Ox).call(this)?N(this,Vt).cancel({revert:!0}):N(this,Vt).cancelRetry()),this.scheduleGc()),N(this,ci).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||je(this,Ws,lr).call(this,{type:"invalidate"})}async fetch(t,i){var p,g,v,b,S,x,w,k,E,L,D;if(this.state.fetchStatus!=="idle"&&((p=N(this,Vt))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(N(this,Vt))return N(this,Vt).continueRetry(),N(this,Vt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find($=>$.options.queryFn);M&&this.setOptions(M.options)}const n=new AbortController,a=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(ue(this,Vn,!0),n.signal)})},c=()=>{const M=kx(this.options,i),Z=(()=>{const K={client:N(this,Wn),queryKey:this.queryKey,meta:this.meta};return a(K),K})();return ue(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:N(this,Wn),state:this.state,fetchFn:c};return a(M),M})(),f=N(this,ll)==="infinite"?Qk(this.options.pages):this.options.behavior;f==null||f.onFetch(d,this),ue(this,ol,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=d.fetchOptions)==null?void 0:g.meta))&&je(this,Ws,lr).call(this,{type:"fetch",meta:(v=d.fetchOptions)==null?void 0:v.meta}),ue(this,Vt,Nx({initialPromise:i==null?void 0:i.initialPromise,fn:d.fetchFn,onCancel:M=>{M instanceof Bm&&M.revert&&this.setState({...N(this,ol),fetchStatus:"idle"}),n.abort()},onFail:(M,$)=>{je(this,Ws,lr).call(this,{type:"failed",failureCount:M,error:$})},onPause:()=>{je(this,Ws,lr).call(this,{type:"pause"})},onContinue:()=>{je(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 N(this,Vt).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(S=(b=N(this,ci).config).onSuccess)==null||S.call(b,M,this),(w=(x=N(this,ci).config).onSettled)==null||w.call(x,M,this.state.error,this),M}catch(M){if(M instanceof Bm){if(M.silent)return N(this,Vt).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw je(this,Ws,lr).call(this,{type:"error",error:M}),(E=(k=N(this,ci).config).onError)==null||E.call(k,M,this),(D=(L=N(this,ci).config).onSettled)==null||D.call(L,this.state.data,M,this),M}finally{this.scheduleGc()}}},ll=new WeakMap,$n=new WeakMap,ol=new WeakMap,ci=new WeakMap,Wn=new WeakMap,Vt=new WeakMap,Qo=new WeakMap,Vn=new WeakMap,Ws=new WeakSet,Ox=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,...Ax(n.data,this.options),fetchMeta:t.meta??null};case"success":const a={...n,...Vb(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ue(this,ol,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()}),N(this,ci).notify({query:this,type:"updated",action:t})})},mx);function Ax(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ex(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Vb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Yb(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,Zo,gs,Yn,cl,cr,sn,Xo,ul,hl,Gn,Qn,rn,dl,rt,Oo,Lm,zm,qm,Pm,Hm,Im,Fm,Rx,px,r_=(px=class extends ua{constructor(t,i){super();_e(this,rt);_e(this,Ts);_e(this,Ye);_e(this,Zo);_e(this,gs);_e(this,Yn);_e(this,cl);_e(this,cr);_e(this,sn);_e(this,Xo);_e(this,ul);_e(this,hl);_e(this,Gn);_e(this,Qn);_e(this,rn);_e(this,dl,new Set);this.options=i,ue(this,Ts,t),ue(this,sn,null),ue(this,cr,Dm()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,Ye).addObserver(this),Gb(N(this,Ye),this.options)?je(this,rt,Oo).call(this):this.updateResult(),je(this,rt,Pm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Um(N(this,Ye),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Um(N(this,Ye),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,je(this,rt,Hm).call(this),je(this,rt,Im).call(this),N(this,Ye).removeObserver(this)}setOptions(t){const i=this.options,n=N(this,Ye);if(this.options=N(this,Ts).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Vs(this.options.enabled,N(this,Ye))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");je(this,rt,Fm).call(this),N(this,Ye).setOptions(this.options),i._defaulted&&!Ho(this.options,i)&&N(this,Ts).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,Ye),observer:this});const a=this.hasListeners();a&&Qb(N(this,Ye),n,this.options,i)&&je(this,rt,Oo).call(this),this.updateResult(),a&&(N(this,Ye)!==n||Vs(this.options.enabled,N(this,Ye))!==Vs(i.enabled,N(this,Ye))||mn(this.options.staleTime,N(this,Ye))!==mn(i.staleTime,N(this,Ye)))&&je(this,rt,Lm).call(this);const c=je(this,rt,zm).call(this);a&&(N(this,Ye)!==n||Vs(this.options.enabled,N(this,Ye))!==Vs(i.enabled,N(this,Ye))||c!==N(this,rn))&&je(this,rt,qm).call(this,c)}getOptimisticResult(t){const i=N(this,Ts).getQueryCache().build(N(this,Ts),t),n=this.createResult(i,t);return eE(this,n)&&(ue(this,gs,n),ue(this,cl,this.options),ue(this,Yn,N(this,Ye).state)),n}getCurrentResult(){return N(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&&N(this,cr).status==="pending"&&N(this,cr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(t){N(this,dl).add(t)}getCurrentQuery(){return N(this,Ye)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=N(this,Ts).defaultQueryOptions(t),n=N(this,Ts).getQueryCache().build(N(this,Ts),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(t){return je(this,rt,Oo).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,gs)))}createResult(t,i){var z;const n=N(this,Ye),a=this.options,c=N(this,gs),h=N(this,Yn),d=N(this,cl),p=t!==n?t.state:N(this,Zo),{state:g}=t;let v={...g},b=!1,S;if(i._optimisticResults){const le=this.hasListeners(),oe=!le&&Gb(t,i),q=le&&Qb(t,n,i,a);(oe||q)&&(v={...v,...Ax(g.data,t.options)}),i._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:k}=v;S=v.data;let E=!1;if(i.placeholderData!==void 0&&S===void 0&&k==="pending"){let le;c!=null&&c.isPlaceholderData&&i.placeholderData===(d==null?void 0:d.placeholderData)?(le=c.data,E=!0):le=typeof i.placeholderData=="function"?i.placeholderData((z=N(this,hl))==null?void 0:z.state.data,N(this,hl)):i.placeholderData,le!==void 0&&(k="success",S=Mm(c==null?void 0:c.data,le,i),b=!0)}if(i.select&&S!==void 0&&!E)if(c&&S===(h==null?void 0:h.data)&&i.select===N(this,Xo))S=N(this,ul);else try{ue(this,Xo,i.select),S=i.select(S),S=Mm(c==null?void 0:c.data,S,i),ue(this,ul,S),ue(this,sn,null)}catch(le){ue(this,sn,le)}N(this,sn)&&(x=N(this,sn),S=N(this,ul),w=Date.now(),k="error");const L=v.fetchStatus==="fetching",D=k==="pending",M=k==="error",$=D&&L,Z=S!==void 0,X={status:k,fetchStatus:v.fetchStatus,isPending:D,isSuccess:k==="success",isError:M,isInitialLoading:$,isLoading:$,data:S,dataUpdatedAt:v.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:v.dataUpdateCount>p.dataUpdateCount||v.errorUpdateCount>p.errorUpdateCount,isFetching:L,isRefetching:L&&!D,isLoadingError:M&&!Z,isPaused:v.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:M&&Z,isStale:n_(t,i),refetch:this.refetch,promise:N(this,cr),isEnabled:Vs(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const le=X.data!==void 0,oe=X.status==="error"&&!le,q=se=>{oe?se.reject(X.error):le&&se.resolve(X.data)},P=()=>{const se=ue(this,cr,X.promise=Dm());q(se)},re=N(this,cr);switch(re.status){case"pending":t.queryHash===n.queryHash&&q(re);break;case"fulfilled":(oe||X.data!==re.value)&&P();break;case"rejected":(!oe||X.error!==re.reason)&&P();break}}return X}updateResult(){const t=N(this,gs),i=this.createResult(N(this,Ye),this.options);if(ue(this,Yn,N(this,Ye).state),ue(this,cl,this.options),N(this,Yn).data!==void 0&&ue(this,hl,N(this,Ye)),Ho(i,t))return;ue(this,gs,i);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,c=typeof a=="function"?a():a;if(c==="all"||!c&&!N(this,dl).size)return!0;const h=new Set(c??N(this,dl));return this.options.throwOnError&&h.add("error"),Object.keys(N(this,gs)).some(d=>{const f=d;return N(this,gs)[f]!==t[f]&&h.has(f)})};je(this,rt,Rx).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&je(this,rt,Pm).call(this)}},Ts=new WeakMap,Ye=new WeakMap,Zo=new WeakMap,gs=new WeakMap,Yn=new WeakMap,cl=new WeakMap,cr=new WeakMap,sn=new WeakMap,Xo=new WeakMap,ul=new WeakMap,hl=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,rn=new WeakMap,dl=new WeakMap,rt=new WeakSet,Oo=function(t){je(this,rt,Fm).call(this);let i=N(this,Ye).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(fs)),i},Lm=function(){je(this,rt,Hm).call(this);const t=mn(this.options.staleTime,N(this,Ye));if(Io.isServer()||N(this,gs).isStale||!Am(t))return;const n=jx(N(this,gs).dataUpdatedAt,t)+1;ue(this,Gn,In.setTimeout(()=>{N(this,gs).isStale||this.updateResult()},n))},zm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,Ye)):this.options.refetchInterval)??!1},qm=function(t){je(this,rt,Im).call(this),ue(this,rn,t),!(Io.isServer()||Vs(this.options.enabled,N(this,Ye))===!1||!Am(N(this,rn))||N(this,rn)===0)&&ue(this,Qn,In.setInterval(()=>{(this.options.refetchIntervalInBackground||Jp.isFocused())&&je(this,rt,Oo).call(this)},N(this,rn)))},Pm=function(){je(this,rt,Lm).call(this),je(this,rt,qm).call(this,je(this,rt,zm).call(this))},Hm=function(){N(this,Gn)!==void 0&&(In.clearTimeout(N(this,Gn)),ue(this,Gn,void 0))},Im=function(){N(this,Qn)!==void 0&&(In.clearInterval(N(this,Qn)),ue(this,Qn,void 0))},Fm=function(){const t=N(this,Ts).getQueryCache().build(N(this,Ts),this.options);if(t===N(this,Ye))return;const i=N(this,Ye);ue(this,Ye,t),ue(this,Zo,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},Rx=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(N(this,gs))}),N(this,Ts).getQueryCache().notify({query:N(this,Ye),type:"observerResultsUpdated"})})},px);function Jk(e,t){return Vs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Vs(t.retryOnMount,e)===!1)}function Gb(e,t){return Jk(e,t)||e.state.data!==void 0&&Um(e,t,t.refetchOnMount)}function Um(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&&n_(e,t)}return!1}function Qb(e,t,i,n){return(e!==t||Vs(n.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&n_(e,i)}function n_(e,t){return Vs(t.enabled,e)!==!1&&e.isStaleByTime(mn(t.staleTime,e))}function eE(e,t){return!Ho(e.getCurrentResult(),t)}var Jo,Ai,ds,Zn,Ri,Yr,_x,tE=(_x=class extends Tx{constructor(t){super();_e(this,Ri);_e(this,Jo);_e(this,Ai);_e(this,ds);_e(this,Zn);ue(this,Jo,t.client),this.mutationId=t.mutationId,ue(this,ds,t.mutationCache),ue(this,Ai,[]),this.state=t.state||Mx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,Ai).includes(t)||(N(this,Ai).push(t),this.clearGcTimeout(),N(this,ds).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ue(this,Ai,N(this,Ai).filter(i=>i!==t)),this.scheduleGc(),N(this,ds).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,Ai).length||(this.state.status==="pending"?this.scheduleGc():N(this,ds).remove(this))}continue(){var t;return((t=N(this,Zn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,d,f,p,g,v,b,S,x,w,k,E,L,D,M,$,Z,K;const i=()=>{je(this,Ri,Yr).call(this,{type:"continue"})},n={client:N(this,Jo),meta:this.options.meta,mutationKey:this.options.mutationKey};ue(this,Zn,Nx({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(X,z)=>{je(this,Ri,Yr).call(this,{type:"failed",failureCount:X,error:z})},onPause:()=>{je(this,Ri,Yr).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,ds).canRun(this)}));const a=this.state.status==="pending",c=!N(this,Zn).canStart();try{if(a)i();else{je(this,Ri,Yr).call(this,{type:"pending",variables:t,isPaused:c}),N(this,ds).config.onMutate&&await N(this,ds).config.onMutate(t,this,n);const z=await((d=(h=this.options).onMutate)==null?void 0:d.call(h,t,n));z!==this.state.context&&je(this,Ri,Yr).call(this,{type:"pending",context:z,variables:t,isPaused:c})}const X=await N(this,Zn).start();return await((p=(f=N(this,ds).config).onSuccess)==null?void 0:p.call(f,X,t,this.state.context,this,n)),await((v=(g=this.options).onSuccess)==null?void 0:v.call(g,X,t,this.state.context,n)),await((S=(b=N(this,ds).config).onSettled)==null?void 0:S.call(b,X,null,this.state.variables,this.state.context,this,n)),await((w=(x=this.options).onSettled)==null?void 0:w.call(x,X,null,t,this.state.context,n)),je(this,Ri,Yr).call(this,{type:"success",data:X}),X}catch(X){try{await((E=(k=N(this,ds).config).onError)==null?void 0:E.call(k,X,t,this.state.context,this,n))}catch(z){Promise.reject(z)}try{await((D=(L=this.options).onError)==null?void 0:D.call(L,X,t,this.state.context,n))}catch(z){Promise.reject(z)}try{await(($=(M=N(this,ds).config).onSettled)==null?void 0:$.call(M,void 0,X,this.state.variables,this.state.context,this,n))}catch(z){Promise.reject(z)}try{await((K=(Z=this.options).onSettled)==null?void 0:K.call(Z,void 0,X,t,this.state.context,n))}catch(z){Promise.reject(z)}throw je(this,Ri,Yr).call(this,{type:"error",error:X}),X}finally{N(this,ds).runNext(this)}}},Jo=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(()=>{N(this,Ai).forEach(n=>{n.onMutationUpdate(t)}),N(this,ds).notify({mutation:this,type:"updated",action:t})})},_x);function Mx(){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,ec,gx,sE=(gx=class extends ua{constructor(t={}){super();_e(this,ur);_e(this,yi);_e(this,ec);this.config=t,ue(this,ur,new Set),ue(this,yi,new Map),ue(this,ec,0)}build(t,i,n){const a=new tE({client:t,mutationCache:this,mutationId:++Tu(this,ec)._,options:t.defaultMutationOptions(i),state:n});return this.add(a),a}add(t){N(this,ur).add(t);const i=Ou(t);if(typeof i=="string"){const n=N(this,yi).get(i);n?n.push(t):N(this,yi).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,ur).delete(t)){const i=Ou(t);if(typeof i=="string"){const n=N(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&&N(this,yi).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Ou(t);if(typeof i=="string"){const n=N(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=Ou(t);if(typeof i=="string"){const a=(n=N(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(()=>{N(this,ur).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,ur).clear(),N(this,yi).clear()})}getAll(){return Array.from(N(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,ec=new WeakMap,gx);function Ou(e){var t;return(t=e.options.scope)==null?void 0:t.id}var hr,nn,Os,dr,_r,Zu,Km,vx,iE=(vx=class extends ua{constructor(i,n){super();_e(this,_r);_e(this,hr);_e(this,nn);_e(this,Os);_e(this,dr);ue(this,hr,i),this.setOptions(n),this.bindMethods(),je(this,_r,Zu).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=N(this,hr).defaultMutationOptions(i),Ho(this.options,n)||N(this,hr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,Os),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ea(n.mutationKey)!==ea(this.options.mutationKey)?this.reset():((a=N(this,Os))==null?void 0:a.state.status)==="pending"&&N(this,Os).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=N(this,Os))==null||i.removeObserver(this)}onMutationUpdate(i){je(this,_r,Zu).call(this),je(this,_r,Km).call(this,i)}getCurrentResult(){return N(this,nn)}reset(){var i;(i=N(this,Os))==null||i.removeObserver(this),ue(this,Os,void 0),je(this,_r,Zu).call(this),je(this,_r,Km).call(this)}mutate(i,n){var a;return ue(this,dr,n),(a=N(this,Os))==null||a.removeObserver(this),ue(this,Os,N(this,hr).getMutationCache().build(N(this,hr),this.options)),N(this,Os).addObserver(this),N(this,Os).execute(i)}},hr=new WeakMap,nn=new WeakMap,Os=new WeakMap,dr=new WeakMap,_r=new WeakSet,Zu=function(){var n;const i=((n=N(this,Os))==null?void 0:n.state)??Mx();ue(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})},Km=function(i){Ct.batch(()=>{var n,a,c,h,d,f,p,g;if(N(this,dr)&&this.hasListeners()){const v=N(this,nn).variables,b=N(this,nn).context,S={client:N(this,hr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(a=(n=N(this,dr)).onSuccess)==null||a.call(n,i.data,v,b,S)}catch(x){Promise.reject(x)}try{(h=(c=N(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=N(this,dr)).onError)==null||f.call(d,i.error,v,b,S)}catch(x){Promise.reject(x)}try{(g=(p=N(this,dr)).onSettled)==null||g.call(p,void 0,i.error,v,b,S)}catch(x){Promise.reject(x)}}}this.listeners.forEach(v=>{v(N(this,nn))})})},vx);function Zb(e,t){const i=new Set(t);return e.filter(n=>!i.has(n))}function rE(e,t,i){const n=e.slice(0);return n[t]=i,n}var fl,As,ml,Xn,$s,an,tc,sc,ic,rc,Kt,$m,Wm,Dx,Vm,Ym,Gm,yx,nE=(yx=class extends ua{constructor(t,i,n){super();_e(this,Kt);_e(this,fl);_e(this,As);_e(this,ml);_e(this,Xn);_e(this,$s);_e(this,an);_e(this,tc);_e(this,sc);_e(this,ic);_e(this,rc,[]);ue(this,fl,t),ue(this,Xn,n),ue(this,ml,[]),ue(this,$s,[]),ue(this,As,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&N(this,$s).forEach(t=>{t.subscribe(i=>{je(this,Kt,Ym).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,N(this,$s).forEach(t=>{t.destroy()})}setQueries(t,i){ue(this,ml,t),ue(this,Xn,i),Ct.batch(()=>{const n=N(this,$s),a=je(this,Kt,Vm).call(this,N(this,ml));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]),p=d||f,g=p?!0:h.some((v,b)=>{const S=N(this,As)[b];return!S||!Ho(v,S)});!p&&!g||(p&&(ue(this,rc,a),ue(this,$s,c)),ue(this,As,h),this.hasListeners()&&(p&&(Zb(n,c).forEach(v=>{v.destroy()}),Zb(c,n).forEach(v=>{v.subscribe(b=>{je(this,Kt,Ym).call(this,v,b)})})),je(this,Kt,Gm).call(this)))})}getCurrentResult(){return N(this,As)}getQueries(){return N(this,$s).map(t=>t.getCurrentQuery())}getObservers(){return N(this,$s)}getOptimisticResult(t,i){const n=je(this,Kt,Vm).call(this,t),a=n.map(h=>h.observer.getOptimisticResult(h.defaultedQueryOptions)),c=n.map(h=>h.defaultedQueryOptions.queryHash);return[a,h=>je(this,Kt,Wm).call(this,h??a,i,c),()=>je(this,Kt,$m).call(this,a,n)]}},fl=new WeakMap,As=new WeakMap,ml=new WeakMap,Xn=new WeakMap,$s=new WeakMap,an=new WeakMap,tc=new WeakMap,sc=new WeakMap,ic=new WeakMap,rc=new WeakMap,Kt=new WeakSet,$m=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)})})})},Wm=function(t,i,n){if(i){const a=N(this,ic),c=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((h,d)=>h!==a[d]));return(!N(this,an)||N(this,As)!==N(this,sc)||c||i!==N(this,tc))&&(ue(this,tc,i),ue(this,sc,N(this,As)),n!==void 0&&ue(this,ic,n),ue(this,an,t_(N(this,an),i(t)))),N(this,an)}return t},Dx=function(){var t;return((t=N(this,Xn))==null?void 0:t.combine)!==void 0&&N(this,$s).some((i,n)=>{var a;return i.options.suspense&&((a=N(this,As)[n])==null?void 0:a.data)===void 0})},Vm=function(t){const i=new Map;N(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=N(this,fl).defaultQueryOptions(a),d=((f=i.get(c.queryHash))==null?void 0:f.shift())??new r_(N(this,fl),c);n.push({defaultedQueryOptions:c,observer:d})}),n},Ym=function(t,i){const n=N(this,$s).indexOf(t);n!==-1&&(ue(this,As,rE(N(this,As),n,i)),je(this,Kt,Gm).call(this))},Gm=function(){var t;if(this.hasListeners()){const i=je(this,Kt,$m).call(this,N(this,As),N(this,rc)),n=je(this,Kt,Dx).call(this),a=N(this,an),c=n?a:je(this,Kt,Wm).call(this,i,(t=N(this,Xn))==null?void 0:t.combine);(n||a!==c)&&Ct.batch(()=>{this.listeners.forEach(h=>{h(N(this,As))})})}},yx),Mi,bx,aE=(bx=class extends ua{constructor(t={}){super();_e(this,Mi);this.config=t,ue(this,Mi,new Map)}build(t,i,n){const a=i.queryKey,c=i.queryHash??e_(a,i);let h=this.get(c);return h||(h=new Xk({client:t,queryKey:a,queryHash:c,options:t.defaultQueryOptions(i),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(h)),h}add(t){N(this,Mi).has(t.queryHash)||(N(this,Mi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=N(this,Mi).get(t.queryHash);i&&(t.destroy(),i===t&&N(this,Mi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,Mi).get(t)}getAll(){return[...N(this,Mi).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(n=>Fb(i,n))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(n=>Fb(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,bx),xt,ln,on,pl,_l,cn,gl,vl,Sx,lE=(Sx=class{constructor(e={}){_e(this,xt);_e(this,ln);_e(this,on);_e(this,pl);_e(this,_l);_e(this,cn);_e(this,gl);_e(this,vl);ue(this,xt,e.queryCache||new aE),ue(this,ln,e.mutationCache||new sE),ue(this,on,e.defaultOptions||{}),ue(this,pl,new Map),ue(this,_l,new Map),ue(this,cn,0)}mount(){Tu(this,cn)._++,N(this,cn)===1&&(ue(this,gl,Jp.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,xt).onFocus())})),ue(this,vl,nh.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,xt).onOnline())})))}unmount(){var e,t;Tu(this,cn)._--,N(this,cn)===0&&((e=N(this,gl))==null||e.call(this),ue(this,gl,void 0),(t=N(this,vl))==null||t.call(this),ue(this,vl,void 0))}isFetching(e){return N(this,xt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,ln).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=N(this,xt).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=N(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 N(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=N(this,xt).get(n.queryHash),c=a==null?void 0:a.state.data,h=Hk(t,c);if(h!==void 0)return N(this,xt).build(this,n).setData(h,{...i,manual:!0})}setQueriesData(e,t,i){return Ct.batch(()=>N(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=N(this,xt).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=N(this,xt);Ct.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=N(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(()=>N(this,xt).findAll(e).map(a=>a.cancel(i)));return Promise.all(n).then(fs).catch(fs)}invalidateQueries(e,t={}){return Ct.batch(()=>(N(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(()=>N(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=N(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 nh.isOnline()?N(this,ln).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,xt)}getMutationCache(){return N(this,ln)}getDefaultOptions(){return N(this,on)}setDefaultOptions(e){ue(this,on,e)}setQueryDefaults(e,t){N(this,pl).set(ea(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,pl).values()],i={};return t.forEach(n=>{yl(e,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(e,t){N(this,_l).set(ea(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,_l).values()],i={};return t.forEach(n=>{yl(e,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,on).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=e_(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===s_&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,on).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,xt).clear(),N(this,ln).clear()}},xt=new WeakMap,ln=new WeakMap,on=new WeakMap,pl=new WeakMap,_l=new WeakMap,cn=new WeakMap,gl=new WeakMap,vl=new WeakMap,Sx),Jf={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 Xb;function oE(){if(Xb)return Me;Xb=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"),p=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(){}},w=Object.assign,k={};function E(T,W,ne){this.props=T,this.context=W,this.refs=k,this.updater=ne||x}E.prototype.isReactComponent={},E.prototype.setState=function(T,W){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,W,"setState")},E.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function L(){}L.prototype=E.prototype;function D(T,W,ne){this.props=T,this.context=W,this.refs=k,this.updater=ne||x}var M=D.prototype=new L;M.constructor=D,w(M,E.prototype),M.isPureReactComponent=!0;var $=Array.isArray;function Z(){}var K={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function z(T,W,ne){var V=ne.ref;return{$$typeof:e,type:T,key:W,ref:V!==void 0?V:null,props:ne}}function le(T,W){return z(T.type,W,T.props)}function oe(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function q(T){var W={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(ne){return W[ne]})}var P=/\/+/g;function re(T,W){return typeof T=="object"&&T!==null&&T.key!=null?q(""+T.key):W.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(W){T.status==="pending"&&(T.status="fulfilled",T.value=W)},function(W){T.status==="pending"&&(T.status="rejected",T.reason=W)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function A(T,W,ne,V,he){var ge=typeof T;(ge==="undefined"||ge==="boolean")&&(T=null);var Ne=!1;if(T===null)Ne=!0;else switch(ge){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(T.$$typeof){case e:case t:Ne=!0;break;case g:return Ne=T._init,A(Ne(T._payload),W,ne,V,he)}}if(Ne)return he=he(T),Ne=V===""?"."+re(T,0):V,$(he)?(ne="",Ne!=null&&(ne=Ne.replace(P,"$&/")+"/"),A(he,W,ne,"",function(Rs){return Rs})):he!=null&&(oe(he)&&(he=le(he,ne+(he.key==null||T&&T.key===he.key?"":(""+he.key).replace(P,"$&/")+"/")+Ne)),W.push(he)),1;Ne=0;var kt=V===""?".":V+":";if($(T))for(var Xe=0;Xe<T.length;Xe++)V=T[Xe],ge=kt+re(V,Xe),Ne+=A(V,W,ne,ge,he);else if(Xe=S(T),typeof Xe=="function")for(T=Xe.call(T),Xe=0;!(V=T.next()).done;)V=V.value,ge=kt+re(V,Xe++),Ne+=A(V,W,ne,ge,he);else if(ge==="object"){if(typeof T.then=="function")return A(se(T),W,ne,V,he);throw W=String(T),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function U(T,W,ne){if(T==null)return T;var V=[],he=0;return A(T,V,"","",function(ge){return W.call(ne,ge,he++)}),V}function G(T){if(T._status===-1){var W=T._result;W=W(),W.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=W)}if(T._status===1)return T._result.default;throw T._result}var be=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=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(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ae={map:U,forEach:function(T,W,ne){U(T,function(){W.apply(this,arguments)},ne)},count:function(T){var W=0;return U(T,function(){W++}),W},toArray:function(T){return U(T,function(W){return W})||[]},only:function(T){if(!oe(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Me.Activity=v,Me.Children=ae,Me.Component=E,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=K,Me.__COMPILER_RUNTIME={__proto__:null,c:function(T){return K.H.useMemoCache(T)}},Me.cache=function(T){return function(){return T.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(T,W,ne){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var V=w({},T.props),he=T.key;if(W!=null)for(ge in W.key!==void 0&&(he=""+W.key),W)!X.call(W,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&W.ref===void 0||(V[ge]=W[ge]);var ge=arguments.length-2;if(ge===1)V.children=ne;else if(1<ge){for(var Ne=Array(ge),kt=0;kt<ge;kt++)Ne[kt]=arguments[kt+2];V.children=Ne}return z(T.type,he,V)},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,W,ne){var V,he={},ge=null;if(W!=null)for(V in W.key!==void 0&&(ge=""+W.key),W)X.call(W,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(he[V]=W[V]);var Ne=arguments.length-2;if(Ne===1)he.children=ne;else if(1<Ne){for(var kt=Array(Ne),Xe=0;Xe<Ne;Xe++)kt[Xe]=arguments[Xe+2];he.children=kt}if(T&&T.defaultProps)for(V in Ne=T.defaultProps,Ne)he[V]===void 0&&(he[V]=Ne[V]);return z(T,ge,he)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(T){return{$$typeof:d,render:T}},Me.isValidElement=oe,Me.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:G}},Me.memo=function(T,W){return{$$typeof:p,type:T,compare:W===void 0?null:W}},Me.startTransition=function(T){var W=K.T,ne={};K.T=ne;try{var V=T(),he=K.S;he!==null&&he(ne,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(Z,be)}catch(ge){be(ge)}finally{W!==null&&ne.types!==null&&(W.types=ne.types),K.T=W}},Me.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},Me.use=function(T){return K.H.use(T)},Me.useActionState=function(T,W,ne){return K.H.useActionState(T,W,ne)},Me.useCallback=function(T,W){return K.H.useCallback(T,W)},Me.useContext=function(T){return K.H.useContext(T)},Me.useDebugValue=function(){},Me.useDeferredValue=function(T,W){return K.H.useDeferredValue(T,W)},Me.useEffect=function(T,W){return K.H.useEffect(T,W)},Me.useEffectEvent=function(T){return K.H.useEffectEvent(T)},Me.useId=function(){return K.H.useId()},Me.useImperativeHandle=function(T,W,ne){return K.H.useImperativeHandle(T,W,ne)},Me.useInsertionEffect=function(T,W){return K.H.useInsertionEffect(T,W)},Me.useLayoutEffect=function(T,W){return K.H.useLayoutEffect(T,W)},Me.useMemo=function(T,W){return K.H.useMemo(T,W)},Me.useOptimistic=function(T,W){return K.H.useOptimistic(T,W)},Me.useReducer=function(T,W,ne){return K.H.useReducer(T,W,ne)},Me.useRef=function(T){return K.H.useRef(T)},Me.useState=function(T){return K.H.useState(T)},Me.useSyncExternalStore=function(T,W,ne){return K.H.useSyncExternalStore(T,W,ne)},Me.useTransition=function(){return K.H.useTransition()},Me.version="19.2.8",Me}var Jb;function a_(){return Jb||(Jb=1,Jf.exports=oE()),Jf.exports}var j=a_(),Bx=j.createContext(void 0),We=e=>{const t=j.useContext(Bx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cE=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),o.jsx(Bx.Provider,{value:e,children:t})),Lx=j.createContext(!1),zx=()=>j.useContext(Lx);Lx.Provider;function uE(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var hE=j.createContext(uE()),qx=()=>j.useContext(hE),Px=(e,t,i)=>{const n=i!=null&&i.state.error&&typeof e.throwOnError=="function"?i_(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Hx=e=>{j.useEffect(()=>{e.clearReset()},[e])},Ix=({result:e,errorResetBoundary:t,throwOnError:i,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||i_(i,[e.error,n])),Fx=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))}},dE=(e,t)=>e.isLoading&&e.isFetching&&!t,Qm=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zm=(e,t,i)=>t.fetchOptimistic(e).catch(()=>{i.clearReset()});function Ux({queries:e,...t},i){const n=We(),a=zx(),c=qx(),h=j.useMemo(()=>e.map(w=>{const k=n.defaultQueryOptions(w);return k._optimisticResults=a?"isRestoring":"optimistic",k}),[e,n,a]);h.forEach(w=>{Fx(w);const k=n.getQueryCache().get(w.queryHash);Px(w,c,k)}),Hx(c);const[d]=j.useState(()=>new nE(n,h,t)),[f,p,g]=d.getOptimisticResult(h,t.combine),v=!a&&t.subscribed!==!1;j.useSyncExternalStore(j.useCallback(w=>v?d.subscribe(Ct.batchCalls(w)):fs,[d,v]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),j.useEffect(()=>{d.setQueries(h,t)},[h,t,d]);const S=f.some((w,k)=>Qm(h[k],w))?f.flatMap((w,k)=>{const E=h[k];if(E&&Qm(E,w)){const L=new r_(n,E);return Zm(E,L,c)}return[]}):[];if(S.length>0)throw Promise.all(S);const x=f.find((w,k)=>{const E=h[k];return E&&Ix({result:w,errorResetBoundary:c,throwOnError:E.throwOnError,query:n.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(x!=null&&x.error)throw x.error;return p(g())}function fE(e,t,i){var S,x,w,k;const n=zx(),a=qx(),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,Fx(h),Px(h,a,d),Hx(a);const p=!c.getQueryCache().get(h.queryHash),[g]=j.useState(()=>new t(c,h)),v=g.getOptimisticResult(h),b=!n&&f;if(j.useSyncExternalStore(j.useCallback(E=>{const L=b?g.subscribe(Ct.batchCalls(E)):fs;return g.updateResult(),L},[g,b]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),j.useEffect(()=>{g.setOptions(h)},[h,g]),Qm(h,v))throw Zm(h,g,a);if(Ix({result:v,errorResetBoundary:a,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw v.error;if((k=(w=c.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||k.call(w,h,v),h.experimental_prefetchInRender&&!Io.isServer()&&dE(v,n)){const E=p?Zm(h,g,a):d==null?void 0:d.promise;E==null||E.catch(fs).finally(()=>{g.updateResult()})}return h.notifyOnChangeProps?v:g.trackResult(v)}function Ee(e,t){return fE(e,r_)}function He(e,t){const i=We(),[n]=j.useState(()=>new iE(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&&i_(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:c,mutateAsync:a.mutate}}var em={exports:{}},wo={},tm={exports:{}},sm={};/**
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 eS;function mE(){return eS||(eS=1,(function(e){function t(A,U){var G=A.length;A.push(U);e:for(;0<G;){var be=G-1>>>1,ae=A[be];if(0<a(ae,U))A[be]=U,A[G]=ae,G=be;else break e}}function i(A){return A.length===0?null:A[0]}function n(A){if(A.length===0)return null;var U=A[0],G=A.pop();if(G!==U){A[0]=G;e:for(var be=0,ae=A.length,T=ae>>>1;be<T;){var W=2*(be+1)-1,ne=A[W],V=W+1,he=A[V];if(0>a(ne,G))V<ae&&0>a(he,ne)?(A[be]=he,A[V]=G,be=V):(A[be]=ne,A[W]=G,be=W);else if(V<ae&&0>a(he,G))A[be]=he,A[V]=G,be=V;else break e}}return U}function a(A,U){var G=A.sortIndex-U.sortIndex;return G!==0?G:A.id-U.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=[],p=[],g=1,v=null,b=3,S=!1,x=!1,w=!1,k=!1,E=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function M(A){for(var U=i(p);U!==null;){if(U.callback===null)n(p);else if(U.startTime<=A)n(p),U.sortIndex=U.expirationTime,t(f,U);else break;U=i(p)}}function $(A){if(w=!1,M(A),!x)if(i(f)!==null)x=!0,Z||(Z=!0,q());else{var U=i(p);U!==null&&se($,U.startTime-A)}}var Z=!1,K=-1,X=5,z=-1;function le(){return k?!0:!(e.unstable_now()-z<X)}function oe(){if(k=!1,Z){var A=e.unstable_now();z=A;var U=!0;try{e:{x=!1,w&&(w=!1,L(K),K=-1),S=!0;var G=b;try{t:{for(M(A),v=i(f);v!==null&&!(v.expirationTime>A&&le());){var be=v.callback;if(typeof be=="function"){v.callback=null,b=v.priorityLevel;var ae=be(v.expirationTime<=A);if(A=e.unstable_now(),typeof ae=="function"){v.callback=ae,M(A),U=!0;break t}v===i(f)&&n(f),M(A)}else n(f);v=i(f)}if(v!==null)U=!0;else{var T=i(p);T!==null&&se($,T.startTime-A),U=!1}}break e}finally{v=null,b=G,S=!1}U=void 0}}finally{U?q():Z=!1}}}var q;if(typeof D=="function")q=function(){D(oe)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,re=P.port2;P.port1.onmessage=oe,q=function(){re.postMessage(null)}}else q=function(){E(oe,0)};function se(A,U){K=E(function(){A(e.unstable_now())},U)}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"):X=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 U=3;break;default:U=b}var G=b;b=U;try{return A()}finally{b=G}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(A,U){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var G=b;b=A;try{return U()}finally{b=G}},e.unstable_scheduleCallback=function(A,U,G){var be=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?be+G:be):G=be,A){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=G+ae,A={id:g++,callback:U,priorityLevel:A,startTime:G,expirationTime:ae,sortIndex:-1},G>be?(A.sortIndex=G,t(p,A),i(f)===null&&A===i(p)&&(w?(L(K),K=-1):w=!0,se($,G-be))):(A.sortIndex=ae,t(f,A),x||S||(x=!0,Z||(Z=!0,q()))),A},e.unstable_shouldYield=le,e.unstable_wrapCallback=function(A){var U=b;return function(){var G=b;b=U;try{return A.apply(this,arguments)}finally{b=G}}}})(sm)),sm}var tS;function pE(){return tS||(tS=1,tm.exports=mE()),tm.exports}var im={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 sS;function _E(){if(sS)return us;sS=1;var e=a_();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+p+" 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,p,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:v==null?null:""+v,children:f,containerInfo:p,implementation:g}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return us.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,us.createPortal=function(f,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(f,p,null,g)},us.flushSync=function(f){var p=h.T,g=n.p;try{if(h.T=null,n.p=2,f)return f()}finally{h.T=p,n.p=g,n.d.f()}},us.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,n.d.C(f,p))},us.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},us.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var g=p.as,v=d(g,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?n.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:S}):g==="script"&&n.d.X(f,{crossOrigin:v,integrity:b,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},us.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=d(p.as,p.crossOrigin);n.d.M(f,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&n.d.M(f)},us.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,v=d(g,p.crossOrigin);n.d.L(f,g,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},us.preloadModule=function(f,p){if(typeof f=="string")if(p){var g=d(p.as,p.crossOrigin);n.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else n.d.m(f)},us.requestFormReset=function(f){n.d.r(f)},us.unstable_batchedUpdates=function(f,p){return f(p)},us.useFormState=function(f,p,g){return h.H.useFormState(f,p,g)},us.useFormStatus=function(){return h.H.useHostTransitionStatus()},us.version="19.2.8",us}var iS;function gE(){if(iS)return im.exports;iS=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(),im.exports=_E(),im.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 rS;function vE(){if(rS)return wo;rS=1;var e=pE(),t=a_(),i=gE();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 p(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 m=l.return;if(m===null)break;var _=m.alternate;if(_===null){if(u=m.return,u!==null){l=u;continue}break}if(m.child===_.child){for(_=m.child;_;){if(_===l)return f(m),s;if(_===u)return f(m),r;_=_.sibling}throw Error(n(188))}if(l.return!==u.return)l=m,u=_;else{for(var y=!1,C=m.child;C;){if(C===l){y=!0,l=m,u=_;break}if(C===u){y=!0,u=m,l=_;break}C=C.sibling}if(!y){for(C=_.child;C;){if(C===l){y=!0,l=_,u=m;break}if(C===u){y=!0,u=_,l=m;break}C=C.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"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),D=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),z=Symbol.for("react.activity"),le=Symbol.for("react.memo_cache_sentinel"),oe=Symbol.iterator;function q(s){return s===null||typeof s!="object"?null:(s=oe&&s[oe]||s["@@iterator"],typeof s=="function"?s:null)}var P=Symbol.for("react.client.reference");function re(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===P?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case w:return"Fragment";case E:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case Z:return"SuspenseList";case z: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 K:return r=s.displayName||null,r!==null?r:re(s.type)||"Memo";case X: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,U=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},be=[],ae=-1;function T(s){return{current:s}}function W(s){0>ae||(s.current=be[ae],be[ae]=null,ae--)}function ne(s,r){ae++,be[ae]=s.current,s.current=r}var V=T(null),he=T(null),ge=T(null),Ne=T(null);function kt(s,r){switch(ne(ge,r),ne(he,s),ne(V,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?lb(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=lb(r),s=ob(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}W(V),ne(V,s)}function Xe(){W(V),W(he),W(ge)}function Rs(s){s.memoizedState!==null&&ne(Ne,s);var r=V.current,l=ob(r,s.type);r!==l&&(ne(he,s),ne(V,l))}function xi(s){he.current===s&&(W(V),W(he)),Ne.current===s&&(W(Ne),vo._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 Mh=!1;function Dh(s,r){if(!s||Mh)return"";Mh=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(Y){var F=Y}Reflect.construct(s,[],ee)}else{try{ee.call()}catch(Y){F=Y}s.call(ee.prototype)}}else{try{throw Error()}catch(Y){F=Y}(ee=s())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(Y){if(Y&&F&&typeof Y.stack=="string")return[Y.stack,F.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=u.DetermineComponentFrameRoot(),y=_[0],C=_[1];if(y&&C){var O=y.split(`
45
+ `),I=C.split(`
46
+ `);for(m=u=0;u<O.length&&!O[u].includes("DetermineComponentFrameRoot");)u++;for(;m<I.length&&!I[m].includes("DetermineComponentFrameRoot");)m++;if(u===O.length||m===I.length)for(u=O.length-1,m=I.length-1;1<=u&&0<=m&&O[u]!==I[m];)m--;for(;1<=u&&0<=m;u--,m--)if(O[u]!==I[m]){if(u!==1||m!==1)do if(u--,m--,0>m||O[u]!==I[m]){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<=m);break}}}finally{Mh=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?mi(l):""}function oC(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 Dh(s.type,!1);case 11:return Dh(s.type.render,!1);case 1:return Dh(s.type,!0);case 31:return mi("Activity");default:return""}}function q_(s){try{var r="",l=null;do r+=oC(s,l),l=s,s=s.return;while(s);return r}catch(u){return`
48
+ Error generating stack: `+u.message+`
49
+ `+u.stack}}var Bh=Object.prototype.hasOwnProperty,Lh=e.unstable_scheduleCallback,zh=e.unstable_cancelCallback,cC=e.unstable_shouldYield,uC=e.unstable_requestPaint,Ms=e.unstable_now,hC=e.unstable_getCurrentPriorityLevel,P_=e.unstable_ImmediatePriority,H_=e.unstable_UserBlockingPriority,dc=e.unstable_NormalPriority,dC=e.unstable_LowPriority,I_=e.unstable_IdlePriority,fC=e.log,mC=e.unstable_setDisableYieldValue,Tl=null,Ds=null;function br(s){if(typeof fC=="function"&&mC(s),Ds&&typeof Ds.setStrictMode=="function")try{Ds.setStrictMode(Tl,s)}catch{}}var Bs=Math.clz32?Math.clz32:gC,pC=Math.log,_C=Math.LN2;function gC(s){return s>>>=0,s===0?32:31-(pC(s)/_C|0)|0}var fc=256,mc=262144,pc=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 _c(s,r,l){var u=s.pendingLanes;if(u===0)return 0;var m=0,_=s.suspendedLanes,y=s.pingedLanes;s=s.warmLanes;var C=u&134217727;return C!==0?(u=C&~_,u!==0?m=yn(u):(y&=C,y!==0?m=yn(y):l||(l=C&~s,l!==0&&(m=yn(l))))):(C=u&~_,C!==0?m=yn(C):y!==0?m=yn(y):l||(l=u&~s,l!==0&&(m=yn(l)))),m===0?0:r!==0&&r!==m&&(r&_)===0&&(_=m&-m,l=r&-r,_>=l||_===32&&(l&4194048)!==0)?r:m}function Ol(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function vC(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 F_(){var s=pc;return pc<<=1,(pc&62914560)===0&&(pc=4194304),s}function qh(s){for(var r=[],l=0;31>l;l++)r.push(s);return r}function Al(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function yC(s,r,l,u,m,_){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 C=s.entanglements,O=s.expirationTimes,I=s.hiddenUpdates;for(l=y&~l;0<l;){var Q=31-Bs(l),ee=1<<Q;C[Q]=0,O[Q]=-1;var F=I[Q];if(F!==null)for(I[Q]=null,Q=0;Q<F.length;Q++){var Y=F[Q];Y!==null&&(Y.lane&=-536870913)}l&=~ee}u!==0&&U_(s,u,0),_!==0&&m===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 K_(s,r){var l=s.entangledLanes|=r;for(s=s.entanglements;l;){var u=31-Bs(l),m=1<<u;m&r|s[u]&r&&(s[u]|=r),l&=~m}}function $_(s,r){var l=r&-r;return l=(l&42)!==0?1:Ph(l),(l&(s.suspendedLanes|r))!==0?0:l}function Ph(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 Hh(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function W_(){var s=U.p;return s!==0?s:(s=window.event,s===void 0?32:Ab(s.type))}function V_(s,r){var l=U.p;try{return U.p=s,r()}finally{U.p=l}}var Sr=Math.random().toString(36).slice(2),es="__reactFiber$"+Sr,Ss="__reactProps$"+Sr,ma="__reactContainer$"+Sr,Ih="__reactEvents$"+Sr,bC="__reactListeners$"+Sr,SC="__reactHandles$"+Sr,Y_="__reactResources$"+Sr,Rl="__reactMarker$"+Sr;function Fh(s){delete s[es],delete s[Ss],delete s[Ih],delete s[bC],delete s[SC]}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=pb(s);s!==null;){if(l=s[es])return l;s=pb(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 Ml(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[Y_];return r||(r=s[Y_]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function $t(s){s[Rl]=!0}var G_=new Set,Q_={};function bn(s,r){va(s,r),va(s+"Capture",r)}function va(s,r){for(Q_[s]=r,s=0;s<r.length;s++)G_.add(r[s])}var xC=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]*$"),Z_={},X_={};function wC(s){return Bh.call(X_,s)?!0:Bh.call(Z_,s)?!1:xC.test(s)?X_[s]=!0:(Z_[s]=!0,!1)}function gc(s,r,l){if(wC(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 vc(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 Fi(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 J_(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function CC(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 m=u.get,_=u.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.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=J_(s)?"checked":"value";s._valueTracker=CC(s,r,""+s[r])}}function eg(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var l=r.getValue(),u="";return s&&(u=J_(s)?s.checked?"true":"false":s.value),s=u,s!==l?(r.setValue(s),!0):!1}function yc(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 jC=/[\n"\\]/g;function Xs(s){return s.replace(jC,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Kh(s,r,l,u,m,_,y,C){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?$h(s,y,Zs(r)):l!=null?$h(s,y,Zs(l)):u!=null&&s.removeAttribute("value"),m==null&&_!=null&&(s.defaultChecked=!!_),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.name=""+Zs(C):s.removeAttribute("name")}function tg(s,r,l,u,m,_,y,C){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,C||r===s.value||(s.value=r),s.defaultValue=r}u=u??m,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=C?s.checked:!!u,s.defaultChecked=!!u,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.name=y),Uh(s)}function $h(s,r,l){r==="number"&&yc(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function ya(s,r,l,u){if(s=s.options,r){r={};for(var m=0;m<l.length;m++)r["$"+l[m]]=!0;for(l=0;l<s.length;l++)m=r.hasOwnProperty("$"+s[l].value),s[l].selected!==m&&(s[l].selected=m),m&&u&&(s[l].defaultSelected=!0)}else{for(l=""+Zs(l),r=null,m=0;m<s.length;m++){if(s[m].value===l){s[m].selected=!0,u&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function sg(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 ig(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 kC=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 rg(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||kC.has(r)?r==="float"?s.cssFloat=l:s[r]=(""+l).trim():s[r]=l+"px"}function ng(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 m in r)u=r[m],r.hasOwnProperty(m)&&l[m]!==u&&rg(s,m,u)}else for(var _ in r)r.hasOwnProperty(_)&&rg(s,_,r[_])}function Wh(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 EC=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"]]),NC=/^[\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 bc(s){return NC.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ui(){}var Vh=null;function Yh(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 ag(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(Kh(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 m=u[Ss]||null;if(!m)throw Error(n(90));Kh(u,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<l.length;r++)u=l[r],u.form===s.form&&eg(u)}break e;case"textarea":sg(s,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&ya(s,!!l.multiple,r,!1)}}}var Gh=!1;function lg(s,r,l){if(Gh)return s(r,l);Gh=!0;try{var u=s(r);return u}finally{if(Gh=!1,(Sa!==null||xa!==null)&&(lu(),Sa&&(r=Sa,s=xa,xa=Sa=null,ag(r),s)))for(r=0;r<s.length;r++)ag(s[r])}}function Dl(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"),Qh=!1;if(Ki)try{var Bl={};Object.defineProperty(Bl,"passive",{get:function(){Qh=!0}}),window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch{Qh=!1}var xr=null,Zh=null,Sc=null;function og(){if(Sc)return Sc;var s,r=Zh,l=r.length,u,m="value"in xr?xr.value:xr.textContent,_=m.length;for(s=0;s<l&&r[s]===m[s];s++);var y=l-s;for(u=1;u<=y&&r[l-u]===m[_-u];u++);return Sc=m.slice(s,1<u?1-u:void 0)}function xc(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 wc(){return!0}function cg(){return!1}function xs(s){function r(l,u,m,_,y){this._reactName=l,this._targetInst=m,this.type=u,this.nativeEvent=_,this.target=y,this.currentTarget=null;for(var C in s)s.hasOwnProperty(C)&&(l=s[C],this[C]=l?l(_):_[C]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?wc:cg,this.isPropagationStopped=cg,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=wc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=wc)},persist:function(){},isPersistent:wc}),r}var Sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cc=xs(Sn),Ll=v({},Sn,{view:0,detail:0}),TC=xs(Ll),Xh,Jh,zl,jc=v({},Ll,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:td,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!==zl&&(zl&&s.type==="mousemove"?(Xh=s.screenX-zl.screenX,Jh=s.screenY-zl.screenY):Jh=Xh=0,zl=s),Xh)},movementY:function(s){return"movementY"in s?s.movementY:Jh}}),ug=xs(jc),OC=v({},jc,{dataTransfer:0}),AC=xs(OC),RC=v({},Ll,{relatedTarget:0}),ed=xs(RC),MC=v({},Sn,{animationName:0,elapsedTime:0,pseudoElement:0}),DC=xs(MC),BC=v({},Sn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),LC=xs(BC),zC=v({},Sn,{data:0}),hg=xs(zC),qC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},PC={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"},HC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function IC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=HC[s])?!!r[s]:!1}function td(){return IC}var FC=v({},Ll,{key:function(s){if(s.key){var r=qC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=xc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?PC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:td,charCode:function(s){return s.type==="keypress"?xc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?xc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),UC=xs(FC),KC=v({},jc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dg=xs(KC),$C=v({},Ll,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:td}),WC=xs($C),VC=v({},Sn,{propertyName:0,elapsedTime:0,pseudoElement:0}),YC=xs(VC),GC=v({},jc,{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}),QC=xs(GC),ZC=v({},Sn,{newState:0,oldState:0}),XC=xs(ZC),JC=[9,13,27,32],sd=Ki&&"CompositionEvent"in window,ql=null;Ki&&"documentMode"in document&&(ql=document.documentMode);var ej=Ki&&"TextEvent"in window&&!ql,fg=Ki&&(!sd||ql&&8<ql&&11>=ql),mg=" ",pg=!1;function _g(s,r){switch(s){case"keyup":return JC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gg(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var wa=!1;function tj(s,r){switch(s){case"compositionend":return gg(r);case"keypress":return r.which!==32?null:(pg=!0,mg);case"textInput":return s=r.data,s===mg&&pg?null:s;default:return null}}function sj(s,r){if(wa)return s==="compositionend"||!sd&&_g(s,r)?(s=og(),Sc=Zh=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 fg&&r.locale!=="ko"?null:r.data;default:return null}}var ij={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 vg(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!ij[s.type]:r==="textarea"}function yg(s,r,l,u){Sa?xa?xa.push(u):xa=[u]:Sa=u,r=mu(r,"onChange"),0<r.length&&(l=new Cc("onChange","change",null,l,u),s.push({event:l,listeners:r}))}var Pl=null,Hl=null;function rj(s){tb(s,0)}function kc(s){var r=Ml(s);if(eg(r))return s}function bg(s,r){if(s==="change")return r}var Sg=!1;if(Ki){var id;if(Ki){var rd="oninput"in document;if(!rd){var xg=document.createElement("div");xg.setAttribute("oninput","return;"),rd=typeof xg.oninput=="function"}id=rd}else id=!1;Sg=id&&(!document.documentMode||9<document.documentMode)}function wg(){Pl&&(Pl.detachEvent("onpropertychange",Cg),Hl=Pl=null)}function Cg(s){if(s.propertyName==="value"&&kc(Hl)){var r=[];yg(r,Hl,s,Yh(s)),lg(rj,r)}}function nj(s,r,l){s==="focusin"?(wg(),Pl=r,Hl=l,Pl.attachEvent("onpropertychange",Cg)):s==="focusout"&&wg()}function aj(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return kc(Hl)}function lj(s,r){if(s==="click")return kc(r)}function oj(s,r){if(s==="input"||s==="change")return kc(r)}function cj(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Ls=typeof Object.is=="function"?Object.is:cj;function Il(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 m=l[u];if(!Bh.call(r,m)||!Ls(s[m],r[m]))return!1}return!0}function jg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function kg(s,r){var l=jg(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=jg(l)}}function Eg(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Eg(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Ng(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=yc(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=yc(s.document)}return r}function nd(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 uj=Ki&&"documentMode"in document&&11>=document.documentMode,Ca=null,ad=null,Fl=null,ld=!1;function Tg(s,r,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ld||Ca==null||Ca!==yc(u)||(u=Ca,"selectionStart"in u&&nd(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}),Fl&&Il(Fl,u)||(Fl=u,u=mu(ad,"onSelect"),0<u.length&&(r=new Cc("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")},od={},Og={};Ki&&(Og=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(od[s])return od[s];if(!ja[s])return s;var r=ja[s],l;for(l in r)if(r.hasOwnProperty(l)&&l in Og)return od[s]=r[l];return s}var Ag=wn("animationend"),Rg=wn("animationiteration"),Mg=wn("animationstart"),hj=wn("transitionrun"),dj=wn("transitionstart"),fj=wn("transitioncancel"),Dg=wn("transitionend"),Bg=new Map,cd="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(" ");cd.push("scrollEnd");function pi(s,r){Bg.set(s,r),bn(r,[s])}var Ec=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,ud=0;function Nc(){for(var s=ka,r=ud=ka=0;r<s;){var l=Js[r];Js[r++]=null;var u=Js[r];Js[r++]=null;var m=Js[r];Js[r++]=null;var _=Js[r];if(Js[r++]=null,u!==null&&m!==null){var y=u.pending;y===null?m.next=m:(m.next=y.next,y.next=m),u.pending=m}_!==0&&Lg(l,m,_)}}function Tc(s,r,l,u){Js[ka++]=s,Js[ka++]=r,Js[ka++]=l,Js[ka++]=u,ud|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function hd(s,r,l,u){return Tc(s,r,l,u),Oc(s)}function Cn(s,r){return Tc(s,null,null,r),Oc(s)}function Lg(s,r,l){s.lanes|=l;var u=s.alternate;u!==null&&(u.lanes|=l);for(var m=!1,_=s.return;_!==null;)_.childLanes|=l,u=_.alternate,u!==null&&(u.childLanes|=l),_.tag===22&&(s=_.stateNode,s===null||s._visibility&1||(m=!0)),s=_,_=_.return;return s.tag===3?(_=s.stateNode,m&&r!==null&&(m=31-Bs(l),s=_.hiddenUpdates,u=s[m],u===null?s[m]=[r]:u.push(r),r.lane=l|536870912),_):null}function Oc(s){if(50<uo)throw uo=0,Sf=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 mj(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 mj(s,r,l,u)}function dd(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 zg(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 Ac(s,r,l,u,m,_){var y=0;if(u=s,typeof s=="function")dd(s)&&(y=1);else if(typeof s=="string")y=yk(s,l,V.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case z:return s=zs(31,l,r,m),s.elementType=z,s.lanes=_,s;case w:return jn(l.children,m,_,r);case k:y=8,m|=24;break;case E:return s=zs(12,l,r,m|2),s.elementType=E,s.lanes=_,s;case $:return s=zs(13,l,r,m),s.elementType=$,s.lanes=_,s;case Z:return s=zs(19,l,r,m),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 K:y=14;break e;case X: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,m),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 fd(s,r,l){return s=zs(6,s,null,r),s.lanes=l,s}function qg(s){var r=zs(18,null,null,0);return r.stateNode=s,r}function md(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 Pg=new WeakMap;function ei(s,r){if(typeof s=="object"&&s!==null){var l=Pg.get(s);return l!==void 0?l:(r={value:s,source:r,stack:q_(r)},Pg.set(s,r),r)}return{value:s,source:r,stack:q_(r)}}var Na=[],Ta=0,Rc=null,Ul=0,ti=[],si=0,wr=null,wi=1,Ci="";function Wi(s,r){Na[Ta++]=Ul,Na[Ta++]=Rc,Rc=s,Ul=r}function Hg(s,r,l){ti[si++]=wi,ti[si++]=Ci,ti[si++]=wr,wr=s;var u=wi;s=Ci;var m=32-Bs(u)-1;u&=~(1<<m),l+=1;var _=32-Bs(r)+m;if(30<_){var y=m-m%5;_=(u&(1<<y)-1).toString(32),u>>=y,m-=y,wi=1<<32-Bs(r)+m|l<<m|u,Ci=_+s}else wi=1<<_|l<<m|u,Ci=s}function pd(s){s.return!==null&&(Wi(s,1),Hg(s,1,0))}function _d(s){for(;s===Rc;)Rc=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 Ig(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,gd=Error(n(519));function jr(s){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Kl(ei(r,s)),gd}function Fg(s){var r=s.stateNode,l=s.type,u=s.memoizedProps;switch(r[es]=s,r[Ss]=u,l){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(l=0;l<fo.length;l++)Ue(fo[l],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Ue("invalid",r),tg(r,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Ue("invalid",r);break;case"textarea":Ue("invalid",r),ig(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||nb(r.textContent,l)?(u.popover!=null&&(Ue("beforetoggle",r),Ue("toggle",r)),u.onScroll!=null&&Ue("scroll",r),u.onScrollEnd!=null&&Ue("scrollend",r),u.onClick!=null&&(r.onclick=Ui),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")||Lf(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=mb(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));ft=mb(s)}else r===27?(r=ft,Pr(s.type)?(s=If,If=null,ft=s):ft=r):ft=ts?ni(s.stateNode.nextSibling):null;return!0}function kn(){ft=ts=null,Ve=!1}function vd(){var s=Cr;return s!==null&&(ks===null?ks=s:ks.push.apply(ks,s),Cr=null),s}function Kl(s){Cr===null?Cr=[s]:Cr.push(s)}var yd=T(null),En=null,Vi=null;function kr(s,r,l){ne(yd,r._currentValue),r._currentValue=l}function Yi(s){s._currentValue=yd.current,W(yd)}function bd(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 Sd(s,r,l,u){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var _=m.dependencies;if(_!==null){var y=m.child;_=_.firstContext;e:for(;_!==null;){var C=_;_=m;for(var O=0;O<r.length;O++)if(C.context===r[O]){_.lanes|=l,C=_.alternate,C!==null&&(C.lanes|=l),bd(_.return,l,s),u||(y=null);break e}_=C.next}}else if(m.tag===18){if(y=m.return,y===null)throw Error(n(341));y.lanes|=l,_=y.alternate,_!==null&&(_.lanes|=l),bd(y,l,s),y=null}else y=m.child;if(y!==null)y.return=m;else for(y=m;y!==null;){if(y===s){y=null;break}if(m=y.sibling,m!==null){m.return=y.return,y=m;break}y=y.return}m=y}}function Aa(s,r,l,u){s=null;for(var m=r,_=!1;m!==null;){if(!_){if((m.flags&524288)!==0)_=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var y=m.alternate;if(y===null)throw Error(n(387));if(y=y.memoizedProps,y!==null){var C=m.type;Ls(m.pendingProps.value,y.value)||(s!==null?s.push(C):s=[C])}}else if(m===Ne.current){if(y=m.alternate,y===null)throw Error(n(387));y.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(vo):s=[vo])}m=m.return}s!==null&&Sd(r,s,l,u),r.flags|=262144}function Mc(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 Kg(En,s)}function Dc(s,r){return En===null&&Nn(s),Kg(s,r)}function Kg(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 pj=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()})}},_j=e.unstable_scheduleCallback,gj=e.unstable_NormalPriority,At={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xd(){return{controller:new pj,data:new Map,refCount:0}}function $l(s){s.refCount--,s.refCount===0&&_j(gj,function(){s.controller.abort()})}var Wl=null,wd=0,Ra=0,Ma=null;function vj(s,r){if(Wl===null){var l=Wl=[];wd=0,Ra=Ef(),Ma={status:"pending",value:void 0,then:function(u){l.push(u)}}}return wd++,r.then($g,$g),r}function $g(){if(--wd===0&&Wl!==null){Ma!==null&&(Ma.status="fulfilled");var s=Wl;Wl=null,Ra=0,Ma=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function yj(s,r){var l=[],u={status:"pending",value:null,reason:null,then:function(m){l.push(m)}};return s.then(function(){u.status="fulfilled",u.value=r;for(var m=0;m<l.length;m++)(0,l[m])(r)},function(m){for(u.status="rejected",u.reason=m,m=0;m<l.length;m++)(0,l[m])(void 0)}),u}var Wg=A.S;A.S=function(s,r){Ty=Ms(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&vj(s,r),Wg!==null&&Wg(s,r)};var Tn=T(null);function Cd(){var s=Tn.current;return s!==null?s:ht.pooledCache}function Bc(s,r){r===null?ne(Tn,Tn.current):ne(Tn,r.pool)}function Vg(){var s=Cd();return s===null?null:{parent:At._currentValue,pool:s}}var Da=Error(n(460)),jd=Error(n(474)),Lc=Error(n(542)),zc={then:function(){}};function Yg(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Gg(s,r,l){switch(l=s[l],l===void 0?s.push(r):l!==r&&(r.then(Ui,Ui),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Zg(s),s;default:if(typeof r.status=="string")r.then(Ui,Ui);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 m=r;m.status="fulfilled",m.value=u}},function(u){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Zg(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 Qg(){if(An===null)throw Error(n(459));var s=An;return An=null,s}function Zg(s){if(s===Da||s===Lc)throw Error(n(483))}var Ba=null,Vl=0;function qc(s){var r=Vl;return Vl+=1,Ba===null&&(Ba=[]),Gg(Ba,s,r)}function Yl(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function Pc(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 Xg(s){function r(B,R){if(s){var H=B.deletions;H===null?(B.deletions=[R],B.flags|=16):H.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 m(B,R){return B=$i(B,R),B.index=0,B.sibling=null,B}function _(B,R,H){return B.index=H,s?(H=B.alternate,H!==null?(H=H.index,H<R?(B.flags|=67108866,R):H):(B.flags|=67108866,R)):(B.flags|=1048576,R)}function y(B){return s&&B.alternate===null&&(B.flags|=67108866),B}function C(B,R,H,J){return R===null||R.tag!==6?(R=fd(H,B.mode,J),R.return=B,R):(R=m(R,H),R.return=B,R)}function O(B,R,H,J){var Ce=H.type;return Ce===w?Q(B,R,H.props.children,J,H.key):R!==null&&(R.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===X&&On(Ce)===R.type)?(R=m(R,H.props),Yl(R,H),R.return=B,R):(R=Ac(H.type,H.key,H.props,null,B.mode,J),Yl(R,H),R.return=B,R)}function I(B,R,H,J){return R===null||R.tag!==4||R.stateNode.containerInfo!==H.containerInfo||R.stateNode.implementation!==H.implementation?(R=md(H,B.mode,J),R.return=B,R):(R=m(R,H.children||[]),R.return=B,R)}function Q(B,R,H,J,Ce){return R===null||R.tag!==7?(R=jn(H,B.mode,J,Ce),R.return=B,R):(R=m(R,H),R.return=B,R)}function ee(B,R,H){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=fd(""+R,B.mode,H),R.return=B,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return H=Ac(R.type,R.key,R.props,null,B.mode,H),Yl(H,R),H.return=B,H;case x:return R=md(R,B.mode,H),R.return=B,R;case X:return R=On(R),ee(B,R,H)}if(se(R)||q(R))return R=jn(R,B.mode,H,null),R.return=B,R;if(typeof R.then=="function")return ee(B,qc(R),H);if(R.$$typeof===D)return ee(B,Dc(B,R),H);Pc(B,R)}return null}function F(B,R,H,J){var Ce=R!==null?R.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return Ce!==null?null:C(B,R,""+H,J);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return H.key===Ce?O(B,R,H,J):null;case x:return H.key===Ce?I(B,R,H,J):null;case X:return H=On(H),F(B,R,H,J)}if(se(H)||q(H))return Ce!==null?null:Q(B,R,H,J,null);if(typeof H.then=="function")return F(B,R,qc(H),J);if(H.$$typeof===D)return F(B,R,Dc(B,H),J);Pc(B,H)}return null}function Y(B,R,H,J,Ce){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return B=B.get(H)||null,C(R,B,""+J,Ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case S:return B=B.get(J.key===null?H:J.key)||null,O(R,B,J,Ce);case x:return B=B.get(J.key===null?H:J.key)||null,I(R,B,J,Ce);case X:return J=On(J),Y(B,R,H,J,Ce)}if(se(J)||q(J))return B=B.get(H)||null,Q(R,B,J,Ce,null);if(typeof J.then=="function")return Y(B,R,H,qc(J),Ce);if(J.$$typeof===D)return Y(B,R,H,Dc(R,J),Ce);Pc(R,J)}return null}function ve(B,R,H,J){for(var Ce=null,tt=null,Se=R,Le=R=0,$e=null;Se!==null&&Le<H.length;Le++){Se.index>Le?($e=Se,Se=null):$e=Se.sibling;var st=F(B,Se,H[Le],J);if(st===null){Se===null&&(Se=$e);break}s&&Se&&st.alternate===null&&r(B,Se),R=_(st,R,Le),tt===null?Ce=st:tt.sibling=st,tt=st,Se=$e}if(Le===H.length)return l(B,Se),Ve&&Wi(B,Le),Ce;if(Se===null){for(;Le<H.length;Le++)Se=ee(B,H[Le],J),Se!==null&&(R=_(Se,R,Le),tt===null?Ce=Se:tt.sibling=Se,tt=Se);return Ve&&Wi(B,Le),Ce}for(Se=u(Se);Le<H.length;Le++)$e=Y(Se,B,Le,H[Le],J),$e!==null&&(s&&$e.alternate!==null&&Se.delete($e.key===null?Le:$e.key),R=_($e,R,Le),tt===null?Ce=$e:tt.sibling=$e,tt=$e);return s&&Se.forEach(function(Kr){return r(B,Kr)}),Ve&&Wi(B,Le),Ce}function ke(B,R,H,J){if(H==null)throw Error(n(151));for(var Ce=null,tt=null,Se=R,Le=R=0,$e=null,st=H.next();Se!==null&&!st.done;Le++,st=H.next()){Se.index>Le?($e=Se,Se=null):$e=Se.sibling;var Kr=F(B,Se,st.value,J);if(Kr===null){Se===null&&(Se=$e);break}s&&Se&&Kr.alternate===null&&r(B,Se),R=_(Kr,R,Le),tt===null?Ce=Kr:tt.sibling=Kr,tt=Kr,Se=$e}if(st.done)return l(B,Se),Ve&&Wi(B,Le),Ce;if(Se===null){for(;!st.done;Le++,st=H.next())st=ee(B,st.value,J),st!==null&&(R=_(st,R,Le),tt===null?Ce=st:tt.sibling=st,tt=st);return Ve&&Wi(B,Le),Ce}for(Se=u(Se);!st.done;Le++,st=H.next())st=Y(Se,B,Le,st.value,J),st!==null&&(s&&st.alternate!==null&&Se.delete(st.key===null?Le:st.key),R=_(st,R,Le),tt===null?Ce=st:tt.sibling=st,tt=st);return s&&Se.forEach(function(Ok){return r(B,Ok)}),Ve&&Wi(B,Le),Ce}function ct(B,R,H,J){if(typeof H=="object"&&H!==null&&H.type===w&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case S:e:{for(var Ce=H.key;R!==null;){if(R.key===Ce){if(Ce=H.type,Ce===w){if(R.tag===7){l(B,R.sibling),J=m(R,H.props.children),J.return=B,B=J;break e}}else if(R.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===X&&On(Ce)===R.type){l(B,R.sibling),J=m(R,H.props),Yl(J,H),J.return=B,B=J;break e}l(B,R);break}else r(B,R);R=R.sibling}H.type===w?(J=jn(H.props.children,B.mode,J,H.key),J.return=B,B=J):(J=Ac(H.type,H.key,H.props,null,B.mode,J),Yl(J,H),J.return=B,B=J)}return y(B);case x:e:{for(Ce=H.key;R!==null;){if(R.key===Ce)if(R.tag===4&&R.stateNode.containerInfo===H.containerInfo&&R.stateNode.implementation===H.implementation){l(B,R.sibling),J=m(R,H.children||[]),J.return=B,B=J;break e}else{l(B,R);break}else r(B,R);R=R.sibling}J=md(H,B.mode,J),J.return=B,B=J}return y(B);case X:return H=On(H),ct(B,R,H,J)}if(se(H))return ve(B,R,H,J);if(q(H)){if(Ce=q(H),typeof Ce!="function")throw Error(n(150));return H=Ce.call(H),ke(B,R,H,J)}if(typeof H.then=="function")return ct(B,R,qc(H),J);if(H.$$typeof===D)return ct(B,R,Dc(B,H),J);Pc(B,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,R!==null&&R.tag===6?(l(B,R.sibling),J=m(R,H),J.return=B,B=J):(l(B,R),J=fd(H,B.mode,J),J.return=B,B=J),y(B)):l(B,R)}return function(B,R,H,J){try{Vl=0;var Ce=ct(B,R,H,J);return Ba=null,Ce}catch(Se){if(Se===Da||Se===Lc)throw Se;var tt=zs(29,Se,null,B.mode);return tt.lanes=J,tt.return=B,tt}finally{}}}var Rn=Xg(!0),Jg=Xg(!1),Er=!1;function kd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ed(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 m=u.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),u.pending=r,r=Oc(s),Lg(s,null,l),r}return Tc(s,u,r,l),Oc(s)}function Gl(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,K_(s,l)}}function Nd(s,r){var l=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var m=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?m=_=y:_=_.next=y,l=l.next}while(l!==null);_===null?m=_=r:_=_.next=r}else m=_=r;l={baseState:u.baseState,firstBaseUpdate:m,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 Td=!1;function Ql(){if(Td){var s=Ma;if(s!==null)throw s}}function Zl(s,r,l,u){Td=!1;var m=s.updateQueue;Er=!1;var _=m.firstBaseUpdate,y=m.lastBaseUpdate,C=m.shared.pending;if(C!==null){m.shared.pending=null;var O=C,I=O.next;O.next=null,y===null?_=I:y.next=I,y=O;var Q=s.alternate;Q!==null&&(Q=Q.updateQueue,C=Q.lastBaseUpdate,C!==y&&(C===null?Q.firstBaseUpdate=I:C.next=I,Q.lastBaseUpdate=O))}if(_!==null){var ee=m.baseState;y=0,Q=I=O=null,C=_;do{var F=C.lane&-536870913,Y=F!==C.lane;if(Y?(Ke&F)===F:(u&F)===F){F!==0&&F===Ra&&(Td=!0),Q!==null&&(Q=Q.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var ve=s,ke=C;F=r;var ct=l;switch(ke.tag){case 1:if(ve=ke.payload,typeof ve=="function"){ee=ve.call(ct,ee,F);break e}ee=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=ke.payload,F=typeof ve=="function"?ve.call(ct,ee,F):ve,F==null)break e;ee=v({},ee,F);break e;case 2:Er=!0}}F=C.callback,F!==null&&(s.flags|=64,Y&&(s.flags|=8192),Y=m.callbacks,Y===null?m.callbacks=[F]:Y.push(F))}else Y={lane:F,tag:C.tag,payload:C.payload,callback:C.callback,next:null},Q===null?(I=Q=Y,O=ee):Q=Q.next=Y,y|=F;if(C=C.next,C===null){if(C=m.shared.pending,C===null)break;Y=C,C=Y.next,Y.next=null,m.lastBaseUpdate=Y,m.shared.pending=null}}while(!0);Q===null&&(O=ee),m.baseState=O,m.firstBaseUpdate=I,m.lastBaseUpdate=Q,_===null&&(m.shared.lanes=0),Dr|=y,s.lanes=y,s.memoizedState=ee}}function ev(s,r){if(typeof s!="function")throw Error(n(191,s));s.call(r)}function tv(s,r){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)ev(l[s],r)}var La=T(null),Hc=T(0);function sv(s,r){s=ir,ne(Hc,s),ne(La,r),ir=s|r.baseLanes}function Od(){ne(Hc,ir),ne(La,La.current)}function Ad(){ir=Hc.current,W(La),W(Hc)}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 Rd(s){ne(Et,Et.current),ne(qs,s),ri===null&&(ri=s)}function iv(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){W(qs),ri===s&&(ri=null),W(Et)}var Et=T(0);function Ic(s){for(var r=s;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Pf(l)||Hf(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,Fc=!1,za=!1,Mn=!1,Uc=0,Xl=0,qa=null,bj=0;function bt(){throw Error(n(321))}function Md(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 Dd(s,r,l,u,m,_){return Gi=_,Be=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,A.H=s===null||s.memoizedState===null?Hv:Gd,Mn=!1,_=l(u,m),Mn=!1,za&&(_=nv(r,l,u,m)),rv(s),_}function rv(s){A.H=to;var r=lt!==null&&lt.next!==null;if(Gi=0,Rt=lt=Be=null,Fc=!1,Xl=0,qa=null,r)throw Error(n(300));s===null||Mt||(s=s.dependencies,s!==null&&Mc(s)&&(Mt=!0))}function nv(s,r,l,u){Be=s;var m=0;do{if(za&&(qa=null),Xl=0,za=!1,25<=m)throw Error(n(301));if(m+=1,Rt=lt=null,s.updateQueue!=null){var _=s.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}A.H=Iv,_=r(l,u)}while(za);return _}function Sj(){var s=A.H,r=s.useState()[0];return r=typeof r.then=="function"?Jl(r):r,s=s.useState()[0],(lt!==null?lt.memoizedState:null)!==s&&(Be.flags|=1024),r}function Bd(){var s=Uc!==0;return Uc=0,s}function Ld(s,r,l){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~l}function zd(s){if(Fc){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Fc=!1}Gi=0,Rt=lt=Be=null,za=!1,Xl=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 Kc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jl(s){var r=Xl;return Xl+=1,qa===null&&(qa=[]),s=Gg(qa,s,r),r=Be,(Rt===null?r.memoizedState:Rt.next)===null&&(r=r.alternate,A.H=r===null||r.memoizedState===null?Hv:Gd),s}function $c(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Jl(s);if(s.$$typeof===D)return ss(s)}throw Error(n(438,String(s)))}function qd(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(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=Kc(),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]=le;return r.index++,l}function Qi(s,r){return typeof r=="function"?r(s):r}function Wc(s){var r=Nt();return Pd(r,lt,s)}function Pd(s,r,l){var u=s.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=l;var m=s.baseQueue,_=u.pending;if(_!==null){if(m!==null){var y=m.next;m.next=_.next,_.next=y}r.baseQueue=m=_,u.pending=null}if(_=s.baseState,m===null)s.memoizedState=_;else{r=m.next;var C=y=null,O=null,I=r,Q=!1;do{var ee=I.lane&-536870913;if(ee!==I.lane?(Ke&ee)===ee:(Gi&ee)===ee){var F=I.revertLane;if(F===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null}),ee===Ra&&(Q=!0);else if((Gi&F)===F){I=I.next,F===Ra&&(Q=!0);continue}else ee={lane:0,revertLane:I.revertLane,gesture:null,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},O===null?(C=O=ee,y=_):O=O.next=ee,Be.lanes|=F,Dr|=F;ee=I.action,Mn&&l(_,ee),_=I.hasEagerState?I.eagerState:l(_,ee)}else F={lane:ee,revertLane:I.revertLane,gesture:I.gesture,action:I.action,hasEagerState:I.hasEagerState,eagerState:I.eagerState,next:null},O===null?(C=O=F,y=_):O=O.next=F,Be.lanes|=ee,Dr|=ee;I=I.next}while(I!==null&&I!==r);if(O===null?y=_:O.next=C,!Ls(_,s.memoizedState)&&(Mt=!0,Q&&(l=Ma,l!==null)))throw l;s.memoizedState=_,s.baseState=y,s.baseQueue=O,u.lastRenderedState=_}return m===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function Hd(s){var r=Nt(),l=r.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=s;var u=l.dispatch,m=l.pending,_=r.memoizedState;if(m!==null){l.pending=null;var y=m=m.next;do _=s(_,y.action),y=y.next;while(y!==m);Ls(_,r.memoizedState)||(Mt=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),l.lastRenderedState=_}return[_,u]}function av(s,r,l){var u=Be,m=Nt(),_=Ve;if(_){if(l===void 0)throw Error(n(407));l=l()}else l=r();var y=!Ls((lt||m).memoizedState,l);if(y&&(m.memoizedState=l,Mt=!0),m=m.queue,Ud(cv.bind(null,u,m,s),[s]),m.getSnapshot!==r||y||Rt!==null&&Rt.memoizedState.tag&1){if(u.flags|=2048,Pa(9,{destroy:void 0},ov.bind(null,u,m,l,r),null),ht===null)throw Error(n(349));_||(Gi&127)!==0||lv(u,r,l)}return l}function lv(s,r,l){s.flags|=16384,s={getSnapshot:r,value:l},r=Be.updateQueue,r===null?(r=Kc(),Be.updateQueue=r,r.stores=[s]):(l=r.stores,l===null?r.stores=[s]:l.push(s))}function ov(s,r,l,u){r.value=l,r.getSnapshot=u,uv(r)&&hv(s)}function cv(s,r,l){return l(function(){uv(r)&&hv(s)})}function uv(s){var r=s.getSnapshot;s=s.value;try{var l=r();return!Ls(s,l)}catch{return!0}}function hv(s){var r=Cn(s,2);r!==null&&Es(r,s,2)}function Id(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 dv(s,r,l,u){return s.baseState=l,Pd(s,lt,typeof u=="function"?u:Qi)}function xj(s,r,l,u,m){if(Gc(s))throw Error(n(485));if(s=r.action,s!==null){var _={payload:m,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=_,fv(r,_)):(_.next=l.next,r.pending=l.next=_)}}function fv(s,r){var l=r.action,u=r.payload,m=s.state;if(r.isTransition){var _=A.T,y={};A.T=y;try{var C=l(m,u),O=A.S;O!==null&&O(y,C),mv(s,r,C)}catch(I){Fd(s,r,I)}finally{_!==null&&y.types!==null&&(_.types=y.types),A.T=_}}else try{_=l(m,u),mv(s,r,_)}catch(I){Fd(s,r,I)}}function mv(s,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){pv(s,r,u)},function(u){return Fd(s,r,u)}):pv(s,r,l)}function pv(s,r,l){r.status="fulfilled",r.value=l,_v(r),s.state=l,r=s.pending,r!==null&&(l=r.next,l===r?s.pending=null:(l=l.next,r.next=l,fv(s,l)))}function Fd(s,r,l){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=l,_v(r),r=r.next;while(r!==u)}s.action=null}function _v(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function gv(s,r){return r}function vv(s,r){if(Ve){var l=ht.formState;if(l!==null){e:{var u=Be;if(Ve){if(ft){t:{for(var m=ft,_=ii;m.nodeType!==8;){if(!_){m=null;break t}if(m=ni(m.nextSibling),m===null){m=null;break t}}_=m.data,m=_==="F!"||_==="F"?m:null}if(m){ft=ni(m.nextSibling),u=m.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:gv,lastRenderedState:r},l.queue=u,l=zv.bind(null,Be,u),u.dispatch=l,u=Id(!1),_=Yd.bind(null,Be,!1,u.queue),u=ps(),m={state:r,dispatch:null,action:s,pending:null},u.queue=m,l=xj.bind(null,Be,m,_,l),m.dispatch=l,u.memoizedState=s,[r,l,!1]}function yv(s){var r=Nt();return bv(r,lt,s)}function bv(s,r,l){if(r=Pd(s,r,gv)[0],s=Wc(Qi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Jl(r)}catch(y){throw y===Da?Lc:y}else u=r;r=Nt();var m=r.queue,_=m.dispatch;return l!==r.memoizedState&&(Be.flags|=2048,Pa(9,{destroy:void 0},wj.bind(null,m,l),null)),[u,_,s]}function wj(s,r){s.action=r}function Sv(s){var r=Nt(),l=lt;if(l!==null)return bv(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=Kc(),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 xv(){return Nt().memoizedState}function Vc(s,r,l,u){var m=ps();Be.flags|=s,m.memoizedState=Pa(1|r,{destroy:void 0},l,u===void 0?null:u)}function Yc(s,r,l,u){var m=Nt();u=u===void 0?null:u;var _=m.memoizedState.inst;lt!==null&&u!==null&&Md(u,lt.memoizedState.deps)?m.memoizedState=Pa(r,_,l,u):(Be.flags|=s,m.memoizedState=Pa(1|r,_,l,u))}function wv(s,r){Vc(8390656,8,s,r)}function Ud(s,r){Yc(2048,8,s,r)}function Cj(s){Be.flags|=4;var r=Be.updateQueue;if(r===null)r=Kc(),Be.updateQueue=r,r.events=[s];else{var l=r.events;l===null?r.events=[s]:l.push(s)}}function Cv(s){var r=Nt().memoizedState;return Cj({ref:r,nextImpl:s}),function(){if((it&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function jv(s,r){return Yc(4,2,s,r)}function kv(s,r){return Yc(4,4,s,r)}function Ev(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 Nv(s,r,l){l=l!=null?l.concat([s]):null,Yc(4,4,Ev.bind(null,r,s),l)}function Kd(){}function Tv(s,r){var l=Nt();r=r===void 0?null:r;var u=l.memoizedState;return r!==null&&Md(r,u[1])?u[0]:(l.memoizedState=[s,r],s)}function Ov(s,r){var l=Nt();r=r===void 0?null:r;var u=l.memoizedState;if(r!==null&&Md(r,u[1]))return u[0];if(u=s(),Mn){br(!0);try{s()}finally{br(!1)}}return l.memoizedState=[u,r],u}function $d(s,r,l){return l===void 0||(Gi&1073741824)!==0&&(Ke&261930)===0?s.memoizedState=r:(s.memoizedState=l,s=Ay(),Be.lanes|=s,Dr|=s,l)}function Av(s,r,l,u){return Ls(l,r)?l:La.current!==null?(s=$d(s,l,u),Ls(s,r)||(Mt=!0),s):(Gi&42)===0||(Gi&1073741824)!==0&&(Ke&261930)===0?(Mt=!0,s.memoizedState=l):(s=Ay(),Be.lanes|=s,Dr|=s,r)}function Rv(s,r,l,u,m){var _=U.p;U.p=_!==0&&8>_?_:8;var y=A.T,C={};A.T=C,Yd(s,!1,r,l);try{var O=m(),I=A.S;if(I!==null&&I(C,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Q=yj(O,u);eo(s,r,Q,Fs(s))}else eo(s,r,u,Fs(s))}catch(ee){eo(s,r,{then:function(){},status:"rejected",reason:ee},Fs())}finally{U.p=_,y!==null&&C.types!==null&&(y.types=C.types),A.T=y}}function jj(){}function Wd(s,r,l,u){if(s.tag!==5)throw Error(n(476));var m=Mv(s).queue;Rv(s,m,r,G,l===null?jj:function(){return Dv(s),l(u)})}function Mv(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 Dv(s){var r=Mv(s);r.next===null&&(r=s.alternate.memoizedState),eo(s,r.next.queue,{},Fs())}function Vd(){return ss(vo)}function Bv(){return Nt().memoizedState}function Lv(){return Nt().memoizedState}function kj(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var l=Fs();s=Nr(l);var u=Tr(r,s,l);u!==null&&(Es(u,r,l),Gl(u,r,l)),r={cache:xd()},s.payload=r;return}r=r.return}}function Ej(s,r,l){var u=Fs();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Gc(s)?qv(r,l):(l=hd(s,r,l,u),l!==null&&(Es(l,s,u),Pv(l,r,u)))}function zv(s,r,l){var u=Fs();eo(s,r,l,u)}function eo(s,r,l,u){var m={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Gc(s))qv(r,m);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var y=r.lastRenderedState,C=_(y,l);if(m.hasEagerState=!0,m.eagerState=C,Ls(C,y))return Tc(s,r,m,0),ht===null&&Nc(),!1}catch{}finally{}if(l=hd(s,r,m,u),l!==null)return Es(l,s,u),Pv(l,r,u),!0}return!1}function Yd(s,r,l,u){if(u={lane:2,revertLane:Ef(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Gc(s)){if(r)throw Error(n(479))}else r=hd(s,l,u,2),r!==null&&Es(r,s,2)}function Gc(s){var r=s.alternate;return s===Be||r!==null&&r===Be}function qv(s,r){za=Fc=!0;var l=s.pending;l===null?r.next=r:(r.next=l.next,l.next=r),s.pending=r}function Pv(s,r,l){if((l&4194048)!==0){var u=r.lanes;u&=s.pendingLanes,l|=u,r.lanes=l,K_(s,l)}}var to={readContext:ss,use:$c,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};to.useEffectEvent=bt;var Hv={readContext:ss,use:$c,useCallback:function(s,r){return ps().memoizedState=[s,r===void 0?null:r],s},useContext:ss,useEffect:wv,useImperativeHandle:function(s,r,l){l=l!=null?l.concat([s]):null,Vc(4194308,4,Ev.bind(null,r,s),l)},useLayoutEffect:function(s,r){return Vc(4194308,4,s,r)},useInsertionEffect:function(s,r){Vc(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 m=l(r);if(Mn){br(!0);try{l(r)}finally{br(!1)}}}else m=r;return u.memoizedState=u.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},u.queue=s,s=s.dispatch=Ej.bind(null,Be,s),[u.memoizedState,s]},useRef:function(s){var r=ps();return s={current:s},r.memoizedState=s},useState:function(s){s=Id(s);var r=s.queue,l=zv.bind(null,Be,r);return r.dispatch=l,[s.memoizedState,l]},useDebugValue:Kd,useDeferredValue:function(s,r){var l=ps();return $d(l,s,r)},useTransition:function(){var s=Id(!1);return s=Rv.bind(null,Be,s.queue,!0,!1),ps().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,l){var u=Be,m=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||lv(u,r,l)}m.memoizedState=l;var _={value:l,getSnapshot:r};return m.queue=_,wv(cv.bind(null,u,_,s),[s]),u.flags|=2048,Pa(9,{destroy:void 0},ov.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=bj++,r="_"+r+"r_"+l.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Vd,useFormState:vv,useActionState:vv,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=Yd.bind(null,Be,!0,l),l.dispatch=r,[s,r]},useMemoCache:qd,useCacheRefresh:function(){return ps().memoizedState=kj.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)}}},Gd={readContext:ss,use:$c,useCallback:Tv,useContext:ss,useEffect:Ud,useImperativeHandle:Nv,useInsertionEffect:jv,useLayoutEffect:kv,useMemo:Ov,useReducer:Wc,useRef:xv,useState:function(){return Wc(Qi)},useDebugValue:Kd,useDeferredValue:function(s,r){var l=Nt();return Av(l,lt.memoizedState,s,r)},useTransition:function(){var s=Wc(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Jl(s),r]},useSyncExternalStore:av,useId:Bv,useHostTransitionStatus:Vd,useFormState:yv,useActionState:yv,useOptimistic:function(s,r){var l=Nt();return dv(l,lt,s,r)},useMemoCache:qd,useCacheRefresh:Lv};Gd.useEffectEvent=Cv;var Iv={readContext:ss,use:$c,useCallback:Tv,useContext:ss,useEffect:Ud,useImperativeHandle:Nv,useInsertionEffect:jv,useLayoutEffect:kv,useMemo:Ov,useReducer:Hd,useRef:xv,useState:function(){return Hd(Qi)},useDebugValue:Kd,useDeferredValue:function(s,r){var l=Nt();return lt===null?$d(l,s,r):Av(l,lt.memoizedState,s,r)},useTransition:function(){var s=Hd(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Jl(s),r]},useSyncExternalStore:av,useId:Bv,useHostTransitionStatus:Vd,useFormState:Sv,useActionState:Sv,useOptimistic:function(s,r){var l=Nt();return lt!==null?dv(l,lt,s,r):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:qd,useCacheRefresh:Lv};Iv.useEffectEvent=Cv;function Qd(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 Zd={enqueueSetState:function(s,r,l){s=s._reactInternals;var u=Fs(),m=Nr(u);m.payload=r,l!=null&&(m.callback=l),r=Tr(s,m,u),r!==null&&(Es(r,s,u),Gl(r,s,u))},enqueueReplaceState:function(s,r,l){s=s._reactInternals;var u=Fs(),m=Nr(u);m.tag=1,m.payload=r,l!=null&&(m.callback=l),r=Tr(s,m,u),r!==null&&(Es(r,s,u),Gl(r,s,u))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var l=Fs(),u=Nr(l);u.tag=2,r!=null&&(u.callback=r),r=Tr(s,u,l),r!==null&&(Es(r,s,l),Gl(r,s,l))}};function Fv(s,r,l,u,m,_,y){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,_,y):r.prototype&&r.prototype.isPureReactComponent?!Il(l,u)||!Il(m,_):!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&&Zd.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 m in s)l[m]===void 0&&(l[m]=s[m])}return l}function Kv(s){Ec(s)}function $v(s){console.error(s)}function Wv(s){Ec(s)}function Qc(s,r){try{var l=s.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function Vv(s,r,l){try{var u=s.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Xd(s,r,l){return l=Nr(l),l.tag=3,l.payload={element:null},l.callback=function(){Qc(s,r)},l}function Yv(s){return s=Nr(s),s.tag=3,s}function Gv(s,r,l,u){var m=l.type.getDerivedStateFromError;if(typeof m=="function"){var _=u.value;s.payload=function(){return m(_)},s.callback=function(){Vv(r,l,u)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(s.callback=function(){Vv(r,l,u),typeof m!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var C=u.stack;this.componentDidCatch(u.value,{componentStack:C!==null?C:""})})}function Nj(s,r,l,u,m){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=l.alternate,r!==null&&Aa(r,l,m,!0),l=qs.current,l!==null){switch(l.tag){case 31:case 13:return ri===null?ou():l.alternate===null&&St===0&&(St=3),l.flags&=-257,l.flags|=65536,l.lanes=m,u===zc?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([u]):r.add(u),Cf(s,u,m)),!1;case 22:return l.flags|=65536,u===zc?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)),Cf(s,u,m)),!1}throw Error(n(435,l.tag))}return Cf(s,u,m),ou(),!1}if(Ve)return r=qs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,u!==gd&&(s=Error(n(422),{cause:u}),Kl(ei(s,l)))):(u!==gd&&(r=Error(n(423),{cause:u}),Kl(ei(r,l))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,u=ei(u,l),m=Xd(s.stateNode,u,m),Nd(s,m),St!==4&&(St=2)),!1;var _=Error(n(520),{cause:u});if(_=ei(_,l),co===null?co=[_]:co.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=m&-m,l.lanes|=s,s=Xd(l.stateNode,u,s),Nd(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,m&=-m,l.lanes|=m,m=Yv(m),Gv(m,s,l,u),Nd(l,m),!1}l=l.return}while(l!==null);return!1}var Jd=Error(n(461)),Mt=!1;function is(s,r,l,u){r.child=s===null?Jg(r,null,l,u):Rn(r,s.child,l,u)}function Qv(s,r,l,u,m){l=l.render;var _=r.ref;if("ref"in u){var y={};for(var C in u)C!=="ref"&&(y[C]=u[C])}else y=u;return Nn(r),u=Dd(s,r,l,y,_,m),C=Bd(),s!==null&&!Mt?(Ld(s,r,m),Zi(s,r,m)):(Ve&&C&&pd(r),r.flags|=1,is(s,r,u,m),r.child)}function Zv(s,r,l,u,m){if(s===null){var _=l.type;return typeof _=="function"&&!dd(_)&&_.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=_,Xv(s,r,_,u,m)):(s=Ac(l.type,null,u,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(_=s.child,!of(s,m)){var y=_.memoizedProps;if(l=l.compare,l=l!==null?l:Il,l(y,u)&&s.ref===r.ref)return Zi(s,r,m)}return r.flags|=1,s=$i(_,u),s.ref=r.ref,s.return=r,r.child=s}function Xv(s,r,l,u,m){if(s!==null){var _=s.memoizedProps;if(Il(_,u)&&s.ref===r.ref)if(Mt=!1,r.pendingProps=u=_,of(s,m))(s.flags&131072)!==0&&(Mt=!0);else return r.lanes=s.lanes,Zi(s,r,m)}return ef(s,r,l,u,m)}function Jv(s,r,l,u){var m=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,m=0;u!==null;)m=m|u.lanes|u.childLanes,u=u.sibling;u=m&~_}else u=0,r.child=null;return ey(s,r,_,l,u)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Bc(r,_!==null?_.cachePool:null),_!==null?sv(r,_):Od(),iv(r);else return u=r.lanes=536870912,ey(s,r,_!==null?_.baseLanes|l:l,l,u)}else _!==null?(Bc(r,_.cachePool),sv(r,_),Ar(),r.memoizedState=null):(s!==null&&Bc(r,null),Od(),Ar());return is(s,r,m,l),r.child}function so(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function ey(s,r,l,u,m){var _=Cd();return _=_===null?null:{parent:At._currentValue,pool:_},r.memoizedState={baseLanes:l,cachePool:_},s!==null&&Bc(r,null),Od(),iv(r),s!==null&&Aa(s,r,u,!0),r.childLanes=m,null}function Zc(s,r){return r=Jc({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function ty(s,r,l){return Rn(r,s.child,null,l),s=Zc(r,r.pendingProps),s.flags|=2,Ps(r),r.memoizedState=null,s}function Tj(s,r,l){var u=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(Ve){if(u.mode==="hidden")return s=Zc(r,u),r.lanes=536870912,so(null,s);if(Rd(r),(s=ft)?(s=fb(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=qg(s),l.return=r,r.child=l,ts=r,ft=null)):s=null,s===null)throw jr(r);return r.lanes=536870912,null}return Zc(r,u)}var _=s.memoizedState;if(_!==null){var y=_.dehydrated;if(Rd(r),m)if(r.flags&256)r.flags&=-257,r=ty(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),m=(l&s.childLanes)!==0,Mt||m){if(u=ht,u!==null&&(y=$_(u,l),y!==0&&y!==_.retryLane))throw _.retryLane=y,Cn(s,y),Es(u,s,y),Jd;ou(),r=ty(s,r,l)}else s=_.treeContext,ft=ni(y.nextSibling),ts=r,Ve=!0,Cr=null,ii=!1,s!==null&&Ig(r,s),r=Zc(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 Xc(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 ef(s,r,l,u,m){return Nn(r),l=Dd(s,r,l,u,void 0,m),u=Bd(),s!==null&&!Mt?(Ld(s,r,m),Zi(s,r,m)):(Ve&&u&&pd(r),r.flags|=1,is(s,r,l,m),r.child)}function sy(s,r,l,u,m,_){return Nn(r),r.updateQueue=null,l=nv(r,u,l,m),rv(s),u=Bd(),s!==null&&!Mt?(Ld(s,r,_),Zi(s,r,_)):(Ve&&u&&pd(r),r.flags|=1,is(s,r,l,_),r.child)}function iy(s,r,l,u,m){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=Zd,r.stateNode=_,_._reactInternals=r,_=r.stateNode,_.props=u,_.state=r.memoizedState,_.refs={},kd(r),y=l.contextType,_.context=typeof y=="object"&&y!==null?ss(y):Ea,_.state=r.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Qd(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&&Zd.enqueueReplaceState(_,_.state,null),Zl(r,u,_,m),Ql(),_.state=r.memoizedState),typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(s===null){_=r.stateNode;var C=r.memoizedProps,O=Dn(l,C);_.props=O;var I=_.context,Q=l.contextType;y=Ea,typeof Q=="object"&&Q!==null&&(y=ss(Q));var ee=l.getDerivedStateFromProps;Q=typeof ee=="function"||typeof _.getSnapshotBeforeUpdate=="function",C=r.pendingProps!==C,Q||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(C||I!==y)&&Uv(r,_,u,y),Er=!1;var F=r.memoizedState;_.state=F,Zl(r,u,_,m),Ql(),I=r.memoizedState,C||F!==I||Er?(typeof ee=="function"&&(Qd(r,l,ee,u),I=r.memoizedState),(O=Er||Fv(r,l,O,u,F,I,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=I),_.props=u,_.state=I,_.context=y,u=O):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{_=r.stateNode,Ed(s,r),y=r.memoizedProps,Q=Dn(l,y),_.props=Q,ee=r.pendingProps,F=_.context,I=l.contextType,O=Ea,typeof I=="object"&&I!==null&&(O=ss(I)),C=l.getDerivedStateFromProps,(I=typeof C=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(y!==ee||F!==O)&&Uv(r,_,u,O),Er=!1,F=r.memoizedState,_.state=F,Zl(r,u,_,m),Ql();var Y=r.memoizedState;y!==ee||F!==Y||Er||s!==null&&s.dependencies!==null&&Mc(s.dependencies)?(typeof C=="function"&&(Qd(r,l,C,u),Y=r.memoizedState),(Q=Er||Fv(r,l,Q,u,F,Y,O)||s!==null&&s.dependencies!==null&&Mc(s.dependencies))?(I||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(u,Y,O),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(u,Y,O)),typeof _.componentDidUpdate=="function"&&(r.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof _.componentDidUpdate!="function"||y===s.memoizedProps&&F===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&F===s.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=Y),_.props=u,_.state=Y,_.context=O,u=Q):(typeof _.componentDidUpdate!="function"||y===s.memoizedProps&&F===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&F===s.memoizedState||(r.flags|=1024),u=!1)}return _=u,Xc(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,m),r.child=Rn(r,null,l,m)):is(s,r,l,m),r.memoizedState=_.state,s=r.child):s=Zi(s,r,m),s}function ry(s,r,l,u){return kn(),r.flags|=256,is(s,r,l,u),r.child}var tf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sf(s){return{baseLanes:s,cachePool:Vg()}}function rf(s,r,l){return s=s!==null?s.childLanes&~l:0,r&&(s|=Is),s}function ny(s,r,l){var u=r.pendingProps,m=!1,_=(r.flags&128)!==0,y;if((y=_)||(y=s!==null&&s.memoizedState===null?!1:(Et.current&2)!==0),y&&(m=!0,r.flags&=-129),y=(r.flags&32)!==0,r.flags&=-33,s===null){if(Ve){if(m?Or(r):Ar(),(s=ft)?(s=fb(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=qg(s),l.return=r,r.child=l,ts=r,ft=null)):s=null,s===null)throw jr(r);return Hf(s)?r.lanes=32:r.lanes=536870912,null}var C=u.children;return u=u.fallback,m?(Ar(),m=r.mode,C=Jc({mode:"hidden",children:C},m),u=jn(u,m,l,null),C.return=r,u.return=r,C.sibling=u,r.child=C,u=r.child,u.memoizedState=sf(l),u.childLanes=rf(s,y,l),r.memoizedState=tf,so(null,u)):(Or(r),nf(r,C))}var O=s.memoizedState;if(O!==null&&(C=O.dehydrated,C!==null)){if(_)r.flags&256?(Or(r),r.flags&=-257,r=af(s,r,l)):r.memoizedState!==null?(Ar(),r.child=s.child,r.flags|=128,r=null):(Ar(),C=u.fallback,m=r.mode,u=Jc({mode:"visible",children:u.children},m),C=jn(C,m,l,null),C.flags|=2,u.return=r,C.return=r,u.sibling=C,r.child=u,Rn(r,s.child,null,l),u=r.child,u.memoizedState=sf(l),u.childLanes=rf(s,y,l),r.memoizedState=tf,r=so(null,u));else if(Or(r),Hf(C)){if(y=C.nextSibling&&C.nextSibling.dataset,y)var I=y.dgst;y=I,u=Error(n(419)),u.stack="",u.digest=y,Kl({value:u,source:null,stack:null}),r=af(s,r,l)}else if(Mt||Aa(s,r,l,!1),y=(l&s.childLanes)!==0,Mt||y){if(y=ht,y!==null&&(u=$_(y,l),u!==0&&u!==O.retryLane))throw O.retryLane=u,Cn(s,u),Es(y,s,u),Jd;Pf(C)||ou(),r=af(s,r,l)}else Pf(C)?(r.flags|=192,r.child=s.child,r=null):(s=O.treeContext,ft=ni(C.nextSibling),ts=r,Ve=!0,Cr=null,ii=!1,s!==null&&Ig(r,s),r=nf(r,u.children),r.flags|=4096);return r}return m?(Ar(),C=u.fallback,m=r.mode,O=s.child,I=O.sibling,u=$i(O,{mode:"hidden",children:u.children}),u.subtreeFlags=O.subtreeFlags&65011712,I!==null?C=$i(I,C):(C=jn(C,m,l,null),C.flags|=2),C.return=r,u.return=r,u.sibling=C,r.child=u,so(null,u),u=r.child,C=s.child.memoizedState,C===null?C=sf(l):(m=C.cachePool,m!==null?(O=At._currentValue,m=m.parent!==O?{parent:O,pool:O}:m):m=Vg(),C={baseLanes:C.baseLanes|l,cachePool:m}),u.memoizedState=C,u.childLanes=rf(s,y,l),r.memoizedState=tf,so(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 nf(s,r){return r=Jc({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Jc(s,r){return s=zs(22,s,null,r),s.lanes=0,s}function af(s,r,l){return Rn(r,s.child,null,l),s=nf(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function ay(s,r,l){s.lanes|=r;var u=s.alternate;u!==null&&(u.lanes|=r),bd(s.return,r,l)}function lf(s,r,l,u,m,_){var y=s.memoizedState;y===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:m,treeForkCount:_}:(y.isBackwards=r,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=l,y.tailMode=m,y.treeForkCount=_)}function ly(s,r,l){var u=r.pendingProps,m=u.revealOrder,_=u.tail;u=u.children;var y=Et.current,C=(y&2)!==0;if(C?(y=y&1|2,r.flags|=128):y&=1,ne(Et,y),is(s,r,u,l),u=Ve?Ul:0,!C&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&ay(s,l,r);else if(s.tag===19)ay(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(m){case"forwards":for(l=r.child,m=null;l!==null;)s=l.alternate,s!==null&&Ic(s)===null&&(m=l),l=l.sibling;l=m,l===null?(m=r.child,r.child=null):(m=l.sibling,l.sibling=null),lf(r,!1,m,l,_,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&Ic(s)===null){r.child=m;break}s=m.sibling,m.sibling=l,l=m,m=s}lf(r,!0,l,null,_,u);break;case"together":lf(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 of(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Mc(s)))}function Oj(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,Rd(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?ny(s,r,l):(Or(r),s=Zi(s,r,l),s!==null?s.sibling:null);Or(r);break;case 19:var m=(s.flags&128)!==0;if(u=(l&r.childLanes)!==0,u||(Aa(s,r,l,!1),u=(l&r.childLanes)!==0),m){if(u)return ly(s,r,l);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ne(Et,Et.current),u)break;return null;case 22:return r.lanes=0,Jv(s,r,l,r.pendingProps);case 24:kr(r,At,s.memoizedState.cache)}return Zi(s,r,l)}function oy(s,r,l){if(s!==null)if(s.memoizedProps!==r.pendingProps)Mt=!0;else{if(!of(s,l)&&(r.flags&128)===0)return Mt=!1,Oj(s,r,l);Mt=(s.flags&131072)!==0}else Mt=!1,Ve&&(r.flags&1048576)!==0&&Hg(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")dd(s)?(u=Dn(s,u),r.tag=1,r=iy(null,r,s,u,l)):(r.tag=0,r=ef(null,r,s,u,l));else{if(s!=null){var m=s.$$typeof;if(m===M){r.tag=11,r=Qv(null,r,s,u,l);break e}else if(m===K){r.tag=14,r=Zv(null,r,s,u,l);break e}}throw r=re(s)||s,Error(n(306,r,""))}}return r;case 0:return ef(s,r,r.type,r.pendingProps,l);case 1:return u=r.type,m=Dn(u,r.pendingProps),iy(s,r,u,m,l);case 3:e:{if(kt(r,r.stateNode.containerInfo),s===null)throw Error(n(387));u=r.pendingProps;var _=r.memoizedState;m=_.element,Ed(s,r),Zl(r,u,null,l);var y=r.memoizedState;if(u=y.cache,kr(r,At,u),u!==_.cache&&Sd(r,[At],l,!0),Ql(),u=y.element,_.isDehydrated)if(_={element:u,isDehydrated:!1,cache:y.cache},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){r=ry(s,r,u,l);break e}else if(u!==m){m=ei(Error(n(424)),r),Kl(m),r=ry(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=Jg(r,null,u,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(kn(),u===m){r=Zi(s,r,l);break e}is(s,r,u,l)}r=r.child}return r;case 26:return Xc(s,r),s===null?(l=yb(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ve||(l=r.type,s=r.pendingProps,u=pu(ge.current).createElement(l),u[es]=r,u[Ss]=s,rs(u,l,s),$t(u),r.stateNode=u):r.memoizedState=yb(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Rs(r),s===null&&Ve&&(u=r.stateNode=_b(r.type,r.pendingProps,ge.current),ts=r,ii=!0,m=ft,Pr(r.type)?(If=m,ft=ni(u.firstChild)):ft=m),is(s,r,r.pendingProps.children,l),Xc(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&Ve&&((m=u=ft)&&(u=ak(u,r.type,r.pendingProps,ii),u!==null?(r.stateNode=u,ts=r,ft=ni(u.firstChild),ii=!1,m=!0):m=!1),m||jr(r)),Rs(r),m=r.type,_=r.pendingProps,y=s!==null?s.memoizedProps:null,u=_.children,Lf(m,_)?u=null:y!==null&&Lf(m,y)&&(r.flags|=32),r.memoizedState!==null&&(m=Dd(s,r,Sj,null,null,l),vo._currentValue=m),Xc(s,r),is(s,r,u,l),r.child;case 6:return s===null&&Ve&&((s=l=ft)&&(l=lk(l,r.pendingProps,ii),l!==null?(r.stateNode=l,ts=r,ft=null,s=!0):s=!1),s||jr(r)),null;case 13:return ny(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 Qv(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 m=r.type._context,u=r.pendingProps.children,Nn(r),m=ss(m),u=u(m),r.flags|=1,is(s,r,u,l),r.child;case 14:return Zv(s,r,r.type,r.pendingProps,l);case 15:return Xv(s,r,r.type,r.pendingProps,l);case 19:return ly(s,r,l);case 31:return Tj(s,r,l);case 22:return Jv(s,r,l,r.pendingProps);case 24:return Nn(r),u=ss(At),s===null?(m=Cd(),m===null&&(m=ht,_=xd(),m.pooledCache=_,_.refCount++,_!==null&&(m.pooledCacheLanes|=l),m=_),r.memoizedState={parent:u,cache:m},kd(r),kr(r,At,m)):((s.lanes&l)!==0&&(Ed(s,r),Zl(r,null,null,l),Ql()),m=s.memoizedState,_=r.memoizedState,m.parent!==u?(m={parent:u,cache:u},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),kr(r,At,u)):(u=_.cache,kr(r,At,u),u!==m.cache&&Sd(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 cf(s,r,l,u,m){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(By())s.flags|=8192;else throw An=zc,jd}else s.flags&=-16777217}function cy(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Cb(r))if(By())s.flags|=8192;else throw An=zc,jd}function eu(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?F_():536870912,s.lanes|=r,Ua|=r)}function io(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 m=s.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags&65011712,u|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)l|=m.lanes|m.childLanes,u|=m.subtreeFlags,u|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=u,s.childLanes=l,r}function Aj(s,r,l){var u=r.pendingProps;switch(_d(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,vd())),mt(r),null;case 26:var m=r.type,_=r.memoizedState;return s===null?(Xi(r),_!==null?(mt(r),cy(r,_)):(mt(r),cf(r,m,null,u,l))):_?_!==s.memoizedState?(Xi(r),mt(r),cy(r,_)):(mt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==u&&Xi(r),mt(r),cf(r,m,s,u,l)),null;case 27:if(xi(r),l=ge.current,m=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=V.current,Oa(r)?Fg(r):(s=_b(m,u,l),r.stateNode=s,Xi(r))}return mt(r),null;case 5:if(xi(r),m=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(_=V.current,Oa(r))Fg(r);else{var y=pu(ge.current);switch(_){case 1:_=y.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:_=y.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":_=y.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":_=y.createElementNS("http://www.w3.org/1998/Math/MathML",m);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(m,{is:u.is}):y.createElement(m)}}_[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(_,m,u),m){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),cf(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=ge.current,Oa(r)){if(s=r.stateNode,l=r.memoizedProps,u=null,m=ts,m!==null)switch(m.tag){case 27:case 5:u=m.memoizedProps}s[es]=r,s=!!(s.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||nb(s.nodeValue,l)),s||jr(r,!0)}else s=pu(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=vd(),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(m=Oa(r),u!==null&&u.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[es]=r}else kn(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),m=!1}else m=vd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)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,m=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(m=u.alternate.memoizedState.cachePool.pool),_=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(_=u.memoizedState.cachePool.pool),_!==m&&(u.flags|=2048)),l!==s&&l&&(r.child.flags|=8192),eu(r,r.updateQueue),mt(r),null);case 4:return Xe(),s===null&&Af(r.stateNode.containerInfo),mt(r),null;case 10:return Yi(r.type),mt(r),null;case 19:if(W(Et),u=r.memoizedState,u===null)return mt(r),null;if(m=(r.flags&128)!==0,_=u.rendering,_===null)if(m)io(u,!1);else{if(St!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(_=Ic(s),_!==null){for(r.flags|=128,io(u,!1),s=_.updateQueue,r.updateQueue=s,eu(r,s),r.subtreeFlags=0,s=l,l=r.child;l!==null;)zg(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()>nu&&(r.flags|=128,m=!0,io(u,!1),r.lanes=4194304)}else{if(!m)if(s=Ic(_),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,eu(r,s),io(u,!0),u.tail===null&&u.tailMode==="hidden"&&!_.alternate&&!Ve)return mt(r),null}else 2*Ms()-u.renderingStartTime>nu&&l!==536870912&&(r.flags|=128,m=!0,io(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,m?l&1|2:l&1),Ve&&Wi(r,u.treeForkCount),s):(mt(r),null);case 22:case 23:return Ps(r),Ad(),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&&eu(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&&W(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 Rj(s,r){switch(_d(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 W(Et),null;case 4:return Xe(),null;case 10:return Yi(r.type),null;case 22:case 23:return Ps(r),Ad(),s!==null&&W(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 uy(s,r){switch(_d(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:W(Et);break;case 10:Yi(r.type);break;case 22:case 23:Ps(r),Ad(),s!==null&&W(Tn);break;case 24:Yi(At)}}function ro(s,r){try{var l=r.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var m=u.next;l=m;do{if((l.tag&s)===s){u=void 0;var _=l.create,y=l.inst;u=_(),y.destroy=u}l=l.next}while(l!==m)}}catch(C){at(r,r.return,C)}}function Rr(s,r,l){try{var u=r.updateQueue,m=u!==null?u.lastEffect:null;if(m!==null){var _=m.next;u=_;do{if((u.tag&s)===s){var y=u.inst,C=y.destroy;if(C!==void 0){y.destroy=void 0,m=r;var O=l,I=C;try{I()}catch(Q){at(m,O,Q)}}}u=u.next}while(u!==_)}}catch(Q){at(r,r.return,Q)}}function hy(s){var r=s.updateQueue;if(r!==null){var l=s.stateNode;try{tv(r,l)}catch(u){at(s,s.return,u)}}}function dy(s,r,l){l.props=Dn(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(u){at(s,r,u)}}function no(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(m){at(s,r,m)}}function ji(s,r){var l=s.ref,u=s.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(m){at(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(m){at(s,r,m)}else l.current=null}function fy(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(m){at(s,s.return,m)}}function uf(s,r,l){try{var u=s.stateNode;ek(u,s.type,l,r),u[Ss]=r}catch(m){at(s,s.return,m)}}function my(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Pr(s.type)||s.tag===4}function hf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||my(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 df(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=Ui));else if(u!==4&&(u===27&&Pr(s.type)&&(l=s.stateNode,r=null),s=s.child,s!==null))for(df(s,r,l),s=s.sibling;s!==null;)df(s,r,l),s=s.sibling}function tu(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(tu(s,r,l),s=s.sibling;s!==null;)tu(s,r,l),s=s.sibling}function py(s){var r=s.stateNode,l=s.memoizedProps;try{for(var u=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);rs(r,u,l),r[es]=s,r[Ss]=l}catch(_){at(s,s.return,_)}}var Ji=!1,Dt=!1,ff=!1,_y=typeof WeakSet=="function"?WeakSet:Set,Wt=null;function Mj(s,r){if(s=s.containerInfo,Df=xu,s=Ng(s),nd(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 m=u.anchorOffset,_=u.focusNode;u=u.focusOffset;try{l.nodeType,_.nodeType}catch{l=null;break e}var y=0,C=-1,O=-1,I=0,Q=0,ee=s,F=null;t:for(;;){for(var Y;ee!==l||m!==0&&ee.nodeType!==3||(C=y+m),ee!==_||u!==0&&ee.nodeType!==3||(O=y+u),ee.nodeType===3&&(y+=ee.nodeValue.length),(Y=ee.firstChild)!==null;)F=ee,ee=Y;for(;;){if(ee===s)break t;if(F===l&&++I===m&&(C=y),F===_&&++Q===u&&(O=y),(Y=ee.nextSibling)!==null)break;ee=F,F=ee.parentNode}ee=Y}l=C===-1||O===-1?null:{start:C,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(Bf={focusedElem:s,selectionRange:l},xu=!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++)m=s[l],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&_!==null){s=void 0,l=r,m=_.memoizedProps,_=_.memoizedState,u=l.stateNode;try{var ve=Dn(l.type,m);s=u.getSnapshotBeforeUpdate(ve,_),u.__reactInternalSnapshotBeforeUpdate=s}catch(ke){at(l,l.return,ke)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,l=s.nodeType,l===9)qf(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":qf(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 gy(s,r,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:tr(s,l),u&4&&ro(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 m=Dn(l.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(y){at(l,l.return,y)}}u&64&&hy(l),u&512&&no(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{tv(s,r)}catch(y){at(l,l.return,y)}}break;case 27:r===null&&u&4&&py(l);case 26:case 5:tr(s,l),r===null&&u&4&&fy(l),u&512&&no(l,l.return);break;case 12:tr(s,l);break;case 31:tr(s,l),u&4&&by(s,l);break;case 13:tr(s,l),u&4&&Sy(s,l),u&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=Fj.bind(null,l),ok(s,l))));break;case 22:if(u=l.memoizedState!==null||Ji,!u){r=r!==null&&r.memoizedState!==null||Dt,m=Ji;var _=Dt;Ji=u,(Dt=r)&&!_?sr(s,l,(l.subtreeFlags&8772)!==0):tr(s,l),Ji=m,Dt=_}break;case 30:break;default:tr(s,l)}}function vy(s){var r=s.alternate;r!==null&&(s.alternate=null,vy(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&Fh(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;)yy(s,r,l),l=l.sibling}function yy(s,r,l){if(Ds&&typeof Ds.onCommitFiberUnmount=="function")try{Ds.onCommitFiberUnmount(Tl,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,m=ws;Pr(l.type)&&(_t=l.stateNode,ws=!1),er(s,r,l),po(l.stateNode),_t=u,ws=m;break;case 5:Dt||ji(l,r);case 6:if(u=_t,m=ws,_t=null,er(s,r,l),_t=u,ws=m,_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,hb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Za(s)):hb(_t,l.stateNode));break;case 4:u=_t,m=ws,_t=l.stateNode.containerInfo,ws=!0,er(s,r,l),_t=u,ws=m;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"&&dy(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 by(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 Sy(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 Dj(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new _y),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new _y),r;default:throw Error(n(435,s.tag))}}function su(s,r){var l=Dj(s);r.forEach(function(u){if(!l.has(u)){l.add(u);var m=Uj.bind(null,s,u);u.then(m,m)}})}function Cs(s,r){var l=r.deletions;if(l!==null)for(var u=0;u<l.length;u++){var m=l[u],_=s,y=r,C=y;e:for(;C!==null;){switch(C.tag){case 27:if(Pr(C.type)){_t=C.stateNode,ws=!1;break e}break;case 5:_t=C.stateNode,ws=!1;break e;case 3:case 4:_t=C.stateNode.containerInfo,ws=!0;break e}C=C.return}if(_t===null)throw Error(n(160));yy(_,y,m),_t=null,ws=!1,_=m.alternate,_!==null&&(_.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)xy(r,s),r=r.sibling}var _i=null;function xy(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),ro(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 m=_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,m=m.ownerDocument||m;t:switch(u){case"title":_=m.getElementsByTagName("title")[0],(!_||_[Rl]||_[es]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=m.createElement(u),m.head.insertBefore(_,m.querySelector("head > title"))),rs(_,u,l),_[es]=s,$t(_),u=_;break e;case"link":var y=xb("link","href",m).get(u+(l.href||""));if(y){for(var C=0;C<y.length;C++)if(_=y[C],_.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(C,1);break t}}_=m.createElement(u),rs(_,u,l),m.head.appendChild(_);break;case"meta":if(y=xb("meta","content",m).get(u+(l.content||""))){for(C=0;C<y.length;C++)if(_=y[C],_.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(C,1);break t}}_=m.createElement(u),rs(_,u,l),m.head.appendChild(_);break;default:throw Error(n(468,u))}_[es]=s,$t(_),u=_}s.stateNode=u}else wb(m,s.type,s.stateNode);else s.stateNode=Sb(m,u,s.memoizedProps);else _!==u?(_===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):_.count--,u===null?wb(m,s.type,s.stateNode):Sb(m,u,s.memoizedProps)):u===null&&s.stateNode!==null&&uf(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&&uf(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){m=s.stateNode;try{ba(m,"")}catch(ve){at(s,s.return,ve)}}u&4&&s.stateNode!=null&&(m=s.memoizedProps,uf(s,m,l!==null?l.memoizedProps:m)),u&1024&&(ff=!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(ve){at(s,s.return,ve)}}break;case 3:if(vu=null,m=_i,_i=_u(r.containerInfo),Cs(r,s),_i=m,js(s),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Za(r.containerInfo)}catch(ve){at(s,s.return,ve)}ff&&(ff=!1,wy(s));break;case 4:u=_i,_i=_u(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,su(s,u)));break;case 13:Cs(r,s),js(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ru=Ms()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,su(s,u)));break;case 22:m=s.memoizedState!==null;var O=l!==null&&l.memoizedState!==null,I=Ji,Q=Dt;if(Ji=I||m,Dt=Q||O,Cs(r,s),Dt=Q,Ji=I,js(s),u&8192)e:for(r=s.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(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,m)y=_.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{C=O.stateNode;var ee=O.memoizedProps.style,F=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;C.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(ve){at(O,O.return,ve)}}}else if(r.tag===6){if(l===null){O=r;try{O.stateNode.nodeValue=m?"":O.memoizedProps}catch(ve){at(O,O.return,ve)}}}else if(r.tag===18){if(l===null){O=r;try{var Y=O.stateNode;m?db(Y,!0):db(O.stateNode,!1)}catch(ve){at(O,O.return,ve)}}}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,su(s,l))));break;case 19:Cs(r,s),js(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,su(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(my(u)){l=u;break}u=u.return}if(l==null)throw Error(n(160));switch(l.tag){case 27:var m=l.stateNode,_=hf(s);tu(s,_,m);break;case 5:var y=l.stateNode;l.flags&32&&(ba(y,""),l.flags&=-33);var C=hf(s);tu(s,C,y);break;case 3:case 4:var O=l.stateNode.containerInfo,I=hf(s);df(s,I,O);break;default:throw Error(n(161))}}catch(Q){at(s,s.return,Q)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function wy(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;wy(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;)gy(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"&&dy(r,r.return,l),Bn(r);break;case 27:po(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,m=s,_=r,y=_.flags;switch(_.tag){case 0:case 11:case 15:sr(m,_,l),ro(4,_);break;case 1:if(sr(m,_,l),u=_,m=u.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(I){at(u,u.return,I)}if(u=_,m=u.updateQueue,m!==null){var C=u.stateNode;try{var O=m.shared.hiddenCallbacks;if(O!==null)for(m.shared.hiddenCallbacks=null,m=0;m<O.length;m++)ev(O[m],C)}catch(I){at(u,u.return,I)}}l&&y&64&&hy(_),no(_,_.return);break;case 27:py(_);case 26:case 5:sr(m,_,l),l&&u===null&&y&4&&fy(_),no(_,_.return);break;case 12:sr(m,_,l);break;case 31:sr(m,_,l),l&&y&4&&by(m,_);break;case 13:sr(m,_,l),l&&y&4&&Sy(m,_);break;case 22:_.memoizedState===null&&sr(m,_,l),no(_,_.return);break;case 30:break;default:sr(m,_,l)}r=r.sibling}}function mf(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&&$l(l))}function pf(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&$l(s))}function gi(s,r,l,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Cy(s,r,l,u),r=r.sibling}function Cy(s,r,l,u){var m=r.flags;switch(r.tag){case 0:case 11:case 15:gi(s,r,l,u),m&2048&&ro(9,r);break;case 1:gi(s,r,l,u);break;case 3:gi(s,r,l,u),m&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&$l(s)));break;case 12:if(m&2048){gi(s,r,l,u),s=r.stateNode;try{var _=r.memoizedProps,y=_.id,C=_.onPostCommit;typeof C=="function"&&C(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):ao(s,r):_._visibility&2?gi(s,r,l,u):(_._visibility|=2,Ha(s,r,l,u,(r.subtreeFlags&10256)!==0||!1)),m&2048&&mf(y,r);break;case 24:gi(s,r,l,u),m&2048&&pf(r.alternate,r);break;default:gi(s,r,l,u)}}function Ha(s,r,l,u,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var _=s,y=r,C=l,O=u,I=y.flags;switch(y.tag){case 0:case 11:case 15:Ha(_,y,C,O,m),ro(8,y);break;case 23:break;case 22:var Q=y.stateNode;y.memoizedState!==null?Q._visibility&2?Ha(_,y,C,O,m):ao(_,y):(Q._visibility|=2,Ha(_,y,C,O,m)),m&&I&2048&&mf(y.alternate,y);break;case 24:Ha(_,y,C,O,m),m&&I&2048&&pf(y.alternate,y);break;default:Ha(_,y,C,O,m)}r=r.sibling}}function ao(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=s,u=r,m=u.flags;switch(u.tag){case 22:ao(l,u),m&2048&&mf(u.alternate,u);break;case 24:ao(l,u),m&2048&&pf(u.alternate,u);break;default:ao(l,u)}r=r.sibling}}var lo=8192;function Ia(s,r,l){if(s.subtreeFlags&lo)for(s=s.child;s!==null;)jy(s,r,l),s=s.sibling}function jy(s,r,l){switch(s.tag){case 26:Ia(s,r,l),s.flags&lo&&s.memoizedState!==null&&bk(l,_i,s.memoizedState,s.memoizedProps);break;case 5:Ia(s,r,l);break;case 3:case 4:var u=_i;_i=_u(s.stateNode.containerInfo),Ia(s,r,l),_i=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=lo,lo=16777216,Ia(s,r,l),lo=u):Ia(s,r,l));break;default:Ia(s,r,l)}}function ky(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 oo(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,Ny(u,s)}ky(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ey(s),s=s.sibling}function Ey(s){switch(s.tag){case 0:case 11:case 15:oo(s),s.flags&2048&&Rr(9,s,s.return);break;case 3:oo(s);break;case 12:oo(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,iu(s)):oo(s);break;default:oo(s)}}function iu(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,Ny(u,s)}ky(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Rr(8,r,r.return),iu(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,iu(r));break;default:iu(r)}s=s.sibling}}function Ny(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:$l(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,Wt=u;else e:for(l=s;Wt!==null;){u=Wt;var m=u.sibling,_=u.return;if(vy(u),u===l){Wt=null;break e}if(m!==null){m.return=_,Wt=m;break e}Wt=_}}}var Bj={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}},Lj=typeof WeakMap=="function"?WeakMap:Map,it=0,ht=null,Fe=null,Ke=0,nt=0,Hs=null,Mr=!1,Fa=!1,_f=!1,ir=0,St=0,Dr=0,Ln=0,gf=0,Is=0,Ua=0,co=null,ks=null,vf=!1,ru=0,Ty=0,nu=1/0,au=null,Br=null,Pt=0,Lr=null,Ka=null,rr=0,yf=0,bf=null,Oy=null,uo=0,Sf=null;function Fs(){return(it&2)!==0&&Ke!==0?Ke&-Ke:A.T!==null?Ef():W_()}function Ay(){if(Is===0)if((Ke&536870912)===0||Ve){var s=mc;mc<<=1,(mc&3932160)===0&&(mc=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)),Al(s,l),((it&2)===0||s!==ht)&&(s===ht&&((it&2)===0&&(Ln|=l),St===4&&zr(s,Ke,Is,!1)),ki(s))}function Ry(s,r,l){if((it&6)!==0)throw Error(n(327));var u=!l&&(r&127)===0&&(r&s.expiredLanes)===0||Ol(s,r),m=u?Pj(s,r):wf(s,r,!0),_=u;do{if(m===0){Fa&&!u&&zr(s,r,0,!1);break}else{if(l=s.current.alternate,_&&!zj(l)){m=wf(s,r,!1),_=!1;continue}if(m===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 C=s;m=co;var O=C.current.memoizedState.isDehydrated;if(O&&($a(C,y).flags|=256),y=wf(C,y,!1),y!==2){if(_f&&!O){C.errorRecoveryDisabledLanes|=_,Ln|=_,m=4;break e}_=ks,ks=m,_!==null&&(ks===null?ks=_:ks.push.apply(ks,_))}m=y}if(_=!1,m!==2)continue}}if(m===1){$a(s,0),zr(s,r,0,!0);break}e:{switch(u=s,_=m,_){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&&(m=ru+300-Ms(),10<m)){if(zr(u,r,Is,!Mr),_c(u,0,!0)!==0)break e;rr=r,u.timeoutHandle=cb(My.bind(null,u,l,ks,au,vf,r,Is,Ln,Ua,Mr,_,"Throttled",-0,0),m);break e}My(u,l,ks,au,vf,r,Is,Ln,Ua,Mr,_,null,-0,0)}}break}while(!0);ki(s)}function My(s,r,l,u,m,_,y,C,O,I,Q,ee,F,Y){if(s.timeoutHandle=-1,ee=r.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ui},jy(r,_,ee);var ve=(_&62914560)===_?ru-Ms():(_&4194048)===_?Ty-Ms():0;if(ve=Sk(ee,ve),ve!==null){rr=_,s.cancelPendingCommit=ve(Iy.bind(null,s,r,_,l,u,m,y,C,O,Q,ee,null,F,Y)),zr(s,_,y,!I);return}}Iy(s,r,_,l,u,m,y,C,O)}function zj(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 m=l[u],_=m.getSnapshot;m=m.value;try{if(!Ls(_(),m))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&=~gf,r&=~Ln,s.suspendedLanes|=r,s.pingedLanes&=~r,u&&(s.warmLanes|=r),u=s.expirationTimes;for(var m=r;0<m;){var _=31-Bs(m),y=1<<_;u[_]=-1,m&=~y}l!==0&&U_(s,l,r)}function lu(){return(it&6)===0?(ho(0),!1):!0}function xf(){if(Fe!==null){if(nt===0)var s=Fe.return;else s=Fe,Vi=En=null,zd(s),Ba=null,Vl=0,s=Fe;for(;s!==null;)uy(s.alternate,s),s=s.return;Fe=null}}function $a(s,r){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,ik(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),rr=0,xf(),ht=s,Fe=l=$i(s.current,null),Ke=r,nt=0,Hs=null,Mr=!1,Fa=Ol(s,r),_f=!1,Ua=Is=gf=Ln=Dr=St=0,ks=co=null,vf=!1,(r&8)!==0&&(r|=r&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=r;0<u;){var m=31-Bs(u),_=1<<m;r|=s[m],u&=~_}return ir=r,Nc(),l}function Dy(s,r){Be=null,A.H=to,r===Da||r===Lc?(r=Qg(),nt=3):r===jd?(r=Qg(),nt=4):nt=r===Jd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Hs=r,Fe===null&&(St=1,Qc(s,ei(r,s.current)))}function By(){var s=qs.current;return s===null?!0:(Ke&4194048)===Ke?ri===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?s===ri:!1}function Ly(){var s=A.H;return A.H=to,s===null?to:s}function zy(){var s=A.A;return A.A=Bj,s}function ou(){St=4,Mr||(Ke&4194048)!==Ke&&qs.current!==null||(Fa=!0),(Dr&134217727)===0&&(Ln&134217727)===0||ht===null||zr(ht,Ke,Is,!1)}function wf(s,r,l){var u=it;it|=2;var m=Ly(),_=zy();(ht!==s||Ke!==r)&&(au=null,$a(s,r)),r=!1;var y=St;e:do try{if(nt!==0&&Fe!==null){var C=Fe,O=Hs;switch(nt){case 8:xf(),y=6;break e;case 3:case 2:case 9:case 6:qs.current===null&&(r=!0);var I=nt;if(nt=0,Hs=null,Wa(s,C,O,I),l&&Fa){y=0;break e}break;default:I=nt,nt=0,Hs=null,Wa(s,C,O,I)}}qj(),y=St;break}catch(Q){Dy(s,Q)}while(!0);return r&&s.shellSuspendCounter++,Vi=En=null,it=u,A.H=m,A.A=_,Fe===null&&(ht=null,Ke=0,Nc()),y}function qj(){for(;Fe!==null;)qy(Fe)}function Pj(s,r){var l=it;it|=2;var u=Ly(),m=zy();ht!==s||Ke!==r?(au=null,nu=Ms()+500,$a(s,r)):Fa=Ol(s,r);e:do try{if(nt!==0&&Fe!==null){r=Fe;var _=Hs;t:switch(nt){case 1:nt=0,Hs=null,Wa(s,r,_,1);break;case 2:case 9:if(Yg(_)){nt=0,Hs=null,Py(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:Yg(_)?(nt=0,Hs=null,Py(r)):(nt=0,Hs=null,Wa(s,r,_,7));break;case 5:var y=null;switch(Fe.tag){case 26:y=Fe.memoizedState;case 5:case 27:var C=Fe;if(y?Cb(y):C.stateNode.complete){nt=0,Hs=null;var O=C.sibling;if(O!==null)Fe=O;else{var I=C.return;I!==null?(Fe=I,cu(I)):Fe=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:xf(),St=6;break e;default:throw Error(n(462))}}Hj();break}catch(Q){Dy(s,Q)}while(!0);return Vi=En=null,A.H=u,A.A=m,it=l,Fe!==null?0:(ht=null,Ke=0,Nc(),St)}function Hj(){for(;Fe!==null&&!cC();)qy(Fe)}function qy(s){var r=oy(s.alternate,s,ir);s.memoizedProps=s.pendingProps,r===null?cu(s):Fe=r}function Py(s){var r=s,l=r.alternate;switch(r.tag){case 15:case 0:r=sy(l,r,r.pendingProps,r.type,void 0,Ke);break;case 11:r=sy(l,r,r.pendingProps,r.type.render,r.ref,Ke);break;case 5:zd(r);default:uy(l,r),r=Fe=zg(r,ir),r=oy(l,r,ir)}s.memoizedProps=s.pendingProps,r===null?cu(s):Fe=r}function Wa(s,r,l,u){Vi=En=null,zd(r),Ba=null,Vl=0;var m=r.return;try{if(Nj(s,m,r,l,Ke)){St=1,Qc(s,ei(l,s.current)),Fe=null;return}}catch(_){if(m!==null)throw Fe=m,_;St=1,Qc(s,ei(l,s.current)),Fe=null;return}r.flags&32768?(Ve||u===1?s=!0:Fa||(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))),Hy(r,s)):cu(r)}function cu(s){var r=s;do{if((r.flags&32768)!==0){Hy(r,Mr);return}s=r.return;var l=Aj(r.alternate,r,ir);if(l!==null){Fe=l;return}if(r=r.sibling,r!==null){Fe=r;return}Fe=r=s}while(r!==null);St===0&&(St=5)}function Hy(s,r){do{var l=Rj(s.alternate,s);if(l!==null){l.flags&=32767,Fe=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(s=s.sibling,s!==null)){Fe=s;return}Fe=s=l}while(s!==null);St=6,Fe=null}function Iy(s,r,l,u,m,_,y,C,O){s.cancelPendingCommit=null;do uu();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,_|=ud,yC(s,l,_,y,C,O),s===ht&&(Fe=ht=null,Ke=0),Ka=r,Lr=s,rr=l,yf=_,bf=m,Oy=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,Kj(dc,function(){return Wy(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=A.T,A.T=null,m=U.p,U.p=2,y=it,it|=4;try{Mj(s,r,l)}finally{it=y,U.p=m,A.T=u}}Pt=1,Fy(),Uy(),Ky()}}function Fy(){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=U.p;U.p=2;var m=it;it|=4;try{xy(r,s);var _=Bf,y=Ng(s.containerInfo),C=_.focusedElem,O=_.selectionRange;if(y!==C&&C&&C.ownerDocument&&Eg(C.ownerDocument.documentElement,C)){if(O!==null&&nd(C)){var I=O.start,Q=O.end;if(Q===void 0&&(Q=I),"selectionStart"in C)C.selectionStart=I,C.selectionEnd=Math.min(Q,C.value.length);else{var ee=C.ownerDocument||document,F=ee&&ee.defaultView||window;if(F.getSelection){var Y=F.getSelection(),ve=C.textContent.length,ke=Math.min(O.start,ve),ct=O.end===void 0?ke:Math.min(O.end,ve);!Y.extend&&ke>ct&&(y=ct,ct=ke,ke=y);var B=kg(C,ke),R=kg(C,ct);if(B&&R&&(Y.rangeCount!==1||Y.anchorNode!==B.node||Y.anchorOffset!==B.offset||Y.focusNode!==R.node||Y.focusOffset!==R.offset)){var H=ee.createRange();H.setStart(B.node,B.offset),Y.removeAllRanges(),ke>ct?(Y.addRange(H),Y.extend(R.node,R.offset)):(H.setEnd(R.node,R.offset),Y.addRange(H))}}}}for(ee=[],Y=C;Y=Y.parentNode;)Y.nodeType===1&&ee.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<ee.length;C++){var J=ee[C];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}xu=!!Df,Bf=Df=null}finally{it=m,U.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=U.p;U.p=2;var m=it;it|=4;try{gy(s,r.alternate,r)}finally{it=m,U.p=u,A.T=l}}Pt=3}}function Ky(){if(Pt===4||Pt===3){Pt=0,uC();var s=Lr,r=Ka,l=rr,u=Oy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Pt=5:(Pt=0,Ka=Lr=null,$y(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(Br=null),Hh(l),r=r.stateNode,Ds&&typeof Ds.onCommitFiberRoot=="function")try{Ds.onCommitFiberRoot(Tl,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=A.T,m=U.p,U.p=2,A.T=null;try{for(var _=s.onRecoverableError,y=0;y<u.length;y++){var C=u[y];_(C.value,{componentStack:C.stack})}}finally{A.T=r,U.p=m}}(rr&3)!==0&&uu(),ki(s),m=s.pendingLanes,(l&261930)!==0&&(m&42)!==0?s===Sf?uo++:(uo=0,Sf=s):uo=0,ho(0)}}function $y(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,$l(r)))}function uu(){return Fy(),Uy(),Ky(),Wy()}function Wy(){if(Pt!==5)return!1;var s=Lr,r=yf;yf=0;var l=Hh(rr),u=A.T,m=U.p;try{U.p=32>l?32:l,A.T=null,l=bf,bf=null;var _=Lr,y=rr;if(Pt=0,Ka=Lr=null,rr=0,(it&6)!==0)throw Error(n(331));var C=it;if(it|=4,Ey(_.current),Cy(_,_.current,y,l),it=C,ho(0,!1),Ds&&typeof Ds.onPostCommitFiberRoot=="function")try{Ds.onPostCommitFiberRoot(Tl,_)}catch{}return!0}finally{U.p=m,A.T=u,$y(s,r)}}function Vy(s,r,l){r=ei(l,r),r=Xd(s.stateNode,r,2),s=Tr(s,r,2),s!==null&&(Al(s,2),ki(s))}function at(s,r,l){if(s.tag===3)Vy(s,s,l);else for(;r!==null;){if(r.tag===3){Vy(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=Yv(2),u=Tr(r,l,2),u!==null&&(Gv(l,u,r,s),Al(u,2),ki(u));break}}r=r.return}}function Cf(s,r,l){var u=s.pingCache;if(u===null){u=s.pingCache=new Lj;var m=new Set;u.set(r,m)}else m=u.get(r),m===void 0&&(m=new Set,u.set(r,m));m.has(l)||(_f=!0,m.add(l),s=Ij.bind(null,s,r,l),r.then(s,s))}function Ij(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()-ru?(it&2)===0&&$a(s,0):gf|=l,Ua===Ke&&(Ua=0)),ki(s)}function Yy(s,r){r===0&&(r=F_()),s=Cn(s,r),s!==null&&(Al(s,r),ki(s))}function Fj(s){var r=s.memoizedState,l=0;r!==null&&(l=r.retryLane),Yy(s,l)}function Uj(s,r){var l=0;switch(s.tag){case 31:case 13:var u=s.stateNode,m=s.memoizedState;m!==null&&(l=m.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),Yy(s,l)}function Kj(s,r){return Lh(s,r)}var hu=null,Va=null,jf=!1,du=!1,kf=!1,qr=0;function ki(s){s!==Va&&s.next===null&&(Va===null?hu=Va=s:Va=Va.next=s),du=!0,jf||(jf=!0,Wj())}function ho(s,r){if(!kf&&du){kf=!0;do for(var l=!1,u=hu;u!==null;){if(s!==0){var m=u.pendingLanes;if(m===0)var _=0;else{var y=u.suspendedLanes,C=u.pingedLanes;_=(1<<31-Bs(42|s)+1)-1,_&=m&~(y&~C),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(l=!0,Xy(u,_))}else _=Ke,_=_c(u,u===ht?_:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(_&3)===0||Ol(u,_)||(l=!0,Xy(u,_));u=u.next}while(l);kf=!1}}function $j(){Gy()}function Gy(){du=jf=!1;var s=0;qr!==0&&sk()&&(s=qr);for(var r=Ms(),l=null,u=hu;u!==null;){var m=u.next,_=Qy(u,r);_===0?(u.next=null,l===null?hu=m:l.next=m,m===null&&(Va=l)):(l=u,(s!==0||(_&3)!==0)&&(du=!0)),u=m}Pt!==0&&Pt!==5||ho(s),qr!==0&&(qr=0)}function Qy(s,r){for(var l=s.suspendedLanes,u=s.pingedLanes,m=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var y=31-Bs(_),C=1<<y,O=m[y];O===-1?((C&l)===0||(C&u)!==0)&&(m[y]=vC(C,r)):O<=r&&(s.expiredLanes|=C),_&=~C}if(r=ht,l=Ke,l=_c(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&&zh(u),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||Ol(s,l)){if(r=l&-l,r===s.callbackPriority)return r;switch(u!==null&&zh(u),Hh(l)){case 2:case 8:l=H_;break;case 32:l=dc;break;case 268435456:l=I_;break;default:l=dc}return u=Zy.bind(null,s),l=Lh(l,u),s.callbackPriority=r,s.callbackNode=l,r}return u!==null&&u!==null&&zh(u),s.callbackPriority=2,s.callbackNode=null,2}function Zy(s,r){if(Pt!==0&&Pt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(uu()&&s.callbackNode!==l)return null;var u=Ke;return u=_c(s,s===ht?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(Ry(s,u,r),Qy(s,Ms()),s.callbackNode!=null&&s.callbackNode===l?Zy.bind(null,s):null)}function Xy(s,r){if(uu())return null;Ry(s,r,!0)}function Wj(){rk(function(){(it&6)!==0?Lh(P_,$j):Gy()})}function Ef(){if(qr===0){var s=Ra;s===0&&(s=fc,fc<<=1,(fc&261888)===0&&(fc=256)),qr=s}return qr}function Jy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:bc(""+s)}function eb(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 Vj(s,r,l,u,m){if(r==="submit"&&l&&l.stateNode===m){var _=Jy((m[Ss]||null).action),y=u.submitter;y&&(r=(r=y[Ss]||null)?Jy(r.formAction):y.getAttribute("formAction"),r!==null&&(_=r,y=null));var C=new Cc("action","action",null,u,m);s.push({event:C,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(qr!==0){var O=y?eb(m,y):new FormData(m);Wd(l,{pending:!0,data:O,method:m.method,action:_},null,O)}}else typeof _=="function"&&(C.preventDefault(),O=y?eb(m,y):new FormData(m),Wd(l,{pending:!0,data:O,method:m.method,action:_},_,O))},currentTarget:m}]})}}for(var Nf=0;Nf<cd.length;Nf++){var Tf=cd[Nf],Yj=Tf.toLowerCase(),Gj=Tf[0].toUpperCase()+Tf.slice(1);pi(Yj,"on"+Gj)}pi(Ag,"onAnimationEnd"),pi(Rg,"onAnimationIteration"),pi(Mg,"onAnimationStart"),pi("dblclick","onDoubleClick"),pi("focusin","onFocus"),pi("focusout","onBlur"),pi(hj,"onTransitionRun"),pi(dj,"onTransitionStart"),pi(fj,"onTransitionCancel"),pi(Dg,"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 fo="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(" "),Qj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fo));function tb(s,r){r=(r&4)!==0;for(var l=0;l<s.length;l++){var u=s[l],m=u.event;u=u.listeners;e:{var _=void 0;if(r)for(var y=u.length-1;0<=y;y--){var C=u[y],O=C.instance,I=C.currentTarget;if(C=C.listener,O!==_&&m.isPropagationStopped())break e;_=C,m.currentTarget=I;try{_(m)}catch(Q){Ec(Q)}m.currentTarget=null,_=O}else for(y=0;y<u.length;y++){if(C=u[y],O=C.instance,I=C.currentTarget,C=C.listener,O!==_&&m.isPropagationStopped())break e;_=C,m.currentTarget=I;try{_(m)}catch(Q){Ec(Q)}m.currentTarget=null,_=O}}}}function Ue(s,r){var l=r[Ih];l===void 0&&(l=r[Ih]=new Set);var u=s+"__bubble";l.has(u)||(sb(r,s,2,!1),l.add(u))}function Of(s,r,l){var u=0;r&&(u|=4),sb(l,s,u,r)}var fu="_reactListening"+Math.random().toString(36).slice(2);function Af(s){if(!s[fu]){s[fu]=!0,G_.forEach(function(l){l!=="selectionchange"&&(Qj.has(l)||Of(l,!1,s),Of(l,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[fu]||(r[fu]=!0,Of("selectionchange",!1,r))}}function sb(s,r,l,u){switch(Ab(r)){case 2:var m=Ck;break;case 8:m=jk;break;default:m=Wf}l=m.bind(null,r,l,s),m=void 0,!Qh||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),u?m!==void 0?s.addEventListener(r,l,{capture:!0,passive:m}):s.addEventListener(r,l,!0):m!==void 0?s.addEventListener(r,l,{passive:m}):s.addEventListener(r,l,!1)}function Rf(s,r,l,u,m){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 C=u.stateNode.containerInfo;if(C===m)break;if(y===4)for(y=u.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===m)return;y=y.return}for(;C!==null;){if(y=pa(C),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){u=_=y;continue e}C=C.parentNode}}u=u.return}lg(function(){var I=_,Q=Yh(l),ee=[];e:{var F=Bg.get(s);if(F!==void 0){var Y=Cc,ve=s;switch(s){case"keypress":if(xc(l)===0)break e;case"keydown":case"keyup":Y=UC;break;case"focusin":ve="focus",Y=ed;break;case"focusout":ve="blur",Y=ed;break;case"beforeblur":case"afterblur":Y=ed;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":Y=ug;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=AC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=WC;break;case Ag:case Rg:case Mg:Y=DC;break;case Dg:Y=YC;break;case"scroll":case"scrollend":Y=TC;break;case"wheel":Y=QC;break;case"copy":case"cut":case"paste":Y=LC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=dg;break;case"toggle":case"beforetoggle":Y=XC}var ke=(r&4)!==0,ct=!ke&&(s==="scroll"||s==="scrollend"),B=ke?F!==null?F+"Capture":null:F;ke=[];for(var R=I,H;R!==null;){var J=R;if(H=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||H===null||B===null||(J=Dl(R,B),J!=null&&ke.push(mo(R,J,H))),ct)break;R=R.return}0<ke.length&&(F=new Y(F,ve,null,l,Q),ee.push({event:F,listeners:ke}))}}if((r&7)===0){e:{if(F=s==="mouseover"||s==="pointerover",Y=s==="mouseout"||s==="pointerout",F&&l!==Vh&&(ve=l.relatedTarget||l.fromElement)&&(pa(ve)||ve[ma]))break e;if((Y||F)&&(F=Q.window===Q?Q:(F=Q.ownerDocument)?F.defaultView||F.parentWindow:window,Y?(ve=l.relatedTarget||l.toElement,Y=I,ve=ve?pa(ve):null,ve!==null&&(ct=c(ve),ke=ve.tag,ve!==ct||ke!==5&&ke!==27&&ke!==6)&&(ve=null)):(Y=null,ve=I),Y!==ve)){if(ke=ug,J="onMouseLeave",B="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(ke=dg,J="onPointerLeave",B="onPointerEnter",R="pointer"),ct=Y==null?F:Ml(Y),H=ve==null?F:Ml(ve),F=new ke(J,R+"leave",Y,l,Q),F.target=ct,F.relatedTarget=H,J=null,pa(Q)===I&&(ke=new ke(B,R+"enter",ve,l,Q),ke.target=H,ke.relatedTarget=ct,J=ke),ct=J,Y&&ve)t:{for(ke=Zj,B=Y,R=ve,H=0,J=B;J;J=ke(J))H++;J=0;for(var Ce=R;Ce;Ce=ke(Ce))J++;for(;0<H-J;)B=ke(B),H--;for(;0<J-H;)R=ke(R),J--;for(;H--;){if(B===R||R!==null&&B===R.alternate){ke=B;break t}B=ke(B),R=ke(R)}ke=null}else ke=null;Y!==null&&ib(ee,F,Y,ke,!1),ve!==null&&ct!==null&&ib(ee,ct,ve,ke,!0)}}e:{if(F=I?Ml(I):window,Y=F.nodeName&&F.nodeName.toLowerCase(),Y==="select"||Y==="input"&&F.type==="file")var tt=bg;else if(vg(F))if(Sg)tt=oj;else{tt=aj;var Se=nj}else Y=F.nodeName,!Y||Y.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?I&&Wh(I.elementType)&&(tt=bg):tt=lj;if(tt&&(tt=tt(s,I))){yg(ee,tt,l,Q);break e}Se&&Se(s,F,I),s==="focusout"&&I&&F.type==="number"&&I.memoizedProps.value!=null&&$h(F,"number",F.value)}switch(Se=I?Ml(I):window,s){case"focusin":(vg(Se)||Se.contentEditable==="true")&&(Ca=Se,ad=I,Fl=null);break;case"focusout":Fl=ad=Ca=null;break;case"mousedown":ld=!0;break;case"contextmenu":case"mouseup":case"dragend":ld=!1,Tg(ee,l,Q);break;case"selectionchange":if(uj)break;case"keydown":case"keyup":Tg(ee,l,Q)}var Le;if(sd)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?_g(s,l)&&($e="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&($e="onCompositionStart");$e&&(fg&&l.locale!=="ko"&&(wa||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&wa&&(Le=og()):(xr=Q,Zh="value"in xr?xr.value:xr.textContent,wa=!0)),Se=mu(I,$e),0<Se.length&&($e=new hg($e,s,null,l,Q),ee.push({event:$e,listeners:Se}),Le?$e.data=Le:(Le=gg(l),Le!==null&&($e.data=Le)))),(Le=ej?tj(s,l):sj(s,l))&&($e=mu(I,"onBeforeInput"),0<$e.length&&(Se=new hg("onBeforeInput","beforeinput",null,l,Q),ee.push({event:Se,listeners:$e}),Se.data=Le)),Vj(ee,s,I,l,Q)}tb(ee,r)})}function mo(s,r,l){return{instance:s,listener:r,currentTarget:l}}function mu(s,r){for(var l=r+"Capture",u=[];s!==null;){var m=s,_=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||_===null||(m=Dl(s,l),m!=null&&u.unshift(mo(s,m,_)),m=Dl(s,r),m!=null&&u.push(mo(s,m,_))),s.tag===3)return u;s=s.return}return[]}function Zj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function ib(s,r,l,u,m){for(var _=r._reactName,y=[];l!==null&&l!==u;){var C=l,O=C.alternate,I=C.stateNode;if(C=C.tag,O!==null&&O===u)break;C!==5&&C!==26&&C!==27||I===null||(O=I,m?(I=Dl(l,_),I!=null&&y.unshift(mo(l,I,O))):m||(I=Dl(l,_),I!=null&&y.push(mo(l,I,O)))),l=l.return}y.length!==0&&s.push({event:r,listeners:y})}var Xj=/\r\n?/g,Jj=/\u0000|\uFFFD/g;function rb(s){return(typeof s=="string"?s:""+s).replace(Xj,`
50
+ `).replace(Jj,"")}function nb(s,r){return r=rb(r),rb(s)===r}function ot(s,r,l,u,m,_){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":vc(s,"class",u);break;case"tabIndex":vc(s,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":vc(s,l,u);break;case"style":ng(s,u,_);break;case"data":if(r!=="object"){vc(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=bc(""+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",m.name,m,null),ot(s,r,"formEncType",m.formEncType,m,null),ot(s,r,"formMethod",m.formMethod,m,null),ot(s,r,"formTarget",m.formTarget,m,null)):(ot(s,r,"encType",m.encType,m,null),ot(s,r,"method",m.method,m,null),ot(s,r,"target",m.target,m,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(l);break}u=bc(""+u),s.setAttribute(l,u);break;case"onClick":u!=null&&(s.onclick=Ui);break;case"onScroll":u!=null&&Ue("scroll",s);break;case"onScrollEnd":u!=null&&Ue("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(m.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=bc(""+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":Ue("beforetoggle",s),Ue("toggle",s),gc(s,"popover",u);break;case"xlinkActuate":Fi(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Fi(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Fi(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Fi(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Fi(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Fi(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Fi(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Fi(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Fi(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":gc(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=EC.get(l)||l,gc(s,l,u))}}function Mf(s,r,l,u,m,_){switch(l){case"style":ng(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(m.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&&Ue("scroll",s);break;case"onScrollEnd":u!=null&&Ue("scrollend",s);break;case"onClick":u!=null&&(s.onclick=Ui);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Q_.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(m=l.endsWith("Capture"),r=l.slice(2,m?l.length-7:void 0),_=s[Ss]||null,_=_!=null?_[l]:null,typeof _=="function"&&s.removeEventListener(r,_,m),typeof u=="function")){typeof _!="function"&&_!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(r,u,m);break e}l in s?s[l]=u:u===!0?s.setAttribute(l,""):gc(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":Ue("error",s),Ue("load",s);var u=!1,m=!1,_;for(_ in l)if(l.hasOwnProperty(_)){var y=l[_];if(y!=null)switch(_){case"src":u=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:ot(s,r,_,y,l,null)}}m&&ot(s,r,"srcSet",l.srcSet,l,null),u&&ot(s,r,"src",l.src,l,null);return;case"input":Ue("invalid",s);var C=_=y=m=null,O=null,I=null;for(u in l)if(l.hasOwnProperty(u)){var Q=l[u];if(Q!=null)switch(u){case"name":m=Q;break;case"type":y=Q;break;case"checked":O=Q;break;case"defaultChecked":I=Q;break;case"value":_=Q;break;case"defaultValue":C=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(n(137,r));break;default:ot(s,r,u,Q,l,null)}}tg(s,_,C,O,I,y,m,!1);return;case"select":Ue("invalid",s),u=y=_=null;for(m in l)if(l.hasOwnProperty(m)&&(C=l[m],C!=null))switch(m){case"value":_=C;break;case"defaultValue":y=C;break;case"multiple":u=C;default:ot(s,r,m,C,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":Ue("invalid",s),_=m=u=null;for(y in l)if(l.hasOwnProperty(y)&&(C=l[y],C!=null))switch(y){case"value":u=C;break;case"defaultValue":m=C;break;case"children":_=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:ot(s,r,y,C,l,null)}ig(s,u,m,_);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":Ue("beforetoggle",s),Ue("toggle",s),Ue("cancel",s),Ue("close",s);break;case"iframe":case"object":Ue("load",s);break;case"video":case"audio":for(u=0;u<fo.length;u++)Ue(fo[u],s);break;case"image":Ue("error",s),Ue("load",s);break;case"details":Ue("toggle",s);break;case"embed":case"source":case"link":Ue("error",s),Ue("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(I in l)if(l.hasOwnProperty(I)&&(u=l[I],u!=null))switch(I){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:ot(s,r,I,u,l,null)}return;default:if(Wh(r)){for(Q in l)l.hasOwnProperty(Q)&&(u=l[Q],u!==void 0&&Mf(s,r,Q,u,l,void 0));return}}for(C in l)l.hasOwnProperty(C)&&(u=l[C],u!=null&&ot(s,r,C,u,l,null))}function ek(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 m=null,_=null,y=null,C=null,O=null,I=null,Q=null;for(Y in l){var ee=l[Y];if(l.hasOwnProperty(Y)&&ee!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":O=ee;default:u.hasOwnProperty(Y)||ot(s,r,Y,null,u,ee)}}for(var F in u){var Y=u[F];if(ee=l[F],u.hasOwnProperty(F)&&(Y!=null||ee!=null))switch(F){case"type":_=Y;break;case"name":m=Y;break;case"checked":I=Y;break;case"defaultChecked":Q=Y;break;case"value":y=Y;break;case"defaultValue":C=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(137,r));break;default:Y!==ee&&ot(s,r,F,Y,u,ee)}}Kh(s,y,C,O,I,Q,_,m);return;case"select":Y=y=C=F=null;for(_ in l)if(O=l[_],l.hasOwnProperty(_)&&O!=null)switch(_){case"value":break;case"multiple":Y=O;default:u.hasOwnProperty(_)||ot(s,r,_,null,u,O)}for(m in u)if(_=u[m],O=l[m],u.hasOwnProperty(m)&&(_!=null||O!=null))switch(m){case"value":F=_;break;case"defaultValue":C=_;break;case"multiple":y=_;default:_!==O&&ot(s,r,m,_,u,O)}r=C,l=y,u=Y,F!=null?ya(s,!!l,F,!1):!!u!=!!l&&(r!=null?ya(s,!!l,r,!0):ya(s,!!l,l?[]:"",!1));return;case"textarea":Y=F=null;for(C in l)if(m=l[C],l.hasOwnProperty(C)&&m!=null&&!u.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:ot(s,r,C,null,u,m)}for(y in u)if(m=u[y],_=l[y],u.hasOwnProperty(y)&&(m!=null||_!=null))switch(y){case"value":F=m;break;case"defaultValue":Y=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==_&&ot(s,r,y,m,u,_)}sg(s,F,Y);return;case"option":for(var ve in l)if(F=l[ve],l.hasOwnProperty(ve)&&F!=null&&!u.hasOwnProperty(ve))switch(ve){case"selected":s.selected=!1;break;default:ot(s,r,ve,null,u,F)}for(O in u)if(F=u[O],Y=l[O],u.hasOwnProperty(O)&&F!==Y&&(F!=null||Y!=null))switch(O){case"selected":s.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:ot(s,r,O,F,u,Y)}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 ke in l)F=l[ke],l.hasOwnProperty(ke)&&F!=null&&!u.hasOwnProperty(ke)&&ot(s,r,ke,null,u,F);for(I in u)if(F=u[I],Y=l[I],u.hasOwnProperty(I)&&F!==Y&&(F!=null||Y!=null))switch(I){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(n(137,r));break;default:ot(s,r,I,F,u,Y)}return;default:if(Wh(r)){for(var ct in l)F=l[ct],l.hasOwnProperty(ct)&&F!==void 0&&!u.hasOwnProperty(ct)&&Mf(s,r,ct,void 0,u,F);for(Q in u)F=u[Q],Y=l[Q],!u.hasOwnProperty(Q)||F===Y||F===void 0&&Y===void 0||Mf(s,r,Q,F,u,Y);return}}for(var B in l)F=l[B],l.hasOwnProperty(B)&&F!=null&&!u.hasOwnProperty(B)&&ot(s,r,B,null,u,F);for(ee in u)F=u[ee],Y=l[ee],!u.hasOwnProperty(ee)||F===Y||F==null&&Y==null||ot(s,r,ee,F,u,Y)}function ab(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tk(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var m=l[u],_=m.transferSize,y=m.initiatorType,C=m.duration;if(_&&C&&ab(y)){for(y=0,C=m.responseEnd,u+=1;u<l.length;u++){var O=l[u],I=O.startTime;if(I>C)break;var Q=O.transferSize,ee=O.initiatorType;Q&&ab(ee)&&(O=O.responseEnd,y+=Q*(O<C?1:(C-I)/(O-I)))}if(--u,r+=8*(_+y)/(m.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 Df=null,Bf=null;function pu(s){return s.nodeType===9?s:s.ownerDocument}function lb(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 ob(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 Lf(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 zf=null;function sk(){var s=window.event;return s&&s.type==="popstate"?s===zf?!1:(zf=s,!0):(zf=null,!1)}var cb=typeof setTimeout=="function"?setTimeout:void 0,ik=typeof clearTimeout=="function"?clearTimeout:void 0,ub=typeof Promise=="function"?Promise:void 0,rk=typeof queueMicrotask=="function"?queueMicrotask:typeof ub<"u"?function(s){return ub.resolve(null).then(s).catch(nk)}:cb;function nk(s){setTimeout(function(){throw s})}function Pr(s){return s==="head"}function hb(s,r){var l=r,u=0;do{var m=l.nextSibling;if(s.removeChild(l),m&&m.nodeType===8)if(l=m.data,l==="/$"||l==="/&"){if(u===0){s.removeChild(m),Za(r);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")po(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,po(l);for(var _=l.firstChild;_;){var y=_.nextSibling,C=_.nodeName;_[Rl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&_.rel.toLowerCase()==="stylesheet"||l.removeChild(_),_=y}}else l==="body"&&po(s.ownerDocument.body);l=m}while(l);Za(r)}function db(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 qf(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":qf(l),Fh(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function ak(s,r,l,u){for(;s.nodeType===1;){var m=l;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[Rl])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(_=s.getAttribute("rel"),_==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(_!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(_=s.getAttribute("src"),(_!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&_&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var _=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===_)return s}else return s;if(s=ni(s.nextSibling),s===null)break}return null}function lk(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 fb(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 Pf(s){return s.data==="$?"||s.data==="$~"}function Hf(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function ok(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 If=null;function mb(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 pb(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 _b(s,r,l){switch(r=pu(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 po(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);Fh(s)}var ai=new Map,gb=new Set;function _u(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var nr=U.d;U.d={f:ck,r:uk,D:hk,C:dk,L:fk,m:mk,X:_k,S:pk,M:gk};function ck(){var s=nr.f(),r=lu();return s||r}function uk(s){var r=_a(s);r!==null&&r.tag===5&&r.type==="form"?Dv(r):nr.r(s)}var Ya=typeof document>"u"?null:document;function vb(s,r,l){var u=Ya;if(u&&typeof r=="string"&&r){var m=Xs(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof l=="string"&&(m+='[crossorigin="'+l+'"]'),gb.has(m)||(gb.add(m),s={rel:s,crossOrigin:l,href:r},u.querySelector(m)===null&&(r=u.createElement("link"),rs(r,"link",s),$t(r),u.head.appendChild(r)))}}function hk(s){nr.D(s),vb("dns-prefetch",s,null)}function dk(s,r){nr.C(s,r),vb("preconnect",s,r)}function fk(s,r,l){nr.L(s,r,l);var u=Ya;if(u&&s&&r){var m='link[rel="preload"][as="'+Xs(r)+'"]';r==="image"&&l&&l.imageSrcSet?(m+='[imagesrcset="'+Xs(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(m+='[imagesizes="'+Xs(l.imageSizes)+'"]')):m+='[href="'+Xs(s)+'"]';var _=m;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(m)!==null||r==="style"&&u.querySelector(_o(_))||r==="script"&&u.querySelector(go(_))||(r=u.createElement("link"),rs(r,"link",s),$t(r),u.head.appendChild(r)))}}function mk(s,r){nr.m(s,r);var l=Ya;if(l&&s){var u=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Xs(u)+'"][href="'+Xs(s)+'"]',_=m;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(m)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(go(_)))return}u=l.createElement("link"),rs(u,"link",s),$t(u),l.head.appendChild(u)}}}function pk(s,r,l){nr.S(s,r,l);var u=Ya;if(u&&s){var m=ga(u).hoistableStyles,_=Ga(s);r=r||"default";var y=m.get(_);if(!y){var C={loading:0,preload:null};if(y=u.querySelector(_o(_)))C.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":r},l),(l=ai.get(_))&&Ff(s,l);var O=y=u.createElement("link");$t(O),rs(O,"link",s),O._p=new Promise(function(I,Q){O.onload=I,O.onerror=Q}),O.addEventListener("load",function(){C.loading|=1}),O.addEventListener("error",function(){C.loading|=2}),C.loading|=4,gu(y,r,u)}y={type:"stylesheet",instance:y,count:1,state:C},m.set(_,y)}}}function _k(s,r){nr.X(s,r);var l=Ya;if(l&&s){var u=ga(l).hoistableScripts,m=Qa(s),_=u.get(m);_||(_=l.querySelector(go(m)),_||(s=v({src:s,async:!0},r),(r=ai.get(m))&&Uf(s,r),_=l.createElement("script"),$t(_),rs(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(m,_))}}function gk(s,r){nr.M(s,r);var l=Ya;if(l&&s){var u=ga(l).hoistableScripts,m=Qa(s),_=u.get(m);_||(_=l.querySelector(go(m)),_||(s=v({src:s,async:!0,type:"module"},r),(r=ai.get(m))&&Uf(s,r),_=l.createElement("script"),$t(_),rs(_,"link",s),l.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},u.set(m,_))}}function yb(s,r,l,u){var m=(m=ge.current)?_u(m):null;if(!m)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(m).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(m).hoistableStyles,y=_.get(s);if(y||(m=m.ownerDocument||m,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(s,y),(_=m.querySelector(_o(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),_||vk(m,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(m).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 _o(s){return'link[rel="stylesheet"]['+s+"]"}function bb(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function vk(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 go(s){return"script[async]"+s}function Sb(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 m=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",m),gu(u,l.precedence,s),r.instance=u;case"stylesheet":m=Ga(l.href);var _=s.querySelector(_o(m));if(_)return r.state.loading|=4,r.instance=_,$t(_),_;u=bb(l),(m=ai.get(m))&&Ff(u,m),_=(s.ownerDocument||s).createElement("link"),$t(_);var y=_;return y._p=new Promise(function(C,O){y.onload=C,y.onerror=O}),rs(_,"link",u),r.state.loading|=4,gu(_,l.precedence,s),r.instance=_;case"script":return _=Qa(l.src),(m=s.querySelector(go(_)))?(r.instance=m,$t(m),m):(u=l,(m=ai.get(_))&&(u=v({},l),Uf(u,m)),s=s.ownerDocument||s,m=s.createElement("script"),$t(m),rs(m,"link",u),s.head.appendChild(m),r.instance=m);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,gu(u,l.precedence,s));return r.instance}function gu(s,r,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=u.length?u[u.length-1]:null,_=m,y=0;y<u.length;y++){var C=u[y];if(C.dataset.precedence===r)_=C;else if(_!==m)break}_?_.parentNode.insertBefore(s,_.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(s,r.firstChild))}function Ff(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 vu=null;function xb(s,r,l){if(vu===null){var u=new Map,m=vu=new Map;m.set(l,u)}else m=vu,u=m.get(l),u||(u=new Map,m.set(l,u));if(u.has(s))return u;for(u.set(s,null),l=l.getElementsByTagName(s),m=0;m<l.length;m++){var _=l[m];if(!(_[Rl]||_[es]||s==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var y=_.getAttribute(r)||"";y=s+y;var C=u.get(y);C?C.push(_):u.set(y,[_])}}return u}function wb(s,r,l){s=s.ownerDocument||s,s.head.insertBefore(l,r==="title"?s.querySelector("head > title"):null)}function yk(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 Cb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function bk(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 m=Ga(u.href),_=r.querySelector(_o(m));if(_){r=_._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=yu.bind(s),r.then(s,s)),l.state.loading|=4,l.instance=_,$t(_);return}_=r.ownerDocument||r,u=bb(u),(m=ai.get(m))&&Ff(u,m),_=_.createElement("link"),$t(_);var y=_;y._p=new Promise(function(C,O){y.onload=C,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=yu.bind(s),r.addEventListener("load",l),r.addEventListener("error",l))}}var Kf=0;function Sk(s,r){return s.stylesheets&&s.count===0&&Su(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var u=setTimeout(function(){if(s.stylesheets&&Su(s,s.stylesheets),s.unsuspend){var _=s.unsuspend;s.unsuspend=null,_()}},6e4+r);0<s.imgBytes&&Kf===0&&(Kf=62500*tk());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Su(s,s.stylesheets),s.unsuspend)){var _=s.unsuspend;s.unsuspend=null,_()}},(s.imgBytes>Kf?50:800)+r);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(m)}}:null}function yu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Su(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var bu=null;function Su(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,bu=new Map,r.forEach(xk,s),bu=null,yu.call(s))}function xk(s,r){if(!(r.state.loading&4)){var l=bu.get(s);if(l)var u=l.get(null);else{l=new Map,bu.set(s,l);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<m.length;_++){var y=m[_];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),u=y)}u&&l.set(null,u)}m=r.instance,y=m.getAttribute("data-precedence"),_=l.get(y)||u,_===u&&l.set(null,m),l.set(y,m),this.count++,u=yu.bind(this),m.addEventListener("load",u),m.addEventListener("error",u),_?_.parentNode.insertBefore(m,_.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var vo={$$typeof:D,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function wk(s,r,l,u,m,_,y,C,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=qh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qh(0),this.hiddenUpdates=qh(null),this.identifierPrefix=u,this.onUncaughtError=m,this.onCaughtError=_,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function jb(s,r,l,u,m,_,y,C,O,I,Q,ee){return s=new wk(s,r,l,y,O,I,Q,ee,C),r=1,_===!0&&(r|=24),_=zs(3,null,null,r),s.current=_,_.stateNode=s,r=xd(),r.refCount++,s.pooledCache=r,r.refCount++,_.memoizedState={element:u,isDehydrated:l,cache:r},kd(_),s}function kb(s){return s?(s=Ea,s):Ea}function Eb(s,r,l,u,m,_){m=kb(m),u.context===null?u.context=m:u.pendingContext=m,u=Nr(r),u.payload={element:l},_=_===void 0?null:_,_!==null&&(u.callback=_),l=Tr(s,u,r),l!==null&&(Es(l,s,r),Gl(l,s,r))}function Nb(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<r?l:r}}function $f(s,r){Nb(s,r),(s=s.alternate)&&Nb(s,r)}function Tb(s){if(s.tag===13||s.tag===31){var r=Cn(s,67108864);r!==null&&Es(r,s,67108864),$f(s,67108864)}}function Ob(s){if(s.tag===13||s.tag===31){var r=Fs();r=Ph(r);var l=Cn(s,r);l!==null&&Es(l,s,r),$f(s,r)}}var xu=!0;function Ck(s,r,l,u){var m=A.T;A.T=null;var _=U.p;try{U.p=2,Wf(s,r,l,u)}finally{U.p=_,A.T=m}}function jk(s,r,l,u){var m=A.T;A.T=null;var _=U.p;try{U.p=8,Wf(s,r,l,u)}finally{U.p=_,A.T=m}}function Wf(s,r,l,u){if(xu){var m=Vf(u);if(m===null)Rf(s,r,u,wu,l),Rb(s,u);else if(Ek(m,s,r,l,u))u.stopPropagation();else if(Rb(s,u),r&4&&-1<kk.indexOf(s)){for(;m!==null;){var _=_a(m);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var y=yn(_.pendingLanes);if(y!==0){var C=_;for(C.pendingLanes|=2,C.entangledLanes|=2;y;){var O=1<<31-Bs(y);C.entanglements[1]|=O,y&=~O}ki(_),(it&6)===0&&(nu=Ms()+500,ho(0))}}break;case 31:case 13:C=Cn(_,2),C!==null&&Es(C,_,2),lu(),$f(_,2)}if(_=Vf(u),_===null&&Rf(s,r,u,wu,l),_===m)break;m=_}m!==null&&u.stopPropagation()}else Rf(s,r,u,null,l)}}function Vf(s){return s=Yh(s),Yf(s)}var wu=null;function Yf(s){if(wu=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 wu=s,null}function Ab(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(hC()){case P_:return 2;case H_:return 8;case dc:case dC:return 32;case I_:return 268435456;default:return 32}default:return 32}}var Gf=!1,Hr=null,Ir=null,Fr=null,yo=new Map,bo=new Map,Ur=[],kk="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 Rb(s,r){switch(s){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Fr=null;break;case"pointerover":case"pointerout":yo.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":bo.delete(r.pointerId)}}function So(s,r,l,u,m,_){return s===null||s.nativeEvent!==_?(s={blockedOn:r,domEventName:l,eventSystemFlags:u,nativeEvent:_,targetContainers:[m]},r!==null&&(r=_a(r),r!==null&&Tb(r)),s):(s.eventSystemFlags|=u,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function Ek(s,r,l,u,m){switch(r){case"focusin":return Hr=So(Hr,s,r,l,u,m),!0;case"dragenter":return Ir=So(Ir,s,r,l,u,m),!0;case"mouseover":return Fr=So(Fr,s,r,l,u,m),!0;case"pointerover":var _=m.pointerId;return yo.set(_,So(yo.get(_)||null,s,r,l,u,m)),!0;case"gotpointercapture":return _=m.pointerId,bo.set(_,So(bo.get(_)||null,s,r,l,u,m)),!0}return!1}function Mb(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,V_(s.priority,function(){Ob(l)});return}}else if(r===31){if(r=d(l),r!==null){s.blockedOn=r,V_(s.priority,function(){Ob(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 Cu(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var l=Vf(s.nativeEvent);if(l===null){l=s.nativeEvent;var u=new l.constructor(l.type,l);Vh=u,l.target.dispatchEvent(u),Vh=null}else return r=_a(l),r!==null&&Tb(r),s.blockedOn=l,!1;r.shift()}return!0}function Db(s,r,l){Cu(s)&&l.delete(r)}function Nk(){Gf=!1,Hr!==null&&Cu(Hr)&&(Hr=null),Ir!==null&&Cu(Ir)&&(Ir=null),Fr!==null&&Cu(Fr)&&(Fr=null),yo.forEach(Db),bo.forEach(Db)}function ju(s,r){s.blockedOn===r&&(s.blockedOn=null,Gf||(Gf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Nk)))}var ku=null;function Bb(s){ku!==s&&(ku=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ku===s&&(ku=null);for(var r=0;r<s.length;r+=3){var l=s[r],u=s[r+1],m=s[r+2];if(typeof u!="function"){if(Yf(u||l)===null)continue;break}var _=_a(l);_!==null&&(s.splice(r,3),r-=3,Wd(_,{pending:!0,data:m,method:l.method,action:u},u,m))}}))}function Za(s){function r(O){return ju(O,s)}Hr!==null&&ju(Hr,s),Ir!==null&&ju(Ir,s),Fr!==null&&ju(Fr,s),yo.forEach(r),bo.forEach(r);for(var l=0;l<Ur.length;l++){var u=Ur[l];u.blockedOn===s&&(u.blockedOn=null)}for(;0<Ur.length&&(l=Ur[0],l.blockedOn===null);)Mb(l),l.blockedOn===null&&Ur.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var m=l[u],_=l[u+1],y=m[Ss]||null;if(typeof _=="function")y||Bb(l);else if(y){var C=null;if(_&&_.hasAttribute("formAction")){if(m=_,y=_[Ss]||null)C=y.formAction;else if(Yf(m)!==null)continue}else C=y.action;typeof C=="function"?l[u+1]=C:(l.splice(u,3),u-=3),Bb(l)}}}function Lb(){function s(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(y){return m=y})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=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,m=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),m!==null&&(m(),m=null)}}}function Qf(s){this._internalRoot=s}Eu.prototype.render=Qf.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(n(409));var l=r.current,u=Fs();Eb(l,u,s,r,null,null)},Eu.prototype.unmount=Qf.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;Eb(s.current,2,null,s,null,null),lu(),r[ma]=null}};function Eu(s){this._internalRoot=s}Eu.prototype.unstable_scheduleHydration=function(s){if(s){var r=W_();s={blockedOn:null,target:s,priority:r};for(var l=0;l<Ur.length&&r!==0&&r<Ur[l].priority;l++);Ur.splice(l,0,s),l===0&&Mb(s)}};var zb=t.version;if(zb!=="19.2.8")throw Error(n(527,zb,"19.2.8"));U.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=p(r),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var Tk={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Nu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Nu.isDisabled&&Nu.supportsFiber)try{Tl=Nu.inject(Tk),Ds=Nu}catch{}}return wo.createRoot=function(s,r){if(!a(s))throw Error(n(299));var l=!1,u="",m=Kv,_=$v,y=Wv;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError)),r=jb(s,1,!1,null,null,l,u,null,m,_,y,Lb),s[ma]=r.current,Af(s),new Qf(r)},wo.hydrateRoot=function(s,r,l){if(!a(s))throw Error(n(299));var u=!1,m="",_=Kv,y=$v,C=Wv,O=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(m=l.identifierPrefix),l.onUncaughtError!==void 0&&(_=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError),l.formState!==void 0&&(O=l.formState)),r=jb(s,1,!0,r,l??null,u,m,O,_,y,C,Lb),r.context=kb(null),l=r.current,u=Fs(),u=Ph(u),m=Nr(u),m.callback=null,Tr(l,m,u),l=u,r.current.lanes=l,Al(r,l),ki(r),s[ma]=r.current,Af(s),new Eu(r)},wo.version="19.2.8",wo}var nS;function yE(){if(nS)return em.exports;nS=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(),em.exports=vE(),em.exports}var bE=yE();const mr=["workspace","list"];function ta(e){return["project","listByWorkspace",e]}function sa(e){return["worktree","listByProject",e]}function SE(e){return["worktree","branches",e]}function xE(e){return["worktree","hostOrigins",e]}function wE(e){return["project","detail",e]}function l_(e){return["worktree","detail",e]}function Hi(e,t){return["session","listByScope",e,t]}function Kx(e,t){return["scripts","status",e,t]}function o_(e,t,i){return["files","listDir",e,t,i]}function Au(e,t,i){return["files","read",e,t,i]}function CE(e,t,i){return["files","deletePreview",e,t,i]}function jE(e,t,i){return["changes","list",e,t,i]}function kE(e,t,i,n){return["changes","patch",e,t,i,n]}function EE(e,t){return["memory","list",e??"-",t??"-"]}function NE(e){return["memory","proposals",e]}function TE(e,t){return["memory","core",e??"-",t??"-"]}function OE(e,t,i){return["memory","search",e??"-",t??"-",i]}const AE=["memory","decisions"],RE=["memory","usage"],ME=["memory","settings"];function DE(e,t){return["usage","byProject",e,t]}function BE(e,t){return["usage","byWorktree",e,t]}function LE(e,t){return["usage","byProjectAndAgent",e,t]}function zE(e,t){return["memory","playbooks",e??"-",t?"arquivados":"ativos"]}function ah(e){return["project","cloneJobs",e]}function qE(e){return["pr","getByWorktree",e]}function PE(e){return["pr","listByProject",e]}function HE(e){return["pr","draft",e]}var IE=Object.create,$x=Object.defineProperty,FE=Object.getOwnPropertyDescriptor,Wx=Object.getOwnPropertyNames,UE=Object.getPrototypeOf,KE=Object.prototype.hasOwnProperty,Ii=(e,t)=>function(){return t||(0,e[Wx(e)[0]])((t={exports:{}}).exports,t),t.exports},$E=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Wx(t),c=0,h=a.length,d;c<h;c++)d=a[c],!KE.call(e,d)&&d!==i&&$x(e,d,{get:(f=>t[f]).bind(null,d),enumerable:!(n=FE(t,d))||n.enumerable});return e},Ot=(e,t,i)=>(i=e!=null?IE(UE(e)):{},$E(t||!e||!e.__esModule?$x(i,"default",{value:e,enumerable:!0}):i,e)),Vx=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}}),WE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=Vx().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}}),VE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=Vx().default,n=WE();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=VE();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(p){return Object.getOwnPropertyDescriptor(c,p).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 wl(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 p;a||(p=i.next)===null||p===void 0||p.call(i,f)},error(f){var p;a||(a=!0,(p=i.error)===null||p===void 0||p.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(YE,t)}};return t}function YE(e,t){return t(e)}function GE(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 QE(e){return t=>{let i=0,n=null;const a=[];function c(){n||(n=t.subscribe({next(d){for(const p of a){var f;(f=p.next)===null||f===void 0||f.call(p,d)}},error(d){for(const p of a){var f;(f=p.error)===null||f===void 0||f.call(p,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 wl(d=>(i++,a.push(d),c(),{unsubscribe(){i--,h();const f=a.findIndex(p=>p===d);f>-1&&a.splice(f,1)}}))}}function Yx(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=wl(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 Gx(e){return wl(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 aS(e){return Array.isArray(e)?e:[e]}function ZE(e){return t=>{const i=aS(e.true).map(a=>a(t)),n=aS(e.false).map(a=>a(t));return a=>wl(c=>{const h=e.condition(a.op)?i:n;return Gx({op:a.op,links:h}).subscribe(c)})}}function Fo(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Qx(){return Object.create(null)}const Zx=e=>e(),Ru={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},XE=[Ru.BAD_GATEWAY,Ru.SERVICE_UNAVAILABLE,Ru.GATEWAY_TIMEOUT,Ru.INTERNAL_SERVER_ERROR];var JE=Object.create,Xx=Object.defineProperty,eN=Object.getOwnPropertyDescriptor,Jx=Object.getOwnPropertyNames,tN=Object.getPrototypeOf,sN=Object.prototype.hasOwnProperty,Si=(e,t)=>function(){return t||(0,e[Jx(e)[0]])((t={exports:{}}).exports,t),t.exports},iN=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Jx(t),c=0,h=a.length,d;c<h;c++)d=a[c],!sN.call(e,d)&&d!==i&&Xx(e,d,{get:(f=>t[f]).bind(null,d),enumerable:!(n=eN(t,d))||n.enumerable});return e},dt=(e,t,i)=>(i=e!=null?JE(tN(e)):{},iN(Xx(i,"default",{value:e,enumerable:!0}),e));const ew=()=>{},lS=e=>{Object.freeze&&Object.freeze(e)};function tw(e,t,i){var n;const a=t.join(".");return(n=i[a])!==null&&n!==void 0||(i[a]=new Proxy(ew,{get(c,h){if(!(typeof h!="string"||h==="then"))return tw(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 p={args:d,path:t};return f==="call"?p={args:d.length>=2?[d[1]]:[],path:t.slice(0,-1)}:f==="apply"&&(p={args:d.length>=2?d[1]:[],path:t.slice(0,-1)}),lS(p.args),lS(p.path),e(p)}})),i[a]}const rN=e=>tw(e,[],Qx()),nN=e=>new Proxy(ew,{get(t,i){if(i!=="then")return e(i)}});var sw=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}}),aN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=sw().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}}),lN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=sw().default,n=aN();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}}),c_=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var i=lN();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}}),nc=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var i=c_();function n(c,h){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(c);h&&(f=f.filter(function(p){return Object.getOwnPropertyDescriptor(c,p).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(nc());dt(c_());var Mu=dt(nc());function oN(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Mu.default)((0,Mu.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Mu.default)((0,Mu.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var rm=class extends Error{constructor(){super("Unable to transform response from server")}};function cN(e,t){let i;try{i=oN(e,t)}catch{throw new rm}if(!i.ok&&(!Fo(i.error.error)||typeof i.error.error.code!="number"))throw new rm;if(i.ok&&!Fo(i.result))throw new rm;return i}dt(nc());dt(nc());var Du=dt(c_());let iw;const nm=new WeakMap,uN=()=>{};iw=Symbol.toStringTag;var rw=class qn{constructor(t){(0,Du.default)(this,"promise",void 0),(0,Du.default)(this,"subscribers",[]),(0,Du.default)(this,"settlement",null),(0,Du.default)(this,iw,"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=dN();this.subscribers=fN(this.subscribers,a),t=a.promise,i=()=>{this.subscribers!==null&&(this.subscribers=pN(this.subscribers,a))}}else{const{status:a}=n;a==="fulfilled"?t=Promise.resolve(n.value):t=Promise.reject(n.reason),i=uN}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 nm.set(t,i),nm.set(i,i),i}static getSubscribablePromise(t){return nm.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(hN);try{return await Promise.race(i)}finally{for(const n of i)n.unsubscribe()}}};function hN(e){return rw.proxy(e).then(()=>[e])}function dN(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}function fN(e,t){return[...e,t]}function mN(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function pN(e,t){const i=e.indexOf(t);return i!==-1?mN(e,i):e}var oS,cS,uS,hS;(cS=(oS=Symbol).dispose)!==null&&cS!==void 0||(oS.dispose=Symbol());(hS=(uS=Symbol).asyncDispose)!==null&&hS!==void 0||(uS.asyncDispose=Symbol());function _N(e,t){const i=e,n=i[Symbol.dispose];return i[Symbol.dispose]=()=>{t(),n==null||n()},i}function gN(e,t){const i=e,n=i[Symbol.asyncDispose];return i[Symbol.asyncDispose]=async()=>{await t(),await(n==null?void 0:n())},i}const nw=Symbol();function vN(e){let t=null;return _N({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(nw),e)})}},()=>{t&&clearTimeout(t)})}var ac=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 p=Error();return p.name="SuppressedError",p.error=d,p.suppressed=f,p},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 p=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(p===void 0&&(p=f[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var g=p;if(typeof p!="function")throw new TypeError("Object is not disposable.");g&&(p=function(){try{g.call(f)}catch(b){return Promise.reject(b)}}),c.push({v:f,d:p,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,p=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 p!==a?Promise.reject(p):Promise.resolve();if(p!==a)throw p}function b(S){return p=p!==a?new n(S,p):S,v()}return v()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),u_=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}}),lc=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=u_();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Cl=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=u_();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(w){if(x){var k=g==="return"?"return":"next";if(!S.k||w.done)return f(k,w);w=c[k](w).value}p(b.done?"return":"normal",w)},function(w){f("throw",w)})}catch(w){p("throw",w)}}function p(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(ac());dt(lc());dt(Cl());dt(ac());dt(lc());dt(Cl());dt(ac());dt(lc());dt(Cl());var aw=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(lc());dt(Cl());dt(ac());dt(aw());var yN=Si({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(e,t){var i=u_();function n(a){var c={},h=!1;function d(f,p){return h=!0,p=new Promise(function(g){g(a[f](p))}),{done:!1,value:new i(p,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(aw());var dS=dt(lc()),bN=dt(Cl());dt(yN());var lw=dt(ac());const SN="ping",xN="serialized-error",wN="connected",CN="return";async function jN(e){try{var t=(0,lw.default)();const i=t.u(vN(e.timeoutMs)),n=await rw.race([e.promise,i.start()]);return n===nw?await e.onTimeout():n}catch(i){t.e=i}finally{t.d()}}function kN(e){const{deserialize:t=d=>d}=e;let i=Qx();const n=e.signal;let a=null;const c=()=>new ReadableStream({async start(d){const[f,p]=await Promise.all([e.url(),e.init()]),g=a=new e.EventSource(f,p);d.enqueue({type:"connecting",eventSource:a,event:null}),g.addEventListener(wN,b=>{const x=JSON.parse(b.data);i=x,d.enqueue({type:"connected",options:x,eventSource:g})}),g.addEventListener(xN,b=>{const S=b;d.enqueue({type:"serialized-error",error:t(JSON.parse(S.data)),eventSource:g})}),g.addEventListener(SN,()=>{d.enqueue({type:"ping",eventSource:g})}),g.addEventListener(CN,()=>{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,w={data:t(JSON.parse(S.data))};S.lastEventId&&(w.id=S.lastEventId),d.enqueue({type:"data",data:w,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 p(){await f.cancel(),a=null}return gN({read(){return f.read()},async recreate(){await p(),d=c(),f=d.getReader()}},p)};return Zx((0,bN.default)(function*(){try{var d=(0,lw.default)();const f=d.a(h());for(;;){let p=f.read();const g=i.reconnectAfterInactivityMs;g&&(p=jN({promise:p,timeoutMs:g,onTimeout:async()=>{const b={value:{type:"timeout",ms:g,eventSource:a},done:!1};return await f.recreate(),b}}));const v=yield(0,dS.default)(p);if(v.done)return v.value;yield v.value}}catch(f){d.e=f}finally{yield(0,dS.default)(d.d())}}))}dt(Cl());dt(nc());var Bu=Ot(ha(),1),Xa=Ot(bi(),1);function EN(e){return e instanceof un}function NN(e){return Fo(e)&&Fo(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function TN(e,t){return typeof e=="string"?e:Fo(e)&&typeof e.message=="string"?e.message:t}var un=class Xu extends Error{constructor(t,i){var n,a;const c=i==null?void 0:i.cause;super(t,{cause:c}),(0,Bu.default)(this,"cause",void 0),(0,Bu.default)(this,"shape",void 0),(0,Bu.default)(this,"data",void 0),(0,Bu.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,Xu.prototype)}static from(t,i={}){const n=t;return EN(n)?(i.meta&&(n.meta=(0,Xa.default)((0,Xa.default)({},n.meta),i.meta)),n):NN(n)?new Xu(n.error.message,(0,Xa.default)((0,Xa.default)({},i),{},{result:n,cause:i.cause})):new Xu(TN(n,"Unknown error"),(0,Xa.default)((0,Xa.default)({},i),{},{cause:n}))}};function ow(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 fS=e=>typeof e=="function";function ON(e){if(e)return e;if(typeof window<"u"&&fS(window.fetch))return window.fetch;if(typeof globalThis<"u"&&fS(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var qo=Ot(bi());function AN(e){return{url:e.url.toString(),fetch:e.fetch,transformer:ow(e.transformer),methodOverride:e.methodOverride}}function RN(e){const t={};for(let i=0;i<e.length;i++){const n=e[i];t[i]=n}return t}const MN={query:"GET",mutation:"POST",subscription:"PATCH"};function cw(e){return"input"in e?e.transformer.input.serialize(e.input):RN(e.inputs.map(t=>e.transformer.input.serialize(t)))}const h_=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=cw(e);c!==void 0&&e.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(c))}`)}return a.length&&(n+="?"+a.join("&")),n},DN=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=cw(e);return t!==void 0?JSON.stringify(t):void 0},BN=e=>PN((0,qo.default)((0,qo.default)({},e),{},{contentTypeHeader:"application/json",getUrl:h_,getBody:DN}));var LN=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const zN=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 LN};async function qN(e){var t,i;zN(e.signal);const n=e.getUrl(e),a=e.getBody(e),c=(t=e.methodOverride)!==null&&t!==void 0?t:MN[e.type],h=await(async()=>{const f=await e.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),d=(0,qo.default)((0,qo.default)((0,qo.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 ON(e.fetch)(n,{method:c,signal:e.signal,body:a,headers:d})}async function PN(e){const t={},i=await qN(e);t.response=i;const n=await i.json();return t.responseJSON=n,{json:n,meta:t}}Ot(bi(),1);const mS=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function pS(e){let t=null,i=null;const n=()=>{clearTimeout(i),i=null,t=null};function a(d){const f=[[]];let p=0;for(;;){const b=d[p];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")),p++;continue}if(e.validate(S.concat(b).map(w=>w.key))){S.push(b),p++;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")),p++;continue}f.push([])}return f}function c(){const d=a(t);n();for(const f of d){if(!f.length)continue;const p={items:f};for(const v of f)v.batch=p;e.fetch(p.items.map(v=>v.key)).then(async v=>{await Promise.all(v.map(async(S,x)=>{const w=p.items[x];try{var k;const L=await Promise.resolve(S);(k=w.resolve)===null||k===void 0||k.call(w,L)}catch(L){var E;(E=w.reject)===null||E===void 0||E.call(w,L)}w.batch=null,w.reject=null,w.resolve=null}));for(const S of p.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 p.items){var b;(b=S.reject)===null||b===void 0||b.call(S,v),S.batch=null}})}}function h(d){var f;const p={aborted:!1,key:d,batch:null,resolve:mS,reject:mS},g=new Promise((v,b)=>{var S;p.reject=b,p.resolve=v,(S=t)!==null&&S!==void 0||(t=[]),t.push(p)});return(f=i)!==null&&f!==void 0||(i=setTimeout(c)),g}return{load:h}}function HN(...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 IN(...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 Lu=Ot(bi(),1);function FN(e){var t,i;const n=AN(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(w=>w.path).join(","),S=v.map(w=>w.input);return h_((0,Lu.default)((0,Lu.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=HN(...v.map(L=>L.signal)),w=await BN((0,Lu.default)((0,Lu.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(w.json)?w.json:v.map(()=>w.json)).map(L=>({meta:w.meta,json:L}))}}),d=pS(h("query")),f=pS(h("mutation")),p={query:d,mutation:f};return({op:g})=>wl(v=>{/* istanbul ignore if -- @preserve */if(g.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=p[g.type].load(g);let x;return S.then(w=>{x=w;const k=cN(w.json,n.transformer.output);if(!k.ok){v.error(un.from(k.error,{meta:w.meta}));return}v.next({context:w.meta,result:k.result}),v.complete()}).catch(w=>{v.error(un.from(w,{meta:x==null?void 0:x.meta}))}),()=>{}})}}Ot(bi(),1);const Uo=(e,...t)=>typeof e=="function"?e(...t):e;Ot(ha(),1);function UN(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}async function KN(e){const t=await Uo(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}async function $N(e,t){const i={method:"connectionParams",data:await Uo(e)};return t.encode(i)}Ot(ha(),1);var Gr=Ot(ha(),1);function WN(e){const{promise:t,resolve:i,reject:n}=UN();return e.addEventListener("open",()=>{e.removeEventListener("error",n),i()}),e.addEventListener("error",n),t}function VN(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 YN=class Xm{constructor(t){var i;if((0,Gr.default)(this,"id",++Xm.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",Yx(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=++Xm.connectCount;const i=KN(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&&VN(n,t.keepAliveOpts),n.addEventListener("close",()=>{t.ws===n&&(t.ws=null)}),await WN(n),t.urlOptions.connectionParams&&n.send(await $N(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)(YN,"connectCount",0);Ot(ha(),1);Ot(bi(),1);var am=Ot(ha(),1),_S=Ot(bi(),1),GN=class{constructor(e){(0,am.default)(this,"links",void 0),(0,am.default)(this,"runtime",void 0),(0,am.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Gx({links:this.links,op:(0,_S.default)((0,_S.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(QE())}async requestAsPromise(e){var t=this;try{const i=t.$request(e);return(await GE(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 QN=Symbol.for("trpc_untypedClient"),ZN={query:"query",mutate:"mutation",subscribe:"subscription"},XN=e=>ZN[e];function JN(e){const t=rN(({path:i,args:n})=>{const a=[...i],c=XN(a.pop()),h=a.join(".");return e[c](h,...n)});return nN(i=>i===QN?e:t[i])}function e2(e){const t=new GN(e);return JN(t)}Ot(bi(),1);var gS=Ot(bi(),1);function t2(e,t){return!t||e!=null&&typeof e!="object"?e:(0,gS.default)((0,gS.default)({},e??{}),{},{lastEventId:t})}var s2=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}}),i2=Ot(s2(),1);async function r2(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 n2(e){const t=ow(e.transformer);return()=>({op:i})=>wl(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 p=new AbortController,g=IN(i.signal,p.signal),v=kN({url:async()=>h_({transformer:t,url:await r2(e),input:t2(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=Yx({type:"state",state:"connecting",error:null}),S=b.subscribe({next(x){n.next({result:x})}});return Zx(async()=>{var x=!1,w=!1,k;try{for(var E=(0,i2.default)(v),L;x=!(L=await E.next()).done;x=!1){const D=L.value;switch(D.type){case"ping":break;case"data":const M=D.data;let $;M.id?(f=M.id,$={id:M.id,data:M}):$={data:M.data},n.next({result:$,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(XE.includes(D.error.code)){b.next({type:"state",state:"connecting",error:Z});break}throw Z}case"connecting":{const Z=b.get(),K=D.event&&un.from(D.event);if(!K&&Z.state==="connecting")break;b.next({type:"state",state:"connecting",error:K});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){w=!0,k=D}finally{try{x&&E.return!=null&&await E.return()}finally{if(w)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(),p.abort(),S.unsubscribe()}})}Ot(bi(),1);var a2=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 p=Error();return p.name="SuppressedError",p.error=d,p.suppressed=f,p},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 p=f[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(p===void 0&&(p=f[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var g=p;if(typeof p!="function")throw new TypeError("Object is not disposable.");g&&(p=function(){try{g.call(f)}catch(b){return Promise.reject(b)}}),c.push({v:f,d:p,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,p=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 p!==a?Promise.reject(p):Promise.resolve();if(p!==a)throw p}function b(S){return p=p!==a?new n(S,p):S,v()}return v()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),uw=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}}),l2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=uw();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),o2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=uw();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(w){if(x){var k=g==="return"?"return":"next";if(!S.k||w.done)return f(k,w);w=c[k](w).value}p(b.done?"return":"normal",w)},function(w){f("throw",w)})}catch(w){p("throw",w)}}function p(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(a2(),1);Ot(l2(),1);Ot(o2(),1);Ot(bi(),1);const ie=e2({links:[ZE({condition:e=>e.type==="subscription",true:n2({url:"/trpc"}),false:FN({url:"/trpc"})})]}),c2={connecting:"conectando",counting:"contando objetos",compressing:"comprimindo",receiving:"recebendo objetos",resolving:"resolvendo deltas",checkout:"preparando arquivos"},u2=new Set(["done","failed","cancelled"]);function lh(e){return u2.has(e)}function h2(e){const t=Ee({queryKey:ah(e),queryFn:()=>ie.project.cloneJobs.query({workspaceId:e})});return d2(t.data??[])}function d2(e){const t=e.find(i=>!lh(i.state));return t!==void 0?t:e.reduce((i,n)=>i===null||n.updatedAt>i.updatedAt?n:i,null)}function f2(e){const t=We(),i=h2(e),n=i!==null&&!lh(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(ah(e),d=>[...(d??[]).filter(p=>p.id!==h.id),h])}});return()=>a.unsubscribe()},[n,e,t]),i}const m2={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:m2[e]}),o.jsx("span",{children:t}),i!==void 0&&o.jsx("span",{className:"banner__actions",children:i})]})}function fe({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 hw({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 p2={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:p2[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 Ko({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 vS({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 _2({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 g2({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(fe,{size:"sm",variant:"primary",onClick:i,children:"entendi"}),n!==void 0&&o.jsx(fe,{size:"sm",variant:"ghost",onClick:n,children:"não mostrar de novo"})]})]})}function d_({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(fe,{size:"sm",variant:"ghost",onClick:()=>{n.writeText(e).then(()=>i(!0),()=>i(!1))},children:t?"copiado":"copiar"})]})}function dw({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 Ge({tone:e="none",children:t}){const i=e==="none"?"":` glyph--${e}`;return o.jsx("span",{className:`glyph${i}`,"aria-hidden":"true",children:t})}function fw({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 f_({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 yS='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function mw({open:e,title:t,where:i,onClose:n,dismissible:a=!0,reason:c,footer:h,children:d}){const f=j.useRef(null),p=j.useRef(null);if(j.useEffect(()=>{var S;if(!e)return;p.current=document.activeElement;const v=f.current;return(S=(v==null?void 0:v.querySelector("[data-modal-focus]"))??(v==null?void 0:v.querySelector(yS)))==null||S.focus(),()=>{var x;(x=p.current)==null||x.focus(),p.current=null}},[e]),j.useEffect(()=>{if(!e)return;const v=b=>{var E,L;if(b.key==="Escape"){if(!a)return;b.preventDefault(),n();return}if(b.key!=="Tab")return;const S=[...((E=f.current)==null?void 0:E.querySelectorAll(yS))??[]];if(S.length===0)return;const x=S[0],w=S[S.length-1],k=document.activeElement;b.shiftKey&&(k===x||!((L=f.current)!=null&&L.contains(k)))?(b.preventDefault(),w.focus()):!b.shiftKey&&k===w&&(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 m_({depth:e,label:t,onSelect:i,selected:n=!1,muted:a=!1,emphasis:c=!1,expanded:h,onToggle:d,glyph:f,meta:p,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(" "),w=h!==void 0&&d!==void 0;return o.jsxs("div",{className:x,style:{"--depth":e},children:[w?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}),p!==void 0&&o.jsx("span",{className:"row__meta",children:p}),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 Eh({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 v2({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 bS({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 y2({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 b2({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 S2({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 x2({job:e}){const t=e.percent,i=e.phase===null?null:c2[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(Ge,{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 SS(e){return e.state==="cancelled"?!1:e.state!=="done"?!0:e.message!==null&&e.message.includes("registrado como")}function w2({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(fe,{variant:"ghost",size:"sm",onClick:t,children:"entendi"})]});const n=e.failure==="auth"?j2(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 ${C2(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(fe,{variant:"primary",size:"sm",onClick:()=>i(n),children:"tentar por ssh"}),o.jsx(fe,{variant:"ghost",size:"sm",onClick:t,children:"dispensar"})]}),n!==null&&o.jsx("p",{className:"clone-outcome__path",children:n})]})}function C2(e){try{return new URL(e).host}catch{return e}}function j2(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 k2=250;function E2({workspaceId:e,workspaceName:t,open:i,onClose:n,onRequestOpen:a,onAdded:c,prefill:h=null,onPrefillConsumed:d}){const f=We(),[p,g]=j.useState(""),[v,b]=j.useState(""),[S,x]=j.useState(null),[w,k]=j.useState(null),E=f2(e),L=E!==null&&!lh(E.state)?E:null,D=E!==null&&E.id!==S&&lh(E.state)&&SS(E)?E:null,M=T2(e,p,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 $=He({mutationFn:()=>ie.project.add.mutate({workspaceId:e,path:(M==null?void 0:M.kind)==="path"?M.path:p.trim(),...v.trim()===""?{}:{name:v.trim()}}),onSuccess:async U=>{await f.invalidateQueries({queryKey:ta(e)}),c(U.id),X()}}),Z=He({mutationFn:()=>ie.project.clone.mutate({workspaceId:e,source:p.trim(),...v.trim()===""?{}:{name:v.trim()}}),onSuccess:async()=>{x(null),await f.invalidateQueries({queryKey:ah(e)})}}),K=He({mutationFn:U=>ie.project.cloneCancel.mutate({jobId:U}),onSuccess:()=>f.invalidateQueries({queryKey:ah(e)})});j.useEffect(()=>{!i||E===null||E.id!==w||E.state!=="done"||SS(E)&&E.id!==S||(f.invalidateQueries({queryKey:ta(e)}),k(null),X())},[i,w,E==null?void 0:E.id,E==null?void 0:E.state,S]);function X(){D!==null&&x(D.id),g(""),b(""),$.reset(),Z.reset(),n()}const z=(M==null?void 0:M.kind)==="url",le=(M==null?void 0:M.kind)==="refused",oe=p.trim().startsWith("/")||p.trim().startsWith("~"),q=M===null&&!oe&&p.trim()!=="",P=$.isPending||Z.isPending,re=$.isError?$.error.message:Z.isError?Z.error.message:void 0,se=L!==null,A=U=>{U.preventDefault(),!(p.trim()===""||le||q)&&(z?Z.mutate():$.mutate())};return o.jsxs(mw,{open:i,title:"Adicionar projeto",where:o.jsxs(o.Fragment,{children:["no workspace",o.jsx(Ge,{tone:"workspace",children:"◈"}),o.jsx("b",{children:t})]}),onClose:X,dismissible:!se,reason:"não fecha enquanto clona",footer:se?L.state==="cloning"?o.jsx(fe,{variant:"ghost",onClick:()=>K.mutate(L.id),children:"cancelar o clone"}):null:o.jsxs(o.Fragment,{children:[o.jsx(fe,{type:"submit",form:xS,variant:"primary",disabled:P||p.trim()===""||le||q,children:$.isPending?"validando…":z?"clonar":"adicionar"}),o.jsx(fe,{variant:"ghost",onClick:X,children:"cancelar"})]}),children:[D!==null&&o.jsx(w2,{job:D,onDismiss:()=>x(D.id),onRetry:U=>{x(D.id),g(U)}}),se?o.jsx(x2,{job:L}):o.jsxs("form",{id:xS,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:p,onChange:U=>g(U.target.value),placeholder:"git@gitlab.interno:time/api.git",invalid:le||$.isError||Z.isError})}),M!==null&&o.jsx(N2,{plan:M}),o.jsx(Xt,{id:"project-name",label:"Nome",children:o.jsx(cs,{id:"project-name",value:v,onChange:U=>b(U.target.value),placeholder:z?M.name??"o nome do repositório":"o nome da pasta"})}),z&&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 xS="add-project";function N2({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 T2(e,t,i){const[n,a]=j.useState("");return j.useEffect(()=>{const h=setTimeout(()=>a(t.trim()),k2);return()=>clearTimeout(h)},[t]),Ee({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 wS;(function(e){e.mergeShapes=(t,i)=>({...t,...i})})(wS||(wS={}));const ye=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 ye.undefined;case"string":return ye.string;case"number":return Number.isNaN(e)?ye.nan:ye.number;case"boolean":return ye.boolean;case"function":return ye.function;case"bigint":return ye.bigint;case"symbol":return ye.symbol;case"object":return Array.isArray(e)?ye.array:e===null?ye.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ye.promise:typeof Map<"u"&&e instanceof Map?ye.map:typeof Set<"u"&&e instanceof Set?ye.set:typeof Date<"u"&&e instanceof Date?ye.date:ye.object;default:return ye.unknown}},ce=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 p=h.path[f];f===h.path.length-1?(d[p]=d[p]||{_errors:[]},d[p]._errors.push(i(h))):d[p]=d[p]||{_errors:[]},d=d[p],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 Jm=(e,t)=>{let i;switch(e.code){case ce.invalid_type:e.received===ye.undefined?i="Required":i=`Expected ${e.expected}, received ${e.received}`;break;case ce.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,Je.jsonStringifyReplacer)}`;break;case ce.unrecognized_keys:i=`Unrecognized key(s) in object: ${Je.joinValues(e.keys,", ")}`;break;case ce.invalid_union:i="Invalid input";break;case ce.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Je.joinValues(e.options)}`;break;case ce.invalid_enum_value:i=`Invalid enum value. Expected ${Je.joinValues(e.options)}, received '${e.received}'`;break;case ce.invalid_arguments:i="Invalid function arguments";break;case ce.invalid_return_type:i="Invalid function return type";break;case ce.invalid_date:i="Invalid date";break;case ce.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 ce.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 ce.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 ce.custom:i="Invalid input";break;case ce.invalid_intersection_types:i="Intersection results could not be merged";break;case ce.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case ce.not_finite:i="Number must be finite";break;default:i=t.defaultError,Je.assertNever(e)}return{message:i}};let O2=Jm;function A2(){return O2}const R2=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(p=>!!p).slice().reverse();for(const p of f)d=p(h,{data:t,defaultError:d}).message;return{...a,path:c,message:d}};function me(e,t){const i=A2(),n=R2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Jm?void 0:Jm].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"}),Ao=e=>({status:"dirty",value:e}),fi=e=>({status:"valid",value:e}),CS=e=>e.status==="aborted",jS=e=>e.status==="dirty",bl=e=>e.status==="valid",oh=e=>typeof Promise<"u"&&e instanceof Promise;var we;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(we||(we={}));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 kS=(e,t)=>{if(bl(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(oh(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 kS(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 bl(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=>bl(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(oh(a)?a:Promise.resolve(a));return kS(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:ce.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 fh.create(this,this._def)}or(t){return uh.create([this,t],this._def)}and(t){return hh.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 mh({...Pe(this._def),innerType:this,defaultValue:i,typeName:Re.ZodDefault})}brand(){return new vw({typeName:Re.ZodBranded,type:this,...Pe(this._def)})}catch(t){const i=typeof t=="function"?t:()=>t;return new ph({...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 __.create(this,t)}readonly(){return _h.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const M2=/^c[^\s-]{8,}$/i,D2=/^[0-9a-z]+$/,B2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,L2=/^[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,z2=/^[a-z0-9_-]{21}$/i,q2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,P2=/^[-+]?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)?)??$/,H2=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,I2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let lm;const F2=/^(?:(?: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])$/,U2=/^(?:(?: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])$/,K2=/^(([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]))$/,$2=/^(([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])$/,W2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,V2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pw="((\\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])))",Y2=new RegExp(`^${pw}$`);function _w(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 G2(e){return new RegExp(`^${_w(e)}$`)}function Q2(e){let t=`${pw}T${_w(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 Z2(e,t){return!!((t==="v4"||!t)&&F2.test(e)||(t==="v6"||!t)&&K2.test(e))}function X2(e,t){if(!q2.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 J2(e,t){return!!((t==="v4"||!t)&&U2.test(e)||(t==="v6"||!t)&&$2.test(e))}class dn extends Ze{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ye.string){const c=this._getOrReturnCtx(t);return me(c,{code:ce.invalid_type,expected:ye.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),me(a,{code:ce.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),me(a,{code:ce.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?me(a,{code:ce.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):d&&me(a,{code:ce.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),n.dirty())}else if(c.kind==="email")H2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"email",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="emoji")lm||(lm=new RegExp(I2,"u")),lm.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"emoji",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="uuid")L2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"uuid",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="nanoid")z2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"nanoid",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid")M2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"cuid",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="cuid2")D2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"cuid2",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="ulid")B2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"ulid",code:ce.invalid_string,message:c.message}),n.dirty());else if(c.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),me(a,{validation:"url",code:ce.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),me(a,{validation:"regex",code:ce.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),me(a,{code:ce.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),me(a,{code:ce.invalid_string,validation:{startsWith:c.value},message:c.message}),n.dirty()):c.kind==="endsWith"?t.data.endsWith(c.value)||(a=this._getOrReturnCtx(t,a),me(a,{code:ce.invalid_string,validation:{endsWith:c.value},message:c.message}),n.dirty()):c.kind==="datetime"?Q2(c).test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{code:ce.invalid_string,validation:"datetime",message:c.message}),n.dirty()):c.kind==="date"?Y2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{code:ce.invalid_string,validation:"date",message:c.message}),n.dirty()):c.kind==="time"?G2(c).test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{code:ce.invalid_string,validation:"time",message:c.message}),n.dirty()):c.kind==="duration"?P2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"duration",code:ce.invalid_string,message:c.message}),n.dirty()):c.kind==="ip"?Z2(t.data,c.version)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"ip",code:ce.invalid_string,message:c.message}),n.dirty()):c.kind==="jwt"?X2(t.data,c.alg)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"jwt",code:ce.invalid_string,message:c.message}),n.dirty()):c.kind==="cidr"?J2(t.data,c.version)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"cidr",code:ce.invalid_string,message:c.message}),n.dirty()):c.kind==="base64"?W2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"base64",code:ce.invalid_string,message:c.message}),n.dirty()):c.kind==="base64url"?V2.test(t.data)||(a=this._getOrReturnCtx(t,a),me(a,{validation:"base64url",code:ce.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:ce.invalid_string,...we.errToObj(n)})}_addCheck(t){return new dn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...we.errToObj(t)})}url(t){return this._addCheck({kind:"url",...we.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...we.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...we.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...we.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...we.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...we.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...we.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...we.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...we.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...we.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...we.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...we.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,...we.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,...we.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...we.errToObj(t)})}regex(t,i){return this._addCheck({kind:"regex",regex:t,...we.errToObj(i)})}includes(t,i){return this._addCheck({kind:"includes",value:t,position:i==null?void 0:i.position,...we.errToObj(i==null?void 0:i.message)})}startsWith(t,i){return this._addCheck({kind:"startsWith",value:t,...we.errToObj(i)})}endsWith(t,i){return this._addCheck({kind:"endsWith",value:t,...we.errToObj(i)})}min(t,i){return this._addCheck({kind:"min",value:t,...we.errToObj(i)})}max(t,i){return this._addCheck({kind:"max",value:t,...we.errToObj(i)})}length(t,i){return this._addCheck({kind:"length",value:t,...we.errToObj(i)})}nonempty(t){return this.min(1,we.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 eT(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 Sl 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)!==ye.number){const c=this._getOrReturnCtx(t);return me(c,{code:ce.invalid_type,expected:ye.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),me(n,{code:ce.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),me(n,{code:ce.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),me(n,{code:ce.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),a.dirty()):c.kind==="multipleOf"?eT(t.data,c.value)!==0&&(n=this._getOrReturnCtx(t,n),me(n,{code:ce.not_multiple_of,multipleOf:c.value,message:c.message}),a.dirty()):c.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),me(n,{code:ce.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,we.toString(i))}gt(t,i){return this.setLimit("min",t,!1,we.toString(i))}lte(t,i){return this.setLimit("max",t,!0,we.toString(i))}lt(t,i){return this.setLimit("max",t,!1,we.toString(i))}setLimit(t,i,n,a){return new Sl({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:we.toString(a)}]})}_addCheck(t){return new Sl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:we.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:we.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:we.toString(i)})}finite(t){return this._addCheck({kind:"finite",message:we.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:we.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:we.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)}}Sl.create=e=>new Sl({checks:[],typeName:Re.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class $o 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)!==ye.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),me(n,{code:ce.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),me(n,{code:ce.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),me(n,{code:ce.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 me(i,{code:ce.invalid_type,expected:ye.bigint,received:i.parsedType}),Oe}gte(t,i){return this.setLimit("min",t,!0,we.toString(i))}gt(t,i){return this.setLimit("min",t,!1,we.toString(i))}lte(t,i){return this.setLimit("max",t,!0,we.toString(i))}lt(t,i){return this.setLimit("max",t,!1,we.toString(i))}setLimit(t,i,n,a){return new $o({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:we.toString(a)}]})}_addCheck(t){return new $o({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:we.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:we.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:we.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:we.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:we.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}}$o.create=e=>new $o({checks:[],typeName:Re.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Pe(e)});class ep extends Ze{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ye.boolean){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.boolean,received:n.parsedType}),Oe}return fi(t.data)}}ep.create=e=>new ep({typeName:Re.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class ch extends Ze{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ye.date){const c=this._getOrReturnCtx(t);return me(c,{code:ce.invalid_type,expected:ye.date,received:c.parsedType}),Oe}if(Number.isNaN(t.data.getTime())){const c=this._getOrReturnCtx(t);return me(c,{code:ce.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),me(a,{code:ce.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),me(a,{code:ce.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 ch({...this._def,checks:[...this._def.checks,t]})}min(t,i){return this._addCheck({kind:"min",value:t.getTime(),message:we.toString(i)})}max(t,i){return this._addCheck({kind:"max",value:t.getTime(),message:we.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}}ch.create=e=>new ch({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Re.ZodDate,...Pe(e)});class ES extends Ze{_parse(t){if(this._getType(t)!==ye.symbol){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.symbol,received:n.parsedType}),Oe}return fi(t.data)}}ES.create=e=>new ES({typeName:Re.ZodSymbol,...Pe(e)});class tp extends Ze{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.undefined,received:n.parsedType}),Oe}return fi(t.data)}}tp.create=e=>new tp({typeName:Re.ZodUndefined,...Pe(e)});class sp extends Ze{_parse(t){if(this._getType(t)!==ye.null){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.null,received:n.parsedType}),Oe}return fi(t.data)}}sp.create=e=>new sp({typeName:Re.ZodNull,...Pe(e)});class NS extends Ze{constructor(){super(...arguments),this._any=!0}_parse(t){return fi(t.data)}}NS.create=e=>new NS({typeName:Re.ZodAny,...Pe(e)});class TS extends Ze{constructor(){super(...arguments),this._unknown=!0}_parse(t){return fi(t.data)}}TS.create=e=>new TS({typeName:Re.ZodUnknown,...Pe(e)});class gn extends Ze{_parse(t){const i=this._getOrReturnCtx(t);return me(i,{code:ce.invalid_type,expected:ye.never,received:i.parsedType}),Oe}}gn.create=e=>new gn({typeName:Re.ZodNever,...Pe(e)});class OS extends Ze{_parse(t){if(this._getType(t)!==ye.undefined){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.void,received:n.parsedType}),Oe}return fi(t.data)}}OS.create=e=>new OS({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!==ye.array)return me(i,{code:ce.invalid_type,expected:ye.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)&&(me(i,{code:h?ce.too_big:ce.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&&(me(i,{code:ce.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&&(me(i,{code:ce.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:we.toString(i)}})}max(t,i){return new zi({...this._def,maxLength:{value:t,message:we.toString(i)}})}length(t,i){return new zi({...this._def,exactLength:{value:t,message:we.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)!==ye.object){const p=this._getOrReturnCtx(t);return me(p,{code:ce.invalid_type,expected:ye.object,received:p.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 p in a.data)h.includes(p)||d.push(p);const f=[];for(const p of h){const g=c[p],v=a.data[p];f.push({key:{status:"valid",value:p},value:g._parse(new _n(a,v,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof gn){const p=this._def.unknownKeys;if(p==="passthrough")for(const g of d)f.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(p==="strict")d.length>0&&(me(a,{code:ce.unrecognized_keys,keys:d}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const g of d){const v=a.data[g];f.push({key:{status:"valid",value:g},value:p._parse(new _n(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const g of f){const v=await g.key,b=await g.value;p.push({key:v,value:b,alwaysSet:g.alwaysSet})}return p}).then(p=>Gs.mergeObjectSync(n,p)):Gs.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(t){return we.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:we.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 gw(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 uh 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 me(i,{code:ce.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 p={...i,common:{...i.common,issues:[]},parent:null},g=f._parseSync({data:i.data,path:i.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!c&&(c={result:g,ctx:p}),p.common.issues.length&&h.push(p.common.issues)}if(c)return i.common.issues.push(...c.ctx.common.issues),c.result;const d=h.map(f=>new gr(f));return me(i,{code:ce.invalid_union,unionErrors:d}),Oe}}get options(){return this._def.options}}uh.create=(e,t)=>new uh({options:e,typeName:Re.ZodUnion,...Pe(t)});const or=e=>e instanceof rp?or(e.schema):e instanceof aa?or(e.innerType()):e instanceof dh?[e.value]:e instanceof na?e.options:e instanceof np?Je.objectValues(e.enum):e instanceof mh?or(e._def.innerType):e instanceof tp?[void 0]:e instanceof sp?[null]:e instanceof pr?[void 0,...or(e.unwrap())]:e instanceof la?[null,...or(e.unwrap())]:e instanceof vw||e instanceof _h?or(e.unwrap()):e instanceof ph?or(e._def.innerType):[];class p_ extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ye.object)return me(i,{code:ce.invalid_type,expected:ye.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}):(me(i,{code:ce.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 p_({typeName:Re.ZodDiscriminatedUnion,discriminator:t,options:i,optionsMap:a,...Pe(n)})}}function ip(e,t){const i=Qr(e),n=Qr(t);if(e===t)return{valid:!0,data:e};if(i===ye.object&&n===ye.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=ip(e[d],t[d]);if(!f.valid)return{valid:!1};h[d]=f.data}return{valid:!0,data:h}}else if(i===ye.array&&n===ye.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=ip(h,d);if(!f.valid)return{valid:!1};a.push(f.data)}return{valid:!0,data:a}}else return i===ye.date&&n===ye.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class hh extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t),a=(c,h)=>{if(CS(c)||CS(h))return Oe;const d=ip(c.value,h.value);return d.valid?((jS(c)||jS(h))&&i.dirty(),{status:i.value,value:d.data}):(me(n,{code:ce.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}))}}hh.create=(e,t,i)=>new hh({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!==ye.array)return me(n,{code:ce.invalid_type,expected:ye.array,received:n.parsedType}),Oe;if(n.data.length<this._def.items.length)return me(n,{code:ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&n.data.length>this._def.items.length&&(me(n,{code:ce.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 AS 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!==ye.map)return me(n,{code:ce.invalid_type,expected:ye.map,received:n.parsedType}),Oe;const a=this._def.keyType,c=this._def.valueType,h=[...n.data.entries()].map(([d,f],p)=>({key:a._parse(new _n(n,d,n.path,[p,"key"])),value:c._parse(new _n(n,f,n.path,[p,"value"]))}));if(n.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const f of h){const p=await f.key,g=await f.value;if(p.status==="aborted"||g.status==="aborted")return Oe;(p.status==="dirty"||g.status==="dirty")&&i.dirty(),d.set(p.value,g.value)}return{status:i.value,value:d}})}else{const d=new Map;for(const f of h){const p=f.key,g=f.value;if(p.status==="aborted"||g.status==="aborted")return Oe;(p.status==="dirty"||g.status==="dirty")&&i.dirty(),d.set(p.value,g.value)}return{status:i.value,value:d}}}}AS.create=(e,t,i)=>new AS({valueType:t,keyType:e,typeName:Re.ZodMap,...Pe(i)});class Wo extends Ze{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ye.set)return me(n,{code:ce.invalid_type,expected:ye.set,received:n.parsedType}),Oe;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(me(n,{code:ce.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&&(me(n,{code:ce.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 p=new Set;for(const g of f){if(g.status==="aborted")return Oe;g.status==="dirty"&&i.dirty(),p.add(g.value)}return{status:i.value,value:p}}const d=[...n.data.values()].map((f,p)=>c._parse(new _n(n,f,n.path,p)));return n.common.async?Promise.all(d).then(f=>h(f)):h(d)}min(t,i){return new Wo({...this._def,minSize:{value:t,message:we.toString(i)}})}max(t,i){return new Wo({...this._def,maxSize:{value:t,message:we.toString(i)}})}size(t,i){return this.min(t,i).max(t,i)}nonempty(t){return this.min(1,t)}}Wo.create=(e,t)=>new Wo({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...Pe(t)});class rp 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})}}rp.create=(e,t)=>new rp({getter:e,typeName:Re.ZodLazy,...Pe(t)});class dh extends Ze{_parse(t){if(t.data!==this._def.value){const i=this._getOrReturnCtx(t);return me(i,{received:i.data,code:ce.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:t.data}}get value(){return this._def.value}}dh.create=(e,t)=>new dh({value:e,typeName:Re.ZodLiteral,...Pe(t)});function gw(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 me(i,{expected:Je.joinValues(n),received:i.parsedType,code:ce.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 me(i,{received:i.data,code:ce.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=gw;class np extends Ze{_parse(t){const i=Je.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ye.string&&n.parsedType!==ye.number){const a=Je.objectValues(i);return me(n,{expected:Je.joinValues(a),received:n.parsedType,code:ce.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 me(n,{received:n.data,code:ce.invalid_enum_value,options:a}),Oe}return fi(t.data)}get enum(){return this._def.values}}np.create=(e,t)=>new np({values:e,typeName:Re.ZodNativeEnum,...Pe(t)});class fh extends Ze{unwrap(){return this._def.type}_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ye.promise&&i.common.async===!1)return me(i,{code:ce.invalid_type,expected:ye.promise,received:i.parsedType}),Oe;const n=i.parsedType===ye.promise?i.data:Promise.resolve(i.data);return fi(n.then(a=>this._def.type.parseAsync(a,{path:i.path,errorMap:i.common.contextualErrorMap})))}}fh.create=(e,t)=>new fh({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=>{me(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"?Ao(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"?Ao(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(!bl(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=>bl(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)===ye.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)===ye.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 mh extends Ze{_parse(t){const{ctx:i}=this._processInputParams(t);let n=i.data;return i.parsedType===ye.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}mh.create=(e,t)=>new mh({innerType:e,typeName:Re.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pe(t)});class ph 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 oh(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}}ph.create=(e,t)=>new ph({innerType:e,typeName:Re.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pe(t)});class RS extends Ze{_parse(t){if(this._getType(t)!==ye.nan){const n=this._getOrReturnCtx(t);return me(n,{code:ce.invalid_type,expected:ye.nan,received:n.parsedType}),Oe}return{status:"valid",value:t.data}}}RS.create=e=>new RS({typeName:Re.ZodNaN,...Pe(e)});class vw 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 __ 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(),Ao(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 __({in:t,out:i,typeName:Re.ZodPipeline})}}class _h extends Ze{_parse(t){const i=this._def.innerType._parse(t),n=a=>(bl(a)&&(a.value=Object.freeze(a.value)),a);return oh(i)?i.then(a=>n(a)):n(i)}unwrap(){return this._def.innerType}}_h.create=(e,t)=>new _h({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 xe=dn.create,ls=Sl.create,yw=ep.create;gn.create;const Oi=zi.create,De=zt.create,tT=uh.create,jl=p_.create;hh.create;ra.create;const Qe=dh.create,vs=na.create;fh.create;pr.create;la.create;const sT="/acp",iT="session",rT=4404,nT=vs(["running","exited"]),MS=vs(["pending","running","ok","failed","cancelled"]),aT=vs(["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"]),DS=De({path:xe(),line:ls().int().nullish()}),lT=jl("type",[De({type:Qe("content"),text:xe()}),De({type:Qe("diff"),path:xe(),oldText:xe().nullish(),newText:xe()}),De({type:Qe("terminal"),terminalId:xe()})]),oT=vs(["allow_once","allow_always","reject_once","reject_always"]),g_=vs(["ask","auto","free"]),bw=vs(["ask","auto"]),Sw=vs(["agent","lumem"]),cT=De({optionId:xe(),name:xe(),kind:oT}),uT=vs(["end_turn","max_tokens","max_turn_requests","refusal","cancelled"]),hT=vs(["pending","in_progress","completed"]),dT=De({content:xe(),status:hT,priority:vs(["high","medium","low"]).nullish()}),fT=De({utilization:ls(),surpassedThreshold:ls().nullish(),isUsingOverage:yw(),resetsAt:ls().int().nullish(),kind:xe().nullish()}),mT=De({value:xe(),name:xe(),description:xe().nullish()}),xw=De({id:xe(),name:xe(),category:xe().nullish(),currentValue:xe(),choices:Oi(mT)}),pT=De({name:xe(),description:xe(),takesInput:yw()}),ww=jl("type",[De({type:Qe("message"),messageId:xe(),role:vs(["user","agent"]),text:xe()}),De({type:Qe("thought"),messageId:xe(),text:xe()}),De({type:Qe("tool_call"),toolCallId:xe(),title:xe(),name:xe().nullish(),kind:aT,status:MS,locations:Oi(DS).default([])}),De({type:Qe("tool_call_update"),toolCallId:xe(),status:MS.optional(),title:xe().optional(),content:Oi(lT).optional(),locations:Oi(DS).optional()}),De({type:Qe("permission_request"),requestId:xe(),toolCallId:xe(),title:xe(),command:xe().nullish(),cwd:xe(),options:Oi(cT).min(1),policyReason:xe().nullable().default(null)}),De({type:Qe("permission_resolved"),requestId:xe(),outcome:tT([Qe("cancelled"),De({optionId:xe()})]),by:vs(["user","lumem"]).default("user"),reason:xe().nullable().default(null)}),De({type:Qe("plan"),entries:Oi(dT)}),De({type:Qe("plan_removed")}),De({type:Qe("usage"),used:ls().int().nonnegative(),size:ls().int().positive(),cost:De({amount:ls(),currency:xe()}).nullish(),rateLimit:fT.nullish()}),De({type:Qe("config"),mode:xe(),options:Oi(xw),modeOwner:Sw.default("agent"),lumemMode:g_.default("ask"),lumemModeDefault:bw.default("ask")}),De({type:Qe("commands"),commands:Oi(pT)}),De({type:Qe("terminal"),terminalId:xe(),ptySessionId:xe(),command:xe()}),De({type:Qe("turn_end"),stopReason:uT}),De({type:Qe("resumed"),fromSessionId:xe()}),De({type:Qe("memory_core"),entries:ls().int().nonnegative(),chars:ls().int().nonnegative()}),De({type:Qe("unknown"),sessionUpdate:xe()})]),_T=De({at:ls().int().nonnegative(),event:ww}),gT=vs(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","ADAPTER_UNAVAILABLE","INTERNAL"]),vT=jl("type",[De({type:Qe("prompt"),text:xe().min(1)}),De({type:Qe("cancel")}),De({type:Qe("permission_response"),requestId:xe(),optionId:xe()}),De({type:Qe("set_config"),optionId:xe().min(1),value:xe().min(1)}),De({type:Qe("set_lumem_mode"),mode:g_})]),yT=jl("type",[De({type:Qe("attached"),sessionId:xe(),state:nT,acpSessionId:xe(),model:xe(),mode:xe(),configOptions:Oi(xw).default([]),modeOwner:Sw.default("agent"),lumemMode:g_.default("ask"),lumemModeDefault:bw.default("ask"),cwd:xe().default(""),transcript:Oi(_T)}),De({type:Qe("event"),at:ls().int().nonnegative(),event:ww}),De({type:Qe("error"),code:gT,message:xe(),remedy:xe().optional()})]);function bT(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 ST(e){return bT(yT,e)}function xT(e){return JSON.stringify(e)}const il={id:"claude",label:"Claude Code",package:"@agentclientprotocol/claude-agent-acp",command:"claude-agent-acp",pinnedVersion:"0.75.1",cli:{command:"claude",install:null},runtime:"@anthropic-ai/claude-agent-sdk",apiKeyEnv:["ANTHROPIC_API_KEY"]},wT={id:"codex",label:"Codex",package:"@agentclientprotocol/codex-acp",command:"codex-acp",pinnedVersion:"1.10.0",cli:null,runtime:"@openai/codex",apiKeyEnv:["CODEX_API_KEY","OPENAI_API_KEY"]},CT=[il,wT],jT=il.id,kT="/pty",ET="session",NT=vs(["running","exited"]),TT=vs(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","INTERNAL"]),BS=5e3;jl("type",[De({type:Qe("input"),data:xe()}),De({type:Qe("resize"),cols:ls().int().min(1).max(BS),rows:ls().int().min(1).max(BS)})]);const OT=jl("type",[De({type:Qe("attached"),sessionId:xe(),state:NT,cols:ls().int(),rows:ls().int(),snapshot:xe()}),De({type:Qe("output"),data:xe()}),De({type:Qe("exit"),exitCode:ls().int(),signal:ls().int().nullable()}),De({type:Qe("error"),code:TT,message:xe()})]);function AT(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 RT(e){return AT(OT,e)}function LS(e){return JSON.stringify(e)}const MT=1;function DT(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${kT}?${ET}=${encodeURIComponent(e)}`}function Cw(e,t,i={}){const{createWebSocket:n=d=>new WebSocket(d),origin:a=window.location}=i,c=n(DT(e,a));let h=[];return c.onopen=()=>{const d=h;h=[];for(const f of d)c.send(LS(f))},c.onmessage=d=>{var p;const f=RT(String(d.data));f.ok?t.onMessage(f.message):(p=t.onDecodeError)==null||p.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===MT?c.send(LS(d)):h.push(d)},close(){c.onmessage=null,c.onclose=null,c.onopen=null,h=[],c.close()}}}const zS=12;function BT({ptySessionId:e,onFinished:t,connect:i=Cw}){const[n,a]=j.useState([]),[c,h]=j.useState(null),[d,f]=j.useState(!1),p=j.useRef(t);return p.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=>qS([...S,...LT(b)]));return}if(v.type==="exit"){f(!1),h(v.exitCode),p.current(v.exitCode);return}v.type==="error"&&a(b=>qS([...b,v.message]))},onClose:()=>f(!1)});return()=>g.close()},[e,i]),{output:n,exitCode:c,running:d}}function LT(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 qS(e){return e.length<=zS?e:e.slice(e.length-zS)}const om=["agentConfig","list"];function zT({embedded:e=!1,onClose:t}={}){const i=We(),[n,a]=j.useState(e),c=Ee({queryKey:om,queryFn:()=>ie.agentConfig.list.query(),enabled:n}),[h,d]=j.useState(""),[f,p]=j.useState(""),[g,v]=j.useState(""),[b,S]=j.useState("acp"),[x,w]=j.useState(""),[k,E]=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:om}),d(""),p(""),v(""),w("")}}),D=He({mutationFn:K=>ie.agentConfig.remove.mutate({id:K}),onSuccess:async()=>{E(null),await i.invalidateQueries({queryKey:om})}}),M=h.trim()!==""&&f.trim()!==""&&(b==="pty"||x.trim()!==""),$=K=>{K.preventDefault(),M&&L.mutate()};if(!n)return o.jsxs("button",{type:"button",className:"sidebar__add",onClick:()=>a(!0),children:[o.jsx(Ge,{tone:"agent",children:"◆"}),"agentes"]});const Z=c.data??[];return o.jsx("div",{className:"agents",children:o.jsxs(hw,{children:[Z.length===0&&!c.isPending&&o.jsx("p",{className:"agents__empty",children:"nenhum agente configurado"}),Z.map(K=>{const X=K.transport==="acp";return o.jsxs("div",{className:"agents__row",children:[o.jsxs("div",{className:"agents__head",children:[o.jsx(Ge,{tone:X?"agent":"shell",children:X?"◆":"●"}),o.jsx("span",{className:"agents__name",children:K.name}),o.jsx(as,{children:X?"conversa":"terminal"}),!K.available&&o.jsx(as,{tone:"missing",children:"fora do PATH"})]}),o.jsxs("div",{className:"agents__foot",children:[o.jsxs("span",{className:"agents__cmd",title:K.command,children:[K.command,X&&K.adapterVersion?` @${K.adapterVersion}`:""]}),k===K.id?o.jsx(fe,{size:"sm",variant:"danger",disabled:D.isPending,onClick:()=>D.mutate(K.id),children:"confirmar"}):o.jsxs(fe,{size:"sm",variant:"ghost",onClick:()=>E(K.id),children:["remover ",o.jsx("span",{className:"sr-only",children:K.name})]})]})]},K.id)}),D.isError&&o.jsx(Ae,{tone:"danger",children:D.error.message}),o.jsxs("form",{className:"agents__form",onSubmit:$,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:K=>d(K.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:K=>S(K.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:K=>p(K.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:K=>v(K.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:K=>w(K.target.value),placeholder:il.pinnedVersion})}),o.jsxs("div",{className:"agents__actions",children:[o.jsx(fe,{type:"submit",variant:"primary",disabled:L.isPending||!M,children:L.isPending?"criando…":"adicionar"}),o.jsx(fe,{variant:"ghost",onClick:()=>{e?t==null||t():a(!1)},children:"fechar"})]})]})]})})}const jw=["agentConfig","list"],PS=["setup","agents"],kw=["setup","probe"];function qT(){const[e,t]=j.useState(null),[i,n]=j.useState(!1),c=(Ee({queryKey:jw,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(zT,{embedded:!0,onClose:()=>n(!1)})]}),!i&&(e==null?void 0:e.kind)==="connect"&&o.jsx(IT,{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(KT,{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(HT,{config:f,open:(e==null?void 0:e.kind)==="agent"&&e.id===f.id,onOpen:()=>t({kind:"agent",id:f.id})},f.id))]})}function Ew(e){return Ee({queryKey:[...kw,e.command,e.args.join(" ")],queryFn:()=>ie.setup.probe.query({command:e.command,args:[...e.args]}),retry:!1,refetchOnWindowFocus:!1,staleTime:5*6e4})}function PT(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 HT({config:e,open:t,onOpen:i}){const n=Ew(e),{tone:a,word:c}=PT(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(Ge,{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 IT({configured:e,onClose:t,onCustom:i,onConnected:n}){const a=We(),[c,h]=j.useState("idle"),[d,f]=j.useState(null),p=Ee({queryKey:PS,queryFn:()=>ie.setup.agents.query(),refetchOnWindowFocus:!1}),g=He({mutationFn:async v=>{var E;f(v);const b=cm(p.data,v.id);let S=(b==null?void 0:b.adapter.path)??null;const x=(b==null?void 0:b.adapter.version)!=null&&b.adapter.version!==v.pinnedVersion;(S===null||x)&&(h("installing"),S=(await ie.setup.installAdapter.mutate({adapterId:v.id})).path),h("handshaking");const w=await ie.setup.probe.query({command:S});return(await ie.agentConfig.create.mutate({name:v.id,command:S,args:[],transport:"acp",adapterVersion:((E=w.agentInfo)==null?void 0:E.version)??v.pinnedVersion})).id},onSettled:async()=>{h("idle"),await a.invalidateQueries({queryKey:jw}),await a.invalidateQueries({queryKey:PS})},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(UT,{spec:d,stage:c,entry:cm(p.data,d==null?void 0:d.id)}):o.jsxs(o.Fragment,{children:[CT.map((v,b)=>{const S=cm(p.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||p.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:FT(v,S,x===!0,p.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 cm(e,t){if(t!==void 0)return e==null?void 0:e.adapters.find(i=>i.id===t)}function FT(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 UT({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 KT({config:e,onClose:t,onCustom:i}){var x,w;const n=We(),[a,c]=j.useState(!1),h=Ew(e),d=j.useCallback(async()=>{await n.invalidateQueries({queryKey:kw})},[n]),f=((w=(x=h.data)==null?void 0:x.agentInfo)==null?void 0:w.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:p()}),o.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:t,children:"✕"})]}),g()]});function p(){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($T,{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(fe,{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(fe,{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 $T({config:e,methods:t,onDone:i}){var K,X;const[n,a]=j.useState(null),[c,h]=j.useState(null),[d,f]=j.useState(""),[p,g]=j.useState(null),v=BT({ptySessionId:n,onFinished:()=>{a(null),i()}}),b={command:e.command,args:[...e.args]},S=He({mutationFn:z=>ie.setup.login.mutate({methodId:z,...b}),onSuccess:z=>a(z.ptySessionId)}),x=He({mutationFn:z=>ie.setup.authenticate.mutate({...z,...b}),onSuccess:z=>g(z.id)}),w=Ee({queryKey:["setup","authState",p],queryFn:()=>ie.setup.authState.query({loginId:p??""}),enabled:p!==null,refetchInterval:z=>z.state.data===void 0||z.state.data.state==="running"?700:!1}),k=He({mutationFn:()=>ie.setup.cancelAuth.mutate({loginId:p??""}),onSuccess:()=>g(null)}),E=(K=w.data)==null?void 0:K.state;if(n!==null||v.running)return D();if(p!==null&&E==="ok")return $();if(p!==null&&(E==="running"||E===void 0))return M();if(c!==null)return Z(c);const L=t.filter(z=>z.type!=="terminal"||z.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(fe,{size:"sm",variant:"ghost",onClick:i,children:"verificar de novo"})]});return o.jsxs(o.Fragment,{children:[L.map((z,le)=>o.jsxs("button",{type:"button",className:le===0?"opt opt--primary":"opt",disabled:S.isPending||x.isPending,onClick:()=>{if(z.type==="terminal"){S.mutate(z.id);return}if(WT(z)){h(z);return}x.mutate({methodId:z.id})},children:[o.jsxs("span",{className:"opt__t",children:[o.jsx("span",{className:"opt__g","aria-hidden":"true",children:le===0?"◆":"◇"}),z.name]}),o.jsx("span",{className:"opt__d",children:VT(z)})]},z.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}),E==="failed"&&((X=w.data)==null?void 0:X.message)!=null&&o.jsx(Ae,{tone:"danger",children:w.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((z,le)=>o.jsx("span",{className:"l",children:z},le))}),o.jsx("div",{className:"setup__acts",children:o.jsx(fe,{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 le;const z=((le=w.data)==null?void 0:le.elicitation)??null;return o.jsxs(o.Fragment,{children:[z!==null&&o.jsxs("div",{className:"dcode",children:[o.jsx("span",{className:"dcode__k",children:"abra em qualquer aparelho"}),o.jsx(d_,{command:z.url}),z.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:z.code})]}),o.jsx("span",{className:"setup__note",children:z.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:"◐"}),z===null?"entrando…":"esperando você autorizar"]})}),o.jsx("div",{className:"setup__acts",children:o.jsx(fe,{size:"sm",variant:"ghost",disabled:k.isPending,onClick:()=>k.mutate(),children:"cancelar"})}),o.jsx("span",{className:"setup__note",children:z===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 $(){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(fe,{size:"sm",variant:"primary",onClick:()=>{g(null),i()},children:"continuar"})})]})}function Z(z){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:le=>f(le.target.value)}),o.jsx(fe,{size:"sm",variant:"primary",disabled:d.trim()===""||x.isPending,onClick:()=>{x.mutate({methodId:z.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 WT(e){return e.type==="env_var"||/api[- ]?key/i.test(e.id)}function VT(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 Nw=[{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"1m",label:"1m"},{id:"6m",label:"6m"},{id:"1y",label:"1a"}];function YT(e,t){return Ee({queryKey:DE(e,t),queryFn:()=>ie.usage.byProject.query({workspaceId:e,period:t})})}function GT(e,t){return Ee({queryKey:BE(e,t),queryFn:()=>ie.usage.byWorktree.query({projectId:e,period:t})})}function QT(e,t,i){return Ee({queryKey:LE(e,t),queryFn:()=>ie.usage.byProjectAndAgent.query({workspaceId:e,period:t}),enabled:i})}function ZT(e){return Ee({queryKey:EE(e.workspaceId,e.projectId),queryFn:()=>ie.memory.list.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function v_(e="pending"){return Ee({queryKey:NE(e),queryFn:()=>ie.memory.proposals.query({status:e})})}function XT(e,t){const i=t.trim();return Ee({queryKey:OE(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 JT(){return Ee({queryKey:AE,queryFn:()=>ie.memory.decisions.query()})}function eO(e){return Ee({queryKey:TE(e.workspaceId,e.projectId),queryFn:()=>ie.memory.core.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function tO(){const e=We();return He({mutationFn:t=>ie.memory.pin.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function sO(){return Ee({queryKey:ME,queryFn:()=>ie.memory.settings.query()})}function iO(e){const t=e.archived??!1;return Ee({queryKey:zE(e.workspaceId,t),queryFn:()=>ie.memory.playbooks.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},archived:t})})}function rO(){const e=We();return He({mutationFn:t=>ie.memory.archivePlaybook.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function nO(){return Ee({queryKey:RE,queryFn:()=>ie.memory.usage.query()})}function aO(){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 lO=[{id:"entries",label:"Memória"},{id:"inbox",label:"Propostas"},{id:"playbooks",label:"Playbooks"},{id:"timeline",label:"Histórico"},{id:"numbers",label:"Números"}];function Tw({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=ZT({workspaceId:e,projectId:t}),p=eO({workspaceId:e,projectId:t});return v_("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:lO.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(oO,{query:f,core:p,scope:{workspaceId:e,projectId:t}}):null,h==="inbox"?o.jsx(fO,{}):null,h==="playbooks"?o.jsx(jO,{workspaceId:e,projectId:t}):null,h==="timeline"?o.jsx(xO,{}):null,h==="numbers"?o.jsx(EO,{core:p}):null]})]})}const HS=4e3,Ow={low:"baixa",medium:"média",high:"alta"},ap={human:"você",agent:"agente",distiller:"destilação",auto_research:"auto-learn",import:"importação"},y_={global:"você · atravessa workspace",workspace:"workspace",project:"projeto"};function oO({query:e,core:t,scope:i}){var S;const[n,a]=j.useState(""),c=XT(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(uO,{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 p=new Map;for(const x of f)p.set(x.winner,[...p.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(w=>w.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:y_[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(w=>{var k;return o.jsxs("li",{className:"mem-item",children:[o.jsx(hO,{entry:w}),o.jsx("p",{className:"mem-desc",children:w.description}),o.jsxs("p",{className:"mem-meta",children:[o.jsx("span",{children:ap[w.sourceActor]??w.sourceActor}),o.jsxs("span",{children:["confiança ",Ow[w.confidence]??w.confidence]}),o.jsx(cO,{entry:w}),w.pinned&&g.get(w.path)!==void 0?o.jsxs("span",{className:"mem-pin-cost",children:[(g.get(w.path)??0).toLocaleString("pt-BR")," car."]}):null]}),(k=p.get(w.path))==null?void 0:k.map(E=>o.jsxs("p",{className:"mem-shadow-note",children:["sombreia ",o.jsx("strong",{children:E})," — continua no disco"]},E))]},w.path)})})]},x.scope))]})}function cO({entry:e}){const t=tO();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 uO({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:y_[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 hO({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 dO=[{id:"pending",label:"Pendentes"},{id:"resolved",label:"Resolvidas"}];function fO(){const[e,t]=j.useState("pending"),i=v_(e);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mem-seg",role:"group","aria-label":"Propostas por estado",children:dO.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(mO,{query:i,status:e})]})}function mO({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(_O,{proposal:i}):o.jsx(yO,{proposal:i})},i.id))})}function pO({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:ap[e.sourceActor]??e.sourceActor}),o.jsxs("span",{children:["confiança ",Ow[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:ap[t.actor]??t.actor}),o.jsx("span",{children:t.evidence===null?"sem evidência":"com evidência"})]})]})]})]})}function _O({proposal:e}){const{approve:t,reject:i}=aO(),[n,a]=j.useState("none");return o.jsxs(o.Fragment,{children:[o.jsx(Aw,{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(bO,{proposal:e}),e.current===null?null:o.jsx(pO,{current:e.current,proposal:e}),n==="edit"?o.jsx(gO,{proposal:e,approve:t,onCancel:()=>{a("none")}}):n==="reject"?o.jsx(vO,{proposal:e,reject:i,onCancel:()=>{a("none")}}):o.jsxs("div",{className:"mem-actions",children:[o.jsx(fe,{variant:"primary",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id})},children:"Aprovar"}),o.jsx(fe,{onClick:()=>{a("edit")},children:"Editar e aprovar"}),o.jsx(fe,{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 gO({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),p=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(fe,{variant:"primary",disabled:t.isPending||p,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(fe,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function vO({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(fe,{variant:"danger",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id,...n.trim()===""?{}:{note:n.trim()}})},children:"Rejeitar"}),o.jsx(fe,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function yO({proposal:e}){return o.jsxs(o.Fragment,{children:[o.jsx(Aw,{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:Rw(e.resolvedAt)})]}),e.resolutionNote===null?null:o.jsx("p",{className:"mem-shadow-note",children:e.resolutionNote})]})}function bO({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 Aw({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 SO={applied:"aprendeu",rejected:"recusou",noop:"nada a fazer"};function xO(){const e=JT();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:wO(t)}),o.jsx("span",{className:"mem-tl-dot",children:t.outcome==="rejected"?"▲":"●"}),o.jsxs("span",{children:[o.jsx("span",{className:"mem-tl-verb",children:SO[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 wO(e){return Rw(e.createdAt)}function Rw(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const CO={active:"ativo",stale:"parado",archived:"arquivado"};function jO({workspaceId:e,projectId:t}){var h,d;const[i,n]=j.useState(!1),a=iO({workspaceId:e,archived:i}),c=rO();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:CO[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":kO(f.lastLoadedAt)}),o.jsx("span",{className:"mem-scope","data-scope":f.scope,children:y_[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 kO(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 EO({core:e}){const t=nO(),i=sO();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>HS?" 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>HS?" · 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 IS(e,t){return t<=0?"0%":`${(Math.min(1,Math.max(0,e/t))*100).toFixed(2)}%`}function gh(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 FS(e,t){return`${t==="USD"?"US$":`${t} `} ${e.toFixed(4).replace(".",",")}`}function NO(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 TO(e){if(!e)return"quiet";if(e.isUsingOverage)return"over";const t=e.surpassedThreshold;return t!=null&&e.utilization>=t?"warn":"quiet"}function OO({usage:e,now:t=Date.now()}){var a;const{rateLimit:i}=e,n=TO(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"}),gh(e.used)," / ",gh(e.size),o.jsx(US,{fraction:IS(e.used,e.size)})]}),o.jsxs("span",{className:`u${e.cost?" u--cost":""}`,children:[o.jsx("span",{className:"u__k",children:"turno"}),e.cost?FS(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"}),FS(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(US,{fraction:IS(i.utilization,1)}),i.isUsingOverage?"em overage":i.resetsAt!==null&&i.resetsAt!==void 0?NO(i.resetsAt,t):null]})]})]})}function US({fraction:e}){return o.jsx("span",{className:"meter","data-fill":e,children:o.jsx("span",{className:"meter__f",style:{"--w":e}})})}function Mw({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),p=d?"div":j.Fragment,g=d?{className:"spend__group"}:{};return o.jsxs(p,{...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(Ge,{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:gh(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:KS(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(Ge,{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:gh(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:KS(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 KS(e,t){const i=e.toFixed(4).replace(".",",");return t==="USD"||t===null?`US$ ${i}`:`${t} ${i}`}function AO({workspaceId:e,workspaceName:t,onRemoved:i}){const[n,a]=j.useState("7d"),c=Ee({queryKey:ta(e),queryFn:()=>ie.project.listByWorkspace.query({workspaceId:e})}),h=YT(e,n),f=(Ee({queryKey:DO,queryFn:()=>ie.agentConfig.list.query()}).data??[]).filter(b=>b.transport==="acp").length>1,p=QT(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",...BO(p.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(RO,{id:e,name:t}),o.jsx(MO,{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(Eh,{title:"Consumo",aside:o.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo",children:Nw.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(Mw,{rows:v})]}),o.jsx("section",{className:"section",children:o.jsx(Tw,{workspaceId:e,projectId:null})})]})}function RO({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 p=a.trim();if(p===""||p===t){n(!1);return}d.mutate(p)},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(fe,{variant:"primary",size:"sm",type:"submit",disabled:d.isPending,children:"salvar"}),d.isError&&o.jsx(Ae,{tone:"danger",children:d.error.message})]}):o.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>{c(t),n(!0)},children:"renomear"})}function MO({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(fe,{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 DO=["agentConfig","list"];function BO(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 Dw(e,t="worktree"){return Ee({queryKey:jE(e.scopeType,e.scopeId,t),queryFn:()=>ie.changes.list.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:t}),refetchOnWindowFocus:!0})}function Bw(e){switch(e){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}}function Lw(e){switch(e){case"added":return"a";case"deleted":return"d";case"untracked":return"u";default:return"m"}}const LO=15e3,lp=6e4;function zO(e){var t;return e.visible?e.status&&(((t=e.status.pull)==null?void 0:t.counts.running)??0)>0?LO:lp:!1}function zw(){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 qO(e,{panelOpen:t}){const i=zw();return Ee({queryKey:qE(e??"-"),queryFn:()=>ie.pr.getByWorktree.query({worktreeId:e}),enabled:e!==null,refetchInterval:n=>zO({visible:i,status:n.state.data}),placeholderData:n=>n})}function PO(e){const t=zw();return Ee({queryKey:PE(e??"-"),queryFn:()=>ie.pr.listByProject.query({projectId:e}),enabled:e!==null,refetchInterval:()=>t?lp:!1,placeholderData:i=>i})}function HO(e){return Ee({queryKey:HE(e??"-"),queryFn:()=>ie.pr.draft.query({worktreeId:e}),enabled:e!==null,staleTime:Number.POSITIVE_INFINITY})}function IO(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 qw="lumem.pr.dismissed";function FO(e){const[t,i]=j.useState(()=>UO());return{isDismissed:e!==null&&t.includes(e),dismiss:()=>{if(e===null)return;const n=[...new Set([...t,e])];i(n);try{localStorage.setItem(qw,JSON.stringify(n))}catch{}}}}function UO(){try{const e=localStorage.getItem(qw);if(e===null)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}const op=new Set;function KO(e){op.add(e);const t=()=>op.delete(e);e.then(t,t)}async function $O(){await Promise.allSettled([...op])}function $S(e,t,i){return`${e}:${t}:${i??"context"}`}const Pw=j.createContext(null);function WO({children:e}){const[t,i]=j.useState(null),[n,a]=j.useState({}),c=j.useCallback(f=>{a(p=>t===null?p:{...p,[t]:f})},[t]),h=j.useCallback(f=>{a(p=>{if(!(f in p))return p;const g={...p};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(Pw.Provider,{value:d,children:e})}function b_(){const e=j.useContext(Pw);if(e===null)throw new Error("useOpenFiles precisa de um OpenFilesProvider acima");return e}function zu(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function WS(e,t){return t===e||t.startsWith(`${e}/`)}function VO(e){var z,le,oe;const t=We(),i=b_(),[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),[p,g]=j.useState(0);j.useEffect(()=>{const q=f.current;q!==null&&(f.current=null,$O().then(q))},[p]);const v=j.useCallback(q=>{if(c===null){q();return}f.current=q,i.close(c),g(P=>P+1)},[i,c]),b=j.useCallback((...q)=>{t.invalidateQueries({queryKey:["changes"]});for(const P of new Set(q))t.invalidateQueries({queryKey:o_(e.scopeType,e.scopeId,P)})},[t,e.scopeType,e.scopeId]),S=He({mutationFn:q=>ie.files.create.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:q.path,kind:q.kind}),onSuccess:q=>{b(zu(q.path)),a({kind:"idle"})}}),x=He({mutationFn:q=>ie.files.rename.mutate({scopeType:e.scopeType,scopeId:e.scopeId,from:q.from,to:q.to}),onSuccess:(q,P)=>{if(b(zu(P.from),zu(q.path)),P.reopen!==null){const re=P.reopen.slice(P.from.length);i.open({path:`${q.path}${re}`,view:"file"})}a({kind:"idle"})},onError:(q,P)=>{P.reopen!==null&&i.open({path:P.reopen,view:"file"})}}),w=He({mutationFn:q=>ie.files.remove.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:q.path,recursive:q.recursive}),onSuccess:(q,P)=>{b(zu(P.path)),a({kind:"idle"})},onError:(q,P)=>{P.reopen!==null&&i.open({path:P.reopen,view:"file"})}}),k=n.kind==="delete"?n.path:null,E=Ee({queryKey:CE(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=w.reset,$=j.useCallback(q=>{L(),D(),M(),a(q)},[L,D,M]),Z=j.useCallback(()=>$({kind:"idle"}),[$]),K=j.useCallback(q=>{const P=q.trim();if(P==="")return;if(n.kind==="create"){const U=n.parent;S.mutate({path:U===""?P:`${U}/${P}`,kind:n.makes});return}if(n.kind!=="rename")return;const re=n.path,se=d!==null&&WS(re,d)?d:null,A=()=>x.mutate({from:re,to:P,reopen:se});se===null?A():v(A)},[S,n,v,x,d]),X=j.useCallback(()=>{if(n.kind!=="delete")return;const q=n.path,P=d!==null&&WS(q,d)?d:null,re=()=>w.mutate({path:q,recursive:n.directory,reopen:P});P===null?re():v(re)},[n,v,w,d]);return{gesture:n,ask:$,cancel:Z,refusal:((z=S.error)==null?void 0:z.message)??((le=x.error)==null?void 0:le.message)??((oe=w.error)==null?void 0:oe.message)??null,busy:S.isPending||x.isPending||w.isPending,submit:K,confirm:X,preview:E}}function YO(e){var a,c;const t=Ee({queryKey:l_(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=Ee({queryKey:wE(i??"-"),queryFn:()=>ie.project.get.query({id:i}),enabled:i!==null}).data)==null?void 0:c.workspaceId)??null,projectId:i}}function GO({scope:e,openPath:t,onOpenPatch:i,onRefChange:n}){var x,w;const[a,c]=j.useState("worktree"),h=Dw(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 p=((x=h.data)==null?void 0:x.baseBranch)??f.current,g=((w=h.data)==null?void 0:w.files)??[],v=g.reduce((k,E)=>k+E.additions,0),b=g.reduce((k,E)=>k+E.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 ",p]})]})}),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?ZO(a,p):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(QO,{file:k,open:t===k.path,onOpen:()=>i(k.path,a)},k.path))})]})]})}function QO({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--${Lw(e.status)}`,title:e.status,children:Bw(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 ZO(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 XO(e){switch(e){case"ready":return"ready";case"blocked":return"blocked";case"pending":return"pending";case"merged":return"merged";default:return"none"}}const qu=(e,t,i)=>`${String(e)} ${e===1?t:i}`;function Pu(e,t=2){return e.slice(0,t)}function JO(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=Pu(t.names),n=t.names.length-i.length;return{state:qu(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=Pu(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=Pu(t.names,1),n=t.running+t.queued;return{state:qu(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=Pu(t.approvedBy,1);return{state:"pronta para merge",why:[{text:t.passed===0?"nada impede":qu(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":`${qu(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 eA(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 um(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:tA(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 tA(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}const sA=12e4;function Hw(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á ${iA(n)}`,stale:n>sA}}function iA(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 rA(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 nA=[{group:"failed",title:"precisa de você"},{group:"running",title:"em andamento"},{group:"passed",title:"passaram"},{group:"skipped",title:"ignoradas"}],aA={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 lA({pull:e,readAt:t,now:i}){const n=Hw(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:[nA.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(oA,{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 oA({check:e}){const t=aA[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:rA(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 cA(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 S_(){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 p=f.target;((g=n.current)==null?void 0:g.contains(p))!==!0&&((v=i.current)==null?void 0:v.contains(p))!==!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 uA({scope:e,openPath:t,onOpen:i,statusOf:n,edits:a}){const[c,h]=j.useState(new Set),d=j.useCallback(p=>{h(g=>{const v=new Set(g);return v.delete(p)||v.add(p),v})},[]),f=j.useCallback(p=>{h(g=>g.has(p)?g:new Set(g).add(p))},[]);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"rp__scroll",role:"tree","aria-label":"arquivos",children:o.jsx(Iw,{scope:e,path:"",depth:0,expanded:c,onToggle:d,onExpand:f,edits:a,openPath:t,onOpen:i,statusOf:n})}),o.jsx(fA,{edits:a})]})}function Iw({scope:e,path:t,depth:i,expanded:n,onToggle:a,onExpand:c,edits:h,openPath:d,onOpen:f,statusOf:p}){const[g,v]=j.useState(void 0),b=Ee({queryKey:[...o_(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(VS,{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:w,total:k,truncated:E}=b.data;return w.length===0?o.jsxs(o.Fragment,{children:[x,o.jsx("p",{className:"fnote",style:{"--depth":i},children:"vazio"})]}):o.jsxs(o.Fragment,{children:[x,w.map(L=>{const D=t===""?L.name:`${t}/${L.name}`,M=L.kind==="dir",$=n.has(D),Z=p(D);return S.kind==="rename"&&S.path===D?o.jsx(VS,{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?$:void 0,onClick:()=>M?a(D):f(D),children:[o.jsx("span",{className:"frow__twist",style:{"--depth":i},"aria-hidden":"true",children:M?$?"▾":"▸":""}),o.jsx("span",{className:"frow__name",children:L.name}),Z!==void 0&&o.jsx("span",{className:`mark mark--${Lw(Z)}`,title:Z,children:Bw(Z)}),o.jsx("span",{className:"frow__gap"}),L.size!==null&&L.size>0&&o.jsx("span",{className:"frow__size",children:Ro(L.size)})]}),o.jsx(dA,{path:D,isDir:M,edits:h,onExpand:c})]}),M&&$&&o.jsx(Iw,{scope:e,path:D,depth:i+1,expanded:n,onToggle:a,onExpand:c,edits:h,openPath:d,onOpen:f,statusOf:p})]},D)}),E&&o.jsxs("p",{className:"fnote",style:{"--depth":i},children:[o.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),o.jsxs("span",{children:[w.length," de ",k," entradas."," ",o.jsx("button",{type:"button",onClick:()=>v(k),children:"listar assim mesmo"})]})]})]})}function hA({edits:e}){const t=S_(),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(f_,{label:"criar na raiz",children:[o.jsx(hn,{glyph:o.jsx(Ge,{children:"+"}),onSelect:i("file"),children:"novo arquivo"}),o.jsx(hn,{glyph:o.jsx(Ge,{children:"▤"}),onSelect:i("dir"),children:"nova pasta"})]})})]})}function dA({path:e,isDir:t,edits:i,onExpand:n}){const a=S_(),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(f_,{label:`ações de ${e}`,children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(hn,{glyph:o.jsx(Ge,{children:"+"}),onSelect:c("file"),children:"novo arquivo"}),o.jsx(hn,{glyph:o.jsx(Ge,{children:"▤"}),onSelect:c("dir"),children:"nova pasta"}),o.jsx("div",{className:"frow-menu__sep",role:"separator"})]}),o.jsx(hn,{glyph:o.jsx(Ge,{children:"✎"}),onSelect:()=>{a.close(),i.ask({kind:"rename",path:e})},children:"renomear"}),o.jsx(hn,{glyph:o.jsx(Ge,{tone:"warn",children:"✕"}),onSelect:()=>{a.close(),i.ask({kind:"delete",path:e,directory:t})},children:"apagar"})]})})]})}function VS({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 fA({edits:e}){const{gesture:t,cancel:i}=e;if(j.useEffect(()=>{if(t.kind!=="delete")return;const f=p=>{p.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(hw,{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(mA,{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(pA,{path:t.path,files:a.files,untracked:a.untracked,truncated:a.truncated})]}),o.jsxs("div",{className:"fdim__actions",children:[o.jsx(fe,{variant:"ghost",onClick:i,children:"cancelar"}),o.jsx(fe,{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 mA({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 pA({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 Ro(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1).replace(".",",")} MB`}const YS={squash:"squash",merge:"merge commit",rebase:"rebase"};function _A(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(gA,{...e,cancelRef:t}):o.jsx(vA,{...e,cancelRef:t})})}function Fw(e){const t=We();return()=>(t.invalidateQueries({queryKey:["pr"]}),t.invalidateQueries({queryKey:["worktree"]}),t.invalidateQueries({queryKey:["changes"]}),e)}function gA({status:e,worktreeId:t,onClose:i,cancelRef:n}){const a=Fw(t),c=yA(e),[h,d]=j.useState(c[0]??"merge"),[f,p]=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:YS[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(fe,{size:"sm",variant:b===h?"primary":"default",role:"radio","aria-checked":b===h,onClick:()=>d(b),children:YS[b]},b))})]}),o.jsx("label",{className:"prform__field",children:o.jsxs("span",{children:[o.jsx("input",{type:"checkbox",checked:f,onChange:b=>p(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(fe,{size:"sm",variant:"ghost",ref:n,onClick:i,children:"cancelar"}),o.jsx(fe,{size:"sm",variant:"danger",type:"submit",disabled:g.isPending,children:g.isPending?"mesclando…":"mesclar"})]})]})}function vA({status:e,worktreeId:t,onClose:i,cancelRef:n}){var k;const a=Fw(t),c=HO(t),[h,d]=j.useState(null),f=h??((k=c.data)==null?void 0:k.title)??"",p=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()}}),w=`pr-title-${t}`;return o.jsxs("form",{className:"prform",onSubmit:E=>{E.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:w,label:"Título",error:x.isError?x.error.message:void 0,children:o.jsx(cs,{id:w,value:f,onChange:E=>p(E.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:`${w}-body`,children:"descrição"}),o.jsx("textarea",{id:`${w}-body`,className:"prform__body",rows:5,value:g,onChange:E=>v(E.target.value)})]}),o.jsx("label",{className:"prform__field",children:o.jsxs("span",{children:[o.jsx("input",{type:"checkbox",checked:b,onChange:E=>S(E.target.checked)})," ","abrir como rascunho"]})}),o.jsxs("div",{className:"prform__acts",children:[o.jsx(fe,{size:"sm",variant:"ghost",ref:n,onClick:i,children:"cancelar"}),o.jsx(fe,{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 yA(e){return["squash","merge","rebase"].filter(t=>e.merge[t])}function bA({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 SA({status:e,worktreeId:t,now:i,onRetry:n,onDismiss:a}){const[c,h]=j.useState(null),d=e.pull,f=e.failure,p=d===null?"none":XO(d.verdict),g=d!==null?JO(d):f!==null?um(f,e.host):eA(e),v=d!==null&&f!==null?um(f,e.host):null,b=Hw(e.readAt,i),S=d===null&&f!==null&&um(f,e.host).dismissible,x=d!==null&&d.verdict==="ready"&&(e.merge.merge||e.merge.squash||e.merge.rebase),w=d===null&&e.published&&f===null&&e.host!==null;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`prbar prbar--${p}`,role:"status","aria-label":"estado da pull request",children:[o.jsxs("div",{className:"prbar__top",children:[d!==null&&o.jsx(xA,{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(bA,{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||w||e.compareUrl!==null||f!==null)&&o.jsxs("div",{className:"prbar__acts",children:[x&&o.jsx(fe,{size:"sm",variant:"primary",onClick:()=>h("merge"),children:"mesclar"}),w&&o.jsx(fe,{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(fe,{size:"sm",variant:"ghost",onClick:n,children:"tentar de novo"}),S&&o.jsx(fe,{size:"sm",variant:"ghost",onClick:a,children:"não mostrar mais"})]})]}),c!==null&&o.jsx(_A,{verb:c,status:e,worktreeId:t,onClose:()=>h(null)})]})}function xA({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 Uw="lumem.rightPanel",wA=360,CA=260,jA=720;function kA(){const e={open:!1,width:wA};try{const t=window.localStorage.getItem(Uw);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"?x_(a):e.width}}catch{return e}}function GS(e){try{window.localStorage.setItem(Uw,JSON.stringify(e))}catch{}}function x_(e){return Math.min(jA,Math.max(CA,Math.round(e)))}function EA(){const[e,t]=j.useState(kA),i=j.useCallback(()=>{t(a=>{const c={...a,open:!a.open};return GS(c),c})},[]),n=j.useCallback(a=>{t(c=>{const h={...c,width:x_(a)};return GS(h),h})},[]);return{open:e.open,width:e.width,toggle:i,setWidth:n}}function NA({proposalCount:e=null,prBar:t,prBadge:i=null,tab:n,onSelectTab:a,changeCount:c,actions:h,onReload:d,onClose:f,onResize:p,dock:g,footLeft:v,footRight:b,children:S}){const x=j.useRef(!1),w=j.useRef(null),[k,E]=j.useState(!1),L=j.useCallback(D=>{var $;const M=($=w.current)==null?void 0:$.getBoundingClientRect().right;M===void 0||!Number.isFinite(D)||p(x_(M-D))},[p]);return j.useEffect(()=>{if(!k)return;const D=$=>{x.current&&($.preventDefault(),L($.clientX))},M=()=>{x.current=!1,E(!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:w,children:[o.jsx("span",{className:"rp__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura da coluna",onPointerDown:D=>{D.preventDefault(),x.current=!0,E(!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 TA=2e3;function Kw(e){return Ee({queryKey:Kx(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})?TA:!1}})}function OA(e){const t=We(),i=()=>{t.invalidateQueries({queryKey:Kx(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 AA=3e3;function $w(e){return{queryKey:Hi(e.scopeType,e.scopeId),queryFn:()=>ie.session.listByScope.query(e),refetchInterval:AA}}function w_(e){return Ee($w(e))}function C_(e){return Ux({queries:e.map($w),combine:t=>t.reduce((i,n)=>i+(n.data??[]).filter(a=>a.state==="running").length,0)})}function vh(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 RA=2,MA=1,DA=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,p=n-d,g=a-f-t;return{cols:Math.max(RA,Math.floor(g/e.css.cell.width)),rows:Math.max(MA,Math.floor(p/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 Ww=Object.defineProperty,BA=Object.getOwnPropertyDescriptor,LA=(e,t)=>{for(var i in t)Ww(e,i,{get:t[i],enumerable:!0})},jt=(e,t,i,n)=>{for(var a=n>1?void 0:n?BA(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&&Ww(t,i,a),a},pe=(e,t)=>(i,n)=>t(i,n,e),QS="Terminal input",cp={get:()=>QS,set:e=>QS=e},ZS="Too much output to announce, navigate to rows manually to read",up={get:()=>ZS,set:e=>ZS=e};function zA(e){return e.replace(/\r?\n/g,"\r")}function qA(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function PA(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function HA(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");Vw(a,t,i,n)}}function Vw(e,t,i,n){e=zA(e),e=qA(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Yw(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 XS(e,t,i,n,a){Yw(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 Nh(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 IA=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}},FA=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,p=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,w;for(;(w=this.interim[++x]&63)&&x<4;)S<<=6,S|=w;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,E=k-x;for(;p<E;){if(p>=i)return 0;if(w=e[p++],(w&192)!==128){p--,b=!0;break}else this.interim[x++]=w,S<<=6,S|=w&63}b||(k===2?S<128?p--: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=p;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}},Gw="",fn=" ",oc=class Qw{constructor(){this.fg=0,this.bg=0,this.extended=new yh}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 Qw;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}},yh=class Zw{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 Zw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},hi=class Xw extends oc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yh,this.combinedData=""}static fromCharData(t){let i=new Xw;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()]}},JS="di$target",hp="di$dependencies",hm=new Map;function UA(e){return e[hp]||[]}function Jt(e){if(hm.has(e))return hm.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");KA(t,i,a)};return t._id=e,hm.set(e,t),t}function KA(e,t,i){t[JS]===t?t[hp].push({id:e,index:i}):(t[hp]=[{id:e,index:i}],t[JS]=t)}var ys=Jt("BufferService"),Jw=Jt("CoreMouseService"),fa=Jt("CoreService"),$A=Jt("CharsetService"),j_=Jt("InstantiationService"),e1=Jt("LogService"),bs=Jt("OptionsService"),t1=Jt("OscLinkService"),WA=Jt("UnicodeService"),cc=Jt("DecorationService"),dp=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,p=!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 p=c.extended.urlId!==d;else f!==-1&&(p=!0);if(p||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+(!p&&v===h-1?1:0),y:e}},x=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let w=new URL(b);["http:","https:"].includes(w.protocol)||(x=!0)}catch{x=!0}x||n.push({text:b,range:S,activate:(w,k)=>a?a.activate(w,k,S):VA(w,k),hover:(w,k)=>{var E;return(E=a==null?void 0:a.hover)==null?void 0:E.call(a,w,k,S)},leave:(w,k)=>{var E;return(E=a==null?void 0:a.leave)==null?void 0:E.call(a,w,k,S)}})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(f=v,d=c.extended.urlId):(f=-1,d=-1)}}t(n)}};dp=jt([pe(0,ys),pe(1,bs),pe(2,t1)],dp);function VA(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 Th=Jt("CharSizeService"),vr=Jt("CoreBrowserService"),k_=Jt("MouseService"),yr=Jt("RenderService"),YA=Jt("SelectionService"),s1=Jt("CharacterJoinerService"),kl=Jt("ThemeService"),i1=Jt("LinkProviderService"),GA=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?e0.isErrorNoTelemetry(e)?new e0(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)}},QA=new GA;function Ju(e){ZA(e)||QA.onUnexpectedError(e)}var fp="Canceled";function ZA(e){return e instanceof XA?!0:e instanceof Error&&e.name===fp&&e.message===fp}var XA=class extends Error{constructor(){super(fp),this.name=this.message}};function JA(e){return new Error(`Illegal argument: ${e}`)}var e0=class mp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof mp)return t;let i=new mp;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},pp=class r1 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,r1.prototype)}};function Us(e,t=0){return e[e.length-(1+t)]}var eR;(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})(eR||(eR={}));function tR(e,t){let i=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(i,arguments))),a}}var n1;(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 $=M.length-1;$>=0;$--)yield M[$]}e.reverse=d;function f(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=f;function p(M){return M[Symbol.iterator]().next().value}e.first=p;function g(M,$){let Z=0;for(let K of M)if($(K,Z++))return!0;return!1}e.some=g;function v(M,$){for(let Z of M)if($(Z))return Z}e.find=v;function*b(M,$){for(let Z of M)$(Z)&&(yield Z)}e.filter=b;function*S(M,$){let Z=0;for(let K of M)yield $(K,Z++)}e.map=S;function*x(M,$){let Z=0;for(let K of M)yield*$(K,Z++)}e.flatMap=x;function*w(...M){for(let $ of M)yield*$}e.concat=w;function k(M,$,Z){let K=Z;for(let X of M)K=$(K,X);return K}e.reduce=k;function*E(M,$,Z=M.length){for($<0&&($+=M.length),Z<0?Z+=M.length:Z>M.length&&(Z=M.length);$<Z;$++)yield M[$]}e.slice=E;function L(M,$=Number.POSITIVE_INFINITY){let Z=[];if($===0)return[Z,M];let K=M[Symbol.iterator]();for(let X=0;X<$;X++){let z=K.next();if(z.done)return[Z,e.empty()];Z.push(z.value)}return[Z,{[Symbol.iterator](){return K}}]}e.consume=L;async function D(M){let $=[];for await(let Z of M)$.push(Z);return Promise.resolve($)}e.asyncToArray=D})(n1||(n1={}));function oa(e){if(n1.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 sR(...e){return gt(()=>oa(e))}function gt(e){return{dispose:tR(()=>{e()})}}var a1=class l1{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?l1.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)}};a1.DISABLE_DISPOSED_WARNING=!1;var pn=a1,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 xl=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,_p=class gp{constructor(t){this.element=t,this.next=gp.Undefined,this.prev=gp.Undefined}};_p.Undefined=new _p(void 0);var vt=_p,t0=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}},iR=globalThis.performance&&typeof globalThis.performance.now=="function",rR=class o1{static create(t){return new o1(t)}constructor(t){this._now=iR&&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(q,P){return v(q,()=>{},0,void 0,!0,void 0,P)}e.defer=t;function i(q){return(P,re=null,se)=>{let A=!1,U;return U=q(G=>{if(!A)return U?U.dispose():A=!0,P.call(re,G)},null,se),A&&U.dispose(),U}}e.once=i;function n(q,P,re){return p((se,A=null,U)=>q(G=>se.call(A,P(G)),null,U),re)}e.map=n;function a(q,P,re){return p((se,A=null,U)=>q(G=>{P(G),se.call(A,G)},null,U),re)}e.forEach=a;function c(q,P,re){return p((se,A=null,U)=>q(G=>P(G)&&se.call(A,G),null,U),re)}e.filter=c;function h(q){return q}e.signal=h;function d(...q){return(P,re=null,se)=>{let A=sR(...q.map(U=>U(G=>P.call(re,G))));return g(A,se)}}e.any=d;function f(q,P,re,se){let A=re;return n(q,U=>(A=P(A,U),A),se)}e.reduce=f;function p(q,P){let re,se={onWillAddFirstListener(){re=q(A.fire,A)},onDidRemoveLastListener(){re==null||re.dispose()}},A=new de(se);return P==null||P.add(A),A.event}function g(q,P){return P instanceof Array?P.push(q):P&&P.add(q),q}function v(q,P,re=100,se=!1,A=!1,U,G){let be,ae,T,W=0,ne,V={leakWarningThreshold:U,onWillAddFirstListener(){be=q(ge=>{W++,ae=P(ae,ge),se&&!T&&(he.fire(ae),ae=void 0),ne=()=>{let Ne=ae;ae=void 0,T=void 0,(!se||W>1)&&he.fire(Ne),W=0},typeof re=="number"?(clearTimeout(T),T=setTimeout(ne,re)):T===void 0&&(T=0,queueMicrotask(ne))})},onWillRemoveListener(){A&&W>0&&(ne==null||ne())},onDidRemoveLastListener(){ne=void 0,be.dispose()}},he=new de(V);return G==null||G.add(he),he.event}e.debounce=v;function b(q,P=0,re){return e.debounce(q,(se,A)=>se?(se.push(A),se):[A],P,void 0,!0,void 0,re)}e.accumulate=b;function S(q,P=(se,A)=>se===A,re){let se=!0,A;return c(q,U=>{let G=se||!P(U,A);return se=!1,A=U,G},re)}e.latch=S;function x(q,P,re){return[e.filter(q,P,re),e.filter(q,se=>!P(se),re)]}e.split=x;function w(q,P=!1,re=[],se){let A=re.slice(),U=q(ae=>{A?A.push(ae):be.fire(ae)});se&&se.add(U);let G=()=>{A==null||A.forEach(ae=>be.fire(ae)),A=null},be=new de({onWillAddFirstListener(){U||(U=q(ae=>be.fire(ae)),se&&se.add(U))},onDidAddFirstListener(){A&&(P?setTimeout(G):G())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return se&&se.add(be),be.event}e.buffer=w;function k(q,P){return(re,se,A)=>{let U=P(new L);return q(function(G){let be=U.evaluate(G);be!==E&&re.call(se,be)},void 0,A)}}e.chain=k;let E=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(P){return this.steps.push(P),this}forEach(P){return this.steps.push(re=>(P(re),re)),this}filter(P){return this.steps.push(re=>P(re)?re:E),this}reduce(P,re){let se=re;return this.steps.push(A=>(se=P(se,A),se)),this}latch(P=(re,se)=>re===se){let re=!0,se;return this.steps.push(A=>{let U=re||!P(A,se);return re=!1,se=A,U?A:E}),this}evaluate(P){for(let re of this.steps)if(P=re(P),P===E)break;return P}}function D(q,P,re=se=>se){let se=(...be)=>G.fire(re(...be)),A=()=>q.on(P,se),U=()=>q.removeListener(P,se),G=new de({onWillAddFirstListener:A,onDidRemoveLastListener:U});return G.event}e.fromNodeEventEmitter=D;function M(q,P,re=se=>se){let se=(...be)=>G.fire(re(...be)),A=()=>q.addEventListener(P,se),U=()=>q.removeEventListener(P,se),G=new de({onWillAddFirstListener:A,onDidRemoveLastListener:U});return G.event}e.fromDOMEventEmitter=M;function $(q){return new Promise(P=>i(q)(P))}e.toPromise=$;function Z(q){let P=new de;return q.then(re=>{P.fire(re)},()=>{P.fire(void 0)}).finally(()=>{P.dispose()}),P.event}e.fromPromise=Z;function K(q,P){return q(re=>P.fire(re))}e.forward=K;function X(q,P,re){return P(re),q(se=>P(se))}e.runAndSubscribe=X;class z{constructor(P,re){this._observable=P,this._counter=0,this._hasChanged=!1;let se={onWillAddFirstListener:()=>{P.addObserver(this)},onDidRemoveLastListener:()=>{P.removeObserver(this)}};this.emitter=new de(se),re&&re.add(this.emitter)}beginUpdate(P){this._counter++}handlePossibleChange(P){}handleChange(P,re){this._hasChanged=!0}endUpdate(P){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function le(q,P){return new z(q,P).emitter.event}e.fromObservable=le;function oe(q){return(P,re,se)=>{let A=0,U=!1,G={beginUpdate(){A++},endUpdate(){A--,A===0&&(q.reportChanges(),U&&(U=!1,P.call(re)))},handlePossibleChange(){},handleChange(){U=!0}};q.addObserver(G),q.reportChanges();let be={dispose(){q.removeObserver(G)}};return se instanceof pn?se.add(be):Array.isArray(se)&&se.push(be),be}}e.fromObservableLight=oe})(os||(os={}));var vp=class yp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${yp._idPool++}`,yp.all.add(this)}start(t){this._stopWatch=new rR,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}}};vp.all=new Set,vp._idPool=0;var nR=vp,aR=-1,c1=class u1{constructor(t,i,n=(u1._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 cR(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}};c1._idPool=1;var lR=c1,oR=class h1{constructor(t){this.value=t}static create(){let t=new Error;return new h1(t.stack??"")}print(){console.warn(this.value.split(`
79
+ `).slice(2).join(`
80
+ `))}},cR=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},uR=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},hR=0,dm=class{constructor(e){this.value=e,this.id=hR++}},dR=2,fR,de=class{constructor(e){var t,i,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new lR((e==null?void 0:e.onListenerError)??Ju,((i=this._options)==null?void 0:i.leakWarningThreshold)??aR):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new nR(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,p,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 uR(`${v}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Ju)(S),Ie.None}if(this._disposed)return Ie.None;t&&(e=e.bind(t));let n=new dm(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=oR.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof dm?(this._deliveryQueue??(this._deliveryQueue=new mR),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=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||g.call(p,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*dR<=t.length){let f=0;for(let p=0;p<t.length;p++)t[p]?t[f++]=t[p]: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)||Ju;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 dm)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}},mR=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}},bp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new de,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new de,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}};bp.INSTANCE=new bp;var E_=bp;function pR(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}E_.INSTANCE.onDidChangeZoomLevel;function _R(e){return E_.INSTANCE.getZoomFactor(e)}E_.INSTANCE.onDidChangeFullscreen;var El=typeof navigator=="object"?navigator.userAgent:"",Sp=El.indexOf("Firefox")>=0,gR=El.indexOf("AppleWebKit")>=0,N_=El.indexOf("Chrome")>=0,vR=!N_&&El.indexOf("Safari")>=0;El.indexOf("Electron/")>=0;El.indexOf("Android")>=0;var fm=!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)");fm=e.matches,pR(fr,e,({matches:i})=>{fm&&t.matches||(fm=i)})}var sl="en",xp=!1,wp=!1,eh=!1,d1=!1,Hu,th=sl,s0=sl,yR,vi,Jn=globalThis,ns,xx;typeof Jn.vscode<"u"&&typeof Jn.vscode.process<"u"?ns=Jn.vscode.process:typeof process<"u"&&typeof((xx=process==null?void 0:process.versions)==null?void 0:xx.node)=="string"&&(ns=process);var wx,bR=typeof((wx=ns==null?void 0:ns.versions)==null?void 0:wx.electron)=="string",SR=bR&&(ns==null?void 0:ns.type)==="renderer",Cx;if(typeof ns=="object"){xp=ns.platform==="win32",wp=ns.platform==="darwin",eh=ns.platform==="linux",eh&&ns.env.SNAP&&ns.env.SNAP_REVISION,ns.env.CI||ns.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Hu=sl,th=sl;let e=ns.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Hu=t.userLocale,s0=t.osLocale,th=t.resolvedLanguage||sl,yR=(Cx=t.languagePack)==null?void 0:Cx.translationsConfigFile}catch{}d1=!0}else typeof navigator=="object"&&!SR?(vi=navigator.userAgent,xp=vi.indexOf("Windows")>=0,wp=vi.indexOf("Macintosh")>=0,(vi.indexOf("Macintosh")>=0||vi.indexOf("iPad")>=0||vi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,eh=vi.indexOf("Linux")>=0,(vi==null?void 0:vi.indexOf("Mobi"))>=0,th=globalThis._VSCODE_NLS_LANGUAGE||sl,Hu=navigator.language.toLowerCase(),s0=Hu):console.error("Unable to resolve platform.");var f1=xp,qi=wp,xR=eh,i0=d1,Pi=vi,$r=th,wR;(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})(wR||(wR={}));var CR=typeof Jn.postMessage=="function"&&!Jn.importScripts;(()=>{if(CR){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 jR=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!jR&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var Ja=typeof navigator=="object"?navigator:{};i0||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ja&&Ja.clipboard&&Ja.clipboard.writeText,i0||Ja&&Ja.clipboard&&Ja.clipboard.readText;var T_=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}},mm=new T_,r0=new T_,n0=new T_,kR=new Array(230),m1;(e=>{function t(d){return mm.keyCodeToStr(d)}e.toString=t;function i(d){return mm.strToKeyCode(d)}e.fromString=i;function n(d){return r0.keyCodeToStr(d)}e.toUserSettingsUS=n;function a(d){return n0.keyCodeToStr(d)}e.toUserSettingsGeneral=a;function c(d){return r0.strToKeyCode(d)||n0.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 mm.keyCodeToStr(d)}e.toElectronAccelerator=h})(m1||(m1={}));var ER=class p1{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 p1&&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 NR([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},NR=class{constructor(e){if(e.length===0)throw JA("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 TR(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return m1.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Sp)switch(t){case 59:return 85;case 60:if(xR)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(gR&&(qi&&t===93||!qi&&t===92))return 57;return kR[t]||0}var OR=qi?256:2048,AR=512,RR=1024,MR=qi?2048:256,a0=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=TR(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|=OR),this.altKey&&(t|=AR),this.shiftKey&&(t|=RR),this.metaKey&&(t|=MR),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new ER(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},l0=new WeakMap;function DR(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 BR=class{static getSameOriginWindowChain(e){let t=l0.get(e);if(!t){t=[],l0.set(e,t);let i=e,n;do n=DR(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}}},Iu=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=BR.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},o0=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(N_){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?Sp&&!qi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof c.wheelDeltaX<"u")vR&&f1?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?Sp&&!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()}},_1=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),LR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof zR?!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:_1})})(LR||(LR={}));var zR=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?_1:(this._emitter||(this._emitter=new de),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},O_=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 pp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new pp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},qR=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 pp("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}},PR;(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})(PR||(PR={}));var c0=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 de,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())}};c0.EMPTY=c0.fromArray([]);var{getWindow:Bi,getWindowId:HR,onDidRegisterWindow:IR}=(function(){let e=new Map,t={window:fr,disposables:new pn};e.set(fr.vscodeWindowId,t);let i=new de,n=new de,a=new de;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 p;let d=h;if((p=d==null?void 0:d.ownerDocument)!=null&&p.defaultView)return d.ownerDocument.defaultView.window;let f=h;return f!=null&&f.view?f.view.window:fr},getDocument(h){return Bi(h).document}}})(),FR=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 FR(e,t,i,n)}var u0=function(e,t,i,n){return Te(e,t,i,n)},A_,UR=class extends qR{constructor(e){super(),this.defaultTarget=e&&Bi(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},h0=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){Ju(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(h0.sort),h.shift().execute();n.set(c,!1)};A_=(c,h,d=0)=>{let f=HR(c),p=new h0(h,d),g=e.get(f);return g||(g=[],e.set(f,g)),g.push(p),i.get(f)||(i.set(f,!0),c.requestAnimationFrame(()=>a(f))),p}})();function KR(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"},$R=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 Po(e){return new $R(e)}var g1=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 WR(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 Mo=class hs extends Ie{constructor(){super(),this.dispatched=!1,this.targets=new t0,this.ignoreTargets=new t0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(os.runAndSubscribe(IR,({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],p=Date.now()-f.initialTimeStamp;if(p<hs.HOLD_DELAY&&Math.abs(f.initialPageX-Us(f.rollingPageX))<30&&Math.abs(f.initialPageY-Us(f.rollingPageY))<30){let g=this.newGestureEvent(Ti.Tap,f.initialTarget);g.pageX=Us(f.rollingPageX),g.pageY=Us(f.rollingPageY),this.dispatchEvent(g)}else if(p>=hs.HOLD_DELAY&&Math.abs(f.initialPageX-Us(f.rollingPageX))<30&&Math.abs(f.initialPageY-Us(f.rollingPageY))<30){let g=this.newGestureEvent(Ti.Contextmenu,f.initialTarget);g.pageX=Us(f.rollingPageX),g.pageY=Us(f.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=Us(f.rollingPageX),v=Us(f.rollingPageY),b=Us(f.rollingTimestamps)-f.rollingTimestamps[0],S=g-f.rollingPageX[0],x=v-f.rollingPageY[0],w=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,w,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,p){this.handle=A_(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 w=this.newGestureEvent(Ti.Change);w.translationX=b,w.translationY=S,i.forEach(k=>k.dispatchEvent(w)),x||this.inertia(t,i,g,a,c,h+b,d,f,p+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-Us(h.rollingPageX),d.translationY=c.pageY-Us(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)}};Mo.SCROLL_FRICTION=-.005,Mo.HOLD_DELAY=700,Mo.CLEAR_TAP_COUNT_TIME=400,jt([WR],Mo,"isTouchDevice",1);var VR=Mo,R_=class extends Ie{onclick(e,t){this._register(Te(e,Yt.CLICK,i=>t(new Iu(Bi(e),i))))}onmousedown(e,t){this._register(Te(e,Yt.MOUSE_DOWN,i=>t(new Iu(Bi(e),i))))}onmouseover(e,t){this._register(Te(e,Yt.MOUSE_OVER,i=>t(new Iu(Bi(e),i))))}onmouseleave(e,t){this._register(Te(e,Yt.MOUSE_LEAVE,i=>t(new Iu(Bi(e),i))))}onkeydown(e,t){this._register(Te(e,Yt.KEY_DOWN,i=>t(new a0(i))))}onkeyup(e,t){this._register(Te(e,Yt.KEY_UP,i=>t(new a0(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 VR.ignoreTarget(e)}},d0=11,YR=class extends R_{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=d0+"px",this.domNode.style.height=d0+"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 g1),this._register(u0(this.bgDomNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(u0(this.domNode,Yt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new UR),this._pointerdownScheduleRepeatTimer=this._register(new O_)}_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()}},GR=class Cp{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 Cp(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 Cp(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}}},QR=class extends Ie{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new GR(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 m0(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=m0.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)))}},f0=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function pm(e,t){let i=t-e;return function(n){return e+i*JR(n)}}function ZR(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}var m0=class jp{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),ZR(pm(t,a),pm(c,i),.33)}return pm(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 f0(n,a,!1)}return new f0(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,n){return jp.start(t,i,n)}static start(t,i,n){n=n+10;let a=Date.now()-10;return new jp(t,i,a,n)}};function XR(e){return Math.pow(e,3)}function JR(e){return 1-XR(1-e)}var eM=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 O_)}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":"")))}},tM=140,v1=class extends R_{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 eM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new g1),this._shouldRender=!0,this.domNode=Po(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 YR(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=Po(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=KR(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(f1&&h>tM){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()}},y1=class kp{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 kp(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 p=Math.round(Math.max(20,Math.floor(n*d/a))),g=(d-p)/(a-n),v=c*g;return{computedAvailableSize:Math.round(h),computedIsNeeded:f,computedSliderSize:Math.round(p),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let t=kp._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)}},sM=class extends v1{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new y1(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}},iM=class extends v1{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new y1(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}},rM=500,p0=50,nM=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Ep=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(N_){let i=Bi(t.browserEvent),n=_R(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 nM(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),p=Math.max(Math.min(c,d),1),g=Math.max(a,h),v=Math.max(c,d);g%f===0&&v%p===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Ep.INSTANCE=new Ep;var aM=Ep,lM=class extends R_{constructor(e,t,i){super(),this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new de),this.onWillScroll=this._onWillScroll.event,this._options=cM(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 iM(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new sM(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=Po(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Po(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Po(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 O_),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 o0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=oa(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new o0(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=aM.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(),p={};if(c){let g=p0*c,v=f.scrollTop-(g<0?Math.floor(g):Math.ceil(g));this._verticalScrollbar.writeScrollPosition(p,v)}if(h){let g=p0*h,v=f.scrollLeft-(g<0?Math.floor(g):Math.ceil(g));this._horizontalScrollbar.writeScrollPosition(p,v)}p=this._scrollable.validateScrollPosition(p),(f.scrollLeft!==p.scrollLeft||f.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),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(),rM)}},oM=class extends lM{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 cM(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 Np=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 de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new QR({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>A_(n.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oM(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(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&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(p=>this._handleScroll(p)))}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}};Np=jt([pe(2,ys),pe(3,vr),pe(4,Jw),pe(5,kl),pe(6,bs),pe(7,yr)],Np);var Tp=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()}};Tp=jt([pe(1,ys),pe(2,vr),pe(3,cc),pe(4,yr)],Tp);var uM=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},Co={full:0,left:0,center:0,right:0},bh=class extends Ie{constructor(e,t,i,n,a,c,h,d){var p;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 uM,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(),(p=this._viewportElement.parentElement)==null||p.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(),Co.full=1,Co.left=1,Co.center=1+Wr.left,Co.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(Co[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}))}};bh=jt([pe(2,ys),pe(3,cc),pe(4,yr),pe(5,bs),pe(6,kl),pe(7,vr)],bh);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 sh;(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="Ÿ"))(sh||(sh={}));var b1;(e=>e.ST=`${te.ESC}\\`)(b1||(b1={}));var Op=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)}}};Op=jt([pe(2,ys),pe(3,bs),pe(4,fa),pe(5,yr)],Op);var Gt=0,Qt=0,Zt=0,wt=0,_0={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,p){if(wt=(p.rgba&255)/255,wt===1)return{css:p.css,rgba:p.rgba};let g=p.rgba>>24&255,v=p.rgba>>16&255,b=p.rgba>>8&255,S=f.rgba>>24&255,x=f.rgba>>16&255,w=f.rgba>>8&255;Gt=S+Math.round((g-S)*wt),Qt=x+Math.round((v-x)*wt),Zt=w+Math.round((b-w)*wt);let k=qt.toCss(Gt,Qt,Zt),E=qt.toRgba(Gt,Qt,Zt);return{css:k,rgba:E}}e.blend=t;function i(f){return(f.rgba&255)===255}e.isOpaque=i;function n(f,p,g){let v=ih.ensureContrastRatio(f.rgba,p.rgba,g);if(v)return qt.toColor(v>>24&255,v>>16&255,v>>8&255)}e.ensureContrastRatio=n;function a(f){let p=(f.rgba|255)>>>0;return[Gt,Qt,Zt]=ih.toChannels(p),{css:qt.toCss(Gt,Qt,Zt),rgba:p}}e.opaque=a;function c(f,p){return wt=Math.round(p*255),[Gt,Qt,Zt]=ih.toChannels(f.rgba),{css:qt.toCss(Gt,Qt,Zt,wt),rgba:qt.toRgba(Gt,Qt,Zt,wt)}}e.opacity=c;function h(f,p){return wt=f.rgba&255,c(f,wt*p/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,p=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 p*.2126+g*.7152+v*.0722}e.relativeLuminance2=i})(_s||(_s={}));var ih;(e=>{function t(h,d){if(wt=(d&255)/255,wt===1)return d;let f=d>>24&255,p=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((p-b)*wt),Zt=S+Math.round((g-S)*wt),qt.toRgba(Gt,Qt,Zt)}e.blend=t;function i(h,d,f){let p=_s.relativeLuminance(h>>8),g=_s.relativeLuminance(d>>8);if(ar(p,g)<f){if(g<p){let S=n(h,d,f),x=ar(p,_s.relativeLuminance(S>>8));if(x<f){let w=a(h,d,f),k=ar(p,_s.relativeLuminance(w>>8));return x>k?S:w}return S}let v=a(h,d,f),b=ar(p,_s.relativeLuminance(v>>8));if(b<f){let S=n(h,d,f),x=ar(p,_s.relativeLuminance(S>>8));return b>x?v:S}return v}}e.ensureContrastRatio=i;function n(h,d,f){let p=h>>24&255,g=h>>16&255,v=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,w=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(p,g,v));for(;w<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)),w=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(p,g,v));return(b<<24|S<<16|x<<8|255)>>>0}e.reduceLuminance=n;function a(h,d,f){let p=h>>24&255,g=h>>16&255,v=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,w=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(p,g,v));for(;w<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)),w=ar(_s.relativeLuminance2(b,S,x),_s.relativeLuminance2(p,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})(ih||(ih={}));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 hM=class extends oc{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()]}},Sh=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 p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==f){if(p-a>1){let g=this._getJoinedRanges(n,h,c,t,a);for(let v=0;v<g.length;v++)i.push(g[v])}a=p,h=c,d=this._workCell.fg,f=this._workCell.bg}c+=this._workCell.getChars().length||fn.length}if(this._bufferService.cols-a>1){let p=this._getJoinedRanges(n,h,c,t,a);for(let g=0;g<p.length;g++)i.push(p[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 p=0;p<f.length;p++)Sh._mergeRanges(h,f[p])}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),p=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+=p}}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}};Sh=jt([pe(0,ys)],Sh);function dM(e){return 57508<=e&&e<=57558}function fM(e){return 9472<=e&&e<=9631}function mM(e){return dM(e)||fM(e)}function pM(){return{css:{canvas:Fu(),cell:Fu()},device:{canvas:Fu(),cell:Fu(),char:{width:0,height:0,left:0,top:0}}}}function Fu(){return{width:0,height:0}}var Ap=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,p,g){let v=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,x=e.getNoBgTrimmedLength();i&&x<c+1&&(x=c+1);let w,k=0,E="",L=0,D=0,M=0,$=0,Z=!1,K=0,X=!1,z=0,le=0,oe=[],q=p!==-1&&g!==-1;for(let P=0;P<x;P++){e.loadCell(P,this._workCell);let re=this._workCell.getWidth();if(re===0)continue;let se=!1,A=P>=le,U=P,G=this._workCell;if(b.length>0&&P===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 hM(this._workCell,e.translateToString(!0,et[0],et[1]),et[1]-et[0]),U=et[1]-1,re=G.getWidth()):le=et[1]}let be=this._isCellInSelection(P,t),ae=i&&P===c,T=q&&P>=p&&P<=g,W=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,et=>{W=!0});let ne=G.getChars()||fn;if(ne===" "&&(G.isUnderline()||G.isOverline())&&(ne=" "),z=re*d-f.get(ne,G.isBold(),G.isItalic()),!w)w=this._document.createElement("span");else if(k&&(be&&X||!be&&!X&&G.bg===D)&&(be&&X&&S.selectionForeground||G.fg===M)&&G.extended.ext===$&&T===Z&&z===K&&!ae&&!se&&!W&&A){G.isInvisible()?E+=fn:E+=ne,k++;continue}else k&&(w.textContent=E),w=this._document.createElement("span"),k=0,E="";if(D=G.bg,M=G.fg,$=G.extended.ext,Z=T,K=z,X=be,se&&c>=P&&c<=U&&(c=P),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(oe.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&oe.push("xterm-cursor-blink"),oe.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":oe.push("xterm-cursor-outline");break;case"block":oe.push("xterm-cursor-block");break;case"bar":oe.push("xterm-cursor-bar");break;case"underline":oe.push("xterm-cursor-underline");break}}if(G.isBold()&&oe.push("xterm-bold"),G.isItalic()&&oe.push("xterm-italic"),G.isDim()&&oe.push("xterm-dim"),G.isInvisible()?E=fn:E=G.getChars()||fn,G.isUnderline()&&(oe.push(`xterm-underline-${G.extended.underlineStyle}`),E===" "&&(E=" "),!G.isUnderlineColorDefault()))if(G.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${oc.toColorRGB(G.getUnderlineColor()).join(",")})`;else{let et=G.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&G.isBold()&&et<8&&(et+=8),w.style.textDecorationColor=S.ansi[et].css}G.isOverline()&&(oe.push("xterm-overline"),E===" "&&(E=" ")),G.isStrikethrough()&&oe.push("xterm-strikethrough"),T&&(w.style.textDecoration="underline");let V=G.getFgColor(),he=G.getFgColorMode(),ge=G.getBgColor(),Ne=G.getBgColorMode(),kt=!!G.isInverse();if(kt){let et=V;V=ge,ge=et;let mi=he;he=Ne,Ne=mi}let Xe,Rs,xi=!1;this._decorationService.forEachDecorationAtCell(P,t,void 0,et=>{et.options.layer!=="top"&&xi||(et.backgroundColorRGB&&(Ne=50331648,ge=et.backgroundColorRGB.rgba>>8&16777215,Xe=et.backgroundColorRGB),et.foregroundColorRGB&&(he=50331648,V=et.foregroundColorRGB.rgba>>8&16777215,Rs=et.foregroundColorRGB),xi=et.options.layer==="top")}),!xi&&be&&(Xe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ge=Xe.rgba>>8&16777215,Ne=50331648,xi=!0,S.selectionForeground&&(he=50331648,V=S.selectionForeground.rgba>>8&16777215,Rs=S.selectionForeground)),xi&&oe.push("xterm-decoration-top");let Qs;switch(Ne){case 16777216:case 33554432:Qs=S.ansi[ge],oe.push(`xterm-bg-${ge}`);break;case 50331648:Qs=qt.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(w,`background-color:#${g0((ge>>>0).toString(16),"0",6)}`);break;case 0:default:kt?(Qs=S.foreground,oe.push("xterm-bg-257")):Qs=S.background}switch(Xe||G.isDim()&&(Xe=pt.multiplyOpacity(Qs,.5)),he){case 16777216:case 33554432:G.isBold()&&V<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(V+=8),this._applyMinimumContrast(w,Qs,S.ansi[V],G,Xe,void 0)||oe.push(`xterm-fg-${V}`);break;case 50331648:let et=qt.toColor(V>>16&255,V>>8&255,V&255);this._applyMinimumContrast(w,Qs,et,G,Xe,Rs)||this._addStyle(w,`color:#${g0(V.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(w,Qs,S.foreground,G,Xe,Rs)||kt&&oe.push("xterm-fg-257")}oe.length&&(w.className=oe.join(" "),oe.length=0),!ae&&!se&&!W&&A?k++:w.textContent=E,z!==this.defaultSpacing&&(w.style.letterSpacing=`${z}px`),v.push(w),P=U}return w&&k&&(w.textContent=E),v}_applyMinimumContrast(e,t,i,n,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||mM(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]}};Ap=jt([pe(1,s1),pe(2,bs),pe(3,vr),pe(4,fa),pe(5,cc),pe(6,kl)],Ap);function g0(e,t,i){for(;e.length<i;)e=t+e;return e}var _M=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}},gM=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 vM(){return new gM}var _m="xterm-dom-renderer-owner-",li="xterm-rows",Uu="xterm-fg-",v0="xterm-bg-",jo="xterm-focus",Ku="xterm-selection",yM=1,Rp=class extends Ie{constructor(e,t,i,n,a,c,h,d,f,p,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=p,this._bufferService=g,this._coreService=v,this._coreBrowserService=b,this._themeService=S,this._terminalClass=yM++,this._rowElements=[],this._selectionRenderModel=vM(),this.onRequestRedraw=this._register(new de).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(Ku),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=pM(),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(Ap,document),this._element.classList.add(_m+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(_m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _M(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}.${jo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${li}.${jo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${li}.${jo} .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} .${Ku} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ku} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ku} 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} .${v0}${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} .${v0}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(jo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(jo),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,p=c===a?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(c,f,p));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 p=f+i.ydisp,g=this._rowElements[f],v=i.lines.get(p);if(!g||!v)break;g.replaceChildren(...this._rowFactory.createRow(v,p,p===n,h,d,a,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_m}${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,p=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,w=this._rowElements[S],k=d.lines.get(x);if(!w||!k)break;w.replaceChildren(...this._rowFactory.createRow(k,x,x===f,v,b,p,g,this.dimensions.css.cell.width,this._widthCache,c?S===i?e:0:-1,c?(S===n?t:a)-1:-1))}}};Rp=jt([pe(7,j_),pe(8,Th),pe(9,bs),pe(10,ys),pe(11,fa),pe(12,vr),pe(13,kl)],Rp);var Mp=class extends Ie{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new de),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new SM(this._optionsService))}catch{this._measureStrategy=this._register(new bM(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())}};Mp=jt([pe(2,bs)],Mp);var S1=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)}},bM=class extends S1{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}},SM=class extends S1{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}},xM=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 wM(this._window)),this._onDprChange=this._register(new de),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new de),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}},wM=class extends Ie{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new xl),this._onDprChange=this._register(new de),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)}},CM=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 M_(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 jM(e,t,i,n,a,c,h,d,f){if(!c)return;let p=M_(e,t,i);if(p)return p[0]=Math.ceil((p[0]+(f?h/2:0))/h),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),n+(f?1:0)),p[1]=Math.min(Math.max(p[1],1),a),p}var Dp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,a){return jM(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=M_(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])}}};Dp=jt([pe(0,yr),pe(1,Th)],Dp);var kM=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=[]}},x1={};LA(x1,{getSafariVersion:()=>NM,isChromeOS:()=>k1,isFirefox:()=>w1,isIpad:()=>TM,isIphone:()=>OM,isLegacyEdge:()=>EM,isLinux:()=>D_,isMac:()=>xh,isNode:()=>Oh,isSafari:()=>C1,isWindows:()=>j1});var Oh=typeof process<"u"&&"title"in process,uc=Oh?"node":navigator.userAgent,hc=Oh?"node":navigator.platform,w1=uc.includes("Firefox"),EM=uc.includes("Edge"),C1=/^((?!chrome|android).)*safari/i.test(uc);function NM(){if(!C1)return 0;let e=uc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var xh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(hc),TM=hc==="iPad",OM=hc==="iPhone",j1=["Windows","Win16","Win32","WinCE"].includes(hc),D_=hc.indexOf("Linux")>=0,k1=/\bCrOS\b/.test(uc),E1=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()}},AM=class extends E1{_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())}}},RM=class extends E1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},wh=!Oh&&"requestIdleCallback"in window?RM:AM,MM=class{constructor(){this._queue=new wh}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Bp=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 xl),this._pausedResizeTask=new MM,this._observerDisposable=this._register(new xl),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 de),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new de),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new de),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new kM((p,g)=>this._renderRows(p,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new DM(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 p;return(p=this._renderer.value)==null?void 0:p.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(p=>this._registerIntersectionObserver(p,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()}};Bp=jt([pe(2,bs),pe(3,Th),pe(4,fa),pe(5,cc),pe(6,ys),pe(7,vr),pe(8,kl)],Bp);var DM=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 BM(e,t,i,n){let a=i.buffer.x,c=i.buffer.y;if(!i.buffer.hasScrollback)return qM(a,c,e,t,i,n)+Ah(c,t,i,n)+PM(a,c,e,t,i,n);let h;if(c===t)return h=a>e?"D":"C",Yo(Math.abs(a-e),Vo(h,n));h=c>t?"D":"C";let d=Math.abs(c-t),f=zM(c>t?e:a,i)+(d-1)*i.cols+1+LM(c>t?a:e);return Yo(f,Vo(h,n))}function LM(e,t){return e-1}function zM(e,t){return t.cols-e}function qM(e,t,i,n,a,c){return Ah(t,n,a,c).length===0?"":Yo(T1(e,t,e,t-ca(t,a),!1,a).length,Vo("D",c))}function Ah(e,t,i,n){let a=e-ca(e,i),c=t-ca(t,i),h=Math.abs(a-c)-HM(e,t,i);return Yo(h,Vo(N1(e,t),n))}function PM(e,t,i,n,a,c){let h;Ah(t,n,a,c).length>0?h=n-ca(n,a):h=t;let d=n,f=IM(e,t,i,n,a,c);return Yo(T1(e,h,i,d,f==="C",a).length,Vo(f,c))}function HM(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=N1(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 IM(e,t,i,n,a,c){let h;return Ah(i,n,a,c).length>0?h=n-ca(n,a):h=t,e<i&&h<=n||e>=i&&h<n?"C":"D"}function N1(e,t){return e>t?"A":"B"}function T1(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 Vo(e,t){let i=t?"O":"[";return te.ESC+i+e}function Yo(e,t){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=t;return i}var FM=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 y0(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 gm=50,UM=15,KM=50,$M=500,WM=" ",VM=new RegExp(WM,"g"),Lp=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 de),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new de),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new de),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new FM(this._bufferService),this._activeSelectionMode=0,this._register(gt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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(VM," ")).join(j1?`\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())),D_&&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=y0(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=M_(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,-gm),gm),t/=gm,t/Math.abs(t)+Math.round(t*(UM-1)))}shouldForceSelection(e){return xh?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(),KM)}_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&&!(xh&&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<$M&&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=BM(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,p=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],E=e[0];c.getWidth(k)===0&&(g++,k--),c.getWidth(E)===2&&(v++,E++);let L=c.getString(E).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(;E<c.length&&f+1<h.length&&!this._isCharWordSeparator(c.loadCell(E+1,this._workCell));){c.loadCell(E+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(v++,E++):D>1&&(S+=D-1,f+=D-1),f++,E++}}f++;let x=d+p-g+b,w=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 E=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(E){let L=this._bufferService.cols-E.start;x-=L,w+=L}}}if(n&&x+w===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 E=this._getWordAt([0,e[1]+1],!1,!1,!0);E&&(w+=E.length)}}return{start:x,length:w}}}_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=y0(i,this._bufferService.cols)}};Lp=jt([pe(3,ys),pe(4,fa),pe(5,k_),pe(6,bs),pe(7,yr),pe(8,vr)],Lp);var b0=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={}}},S0=class{constructor(){this._color=new b0,this._css=new b0}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"),Do=yt.toColor("#000000"),x0=yt.toColor("#ffffff"),w0=Do,ko={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},YM=Pn,zp=class extends Ie{constructor(e){super(),this._optionsService=e,this._contrastCache=new S0,this._halfContrastCache=new S0,this._onChangeColors=this._register(new de),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pn,background:Do,cursor:x0,cursorAccent:w0,selectionForeground:void 0,selectionBackgroundTransparent:ko,selectionBackgroundOpaque:pt.blend(Do,ko),selectionInactiveBackgroundTransparent:ko,selectionInactiveBackgroundOpaque:pt.blend(Do,ko),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,Do),t.cursor=pt.blend(t.background,ut(e.cursor,x0)),t.cursorAccent=pt.blend(t.background,ut(e.cursorAccent,w0)),t.selectionBackgroundTransparent=ut(e.selectionBackground,ko),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,_0):void 0,t.selectionForeground===_0&&(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,YM),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()}}};zp=jt([pe(0,bs)],zp);function ut(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var GM=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)}},QM=class{constructor(){this._services=new GM,this._services.set(j_,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=UA(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)}},ZM={trace:0,debug:1,info:2,warn:3,error:4,off:5},XM="xterm.js: ",qp=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=ZM[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?"":XM)+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)}};qp=jt([pe(0,bs)],qp);var C0=class extends Ie{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new de),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new de),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new de),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 oc),$u=0,vm=2,Bo=class O1{constructor(t,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let a=i||hi.fromCharData([0,Gw,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 $u=t*ze,i.content=this._data[$u+0],i.fg=this._data[$u+1],i.bg=this._data[$u+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*vm<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*vm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*vm<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 O1(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 p=0;p<ze;p++)this._data[(n+f)*ze+p]=h[(i+f)*ze+p];h[(i+f)*ze+2]&268435456&&(this._extendedAttrs[n+f]=t._extendedAttrs[i+f])}else for(let f=0;f<a;f++){for(let p=0;p<ze;p++)this._data[(n+f)*ze+p]=h[(i+f)*ze+p];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 p=parseInt(d[f],10);p>=i&&(this._combined[p-i+n]=t._combined[p])}}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 p=0;p<f.length;++p)a.push(i);i+=h>>22||1}return a&&a.push(i),c}};function JM(e,t,i,n,a,c){let h=[];for(let d=0;d<e.length-1;d++){let f=d,p=e.get(++f);if(!p.isWrapped)continue;let g=[e.get(d)];for(;f<e.length&&p.isWrapped;)g.push(p),p=e.get(++f);if(!c&&n>=d&&n<f){d+=g.length-1;continue}let v=0,b=Go(g,v,t),S=1,x=0;for(;S<g.length;){let k=Go(g,S,t),E=k-x,L=i-b,D=Math.min(E,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 w=0;for(let k=g.length-1;k>0&&(k>v||g[k].getTrimmedLength()===0);k--)w++;w>0&&(h.push(d+g.length-w),h.push(w)),d+=g.length-1}return h}function eD(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 tD(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 sD(e,t,i){let n=[],a=e.map((f,p)=>Go(e,p,t)).reduce((f,p)=>f+p),c=0,h=0,d=0;for(;d<a;){if(a-d<i){n.push(a-d);break}c+=i;let f=Go(e,h,t);c>f&&(c-=f,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let g=p?i-1:i;n.push(g),d+=g}return n}function Go(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 A1=class R1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=R1._nextId++,this._onDispose=this.register(new de),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}};A1._nextId=1;var iD=A1,Ut={},Hn=Ut.B;Ut[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ut.A={"#":"£"};Ut.B=void 0;Ut[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ut.C=Ut[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ut.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ut.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ut.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ut.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ut.E=Ut[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ut.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ut.H=Ut[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ut["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var j0=4294967295,k0=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,Gw,1,0]),this._whitespaceCell=hi.fromCharData([0,fn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new wh,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new C0(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 yh),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 yh),this._whitespaceCell}getBlankLine(e,t){return new Bo(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>j0?j0: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 C0(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 Bo(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 Bo(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=JM(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Lt),i);if(n.length>0){let a=eD(this.lines,n);tD(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 Bo(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 p=f[f.length-1].getTrimmedLength(),g=sD(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,w=g[x];w===0&&(x--,w=g[x]);let k=f.length-v-1,E=p;for(;k>=0;){let D=Math.min(E,w);if(f[x]===void 0)break;if(f[x].copyCellsFrom(f[k],E-D,w-D,D,!0),w-=D,w===0&&(x--,w=g[x]),E-=D,E===0){k--;let M=Math.max(k,0);E=Go(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 w=0;w<this.lines.length;w++)d.push(this.lines.get(w));let f=this.lines.length,p=f-1,g=0,v=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let b=0;for(let w=Math.min(this.lines.maxLength-1,f+c-1);w>=0;w--)if(v&&v.start>p+b){for(let k=v.newLines.length-1;k>=0;k--)this.lines.set(w--,v.newLines[k]);w++,h.push({index:p+1,amount:v.newLines.length}),b+=v.newLines.length,v=a[++g]}else this.lines.set(w,d[p--]);let S=0;for(let w=h.length-1;w>=0;w--)h[w].index+=S,this.lines.onInsertEmitter.fire(h[w]),S+=h[w].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 iD(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)}},rD=class extends Ie{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new de),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 k0(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new k0(!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)}},M1=2,D1=1,Pp=class extends Ie{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,M1),this.rows=Math.max(e.rawOptions.rows||0,D1),this.buffers=this._register(new rD(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))}};Pp=jt([pe(0,bs)],Pp);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:xh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},nD=["normal","bold","100","200","300","400","500","600","700","800","900"],aD=class extends Ie{constructor(e){super(),this._onOptionChange=this._register(new de),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]),!lD(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=nD.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 lD(e){return e==="block"||e==="underline"||e==="bar"}function Lo(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]&&Lo(e[n],t-1);return i}var E0=Object.freeze({insertMode:!1}),N0=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Hp=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 de),this.onData=this._onData.event,this._onUserInput=this._register(new de),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new de),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Lo(E0),this.decPrivateModes=Lo(N0)}reset(){this.modes=Lo(E0),this.decPrivateModes=Lo(N0)}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))}};Hp=jt([pe(0,ys),pe(1,e1),pe(2,bs)],Hp);var T0={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 ym(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 bm=String.fromCharCode,O0={DEFAULT:e=>{let t=[ym(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${bm(t[0])}${bm(t[1])}${bm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ym(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${ym(e,!0)};${e.x};${e.y}${t}`}},Ip=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 de),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(T0))this.addProtocol(n,T0[n]);for(let n of Object.keys(O0))this.addEncoding(n,O0[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)}};Ip=jt([pe(0,ys),pe(1,fa),pe(2,bs)],Ip);var Sm=[[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]],oD=[[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 cD(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 uD=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<Sm.length;++e)It.fill(0,Sm[e][0],Sm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?It[e]:cD(e,oD)?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=Fn.extractWidth(t);a===0?n=!1:a>i&&(i=a)}return Fn.createPropertyValue(0,i,n)}},Fn=class rh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new de,this.onChange=this._onChange.event;let t=new uD;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 p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:i+=this.wcwidth(p)}let d=this.charProperties(h,n),f=rh.extractWidth(d);rh.extractShouldJoin(d)&&(f-=rh.extractWidth(n)),i+=f,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},hD=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 A0(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 Eo=2147483647,dD=256,B1=class Fp{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>dD)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 Fp;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 Fp(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>Eo?Eo: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>Eo?Eo: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,Eo):t}},No=[],fD=class{constructor(){this._state=0,this._active=No,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=No}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=No,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||No,!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",Nh(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=No,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+=Nh(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}},To=[],mD=class{constructor(){this._handlers=Object.create(null),this._active=To,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=To}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=To,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||To,!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",Nh(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=To,this._ident=0}},zo=new B1;zo.addParam(0);var R0=class{constructor(e){this._handler=e,this._data="",this._params=zo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():zo,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Nh(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=zo,this._data="",this._hitLimit=!1,i));return this._params=zo,this._data="",this._hitLimit=!1,t}},pD=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,_D=(function(){let e=new pD(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})(),gD=class extends Ie{constructor(e=_D){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 B1,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 fD),this._dcsParser=this._register(new mD),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],p=f?f.length-1:-1;for(;p>=0&&(h=f[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,f,p,a,d),h;p<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}}},vD=/^([\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})$/,yD=/^[\da-f]+$/;function M0(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=vD.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),yD.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 xm(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 bD(e,t=16){let[i,n,a]=e;return`rgb:${xm(i,t)}/${xm(n,t)}/${xm(a,t)}`}var SD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vr=131072,D0=10;function B0(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 L0=5e3,z0=0,xD=class extends Ie{constructor(e,t,i,n,a,c,h,d,f=new gD){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 IA,this._utf8Decoder=new FA,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Lt.clone(),this._eraseAttrDataInternal=Lt.clone(),this._onRequestBell=this._register(new de),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new de),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new de),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new de),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new de),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new de),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new de),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new de),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new de),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new de),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 Up(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:g.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,g,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:g,data:v})}),this._parser.setDcsHandlerFallback((p,g,v)=>{g==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:g,payload:v})}),this._parser.setPrintHandler((p,g,v)=>this.print(p,g,v)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!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(sh.IND,()=>this.index()),this._parser.setExecuteHandler(sh.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(sh.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ks(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Ks(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Ks(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Ks(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Ks(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Ks(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Ks(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Ks(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Ks(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Ks(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Ks(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Ks(p=>this.restoreCursorColor(p))),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 p in Ut)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new R0((p,g)=>this.requestStatusString(p,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"),L0))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${L0} 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,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.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 p=c;p<e.length;p+=Vr){let g=p+Vr<e.length?p+Vr:e.length,v=typeof e=="string"?this._stringDecoder.decode(e.substring(p,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,g),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,v))return this._preserveStack(n,a,v,p),this._logSlowResolvingAsync(i),i}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,p))return this._preserveStack(n,a,p,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,p=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 E=c[String.fromCharCode(n)];E&&(n=E.charCodeAt(0))}let x=this._unicodeService.charProperties(n,b);a=Fn.extractWidth(x);let w=Fn.extractShouldJoin(x),k=w?Fn.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 E=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 Bo&&v.copyCellsFrom(E,L,0,k,!1);L<d;)E.setCellFromCodepoint(L++,0,1,g)}else if(this._activeBuffer.x=d-1,a===2)continue}if(w&&this._activeBuffer.x){let E=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-E,n,a);for(let L=a-k;--L>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(p&&(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=>B0(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new R0(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=Fn.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 p=0;p<c.length;){let g=c.codePointAt(p)||0;h[d++]=g,p+=g>65535?2:1}let f=d;for(let p=1;p<i;++p)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){(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.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:p,alt:g}=d,v=this._optionsService.rawOptions,b=(w,k)=>(h.triggerDataEvent(`${te.ESC}[${t?"":"?"}${w};${k}$y`),!0),S=w=>w?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(p===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|=oc.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(!B0(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>D0&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>D0&&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(q0(c))if(a==="?")t.push({type:0,index:c});else{let h=M0(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=M0(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]);q0(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(SD[e[0]],Ut[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)}},Up=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&&(z0=e,e=t,t=z0),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Up=jt([pe(0,ys)],Up);function q0(e){return 0<=e&&e<256}var wD=5e7,P0=12,CD=50,jD=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 de),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>wD)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>=P0?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>=P0)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>CD&&(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()}},Kp=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)))}};Kp=jt([pe(0,ys)],Kp);var H0=!1,kD=class extends Ie{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new xl),this._onBinary=this._register(new de),this.onBinary=this._onBinary.event,this._onData=this._register(new de),this.onData=this._onData.event,this._onLineFeed=this._register(new de),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new de),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new de),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new de),this._instantiationService=new QM,this.optionsService=this._register(new aD(e)),this._instantiationService.setService(bs,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Pp)),this._instantiationService.setService(ys,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(qp)),this._instantiationService.setService(e1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Hp)),this._instantiationService.setService(fa,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ip)),this._instantiationService.setService(Jw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Fn)),this._instantiationService.setService(WA,this.unicodeService),this._charsetService=this._instantiationService.createInstance(hD),this._instantiationService.setService($A,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Kp),this._instantiationService.setService(t1,this._oscLinkService),this._inputHandler=this._register(new xD(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 jD((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 de),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&&!H0&&(this._logService.warn("writeSync is unreliable and will be removed soon."),H0=!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,M1),t=Math.max(t,D1),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(A0.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(A0(this._bufferService),!1))),this._windowsWrappingHeuristics.value=gt(()=>{for(let t of e)t.dispose()})}}},ED={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 ND(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=ED[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,p=String.fromCharCode(f);e.shiftKey&&(p=p.toUpperCase()),a.key=te.ESC+p}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,TD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new wh,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new wh,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}},wm=0,I0=0,OD=class extends Ie{constructor(){super(),this._decorations=new TD(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new de),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new de),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 AD(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=>{wm=a.options.x??0,I0=wm+(a.options.width??1),e>=wm&&e<I0&&(!i||(a.options.layer??"bottom")===i)&&n(a)})}},AD=class extends pn{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new de),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new de),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()}},RD=1e3,MD=class{constructor(e,t=RD){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)}},F0=20,Ch=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 MD(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<F0+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
86
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===F0+1&&(this._liveRegion.textContent+=up.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(),p=this._rowElements[a];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",f),p.setAttribute("aria-setsize",n),this._alignRowWidth(p))}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:p})=>{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=p<b.length?b[p]: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})`}};Ch=jt([pe(1,j_),pe(2,vr),pe(3,yr)],Ch);var $p=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 de),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new de),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 p,g;if(this._isMouseOut)return;let f=d==null?void 0:d.map(v=>({link:v}));(p=this._activeProviderReplies)==null||p.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 p=d;p<=f;p++){if(i.has(p)){a.splice(c--,1);break}i.add(p)}}}}_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&&DD(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}}};$p=jt([pe(1,k_),pe(2,yr),pe(3,ys),pe(4,i1)],$p);function DD(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 BD=class extends kD{constructor(e={}){super(e),this._linkifier=this._register(new xl),this.browser=x1,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new xl),this._onCursorMove=this._register(new de),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new de),this.onKey=this._onKey.event,this._onRender=this._register(new de),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new de),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new de),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new de),this.onBell=this._onBell.event,this._onFocus=this._register(new de),this._onBlur=this._register(new de),this._onA11yCharEmitter=this._register(new de),this._onA11yTabEmitter=this._register(new de),this._onWillOpen=this._register(new de),this._setup(),this._decorationService=this._instantiationService.createInstance(OD),this._instantiationService.setService(cc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(CM),this._instantiationService.setService(i1,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(dp)),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};${bD(a)}${b1.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(Ch,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()&&PA(t,this._selectionService)}));let e=t=>HA(t,this.textarea,this.coreService,this.optionsService);this._register(Te(this.textarea,"paste",e)),this._register(Te(this.element,"paste",e)),w1?this._register(Te(this.element,"mousedown",t=>{t.button===2&&XS(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Te(this.element,"contextmenu",t=>{XS(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),D_&&this._register(Te(this.element,"auxclick",t=>{t.button===1&&Yw(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",cp.get()),k1||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(xM,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(Mp,this._document,this._helperContainer),this._instantiationService.setService(Th,this._charSizeService),this._themeService=this._instantiationService.createInstance(zp),this._instantiationService.setService(kl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Sh),this._instantiationService.setService(s1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Bp,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(Op,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Dp),this._instantiationService.setService(k_,this._mouseService);let n=this._linkifier.value=this._register(this._instantiationService.createInstance($p,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(Np,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(Lp,this.element,this.screenElement,n)),this._instantiationService.setService(YA,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(Tp,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(Ch,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",c=>this._handleScreenReaderModeOptionChange(c))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",c=>{!this._overviewRulerRenderer&&c&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(bh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Rp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(c){var p,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=(p=e._renderService)==null?void 0:p.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,p,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,(p=(f=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:f.cell)==null?void 0:p.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){Vw(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=ND(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)&&(LD(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 LD(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var zD=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)}},qD=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)}},U0=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 qD(t)}getNullCell(){return new hi}},PD=class extends Ie{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new de),this.onBufferChange=this._onBufferChange.event,this._normal=new U0(this._core.buffers.normal,"normal"),this._alternate=new U0(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)}},HD=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)}},ID=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}},FD=["cols","rows"],Ni=0,UD=class extends Ie{constructor(e){super(),this._core=this._register(new BD(e)),this._addonManager=this._register(new zD),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(FD.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 HD(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new ID(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 PD(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 cp.get()},set promptLabel(e){cp.set(e)},get tooMuchOutput(){return up.get()},set tooMuchOutput(e){up.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]},OB={2:2,8:8,10:10,12:12},AB={"gutter/line":44},KD={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]},$D=['"JetBrainsMono Nerd Font"','"MesloLGS NF"','"FiraCode Nerd Font"','"Hack Nerd Font"','"JetBrains Mono"',"ui-monospace","SFMono-Regular","Menlo","monospace"].join(", "),WD=13,VD=20/13;function Rh({sessionId:e,connect:t=Cw,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),p=j.useRef(a);return f.current=n,p.current=a,j.useEffect(()=>{var L;const g=c.current;if(!g)return;const v=new UD({convertEol:!1,cursorBlink:!d.current,disableStdin:d.current,scrollback:1e4,theme:KD,fontFamily:$D,fontSize:WD,lineHeight:VD}),b=new DA;v.loadAddon(b),v.open(g),h.current=v,Cm(b),d.current||v.focus();const S=t(e,{onMessage(D){var M;D.type==="attached"?(Cm(b),v.reset(),v.write(D.snapshot)):D.type==="output"&&v.write(D.data),(M=p.current)==null||M.call(p,D)}}),x=v.onData(D=>{d.current||S.send({type:"input",data:D})}),w=v.onResize(({cols:D,rows:M})=>S.send({type:"resize",cols:D,rows:M})),k=()=>Cm(b);window.addEventListener("resize",k);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(k);return E==null||E.observe(g),(L=f.current)==null||L.call(f,v),()=>{E==null||E.disconnect(),window.removeEventListener("resize",k),x.dispose(),w.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 Cm(e){try{e.fit()}catch{}}function YD({scope:e,dock:t,onAskAgent:i}){var d,f,p;const[n,a]=j.useState("run"),c=Kw(e),h=OA(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(Wu,{label:"Setup",active:n==="setup",dot:jm((d=c.data)==null?void 0:d.setup),onClick:()=>a("setup")}),o.jsx(Wu,{label:"Run",active:n==="run",dot:jm((f=c.data)==null?void 0:f.run),onClick:()=>a("run")}),o.jsx(Wu,{label:"Testes",active:n==="test",dot:jm((p=c.data)==null?void 0:p.test),onClick:()=>a("test")}),o.jsx(Wu,{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(GD,{status:c.data,actions:h}),(n==="setup"||n==="test")&&o.jsx(QD,{phase:n,status:c.data,actions:h})]})]}),n==="terminal"?o.jsx(t3,{scope:e}):c.isError?o.jsx("div",{className:"dock__idle",role:"alert",children:o.jsx("span",{children:c.error.message})}):o.jsx(ZD,{scope:e,phase:n,status:c.data,actions:h,onAskAgent:i})]}):o.jsx(s3,{scope:e,status:c.data,onOpen:t.toggle})}function jm(e){return e!=null&&e.last?e.last.running?"run":e.last.exitCode===0?"ok":"fail":null}function Wu({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 GD({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(fe,{size:"sm",glyph:o.jsx("span",{className:"stopglyph",children:"⏹"}),disabled:t.stop.isPending,onClick:()=>t.stop.mutate("run"),children:"parar"})]}):o.jsx(fe,{size:"sm",variant:"primary",disabled:(e==null?void 0:e.run.command)===null||t.start.isPending,onClick:()=>t.start.mutate("run"),children:"▶ rodar"})}function QD({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(fe,{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(fe,{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 ZD({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(JD,{scope:e,status:i,onAskAgent:a});if(!i.trusted)return o.jsx(e3,{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(Ge,{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 · ",vh(h.startedAt)]}):o.jsxs(as,{dot:!0,children:["saiu ",h.exitCode??"?"," · ",vh(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(Rh,{sessionId:h.sessionId,readOnly:!h.running},h.sessionId)})]})}function XD(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 JD({scope:e,status:t,onAskAgent:i}){const n=We(),c=(Ee({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,XD(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(fe,{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(fe,{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 e3({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(fe,{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 t3({scope:e}){const t=We(),i=w_(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(fe,{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(Rh,{sessionId:h.id},h.id)})]})}function s3({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 i3({scope:e,onClose:t,onResize:i,dock:n,onAskAgent:a}){var z,le,oe,q;const c=We(),[h,d]=j.useState("files"),[f,p]=j.useState("worktree"),g=b_(),v=VO(e),b=Dw(e,"worktree"),S=v_("pending"),x=YO(e),w=e.scopeType==="worktree"?e.scopeId:null,k=qO(w,{panelOpen:!0}),E=IO(e),L=FO(x.projectId),D=k.data??null,M=(D==null?void 0:D.pull)??null,$=D!==null&&w!==null&&!L.isDismissed,Z=h==="pr"&&M===null?"files":h,K=new Map((((z=b.data)==null?void 0:z.files)??[]).map(P=>[P.path,P.status])),X=g.activeTab===null?null:g.fileFor(g.activeTab);return o.jsxs(NA,{tab:Z,onSelectTab:d,changeCount:((le=b.data)==null?void 0:le.files.length)??null,proposalCount:((oe=S.data)==null?void 0:oe.length)??null,prBar:$&&w!==null?o.jsx(SA,{status:D,worktreeId:w,onRetry:()=>E.mutate(),onDismiss:L.dismiss}):void 0,prBadge:M===null?null:cA(M),actions:Z==="files"?o.jsx(hA,{edits:v}):void 0,onReload:()=>{c.invalidateQueries({queryKey:["files"]}),c.invalidateQueries({queryKey:["changes"]}),E.mutate()},onClose:t,onResize:i,dock:o.jsx(YD,{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 ${((q=b.data)==null?void 0:q.baseBranch)??"base"}`:void 0,children:[Z==="files"&&o.jsx(uA,{scope:e,openPath:(X==null?void 0:X.view)==="file"?X.path:null,onOpen:P=>g.open({path:P,view:"file"}),statusOf:P=>K.get(P),edits:v}),Z==="changes"&&o.jsx(GO,{scope:e,openPath:(X==null?void 0:X.view)==="patch"?X.path:null,onOpenPatch:(P,re)=>g.open({path:P,view:"patch",ref:re}),onRefChange:p}),Z==="pr"&&M!==null&&o.jsx(lA,{pull:M,readAt:(D==null?void 0:D.readAt)??null}),Z==="memory"&&o.jsx(Tw,{workspaceId:x.workspaceId,projectId:x.projectId})]})}const r3=new Set(["no-binary","no-auth","unsupported-host"]);function n3(e,t){const i=t.toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60).replace(/-+$/g,"");return i===""?String(e):`${e}-${i}`}function a3({projectId:e,projectName:t,open:i,onClose:n,onCreated:a,onOpenExisting:c,hasCommits:h=null}){var q,P,re,se,A,U,G,be;const d=We(),[f,p]=j.useState(""),[g,v]=j.useState("default"),[b,S]=j.useState(null),x=Ee({queryKey:SE(e),queryFn:()=>ie.worktree.branches.query({projectId:e}),enabled:i}),w=Ee({queryKey:xE(e),queryFn:()=>ie.worktree.hostOrigins.query({projectId:e}),enabled:i}),k=He({mutationFn:()=>ie.worktree.create.mutate({projectId:e,name:f.trim(),from:c3(X,b)}),onSuccess:async ae=>{await d.invalidateQueries({queryKey:sa(e)}),a(ae.id),E()}});function E(){p(""),v("default"),S(null),k.reset(),n()}const L=ae=>{ae.preventDefault(),f.trim()!==""&&k.mutate()},D=h===!1,M=`worktree-name-${e}`,$=((q=w.data)==null?void 0:q.issues.failure)??((P=w.data)==null?void 0:P.pulls.failure)??null,Z=w.data!==void 0&&(w.data.host===null||r3.has(($==null?void 0:$.kind)??"")),K=Z?["default","branch"]:["default","branch","issue","pr"],X=K.includes(g)?g:"default",z=b!==null&&b.kind===X?b:null,le=(z==null?void 0:z.kind)==="pr"&&((re=w.data)==null?void 0:re.pulls.items.some(ae=>ae.number===z.number&&!ae.onDisk))===!0?z.number:null;function oe(ae,T){S(ae),p(T)}return o.jsx(mw,{open:i,title:"Nova worktree",where:o.jsxs(o.Fragment,{children:["em",o.jsx(Ge,{tone:"project",children:"■"}),o.jsx("b",{children:t})]}),onClose:E,footer:o.jsxs(o.Fragment,{children:[o.jsx(fe,{type:"submit",form:$0,variant:"primary",disabled:k.isPending||f.trim()===""||D,children:k.isPending?"criando…":"criar"}),o.jsx(fe,{variant:"ghost",onClick:E,children:D?"fechar":"cancelar"})]}),children:o.jsxs("form",{id:$0,onSubmit:L,children:[!D&&o.jsxs("div",{className:"origin",children:[o.jsx("div",{className:"seg",role:"group","aria-label":"de onde cortar",children:K.map(ae=>o.jsx("button",{type:"button",className:"seg__btn","aria-pressed":X===ae,onClick:()=>{v(ae),S(null)},children:u3[ae]},ae))}),X==="default"?o.jsx("div",{className:"origin__list",children:o.jsx("div",{className:"origin__empty",children:o.jsx("p",{children:"corta da branch default deste projeto — sem ir à rede"})})}):X==="branch"?o.jsx(km,{busy:x.isPending,label:"branches",empty:"nenhuma branch além da default",failure:x.isError?x.error.message:null,children:(x.data??[]).map(ae=>{const T=ae.worktreePath!==null;return o.jsxs("button",{type:"button",role:"option",className:`orow${T?" orow--held":""}`,"aria-selected":(b==null?void 0:b.kind)==="branch"&&b.ref===ae.name,onClick:()=>{if(T){ae.worktreeId!==null&&((c??a)(ae.worktreeId),E());return}oe({kind:"branch",ref:ae.name,local:ae.local},ae.name)},children:[o.jsx("span",{className:"orow__ref",children:ae.name}),o.jsx("span",{className:"orow__t"}),o.jsx("span",{className:"orow__note",children:T?ae.worktreeName===null?"no checkout principal":`em ${ae.worktreeName}`:l3(ae)}),T&&ae.worktreeId!==null&&o.jsx("span",{className:"orow__go",children:"→"})]},ae.name)})}):X==="issue"?o.jsx(km,{busy:w.isPending,label:"issues abertas",empty:"nenhuma issue aberta neste repositório",failure:K0(w,((se=w.data)==null?void 0:se.issues.failure)??null),children:(((A=w.data)==null?void 0:A.issues.items)??[]).map(ae=>o.jsxs("button",{type:"button",role:"option",className:"orow","aria-selected":(b==null?void 0:b.kind)==="issue"&&b.number===ae.number,onClick:()=>oe({kind:"issue",number:ae.number},n3(ae.number,ae.title)),children:[o.jsxs("span",{className:"orow__n",children:["#",ae.number]}),o.jsx("span",{className:"orow__t",children:ae.title})]},ae.number))}):o.jsx(km,{busy:w.isPending,label:"pull requests abertas",empty:"nenhuma PR aberta neste repositório",failure:K0(w,((U=w.data)==null?void 0:U.pulls.failure)??null),children:(((G=w.data)==null?void 0:G.pulls.items)??[]).map(ae=>o.jsxs("button",{type:"button",role:"option",className:"orow","aria-selected":(b==null?void 0:b.kind)==="pr"&&b.number===ae.number,onClick:()=>oe({kind:"pr",number:ae.number},ae.headRefName),children:[o.jsxs("span",{className:"orow__n",children:["#",ae.number]}),o.jsx("span",{className:"orow__t",children:ae.title}),!ae.onDisk&&o.jsx("span",{className:"orow__note orow__note--wait",children:ae.crossRepository?"de um fork · busca ao criar":"busca ao criar"})]},ae.number))}),Z&&o.jsxs("p",{className:"origin__off",children:[o.jsx(Ge,{tone:"off",children:"◌"}),$===null||((be=w.data)==null?void 0:be.host)===null?"este projeto não tem remoto — issues e PRs vêm de um host":$.kind==="no-auth"?"o gh não está autenticado — rode gh auth login no terminal":$.message]})]}),o.jsx(Xt,{id:M,label:"Nome da worktree",error:k.isError?k.error.message:void 0,children:o.jsx(cs,{id:M,"data-modal-focus":"",value:f,onChange:ae=>p(ae.target.value),placeholder:"teste-prd",invalid:k.isError})}),D?o.jsx(Ae,{tone:"warning",children:"este repositório ainda não tem nenhum commit — faça o primeiro para poder cortar worktrees"}):z===null?o.jsx("p",{className:"create-worktree__hint",children:"A branch tem o mesmo nome. Barra vira diretório aninhado."}):o.jsxs("p",{className:`create-worktree__hint fname${z.kind==="branch"&&z.local?" fname--branch":""}`,children:[o.jsx("span",{className:"fname__g",children:z.kind==="branch"&&z.local?"⑂":"◈"}),o.jsx("span",{children:o3(z)})]}),k.isPending&&o.jsx(Ae,{tone:"info",children:le===null?"copiando o checkout — em repositório grande isto leva alguns segundos":`buscando a branch da PR #${String(le)} — isto vai à rede`})]})})}function km({busy:e,label:t,empty:i,failure:n,children:a}){return o.jsx("div",{className:"origin__list",role:"listbox","aria-label":t,"aria-busy":e||void 0,children:e?o.jsxs("div",{className:"origin__skel","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{})]}):n!==null?o.jsx("div",{className:"origin__empty",children:o.jsx("p",{children:n})}):a.length===0?o.jsx("div",{className:"origin__empty",children:o.jsx("p",{children:i})}):a})}function l3(e){return[e.local?"local":null,...e.remotes].filter(t=>t!==null).join(" · ")}function o3(e){switch(e.kind){case"branch":return e.local?`na branch ${e.ref}, que já existe — o nome é só desta worktree`:`da branch publicada ${e.ref}, rastreando ela`;case"issue":return`da issue #${e.number} — corta da default, como sempre`;case"pr":return`da head da PR #${e.number}, que já está no disco`}}function c3(e,t){if(!(e==="default"||t===null)&&e===t.kind)return t}function K0(e,t){var i;return e.isError?((i=e.error)==null?void 0:i.message)??"não deu para ler as origens deste projeto":t===null?null:t.message}const u3={default:"default",branch:"branch",issue:"issue",pr:"PR"},$0="create-worktree",L1=j.createContext(null);function h3({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(L1.Provider,{value:a,children:e})}function B_(){return j.useContext(L1)??{isWaiting:()=>!1,countIn:()=>0,setWaiting:()=>{}}}function d3(e){const t=w_(e),i=We(),[n,a]=j.useState(null),[c,h]=j.useState(new Set),[d,f]=j.useState(new Set),p=j.useMemo(()=>t.data??[],[t.data]),g=j.useMemo(()=>{const k=p.filter(L=>!d.has(L.id)&&(L.state==="running"||c.has(L.id))),E=new Map;return k.map(L=>{const D=L.agentName??"shell",M=(E.get(D)??0)+1;return E.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}:{}}})},[p,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 E=p.find(L=>L.id===k);E===void 0||E.state==="running"||(f(L=>new Set(L).add(k)),h(L=>{const D=new Set(L);return D.delete(k),D}))},[p]),S=j.useCallback(k=>{f(E=>{const L=new Set(E);return L.delete(k),L}),h(E=>new Set(E).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)}}),w=j.useCallback(k=>x.mutate(k),[x]);return{tabs:g,activeId:n,select:v,close:b,reopen:S,resume:w,resuming:x.isPending?x.variables??null:null,sessions:t}}const f3=800;function W0(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 Vu(e,t){return e.scopeType===t.scopeType&&e.scopeId===t.scopeId&&e.path===t.path}function m3(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function p3(e){return e instanceof Error?e.message:String(e)}function V0(e){return e===void 0||e.kind!=="text"?null:e}function _3({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),p=j.useRef(0),g=j.useRef(null),v=j.useRef(!1),b=j.useRef(!1),S=j.useRef(null),x=j.useRef(null),w=j.useRef(!1),k=j.useRef([]),[E,L]=j.useState({kind:"clean"}),[D,M]=j.useState(!0),$=j.useRef(!0),Z=Au(e.scopeType,e.scopeId,t),K=Ee({queryKey:Z,queryFn:()=>{const V=n.getQueryData(Z);return!$.current&&V!==void 0?(w.current=!0,V):ie.files.read.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t})},refetchOnWindowFocus:D}),X=V0(K.data),z=j.useRef(!1);z.current=X===null||X.readOnly!==null;const le=j.useCallback(V=>{$.current=V,M(V)},[]),oe=j.useCallback(()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null)},[]),q=j.useCallback(V=>{S.current=V,L({kind:"stale",...V})},[]),P=j.useCallback(()=>!v.current&&(g.current===null||b.current),[]),re=j.useCallback(()=>{if(!P())return;const V=k.current;if(V.length!==0){k.current=[];for(const he of V)he()}},[P]),se=j.useCallback(V=>{n.invalidateQueries({queryKey:["changes"]}),n.invalidateQueries({queryKey:o_(V.scopeType,V.scopeId,m3(V.path))})},[n]),A=j.useCallback(()=>{if(v.current||b.current)return;const V=g.current;V!==null&&(g.current=null,v.current=!0,L({kind:"saving"}),n.cancelQueries({queryKey:Au(V.target.scopeType,V.target.scopeId,V.target.path)}),ie.files.write.mutate({scopeType:V.target.scopeType,scopeId:V.target.scopeId,path:V.target.path,text:V.text,baseRevision:V.baseRevision}).then(he=>{var ge,Ne;if(!he.ok){if(!Vu(V.target,h.current))return;b.current=!0,oe(),q({revision:he.revision,changedAt:he.changedAt,base:((ge=c.current)==null?void 0:ge.text)??V.text,mine:((Ne=a.current)==null?void 0:Ne.getDoc())??V.text,disk:null}),ie.files.read.query(V.target).then(kt=>{const Xe=V0(kt),Rs=S.current;Xe===null||Rs===null||q({...Rs,disk:Xe})}).catch(()=>{});return}Vu(V.target,h.current)&&(c.current={text:V.text,revision:he.revision},f.current===V.version&&(p.current=V.version,le(!0)),L({kind:"saved",at:Date.now()})),g.current!==null&&Vu(g.current.target,V.target)&&(g.current={...g.current,baseRevision:he.revision}),se(V.target)}).catch(he=>{Vu(V.target,h.current)&&L({kind:"failed",why:p3(he)})}).finally(()=>{v.current=!1,A(),re()}))},[oe,se,n,re,le,q]),U=j.useCallback(()=>{oe();const V=a.current,he=c.current,ge=d.current;V===null||he===null||ge===null||f.current!==p.current&&(g.current={target:ge,text:V.getDoc(),baseRevision:he.revision,version:f.current},A())},[oe,A]),G=j.useCallback(()=>{if(b.current||(U(),P()))return Promise.resolve();const V=new Promise(he=>{k.current.push(he)});return KO(V),V},[P,U]),be=j.useCallback(()=>{if(f.current+=1,d.current=h.current,le(!1),b.current){const V=S.current,he=a.current;V!==null&&he!==null&&q({...V,mine:he.getDoc()});return}oe(),x.current=window.setTimeout(()=>{x.current=null,U()},f3)},[oe,U,le,q]),ae=j.useCallback(V=>{var he;if(V===null){G(),(he=a.current)==null||he.onChange(null),a.current=null;return}a.current=V,!z.current&&V.onChange(be)},[be,G]),T=j.useCallback(()=>{U()},[U]),W=j.useCallback(()=>{const V=S.current,he=d.current;if(V===null||he===null)return;S.current=null,b.current=!1,p.current=f.current,le(!0),L({kind:"clean"});const ge=Au(he.scopeType,he.scopeId,he.path);if(V.disk===null){n.invalidateQueries({queryKey:ge});return}n.setQueryData(ge,V.disk)},[n,le]),ne=j.useCallback(()=>{const V=S.current,he=a.current,ge=d.current;V===null||he===null||ge===null||(S.current=null,b.current=!1,g.current={target:ge,text:he.getDoc(),baseRevision:V.revision,version:f.current},A())},[A]);return j.useEffect(()=>{h.current={scopeType:e.scopeType,scopeId:e.scopeId,path:t},d.current=null,p.current=f.current,b.current=!1,S.current=null,c.current=null,le(!0),L({kind:"clean"})},[e.scopeType,e.scopeId,t,le]),j.useEffect(()=>{var V;X!==null&&$.current&&(c.current={text:X.text,revision:X.revision},(V=a.current)==null||V.setDoc(X.text))},[X]),j.useEffect(()=>{!D||!w.current||(w.current=!1,n.invalidateQueries({queryKey:Au(e.scopeType,e.scopeId,t)}))},[D,n,e.scopeType,e.scopeId,t]),j.useEffect(()=>{i||G()},[i,G]),j.useEffect(()=>{const V=()=>void G();return window.addEventListener("blur",V),()=>window.removeEventListener("blur",V)},[G]),j.useEffect(()=>oe,[oe]),{content:K,state:E,attach:ae,retry:T,reload:W,overwrite:ne}}const z1="lumem",g3={name:z1,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"]}}]},v3={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"},y3={typescript:()=>Ft(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>Ft(()=>import("./tsx-COt5Ahok.js"),[]),javascript:()=>Ft(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>Ft(()=>import("./jsx-g9-lgVsj.js"),[]),json:()=>Ft(()=>import("./json-Cp-IABpG.js"),[]),markdown:()=>Ft(()=>import("./markdown-Cvjx9yec.js"),[]),css:()=>Ft(()=>import("./css-CLj8gQPS.js"),[]),html:()=>Ft(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2])),yaml:()=>Ft(()=>import("./yaml-Buea-lGh.js"),[]),shellscript:()=>Ft(()=>import("./shellscript-Yzrsuije.js"),[]),python:()=>Ft(()=>import("./python-B6aJPvgy.js"),[]),sql:()=>Ft(()=>import("./sql-CRqJ_cUM.js"),[]),toml:()=>Ft(()=>import("./toml-vGWfd6FD.js"),[]),diff:()=>Ft(()=>import("./diff-D97Zzqfu.js"),[]),docker:()=>Ft(()=>import("./docker-BcOcwvcX.js"),[]),make:()=>Ft(()=>import("./make-CHLpvVh8.js"),[])},Y0={dockerfile:"docker",makefile:"make"};function b3(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(t in Y0)return Y0[t];const i=t.lastIndexOf(".");return i<=0?null:v3[t.slice(i+1)]??null}let Yu=null,Em=null;const G0=new Set;async function S3(){if(Yu!==null)return Yu;Em??(Em=x3());try{return Yu=await Em,Yu}catch(e){throw Em=null,e}}async function x3(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([Ft(()=>import("./core-rofTMs1b.js"),[]),Ft(()=>import("./engine-javascript-DBd1bXLz.js"),[])]);return e({themes:[g3],langs:[],engine:t()})}async function w3(e){try{const t=await S3();if(!G0.has(e)){const i=y3[e];if(i===void 0)return null;const n=await i();await t.loadLanguage(n.default),G0.add(e)}return t}catch{return null}}function q1({path:e,headExtra:t,wrap:i,onToggleWrap:n,onClose:a,footLeft:c,footRight:h,children:d}){const f=e.lastIndexOf("/"),p=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:p}),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 Q0={"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 C3({scope:e,path:t,active:i,onClose:n}){const[a,c]=j.useState(!0),h=_3({scope:e,path:t,active:i}),d=h.content,f=b3(t),p=d.data,g=p===void 0?null:p.kind==="binary"?"binário":p.kind==="too-large"?"acima do teto":p.readOnly===null?null:Q0[p.readOnly].chip,v=g===null&&(h.state.kind==="failed"||h.state.kind==="stale");return o.jsx(q1,{path:t,onClose:n,wrap:a,onToggleWrap:()=>c(S=>!S),footLeft:g===null?o.jsx(E3,{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||p===void 0?void 0:p.kind==="text"?`${Ro(p.bytes)} · ${p.lines} linhas · ${f??"texto"}`:Ro(p.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:[Ro(d.data.bytes)," passa do teto de ",Ro(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:Q0[S].why})]}),h.state.kind==="stale"&&o.jsx(j3,{conflict:h.state,onReload:h.reload,onOverwrite:h.overwrite}),o.jsx(N3,{path:t,text:d.data.text,language:f,readOnly:S!==null,wrap:a,onReady:h.attach})]})}}function j3({conflict:e,onReload:t,onOverwrite:i}){const n=W0(e.base,e.mine),a=e.disk===null?null:W0(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(P1,{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 ",k3(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 k3(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 E3({state:e,onRetry:t}){return e.kind==="clean"?null:e.kind==="saving"?o.jsx(Gu,{tone:"saving",children:"salvando…"}):e.kind==="saved"?o.jsxs(Gu,{tone:"saved",children:["salvo há ",o.jsx(P1,{at:e.at})]}):e.kind==="failed"?o.jsxs(o.Fragment,{children:[o.jsx(Gu,{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(Gu,{tone:"stale",children:"mudou no disco"}),o.jsx("span",{className:"save__why",children:"o autosave parou até você escolher"})]})}function Gu({tone:e,children:t}){return o.jsxs("span",{className:`save save--${e}`,children:[o.jsx("span",{className:"save__dot","aria-hidden":"true"}),t]})}function P1({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 N3({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),p=j.useRef({text:t,wrap:a});return j.useEffect(()=>{p.current.text=t},[t]),j.useEffect(()=>{var g;p.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 Ft(async()=>{const{mountEditor:b}=await import("./codemirror-setup-u52h1pHp.js");return{mountEditor:b}},[]).then(({mountEditor:b})=>{v&&(d.current=b(g,{doc:p.current.text,wrap:p.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 w3(i).then(b=>{var S;!g||b===null||(f.current={highlighter:b,language:i,theme:z1},(S=d.current)==null||S.setHighlight(f.current))}),()=>{g=!1}},[i]),o.jsx("div",{className:"cmhost",ref:h,"data-testid":"editor"})}function T3({scopeType:e,scopeId:t,onCreated:i}){const n=We(),a=S_(),c=Ee({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)}}),p=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(f_,{label:"nova sessão",children:[o.jsx(hn,{glyph:o.jsx(Ge,{tone:"shell",children:"●"}),hint:"shell de login",onSelect:()=>{a.close(),d.mutate()},children:"shell"}),g.map(v=>o.jsx(hn,{glyph:o.jsx(Ge,{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))]})})]}),p&&o.jsx("div",{className:"new-session__error",children:o.jsx(Ae,{tone:"danger",children:p.message})})]})}function H1({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 O3(e,t){const i=Z0(e??""),n=Z0(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 p of h)f.push({kind:"del",text:p});for(const p of d)f.push({kind:"add",text:p});return c>0&&f.push({kind:"context",text:`… ${c} linha(s) abaixo, sem mudança`}),f}function Z0(e){if(e==="")return[];const t=e.split(`
92
+ `);return t.at(-1)===""&&t.pop(),t}function A3({scope:e,path:t,changeRef:i,onClose:n}){const[a,c]=j.useState(!0),h=Ee({queryKey:kE(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?[]:R3(h.data.patch),f=d.filter(g=>g.kind==="hunk").length;return o.jsx(q1,{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:p()});function p(){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(H1,{lines:d,wrap:a})}}function R3(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 I1(){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 M3(e){return e.reduce(F1,I1())}function F1(e,{at:t,event:i}){var n,a,c,h,d;switch(i.type){case"message":return X0(i.role==="user"?D3(e):e,i.role,{kind:"message",messageId:i.messageId,text:i.text});case"thought":return X0(e,"agent",{kind:"thought",messageId:i.messageId,text:i.text});case"tool_call":return Qu(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 J0(e,i.toolCallId,f=>({...f,...i.status?{status:i.status}:{},...i.title?{title:i.title}:{},...i.locations?{locations:i.locations}:{},...i.content?z3(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},p=Wp(e.turns,g=>g.kind==="permission"?null:g);return Qu({...e,turns:p,pendingPermission:f,turnTally:{...e.turnTally,asked:e.turnTally.asked+1}},"agent",{kind:"permission",request:f})}case"permission_resolved":{const f=L3(e.turns,i.requestId);if(!f)return{...e,orphanUpdates:e.orphanUpdates+1};const p=i.outcome==="cancelled"?null:i.outcome.optionId,g=p===null?null:f.options.find(S=>S.optionId===p)??null,v=Wp(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?J0(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(p=>p.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:Qu(f,"agent",{kind:"meta",text:B3(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 Qu(e,"agent",{kind:"note",text:`evento não reconhecido: ${i.sessionUpdate}`})}}function X0(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 D3(e){return{...e,turns:Wp(e.turns,t=>t.kind==="meta"&&t.text.startsWith(U1)?null:t)}}const U1="◈ ";function B3({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`${U1}${i} pelo Lumem, ${n} neste turno`}function Qu(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 J0(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 Wp(e,t){return e.map(i=>({...i,blocks:i.blocks.flatMap(n=>{const a=t(n);return a?[a]:[]})}))}function L3(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 z3(e,t){let i=0,n=0,a=!1;for(const c of t){if(c.type!=="diff")continue;a=!0;const h=ex(c.oldText??""),d=ex(c.newText),f=q3(h,d);i+=d.length-f,n+=h.length-f}return{content:t,added:a?i:e.added,removed:a?n:e.removed}}function ex(e){if(e==="")return[];const t=e.split(`
94
+ `);return t.at(-1)===""&&t.pop(),t}function q3(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 P3=1;function H3(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${sT}?${iT}=${encodeURIComponent(e)}`}function I3(e,t,i={}){const{createWebSocket:n=h=>new WebSocket(h),origin:a=window.location}=i,c=n(H3(e,a));return c.onmessage=h=>{var f;const d=ST(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===rT})},c.onerror=()=>{},{send(h){var f,p;const d=vT.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!==P3){(p=t.onSendRejected)==null||p.call(t,"o socket não está aberto");return}c.send(xT(d.data))},close(){c.onmessage=null,c.onclose=null,c.onopen=null,c.close()}}}const F3={auto:"auto",plan:"plan",bypassPermissions:"bypass"};function U3({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=K3(h,d);return o.jsxs("span",{className:"config",children:[o.jsxs("button",{type:"button",className:`pill${$3(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(p=>o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":p.value===d,className:`slash__row focus-ring${p.value===d?" slash__row--on":""}${p.value==="bypassPermissions"?" slash__row--danger":""}`,onClick:()=>{c(null),n(h.id,p.value)},children:[o.jsx("span",{className:"slash__cmd",children:p.value}),o.jsx("span",{className:"slash__desc",children:p.description??""})]},p.value))})]},h.id)})})}function K3(e,t){var i;return((i=e.choices.find(n=>n.value===t))==null?void 0:i.name)||t||e.name}function $3(e,t){if(e.id==="mode"){const i=F3[t];return i?` pill--${i}`:""}return e.id==="model"?" pill--model":""}function W3({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 Vp=[{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"}],K1=e=>Vp.find(t=>t.value===e)??Vp[0];function V3({mode:e,disabled:t=!1,readOnly:i=!1,open:n=!1,onToggle:a}){const c=K1(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 Y3({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."]})]}),Vp.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:K1(t).label.toLowerCase()})]})]})}const Yp=/^\s{0,3}(?:```|~~~)\s*([\w+-]*)\s*$/,$1=/^\s{0,3}(#{1,6})\s+(.*)$/,W1=/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/,Gp=/^\s{0,3}>\s?(.*)$/,L_=/^(\s*)[-*+]\s+(.*)$/,jh=/^(\s*)\d{1,9}[.)]\s+(.*)$/,kh=/^\s{0,3}\|(.+)\|\s*$/,G3=/^\s{0,3}\|[\s:|-]+\|\s*$/;function Q3(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=Yp.exec(a);if(c){const f=c[1]===""?null:c[1],p=[];for(n+=1;n<t.length&&!Yp.test(t[n]);)p.push(t[n]),n+=1;n<t.length&&(n+=1),i.push({kind:"code",language:f,text:p.join(`
97
+ `)});continue}const h=$1.exec(a);if(h){i.push({kind:"heading",level:h[1].length,content:Li(h[2].trim())}),n+=1;continue}if(W1.test(a)){i.push({kind:"rule"}),n+=1;continue}if(Gp.test(a)){const f=[];for(;n<t.length;){const p=Gp.exec(t[n]);if(!p)break;f.push(p[1]),n+=1}i.push({kind:"quote",content:Li(f.join(`
98
+ `))});continue}if(kh.test(a)&&n+1<t.length&&G3.test(t[n+1])){const f=tx(a);n+=2;const p=[];for(;n<t.length&&kh.test(t[n]);)p.push(tx(t[n])),n+=1;i.push({kind:"table",header:f,rows:p});continue}if(L_.test(a)||jh.test(a)){const f=jh.test(a),{items:p,next:g}=X3(t,n,f);i.push({kind:"list",ordered:f,items:p}),n=g;continue}const d=[t[n].trim()];for(n+=1;n<t.length;){const f=t[n];if(f.trim()===""||Z3(f))break;d.push(f.trim()),n+=1}i.push({kind:"paragraph",content:Li(d.join(`
99
+ `))})}return i}function Z3(e){return Yp.test(e)||$1.test(e)||W1.test(e)||Gp.test(e)||L_.test(e)||jh.test(e)||kh.test(e)}function tx(e){return kh.exec(e)[1].split("|").map(i=>Li(i.trim()))}function X3(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&&sx(e[a+1])!==null){a+=1;continue}break}const d=sx(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 sx(e){const t=L_.exec(e);if(t)return{indent:t[1].length,text:t[2],ordered:!1};const i=jh.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 p=/^~~(?=\S)([\s\S]*?\S)~~/.exec(c);if(p){n(),t.push({kind:"strike",children:Li(p[1])}),a+=p[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 V1({text:e,streaming:t=!1}){const i=Q3(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:J3(c,t&&h===n?a:null)},h))})}function J3(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(Y1,{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 Y1({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(Y1,{item:n,ordered:t},a))})]})}function Di({nodes:e}){return o.jsx(o.Fragment,{children:e.map((t,i)=>o.jsx(j.Fragment,{children:e5(t)},i))})}function e5(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 t5({role:e,children:t}){return o.jsxs("div",{className:`turn turn--${e}`,children:[o.jsx("span",{className:"turn__g",children:o.jsx(Ge,{tone:e==="agent"?"agent":"none",children:e==="agent"?"◆":"❯"})}),o.jsx("div",{className:"turn__b",children:t})]})}function s5({text:e,streaming:t=!1}){return o.jsx("div",{className:"msg",children:o.jsx(V1,{text:e,streaming:t})})}function i5({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(V1,{text:e,streaming:n})})]})}function r5({request:e,onRespond:t}){const[i,n]=j.useState(!1),a=j.useRef(null),c=Nm(e.options,"allow_once")??e.options[0],h=Nm(e.options,"reject_once"),d=Nm(e.options,"reject_always"),f=e.options.filter(g=>g!==c&&g!==h&&g!==d),p=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(),p(c.optionId);return}v.key==="Escape"&&h&&(v.preventDefault(),p(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(fe,{ref:a,variant:"primary",size:"sm",disabled:i,onClick:()=>p(c.optionId),children:[c.name," ",o.jsx("span",{className:"kbd",children:"⏎"})]}),f.map(g=>o.jsx(fe,{variant:"ghost",size:"sm",disabled:i,onClick:()=>p(g.optionId),children:g.name},g.optionId)),h&&o.jsxs(fe,{variant:"ghost",size:"sm",disabled:i,onClick:()=>p(h.optionId),children:[h.name," ",o.jsx("span",{className:"kbd",children:"esc"})]}),d&&o.jsx(fe,{variant:"danger",size:"sm",disabled:i,onClick:()=>p(d.optionId),children:d.name})]})]})]})}function Nm(e,t){return e.find(i=>i.kind===t)}const G1="lumem.coach.permission";function n5(){try{return window.localStorage.getItem(G1)==="seen"}catch{return!1}}function a5(){try{window.localStorage.setItem(G1,"seen")}catch{}}function l5(e){const[t,i]=j.useState(n5),[n,a]=j.useState(!1),c=j.useCallback(()=>a(!0),[]),h=j.useCallback(()=>{a5(),i(!0)},[]);return{show:e&&!t&&!n,dismiss:c,never:h}}const o5={pending:"○",in_progress:"◐",completed:"✓"},c5={pending:"pending",in_progress:"active",completed:"done"};function u5({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--${c5[d.status]}`,children:[o.jsx("span",{className:"plan__mark","aria-hidden":"true",children:o5[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 h5(e){const t=/^\/([^\s]*)$/.exec(e);return t?t[1]:null}function Q1(e,t){if(t==="")return e;const i=t.toLowerCase();return e.filter(n=>n.name.toLowerCase().startsWith(i))}function d5({commands:e,query:t,onChoose:i,onDismiss:n}){const a=Q1(e,t),[c,h]=j.useState(0);j.useEffect(()=>h(0),[t,e]),j.useEffect(()=>{const f=p=>{if(a.length!==0){if(p.key==="ArrowDown"){p.preventDefault(),h(g=>(g+1)%a.length);return}if(p.key==="ArrowUp"){p.preventDefault(),h(g=>(g-1+a.length)%a.length);return}if(p.key==="Enter"&&!p.metaKey&&!p.ctrlKey){p.preventDefault(),p.stopPropagation(),d(a[c]);return}p.key==="Escape"&&(p.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,p)=>o.jsxs("button",{type:"button",role:"option","aria-selected":p===c,className:`slash__row focus-ring${p===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 f5={read:"▤",search:"▤",edit:"▣",delete:"▣",move:"▣",execute:"❯",fetch:"↓",think:"◈",switch_mode:"◈",other:"◈"},m5={pending:"na fila",running:"rodando",ok:"ok",failed:"falhou",cancelled:"interrompido"},p5=12;function _5({call:e,terminals:t=[],defaultOpen:i=!1}){const[n,a]=j.useState(i),c=g5(e),h=y5(e),d=v5(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:f5[e.kind]}),o.jsx("span",{className:"tc__verb",children:e.name??S5(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:b5(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:x5(e.elapsedMs)}),o.jsxs("span",{className:"tc__st",children:[o.jsx("span",{className:"tc__dot","aria-hidden":"true"}),m5[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(Rh,{sessionId:d.ptySessionId})})}),n&&!d&&c&&o.jsxs("div",{className:"tc__body",children:[c.kind==="diff"?o.jsx(H1,{lines:c.lines,wrap:!1}):o.jsx("div",{className:"out",children:c.lines.map((f,p)=>o.jsx("span",{className:"l",children:f},p))}),c.hidden>0&&o.jsxs("div",{className:"tc__more",children:["▾ mostrar as ",c.hidden.toLocaleString("pt-BR")," linhas"]})]})]})}function g5(e){const t=e.content.find(c=>c.type==="diff");if((t==null?void 0:t.type)==="diff")return{kind:"diff",lines:O3(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-p5));return{kind:"text",lines:a,hidden:n.length-a.length}}function v5(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 y5(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 b5(e){const t=e.name;return t&&e.title.startsWith(`${t} `)?e.title.slice(t.length+1):e.title}function S5(e){const t=e.indexOf(" ");return t===-1?e:e.slice(0,t)}function x5(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 Z1={conversation:I1(),session:null,failure:null};function w5(e,t){if(t.kind==="reset")return Z1;const i=t.message;switch(i.type){case"attached":return{conversation:{...M3(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:F1(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 C5=e=>ie.session.transcript.query({id:e});function j5({sessionId:e,agentName:t="agente",live:i=!0,connect:n=I3,load:a=C5,onResume:c,resuming:h=!1,active:d=!0,initialPrompt:f}){const[p,g]=j.useReducer(w5,Z1),[v,b]=j.useState(""),[S,x]=j.useState(!1),[w,k]=j.useState(!1),[E,L]=j.useState(new Set),D=j.useRef(null),M=B_(),{conversation:$,session:Z,failure:K}=p,X=$.pendingPermission,z=l5(X!==null),le=!i||(Z==null?void 0:Z.state)==="exited";j.useEffect(()=>{if(g({kind:"reset"}),!i){let W=!0;return a(e).then(ne=>{W&&g({kind:"message",message:ne})}).catch(ne=>{W&&g({kind:"message",message:{type:"error",code:"INTERNAL",message:ne instanceof Error?ne.message:"não deu para ler a conversa"}})}),()=>{W=!1}}const T=n(e,{onMessage:W=>g({kind:"message",message:W})});return D.current=T,()=>{D.current=null,T.close()}},[e,i,n,a]),j.useEffect(()=>{M.setWaiting(e,X!==null)},[M,e,X]);const oe=j.useRef(M.setWaiting);oe.current=M.setWaiting,j.useEffect(()=>()=>{oe.current(e,!1)},[e]);const q=Z!==null,P=!$.streaming&&q;j.useEffect(()=>{P||(k(!1),x(!1))},[P]);const re=j.useCallback(()=>{var W;const T=v.trim();T===""||X!==null||le||!q||((W=D.current)==null||W.send({type:"prompt",text:T}),b(""))},[q,v,X,le]),se=j.useRef(!1);j.useEffect(()=>{var T;f===void 0||se.current||!q||le||(se.current=!0,(T=D.current)==null||T.send({type:"prompt",text:f}))},[q,f,le]);const A=h5(v),U=j.useCallback(()=>{var T;(T=D.current)==null||T.send({type:"cancel"})},[]),G=$.streaming,be=A!==null&&Q1($.commands,A).length>0;j.useEffect(()=>{if(!d||le||!G||X!==null||be)return;const T=W=>{W.key==="Escape"&&(W.preventDefault(),U())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[d,le,G,X,be,U]);const ae=O5([$.turns.length,$.streaming]);return o.jsxs("div",{className:"conv",children:[o.jsxs("div",{className:"conv__head",children:[o.jsxs("span",{className:"conv__who",children:[o.jsx(Ge,{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"}),le&&c&&o.jsx(fe,{variant:"primary",size:"sm",disabled:h,onClick:c,children:h?"retomando…":"↻ retomar"}),$.streaming&&!le&&o.jsxs(fe,{variant:"ghost",size:"sm",onClick:U,children:["■ interromper ",o.jsx("span",{className:"kbd",children:"esc"})]})]}),o.jsxs("div",{className:"conv__scroll",ref:ae,children:[(K==null?void 0:K.fatal)&&o.jsxs("div",{className:"fail",children:[o.jsxs("div",{className:"fail__title",children:[o.jsx("span",{"aria-hidden":"true",children:"⚠"}),K.remedy?"o adaptador ACP não subiu":"a sessão não está disponível"]}),o.jsx("div",{className:"fail__body",children:K.message}),K.remedy&&o.jsx("div",{className:"fail__cmd",children:K.remedy})]}),K&&!K.fatal&&o.jsx(Ae,{tone:"danger",children:K.message}),$.turns.length===0&&!K&&o.jsx(T5,{ready:Z!==null}),$.plan&&o.jsx(u5,{entries:$.plan}),$.turns.map((T,W)=>T.role==="resumed"?o.jsx(k5,{at:T.at??null},W):o.jsx(t5,{role:T.role,children:T.blocks.map((ne,V)=>o.jsx(N5,{block:ne,terminals:$.terminals,streaming:$.streaming&&W===$.turns.length-1&&V===T.blocks.length-1,openThoughts:E,onToggleThought:he=>L(ge=>{const Ne=new Set(ge);return Ne.has(he)?Ne.delete(he):Ne.add(he),Ne}),onRespond:he=>{var Ne;const ge=$.pendingPermission;ge&&((Ne=D.current)==null||Ne.send({type:"permission_response",requestId:ge.requestId,optionId:he}))},coach:z},V))},W)),le&&Z&&o.jsx("div",{className:"daysep",children:"conversa encerrada"})]}),$.usage&&o.jsx(OO,{usage:$.usage}),o.jsxs("div",{className:"composer",children:[S&&P&&o.jsx(W3,{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(d5,{commands:$.commands,query:A,onChoose:b,onDismiss:()=>b("")}),o.jsx("textarea",{className:`composer__in${v===""?" composer__in--empty":""}`,value:v,disabled:X!==null||le,placeholder:le?"esta conversa terminou — retome para continuar":X!==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:[$.modeOwner==="lumem"&&o.jsxs("span",{className:"config",children:[o.jsx(V3,{mode:$.lumemMode,disabled:!P,readOnly:le,open:w,onToggle:()=>k(!w)}),w&&P&&o.jsx(Y3,{mode:$.lumemMode,workspaceDefault:$.lumemModeDefault,onSwitch:T=>{var W;k(!1),(W=D.current)==null||W.send({type:"set_lumem_mode",mode:T})},onFreeRequested:()=>{k(!1),x(!0)}})]}),o.jsx(U3,{mode:$.mode,options:$.configOptions,disabled:$.streaming||le,onSwitch:(T,W)=>{var ne;return(ne=D.current)==null?void 0:ne.send({type:"set_config",optionId:T,value:W})}}),o.jsx("span",{className:"spacer"}),o.jsxs(fe,{variant:"primary",size:"sm",disabled:v.trim()===""||X!==null||le||!q,onClick:re,children:["enviar ",o.jsx("span",{className:"kbd",children:"⏎"})]})]})]})]})]})}function k5({at:e}){return o.jsxs("div",{className:"daysep",children:["retomada",e===null?"":` · ${E5(e)}`]})}function E5(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}function N5({block:e,terminals:t,streaming:i,openThoughts:n,onToggleThought:a,onRespond:c,coach:h}){switch(e.kind){case"message":return o.jsx(s5,{text:e.text,streaming:i});case"thought":return o.jsx(i5,{text:e.text,open:n.has(e.messageId),onToggle:()=>a(e.messageId),streaming:i});case"tool":return o.jsx(_5,{call:e.call,terminals:t});case"permission":return o.jsxs(o.Fragment,{children:[o.jsx(r5,{request:e.request,onRespond:c}),h.show&&o.jsxs(g2,{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 T5({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 O5(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 A5=.2,R5=.8;function X1({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 p=(v=a.current)==null?void 0:v.getBoundingClientRect();if(p===void 0||p.width===0||!Number.isFinite(f))return;const g=(f-p.left)/p.width;n(Math.min(R5,Math.max(A5,g)))},[]);return j.useEffect(()=>{if(!c)return;const f=g=>{g.preventDefault(),d(g.clientX)},p=()=>h(!1);return window.addEventListener("pointermove",f),window.addEventListener("pointerup",p),()=>{window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",p)}},[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 M5({tab:e,scope:t,cwd:i,active:n,viewer:a=null,onResume:c,resuming:h=!1,onStarted:d,initialPrompt:f}){const p=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(X1,{viewer:a,children:[!g&&o.jsxs("div",{className:"term-head",children:[o.jsx(Ge,{tone:p?"agent":"shell",children:p?"◆":"●"}),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(D5,{tab:e,scope:t,onStarted:d}),g?o.jsx(j5,{sessionId:e.sessionId,agentName:e.label,live:e.state==="running",active:n,...c?{onResume:c}:{},resuming:h,initialPrompt:f},e.sessionId):o.jsx(Rh,{sessionId:e.sessionId,readOnly:v},e.sessionId)]})})}function D5({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(fe,{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 Qp({scope:e,crumb:t,checkout:i,context:n,filesPanel:a,cwd:c,openSessionId:h,initialPrompt:d}){const f=We(),{tabs:p,activeId:g,select:v,close:b,reopen:S,resume:x,resuming:w,sessions:k}=d3(e),E=B_(),L=b_(),D=j.useRef(!1);j.useEffect(()=>{h===void 0||D.current||p.some(z=>z.sessionId===h)&&(D.current=!0,v(h))},[h,p,v]);const M=$S(e.scopeType,e.scopeId,g);j.useEffect(()=>{L.setActiveTab(M)},[M,L.setActiveTab]);function $(z){const le=$S(e.scopeType,e.scopeId,z),oe=L.fileFor(le);return oe===null?null:oe.view==="patch"?o.jsx(A3,{scope:e,path:oe.path,changeRef:oe.ref??"worktree",onClose:()=>L.close(le)}):o.jsx(C3,{scope:e,path:oe.path,active:z===g,onClose:()=>L.close(le)})}const Z=He({mutationFn:z=>ie.session.close.mutate({id:z}),onSuccess:()=>f.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)})}),K=k.data??[],X=new Set(p.map(z=>z.sessionId));return o.jsxs("section",{className:"scope",children:[o.jsx("div",{className:"scope__crumb",children:t}),o.jsx(y2,{label:`sessões de ${c}`,lead:o.jsx(bS,{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(T3,{scopeType:e.scopeType,scopeId:e.scopeId,onCreated:z=>v(z)}),end:o.jsx(b2,{label:"a coluna de arquivos",pressed:a.open,onToggle:a.toggle,children:"▤"}),children:p.map(z=>o.jsx(bS,{label:z.label,ordinal:z.ordinal,glyph:o.jsx(Ge,{tone:z.kind==="agent"?"agent":"shell",children:z.kind==="agent"?"◆":"●"}),state:E.isWaiting(z.sessionId)?"asking":z.state==="running"?"running":z.exitCode===0?"exited":"failed",note:z.state==="running"?void 0:"registro",active:g===z.sessionId,onSelect:()=>v(z.sessionId),onClose:()=>{z.state==="running"?Z.mutate(z.sessionId):b(z.sessionId)}},z.sessionId))}),o.jsx("div",{className:"pane",role:"tabpanel",hidden:g!==null,"aria-label":i.name,children:o.jsxs(X1,{viewer:$(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(Eh,{title:"Sessões",count:K.length===0?0:`${K.length} · ${K.filter(z=>z.state==="running").length} rodando`}),K.length===0?o.jsx("p",{className:"detail__hint",children:"nenhuma sessão aberta aqui"}):K.map(z=>{const le=z.state==="running",oe=X.has(z.id);return o.jsx(fw,{name:z.agentName??z.scriptName??"shell",glyph:o.jsx(Ge,{tone:z.kind==="agent"?"agent":"shell",children:z.kind==="agent"?"◆":z.kind==="script"?"▶":"●"}),detail:z.command,state:le?{label:"running",tone:"running"}:{label:`exited (${z.exitCode??"?"})`,tone:z.exitCode===0?"exited":"failed"},age:vh(z.createdAt),onSelect:oe?()=>v(z.id):void 0,action:oe?void 0:o.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>S(z.id),children:z.transport==="acp"?"reabrir":"ver registro"})},z.id)})]})]})}),p.map(z=>o.jsx(M5,{tab:z,scope:e,cwd:c,onStarted:v,active:g===z.sessionId,viewer:$(z.sessionId),...z.transport==="acp"?{onResume:()=>x(z.sessionId)}:{},resuming:w===z.sessionId,initialPrompt:(d==null?void 0:d.sessionId)===z.sessionId?d.text:void 0},z.sessionId))]})}function B5({projectId:e}){var h,d;const[t,i]=j.useState("7d"),n=GT(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(Eh,{title:"Consumo por worktree",aside:o.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo do projeto",children:Nw.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(Mw,{rows:a})]})}function L5(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 z5({projectId:e,workspaceId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onSelectWorktree:c,openSessionId:h,initialPrompt:d,filesPanel:f}){var $,Z;const p=We(),g={scopeType:"project",scopeId:e},v=Ee({queryKey:["project","get",e],queryFn:()=>ie.project.get.query({id:e})}),b=Ee({queryKey:sa(e),queryFn:()=>ie.worktree.listByProject.query({projectId:e}),enabled:(($=v.data)==null?void 0:$.available)===!0}),[S,x]=j.useState(!1),w=He({mutationFn:()=>ie.project.remove.mutate({id:e}),onSuccess:async()=>{await p.invalidateQueries({queryKey:ta(t)}),n()}});if(S&&v.data)return o.jsx(q5,{project:v.data,worktrees:((Z=b.data)==null?void 0:Z.length)??null,pending:w.isPending,error:w.isError?w.error.message:null,onCancel:()=>{x(!1),w.reset()},onConfirm:()=>w.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:E,defaultBranch:L,available:D}=v.data,M=b.data??[];return o.jsx(Qp,{scope:g,cwd:E,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(Ge,{tone:D?"project":"off",children:"▭"})},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Ge,{tone:D?"project":"off",children:"▭"})," local"]}),o.jsx("span",{className:"detail__kind",children:"checkout do projeto"}),o.jsx("span",{className:"actions__spacer"}),o.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>x(!0),disabled:w.isPending,children:w.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 ",E,"."]})," As ações sobre ele ficam bloqueadas até que ele volte; o registro continua aqui."]})}),w.isError&&o.jsx("div",{className:"detail__banner",children:o.jsx(Ae,{tone:"danger",children:w.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(dw,{path:E})},...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(B5,{projectId:e}),o.jsxs("section",{className:"section",children:[o.jsx(Eh,{title:"Worktrees deste projeto",count:M.length}),M.length===0?o.jsx("p",{className:"detail__hint",children:"nenhuma worktree ainda"}):M.map(K=>o.jsx(fw,{name:K.name,glyph:o.jsx(Ge,{tone:K.state==="missing"?"warn":"worktree",children:K.state==="missing"?"⚠":"◇"}),detail:K.path,state:K.state==="missing"?{label:"ausente",tone:"missing"}:void 0,onSelect:()=>c(K.id)},K.id))]})]})]})})}function q5({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:L5(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(fe,{variant:e.managed?"danger":"primary",onClick:c,disabled:i,children:i?"removendo…":e.managed?"apagar":"remover"}),o.jsx(fe,{variant:"ghost",onClick:a,children:"cancelar"})]})]})})}function P5(e){const t=Ee({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(H5,{project:a,...e},a.id))}}function H5({project:e,expansion:t,selection:i,onSelect:n,onCreateWorktree:a}){const c=t.isExpanded(e.id),h={scopeType:"project",scopeId:e.id},d=Ee({queryKey:sa(e.id),queryFn:()=>ie.worktree.listByProject.query({projectId:e.id}),enabled:e.available}),f=d.data??[],p=[h,...f.map(S=>({scopeType:"worktree",scopeId:S.id}))],g=C_(p),v=PO(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(m_,{depth:0,emphasis:!0,label:e.name,glyph:o.jsx(Ge,{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(I5,{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($5,{projectId:e.id,worktree:S,mark:b(S.id),selected:i.scopeType==="worktree"&&i.scopeId===S.id,onSelect:n},S.id))]})]})}function I5({projectId:e,selected:t,onSelect:i}){const n={scopeType:"project",scopeId:e},a=C_([n]);return o.jsx("div",{"data-kind":"local","data-state":"active",children:o.jsx(m_,{depth:1,label:"local",glyph:o.jsx(Ge,{tone:"project",children:"▭"}),meta:o.jsx(J1,{scope:n}),count:a>0?a:void 0,selected:t,onSelect:i})})}function J1({scope:e}){var a,c,h;const t=Kw(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 F5(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 U5({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 ",K5[e.verdict]]})]})}const K5={ready:"pronta para merge",blocked:"bloqueada",pending:"verificando",draft:"em rascunho",merged:"mesclada",closed:"fechada sem merge"};function $5({projectId:e,worktree:t,mark:i,selected:n,onSelect:a}){const c=t.state==="missing",h={scopeType:"worktree",scopeId:t.id},d=C_([h]),f=B_(),p=w_(h),g=f.countIn((p.data??[]).map(v=>v.id));return o.jsx("div",{"data-kind":"worktree","data-state":t.state,children:o.jsx(m_,{depth:1,label:t.name,glyph:o.jsx(Ge,{tone:c?"warn":"worktree",children:c?"⚠":"◇"}),muted:c,meta:i!==void 0&&!c?o.jsx(U5,{mark:i}):F5(t)??(c?void 0:o.jsx(J1,{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 W5({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("")}}),p=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(fe,{size:"sm",variant:"ghost","aria-label":"novo workspace",title:"novo workspace",onClick:()=>c(!0),children:"+"})]}),a&&o.jsxs("form",{className:"ws__form",onSubmit:p,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(fe,{type:"submit",variant:"primary",size:"sm",disabled:f.isPending||h.trim()==="",children:"criar"}),o.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>c(!1),children:"cancelar"})]})]}),f.isError&&o.jsx("p",{className:"ws__error",role:"alert",children:f.error.message})]})}function V5({worktreeId:e,projectId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onOpenProject:c,openSessionId:h,initialPrompt:d,filesPanel:f}){var P,re;const p=We(),[g,v]=j.useState(!1),b=Ee({queryKey:l_(e),queryFn:()=>ie.worktree.getDetail.query({id:e})}),S=(P=p.getQueryData(sa(t)))==null?void 0:P.find(se=>se.id===e),x=Ee({queryKey:["project","get",t],queryFn:()=>ie.project.get.query({id:t})}),w=He({mutationFn:se=>ie.worktree.remove.mutate({id:e,force:se}),onSuccess:async()=>{await p.invalidateQueries({queryKey:sa(t)}),n()}}),k={scopeType:"worktree",scopeId:e};function E(se,A){var U;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:((U=x.data)==null?void 0:U.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(Qp,{scope:k,cwd:S.path,openSessionId:h,initialPrompt:d,filesPanel:f,crumb:E(S.name,S.branch),checkout:{name:S.name,glyph:o.jsx(Ge,{tone:"worktree",children:"◇"})},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Ge,{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:$,present:Z,status:K,aheadBehind:X,baseBranch:z,createdAt:le}=b.data,oe=!Z||$==="missing",q=oe||K===null||K.clean?null:K.changedFiles;return o.jsx(Qp,{scope:k,cwd:M,openSessionId:h,initialPrompt:d,filesPanel:f,crumb:E(L,D),checkout:{name:L,glyph:o.jsx(Ge,{tone:oe?"warn":"worktree",children:oe?"⚠":"◇"}),...q===null?{}:{state:"dirty",stateLabel:`árvore suja · ${q} ${q===1?"arquivo":"arquivos"}`}},context:o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"detail__title",children:[o.jsxs("h2",{children:[o.jsx(Ge,{tone:oe?"warn":"worktree",children:oe?"⚠":"◇"})," ",L]}),o.jsx("span",{className:"detail__kind",children:oe?"worktree ausente":"worktree"}),o.jsx("span",{className:"actions__spacer"}),o.jsx(fe,{variant:"ghost",size:"sm",onClick:()=>w.mutate(!1,{onError:()=>v(!0)}),disabled:w.isPending,children:w.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(fe,{size:"sm",variant:"danger",onClick:()=>w.mutate(!0),disabled:w.isPending,children:"remover mesmo assim"}),o.jsx(fe,{size:"sm",variant:"ghost",onClick:()=>v(!1),children:"cancelar"})]}),children:((re=w.error)==null?void 0:re.message)??"isso descarta as alterações não salvas."})}),oe&&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 ",z]})]})},...oe?[]:[{label:`em relação a ${z}`,value:X===null?"desconhecido":o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"ahead",children:["↑",X.ahead]})," ",o.jsxs("span",{className:"behind",children:["↓",X.behind]})," ",o.jsxs("span",{className:"dim",children:[X.ahead," à frente, ",X.behind," atrás"]})]})}],{label:"estado",value:oe?o.jsx(as,{tone:"missing",dot:!0,children:"ausente do disco"}):K===null?o.jsx(as,{children:"estado desconhecido"}):K.clean?o.jsx(as,{tone:"clean",dot:!0,children:"limpa"}):o.jsxs(as,{tone:"dirty",dot:!0,children:["suja · ",K.changedFiles," ",K.changedFiles===1?"arquivo":"arquivos"]})},{label:"caminho",value:o.jsx(dw,{path:M})},...oe?[]:[{label:"criada",value:o.jsx("span",{className:"dim",children:vh(le)})}]]}),o.jsx("p",{className:"detail__hint",children:"a branch não é apagada"})]})})}const Zp="lumem.activeWorkspaceId";function Y5(){try{return window.localStorage.getItem(Zp)}catch{return null}}function ix(e){try{e===null?window.localStorage.removeItem(Zp):window.localStorage.setItem(Zp,e)}catch{}}function G5(e){var c,h;const[t,i]=j.useState(Y5),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&&ix(n)},[n,t]);const a=j.useCallback(d=>{ix(d),i(d)},[]);return{activeId:n,select:a}}function Q5(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 Z5(){const e=We();j.useEffect(()=>{const t=ie.events.onChange.subscribe(void 0,{onData:i=>Q5(e,i),onConnectionStateChange:i=>{i.state==="idle"&&e.invalidateQueries()}});return()=>t.unsubscribe()},[e])}const eC="lumem.runDock",tC=96;function X5(e=window.innerHeight){return z_(Math.round(e/2),e)}function J5(e=window.innerHeight){return Math.max(tC,e-160)}const rx=640;function z_(e,t=window.innerHeight){return Math.min(J5(t),Math.max(tC,Math.round(e)))}function eB(){const e={open:!0,height:X5()};try{const t=window.localStorage.getItem(eC);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"?z_(a):e.height}}catch{return e}}function nx(e){try{window.localStorage.setItem(eC,JSON.stringify(e))}catch{}}function tB(e,t){return{...e,toggle:()=>{!e.open&&t.width<rx&&t.setWidth(rx),e.toggle()}}}function sB(){const[e,t]=j.useState(eB),[i,n]=j.useState(!1),a=j.useCallback(d=>{t(f=>{const p={...f,height:z_(d)};return nx(p),p})},[]),c=j.useCallback(()=>{t(d=>{const f={...d,open:!d.open};return nx(f),f})},[]);j.useEffect(()=>{if(!i)return;const d=p=>{p.preventDefault(),a(window.innerHeight-p.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 sC="lumem.collapsedNodes";function iB(){try{const e=window.localStorage.getItem(sC);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 ax(e){try{window.localStorage.setItem(sC,JSON.stringify([...e]))}catch{}}function rB(){const[e,t]=j.useState(iB),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),ax(d),d})},[]),a=j.useCallback(c=>{t(h=>{if(!h.has(c))return h;const d=new Set(h);return d.delete(c),ax(d),d})},[]);return{isExpanded:i,toggle:n,expand:a}}function nB({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 aB({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 iC=["máquina","agente","workspace","projeto","tarefa"],lB={welcome:null,machine:0,agent:1,handshake:1,workspace:2,project:3,task:4,done:null};function rC(e){return lB[e]}function Nl(e){const t=rC(e);return t===null?null:`passo ${t+1} de ${iC.length}`}function vn({eyebrow:e,title:t,lede:i,narrow:n,children:a,primary:c,onSubmit:h,onBack:d,onSkip:f,extra:p,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(S2,{...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(fe,{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:"⏎"})]})]}),p,o.jsx("span",{className:"spacer"}),f!==void 0&&o.jsx(fe,{variant:"ghost",onClick:f,children:"pular este passo"}),d!==void 0&&o.jsx(fe,{variant:"ghost",onClick:d,children:"Voltar"}),g!==void 0&&o.jsx("span",{className:"hint",children:g})]}),children:a})})}const lx=["setup","agents"];function oB({onNext:e,onBack:t,onSkip:i}){var b;const n=We(),a=Ee({queryKey:lx,queryFn:()=>ie.setup.agents.query(),refetchOnWindowFocus:!1}),c=He({mutationFn:()=>ie.setup.installAdapter.mutate(),onSuccess:async()=>{await n.invalidateQueries({queryKey:lx})}}),h=(b=a.data)==null?void 0:b.adapters.find(S=>S.id===jT),d=h==null?void 0:h.adapter,f=(h==null?void 0:h.cli)??void 0,p=(h==null?void 0:h.apiKeyEnv)!==null&&(h==null?void 0:h.apiKeyEnv)!==void 0,g=(d==null?void 0:d.path)!=null,v=(d==null?void 0:d.version)!=null&&d.version!==il.pinnedVersion;return o.jsxs(vn,{eyebrow:Nl("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(Ko,{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(fe,{variant:"primary",size:"sm",disabled:c.isPending,onClick:()=>c.mutate(),children:c.isPending?"instalando…":"Instalar o adaptador"}),o.jsx(fe,{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(d_,{command:d.install})]})]}),v&&o.jsxs("span",{className:"field__help",children:["A cópia encontrada é a ",o.jsx("b",{children:d.version}),", e o Lumem fixa a"," ",o.jsx("b",{children:il.pinnedVersion})," — a versão que foi medida contra este daemon. O adaptador ",o.jsx("b",{children:"embute o próprio runtime"}),", então uma cópia velha responde a conversa mesmo com o ",o.jsx("code",{children:"claude"})," da sua máquina atualizado. Conectar o agente instala a versão fixa na pasta do Lumem."]}),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(Ko,{label:"credencial",children:o.jsx(Ys,{state:p?"ok":"warn",what:(h==null?void 0:h.apiKeyEnv)??il.apiKeyEnv[0]??"",value:p?"presente no ambiente do daemon — cobrança por token":"ausente — o adaptador vai usar a credencial local do Claude",status:p?"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 cB=["agentConfig","list"];function uB({result:e,skipped:t,onOpen:i,onReview:n}){var S,x,w;const[a,c,h,d,f]=Ux({queries:[{queryKey:mr,queryFn:()=>ie.workspace.list.query()},{queryKey:cB,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:l_(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}]}),p=(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=(w=f.data)==null?void 0:w.find(k=>k.kind==="agent"),b=[{label:"workspace",value:(p==null?void 0:p.name)??o.jsx(hB,{})},{label:"agente",value:g===void 0?o.jsx(Tm,{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(Tm,{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(Tm,{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(fe,{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 hB(){return o.jsx("span",{className:"dim",children:"lendo do daemon…"})}function Tm({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 dB=["setup","probe"],ox=["agentConfig","list"],cx="claude";function fB({onNext:e,onBack:t,onSkip:i}){const n=We(),a=Ee({queryKey:dB,queryFn:()=>ie.setup.probe.query(),refetchOnWindowFocus:!1,retry:!1}),c=Ee({queryKey:ox,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 p=(g=c.data)==null?void 0:g.find(b=>b.transport==="acp"&&b.command===h.command);return p!==void 0?p:ie.agentConfig.create.mutate({name:cx,command:h.command,args:[...h.args],transport:"acp",adapterVersion:((v=h.agentInfo)==null?void 0:v.version)??null})},onSuccess:async p=>{await n.invalidateQueries({queryKey:ox}),e({agentConfigId:p.id,agentName:p.name,...p.adapterVersion===null?{}:{adapterVersion:p.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(p=>p.name??p.id).join(", ")}`;return o.jsxs(vn,{eyebrow:`${Nl("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(fe,{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:cx})]}),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(Ko,{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(p=>p.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 nC=["setup","preflight"];function mB({onNext:e,onBack:t,onSkip:i}){var h;const n=Ee({queryKey:nC,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:Nl("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(fe,{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(Ko,{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":pB(d.state),...d.fix===null?{}:{action:o.jsx(d_,{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 pB(e){return e==="ok"?"ok":e==="warn"?"atenção":"falha"}function aC(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 _B({workspaceId:e,onNext:t,onBack:i,onSkip:n}){const a=We(),[c,h]=j.useState(""),d=aC(c.trim()),f=Ee({queryKey:["project","inspect",d],queryFn:()=>ie.project.inspect.query({path:d}),enabled:d.startsWith("/")||d.startsWith("~"),retry:!1}),p=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:Nl("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:p.isPending,pending:"validando…"},onSubmit:()=>{if(v!==null){t({projectId:v.id,projectPath:d});return}p.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:p.isError?p.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:p.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(Ko,{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 gB({projectId:e,agentConfigId:t,onNext:i,onBack:n,onSkip:a}){const c=We(),[h,d]=j.useState("primeira-tarefa"),[f,p]=j.useState(!0),g=aC(h.trim()),v=Ee({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 w;return f&&t!==void 0&&(w=(await ie.session.createAgent.mutate({scopeType:"worktree",scopeId:x.id,agentConfigId:t})).id),{worktree:x,sessionId:w}},onSuccess:async({worktree:x,sessionId:w})=>{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:w!==void 0,...w===void 0?{}:{sessionId:w}})}}),S=v.data;return o.jsxs(vn,{eyebrow:Nl("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(_2,{label:"o que abre junto",children:[o.jsx(vS,{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(Ge,{tone:"agent",children:"◆"}),selected:f&&t!==void 0,onSelect:()=>p(!0),disabled:t===void 0}),o.jsx(vS,{title:"Só a worktree",description:"Cria a pasta e a branch. Você abre sessão quando quiser.",glyph:o.jsx(Ge,{tone:"shell",children:"●"}),selected:!f||t===void 0,onSelect:()=>p(!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 vB({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 yB({onNext:e,onBack:t}){var f;const i=We(),[n,a]=j.useState("pessoal"),c=Ee({queryKey:nC,queryFn:()=>ie.setup.preflight.query(),refetchOnWindowFocus:!1}),h=He({mutationFn:()=>ie.workspace.create.mutate({name:n.trim()}),onSuccess:async p=>{await i.invalidateQueries({queryKey:mr}),e({workspaceId:p.id,workspaceName:p.name})}}),d=(f=c.data)==null?void 0:f.paths;return o.jsxs(vn,{eyebrow:Nl("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:p=>a(p.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 Om=["welcome","machine","agent","handshake","workspace","project","task","done"];function bB({daemonVersion:e,daemonUnreachable:t,onFinish:i}){const[n,a]=j.useState("welcome"),[c,h]=j.useState({}),[d,f]=j.useState([]),p=Om.indexOf(n),g=j.useCallback(E=>{a(E),window.scrollTo(0,0)},[]),v=j.useCallback(E=>{E!==void 0&&h(D=>({...D,...E}));const L=Om[p+1];L!==void 0&&g(L)},[g,p]),b=j.useCallback(()=>{const E=Om[p-1];E!==void 0&&g(E)},[g,p]),S=j.useCallback(()=>{if(f(E=>E.includes(n)?E:[...E,n]),n==="agent"){f(E=>E.includes("handshake")?E:[...E,"handshake"]),g("workspace");return}v()},[v,g,n]);j.useEffect(()=>{const E=L=>{L.key==="Escape"&&b()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[b]);const x=rC(n),w=j.useMemo(()=>x===null?null:o.jsx(v2,{steps:iC,current:x}),[x]);return o.jsx("div",{className:"flow",children:o.jsxs("div",{className:"wizard",children:[w,k()]})});function k(){switch(n){case"welcome":return o.jsx(vB,{daemonVersion:e,daemonUnreachable:t,onStart:()=>v()});case"machine":return o.jsx(mB,{onNext:()=>v(),onBack:b,onSkip:S});case"agent":return o.jsx(oB,{onNext:()=>v(),onBack:b,onSkip:S});case"handshake":return o.jsx(fB,{onNext:E=>v(E),onBack:b,onSkip:S});case"workspace":return o.jsx(yB,{onNext:E=>v(E),onBack:b});case"project":return o.jsx(_B,{workspaceId:c.workspaceId,onNext:E=>v(E),onBack:b,onSkip:S});case"task":return o.jsx(gB,{projectId:c.projectId,agentConfigId:c.agentConfigId,onNext:E=>v(E),onBack:b,onSkip:S});case"done":return o.jsx(uB,{result:c,skipped:d,onOpen:()=>i(c),onReview:()=>g("welcome")})}}}function SB(){var K;const e=We(),[t,i]=j.useState(null),[n,a]=j.useState(null),[c,h]=j.useState(void 0),[d,f]=j.useState(null),[p,g]=j.useState(!1),[v,b]=j.useState(null),S=rB(),x=EA(),w=sB(),k=Ee({queryKey:["health"],queryFn:()=>ie.health.query(),refetchInterval:5e3,retry:!1}),E=Ee({queryKey:mr,queryFn:()=>ie.workspace.list.query()}),{activeId:L,select:D}=G5(E.data??[]);return j.useEffect(()=>{n!==null||!E.isSuccess||a(E.data.length===0)},[n,E.isSuccess,E.data]),Z5(),o.jsx(h3,{children:o.jsx(WO,{children:o.jsxs("div",{className:"app",children:[o.jsx(aB,{version:((K=k.data)==null?void 0:K.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 le,oe;if(E.isPending)return o.jsx("div",{className:"pane",children:o.jsx(di,{label:"conectando ao daemon"})});if(E.isError)return o.jsx("div",{className:"pane",children:o.jsx("p",{role:"alert",children:E.error.message})});if(n===null)return o.jsx("div",{className:"pane",children:o.jsx(di,{label:"conectando ao daemon"})});if(n||E.data.length===0||L===null)return o.jsx(bB,{daemonVersion:((le=k.data)==null?void 0:le.version)??null,daemonUnreachable:k.isError,onFinish:async q=>{await e.invalidateQueries({queryKey:mr}),q.workspaceId!==void 0&&D(q.workspaceId),h(q.sessionId),q.projectId!==void 0&&i({projectId:q.projectId,scope:q.worktreeId===void 0?{scopeType:"project",scopeId:q.projectId}:{scopeType:"worktree",scopeId:q.worktreeId}}),a(!1)}});const X=E.data,z=((oe=X.find(q=>q.id===L))==null?void 0:oe.name)??"";return o.jsxs(o.Fragment,{children:[o.jsx(nB,{fill:!0,right:$(),rightWidth:x.width,sidebar:o.jsxs(o.Fragment,{children:[o.jsx(W5,{workspaces:X,activeId:L,onSelect:q=>{D(q),i(null)}}),o.jsx(P5,{workspaceId:L,expansion:S,selection:{scopeType:(t==null?void 0:t.scope.scopeType)??null,scopeId:(t==null?void 0:t.scope.scopeId)??null},onSelect:(q,P)=>i({projectId:q,scope:P}),onAddProject:()=>g(!0),onCreateWorktree:b}),o.jsx("div",{className:"sidebar__foot",children:o.jsx(qT,{})})]}),children:Z(L,z)}),o.jsx(E2,{workspaceId:L,workspaceName:z,open:p,onClose:()=>g(!1),onRequestOpen:()=>g(!0),onAdded:q=>i({projectId:q,scope:{scopeType:"project",scopeId:q}})}),v!==null&&o.jsx(a3,{projectId:v.id,projectName:v.name,hasCommits:v.hasCommits,open:!0,onClose:()=>b(null),onOpenExisting:q=>{S.expand(v.id),i({projectId:v.id,scope:{scopeType:"worktree",scopeId:q}}),b(null)},onCreated:q=>{S.expand(v.id),i({projectId:v.id,scope:{scopeType:"worktree",scopeId:q}}),b(null)}},v.id)]})}function $(){if(!(t===null||!x.open))return o.jsx(i3,{scope:t.scope,onClose:x.toggle,onResize:x.setWidth,onAskAgent:(X,z)=>{f({sessionId:X,text:z}),h(X)},dock:tB(w,x)},`${t.scope.scopeType}:${t.scope.scopeId}`)}function Z(X,z){if(t===null)return o.jsx(AO,{workspaceId:X,workspaceName:z,onRemoved:async()=>{await e.invalidateQueries({queryKey:mr})}},X);const{projectId:le,scope:oe}=t;return oe.scopeType==="worktree"?o.jsx(V5,{worktreeId:oe.scopeId,projectId:le,openSessionId:c,initialPrompt:d??void 0,workspaceName:z,filesPanel:x,onRemoved:()=>i({projectId:le,scope:{scopeType:"project",scopeId:le}}),onOpenWorkspace:()=>i(null),onOpenProject:()=>i({projectId:le,scope:{scopeType:"project",scopeId:le}})},oe.scopeId):o.jsx(z5,{projectId:le,workspaceId:X,workspaceName:z,openSessionId:c,initialPrompt:d??void 0,filesPanel:x,onRemoved:()=>i(null),onOpenWorkspace:()=>i(null),onSelectWorktree:q=>i({projectId:le,scope:{scopeType:"worktree",scopeId:q}})},le)}}const xB={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};async function wB(e=xB){}function CB(){return new lE({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})}const lC=document.getElementById("root");if(!lC)throw new Error("#root not found in index.html");const jB=bE.createRoot(lC);jB.render(o.jsx(j.StrictMode,{children:o.jsx(cE,{client:CB(),children:o.jsx(SB,{})})}));wB();export{AB as a,Bt as c,OB as s};